Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename hideContainerWhenNoResults to autoHideContainer #407

Closed
4 tasks done
vvo opened this issue Nov 2, 2015 · 5 comments · Fixed by #475
Closed
4 tasks done

rename hideContainerWhenNoResults to autoHideContainer #407

vvo opened this issue Nov 2, 2015 · 5 comments · Fixed by #475
Assignees

Comments

@vvo
Copy link
Contributor

vvo commented Nov 2, 2015

As proposed by @jerskouille in #394

TODO:

  • always use facet values count to hide the container when relevant
  • use nbHits if facet values not relevant
  • handle cases were we have only null facet values
  • also to be used in API proposal: clearAll #405 clearAll proposals where we hide when no refinements WERE made (vs no facet values available in the algolia response)
@pixelastic
Copy link
Contributor

After discussions in #394 and #427 it seems that we are going to remove the autoHideWhenNoResults and autoHideWhenNoRefinements options for several widgets and replace them with a more generic autoHideContainer.

I think autoHideContainer sound to magical for the naming of a public-facing API attribute. What it does is really dependent on the widget context. I would use hdieContainerIfNoResults for widgets displaying results, and hideContainerIfNoRefinements for the clearAll widget. Explicit is better.

It does not change the fact that the underlying autoHideContainer decorator can use a autoHideContainer:true/false props itself, but the public-facing widget option should be self-explanatory.

@vvo
Copy link
Contributor Author

vvo commented Nov 5, 2015

I would say on this one (always using autoHideContainer) should not harm the users or make them wonder what is hapening. I agree I like being explicit most of the time but here what I want is "Hide this when it makes sense", being explicit introduces more naming conflicts.

clearAll widget needs an option to say "hide the container when no refinements were made", thus if we introduce both hideContainerIfNoResults and hideContainerIfNoRefinements, how do we name the "hide the container when no refinements were made"?

We would then need:

  • hideContainerIfNoResults
  • hideContainerIfNoFacetValues
  • hideContainerIfNoNumericalRefinements (sliders)
  • hideContainerIfNoRefinements (= no refinement were made, clearAll)

And we would be exhaustive, but that's a lot of options to remember for the "hide this when it make sense" usecase, while "autoHideContainer" could solve the three first cases.

I would still go for autoHideContainer

@Jerska
Copy link
Member

Jerska commented Nov 5, 2015

This actually allowed us to not worry about some namings:

  • For facetting widgets, we'd use hideWhenNoRefinements when there is no available refinement to select.
  • For currentRefinedValues and clearAll, we also want hideWhenNoRefinements, but these refinements are the currently selected ones

Our widget are already "intelligent" by doing a lot of logic, and I like the idea that a widget knows when it's best to be hidden or show and allow the user to customize it with something like #455 .

In the end the markup generated and cssClasses are kind of magical too. But as soon as we document them they become part of the widget and it's easy to understand, don't you think that a clear documentation would be enough for this too?

@pixelastic
Copy link
Contributor

Ok, I was missing some pieces, I thought there was only two cases. Makes sense with your explanation. Having a unified and maigical autoHideContainer options is also nice from our user POV, where we do not want them to dive too deep into the world of refinement and facets.

LGTM, then

@vvo
Copy link
Contributor Author

vvo commented Nov 5, 2015

doing this right now so we can handle #427

@vvo vvo self-assigned this Nov 5, 2015
@vvo vvo added the in progress label Nov 5, 2015
vvo pushed a commit that referenced this issue Nov 5, 2015
+ updated jsdoc
+ updated some widgets algorithm to hide/show (numeric widgets)
+ had to rename the decorators require to $decoratorHOC (High Order
Component, the pattern we use).

fixes #407

BREAKING CHANGE: use autoHideContainer instead of
hideContainerWhenNoResults
vvo pushed a commit that referenced this issue Nov 5, 2015
+ updated jsdoc
+ updated some widgets algorithm to hide/show (numeric widgets)
+ had to rename the decorators require to $decoratorHOC (High Order
Component, the pattern we use).

fixes #407

