@constructor-io/constructorio-ui-autocomplete 1.1.6 → 1.1.8

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 (100) hide show
  1. package/README.md +17 -3
  2. package/package.json +5 -3
  3. package/lib/.DS_Store +0 -0
  4. package/lib/cjs/components/Autocomplete/Autocomplete.css +0 -110
  5. package/lib/cjs/components/Autocomplete/AutocompleteResults/AutocompleteResults.js +0 -22
  6. package/lib/cjs/components/Autocomplete/AutocompleteResults/AutocompleteResults.js.map +0 -1
  7. package/lib/cjs/components/Autocomplete/CioAutocomplete/CioAutocomplete.js +0 -18
  8. package/lib/cjs/components/Autocomplete/CioAutocomplete/CioAutocomplete.js.map +0 -1
  9. package/lib/cjs/components/Autocomplete/CioAutocompleteProvider.js +0 -15
  10. package/lib/cjs/components/Autocomplete/CioAutocompleteProvider.js.map +0 -1
  11. package/lib/cjs/components/Autocomplete/SearchInput/SearchInput.js +0 -30
  12. package/lib/cjs/components/Autocomplete/SearchInput/SearchInput.js.map +0 -1
  13. package/lib/cjs/components/Autocomplete/SectionItem/SectionItem.js +0 -22
  14. package/lib/cjs/components/Autocomplete/SectionItem/SectionItem.js.map +0 -1
  15. package/lib/cjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +0 -22
  16. package/lib/cjs/components/Autocomplete/SectionItemsList/SectionItemsList.js.map +0 -1
  17. package/lib/cjs/constants.js +0 -163
  18. package/lib/cjs/constants.js.map +0 -1
  19. package/lib/cjs/hooks/useCioAutocomplete.js +0 -107
  20. package/lib/cjs/hooks/useCioAutocomplete.js.map +0 -1
  21. package/lib/cjs/hooks/useCioClient.js +0 -22
  22. package/lib/cjs/hooks/useCioClient.js.map +0 -1
  23. package/lib/cjs/hooks/useDebounce.js +0 -24
  24. package/lib/cjs/hooks/useDebounce.js.map +0 -1
  25. package/lib/cjs/hooks/useDebouncedFetchSections.js +0 -35
  26. package/lib/cjs/hooks/useDebouncedFetchSections.js.map +0 -1
  27. package/lib/cjs/hooks/useDownShift.js +0 -37
  28. package/lib/cjs/hooks/useDownShift.js.map +0 -1
  29. package/lib/cjs/hooks/useFetchRecommendationPod.js +0 -30
  30. package/lib/cjs/hooks/useFetchRecommendationPod.js.map +0 -1
  31. package/lib/cjs/hooks/usePrevious.js +0 -12
  32. package/lib/cjs/hooks/usePrevious.js.map +0 -1
  33. package/lib/cjs/index.js +0 -16
  34. package/lib/cjs/index.js.map +0 -1
  35. package/lib/cjs/stories/Autocomplete/argTypes.js +0 -65
  36. package/lib/cjs/stories/Autocomplete/argTypes.js.map +0 -1
  37. package/lib/cjs/typeGuards.js +0 -10
  38. package/lib/cjs/typeGuards.js.map +0 -1
  39. package/lib/cjs/types.js +0 -3
  40. package/lib/cjs/types.js.map +0 -1
  41. package/lib/cjs/utils.js +0 -72
  42. package/lib/cjs/utils.js.map +0 -1
  43. package/lib/mjs/components/Autocomplete/Autocomplete.css +0 -110
  44. package/lib/mjs/components/Autocomplete/AutocompleteResults/AutocompleteResults.js +0 -21
  45. package/lib/mjs/components/Autocomplete/AutocompleteResults/AutocompleteResults.js.map +0 -1
  46. package/lib/mjs/components/Autocomplete/CioAutocomplete/CioAutocomplete.js +0 -15
  47. package/lib/mjs/components/Autocomplete/CioAutocomplete/CioAutocomplete.js.map +0 -1
  48. package/lib/mjs/components/Autocomplete/CioAutocompleteProvider.js +0 -10
  49. package/lib/mjs/components/Autocomplete/CioAutocompleteProvider.js.map +0 -1
  50. package/lib/mjs/components/Autocomplete/SearchInput/SearchInput.js +0 -27
  51. package/lib/mjs/components/Autocomplete/SearchInput/SearchInput.js.map +0 -1
  52. package/lib/mjs/components/Autocomplete/SectionItem/SectionItem.js +0 -18
  53. package/lib/mjs/components/Autocomplete/SectionItem/SectionItem.js.map +0 -1
  54. package/lib/mjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +0 -15
  55. package/lib/mjs/components/Autocomplete/SectionItemsList/SectionItemsList.js.map +0 -1
  56. package/lib/mjs/constants.js +0 -160
  57. package/lib/mjs/constants.js.map +0 -1
  58. package/lib/mjs/hooks/useCioAutocomplete.js +0 -118
  59. package/lib/mjs/hooks/useCioAutocomplete.js.map +0 -1
  60. package/lib/mjs/hooks/useCioClient.js +0 -20
  61. package/lib/mjs/hooks/useCioClient.js.map +0 -1
  62. package/lib/mjs/hooks/useDebounce.js +0 -22
  63. package/lib/mjs/hooks/useDebounce.js.map +0 -1
  64. package/lib/mjs/hooks/useDebouncedFetchSections.js +0 -41
  65. package/lib/mjs/hooks/useDebouncedFetchSections.js.map +0 -1
  66. package/lib/mjs/hooks/useDownShift.js +0 -33
  67. package/lib/mjs/hooks/useDownShift.js.map +0 -1
  68. package/lib/mjs/hooks/useFetchRecommendationPod.js +0 -27
  69. package/lib/mjs/hooks/useFetchRecommendationPod.js.map +0 -1
  70. package/lib/mjs/hooks/usePrevious.js +0 -10
  71. package/lib/mjs/hooks/usePrevious.js.map +0 -1
  72. package/lib/mjs/index.js +0 -7
  73. package/lib/mjs/index.js.map +0 -1
  74. package/lib/mjs/stories/Autocomplete/argTypes.js +0 -62
  75. package/lib/mjs/stories/Autocomplete/argTypes.js.map +0 -1
  76. package/lib/mjs/typeGuards.js +0 -6
  77. package/lib/mjs/typeGuards.js.map +0 -1
  78. package/lib/mjs/types.js +0 -2
  79. package/lib/mjs/types.js.map +0 -1
  80. package/lib/mjs/utils.js +0 -58
  81. package/lib/mjs/utils.js.map +0 -1
  82. package/lib/types/components/Autocomplete/AutocompleteResults/AutocompleteResults.d.ts +0 -11
  83. package/lib/types/components/Autocomplete/CioAutocomplete/CioAutocomplete.d.ts +0 -3
  84. package/lib/types/components/Autocomplete/CioAutocompleteProvider.d.ts +0 -28
  85. package/lib/types/components/Autocomplete/SearchInput/SearchInput.d.ts +0 -7
  86. package/lib/types/components/Autocomplete/SectionItem/SectionItem.d.ts +0 -10
  87. package/lib/types/components/Autocomplete/SectionItemsList/SectionItemsList.d.ts +0 -12
  88. package/lib/types/constants.d.ts +0 -23
  89. package/lib/types/hooks/useCioAutocomplete.d.ts +0 -29
  90. package/lib/types/hooks/useCioClient.d.ts +0 -15
  91. package/lib/types/hooks/useDebounce.d.ts +0 -2
  92. package/lib/types/hooks/useDebouncedFetchSections.d.ts +0 -4
  93. package/lib/types/hooks/useDownShift.d.ts +0 -16
  94. package/lib/types/hooks/useFetchRecommendationPod.d.ts +0 -4
  95. package/lib/types/hooks/usePrevious.d.ts +0 -2
  96. package/lib/types/index.d.ts +0 -6
  97. package/lib/types/stories/Autocomplete/argTypes.d.ts +0 -62
  98. package/lib/types/typeGuards.d.ts +0 -2
  99. package/lib/types/types.d.ts +0 -131
  100. package/lib/types/utils.d.ts +0 -24
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
4
- const constructorio_client_javascript_1 = require("@constructor-io/constructorio-client-javascript");
5
- const useCioClient = ({ apiKey, cioJsClient }) => {
6
- const [cioClient, setCioClient] = (0, react_1.useState)(cioJsClient);
7
- (0, react_1.useEffect)(() => {
8
- if (apiKey && !cioJsClient) {
9
- const client = new constructorio_client_javascript_1.default({
10
- apiKey,
11
- sendTrackingEvents: true
12
- });
13
- setCioClient(client);
14
- }
15
- else if (cioJsClient) {
16
- setCioClient(cioJsClient);
17
- }
18
- }, [apiKey, cioJsClient]);
19
- return cioClient;
20
- };
21
- exports.default = useCioClient;
22
- //# sourceMappingURL=useCioClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCioClient.js","sourceRoot":"","sources":["../../../src/hooks/useCioClient.ts"],"names":[],"mappings":";;AAAA,iCAA4C;AAC5C,qGAAkF;AAuBlF,MAAM,YAAY,GAAiB,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE;IAC7D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,WAAW,CAAC,CAAC;IAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,MAAM,IAAI,CAAC,WAAW,EAAE;YAC1B,MAAM,MAAM,GAAG,IAAI,yCAAmB,CAAC;gBACrC,MAAM;gBACN,kBAAkB,EAAE,IAAI;aACzB,CAAC,CAAC;YAEH,YAAY,CAAC,MAAM,CAAC,CAAC;SACtB;aAAM,IAAI,WAAW,EAAE;YACtB,YAAY,CAAC,WAAW,CAAC,CAAC;SAC3B;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAE1B,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
4
- // adapted from: https://usehooks.com/useDebounce/
5
- const useDebounce = (value, delay = 250) => {
6
- // State and setters for debounced value
7
- const [debouncedValue, setDebouncedValue] = (0, react_1.useState)(value);
8
- (0, react_1.useEffect)(() => {
9
- // Update debounced value after delay
10
- const handler = setTimeout(() => {
11
- setDebouncedValue(value);
12
- }, delay);
13
- // Cancel the timeout if value changes (also on delay change or unmount)
14
- // This is how we prevent debounced value from updating if value is changed ...
15
- // .. within the delay period. Timeout gets cleared and restarted.
16
- return () => {
17
- clearTimeout(handler);
18
- };
19
- }, [value, delay] // Only re-call effect if value or delay changes
20
- );
21
- return debouncedValue;
22
- };
23
- exports.default = useDebounce;
24
- //# sourceMappingURL=useDebounce.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDebounce.js","sourceRoot":"","sources":["../../../src/hooks/useDebounce.ts"],"names":[],"mappings":";;AAAA,iCAA4C;AAE5C,kDAAkD;AAClD,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,KAAK,GAAG,GAAG,EAAE,EAAE;IACjD,wCAAwC;IACxC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5D,IAAA,iBAAS,EACP,GAAG,EAAE;QACH,qCAAqC;QACrC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,wEAAwE;QACxE,+EAA+E;QAC/E,kEAAkE;QAClE,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EACD,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,gDAAgD;KAChE,CAAC;IACF,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
4
- const useDebounce_1 = require("./useDebounce");
5
- const autocompleteParameters = {
6
- resultsPerSection: {}
7
- // numResults: 8,
8
- // hiddenFields: [],
9
- // filters: {},
10
- // variationsMap: {}
11
- };
12
- const useDebouncedFetchSection = (query, cioClient, autocompleteSections) => {
13
- const [sectionsData, setSectionsData] = (0, react_1.useState)({});
14
- const debouncedSearchTerm = (0, useDebounce_1.default)(query);
15
- if (autocompleteSections) {
16
- autocompleteParameters.resultsPerSection = autocompleteSections.reduce((acc, sectionConfig) => (Object.assign(Object.assign({}, acc), { [sectionConfig.identifier]: (sectionConfig === null || sectionConfig === void 0 ? void 0 : sectionConfig.numResults) || 8 })), {});
17
- }
18
- (0, react_1.useEffect)(() => {
19
- if (debouncedSearchTerm) {
20
- cioClient === null || cioClient === void 0 ? void 0 : cioClient.autocomplete.getAutocompleteResults(debouncedSearchTerm, autocompleteParameters).then((response) => {
21
- const newSectionsData = {};
22
- Object.keys(response.sections).forEach((section) => {
23
- newSectionsData[section] = response.sections[section].map((item) => (Object.assign(Object.assign({}, item), { section })));
24
- });
25
- setSectionsData(newSectionsData);
26
- });
27
- }
28
- else if (!debouncedSearchTerm) {
29
- setSectionsData({});
30
- }
31
- }, [debouncedSearchTerm, cioClient]);
32
- return sectionsData;
33
- };
34
- exports.default = useDebouncedFetchSection;
35
- //# sourceMappingURL=useDebouncedFetchSections.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDebouncedFetchSections.js","sourceRoot":"","sources":["../../../src/hooks/useDebouncedFetchSections.ts"],"names":[],"mappings":";;AAAA,iCAA4C;AAE5C,+CAAwC;AAaxC,MAAM,sBAAsB,GAAG;IAC7B,iBAAiB,EAAE,EAAE;IACrB,iBAAiB;IACjB,oBAAoB;IACpB,eAAe;IACf,oBAAoB;CACM,CAAC;AAE7B,MAAM,wBAAwB,GAAG,CAC/B,KAAa,EACb,SAA+B,EAC/B,oBAA6C,EAC7C,EAAE;IACF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAA6B,EAAE,CAAC,CAAC;IACjF,MAAM,mBAAmB,GAAG,IAAA,qBAAW,EAAC,KAAK,CAAC,CAAC;IAE/C,IAAI,oBAAoB,EAAE;QACxB,sBAAsB,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,MAAM,CACpE,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,iCACnB,GAAG,KACN,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,UAAU,KAAI,CAAC,IAC1D,EACF,EAAE,CACH,CAAC;KACH;IAED,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,mBAAmB,EAAE;YACvB,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,YAAY,CACpB,sBAAsB,CAAC,mBAAmB,EAAE,sBAAsB,EAClE,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACjB,MAAM,eAAe,GAA+B,EAAE,CAAC;gBACvD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAe,EAAE,EAAE;oBACzD,eAAe,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iCAC/D,IAAI,KACP,OAAO,IACP,CAAC,CAAC;gBACN,CAAC,CAAC,CAAC;gBACH,eAAe,CAAC,eAAe,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACN;aAAM,IAAI,CAAC,mBAAmB,EAAE;YAC/B,eAAe,CAAC,EAAE,CAAC,CAAC;SACrB;IACH,CAAC,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC,CAAC;IAErC,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,kBAAe,wBAAwB,CAAC"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const downshift_1 = require("downshift");
5
- let idCounter = 0;
6
- const useDownShift = ({ setQuery, items, onSubmit, cioClient, previousQuery = '', onChange }) => (0, downshift_1.useCombobox)({
7
- id: `cio-autocomplete-${idCounter++}`,
8
- items,
9
- itemToString: (item) => (item === null || item === void 0 ? void 0 : item.value) || '',
10
- onInputValueChange: ({ inputValue = '' }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
11
- setQuery(inputValue);
12
- if (onChange) {
13
- onChange(inputValue);
14
- }
15
- }),
16
- onSelectedItemChange({ selectedItem }) {
17
- var _a;
18
- if (selectedItem) {
19
- setQuery(selectedItem.value || '');
20
- if (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value) {
21
- if (onSubmit)
22
- onSubmit({ item: selectedItem, originalQuery: previousQuery });
23
- if (!((_a = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.data) === null || _a === void 0 ? void 0 : _a.url)) {
24
- cioClient === null || cioClient === void 0 ? void 0 : cioClient.tracker.trackSearchSubmit(selectedItem.value, {
25
- original_query: previousQuery
26
- });
27
- }
28
- cioClient === null || cioClient === void 0 ? void 0 : cioClient.tracker.trackAutocompleteSelect(selectedItem.value, {
29
- original_query: previousQuery,
30
- section: selectedItem.section
31
- });
32
- }
33
- }
34
- }
35
- });
36
- exports.default = useDownShift;
37
- //# sourceMappingURL=useDownShift.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDownShift.js","sourceRoot":"","sources":["../../../src/hooks/useDownShift.ts"],"names":[],"mappings":";;;AAAA,yCAAgE;AAIhE,IAAI,SAAS,GAAG,CAAC,CAAC;AAelB,MAAM,YAAY,GAAiB,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,SAAS,EACT,aAAa,GAAG,EAAE,EAClB,QAAQ,EACT,EAAE,EAAE,CACH,IAAA,uBAAW,EAAC;IACV,EAAE,EAAE,oBAAoB,SAAS,EAAE,EAAE;IACrC,KAAK;IACL,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,KAAI,EAAE;IACzC,kBAAkB,EAAE,CAAO,EAAE,UAAU,GAAG,EAAE,EAAE,EAAE,EAAE;QAChD,QAAQ,CAAC,UAAU,CAAC,CAAC;QACrB,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,UAAU,CAAC,CAAC;SACtB;IACH,CAAC,CAAA;IACD,oBAAoB,CAAC,EAAE,YAAY,EAAE;;QACnC,IAAI,YAAY,EAAE;YAChB,QAAQ,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACnC,IAAI,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,EAAE;gBACvB,IAAI,QAAQ;oBAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC,CAAC;gBAC7E,IAAI,CAAC,CAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,0CAAE,GAAG,CAAA,EAAE;oBAC5B,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,KAAK,EAAE;wBACvD,cAAc,EAAE,aAAa;qBAC9B,CAAC,CAAC;iBACJ;gBACD,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,CAAC,uBAAuB,CAAC,YAAY,CAAC,KAAK,EAAE;oBAC7D,cAAc,EAAE,aAAa;oBAC7B,OAAO,EAAE,YAAY,CAAC,OAAO;iBAC9B,CAAC,CAAC;aACJ;SACF;IACH,CAAC;CACF,CAAC,CAAC;AAEL,kBAAe,YAAY,CAAC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const react_1 = require("react");
5
- const useFetchRecommendationPod = (cioClient, recommendationPods) => {
6
- const [recommendationResults, setRecommendationResults] = (0, react_1.useState)({});
7
- (0, react_1.useEffect)(() => {
8
- if (!cioClient || !Array.isArray(recommendationPods) || recommendationPods.length === 0)
9
- return;
10
- const fetchRecommendationResults = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
11
- const responses = yield Promise.all(recommendationPods.map((_a) => {
12
- var { identifier: podId } = _a, parameters = tslib_1.__rest(_a, ["identifier"]);
13
- return cioClient.recommendations.getRecommendations(podId, parameters);
14
- }));
15
- const recommendationPodResults = {};
16
- responses.forEach(({ response }) => {
17
- const { pod, results } = response;
18
- if (pod === null || pod === void 0 ? void 0 : pod.id) {
19
- recommendationPodResults[pod.id] = results === null || results === void 0 ? void 0 : results.map((item) => (Object.assign(Object.assign({}, item), { section: pod.id })));
20
- }
21
- });
22
- setRecommendationResults(recommendationPodResults);
23
- });
24
- fetchRecommendationResults();
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- }, [cioClient]);
27
- return recommendationResults;
28
- };
29
- exports.default = useFetchRecommendationPod;
30
- //# sourceMappingURL=useFetchRecommendationPod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFetchRecommendationPod.js","source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AAC;QACF,0BAA0B,EAAE,CAAC;QAC7B,uDAAuD;IACzD,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,qBAAqB,CAAC;AAC/B,CAAC,CAAC;AAEF,kBAAe,yBAAyB,CAAC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
4
- const usePrevious = (value) => {
5
- const ref = (0, react_1.useRef)();
6
- (0, react_1.useEffect)(() => {
7
- ref.current = value; // assign the value of ref to the argument
8
- }, [value]); // this code will run when the value of 'value' changes
9
- return ref.current; // in the end, return the current ref value.
10
- };
11
- exports.default = usePrevious;
12
- //# sourceMappingURL=usePrevious.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePrevious.js","sourceRoot":"","sources":["../../../src/hooks/usePrevious.ts"],"names":[],"mappings":";;AAAA,iCAA0C;AAE1C,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;IACpC,MAAM,GAAG,GAAG,IAAA,cAAM,GAAU,CAAC;IAC7B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,0CAA0C;IACjE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,uDAAuD;IACpE,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,4CAA4C;AAClE,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
package/lib/cjs/index.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCioAutocomplete = exports.SectionItemsList = exports.SectionItem = exports.SearchInput = exports.CioAutocomplete = exports.AutocompleteResults = void 0;
4
- var AutocompleteResults_1 = require("./components/Autocomplete/AutocompleteResults/AutocompleteResults");
5
- Object.defineProperty(exports, "AutocompleteResults", { enumerable: true, get: function () { return AutocompleteResults_1.default; } });
6
- var CioAutocomplete_1 = require("./components/Autocomplete/CioAutocomplete/CioAutocomplete");
7
- Object.defineProperty(exports, "CioAutocomplete", { enumerable: true, get: function () { return CioAutocomplete_1.default; } });
8
- var SearchInput_1 = require("./components/Autocomplete/SearchInput/SearchInput");
9
- Object.defineProperty(exports, "SearchInput", { enumerable: true, get: function () { return SearchInput_1.default; } });
10
- var SectionItem_1 = require("./components/Autocomplete/SectionItem/SectionItem");
11
- Object.defineProperty(exports, "SectionItem", { enumerable: true, get: function () { return SectionItem_1.default; } });
12
- var SectionItemsList_1 = require("./components/Autocomplete/SectionItemsList/SectionItemsList");
13
- Object.defineProperty(exports, "SectionItemsList", { enumerable: true, get: function () { return SectionItemsList_1.default; } });
14
- var useCioAutocomplete_1 = require("./hooks/useCioAutocomplete");
15
- Object.defineProperty(exports, "useCioAutocomplete", { enumerable: true, get: function () { return useCioAutocomplete_1.default; } });
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yGAAmH;AAA1G,0HAAA,OAAO,OAAuB;AACvC,6FAAuG;AAA9F,kHAAA,OAAO,OAAmB;AACnC,iFAA2F;AAAlF,0GAAA,OAAO,OAAe;AAC/B,iFAA2F;AAAlF,0GAAA,OAAO,OAAe;AAC/B,gGAA0G;AAAjG,oHAAA,OAAO,OAAoB;AACpC,iEAA2E;AAAlE,wHAAA,OAAO,OAAsB"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.argTypes = void 0;
4
- // eslint-disable-next-line
5
- exports.argTypes = {
6
- placeholder: {
7
- description: 'Search input placeholder',
8
- table: {
9
- type: {
10
- summary: 'string'
11
- }
12
- },
13
- control: {
14
- type: 'text'
15
- }
16
- },
17
- apiKey: {
18
- type: { name: 'string' },
19
- description: 'Your constructor API key',
20
- table: {
21
- type: {
22
- summary: 'string'
23
- }
24
- },
25
- control: {
26
- type: 'text'
27
- }
28
- },
29
- onSubmit: {
30
- type: {
31
- name: 'function'
32
- },
33
- description: `On search submit callback function`,
34
- table: {
35
- type: {
36
- summary: 'Function'
37
- }
38
- },
39
- control: null
40
- },
41
- onFocus: {
42
- type: {
43
- name: 'function'
44
- },
45
- description: `On focus callback function`,
46
- table: {
47
- type: {
48
- summary: 'Function'
49
- }
50
- },
51
- control: null
52
- },
53
- openOnFocus: {
54
- description: 'Open results on focus',
55
- table: {
56
- type: {
57
- summary: 'boolean'
58
- }
59
- },
60
- control: {
61
- type: 'boolean'
62
- }
63
- }
64
- };
65
- //# sourceMappingURL=argTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"argTypes.js","sourceRoot":"","sources":["../../../../src/stories/Autocomplete/argTypes.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,QAAQ,GAAG;IACtB,WAAW,EAAE;QACX,WAAW,EAAE,0BAA0B;QACvC,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,OAAO,EAAE,QAAQ;aAClB;SACF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;SACb;KACF;IACD,MAAM,EAAE;QACN,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,WAAW,EAAE,0BAA0B;QACvC,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,OAAO,EAAE,QAAQ;aAClB;SACF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;SACb;KACF;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,IAAI,EAAE,UAAU;SACjB;QACD,WAAW,EAAE,oCAAoC;QACjD,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,OAAO,EAAE,UAAU;aACpB;SACF;QACD,OAAO,EAAE,IAAI;KACd;IACD,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,IAAI,EAAE,UAAU;SACjB;QACD,WAAW,EAAE,4BAA4B;QACzC,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,OAAO,EAAE,UAAU;aACpB;SACF;QACD,OAAO,EAAE,IAAI;KACd;IACD,WAAW,EAAE;QACX,WAAW,EAAE,uBAAuB;QACpC,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,OAAO,EAAE,SAAS;aACnB;SACF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isProduct = void 0;
4
- // Type Guard
5
- // eslint-disable-next-line
6
- function isProduct(item) {
7
- return item.data.image_url !== undefined;
8
- }
9
- exports.isProduct = isProduct;
10
- //# sourceMappingURL=typeGuards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../src/typeGuards.ts"],"names":[],"mappings":";;;AAEA,aAAa;AACb,2BAA2B;AAC3B,SAAgB,SAAS,CAAC,IAAU;IAClC,OAAQ,IAAgB,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC;AACxD,CAAC;AAFD,8BAEC"}
package/lib/cjs/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
package/lib/cjs/utils.js DELETED
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.disableStoryActions = exports.stringify = exports.getStoryParams = exports.sleep = exports.clearConstructorRequests = exports.isTrackingRequestSent = exports.camelToStartCase = exports.getIndexOffset = void 0;
4
- const getIndexOffset = ({ activeSections, sectionIdentifier }) => {
5
- let indexOffset = 0;
6
- if (sectionIdentifier) {
7
- activeSections.find((config) => {
8
- var _a;
9
- if ((config === null || config === void 0 ? void 0 : config.identifier) === sectionIdentifier)
10
- return true; // break out of loop
11
- indexOffset += ((_a = config === null || config === void 0 ? void 0 : config.data) === null || _a === void 0 ? void 0 : _a.length) || 0;
12
- return false; // continue
13
- });
14
- }
15
- return indexOffset;
16
- };
17
- exports.getIndexOffset = getIndexOffset;
18
- const camelToStartCase = (camelCaseString) => camelCaseString
19
- // insert a space before all caps
20
- .replace(/([A-Z])/g, ' $1')
21
- // uppercase the first character
22
- .replace(/^./, (str) => str.toUpperCase());
23
- exports.camelToStartCase = camelToStartCase;
24
- function isTrackingRequestSent(trackingRequestUrl) {
25
- var _a, _b;
26
- // eslint-disable-next-line
27
- const trackingRequestsQueue = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a._constructorio_requests;
28
- return (trackingRequestsQueue &&
29
- ((_b = JSON.parse(trackingRequestsQueue)) === null || _b === void 0 ? void 0 : _b.some((request) => { var _a; return (_a = request === null || request === void 0 ? void 0 : request.url) === null || _a === void 0 ? void 0 : _a.includes(trackingRequestUrl); })));
30
- }
31
- exports.isTrackingRequestSent = isTrackingRequestSent;
32
- function clearConstructorRequests() {
33
- var _a;
34
- // eslint-disable-next-line
35
- if ((_a = window.localStorage) === null || _a === void 0 ? void 0 : _a._constructorio_requests) {
36
- window.localStorage.removeItem('_constructorio_requests');
37
- }
38
- }
39
- exports.clearConstructorRequests = clearConstructorRequests;
40
- // Function to emulate pausing between interactions
41
- function sleep(ms) {
42
- // eslint-disable-next-line
43
- return new Promise((resolve) => setTimeout(resolve, ms));
44
- }
45
- exports.sleep = sleep;
46
- // More on Story layout: https://storybook.js.org/docs/react/configure/story-layout
47
- const getStoryParams = (storyCode, templateCode, importCode) => {
48
- const code = `
49
- ${importCode}
50
- ${storyCode}
51
- ${templateCode}
52
- `;
53
- return {
54
- docs: {
55
- source: {
56
- code,
57
- language: 'jsx',
58
- format: true,
59
- type: 'code'
60
- }
61
- }
62
- };
63
- };
64
- exports.getStoryParams = getStoryParams;
65
- const stringify = (obj) => JSON.stringify(obj, null, ' ');
66
- exports.stringify = stringify;
67
- const disableStoryActions = (story) => {
68
- // eslint-disable-next-line
69
- story.parameters.actions = { argTypesRegex: null };
70
- };
71
- exports.disableStoryActions = disableStoryActions;
72
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAOO,MAAM,cAAc,GAAmB,CAAC,EAAE,cAAc,EAAE,iBAAiB,EAAE,EAAE,EAAE;IACtF,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,IAAI,iBAAiB,EAAE;QACrB,cAAc,CAAC,IAAI,CAAC,CAAC,MAA4B,EAAE,EAAE;;YACnD,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,MAAK,iBAAiB;gBAAE,OAAO,IAAI,CAAC,CAAC,oBAAoB;YAC/E,WAAW,IAAI,CAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,0CAAE,MAAM,KAAI,CAAC,CAAC;YACzC,OAAO,KAAK,CAAC,CAAC,WAAW;QAC3B,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAZW,QAAA,cAAc,kBAYzB;AAIK,MAAM,gBAAgB,GAAqB,CAAC,eAAe,EAAE,EAAE,CACpE,eAAe;IACb,iCAAiC;KAChC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,gCAAgC;KAC/B,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;AALlC,QAAA,gBAAgB,oBAKkB;AAE/C,SAAgB,qBAAqB,CAAC,kBAAkB;;IACtD,2BAA2B;IAC3B,MAAM,qBAAqB,GAAG,MAAA,MAAM,CAAC,YAAY,0CAAE,uBAAuB,CAAC;IAE3E,OAAO,CACL,qBAAqB;SACrB,MAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,0CAAE,IAAI,CAAC,CAAC,O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A,mBAAmB,uBAG9B"}
@@ -1,110 +0,0 @@
1
- /* Autosuggest Container */
2
- .cio-autocomplete {
3
- position: relative;
4
- height: 2rem;
5
- padding: 20px;
6
- font-family: Arial, Helvetica, sans-serif;
7
- }
8
-
9
- /* Autosuggest Form */
10
- .cio-autocomplete .cio-form {
11
- position: relative;
12
- height: 100%;
13
- width: 24rem;
14
- }
15
-
16
- .cio-autocomplete .cio-input {
17
- width: 100%;
18
- height: 100%;
19
- border: 1px solid gray;
20
- padding: 0 10px;
21
- border-radius: 3px;
22
- font-size: 1rem;
23
- }
24
-
25
- .cio-autocomplete .cio-submit-btn,
26
- .cio-autocomplete .cio-clear-btn {
27
- position: absolute;
28
- top: 1px;
29
- bottom: -1px;
30
- right: -21px;
31
- cursor: pointer;
32
- }
33
-
34
- .cio-autocomplete button:disabled {
35
- cursor: not-allowed;
36
- }
37
-
38
- .cio-autocomplete .cio-submit-btn {
39
- right: -21px;
40
- }
41
-
42
- .cio-autocomplete .cio-clear-btn {
43
- right: 10px;
44
- }
45
-
46
- .cio-autocomplete .cio-icon {
47
- display: flex;
48
- justify-content: center;
49
- }
50
-
51
- /* Autosuggest Results */
52
- .cio-autocomplete .cio-results {
53
- position: absolute;
54
- background-color: white;
55
- gap: 20px;
56
- padding-left: 0px;
57
- list-style: none;
58
- display: flex;
59
- flex-direction: row;
60
- z-index: 1000;
61
- margin-top: 5px;
62
- }
63
-
64
- .cio-autocomplete .cio-sectionName {
65
- margin: 15px 0;
66
- font-size: 1rem;
67
- }
68
-
69
- .cio-autocomplete .cio-section-items {
70
- padding: 0;
71
- }
72
-
73
- .cio-autocomplete .cio-item-SearchSuggestions {
74
- flex-direction: column;
75
- min-width: 160px;
76
- }
77
-
78
- .cio-autocomplete .cio-item {
79
- flex: 1;
80
- display: flex;
81
- flex-direction: column;
82
- cursor: pointer;
83
- list-style: none;
84
- padding: 5px;
85
- border-bottom: 3px solid transparent;
86
- }
87
-
88
- .cio-autocomplete .cio-item[aria-selected='true'] {
89
- background-color: hsl(0, 0%, 90%);
90
- border-radius: 4px;
91
- }
92
-
93
- .cio-autocomplete .Products .cio-item {
94
- display: inline-flex;
95
- align-items: center;
96
- width: 25%;
97
- height: 140px;
98
- padding: 5px 0;
99
- }
100
-
101
- .cio-autocomplete .cio-item p {
102
- margin: 0;
103
- overflow: hidden;
104
- }
105
-
106
- .cio-autocomplete .cio-item img {
107
- width: 100%;
108
- max-width: 100px;
109
- max-height: 100px;
110
- }
@@ -1,21 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { CioAutocompleteContext } from '../CioAutocompleteProvider';
3
- import SectionItemsList from '../SectionItemsList/SectionItemsList';
4
- const DefaultRenderResults = ({ sections }) => sections?.map((section) => (React.createElement(SectionItemsList, { section: section, key: section.identifier })));
5
- export default function AutocompleteResults(props) {
6
- const { children = DefaultRenderResults } = props;
7
- const { sections, isOpen, getMenuProps, getItemProps } = useContext(CioAutocompleteContext);
8
- const hasResults = sections && sections.some((section) => section?.data?.length);
9
- let content;
10
- if (isOpen && hasResults) {
11
- content = typeof children === 'function' ? children({ sections, getItemProps }) : children;
12
- }
13
- else {
14
- content = null;
15
- }
16
- const menuProps = {
17
- ...getMenuProps()
18
- };
19
- return React.createElement("ul", { ...menuProps }, content);
20
- }
21
- //# sourceMappingURL=AutocompleteResults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutocompleteResults.js","sourceRoot":"","sources":["../../../../../src/components/Autocomplete/AutocompleteResults/AutocompleteResults.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAWpE,MAAM,oBAAoB,GAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAC3D,QAAQ,EAAE,GAAG,CAAC,CAAC,OAA6B,EAAE,EAAE,CAAC,CAC/C,oBAAC,gBAAgB,IAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,UAAU,GAAI,CAChE,CAAC,CAAC;AAEL,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAA+B;IACzE,MAAM,EAAE,QAAQ,GAAG,oBAAoB,EAAE,GAAG,KAAK,CAAC;IAClD,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAE5F,MAAM,UAAU,GAAG,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAEjF,IAAI,OAAO,CAAC;IACZ,IAAI,MAAM,IAAI,UAAU,EAAE;QACxB,OAAO,GAAG,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;KAC5F;SAAM;QACL,OAAO,GAAG,IAAI,CAAC;KAChB;IAED,MAAM,SAAS,GAAG;QAChB,GAAG,YAAY,EAAE;KAClB,CAAC;IAEF,OAAO,+BAAQ,SAAS,IAAG,OAAO,CAAM,CAAC;AAC3C,CAAC"}
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import CioAutocompleteProvider from '../CioAutocompleteProvider';
3
- import AutocompleteResults from '../AutocompleteResults/AutocompleteResults';
4
- import SearchInput from '../SearchInput/SearchInput';
5
- export default function CioAutocomplete(props) {
6
- const { children } = props;
7
- if (children) {
8
- return React.createElement(CioAutocompleteProvider, { ...props }, children);
9
- }
10
- return (React.createElement("div", null,
11
- React.createElement(CioAutocompleteProvider, { ...props },
12
- React.createElement(SearchInput, null),
13
- React.createElement(AutocompleteResults, null))));
14
- }
15
- //# sourceMappingURL=CioAutocomplete.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CioAutocomplete.js","sourceRoot":"","sources":["../../../../../src/components/Autocomplete/CioAutocomplete/CioAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,uBAAuB,MAAM,4BAA4B,CAAC;AACjE,OAAO,mBAAmB,MAAM,4CAA4C,CAAC;AAC7E,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAGrD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAA2B;IACjE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE3B,IAAI,QAAQ,EAAE;QACZ,OAAO,oBAAC,uBAAuB,OAAK,KAAK,IAAG,QAAQ,CAA2B,CAAC;KACjF;IAED,OAAO,CACL;QACE,oBAAC,uBAAuB,OAAK,KAAK;YAChC,oBAAC,WAAW,OAAG;YACf,oBAAC,mBAAmB,OAAG,CACC,CACtB,CACP,CAAC;AACJ,CAAC"}
@@ -1,10 +0,0 @@
1
- import React, { createContext } from 'react';
2
- import useCioAutocomplete from '../../hooks/useCioAutocomplete';
3
- export const CioAutocompleteContext = createContext({});
4
- export default function CioAutocompleteProvider(props) {
5
- const { children, ...restProps } = props;
6
- const cioAutocomplete = useCioAutocomplete(restProps);
7
- return (React.createElement(CioAutocompleteContext.Provider, { value: cioAutocomplete },
8
- React.createElement("div", { className: cioAutocomplete.autocompleteClassName }, children)));
9
- }
10
- //# sourceMappingURL=CioAutocompleteProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CioAutocompleteProvider.js","sourceRoot":"","sources":["../../../../src/components/Autocomplete/CioAutocompleteProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,kBAAkB,MAAM,gCAAgC,CAAC;AAGhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CACjD,EAA2C,CAC5C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAA2B;IACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,eAAe,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEtD,OAAO,CACL,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe;QACrD,6BAAK,SAAS,EAAE,eAAe,CAAC,qBAAqB,IAAG,QAAQ,CAAO,CACvC,CACnC,CAAC;AACJ,CAAC"}
@@ -1,27 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { CioAutocompleteContext } from '../CioAutocompleteProvider';
3
- function DefaultRenderInput({ getFormProps, getInputProps, getLabelProps, setQuery }) {
4
- const inputProps = getInputProps();
5
- return (React.createElement("form", { ...getFormProps() },
6
- React.createElement("label", { ...getLabelProps(), htmlFor: 'cio-input' },
7
- React.createElement("input", { id: 'cio-input', ...inputProps })),
8
- React.createElement("button", { className: 'cio-clear-btn', "data-testid": 'cio-clear-btn', hidden: !inputProps.value, onClick: () => {
9
- setQuery('');
10
- if (inputProps.id) {
11
- setTimeout(() => document.getElementById(inputProps.id)?.focus(), 100);
12
- }
13
- }, type: 'button', "aria-label": 'Clear search field text' },
14
- React.createElement("div", { className: 'cio-icon' },
15
- React.createElement("svg", { stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', height: '1em', width: '1em', xmlns: 'http://www.w3.org/2000/svg' },
16
- React.createElement("path", { d: 'M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z' })))),
17
- React.createElement("button", { className: 'cio-submit-btn', "data-testid": 'cio-submit-btn', disabled: !inputProps.value, type: 'submit', "aria-label": 'Submit Search' },
18
- React.createElement("div", { className: 'cio-icon' },
19
- React.createElement("svg", { stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', height: '1em', width: '1em', xmlns: 'http://www.w3.org/2000/svg' },
20
- React.createElement("path", { d: 'M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z' }))))));
21
- }
22
- export default function SearchInput(props) {
23
- const { children = DefaultRenderInput } = props;
24
- const { getFormProps, getInputProps, getLabelProps, setQuery } = useContext(CioAutocompleteContext);
25
- return children({ getFormProps, getInputProps, getLabelProps, setQuery });
26
- }
27
- //# sourceMappingURL=SearchInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../../../src/components/Autocomplete/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAMpE,SAAS,kBAAkB,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE;IAClF,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,OAAO,CACL,iCAAU,YAAY,EAAE;QACtB,kCAAW,aAAa,EAAE,EAAE,OAAO,EAAC,WAAW;YAC7C,+BAAO,EAAE,EAAC,WAAW,KAAK,UAAU,GAAI,CAClC;QACR,gCACE,SAAS,EAAC,eAAe,iBACb,eAAe,EAC3B,MAAM,EAAE,CAAC,UAAU,CAAC,KAAK,EACzB,OAAO,EAAE,GAAG,EAAE;gBACZ,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACb,IAAI,UAAU,CAAC,EAAE,EAAE;oBACjB,UAAU,CAAC,G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teContext } from '../CioAutocompleteProvider';
3
- import { isProduct } from '../../../typeGuards';
4
- export default function SectionItem(props) {
5
- const { item, index, sectionIdentifier, children } = props;
6
- const { getItemProps } = useContext(CioAutocompleteContext);
7
- let defaultChildren;
8
- if (isProduct(item)) {
9
- defaultChildren = (React.createElement(React.Fragment, null,
10
- React.createElement("img", { "data-testid": 'cio-img', src: item.data?.image_url, alt: item.value }),
11
- React.createElement("p", { "data-testid": 'cio-text' }, item.value)));
12
- }
13
- else {
14
- defaultChildren = item.value;
15
- }
16
- return (React.createElement("li", { ...getItemProps({ item, index, sectionIdentifier }) }, children || defaultChildren));
17
- }
18
- //# sourceMappingURL=SectionItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SectionItem.js","sourceRoot":"","sources":["../../../../../src/components/Autocomplete/SectionItem/SectionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAUhD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAuB;IACzD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAE5D,IAAI,eAAe,CAAC;IACpB,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE;QACnB,eAAe,GAAG,CAChB;YACE,4CAAiB,SAAS,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,GAAI;YACzE,0CAAe,UAAU,IAAE,IAAI,CAAC,KAAK,CAAK,CACzC,CACJ,CAAC;KACH;SAAM;QACL,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC;KAC9B;IAED,OAAO,CACL,+BAAQ,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,IAAG,QAAQ,IAAI,eAAe,CAAM,CAC7F,CAAC;AACJ,CAAC"}