@searchspring/snap-preact-components 0.60.4 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -144,8 +144,9 @@ function List(properties) {
144
144
  (0, react_1.jsx)("div", __assign({}, styling, { className: (0, classnames_1.default)('ss__list', disabled ? 'ss__list--disabled' : '', className) }),
145
145
  titleText && (0, react_1.jsx)("h5", { className: "ss__list__title" }, titleText),
146
146
  (0, react_1.jsx)("ul", { className: "ss__list__options", role: "listbox", "aria-label": titleText }, options.map(function (option) {
147
+ var _a;
147
148
  var selected = selection.some(function (select) { return select.value == option.value; });
148
- return ((0, react_1.jsx)("li", { className: (0, classnames_1.default)("ss__list__option ss__list__option--".concat(snap_toolbox_1.filters.handleize(option.value.toString())), {
149
+ return ((0, react_1.jsx)("li", { className: (0, classnames_1.default)("ss__list__option ss__list__option--".concat(snap_toolbox_1.filters.handleize((_a = option.value) === null || _a === void 0 ? void 0 : _a.toString())), {
149
150
  'ss__list__option--selected': selected,
150
151
  'ss__list__option--disabled': option === null || option === void 0 ? void 0 : option.disabled,
151
152
  'ss__list__option--unavailable': (option === null || option === void 0 ? void 0 : option.available) === false,
@@ -152,14 +152,15 @@ function Swatches(properties) {
152
152
  };
153
153
  return typeof options == 'object' && (options === null || options === void 0 ? void 0 : options.length) ? ((0, react_1.jsx)(providers_1.CacheProvider, null,
154
154
  (0, react_1.jsx)("div", __assign({}, styling, { className: (0, classnames_1.default)('ss__swatches', className) }), type == 'carousel' ? ((0, react_1.jsx)(Carousel_1.Carousel, __assign({}, subProps.carousel), options.map(function (option) {
155
+ var _a, _b;
155
156
  var label = option.label;
156
157
  var selected = (selection === null || selection === void 0 ? void 0 : selection.value) == option.value;
157
- return ((0, react_1.jsx)("div", { className: (0, classnames_1.default)("ss__swatches__carousel__swatch ss__swatches__carousel__swatch--".concat(snap_toolbox_1.filters.handleize(option.value.toString())), {
158
+ return ((0, react_1.jsx)("div", { className: (0, classnames_1.default)("ss__swatches__carousel__swatch ss__swatches__carousel__swatch--".concat(snap_toolbox_1.filters.handleize((_a = option.value) === null || _a === void 0 ? void 0 : _a.toString())), {
158
159
  'ss__swatches__carousel__swatch--selected': selected,
159
160
  'ss__swatches__carousel__swatch--disabled': option === null || option === void 0 ? void 0 : option.disabled,
160
161
  'ss__swatches__carousel__swatch--unavailable': (option === null || option === void 0 ? void 0 : option.available) === false,
161
162
  }), title: label, style: { background: option.background ? option.background : option.backgroundImageUrl ? "" : option.value }, onClick: function (e) { return !disabled && !(option === null || option === void 0 ? void 0 : option.disabled) && makeSelection(e, option); }, ref: function (e) { return (0, hooks_2.useA11y)(e); }, role: "option", "aria-selected": selected },
162
- !option.background && option.backgroundImageUrl ? ((0, react_1.jsx)(Image_1.Image, __assign({}, subProps.image, { src: option.backgroundImageUrl, alt: option.label || option.value.toString() }))) : ((0, react_1.jsx)(preact_1.Fragment, null)),
163
+ !option.background && option.backgroundImageUrl ? ((0, react_1.jsx)(Image_1.Image, __assign({}, subProps.image, { src: option.backgroundImageUrl, alt: option.label || ((_b = option.value) === null || _b === void 0 ? void 0 : _b.toString()) }))) : ((0, react_1.jsx)(preact_1.Fragment, null)),
163
164
  !hideLabels && (0, react_1.jsx)("span", { className: "ss__swatches__carousel__swatch__value" }, label || option.value)));
164
165
  }))) : ((0, react_1.jsx)(Grid_1.Grid, __assign({}, subProps.grid, { options: options, onSelect: function (e, option) {
165
166
  !disabled && makeSelection(e, option);
@@ -128,7 +128,7 @@ export function List(properties) {
128
128
  titleText && jsx("h5", { className: "ss__list__title" }, titleText),
129
129
  jsx("ul", { className: `ss__list__options`, role: "listbox", "aria-label": titleText }, options.map((option) => {
130
130
  const selected = selection.some((select) => select.value == option.value);
131
- return (jsx("li", { className: classnames(`ss__list__option ss__list__option--${filters.handleize(option.value.toString())}`, {
131
+ return (jsx("li", { className: classnames(`ss__list__option ss__list__option--${filters.handleize(option.value?.toString())}`, {
132
132
  'ss__list__option--selected': selected,
133
133
  'ss__list__option--disabled': option?.disabled,
134
134
  'ss__list__option--unavailable': option?.available === false,
@@ -166,12 +166,12 @@ export function Swatches(properties) {
166
166
  jsx("div", { ...styling, className: classnames('ss__swatches', className) }, type == 'carousel' ? (jsx(Carousel, { ...subProps.carousel }, options.map((option) => {
167
167
  const label = option.label;
168
168
  const selected = selection?.value == option.value;
169
- return (jsx("div", { className: classnames(`ss__swatches__carousel__swatch ss__swatches__carousel__swatch--${filters.handleize(option.value.toString())}`, {
169
+ return (jsx("div", { className: classnames(`ss__swatches__carousel__swatch ss__swatches__carousel__swatch--${filters.handleize(option.value?.toString())}`, {
170
170
  'ss__swatches__carousel__swatch--selected': selected,
171
171
  'ss__swatches__carousel__swatch--disabled': option?.disabled,
172
172
  'ss__swatches__carousel__swatch--unavailable': option?.available === false,
173
173
  }), title: label, style: { background: option.background ? option.background : option.backgroundImageUrl ? `` : option.value }, onClick: (e) => !disabled && !option?.disabled && makeSelection(e, option), ref: (e) => useA11y(e), role: "option", "aria-selected": selected },
174
- !option.background && option.backgroundImageUrl ? (jsx(Image, { ...subProps.image, src: option.backgroundImageUrl, alt: option.label || option.value.toString() })) : (jsx(Fragment, null)),
174
+ !option.background && option.backgroundImageUrl ? (jsx(Image, { ...subProps.image, src: option.backgroundImageUrl, alt: option.label || option.value?.toString() })) : (jsx(Fragment, null)),
175
175
  !hideLabels && jsx("span", { className: "ss__swatches__carousel__swatch__value" }, label || option.value)));
176
176
  }))) : (jsx(Grid, { ...subProps.grid, options: options, onSelect: (e, option) => {
177
177
  !disabled && makeSelection(e, option);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searchspring/snap-preact-components",
3
- "version": "0.60.4",
3
+ "version": "0.61.0",
4
4
  "description": "Snap Preact Component Library",
5
5
  "author": "Searchspring",
6
6
  "license": "MIT",
@@ -23,13 +23,13 @@
23
23
  "storybook": "start-storybook -p 6006",
24
24
  "cypress": "cypress open --project tests",
25
25
  "cypress:headless": "cypress run --component --project tests",
26
- "test": "jest; npm run cypress:headless",
26
+ "test": "jest",
27
27
  "test:watch": "jest --watch"
28
28
  },
29
29
  "dependencies": {
30
30
  "@cypress/react": "^8.0.0",
31
31
  "@emotion/react": "11.9.0",
32
- "@searchspring/snap-toolbox": "^0.60.4",
32
+ "@searchspring/snap-toolbox": "^0.61.0",
33
33
  "classnames": "^2.3.2",
34
34
  "cypress": "^13.7.1",
35
35
  "cypress-wait-until": "^1.7.2",
@@ -52,14 +52,14 @@
52
52
  "@babel/preset-env": "^7.21.4",
53
53
  "@babel/preset-react": "^7.18.6",
54
54
  "@babel/runtime": "^7.21.0",
55
- "@searchspring/snap-client": "^0.60.4",
56
- "@searchspring/snap-controller": "^0.60.4",
57
- "@searchspring/snap-event-manager": "^0.60.4",
58
- "@searchspring/snap-logger": "^0.60.4",
59
- "@searchspring/snap-profiler": "^0.60.4",
60
- "@searchspring/snap-store-mobx": "^0.60.4",
61
- "@searchspring/snap-tracker": "^0.60.4",
62
- "@searchspring/snap-url-manager": "^0.60.4",
55
+ "@searchspring/snap-client": "^0.61.0",
56
+ "@searchspring/snap-controller": "^0.61.0",
57
+ "@searchspring/snap-event-manager": "^0.61.0",
58
+ "@searchspring/snap-logger": "^0.61.0",
59
+ "@searchspring/snap-profiler": "^0.61.0",
60
+ "@searchspring/snap-store-mobx": "^0.61.0",
61
+ "@searchspring/snap-tracker": "^0.61.0",
62
+ "@searchspring/snap-url-manager": "^0.61.0",
63
63
  "@storybook/addon-actions": "6.4.22",
64
64
  "@storybook/addon-controls": "6.4.22",
65
65
  "@storybook/addon-docs": "6.4.22",
@@ -84,5 +84,5 @@
84
84
  "webpack-merge": "^5.8.0"
85
85
  },
86
86
  "sideEffects": false,
87
- "gitHead": "35b8cbfd72999ecb018ba9febc0b01fc63bd3164"
87
+ "gitHead": "cc0a0e82dbdb7884ce819e9a452923b452e4a741"
88
88
  }