BREAKING CHANGE: use autoHideContainer instead of
hideContainerWhenNoResults
vvo pushed a commit that referenced this issue Nov 5, 2015
+ updated jsdoc
+ updated some widgets algorithm to hide/show (numeric widgets)
+ had to rename the decorators require to $decoratorHOC (High Order
Component, the pattern we use).

fixes #407

BREAKING CHANGE: use autoHideContainer instead of
hideContainerWhenNoResults
@vvo vvo closed this as completed in 3f64bef Nov 6, 2015
vvo pushed a commit that referenced this issue Nov 6, 2015
<a name="0.10.0"></a>
# [0.10.0](v0.9.0...v0.10.0) (2015-11-06)

### Bug Fixes

* **api:** rename hideContainerWhenNoResults to autoHideContainer ([3f64bef](3f64bef)), closes [#407](#407)
* **doc:** ensure the documentation content doesn't overflow ([1e28a4e](1e28a4e)), closes [#444](#444)
* **hitsPerPageSelector:** Be more tolerant in options ([e14a344](e14a344))
* **numeric widgets:** synchronizes rounded value between widgets ([b314160](b314160))
* **numeric-refinement:** Replace Array.find with lodash find/includes ([b3e815c](b3e815c))
* **price-ranges:** makes it uses same operator as the slider ([ad6f5c2](ad6f5c2))
* **range-slider:** fixes bound definition ([e15c9b7](e15c9b7))
* **selector:** makes component as uncontrolled component ([1dda12a](1dda12a))
* **slider:** fixed `pip` propTypes constraint ([c77b7f4](c77b7f4))
* **website:** fix images path ([a3f62eb](a3f62eb))

### Features

* **searchBox:** ability to be non-instant ([b3ef871](b3ef871)), closes [#458](#458)
* **toggle:** Allow custom on/off values ([9b6c2bf](9b6c2bf)), closes [#409](#409)

### Performance Improvements

* **hitsPerPageSelector:** Use the correct lodash function ([be9aea7](be9aea7))

### BREAKING CHANGES

* api: use autoHideContainer instead of
hideContainerWhenNoResults
@vvo vvo removed the in progress label Nov 6, 2015
maxiloc added a commit that referenced this issue Nov 10, 2015
<a name="0.11.0"></a>
# 0.11.0 (2015-11-10)

### Bug Fixes

* add missing 'use strict's ([397294e](397294e))
* add title for brands ([2e67c47](2e67c47))
* allow adding css classes to the searchBox wrapper ([6ef0b0b](6ef0b0b)), closes [#22](#22) [#24](#24)
* allow html in pagination labels ([4147358](4147358)), closes [#36](#36)
* Allow not specifying `cssClass` on index selector ([4e9324f](4e9324f))
* allow passing only one key of transformData as an object ([e0ce89f](e0ce89f))
* Handle plural forms in template ([1bfd109](1bfd109))
* **transformData:** add an explicit error message ([94c53d3](94c53d3)), closes [#212](#212)
* cap the number of page displayed ([bc6c2e2](bc6c2e2))
* change no results message ([80acf33](80acf33))
* do not use memoize & co ([32c64e6](32c64e6))
* expose main dist/ instead of index.js ([98bd889](98bd889))
* Fix merge issues ([3b5e8f4](3b5e8f4))
* fixed hits display height, no more scroll jumps ([6b4319d](6b4319d))
* folder requires uses a trailing / to ease recognition of /index.js ([3ef55a3](3ef55a3))
* Handle zero, one and many ([5434ca2](5434ca2))
* hits widget should allow hitsPerPage configuration, pagination should not ([a2221a8](a2221a8))
* instantSearch => instantsearch ([bdcbf18](bdcbf18)), closes [#7](#7)
* **api:** rename hideContainerWhenNoResults to autoHideContainer ([3f64bef](3f64bef)), closes [#407](#407)
* **autohide:** Rename attribute to `hideContainerWhenNoResults` ([ecb6756](ecb6756)), closes [#325](#325)
* **bem:** Make scss mixins actually follow BEM ([fcfb408](fcfb408))
* **core:** recursively merge arrays in searchParameters ([dbadcdb](dbadcdb)), closes [#80](#80)
* **cssClasses:** Fixed duplication of classNames ([e193f45](e193f45)), closes [#388](#388)
* **doc:** add doctype were missing ([86a18aa](86a18aa))
* **doc:** All wigdets in docs are not anymore linked together #fix #446 ([4361320](4361320)), closes [#446](#446)
* **doc:** bolder font for the navigation ([64f6d56](64f6d56))
* **doc:** ensure the documentation content doesn't overflow ([1e28a4e](1e28a4e)), closes [#444](#444)
* **doc:** new color scheme ([deccc17](deccc17))
* **doc:** only show a scrollbar when needed ([f2d955b](f2d955b))
* **example:** Example searchbox ([cdad6c7](cdad6c7)), closes [#157](#157)
* **generateRanges:** avoid any infinite loop. Fix #351 ([4965222](4965222)), closes [#351](#351)
* **hideIfEmpty:** should be hideWhenNoResults ([21877a0](21877a0))
* **hierarchical:** setPage 0 when toggling ([a976539](a976539)), closes [#371](#371)
* **hierarchicalFacets:** use a real attribute name for the hierarchicalFacet name ([0d2a455](0d2a455))
* **hierarchicalMenu:** handle cases where no results after a search ([0a1d0ac](0a1d0ac)), closes [#385](#385)
* **hits:** Fix warning about unique key in iterator ([0c9468c](0c9468c))
* **Hits:** handle the display when there is no result ([544ff5c](544ff5c))
* **hitsPerPageSelector:** Be more tolerant in options ([e14a344](e14a344))
* **hitsPerPageSelector:** Issue when state did not have a `hitsPerPage` ([dc9371c](dc9371c))
* **index-selector:** Fix tests passing with incorrect parameters ([8fc31b9](8fc31b9))
* **index-selector:** Update usage and error ([a7e4c10](a7e4c10))
* **InstantSearch:** throw error when init and render are not defined. Fixes #499 ([2830cd3](2830cd3)), closes [#499](#499)
* **jsdoc:** use babel-node ([453dc21](453dc21))
* **live-doc:** adds a start at a responsive display ([c83967e](c83967e))
* **live-doc:** adds navigation menu for smaller screens ([a6bb71e](a6bb71e))
* **live-doc:** fixes flow for texts ([3855071](3855071))
* **live-doc:** generates missing ul ([b43e6e2](b43e6e2))
* **live-doc:** Momentum scroll for iPhone ([60a36ff](60a36ff))
* **live-doc:** move scrollbars, removes useless ones ([548ae5f](548ae5f))
* Pass nbHits, hitsPerPage, nbPages and page to Stats widget ([deefd23](deefd23)), closes [#106](#106)
* **live-doc:** moves octocat link to top. Removes stackOverflow ([8ff6a79](8ff6a79))
* **live-doc:** Moves version in the main content ([27731c3](27731c3))
* **live-doc:** uses only h4 and fixes style of h4 (mobile) ([0fdd2d0](0fdd2d0))
* **live-reload:** integrates the links into the menu flow ([c118051](c118051))
* **menu:** send an empty array values when no values ([12cd7dc](12cd7dc)), closes [#107](#107)
* **middle-click:** Allow middle click on links ([a7601c0](a7601c0))
* **multipleChoiceList:** `limit` should be pure JS ([68bdf81](68bdf81))
* **numeric widgets:** synchronizes rounded value between widgets ([b314160](b314160))
* **numeric-refinement:** Replace Array.find with lodash find/includes ([b3e815c](b3e815c))
* **numerical widgets:** s/facetName/attributeName ([f209f5d](f209f5d)), closes [#431](#431)
* **onClick:** do not replace the browser's behavior on special clicks ([8562d49](8562d49)), closes [#278](#278)
* **package.json:** typo in repository ([33cf196](33cf196))
* **pagination:** do not generate the URL for disabled pages. ([e5d78ab](e5d78ab)), closes [#282](#282)
* **pagination:** handle cases where maxPages is low ([d3c9959](d3c9959)), closes [#100](#100)
* **pagination:** missing showFirstLast attribute when instanciating ([28fa0ae](28fa0ae))
* **poweredBy:** Extract its hiding capabilities ([f5fa9ee](f5fa9ee)), closes [#189](#189)
* **price-ranges:** makes it uses same operator as the slider ([ad6f5c2](ad6f5c2))
* **priceRanges:** fixed 'active' CSS class not using BEM ([ec0d1b1](ec0d1b1))
* **priceRanges:** plug the URL computation. Fix #354 ([fbf4022](fbf4022)), closes [#354](#354)
* **range-slider:** fixes bound definition ([e15c9b7](e15c9b7))
* **range-slider:** Use lodash find instead of Array.prototype.find ([056153c](056153c))
* **rangeSlider:** refinements cleanuo ([16c132c](16c132c)), closes [#147](#147)
* **rangeSlider:** restore wrongly removed state nesting ([3ed3d39](3ed3d39))
* **React:** require React in order for JSX to work in widgets ([64d6011](64d6011))
* **react-nouislider:** upgrade react-nouislider to avoid mutating props ([1b7cd1d](1b7cd1d))
* **refinementList:** ensure the key reflects the underlying state ([b048f0b](b048f0b)), closes [#398](#398)
* **refinementList:** Remove `singleRefine` attribute ([db73e38](db73e38)), closes [#220](#220)
* **refinementList:** singleRefine is not dependant from operator ([d29dff6](d29dff6))
* **RefinementList:** click on child should not click on parent ([d476da2](d476da2)), closes [#191](#191)
* **search-box:** Fix #137 autofocus must be configurable ([51f01be](51f01be)), closes [#137](#137)
* **searchBox:** allow searchBox to reuse an `<input>` ([e820cc3](e820cc3))
* **searchBox:** do not update input's value if focused ([0e85f0d](0e85f0d)), closes [#163](#163)
* **searchBox:** handling pasting event with contextual menu. ([a172458](a172458)), closes [#467](#467)
* **searchBox:** Use `hasAttribute` instead of `getAttribute` ([a122af9](a122af9))
* **SearchBox:** Missing poweredBy in the not focused SearchBox ([ef695ff](ef695ff))
* **selector:** makes component as uncontrolled component ([1dda12a](1dda12a))
* **slider:** allow handles to reach the real start and end of the slider ([03ed3f5](03ed3f5))
* **slider:** fix tap event throwing ([d906d3e](d906d3e)), closes [#120](#120)
* **slider:** fixed `pip` propTypes constraint ([c77b7f4](c77b7f4))
* **slider:** hide slider if when no hits/matches ([31e4a80](31e4a80)), closes [#107](#107)
* **Slider:** cssClasses.body handled by headerFooter HOC ([d8d20b2](d8d20b2))
* **stats:** Move CSS classes definition to widget from component ([99073cd](99073cd))
* **template:** throw when no way to deal with the template type ([f5d151a](f5d151a))
* **template:** transformData checks too strict ([609f123](609f123)), closes [#347](#347)
* **Template:** add default value for template ([4291014](4291014))
* **templatesConfig:** helpers are now following Mustache spec ([8f3502f](8f3502f))
* **transformData:** this test is not needed, already covered by Template ([36e5b9c](36e5b9c))
* **url-sync:** handle both hash and query parameter fix #165 ([8d84de6](8d84de6)), closes [#165](#165)
* **url-sync:** make input not to lose focus ([63488d3](63488d3))
* **validate-commit:** Update the regexp ([96b93ba](96b93ba))
* **website:** defered doc scripts ([0c1324f](0c1324f))
* **website:** doc layout responsive ([a4dc894](a4dc894))
* **website:** fix images path ([a3f62eb](a3f62eb))
* **website:** fixed space overlay color animation ([200b8a7](200b8a7))
* **website:** Fixes & responsive stuff for doc ([7a8f920](7a8f920))
* **website:** footer markup ([95364a1](95364a1))
* **website:** home.js lint ([b70e06e](b70e06e))
* **website:** icon-theme didn't like svgo (to fix) ([38d84af](38d84af))
* **website:** image alt ([30cca29](30cca29))
* **website:** jsdelivr for every scripts ([06591d4](06591d4))
* **website:** Nav Icon + logo ([c1f419c](c1f419c))
* **website:** only load what's needed in bootstrap ([4843474](4843474))
* Use `appId` and `apiKey` keys ([5716552](5716552))
* **website:** removed animation debug ([01ac079](01ac079))
* Keep `en-EN` as demo default ([6c2a043](6c2a043))
* More explicit error message when DOM selector is invalid ([d36a2ad](d36a2ad)), closes [#105](#105)
* no more needed to override css class here ([2b314c0](2b314c0))
* no need for a flag in refinementList refine() ([9b8fa3f](9b8fa3f))
* no state needed for Hogan component ([d8a3a4c](d8a3a4c))
* react-nouislider will live in our repo for now ([49520f1](49520f1))
* reduce the dependency between REACT components and helper ([9309a4c](9309a4c))
* Remove `htmlAttribute` in favor of `cssClass` ([59a0bc5](59a0bc5))
* remove data-role from searchBox ([bdfe6d3](bdfe6d3))
* remove linebreak ([e5f1720](e5f1720))
* rename BEM root algolia-magic to as ([5f3329d](5f3329d)), closes [#24](#24)
* rename results component to hits ([7b9eb25](7b9eb25))
* Set `cssClass` as optional in documentation ([e7ac953](e7ac953))
* set visibility:hidden by default for uneeded pagination links ([19fddba](19fddba)), closes [#37](#37)
* strict container check ([ec23e34](ec23e34))
* switch back to divs, rendering glitch ([b44943a](b44943a))
* toggleRefine was no more working ([e6e35df](e6e35df))
* update algoliasearch and algoliasearch-helper ([e944d12](e944d12))
* upgrade all libs, switch to ^ dependencies ([79d0a64](79d0a64))
* use cssClass instead of inputClass or addClass ([6826bd6](6826bd6))
* use toggleRefinement ([b497b02](b497b02))
* widgets.searchbox => widgets.searchBox ([6c49e18](6c49e18))
* wrap in an li the checkbox ([dfe629d](dfe629d))
* **website:** space bg fadeIn ([5e09844](5e09844))
* **website:** unclosed content block ([d42dc3e](d42dc3e))

### Features

* Add `htmlAttributes` to indexSelector ([ceed8ae](ceed8ae))
* Add stats widget ([8290542](8290542))
* Add support for `className` ([898a2fa](898a2fa))
* Add Toggle example ([d801807](d801807))
* Check that currentIndex is in indices list ([494dbe9](494dbe9))
* example now uses the instant_search index ([63b4b50](63b4b50))
* expose instantsearch.version ([ae5ef94](ae5ef94))
* expose instantsearch() as main init method ([27baf55](27baf55)), closes [#6](#6)
* formatNumber in Stats widget ([cf6a83c](cf6a83c))
* hierarchicalWidget ([1facd9d](1facd9d))
* **url-sync:** Add `is_v` version to url ([9f597a0](9f597a0)), closes [#70](#70)
* indexSelector widget ([b60ed36](b60ed36))
* multipleChoiceList => refinementList ([423542d](423542d)), closes [#64](#64)
* multipleChoiceList first iteration ([bc91bfb](bc91bfb))
* MutlipleChoiceList second pass ([ac74dfb](ac74dfb))
* pagination component ([fad2720](fad2720))
* pimp the npm run dev example using instant search data ([ea666ad](ea666ad)), closes [#20](#20)
* **bem:** Add BEM to the index-selector widget ([564da51](564da51))
* **bem:** Add BEM-styling to the Stats widget ([92cebeb](92cebeb))
* **build:** Add minified CSS theme version to build ([77f0640](77f0640))
* **build:** allow building React based custom widgets ([cfbbfe4](cfbbfe4)), closes [#373](#373)
* **core/lifecycle-event:** emits `render` when render ([7f03ae9](7f03ae9))
* **es7:** Enable `es7.objectRestSpread` ([fc2fbc4](fc2fbc4))
* **examples:** try examples instead of themes ([bedffce](bedffce))
* **headerFooter:** Add BEM classes to header and footer ([9e9d438](9e9d438)), closes [#259](#259)
* **headerFooter:** Only add markup if a template is defined ([7a2d22d](7a2d22d)), closes [#370](#370)
* **hierarchical-menu:** Add BEM classes ([58ec191](58ec191))
* **hierarchical-menu:** Add CSS classes dependent on the depth ([1256ea8](1256ea8))
* **hierarchicalMenu:** Adding indentation with default theme ([34885d2](34885d2))
* **hits:** Add BEM styling to the `hits` widget ([6681960](6681960))
* **hits-per-page-selector:** New widget to change hitsPerPage ([a3e0f78](a3e0f78)), closes [#331](#331)
* **menu:** Add BEM classes ([467f49e](467f49e))
* **menu:** first widget version ([a888143](a888143))
* **menu,refinementList:** add header/item/footer templating solution ([58275dc](58275dc)), closes [#101](#101)
* **numericRefinementList:** create numericRefinementList widget using refinementList component ([a29e9c7](a29e9c7))
* **pagination:** add `scrollTo` option ([e6cd621](e6cd621)), closes [#73](#73)
* **pagination:** add hitsPerPage and maxPages options ([7e558ce](7e558ce))
* **priceRanges:** Add BEM classes and tests ([ad58d7a](ad58d7a)), closes [#387](#387)
* **priceRanges:** new Amazon-style price ranges widget ([e5fe344](e5fe344))
* **priceRanges:** polish priceRanges widget ([0994e6f](0994e6f))
* **rangeSlider:** add headerFooter decorator ([19090c3](19090c3))
* **refinement-list:** Add BEM naming ([b09b830](b09b830))
* **refinementlist:** Move default templates to its own file ([cb6fa16](cb6fa16))
* **refinementList:** Limits improvement ([ebcc8a9](ebcc8a9))
* **searchbox:** Make the searchBox BEMish ([db8bd60](db8bd60))
* **searchBox:** ability to be non-instant ([b3ef871](b3ef871)), closes [#458](#458)
* **searchBox:** Add `wrapInput` option ([b327dbc](b327dbc))
* **searchBox:** add headerFooter decorator to the Component ([5974a88](5974a88))
* **searchBox:** add poweredBy option, disabled by default ([c9da165](c9da165))
* **slider:** allow overriding css classes from a user stylesheet ([a1e87dd](a1e87dd))
* **slider:** first iteration ([229bb02](229bb02))
* **slider:** second iteration ([885aff6](885aff6))
* **stats:** add query variable to the template ([75f457d](75f457d))
* **templatesConfig:** helpers and options transferred to Template ([456d781](456d781)), closes [#99](#99)
* **theme:** Add `searchBox` widget to default theme ([def831f](def831f))
* **theme:** Add debug.css file ([ff8f2dc](ff8f2dc)), closes [#249](#249)
* **theme:** Move `indexSelector` styling to default.css ([1841ef1](1841ef1))
* **theme:** Move all default css rules to `default.css` ([57c8c65](57c8c65))
* **toggle:** add headerFooter decorator ([8a70c7d](8a70c7d))
* **toggle:** Adding BEM class naming ([8730c97](8730c97))
* **toggle:** Allow custom on/off values ([9b6c2bf](9b6c2bf)), closes [#409](#409)
* **transformData:** add to every widget using the Template component ([d080a03](d080a03)), closes [#116](#116)
* **transformData:** refinementList + menu implementation ([0a0e36e](0a0e36e))
* Switch/Toggle widget ([3b2a450](3b2a450))
* Use `helpers.formatNumber` syntax instead of `_formatNumber` ([6207514](6207514))
* Warn users if we do not override `helpers` in templates ([a4199a5](a4199a5))
* **urls:** ability to create an URL from a set of params ([9ca8369](9ca8369)), closes [#372](#372)
* **urlSync:** add urlSync widget ([50fc4ce](50fc4ce))
* **urlSync:** url generation for widget links. Fix #29 ([23dd505](23dd505)), closes [#29](#29)
* **widgets:** auto hide some widgets ([187b4bd](187b4bd))

### Performance Improvements

* **hitsPerPageSelector:** Use the correct lodash function ([be9aea7](be9aea7))

### BREAKING CHANGES

* hierarchicalMenu: Hierarchical menu levels 1 and 2 now have
a margin-left added in the default theme.
* menu,refinementList: Removed from menu and refinementList:
- rootClass => cssClasses.root
- itemCLass => cssClasses.item
- template => templates.item

Added to menu and refinementList:
- cssClasses{root,list,item}
- templates{header,item,footer}
- widget (container) is automatically hidden by default
- hideWhenNoResults=true

This was done to allow more templating solutions like discussed in #101.
* numerical widgets: the priceRanges and rangeSlider widgets are now using `attributeName` instead of `facetName`.
* priceRanges: `ais-price-ranges--range` are now named
`ais-price-ranges--item` and are wrapped in
a `ais-price-ranges--list`.

I've moved the bottom form into it's own PriceRangesForm component,
along with its own tests. I've fixed a minor typo where the component
was internally named PriceRange (without the final __s__).

I factorize some logic form the render in individual methods and
manage to individually test them. This was not an easy task. I had to
mock the default `render` (so it does nothing) before instanciating
the component. Then, I was able to call each inner method
individually. This requires to stub prototype methods in beforeEach,
then restore them in afterEach. I've added a few helper methods, this
can surely be simplified again but this gives nice granularity in
testing.

I've renamed the `range` items to `item` and wrapped them in a `list`.
I've also added classes to all elements we add (`label`, `separator`,
etc). I've removed the empty `span`s.
* headerFooter: The `<div class="ais-header">` and `<div
class="ais-footer">` markup is only added when
a `templates.{header,footer}` is passed.
* urls: the instantsearch.createURL method is now taking a
simple JS object and not a SearchParameter instance anymore.
* searchBox: The `input` used by the search-box widget is now
wrapped in a `<div class="ais-search-box">` by default. This can be
turned off with `wrapInput: false`.

This PR is a bit long, I had to do some minor refactoring to keep the
new code understandable. I simply split the large `init` method into
calls to smaller methods.

There is some vanilla JS DOM manipulation involved to handle all the
possible cases: targeting an `input` or a `div`, adding or not the
`poweredBy`, adding or not the wrapping div.

Note that there is no `targetNode.insertAfter(newNode)` method, so
I had to resort to the old trick of `parentNode.insertBefore(newNode,
targetNode.nextSibling)`.
* priceRanges: the `input-group` modifier has been renamed to `form`
* autohide: Widget attribute is now named
`hideContainerWhenNoResults` instead of `hideWhenNoResults` to be more
explicit on what it is really doing.

Also internally renamed the `autoHide` decorator to
`autoHideContainer`
* build: You should now include the `default.css` file in your
page to get the default styling.

- Added `clean-css` as minifier
- Updated build script
- Updated documentation about loading it from jsdeliver
- `npm shrinkwrap` madness
* hits: The hit template and transform data key is renamed
from `hit` to `item` to stay consistent with the other widgets
* api: use autoHideContainer instead of
hideContainerWhenNoResults
* stats: `cssClasses.root` now applies to the main root
element (above header and footer) and no longer to the template
wrapper. To style the template wrapper, use `cssClasses.body`
* theme: Classes are now named `ais-index-selector` and
`ais-index-selector--item` to stay consistent with other widgets.

Updated tests as well. Widget is responsible for adding default
classes + user-defined ones. Then component simply add them to the
markup.
* theme: "Powered by" styles are now
`ais-search-box--powered-by` and `ais-search-box--powered-by-link`.
* urlSync: urlSync is not a widget anymore. It's now an option of
instantsearch(appID, apiKey, opts);. See the README.md for more info.
* searchbox: The `searchBox` widget now expect
a `cssClasses.{input, poweredBy}`
* bem: We now use a `span.ais-stats--time` instead of
a `small` tag in the stats widget.
* bem: We now use `cssClasses.select` and
`cssClasses.option` instead of `cssClass` for the index-selector
widget.
* toggle: S:
- toggle: removed template
* searchBox: - removed: inputClass
* menu: The default template now has the count element inside
the link, not outside.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants