@athoscommerce/snap-preact 1.12.0 → 1.13.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.
Files changed (58) hide show
  1. package/dist/cjs/components/src/components/Atoms/Price/Price.js +2 -2
  2. package/dist/cjs/components/src/components/Molecules/CustomComponentWrapper/CustomComponentWrapper.js +1 -1
  3. package/dist/cjs/components/src/components/Molecules/Slideshow/Slideshow.js +59 -30
  4. package/dist/cjs/components/src/components/Organisms/AutocompleteLayout/AutocompleteLayout.js +13 -8
  5. package/dist/cjs/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.js +13 -8
  6. package/dist/cjs/components/src/hooks/useLayoutOptions.js +19 -14
  7. package/dist/cjs/components/src/utilities/mergeProps.js +647 -184
  8. package/dist/cjs/src/Snap.js +1 -1
  9. package/dist/cjs/src/Templates/SnapTemplates.js +17 -53
  10. package/dist/cjs/src/Templates/Stores/LibraryStore.js +2 -0
  11. package/dist/cjs/src/Templates/Stores/TemplateStore.js +37 -8
  12. package/dist/cjs/src/Templates/Stores/ThemeStore.js +125 -32
  13. package/dist/cjs/src/Templates/Stores/library/currencies/currencies.js +52 -29
  14. package/dist/cjs/src/Templates/Stores/library/plugins/shopify/pluginCurrency.js +5 -0
  15. package/dist/esm/components/src/components/Atoms/Price/Price.d.ts +2 -0
  16. package/dist/esm/components/src/components/Atoms/Price/Price.d.ts.map +1 -1
  17. package/dist/esm/components/src/components/Atoms/Price/Price.js +2 -2
  18. package/dist/esm/components/src/components/Molecules/CustomComponentWrapper/CustomComponentWrapper.d.ts.map +1 -1
  19. package/dist/esm/components/src/components/Molecules/CustomComponentWrapper/CustomComponentWrapper.js +1 -1
  20. package/dist/esm/components/src/components/Molecules/Select/Select.d.ts +2 -2
  21. package/dist/esm/components/src/components/Molecules/Select/Select.d.ts.map +1 -1
  22. package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.d.ts +1 -0
  23. package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.d.ts.map +1 -1
  24. package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.js +59 -30
  25. package/dist/esm/components/src/components/Organisms/AutocompleteLayout/AutocompleteLayout.d.ts.map +1 -1
  26. package/dist/esm/components/src/components/Organisms/AutocompleteLayout/AutocompleteLayout.js +13 -8
  27. package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.d.ts.map +1 -1
  28. package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.js +13 -8
  29. package/dist/esm/components/src/hooks/useLayoutOptions.d.ts.map +1 -1
  30. package/dist/esm/components/src/hooks/useLayoutOptions.js +19 -14
  31. package/dist/esm/components/src/providers/langComponents.d.ts +5 -0
  32. package/dist/esm/components/src/providers/langComponents.d.ts.map +1 -1
  33. package/dist/esm/components/src/providers/themeComponents.d.ts +214 -193
  34. package/dist/esm/components/src/providers/themeComponents.d.ts.map +1 -1
  35. package/dist/esm/components/src/utilities/mergeProps.d.ts +11 -0
  36. package/dist/esm/components/src/utilities/mergeProps.d.ts.map +1 -1
  37. package/dist/esm/components/src/utilities/mergeProps.js +647 -184
  38. package/dist/esm/src/Snap.js +1 -1
  39. package/dist/esm/src/Templates/SnapTemplates.d.ts +32 -19
  40. package/dist/esm/src/Templates/SnapTemplates.d.ts.map +1 -1
  41. package/dist/esm/src/Templates/SnapTemplates.js +16 -51
  42. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts +7 -0
  43. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts.map +1 -1
  44. package/dist/esm/src/Templates/Stores/LibraryStore.js +2 -0
  45. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts +11 -7
  46. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  47. package/dist/esm/src/Templates/Stores/TemplateStore.js +31 -8
  48. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts +5 -2
  49. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
  50. package/dist/esm/src/Templates/Stores/ThemeStore.js +125 -32
  51. package/dist/esm/src/Templates/Stores/library/currencies/currencies.d.ts +27 -0
  52. package/dist/esm/src/Templates/Stores/library/currencies/currencies.d.ts.map +1 -1
  53. package/dist/esm/src/Templates/Stores/library/currencies/currencies.js +52 -29
  54. package/dist/esm/src/Templates/Stores/library/plugins/shopify/pluginCurrency.d.ts +2 -0
  55. package/dist/esm/src/Templates/Stores/library/plugins/shopify/pluginCurrency.d.ts.map +1 -0
  56. package/dist/esm/src/Templates/Stores/library/plugins/shopify/pluginCurrency.js +1 -0
  57. package/eslint/src/validate-config.cjs +520 -0
  58. package/package.json +13 -13
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.currencies = void 0;
4
- // Currencies supported by Snap Templates — matches the list of currencies supported by Shopify (ISO 4217).
5
- // Symbols, decimal places and separators are sourced from CLDR — decimalPlaces is only set when not 2, and
6
- // separators are only set when the currency has a single dominant convention that differs from the component
7
- // defaults (multi-locale currencies like EUR/USD/CHF/CAD keep the defaults and can be overridden per site).
8
4
  exports.currencies = {
9
5
  // United Arab Emirates Dirham
10
6
  aed: {
@@ -38,9 +34,10 @@ exports.currencies = {
38
34
  amd: {
39
35
  components: {
40
36
  price: {
41
- symbol: '֏',
37
+ symbol: '\u00A0֏',
42
38
  thousandsSeparator: '\u00A0',
43
39
  decimalSeparator: ',',
40
+ symbolAfter: true,
44
41
  },
45
42
  },
46
43
  },
@@ -58,9 +55,10 @@ exports.currencies = {
58
55
  aoa: {
59
56
  components: {
60
57
  price: {
61
- symbol: 'Kz',
58
+ symbol: '\u00A0Kz',
62
59
  thousandsSeparator: '\u00A0',
63
60
  decimalSeparator: ',',
61
+ symbolAfter: true,
64
62
  },
65
63
  },
66
64
  },
@@ -96,9 +94,10 @@ exports.currencies = {
96
94
  azn: {
97
95
  components: {
98
96
  price: {
99
- symbol: '₼',
97
+ symbol: '\u00A0₼',
100
98
  thousandsSeparator: '.',
101
99
  decimalSeparator: ',',
100
+ symbolAfter: true,
102
101
  },
103
102
  },
104
103
  },
@@ -106,9 +105,10 @@ exports.currencies = {
106
105
  bam: {
107
106
  components: {
108
107
  price: {
109
- symbol: 'KM',
108
+ symbol: '\u00A0KM',
110
109
  thousandsSeparator: '.',
111
110
  decimalSeparator: ',',
111
+ symbolAfter: true,
112
112
  },
113
113
  },
114
114
  },
@@ -125,6 +125,7 @@ exports.currencies = {
125
125
  components: {
126
126
  price: {
127
127
  symbol: '৳',
128
+ symbolAfter: true,
128
129
  },
129
130
  },
130
131
  },
@@ -318,9 +319,10 @@ exports.currencies = {
318
319
  czk: {
319
320
  components: {
320
321
  price: {
321
- symbol: 'Kč',
322
+ symbol: '\u00A0Kč',
322
323
  thousandsSeparator: '\u00A0',
323
324
  decimalSeparator: ',',
325
+ symbolAfter: true,
324
326
  },
325
327
  },
326
328
  },
@@ -339,9 +341,10 @@ exports.currencies = {
339
341
  dkk: {
340
342
  components: {
341
343
  price: {
342
- symbol: 'kr',
344
+ symbol: '\u00A0kr',
343
345
  thousandsSeparator: '.',
344
346
  decimalSeparator: ',',
347
+ symbolAfter: true,
345
348
  },
346
349
  },
347
350
  },
@@ -423,9 +426,10 @@ exports.currencies = {
423
426
  gel: {
424
427
  components: {
425
428
  price: {
426
- symbol: '₾',
429
+ symbol: '\u00A0₾',
427
430
  thousandsSeparator: '\u00A0',
428
431
  decimalSeparator: ',',
432
+ symbolAfter: true,
429
433
  },
430
434
  },
431
435
  },
@@ -457,10 +461,11 @@ exports.currencies = {
457
461
  gnf: {
458
462
  components: {
459
463
  price: {
460
- symbol: 'FG',
464
+ symbol: '\u00A0FG',
461
465
  decimalPlaces: 0,
462
466
  thousandsSeparator: '\u00A0',
463
467
  decimalSeparator: ',',
468
+ symbolAfter: true,
464
469
  },
465
470
  },
466
471
  },
@@ -500,9 +505,10 @@ exports.currencies = {
500
505
  hrk: {
501
506
  components: {
502
507
  price: {
503
- symbol: 'kn',
508
+ symbol: '\u00A0kn',
504
509
  thousandsSeparator: '.',
505
510
  decimalSeparator: ',',
511
+ symbolAfter: true,
506
512
  },
507
513
  },
508
514
  },
@@ -520,10 +526,11 @@ exports.currencies = {
520
526
  huf: {
521
527
  components: {
522
528
  price: {
523
- symbol: 'Ft',
529
+ symbol: '\u00A0Ft',
524
530
  decimalPlaces: 0,
525
531
  thousandsSeparator: '\u00A0',
526
532
  decimalSeparator: ',',
533
+ symbolAfter: true,
527
534
  },
528
535
  },
529
536
  },
@@ -542,7 +549,8 @@ exports.currencies = {
542
549
  ils: {
543
550
  components: {
544
551
  price: {
545
- symbol: '₪',
552
+ symbol: '\u00A0₪',
553
+ symbolAfter: true,
546
554
  },
547
555
  },
548
556
  },
@@ -576,10 +584,11 @@ exports.currencies = {
576
584
  isk: {
577
585
  components: {
578
586
  price: {
579
- symbol: 'kr',
587
+ symbol: '\u00A0kr',
580
588
  decimalPlaces: 0,
581
589
  thousandsSeparator: '.',
582
590
  decimalSeparator: ',',
591
+ symbolAfter: true,
583
592
  },
584
593
  },
585
594
  },
@@ -640,6 +649,7 @@ exports.currencies = {
640
649
  components: {
641
650
  price: {
642
651
  symbol: '៛',
652
+ symbolAfter: true,
643
653
  },
644
654
  },
645
655
  },
@@ -655,10 +665,11 @@ exports.currencies = {
655
665
  kmf: {
656
666
  components: {
657
667
  price: {
658
- symbol: 'CF',
668
+ symbol: '\u00A0CF',
659
669
  decimalPlaces: 0,
660
670
  thousandsSeparator: '\u00A0',
661
671
  decimalSeparator: ',',
672
+ symbolAfter: true,
662
673
  },
663
674
  },
664
675
  },
@@ -692,9 +703,10 @@ exports.currencies = {
692
703
  kzt: {
693
704
  components: {
694
705
  price: {
695
- symbol: '₸',
706
+ symbol: '\u00A0₸',
696
707
  thousandsSeparator: '\u00A0',
697
708
  decimalSeparator: ',',
709
+ symbolAfter: true,
698
710
  },
699
711
  },
700
712
  },
@@ -758,9 +770,10 @@ exports.currencies = {
758
770
  lvl: {
759
771
  components: {
760
772
  price: {
761
- symbol: 'Ls',
773
+ symbol: '\u00A0Ls',
762
774
  thousandsSeparator: '\u00A0',
763
775
  decimalSeparator: ',',
776
+ symbolAfter: true,
764
777
  },
765
778
  },
766
779
  },
@@ -820,8 +833,9 @@ exports.currencies = {
820
833
  mmk: {
821
834
  components: {
822
835
  price: {
823
- symbol: 'K',
836
+ symbol: '\u00A0K',
824
837
  decimalPlaces: 0,
838
+ symbolAfter: true,
825
839
  },
826
840
  },
827
841
  },
@@ -855,7 +869,8 @@ exports.currencies = {
855
869
  mur: {
856
870
  components: {
857
871
  price: {
858
- symbol: 'Rs',
872
+ symbol: '\u00A0Rs',
873
+ symbolAfter: true,
859
874
  },
860
875
  },
861
876
  },
@@ -929,9 +944,10 @@ exports.currencies = {
929
944
  nok: {
930
945
  components: {
931
946
  price: {
932
- symbol: 'kr',
947
+ symbol: '\u00A0kr',
933
948
  thousandsSeparator: '\u00A0',
934
949
  decimalSeparator: ',',
950
+ symbolAfter: true,
935
951
  },
936
952
  },
937
953
  },
@@ -1005,9 +1021,10 @@ exports.currencies = {
1005
1021
  pln: {
1006
1022
  components: {
1007
1023
  price: {
1008
- symbol: 'zł',
1024
+ symbol: '\u00A0zł',
1009
1025
  thousandsSeparator: '\u00A0',
1010
1026
  decimalSeparator: ',',
1027
+ symbolAfter: true,
1011
1028
  },
1012
1029
  },
1013
1030
  },
@@ -1054,9 +1071,10 @@ exports.currencies = {
1054
1071
  rub: {
1055
1072
  components: {
1056
1073
  price: {
1057
- symbol: '₽',
1074
+ symbol: '\u00A0₽',
1058
1075
  thousandsSeparator: '\u00A0',
1059
1076
  decimalSeparator: ',',
1077
+ symbolAfter: true,
1060
1078
  },
1061
1079
  },
1062
1080
  },
@@ -1107,9 +1125,10 @@ exports.currencies = {
1107
1125
  sek: {
1108
1126
  components: {
1109
1127
  price: {
1110
- symbol: 'kr',
1128
+ symbol: '\u00A0kr',
1111
1129
  thousandsSeparator: '\u00A0',
1112
1130
  decimalSeparator: ',',
1131
+ symbolAfter: true,
1113
1132
  },
1114
1133
  },
1115
1134
  },
@@ -1161,7 +1180,8 @@ exports.currencies = {
1161
1180
  ssp: {
1162
1181
  components: {
1163
1182
  price: {
1164
- symbol: '£',
1183
+ symbol: '\u00A0£',
1184
+ symbolAfter: true,
1165
1185
  },
1166
1186
  },
1167
1187
  },
@@ -1169,9 +1189,10 @@ exports.currencies = {
1169
1189
  stn: {
1170
1190
  components: {
1171
1191
  price: {
1172
- symbol: 'Db',
1192
+ symbol: '\u00A0Db',
1173
1193
  thousandsSeparator: '\u00A0',
1174
1194
  decimalSeparator: ',',
1195
+ symbolAfter: true,
1175
1196
  },
1176
1197
  },
1177
1198
  },
@@ -1277,9 +1298,10 @@ exports.currencies = {
1277
1298
  uah: {
1278
1299
  components: {
1279
1300
  price: {
1280
- symbol: '₴',
1301
+ symbol: '\u00A0₴',
1281
1302
  thousandsSeparator: '\u00A0',
1282
1303
  decimalSeparator: ',',
1304
+ symbolAfter: true,
1283
1305
  },
1284
1306
  },
1285
1307
  },
@@ -1344,10 +1366,11 @@ exports.currencies = {
1344
1366
  vnd: {
1345
1367
  components: {
1346
1368
  price: {
1347
- symbol: '₫',
1369
+ symbol: '\u00A0₫',
1348
1370
  decimalPlaces: 0,
1349
1371
  thousandsSeparator: '.',
1350
1372
  decimalSeparator: ',',
1373
+ symbolAfter: true,
1351
1374
  },
1352
1375
  },
1353
1376
  },
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pluginCurrency = void 0;
4
+ var shopify_1 = require("@athoscommerce/snap-platforms/shopify");
5
+ Object.defineProperty(exports, "pluginCurrency", { enumerable: true, get: function () { return shopify_1.pluginCurrency; } });
@@ -9,6 +9,8 @@ export interface PriceTemplatesLegalProps extends Omit<FormattedNumberProps, 'va
9
9
  value?: number;
10
10
  lineThrough?: boolean;
11
11
  format?: (number: number | string) => string;
12
+ code?: string;
13
+ showCode?: boolean;
12
14
  }
13
15
  export type PriceNames = 'price' | 'msrp' | 'bundle-price' | 'bundle-msrp';
14
16
  //# sourceMappingURL=Price.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Price.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Atoms/Price/Price.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQ3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAc7D,eAAO,MAAM,KAAK,gBAAyB,UAAU;;CAoEnD,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,wBAAwB,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;AAC/E,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACzG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;CAC7C;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,aAAa,CAAC"}
1
+ {"version":3,"file":"Price.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Atoms/Price/Price.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQ3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAc7D,eAAO,MAAM,KAAK,gBAAyB,UAAU;;CA8EnD,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,wBAAwB,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;AAC/E,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACzG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,aAAa,CAAC"}
@@ -29,7 +29,7 @@ export const Price = observer((properties) => {
29
29
  treePath: globalTreePath,
30
30
  };
31
31
  const props = mergeProps('price', globalTheme, defaultProps, properties);
32
- const { lineThrough, value, format, symbol, decimalPlaces, padDecimalPlaces, thousandsSeparator, decimalSeparator, symbolAfter, raw, className, internalClassName, } = props;
32
+ const { lineThrough, value, format, symbol, decimalPlaces, padDecimalPlaces, thousandsSeparator, decimalSeparator, symbolAfter, code, showCode, raw, className, internalClassName, } = props;
33
33
  const { overrideElement, shouldRenderDefault } = useCustomComponentOverride('price', props);
34
34
  if (!shouldRenderDefault) {
35
35
  return overrideElement;
@@ -48,7 +48,7 @@ export const Price = observer((properties) => {
48
48
  }
49
49
  const styling = mergeStyles(props, defaultStyles);
50
50
  if (formattedPrice) {
51
- return raw ? (_jsx(_Fragment, { children: formattedPrice })) : (_jsx(CacheProvider, { children: _jsxs("span", { ...styling, className: classnames('ss__price', { 'ss__price--strike': lineThrough }, className, internalClassName), children: [!format && symbol && !symbolAfter ? _jsx("span", { className: 'ss__price__symbol', children: symbol }) : _jsx(_Fragment, {}), _jsx("span", { className: 'ss__price__value', children: formattedPrice }), !format && symbol && symbolAfter ? _jsx("span", { className: 'ss__price__symbol', children: symbol }) : _jsx(_Fragment, {})] }) }));
51
+ return raw ? (_jsx(_Fragment, { children: formattedPrice })) : (_jsx(CacheProvider, { children: _jsxs("span", { ...styling, className: classnames('ss__price', { 'ss__price--strike': lineThrough }, className, internalClassName), children: [!format && symbol && !symbolAfter ? _jsx("span", { className: 'ss__price__symbol', children: symbol }) : _jsx(_Fragment, {}), _jsx("span", { className: 'ss__price__value', children: formattedPrice }), !format && symbol && symbolAfter ? _jsx("span", { className: 'ss__price__symbol', children: symbol }) : _jsx(_Fragment, {}), !format && showCode && code ? (_jsxs(_Fragment, { children: ['\u00A0', _jsx("span", { className: 'ss__price__code', children: code })] })) : (_jsx(_Fragment, {}))] }) }));
52
52
  }
53
53
  else {
54
54
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"CustomComponentWrapper.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/CustomComponentWrapper/CustomComponentWrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAQ7D,eAAO,MAAM,sBAAsB,gBAAyB,2BAA2B;;CAuBrF,CAAC;AAEH,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;CACd"}
1
+ {"version":3,"file":"CustomComponentWrapper.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/CustomComponentWrapper/CustomComponentWrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAQ7D,eAAO,MAAM,sBAAsB,gBAAyB,2BAA2B;;CA0BrF,CAAC;AAEH,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;CACd"}
@@ -18,5 +18,5 @@ export const CustomComponentWrapper = observer((properties) => {
18
18
  const { children } = props;
19
19
  const styling = mergeStyles(props, defaultStyles);
20
20
  const path = styling['ss-path'];
21
- return (_jsx(CacheProvider, { children: _jsx("div", { ...styling, children: cloneWithProps(children, { treePath: path, theme: globalTheme }) }) }));
21
+ return (_jsx(CacheProvider, { children: _jsx("div", { ...styling, children: cloneWithProps(children, { treePath: path, theme: props.theme }) }) }));
22
22
  });
@@ -7,9 +7,10 @@ export declare const Select: ((properties: SelectProps) => import("@emotion/reac
7
7
  };
8
8
  export type SelectProps = {
9
9
  lang?: Partial<SelectLang>;
10
+ options: ListOption[];
11
+ selected?: ListOption;
10
12
  } & SelectTemplatesLegalProps & ComponentProps<SelectProps>;
11
13
  export type SelectTemplatesLegalProps = {
12
- options: ListOption[];
13
14
  backgroundColor?: string;
14
15
  borderColor?: string;
15
16
  color?: string;
@@ -24,7 +25,6 @@ export type SelectTemplatesLegalProps = {
24
25
  hideLabel?: boolean;
25
26
  native?: boolean;
26
27
  onSelect?: (e: React.ChangeEvent<HTMLSelectElement> | React.MouseEvent<HTMLElement>, option?: ListOption) => void;
27
- selected?: ListOption;
28
28
  separator?: string | JSX.Element;
29
29
  startOpen?: boolean;
30
30
  stayOpenOnSelection?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAS3B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAe,MAAM,gBAAgB,CAAC;AAGzE,OAAO,EAAQ,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;AAiE3E,eAAO,MAAM,MAAM,gBAAyB,WAAW;;CA4RrD,CAAC;AAQH,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;CAC3B,GAAG,yBAAyB,GAC5B,cAAc,CAAC,WAAW,CAAC,CAAC;AAE7B,MAAM,MAAM,yBAAyB,GAAG;IACvC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,eAAe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,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClH,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,IAAI,CAAC;QACjB,OAAO,EAAE,UAAU,EAAE,CAAC;QACtB,eAAe,EAAE,UAAU,EAAE,CAAC;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,OAAO,CAAC;KACd,CAAC,CAAC;CACH"}
@@ -65,5 +65,6 @@ export type SlideshowTemplatesLegalProps = {
65
65
  ariaLabelledBy?: string;
66
66
  touchDragging?: boolean;
67
67
  dragThreshold?: number;
68
+ dragClickThreshold?: number;
68
69
  };
69
70
  //# sourceMappingURL=Slideshow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Slideshow.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Slideshow/Slideshow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA+JxD,eAAO,MAAM,SAAS,gBAAyB,cAAc;;CAisB3D,CA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,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"Slideshow.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Slideshow/Slideshow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAyJxD,eAAO,MAAM,SAAS,gBAAyB,cAAc;;CAouB3D,CAAC;AAEH,MAAM,WAAW,aAAa;IAC7B,WAAW,EAAE,IAAI,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,cAAc,EAAE,OAAO,CAA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IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC"}
@@ -9,8 +9,6 @@ import { Image } from '../../Atoms/Image';
9
9
  import { Button } from '../../Atoms/Button';
10
10
  import { useLang, useCustomComponentOverride } from '../../../hooks';
11
11
  import deepmerge from 'deepmerge';
12
- // Pointer travel (px) past which a press is treated as a drag rather than a click.
13
- const DRAG_CLICK_THRESHOLD = 5;
14
12
  const defaultStyles = ({ theme, slidesToShow = 1, slideWidth, gap = 16, overlayNavigation = false, showNavigation }) => {
15
13
  return css({
16
14
  position: 'relative',
@@ -55,8 +53,10 @@ const defaultStyles = ({ theme, slidesToShow = 1, slideWidth, gap = 16, overlayN
55
53
  height: '100%',
56
54
  objectFit: 'cover',
57
55
  display: 'block',
58
- // Prevent image dragging
56
+ // pointer-events:none isn't fully reliable for blocking native image drag
57
+ // this plus draggable={false} below covers all browsers
59
58
  pointerEvents: 'none',
59
+ WebkitUserDrag: 'none',
60
60
  },
61
61
  },
62
62
  '.ss__slideshow__slide--content': {
@@ -69,10 +69,6 @@ const defaultStyles = ({ theme, slidesToShow = 1, slideWidth, gap = 16, overlayN
69
69
  },
70
70
  '.ss__slideshow__slide--clickable': {
71
71
  cursor: 'pointer',
72
- '&:hover img': {
73
- opacity: 0.9,
74
- transition: 'opacity 0.2s ease',
75
- },
76
72
  '&:focus-visible': {
77
73
  outline: '2px solid #005fcc',
78
74
  outlineOffset: '2px',
@@ -162,9 +158,10 @@ export const Slideshow = observer((properties) => {
162
158
  ariaLabel: 'slideshow',
163
159
  touchDragging: true,
164
160
  dragThreshold: 50,
161
+ dragClickThreshold: 10,
165
162
  };
166
163
  const props = mergeProps('slideshow', globalTheme, defaultProps, properties);
167
- const { className, slides, fallbackImage, autoPlay, autoPlayInterval, showNavigation, showPagination, loop, alwaysShowNavigation, slidesToShow, slideImageAlt, centerInsufficientSlides, ariaLabel, ariaLabelledBy, disableStyles, slideWidth, startIndex, gap, treePath, overlayNavigation, dragThreshold, } = props;
164
+ const { className, slides, fallbackImage, autoPlay, autoPlayInterval, showNavigation, showPagination, loop, alwaysShowNavigation, slidesToShow, slideImageAlt, centerInsufficientSlides, ariaLabel, ariaLabelledBy, disableStyles, slideWidth, startIndex, gap, treePath, overlayNavigation, dragThreshold, dragClickThreshold, } = props;
168
165
  const { overrideElement, shouldRenderDefault } = useCustomComponentOverride('slideshow', props);
169
166
  if (!shouldRenderDefault) {
170
167
  return overrideElement;
@@ -174,6 +171,9 @@ export const Slideshow = observer((properties) => {
174
171
  Image: {
175
172
  // default props
176
173
  fallback: fallbackImage,
174
+ // images are draggable by default in every browser
175
+ // a native image drag can hijack our custom drag and eat the mouseup
176
+ draggable: false,
177
177
  // inherited props
178
178
  ...defined({
179
179
  disableStyles,
@@ -266,9 +266,17 @@ export const Slideshow = observer((properties) => {
266
266
  }, []);
267
267
  // Touch/Drag state
268
268
  const [isDragging, setIsDragging] = useState(false);
269
- const [startX, setStartX] = useState(0);
270
- const [currentX, setCurrentX] = useState(0);
269
+ // refs, not state - only read inside the drag handlers, never in render
270
+ // the document mouseup listener below is bound once per drag, so its closure goes stale
271
+ // refs stay current even from that stale closure, state would not
272
+ const startXRef = useRef(0);
273
+ const currentXRef = useRef(0);
271
274
  const [dragOffset, setDragOffset] = useState(0);
275
+ // the track's on-screen translateX (px) captured when the current drag began
276
+ // starting a drag turns off the CSS transition immediately
277
+ // without this, interrupting an in-flight transition would snap the track to its target
278
+ // null means there's no drag in progress
279
+ const dragBaseTranslatePxRef = useRef(null);
272
280
  // Normalize slides to SlideshowSlide format
273
281
  const normalizedSlides = slides.map((slide, index) => {
274
282
  if (typeof slide === 'string') {
@@ -360,15 +368,33 @@ export const Slideshow = observer((properties) => {
360
368
  if (totalSlides <= visibleSlides) {
361
369
  touchDragging = false;
362
370
  }
371
+ // how far you need to drag before it counts as a navigation
372
+ // smaller of dragThreshold and 30% of a slide's width
373
+ const getNavigationThreshold = () => {
374
+ const trackContainerWidth = trackRef.current?.parentElement?.offsetWidth || 0;
375
+ const slideWidthPx = trackContainerWidth / visibleSlides;
376
+ return Math.min(dragThreshold, slideWidthPx * 0.3);
377
+ };
363
378
  // Touch/Mouse event handlers for dragging
364
379
  const handleDragStart = (clientX) => {
365
380
  if (!touchDragging)
366
381
  return;
382
+ // capture the track's actual current position, mid-transition or not
383
+ // the track has no margin and fills its parent's width
384
+ // so the gap between their left edges is exactly the current translateX in px
385
+ dragBaseTranslatePxRef.current = null;
386
+ if (trackRef.current?.parentElement) {
387
+ dragBaseTranslatePxRef.current = trackRef.current.getBoundingClientRect().left - trackRef.current.parentElement.getBoundingClientRect().left;
388
+ }
367
389
  hasDraggedRef.current = false;
368
390
  setIsPlaying(false);
369
391
  setIsDragging(true);
370
- setStartX(clientX);
371
- setCurrentX(clientX);
392
+ // a previous drag's mouseup may never have arrived (e.g. a native image drag hijacked it)
393
+ // that would leave dragOffset stuck from that aborted drag
394
+ // reset it so this drag always starts clean, not stacked on stale movement
395
+ setDragOffset(0);
396
+ startXRef.current = clientX;
397
+ currentXRef.current = clientX;
372
398
  // Pause autoplay during drag
373
399
  if (intervalRef.current) {
374
400
  clearInterval(intervalRef.current);
@@ -377,11 +403,12 @@ export const Slideshow = observer((properties) => {
377
403
  const handleDragMove = (clientX) => {
378
404
  if (!isDragging || !touchDragging)
379
405
  return;
380
- setCurrentX(clientX);
381
- const diff = clientX - startX;
382
- // Past a few pixels of travel this is a drag, not a click — flag it so the trailing
383
- // click (fired after mouseup/touchend) doesn't trigger slide onClick handlers.
384
- if (Math.abs(diff) > DRAG_CLICK_THRESHOLD) {
406
+ currentXRef.current = clientX;
407
+ const diff = clientX - startXRef.current;
408
+ // past a few pixels this counts as a drag, not a click
409
+ // flags it so the trailing click after mouseup doesn't fire onClick
410
+ // clamped to the nav threshold so a drag big enough to navigate is always flagged
411
+ if (Math.abs(diff) > Math.min(dragClickThreshold, getNavigationThreshold())) {
385
412
  hasDraggedRef.current = true;
386
413
  }
387
414
  setDragOffset(diff);
@@ -389,10 +416,8 @@ export const Slideshow = observer((properties) => {
389
416
  const handleDragEnd = () => {
390
417
  if (!isDragging || !touchDragging)
391
418
  return;
392
- const diff = currentX - startX;
393
- const trackContainerWidth = trackRef.current?.parentElement?.offsetWidth || 0;
394
- const slideWidthPx = trackContainerWidth / visibleSlides;
395
- const threshold = Math.min(dragThreshold, slideWidthPx * 0.3); // 30% of slide width or dragThreshold, whichever is smaller
419
+ const diff = currentXRef.current - startXRef.current;
420
+ const threshold = getNavigationThreshold();
396
421
  if (Math.abs(diff) > threshold) {
397
422
  if (diff > 0 && (loop || currentIndex > 0)) {
398
423
  // Dragged right - go to previous
@@ -405,6 +430,7 @@ export const Slideshow = observer((properties) => {
405
430
  }
406
431
  setIsDragging(false);
407
432
  setDragOffset(0);
433
+ dragBaseTranslatePxRef.current = null;
408
434
  // Resume autoplay if it was playing
409
435
  if (isPlaying && normalizedSlides.length > computedSlidesToShow) {
410
436
  intervalRef.current = setInterval(() => {
@@ -547,7 +573,13 @@ export const Slideshow = observer((properties) => {
547
573
  // Simplified transform calculation
548
574
  let translateX;
549
575
  let translateUnit;
550
- if (slideWidth) {
576
+ if (isDragging && dragBaseTranslatePxRef.current !== null) {
577
+ // while dragging, move from the position captured in handleDragStart
578
+ // not from currentIndex, so an interrupted transition continues smoothly
579
+ translateX = dragBaseTranslatePxRef.current + dragOffset;
580
+ translateUnit = 'px';
581
+ }
582
+ else if (slideWidth) {
551
583
  // Fixed-width mode: translate by pixel amounts (slideWidth + gap per slide)
552
584
  const slideStepPx = slideWidth + (gap ?? 0);
553
585
  translateX = -(currentIndex * slideStepPx);
@@ -620,20 +652,17 @@ export const Slideshow = observer((properties) => {
620
652
  handleDragMove(touch.clientX);
621
653
  }
622
654
  : undefined, onTouchEnd: touchDragging ? handleDragEnd : undefined,
623
- // Mouse events (for desktop dragging)
655
+ // mouse events for desktop dragging
656
+ // move/up are handled by the document listeners below, not here
657
+ // that keeps the drag tracking even if the cursor leaves the track
658
+ // and avoids firing handleDragEnd twice on a release over the track
624
659
  // @ts-ignore - mouse events
625
660
  onMouseDown: touchDragging
626
661
  ? (event) => {
627
662
  event.preventDefault();
628
663
  handleDragStart(event.clientX);
629
664
  }
630
- : undefined,
631
- // Mouse events (for desktop dragging)
632
- // @ts-ignore - mouse events
633
- onMouseUp: touchDragging ? handleDragEnd : undefined,
634
- // Mouse events (for desktop dragging)
635
- // @ts-ignore - mouse events
636
- onMouseMove: touchDragging ? handleMouseMove : undefined, children: normalizedSlides.map((slide, index) => {
665
+ : undefined, children: normalizedSlides.map((slide, index) => {
637
666
  const isVisible = index >= currentIndex && index < currentIndex + computedSlidesToShow;
638
667
  const hasClickHandler = !!slide.onClick;
639
668
  const hasContent = !!slide.content;
@@ -1 +1 @@
1
- {"version":3,"file":"AutocompleteLayout.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/AutocompleteLayout/AutocompleteLayout.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAA4B,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H"}
1
+ {"version":3,"file":"AutocompleteLayout.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/AutocompleteLayout/AutocompleteLayout.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAA4B,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AASvI,OAAO,EAAE,cAAc,EAAgB,4BAA4B,EAA6C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrJ,OAAO,EAAE,IAAI,EAAoB,MAAM,gBAAgB,CAAC;AAOxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AA6K3F,eAAO,MAAM,kBAAkB,gBAAyB,uBAAuB;;CAmmB7E,CAAC;AAeH,MAAM,MAAM,WAAW,GACpB,WAAW,GACX,eAAe,GACf,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,GACR,kBAAkB,GAClB,iBAAiB,GACjB,SAAS,GACT,YAAY,GACZ,cAAc,GACd,GAAG,GACH,aAAa,GACb,eAAe,GACf,eAAe,GACf,eAAe,CAAC;AACnB,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,KAAK,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AACjE,KAAK,sBAAsB,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,EAAE,GAAG,YAAY,EAAE,CAAC;AAE1F,KAAK,MAAM,GAAG;IACb,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,WAAW,EAAE,CAAC;IACxC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,eAAe,CAAC;CACtE,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACrC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO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