@veeqo/ui 13.0.0 → 13.1.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 (63) hide show
  1. package/dist/components/PhoneInput/PhoneInput.cjs +50 -0
  2. package/dist/components/PhoneInput/PhoneInput.cjs.map +1 -0
  3. package/dist/components/PhoneInput/PhoneInput.d.ts +3 -0
  4. package/dist/components/PhoneInput/PhoneInput.js +44 -0
  5. package/dist/components/PhoneInput/PhoneInput.js.map +1 -0
  6. package/dist/components/PhoneInput/PhoneInput.module.scss.cjs +9 -0
  7. package/dist/components/PhoneInput/PhoneInput.module.scss.cjs.map +1 -0
  8. package/dist/components/PhoneInput/PhoneInput.module.scss.js +7 -0
  9. package/dist/components/PhoneInput/PhoneInput.module.scss.js.map +1 -0
  10. package/dist/components/PhoneInput/components/SelectedCountry.cjs +18 -0
  11. package/dist/components/PhoneInput/components/SelectedCountry.cjs.map +1 -0
  12. package/dist/components/PhoneInput/components/SelectedCountry.d.ts +5 -0
  13. package/dist/components/PhoneInput/components/SelectedCountry.js +12 -0
  14. package/dist/components/PhoneInput/components/SelectedCountry.js.map +1 -0
  15. package/dist/components/PhoneInput/constants.cjs +1243 -0
  16. package/dist/components/PhoneInput/constants.cjs.map +1 -0
  17. package/dist/components/PhoneInput/constants.d.ts +4 -0
  18. package/dist/components/PhoneInput/constants.js +1239 -0
  19. package/dist/components/PhoneInput/constants.js.map +1 -0
  20. package/dist/components/PhoneInput/hooks/useApplyCountryCode.cjs +48 -0
  21. package/dist/components/PhoneInput/hooks/useApplyCountryCode.cjs.map +1 -0
  22. package/dist/components/PhoneInput/hooks/useApplyCountryCode.d.ts +11 -0
  23. package/dist/components/PhoneInput/hooks/useApplyCountryCode.js +46 -0
  24. package/dist/components/PhoneInput/hooks/useApplyCountryCode.js.map +1 -0
  25. package/dist/components/PhoneInput/index.cjs +11 -0
  26. package/dist/components/PhoneInput/index.cjs.map +1 -0
  27. package/dist/components/PhoneInput/index.d.ts +308 -0
  28. package/dist/components/PhoneInput/index.js +9 -0
  29. package/dist/components/PhoneInput/index.js.map +1 -0
  30. package/dist/components/PhoneInput/types.d.ts +25 -0
  31. package/dist/components/PhoneInput/utils/utils.cjs +69 -0
  32. package/dist/components/PhoneInput/utils/utils.cjs.map +1 -0
  33. package/dist/components/PhoneInput/utils/utils.d.ts +14 -0
  34. package/dist/components/PhoneInput/utils/utils.js +60 -0
  35. package/dist/components/PhoneInput/utils/utils.js.map +1 -0
  36. package/dist/components/SelectDropdown/SelectDropdown.cjs +2 -3
  37. package/dist/components/SelectDropdown/SelectDropdown.cjs.map +1 -1
  38. package/dist/components/SelectDropdown/SelectDropdown.d.ts +1 -1
  39. package/dist/components/SelectDropdown/SelectDropdown.js +2 -3
  40. package/dist/components/SelectDropdown/SelectDropdown.js.map +1 -1
  41. package/dist/components/SelectDropdown/components/ItemContent/ItemContent.cjs +2 -2
  42. package/dist/components/SelectDropdown/components/ItemContent/ItemContent.cjs.map +1 -1
  43. package/dist/components/SelectDropdown/components/ItemContent/ItemContent.d.ts +1 -1
  44. package/dist/components/SelectDropdown/components/ItemContent/ItemContent.js +2 -2
  45. package/dist/components/SelectDropdown/components/ItemContent/ItemContent.js.map +1 -1
  46. package/dist/components/SelectDropdown/components/ItemContent/SelectionType.cjs +5 -3
  47. package/dist/components/SelectDropdown/components/ItemContent/SelectionType.cjs.map +1 -1
  48. package/dist/components/SelectDropdown/components/ItemContent/SelectionType.d.ts +2 -1
  49. package/dist/components/SelectDropdown/components/ItemContent/SelectionType.js +5 -3
  50. package/dist/components/SelectDropdown/components/ItemContent/SelectionType.js.map +1 -1
  51. package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs +2 -2
  52. package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs.map +1 -1
  53. package/dist/components/SelectDropdown/components/ListItem/ListItem.d.ts +1 -1
  54. package/dist/components/SelectDropdown/components/ListItem/ListItem.js +2 -2
  55. package/dist/components/SelectDropdown/components/ListItem/ListItem.js.map +1 -1
  56. package/dist/components/SelectDropdown/components/types.d.ts +1 -0
  57. package/dist/components/SelectDropdown/types.d.ts +2 -1
  58. package/dist/components/index.d.ts +1 -0
  59. package/dist/index.cjs +4 -2
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.js +1 -0
  62. package/dist/index.js.map +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { withLabels } from '../../hoc/withLabels/withLabels.js';
2
+ import 'react';
3
+ import { PhoneInput as PhoneInput$1 } from './PhoneInput.js';
4
+
5
+ const PhoneInput = withLabels(PhoneInput$1);
6
+ PhoneInput.displayName = 'PhoneInput';
7
+
8
+ export { PhoneInput };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/PhoneInput/index.ts"],"sourcesContent":["import { withLabels } from '../../hoc';\nimport { PhoneInput as StandardPhoneInput } from './PhoneInput';\n\nexport const PhoneInput = withLabels(StandardPhoneInput);\n\nPhoneInput.displayName = 'PhoneInput';\n"],"names":["StandardPhoneInput"],"mappings":";;;;MAGa,UAAU,GAAG,UAAU,CAACA,YAAkB;AAEvD,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
@@ -0,0 +1,25 @@
1
+ import { ReactElement } from 'react';
2
+ import { TextFieldProps } from '../TextField';
3
+ export type PhoneOption = {
4
+ id: string;
5
+ label: string;
6
+ itemInfoSlot: ReactElement;
7
+ shouldDisableSelectionRender: boolean;
8
+ mediaSlot: ReactElement;
9
+ };
10
+ export type InternationalCode = {
11
+ countryCode: string;
12
+ country: string;
13
+ countryFlag: string;
14
+ length: number;
15
+ };
16
+ export type PhoneInputProps = TextFieldProps & {
17
+ value?: string;
18
+ onChange?: (value: string) => void;
19
+ hasError?: boolean;
20
+ disabled?: boolean;
21
+ error?: string;
22
+ className?: string;
23
+ };
24
+ export type PhoneOptions = PhoneOption[];
25
+ export type InternationalCodes = Record<string, InternationalCode>;
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var constants = require('../constants.cjs');
5
+ var Text = require('../../Text/Text.cjs');
6
+ var Image = require('../../Image/Image.cjs');
7
+ var PhoneInput_module = require('../PhoneInput.module.scss.cjs');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
12
+
13
+ const buildPhoneOptions = () => {
14
+ const phoneOptionsFromInternationalCode = Object.entries(constants.InternationalCodesMap).map(([dialingCode, country]) => ({
15
+ id: dialingCode,
16
+ label: country.country,
17
+ itemInfoSlot: React__default.default.createElement(Text.Text, { variant: "hintText" }, dialingCode),
18
+ shouldDisableSelectionRender: true,
19
+ mediaSlot: country.countryFlag ? (React__default.default.createElement(Image.Image, { className: PhoneInput_module.countryFlagSVG, src: `https://static.veeqo.com/static_content/country_flags/${country.countryFlag}.svg`, alt: `${country.country} flag` })) : (React__default.default.createElement(Text.Text, null, country.countryCode)),
20
+ }));
21
+ return phoneOptionsFromInternationalCode;
22
+ };
23
+ const filterPhoneOptions = (phoneOptions, searchTerm) => {
24
+ if (!searchTerm.trim())
25
+ return phoneOptions;
26
+ const normalizedSearchTerm = searchTerm.toLowerCase().trim();
27
+ return phoneOptions.reduce((acc, option) => {
28
+ const countryName = option.label.toLowerCase();
29
+ const dialingCode = `+${option.id}`;
30
+ if (countryName.includes(normalizedSearchTerm) || dialingCode.includes(normalizedSearchTerm)) {
31
+ acc.push(option);
32
+ }
33
+ return acc;
34
+ }, []);
35
+ };
36
+ /**
37
+ * Function which extracts the country code from a phone number
38
+ * @param {string} phoneNumber phone number entered into the textfield, formatted or not
39
+ * @returns {string} the country code extracted from the phone number
40
+ *
41
+ * @example
42
+ * extractCountryCodeFromPhoneNumber('+123456789')
43
+ * returns '+1'
44
+ */
45
+ const extractCountryCodeFromPhoneNumber = (phoneNumber) => {
46
+ const normalisedPhoneNumber = phoneNumber.replace(/[^\d+]/g, '');
47
+ if (!normalisedPhoneNumber.startsWith('+'))
48
+ return null;
49
+ const matches = Object.keys(constants.InternationalCodesMap).reduce((longestMatchingDialingCode, dialingCode) => {
50
+ return normalisedPhoneNumber.startsWith(dialingCode) &&
51
+ dialingCode.length > ((longestMatchingDialingCode === null || longestMatchingDialingCode === undefined ? undefined : longestMatchingDialingCode.length) || 0)
52
+ ? dialingCode
53
+ : longestMatchingDialingCode;
54
+ }, null);
55
+ return matches;
56
+ };
57
+ const applyLengthLimit = (phoneNumber, countryCode) => {
58
+ var _a;
59
+ const normalizedPhone = phoneNumber.replace(/[^\d+]/g, '');
60
+ const maxLength = ((_a = constants.InternationalCodesMap[countryCode]) === null || _a === undefined ? undefined : _a.length) || Infinity;
61
+ const remainingDigits = normalizedPhone.slice(countryCode.length, countryCode.length + maxLength);
62
+ return remainingDigits;
63
+ };
64
+
65
+ exports.applyLengthLimit = applyLengthLimit;
66
+ exports.buildPhoneOptions = buildPhoneOptions;
67
+ exports.extractCountryCodeFromPhoneNumber = extractCountryCodeFromPhoneNumber;
68
+ exports.filterPhoneOptions = filterPhoneOptions;
69
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","sources":["../../../../src/components/PhoneInput/utils/utils.tsx"],"sourcesContent":["import React from 'react';\nimport { InternationalCodesMap } from '../constants';\nimport { Text } from '../../Text';\nimport { Image } from '../../Image';\nimport styles from '../PhoneInput.module.scss';\nimport { PhoneOptions } from '../types';\n\nexport const buildPhoneOptions = (): PhoneOptions => {\n const phoneOptionsFromInternationalCode = Object.entries(InternationalCodesMap).map(\n ([dialingCode, country]) => ({\n id: dialingCode,\n label: country.country,\n itemInfoSlot: <Text variant=\"hintText\">{dialingCode}</Text>,\n shouldDisableSelectionRender: true,\n mediaSlot: country.countryFlag ? (\n <Image\n className={styles.countryFlagSVG}\n src={`https://static.veeqo.com/static_content/country_flags/${country.countryFlag}.svg`}\n alt={`${country.country} flag`}\n />\n ) : (\n <Text>{country.countryCode}</Text>\n ),\n }),\n );\n\n return phoneOptionsFromInternationalCode;\n};\n\nexport const filterPhoneOptions = (\n phoneOptions: PhoneOptions,\n searchTerm: string,\n): PhoneOptions => {\n if (!searchTerm.trim()) return phoneOptions;\n\n const normalizedSearchTerm = searchTerm.toLowerCase().trim();\n\n return phoneOptions.reduce<PhoneOptions>((acc, option) => {\n const countryName = option.label.toLowerCase();\n const dialingCode = `+${option.id}`;\n\n if (countryName.includes(normalizedSearchTerm) || dialingCode.includes(normalizedSearchTerm)) {\n acc.push(option);\n }\n return acc;\n }, []);\n};\n\n/**\n * Function which extracts the country code from a phone number\n * @param {string} phoneNumber phone number entered into the textfield, formatted or not\n * @returns {string} the country code extracted from the phone number\n *\n * @example\n * extractCountryCodeFromPhoneNumber('+123456789')\n * returns '+1'\n */\nexport const extractCountryCodeFromPhoneNumber = (phoneNumber: string): string | null => {\n const normalisedPhoneNumber = phoneNumber.replace(/[^\\d+]/g, '');\n\n if (!normalisedPhoneNumber.startsWith('+')) return null;\n\n const matches = Object.keys(InternationalCodesMap).reduce(\n (longestMatchingDialingCode: string | null, dialingCode) => {\n return normalisedPhoneNumber.startsWith(dialingCode) &&\n dialingCode.length > (longestMatchingDialingCode?.length || 0)\n ? dialingCode\n : longestMatchingDialingCode;\n },\n null,\n );\n\n return matches;\n};\n\nexport const applyLengthLimit = (phoneNumber: string, countryCode: string): string => {\n const normalizedPhone = phoneNumber.replace(/[^\\d+]/g, '');\n const maxLength = InternationalCodesMap[countryCode]?.length || Infinity;\n const remainingDigits = normalizedPhone.slice(countryCode.length, countryCode.length + maxLength);\n\n return remainingDigits;\n};\n"],"names":["InternationalCodesMap","React","Text","Image","styles"],"mappings":";;;;;;;;;;;;AAOO,MAAM,iBAAiB,GAAG,MAAmB;IAClD,MAAM,iCAAiC,GAAG,MAAM,CAAC,OAAO,CAACA,+BAAqB,CAAC,CAAC,GAAG,CACjF,CAAC,CAAC,WAAW,EAAE,OAAO,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G,CAAC,WAAmB,KAAmB;IACtF,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;AAEhE,IAAA,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,IAAI;AAEvD,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAACF,+BAAqB,CAAC,CAAC,MAAM,CACvD,CAAC,0BAAyC,EAAE,WAAW,KAAI;AACzD,QAAA,OAAO,qBAAqB,CAAC,UAAU,CAAC,WAAW,CAAC;AAClD,YAAA,WAAW,CAAC,MAAM,IAAI,CAAA,0BAA0B,KAAA,IAAA,IAA1B,0BAA0B,KAAA,SAAA,GAAA,SAAA,GAA1B,0BAA0B,CAAE,MAAM,KAAI,CAAC;AAC7D,cAAE;cACA,0BAA0B;KAC/B,EACD,IAAI,CACL;AAED,IAAA,OAAO,OAAO;AAChB;MAEa,gBAAgB,GAAG,CAAC,WAAmB,EAAE,WAAmB,KAAY;;IACnF,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;AAC1D,IAAA,MAAM,SAAS,GAAG,CAAA,CAAA,EAAA,GAAAA,+BAAqB,CAAC,WAAW,CAAC,MAAE,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,MAAM,KAAI,QAAQ;AACxE,IAAA,MAAM,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC;AAEjG,IAAA,OAAO,eAAe;AACxB;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ import { PhoneOptions } from '../types';
2
+ export declare const buildPhoneOptions: () => PhoneOptions;
3
+ export declare const filterPhoneOptions: (phoneOptions: PhoneOptions, searchTerm: string) => PhoneOptions;
4
+ /**
5
+ * Function which extracts the country code from a phone number
6
+ * @param {string} phoneNumber phone number entered into the textfield, formatted or not
7
+ * @returns {string} the country code extracted from the phone number
8
+ *
9
+ * @example
10
+ * extractCountryCodeFromPhoneNumber('+123456789')
11
+ * returns '+1'
12
+ */
13
+ export declare const extractCountryCodeFromPhoneNumber: (phoneNumber: string) => string | null;
14
+ export declare const applyLengthLimit: (phoneNumber: string, countryCode: string) => string;
@@ -0,0 +1,60 @@
1
+ import React__default from 'react';
2
+ import { InternationalCodesMap } from '../constants.js';
3
+ import { Text } from '../../Text/Text.js';
4
+ import { Image } from '../../Image/Image.js';
5
+ import styles from '../PhoneInput.module.scss.js';
6
+
7
+ const buildPhoneOptions = () => {
8
+ const phoneOptionsFromInternationalCode = Object.entries(InternationalCodesMap).map(([dialingCode, country]) => ({
9
+ id: dialingCode,
10
+ label: country.country,
11
+ itemInfoSlot: React__default.createElement(Text, { variant: "hintText" }, dialingCode),
12
+ shouldDisableSelectionRender: true,
13
+ mediaSlot: country.countryFlag ? (React__default.createElement(Image, { className: styles.countryFlagSVG, src: `https://static.veeqo.com/static_content/country_flags/${country.countryFlag}.svg`, alt: `${country.country} flag` })) : (React__default.createElement(Text, null, country.countryCode)),
14
+ }));
15
+ return phoneOptionsFromInternationalCode;
16
+ };
17
+ const filterPhoneOptions = (phoneOptions, searchTerm) => {
18
+ if (!searchTerm.trim())
19
+ return phoneOptions;
20
+ const normalizedSearchTerm = searchTerm.toLowerCase().trim();
21
+ return phoneOptions.reduce((acc, option) => {
22
+ const countryName = option.label.toLowerCase();
23
+ const dialingCode = `+${option.id}`;
24
+ if (countryName.includes(normalizedSearchTerm) || dialingCode.includes(normalizedSearchTerm)) {
25
+ acc.push(option);
26
+ }
27
+ return acc;
28
+ }, []);
29
+ };
30
+ /**
31
+ * Function which extracts the country code from a phone number
32
+ * @param {string} phoneNumber phone number entered into the textfield, formatted or not
33
+ * @returns {string} the country code extracted from the phone number
34
+ *
35
+ * @example
36
+ * extractCountryCodeFromPhoneNumber('+123456789')
37
+ * returns '+1'
38
+ */
39
+ const extractCountryCodeFromPhoneNumber = (phoneNumber) => {
40
+ const normalisedPhoneNumber = phoneNumber.replace(/[^\d+]/g, '');
41
+ if (!normalisedPhoneNumber.startsWith('+'))
42
+ return null;
43
+ const matches = Object.keys(InternationalCodesMap).reduce((longestMatchingDialingCode, dialingCode) => {
44
+ return normalisedPhoneNumber.startsWith(dialingCode) &&
45
+ dialingCode.length > ((longestMatchingDialingCode === null || longestMatchingDialingCode === undefined ? undefined : longestMatchingDialingCode.length) || 0)
46
+ ? dialingCode
47
+ : longestMatchingDialingCode;
48
+ }, null);
49
+ return matches;
50
+ };
51
+ const applyLengthLimit = (phoneNumber, countryCode) => {
52
+ var _a;
53
+ const normalizedPhone = phoneNumber.replace(/[^\d+]/g, '');
54
+ const maxLength = ((_a = InternationalCodesMap[countryCode]) === null || _a === undefined ? undefined : _a.length) || Infinity;
55
+ const remainingDigits = normalizedPhone.slice(countryCode.length, countryCode.length + maxLength);
56
+ return remainingDigits;
57
+ };
58
+
59
+ export { applyLengthLimit, buildPhoneOptions, extractCountryCodeFromPhoneNumber, filterPhoneOptions };
60
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/PhoneInput/utils/utils.tsx"],"sourcesContent":["import React from 'react';\nimport { InternationalCodesMap } from '../constants';\nimport { Text } from '../../Text';\nimport { Image } from '../../Image';\nimport styles from '../PhoneInput.module.scss';\nimport { PhoneOptions } from '../types';\n\nexport const buildPhoneOptions = (): PhoneOptions => {\n const phoneOptionsFromInternationalCode = Object.entries(InternationalCodesMap).map(\n ([dialingCode, country]) => ({\n id: dialingCode,\n label: country.country,\n itemInfoSlot: <Text variant=\"hintText\">{dialingCode}</Text>,\n shouldDisableSelectionRender: true,\n mediaSlot: country.countryFlag ? (\n <Image\n className={styles.countryFlagSVG}\n src={`https://static.veeqo.com/static_content/country_flags/${country.countryFlag}.svg`}\n alt={`${country.country} flag`}\n />\n ) : (\n <Text>{country.countryCode}</Text>\n ),\n }),\n );\n\n return phoneOptionsFromInternationalCode;\n};\n\nexport const filterPhoneOptions = (\n phoneOptions: PhoneOptions,\n searchTerm: string,\n): PhoneOptions => {\n if (!searchTerm.trim()) return phoneOptions;\n\n const normalizedSearchTerm = searchTerm.toLowerCase().trim();\n\n return phoneOptions.reduce<PhoneOptions>((acc, option) => {\n const countryName = option.label.toLowerCase();\n const dialingCode = `+${option.id}`;\n\n if (countryName.includes(normalizedSearchTerm) || dialingCode.includes(normalizedSearchTerm)) {\n acc.push(option);\n }\n return acc;\n }, []);\n};\n\n/**\n * Function which extracts the country code from a phone number\n * @param {string} phoneNumber phone number entered into the textfield, formatted or not\n * @returns {string} the country code extracted from the phone number\n *\n * @example\n * extractCountryCodeFromPhoneNumber('+123456789')\n * returns '+1'\n */\nexport const extractCountryCodeFromPhoneNumber = (phoneNumber: string): string | null => {\n const normalisedPhoneNumber = phoneNumber.replace(/[^\\d+]/g, '');\n\n if (!normalisedPhoneNumber.startsWith('+')) return null;\n\n const matches = Object.keys(InternationalCodesMap).reduce(\n (longestMatchingDialingCode: string | null, dialingCode) => {\n return normalisedPhoneNumber.startsWith(dialingCode) &&\n dialingCode.length > (longestMatchingDialingCode?.length || 0)\n ? dialingCode\n : longestMatchingDialingCode;\n },\n null,\n );\n\n return matches;\n};\n\nexport const applyLengthLimit = (phoneNumber: string, countryCode: string): string => {\n const normalizedPhone = phoneNumber.replace(/[^\\d+]/g, '');\n const maxLength = InternationalCodesMap[countryCode]?.length || Infinity;\n const remainingDigits = normalizedPhone.slice(countryCode.length, countryCode.length + maxLength);\n\n return remainingDigits;\n};\n"],"names":["React"],"mappings":";;;;;;AAOO,MAAM,iBAAiB,GAAG,MAAmB;IAClD,MAAM,iCAAiC,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,GAAG,CACjF,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM;AAC3B,QAAA,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,OAAO,CA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AS,EAAE,EAAE,CAAC;AAEhE,IAAA,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,IAAI;AAEvD,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,MAAM,CACvD,CAAC,0BAAyC,EAAE,WAAW,KAAI;AACzD,QAAA,OAAO,qBAAqB,CAAC,UAAU,CAAC,WAAW,CAAC;AAClD,YAAA,WAAW,CAAC,MAAM,IAAI,CAAA,0BAA0B,KAAA,IAAA,IAA1B,0BAA0B,KAAA,SAAA,GAAA,SAAA,GAA1B,0BAA0B,CAAE,MAAM,KAAI,CAAC;AAC7D,cAAE;cACA,0BAA0B;KAC/B,EACD,IAAI,CACL;AAED,IAAA,OAAO,OAAO;AAChB;MAEa,gBAAgB,GAAG,CAAC,WAAmB,EAAE,WAAmB,KAAY;;IACnF,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;AAC1D,IAAA,MAAM,SAAS,GAAG,CAAA,CAAA,EAAA,GAAA,qBAAqB,CAAC,WAAW,CAAC,MAAE,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,MAAM,KAAI,QAAQ;AACxE,IAAA,MAAM,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC;AAEjG,IAAA,OAAO,eAAe;AACxB;;;;"}
@@ -17,7 +17,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
17
17
 
18
18
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
19
19
 
20
- const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen = false, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
20
+ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, selectedSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen = false, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
21
21
  const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);
22
22
  const classNames = utils.generateClassNames(className);
23
23
  const [isSelectOpen, setIsSelectOpen] = React.useState(false);
@@ -48,8 +48,7 @@ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple =
48
48
  form_module.base,
49
49
  hasError && form_module.error,
50
50
  compact && form_module.compact,
51
- ]) },
52
- React__default.default.createElement(SelectedOption.SelectedOption, { placeholder: placeholder, options: selectedValues, selectionMode: selectionMode })));
51
+ ]) }, selectedSlot || (React__default.default.createElement(SelectedOption.SelectedOption, { placeholder: placeholder, options: selectedValues, selectionMode: selectionMode }))));
53
52
  } },
54
53
  onSearchChange && (React__default.default.createElement(React__default.default.Fragment, null,
55
54
  React__default.default.createElement(Search.Search, { className: SelectDropdown_module.search, value: searchValue, onChange: onSearchChange }),
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDropdown.cjs","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useState } from 'react';\nimport { Selection } from 'react-aria-components';\n\nimport { buildClassnames } from '../../utils';\nimport { SelectedOption } from './components/SelectedOption';\nimport { generateClassNames, getSelectedValues } from './utils';\nimport { SelectDropdownItem, SelectDropdownProps } from './types';\nimport { GridItemProps } from './components/GridItem/types';\nimport { Dropdown } from '../Dropdown';\nimport { Search } from '../Search';\nimport { Button } from '../Button';\nimport styles from './SelectDropdown.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\nimport { ListBox } from './components/OptionsContainers/ListBox';\nimport { GridList } from './components/OptionsContainers/GridList';\n\nexport const SelectDropdown = ({\n id,\n className,\n placeholder = 'Select item',\n multiple = false,\n compact = false,\n hasError = false,\n disabled,\n options,\n value,\n actions,\n isLoading = false,\n searchValue,\n emptyStateSlot,\n onSearchChange,\n onChange,\n topAction,\n isSelectDropdownOpen = false,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...otherProps\n}: SelectDropdownProps) => {\n const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);\n const classNames = generateClassNames(className);\n\n const [isSelectOpen, setIsSelectOpen] = useState(false);\n\n const selectedValues = getSelectedValues(options, hasSection, value);\n const selectionMode = multiple ? 'multiple' : 'single';\n const hasRowAction = options.some(\n (option) => 'onClickRowAction' in option && option.onClickRowAction,\n );\n\n const onSelectionChange = useCallback(\n (keys: Selection) => {\n const selectedKeys = Array.from(keys);\n const newSelectedValues = getSelectedValues(options, hasSection, selectedKeys);\n\n if (multiple) {\n (onChange as (items: SelectDropdownItem[]) => void)(newSelectedValues);\n } else {\n (onChange as (item: SelectDropdownItem) => void)(newSelectedValues[0]);\n if (!isSelectDropdownOpen) {\n setIsSelectOpen(false);\n }\n }\n },\n [options, hasSection, multiple, onChange, isSelectDropdownOpen],\n );\n\n return (\n <Dropdown\n id={`select-dropdown-${id}`}\n className={buildClassnames([classNames?.popover, styles.dropdown, className])}\n shouldShow={isSelectOpen}\n setShouldShow={setIsSelectOpen}\n useAnchorWidth\n disabled={disabled}\n renderCta={(buttonProps, anchorRef) => {\n if (anchorRef && isSelectDropdownOpen) {\n setIsSelectOpen(isSelectDropdownOpen);\n }\n\n return (\n <button\n {...buttonProps}\n type=\"button\"\n ref={anchorRef}\n className={buildClassnames([\n className,\n styles.dropdownTrigger,\n formStyles.fullStyles,\n formStyles.base,\n hasError && formStyles.error,\n compact && formStyles.compact,\n ])}\n >\n <SelectedOption\n placeholder={placeholder}\n options={selectedValues}\n selectionMode={selectionMode}\n />\n </button>\n );\n }}\n >\n {onSearchChange && (\n <>\n <Search className={styles.search} value={searchValue} onChange={onSearchChange} />\n <hr className={styles.separator} />\n </>\n )}\n {topAction && (\n <Fragment key={topAction.label}>\n <Button\n className={styles.ctaButton}\n key={topAction.label}\n variant=\"flat\"\n {...topAction}\n />\n <hr className={styles.separator} key={`separator-${topAction.label}`} />\n </Fragment>\n )}\n {hasRowAction ? (\n <GridList\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options as GridItemProps[]}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues as GridItemProps[]}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n {...otherProps}\n />\n ) : (\n <ListBox\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n hasSection={hasSection}\n {...otherProps}\n />\n )}\n {actions?.map(({ label, ...actionProps }) => (\n <Fragment key={label}>\n <hr className={styles.separator} key={`separator-${label}`} />\n <Button className={styles.ctaButton} variant=\"flat\" key={label} {...actionProps} />\n </Fragment>\n ))}\n </Dropdown>\n );\n};\n"],"names":["generateClassNames","useState","getSelectedValues","useCallback","React","Dropdown","buildClassnames","styles","formStyles","SelectedOption","Search","Fragment","Button","GridList","ListBox"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBO,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,SAAS,EACT,WAAW,GAAG,aAAa,EAC3B,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,oBAAoB,GAAG,KAAK,EAC5B,iBAAi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UAAU,EAAE,UAAU,EAAA,GAClB,UAAU,EAAA,CACd,CACH,EACA,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,SAAA,GAAA,SAAA;AAAP,QAAA,OAAO,CAAE,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,MACtCV,sBAAA,CAAA,aAAA,CAACO,cAAQ,EAAC,EAAA,GAAG,EAAE,KAAK,EAAA;YAClBP,sBAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAEG,qBAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE,EAAI,CAAA;YAC9DH,sBAAC,CAAA,aAAA,CAAAQ,aAAM,IAAC,SAAS,EAAEL,qBAAM,CAAC,SAAS,EAAE,OAAO,EAAC,MAAM,EAAC,GAAG,EAAE,KAAK,EAAA,GAAM,WAAW,EAAA,CAAI,CAC1E,CACZ,CAAC,CACO;AAEf;;;;"}
1
+ {"version":3,"file":"SelectDropdown.cjs","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useState } from 'react';\nimport { Selection } from 'react-aria-components';\n\nimport { buildClassnames } from '../../utils';\nimport { SelectedOption } from './components/SelectedOption';\nimport { generateClassNames, getSelectedValues } from './utils';\nimport { SelectDropdownItem, SelectDropdownProps } from './types';\nimport { GridItemProps } from './components/GridItem/types';\nimport { Dropdown } from '../Dropdown';\nimport { Search } from '../Search';\nimport { Button } from '../Button';\nimport styles from './SelectDropdown.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\nimport { ListBox } from './components/OptionsContainers/ListBox';\nimport { GridList } from './components/OptionsContainers/GridList';\n\nexport const SelectDropdown = ({\n id,\n className,\n placeholder = 'Select item',\n multiple = false,\n compact = false,\n hasError = false,\n disabled,\n options,\n value,\n actions,\n isLoading = false,\n searchValue,\n emptyStateSlot,\n selectedSlot,\n onSearchChange,\n onChange,\n topAction,\n isSelectDropdownOpen = false,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...otherProps\n}: SelectDropdownProps) => {\n const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);\n const classNames = generateClassNames(className);\n\n const [isSelectOpen, setIsSelectOpen] = useState(false);\n\n const selectedValues = getSelectedValues(options, hasSection, value);\n const selectionMode = multiple ? 'multiple' : 'single';\n const hasRowAction = options.some(\n (option) => 'onClickRowAction' in option && option.onClickRowAction,\n );\n\n const onSelectionChange = useCallback(\n (keys: Selection) => {\n const selectedKeys = Array.from(keys);\n const newSelectedValues = getSelectedValues(options, hasSection, selectedKeys);\n\n if (multiple) {\n (onChange as (items: SelectDropdownItem[]) => void)(newSelectedValues);\n } else {\n (onChange as (item: SelectDropdownItem) => void)(newSelectedValues[0]);\n if (!isSelectDropdownOpen) {\n setIsSelectOpen(false);\n }\n }\n },\n [options, hasSection, multiple, onChange, isSelectDropdownOpen],\n );\n\n return (\n <Dropdown\n id={`select-dropdown-${id}`}\n className={buildClassnames([classNames?.popover, styles.dropdown, className])}\n shouldShow={isSelectOpen}\n setShouldShow={setIsSelectOpen}\n useAnchorWidth\n disabled={disabled}\n renderCta={(buttonProps, anchorRef) => {\n if (anchorRef && isSelectDropdownOpen) {\n setIsSelectOpen(isSelectDropdownOpen);\n }\n\n return (\n <button\n {...buttonProps}\n type=\"button\"\n ref={anchorRef}\n className={buildClassnames([\n className,\n styles.dropdownTrigger,\n formStyles.fullStyles,\n formStyles.base,\n hasError && formStyles.error,\n compact && formStyles.compact,\n ])}\n >\n {selectedSlot || (\n <SelectedOption\n placeholder={placeholder}\n options={selectedValues}\n selectionMode={selectionMode}\n />\n )}\n </button>\n );\n }}\n >\n {onSearchChange && (\n <>\n <Search className={styles.search} value={searchValue} onChange={onSearchChange} />\n <hr className={styles.separator} />\n </>\n )}\n {topAction && (\n <Fragment key={topAction.label}>\n <Button\n className={styles.ctaButton}\n key={topAction.label}\n variant=\"flat\"\n {...topAction}\n />\n <hr className={styles.separator} key={`separator-${topAction.label}`} />\n </Fragment>\n )}\n {hasRowAction ? (\n <GridList\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options as GridItemProps[]}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues as GridItemProps[]}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n {...otherProps}\n />\n ) : (\n <ListBox\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n hasSection={hasSection}\n {...otherProps}\n />\n )}\n {actions?.map(({ label, ...actionProps }) => (\n <Fragment key={label}>\n <hr className={styles.separator} key={`separator-${label}`} />\n <Button className={styles.ctaButton} variant=\"flat\" key={label} {...actionProps} />\n </Fragment>\n ))}\n </Dropdown>\n );\n};\n"],"names":["generateClassNames","useState","getSelectedValues","useCallback","React","Dropdown","buildClassnames","styles","formStyles","SelectedOption","Search","Fragment","Button","GridList","ListBox"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBO,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,SAAS,EACT,WAAW,GAAG,aAAa,EAC3B,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,SAAS,EACT,oBAAoB,GAAG,KAAK,EAC5B,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,UAAU,EACO,KAAI;IACxB,MAAM,UAAU,GAAG,OAAO,CAA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P,QAAA,OAAO,CAAE,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,MACtCV,sBAAA,CAAA,aAAA,CAACO,cAAQ,EAAC,EAAA,GAAG,EAAE,KAAK,EAAA;YAClBP,sBAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAEG,qBAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE,EAAI,CAAA;YAC9DH,sBAAC,CAAA,aAAA,CAAAQ,aAAM,IAAC,SAAS,EAAEL,qBAAM,CAAC,SAAS,EAAE,OAAO,EAAC,MAAM,EAAC,GAAG,EAAE,KAAK,EAAA,GAAM,WAAW,EAAA,CAAI,CAC1E,CACZ,CAAC,CACO;AAEf;;;;"}
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { SelectDropdownProps } from './types';
3
- export declare const SelectDropdown: ({ id, className, placeholder, multiple, compact, hasError, disabled, options, value, actions, isLoading, searchValue, emptyStateSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...otherProps }: SelectDropdownProps) => React.JSX.Element;
3
+ export declare const SelectDropdown: ({ id, className, placeholder, multiple, compact, hasError, disabled, options, value, actions, isLoading, searchValue, emptyStateSlot, selectedSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...otherProps }: SelectDropdownProps) => React.JSX.Element;
@@ -11,7 +11,7 @@ import formStyles from '../../utils/forms/form.module.scss.js';
11
11
  import { ListBox } from './components/OptionsContainers/ListBox.js';
12
12
  import { GridList } from './components/OptionsContainers/GridList.js';
13
13
 
14
- const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen = false, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
14
+ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, selectedSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen = false, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
15
15
  const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);
16
16
  const classNames = generateClassNames(className);
17
17
  const [isSelectOpen, setIsSelectOpen] = useState(false);
@@ -42,8 +42,7 @@ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple =
42
42
  formStyles.base,
43
43
  hasError && formStyles.error,
44
44
  compact && formStyles.compact,
45
- ]) },
46
- React__default.createElement(SelectedOption, { placeholder: placeholder, options: selectedValues, selectionMode: selectionMode })));
45
+ ]) }, selectedSlot || (React__default.createElement(SelectedOption, { placeholder: placeholder, options: selectedValues, selectionMode: selectionMode }))));
47
46
  } },
48
47
  onSearchChange && (React__default.createElement(React__default.Fragment, null,
49
48
  React__default.createElement(Search, { className: styles.search, value: searchValue, onChange: onSearchChange }),
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDropdown.js","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useState } from 'react';\nimport { Selection } from 'react-aria-components';\n\nimport { buildClassnames } from '../../utils';\nimport { SelectedOption } from './components/SelectedOption';\nimport { generateClassNames, getSelectedValues } from './utils';\nimport { SelectDropdownItem, SelectDropdownProps } from './types';\nimport { GridItemProps } from './components/GridItem/types';\nimport { Dropdown } from '../Dropdown';\nimport { Search } from '../Search';\nimport { Button } from '../Button';\nimport styles from './SelectDropdown.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\nimport { ListBox } from './components/OptionsContainers/ListBox';\nimport { GridList } from './components/OptionsContainers/GridList';\n\nexport const SelectDropdown = ({\n id,\n className,\n placeholder = 'Select item',\n multiple = false,\n compact = false,\n hasError = false,\n disabled,\n options,\n value,\n actions,\n isLoading = false,\n searchValue,\n emptyStateSlot,\n onSearchChange,\n onChange,\n topAction,\n isSelectDropdownOpen = false,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...otherProps\n}: SelectDropdownProps) => {\n const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);\n const classNames = generateClassNames(className);\n\n const [isSelectOpen, setIsSelectOpen] = useState(false);\n\n const selectedValues = getSelectedValues(options, hasSection, value);\n const selectionMode = multiple ? 'multiple' : 'single';\n const hasRowAction = options.some(\n (option) => 'onClickRowAction' in option && option.onClickRowAction,\n );\n\n const onSelectionChange = useCallback(\n (keys: Selection) => {\n const selectedKeys = Array.from(keys);\n const newSelectedValues = getSelectedValues(options, hasSection, selectedKeys);\n\n if (multiple) {\n (onChange as (items: SelectDropdownItem[]) => void)(newSelectedValues);\n } else {\n (onChange as (item: SelectDropdownItem) => void)(newSelectedValues[0]);\n if (!isSelectDropdownOpen) {\n setIsSelectOpen(false);\n }\n }\n },\n [options, hasSection, multiple, onChange, isSelectDropdownOpen],\n );\n\n return (\n <Dropdown\n id={`select-dropdown-${id}`}\n className={buildClassnames([classNames?.popover, styles.dropdown, className])}\n shouldShow={isSelectOpen}\n setShouldShow={setIsSelectOpen}\n useAnchorWidth\n disabled={disabled}\n renderCta={(buttonProps, anchorRef) => {\n if (anchorRef && isSelectDropdownOpen) {\n setIsSelectOpen(isSelectDropdownOpen);\n }\n\n return (\n <button\n {...buttonProps}\n type=\"button\"\n ref={anchorRef}\n className={buildClassnames([\n className,\n styles.dropdownTrigger,\n formStyles.fullStyles,\n formStyles.base,\n hasError && formStyles.error,\n compact && formStyles.compact,\n ])}\n >\n <SelectedOption\n placeholder={placeholder}\n options={selectedValues}\n selectionMode={selectionMode}\n />\n </button>\n );\n }}\n >\n {onSearchChange && (\n <>\n <Search className={styles.search} value={searchValue} onChange={onSearchChange} />\n <hr className={styles.separator} />\n </>\n )}\n {topAction && (\n <Fragment key={topAction.label}>\n <Button\n className={styles.ctaButton}\n key={topAction.label}\n variant=\"flat\"\n {...topAction}\n />\n <hr className={styles.separator} key={`separator-${topAction.label}`} />\n </Fragment>\n )}\n {hasRowAction ? (\n <GridList\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options as GridItemProps[]}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues as GridItemProps[]}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n {...otherProps}\n />\n ) : (\n <ListBox\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n hasSection={hasSection}\n {...otherProps}\n />\n )}\n {actions?.map(({ label, ...actionProps }) => (\n <Fragment key={label}>\n <hr className={styles.separator} key={`separator-${label}`} />\n <Button className={styles.ctaButton} variant=\"flat\" key={label} {...actionProps} />\n </Fragment>\n ))}\n </Dropdown>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAgBO,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,SAAS,EACT,WAAW,GAAG,aAAa,EAC3B,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,oBAAoB,GAAG,KAAK,EAC5B,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,UAAU,EACO,KAAI;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CA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,WAAW,EAAE,MACtCA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAC,EAAA,GAAG,EAAE,KAAK,EAAA;YAClBA,cAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE,EAAI,CAAA;YAC9DA,cAAC,CAAA,aAAA,CAAA,MAAM,IAAC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,EAAC,MAAM,EAAC,GAAG,EAAE,KAAK,EAAA,GAAM,WAAW,EAAA,CAAI,CAC1E,CACZ,CAAC,CACO;AAEf;;;;"}
1
+ {"version":3,"file":"SelectDropdown.js","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useState } from 'react';\nimport { Selection } from 'react-aria-components';\n\nimport { buildClassnames } from '../../utils';\nimport { SelectedOption } from './components/SelectedOption';\nimport { generateClassNames, getSelectedValues } from './utils';\nimport { SelectDropdownItem, SelectDropdownProps } from './types';\nimport { GridItemProps } from './components/GridItem/types';\nimport { Dropdown } from '../Dropdown';\nimport { Search } from '../Search';\nimport { Button } from '../Button';\nimport styles from './SelectDropdown.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\nimport { ListBox } from './components/OptionsContainers/ListBox';\nimport { GridList } from './components/OptionsContainers/GridList';\n\nexport const SelectDropdown = ({\n id,\n className,\n placeholder = 'Select item',\n multiple = false,\n compact = false,\n hasError = false,\n disabled,\n options,\n value,\n actions,\n isLoading = false,\n searchValue,\n emptyStateSlot,\n selectedSlot,\n onSearchChange,\n onChange,\n topAction,\n isSelectDropdownOpen = false,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...otherProps\n}: SelectDropdownProps) => {\n const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);\n const classNames = generateClassNames(className);\n\n const [isSelectOpen, setIsSelectOpen] = useState(false);\n\n const selectedValues = getSelectedValues(options, hasSection, value);\n const selectionMode = multiple ? 'multiple' : 'single';\n const hasRowAction = options.some(\n (option) => 'onClickRowAction' in option && option.onClickRowAction,\n );\n\n const onSelectionChange = useCallback(\n (keys: Selection) => {\n const selectedKeys = Array.from(keys);\n const newSelectedValues = getSelectedValues(options, hasSection, selectedKeys);\n\n if (multiple) {\n (onChange as (items: SelectDropdownItem[]) => void)(newSelectedValues);\n } else {\n (onChange as (item: SelectDropdownItem) => void)(newSelectedValues[0]);\n if (!isSelectDropdownOpen) {\n setIsSelectOpen(false);\n }\n }\n },\n [options, hasSection, multiple, onChange, isSelectDropdownOpen],\n );\n\n return (\n <Dropdown\n id={`select-dropdown-${id}`}\n className={buildClassnames([classNames?.popover, styles.dropdown, className])}\n shouldShow={isSelectOpen}\n setShouldShow={setIsSelectOpen}\n useAnchorWidth\n disabled={disabled}\n renderCta={(buttonProps, anchorRef) => {\n if (anchorRef && isSelectDropdownOpen) {\n setIsSelectOpen(isSelectDropdownOpen);\n }\n\n return (\n <button\n {...buttonProps}\n type=\"button\"\n ref={anchorRef}\n className={buildClassnames([\n className,\n styles.dropdownTrigger,\n formStyles.fullStyles,\n formStyles.base,\n hasError && formStyles.error,\n compact && formStyles.compact,\n ])}\n >\n {selectedSlot || (\n <SelectedOption\n placeholder={placeholder}\n options={selectedValues}\n selectionMode={selectionMode}\n />\n )}\n </button>\n );\n }}\n >\n {onSearchChange && (\n <>\n <Search className={styles.search} value={searchValue} onChange={onSearchChange} />\n <hr className={styles.separator} />\n </>\n )}\n {topAction && (\n <Fragment key={topAction.label}>\n <Button\n className={styles.ctaButton}\n key={topAction.label}\n variant=\"flat\"\n {...topAction}\n />\n <hr className={styles.separator} key={`separator-${topAction.label}`} />\n </Fragment>\n )}\n {hasRowAction ? (\n <GridList\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options as GridItemProps[]}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues as GridItemProps[]}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n {...otherProps}\n />\n ) : (\n <ListBox\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n hasSection={hasSection}\n {...otherProps}\n />\n )}\n {actions?.map(({ label, ...actionProps }) => (\n <Fragment key={label}>\n <hr className={styles.separator} key={`separator-${label}`} />\n <Button className={styles.ctaButton} variant=\"flat\" key={label} {...actionProps} />\n </Fragment>\n ))}\n </Dropdown>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAgBO,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,SAAS,EACT,WAAW,GAAG,aAAa,EAC3B,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,SAAS,EACT,oBAAoB,GAAG,KAAK,EAC5B,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,UAAU,EACO,KAAI;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC;AACtF,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,SAAS,CAAC;IAEhD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEvD,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,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AC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,EAAC,MAAM,EAAC,GAAG,EAAE,KAAK,EAAA,GAAM,WAAW,EAAA,CAAI,CAC1E,CACZ,CAAC,CACO;AAEf;;;;"}
@@ -17,7 +17,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
17
17
 
18
18
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
19
19
 
20
- const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, selectionMode = 'single', isLink, isSelected = false, isHovered = false, itemType, }) => {
20
+ const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, shouldDisableSelectionRender = false, selectionMode = 'single', isLink, isSelected = false, isHovered = false, itemType, }) => {
21
21
  const infoContainerClassNames = React.useMemo(() => {
22
22
  const base = ItemContent_module.infoContainer;
23
23
  if (itemInfoSlot && endInfoSlot) {
@@ -34,7 +34,7 @@ const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot,
34
34
  return (React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", justifyContent: "space-between", alignItems: "center", gap: "base", style: { flexGrow: 1 } },
35
35
  React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", gap: "base", style: { flexGrow: 1 } },
36
36
  allowsDragging && React__default.default.createElement(DragIndicatorIcon.ReactComponent, { "data-testid": "drag-icon" }),
37
- React__default.default.createElement(SelectionType.SelectionType, { selectionMode: selectionMode, isSelected: isSelected, isLink: isLink }),
37
+ React__default.default.createElement(SelectionType.SelectionType, { shouldDisableSelectionRender: shouldDisableSelectionRender, selectionMode: selectionMode, isSelected: isSelected, isLink: isLink }),
38
38
  mediaSlot,
39
39
  React__default.default.createElement(FlexCol.FlexCol, { gap: "xs", style: { flexGrow: 1 } },
40
40
  React__default.default.createElement("div", { className: infoContainerClassNames, "data-testid": "info-container" },
@@ -1 +1 @@
1
- {"version":3,"file":"ItemContent.cjs","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/ItemContent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Text } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowRightIcon, DragIndicatorIcon } from '../../../../icons';\nimport { ItemContentProps } from './types';\nimport { Text as VeeqoText } from '../../../Text';\nimport { MiniAlert } from '../../../Alerts/MiniAlert';\nimport { SelectionType } from './SelectionType';\nimport styles from './ItemContent.module.scss';\nimport { FlexRow } from '../../../Flex/FlexRow';\n\nexport const ItemContent = ({\n label,\n hint,\n itemInfoSlot,\n endInfoSlot,\n alert,\n mediaSlot,\n allowsDragging = false,\n selectionMode = 'single',\n isLink,\n isSelected = false,\n isHovered = false,\n itemType,\n}: ItemContentProps) => {\n const infoContainerClassNames = useMemo(() => {\n const base = styles.infoContainer;\n\n if (itemInfoSlot && endInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoAndEndInfo]);\n }\n\n if (itemInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoOnly]);\n }\n\n if (endInfoSlot) {\n return buildClassnames([base, styles.hasEndInfoOnly]);\n }\n\n return buildClassnames([base]);\n }, [endInfoSlot, itemInfoSlot]);\n\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n gap=\"base\"\n style={{ flexGrow: 1 }}\n >\n <FlexRow flexWrap=\"nowrap\" gap=\"base\" style={{ flexGrow: 1 }}>\n {allowsDragging && <DragIndicatorIcon data-testid=\"drag-icon\" />}\n <SelectionType selectionMode={selectionMode} isSelected={isSelected} isLink={isLink} />\n {mediaSlot}\n <FlexCol gap=\"xs\" style={{ flexGrow: 1 }}>\n <div className={infoContainerClassNames} data-testid=\"info-container\">\n {itemType === 'grid' ? (\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n ) : (\n <Text slot=\"label\">\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n </Text>\n )}\n {itemInfoSlot}\n {endInfoSlot && (\n <div className={endInfoSlot ? styles.justifyEnd : styles.justifyStart}>\n {endInfoSlot}\n </div>\n )}\n </div>\n\n {hint && (\n <Text slot=\"description\">\n <VeeqoText variant=\"body\">{hint}</VeeqoText>\n </Text>\n )}\n {alert && <MiniAlert title={alert.title} variant={alert.variant} />}\n </FlexCol>\n </FlexRow>\n {isLink && <ArrowRightIcon className={styles.linkIcon} data-testid=\"link-icon\" />}\n </FlexRow>\n );\n};\n"],"names":["useMemo","styles","buildClassnames","React","FlexRow","DragIndicatorIcon","SelectionType","FlexCol","VeeqoText","Text","MiniAlert","ArrowRightIcon"],"mappings":";;;;;;;;;;;;;;;;;;;AAYa,MAAA,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,GAAG,KAAK,EACtB,aAAa,GAAG,QAAQ,EACxB,MAAM,EACN,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,QAAQ,GACS,KAAI;AACrB,IAAA,MAAM,uBAAuB,GAAGA,aAAO,CAAC,MAAK;AAC3C,QAAA,MAAM,IAAI,GAAGC,kBAAM,CAAC,aAAa;QAEjC,IAAI,YAAY,IAAI,WAAW,EAAE;YAC/B,OAAOC,+BAAe,CAAC,CAAC,IAAI,EAAED,kBAAM,CAAC,qBAAqB,CAAC,CAAC;AAC7D;AAED,QAAA,IAAI,YAAY,EAAE;YAChB,OAAOC,+BAAe,CAAC,CAAC,IAAI,EAAED,kBAAM,CAAC,eAAe,CAAC,CAAC;AACvD;AAED,QAAA,IAAI,WAAW,EAAE;YACf,OAAOC,+BAAe,CAAC,CAAC,IAAI,EAAED,kBAAM,CAAC,cAAc,CAAC,CAAC;AACtD;AAED,QAAA,OAAOC,+BAAe,CAAC,CAAC,IAAI,CAAC,CAAC;AAChC,KAAC,EA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Aa,CACnE,CACR;oBACA,YAAY;oBACZ,WAAW,KACVL,sBAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,WAAW,GAAGF,kBAAM,CAAC,UAAU,GAAGA,kBAAM,CAAC,YAAY,EAClE,EAAA,WAAW,CACR,CACP,CACG;AAEL,gBAAA,IAAI,KACHE,sBAAA,CAAA,aAAA,CAACM,wBAAI,EAAC,EAAA,IAAI,EAAC,aAAa,EAAA;oBACtBN,sBAAC,CAAA,aAAA,CAAAK,SAAS,IAAC,OAAO,EAAC,MAAM,EAAE,EAAA,IAAI,CAAa,CACvC,CACR;AACA,gBAAA,KAAK,IAAIL,sBAAC,CAAA,aAAA,CAAAO,mBAAS,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA,CAAI,CAC3D,CACF;AACT,QAAA,MAAM,IAAIP,sBAAA,CAAA,aAAA,CAACQ,6BAAc,EAAA,EAAC,SAAS,EAAEV,kBAAM,CAAC,QAAQ,EAAc,aAAA,EAAA,WAAW,EAAG,CAAA,CACzE;AAEd;;;;"}
1
+ {"version":3,"file":"ItemContent.cjs","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/ItemContent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Text } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowRightIcon, DragIndicatorIcon } from '../../../../icons';\nimport { ItemContentProps } from './types';\nimport { Text as VeeqoText } from '../../../Text';\nimport { MiniAlert } from '../../../Alerts/MiniAlert';\nimport { SelectionType } from './SelectionType';\nimport styles from './ItemContent.module.scss';\nimport { FlexRow } from '../../../Flex/FlexRow';\n\nexport const ItemContent = ({\n label,\n hint,\n itemInfoSlot,\n endInfoSlot,\n alert,\n mediaSlot,\n allowsDragging = false,\n shouldDisableSelectionRender = false,\n selectionMode = 'single',\n isLink,\n isSelected = false,\n isHovered = false,\n itemType,\n}: ItemContentProps) => {\n const infoContainerClassNames = useMemo(() => {\n const base = styles.infoContainer;\n\n if (itemInfoSlot && endInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoAndEndInfo]);\n }\n\n if (itemInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoOnly]);\n }\n\n if (endInfoSlot) {\n return buildClassnames([base, styles.hasEndInfoOnly]);\n }\n\n return buildClassnames([base]);\n }, [endInfoSlot, itemInfoSlot]);\n\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n gap=\"base\"\n style={{ flexGrow: 1 }}\n >\n <FlexRow flexWrap=\"nowrap\" gap=\"base\" style={{ flexGrow: 1 }}>\n {allowsDragging && <DragIndicatorIcon data-testid=\"drag-icon\" />}\n <SelectionType\n shouldDisableSelectionRender={shouldDisableSelectionRender}\n selectionMode={selectionMode}\n isSelected={isSelected}\n isLink={isLink}\n />\n {mediaSlot}\n <FlexCol gap=\"xs\" style={{ flexGrow: 1 }}>\n <div className={infoContainerClassNames} data-testid=\"info-container\">\n {itemType === 'grid' ? (\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n ) : (\n <Text slot=\"label\">\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n </Text>\n )}\n {itemInfoSlot}\n {endInfoSlot && (\n <div className={endInfoSlot ? styles.justifyEnd : styles.justifyStart}>\n {endInfoSlot}\n </div>\n )}\n </div>\n\n {hint && (\n <Text slot=\"description\">\n <VeeqoText variant=\"body\">{hint}</VeeqoText>\n </Text>\n )}\n {alert && <MiniAlert title={alert.title} variant={alert.variant} />}\n </FlexCol>\n </FlexRow>\n {isLink && <ArrowRightIcon className={styles.linkIcon} data-testid=\"link-icon\" />}\n </FlexRow>\n );\n};\n"],"names":["useMemo","styles","buildClassnames","React","FlexRow","DragIndicatorIcon","SelectionType","FlexCol","VeeqoText","Text","MiniAlert","ArrowR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BAAA,KAAK,IAAIL,sBAAC,CAAA,aAAA,CAAAO,mBAAS,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA,CAAI,CAC3D,CACF;AACT,QAAA,MAAM,IAAIP,sBAAA,CAAA,aAAA,CAACQ,6BAAc,EAAA,EAAC,SAAS,EAAEV,kBAAM,CAAC,QAAQ,EAAc,aAAA,EAAA,WAAW,EAAG,CAAA,CACzE;AAEd;;;;"}
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { ItemContentProps } from './types';
3
- export declare const ItemContent: ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging, selectionMode, isLink, isSelected, isHovered, itemType, }: ItemContentProps) => React.JSX.Element;
3
+ export declare const ItemContent: ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging, shouldDisableSelectionRender, selectionMode, isLink, isSelected, isHovered, itemType, }: ItemContentProps) => React.JSX.Element;
@@ -11,7 +11,7 @@ import { SelectionType } from './SelectionType.js';
11
11
  import styles from './ItemContent.module.scss.js';
12
12
  import { FlexRow } from '../../../Flex/FlexRow/FlexRow.js';
13
13
 
14
- const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, selectionMode = 'single', isLink, isSelected = false, isHovered = false, itemType, }) => {
14
+ const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, shouldDisableSelectionRender = false, selectionMode = 'single', isLink, isSelected = false, isHovered = false, itemType, }) => {
15
15
  const infoContainerClassNames = useMemo(() => {
16
16
  const base = styles.infoContainer;
17
17
  if (itemInfoSlot && endInfoSlot) {
@@ -28,7 +28,7 @@ const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot,
28
28
  return (React__default.createElement(FlexRow, { flexWrap: "nowrap", justifyContent: "space-between", alignItems: "center", gap: "base", style: { flexGrow: 1 } },
29
29
  React__default.createElement(FlexRow, { flexWrap: "nowrap", gap: "base", style: { flexGrow: 1 } },
30
30
  allowsDragging && React__default.createElement(DragIndicatorIcon, { "data-testid": "drag-icon" }),
31
- React__default.createElement(SelectionType, { selectionMode: selectionMode, isSelected: isSelected, isLink: isLink }),
31
+ React__default.createElement(SelectionType, { shouldDisableSelectionRender: shouldDisableSelectionRender, selectionMode: selectionMode, isSelected: isSelected, isLink: isLink }),
32
32
  mediaSlot,
33
33
  React__default.createElement(FlexCol, { gap: "xs", style: { flexGrow: 1 } },
34
34
  React__default.createElement("div", { className: infoContainerClassNames, "data-testid": "info-container" },
@@ -1 +1 @@
1
- {"version":3,"file":"ItemContent.js","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/ItemContent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Text } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowRightIcon, DragIndicatorIcon } from '../../../../icons';\nimport { ItemContentProps } from './types';\nimport { Text as VeeqoText } from '../../../Text';\nimport { MiniAlert } from '../../../Alerts/MiniAlert';\nimport { SelectionType } from './SelectionType';\nimport styles from './ItemContent.module.scss';\nimport { FlexRow } from '../../../Flex/FlexRow';\n\nexport const ItemContent = ({\n label,\n hint,\n itemInfoSlot,\n endInfoSlot,\n alert,\n mediaSlot,\n allowsDragging = false,\n selectionMode = 'single',\n isLink,\n isSelected = false,\n isHovered = false,\n itemType,\n}: ItemContentProps) => {\n const infoContainerClassNames = useMemo(() => {\n const base = styles.infoContainer;\n\n if (itemInfoSlot && endInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoAndEndInfo]);\n }\n\n if (itemInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoOnly]);\n }\n\n if (endInfoSlot) {\n return buildClassnames([base, styles.hasEndInfoOnly]);\n }\n\n return buildClassnames([base]);\n }, [endInfoSlot, itemInfoSlot]);\n\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n gap=\"base\"\n style={{ flexGrow: 1 }}\n >\n <FlexRow flexWrap=\"nowrap\" gap=\"base\" style={{ flexGrow: 1 }}>\n {allowsDragging && <DragIndicatorIcon data-testid=\"drag-icon\" />}\n <SelectionType selectionMode={selectionMode} isSelected={isSelected} isLink={isLink} />\n {mediaSlot}\n <FlexCol gap=\"xs\" style={{ flexGrow: 1 }}>\n <div className={infoContainerClassNames} data-testid=\"info-container\">\n {itemType === 'grid' ? (\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n ) : (\n <Text slot=\"label\">\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n </Text>\n )}\n {itemInfoSlot}\n {endInfoSlot && (\n <div className={endInfoSlot ? styles.justifyEnd : styles.justifyStart}>\n {endInfoSlot}\n </div>\n )}\n </div>\n\n {hint && (\n <Text slot=\"description\">\n <VeeqoText variant=\"body\">{hint}</VeeqoText>\n </Text>\n )}\n {alert && <MiniAlert title={alert.title} variant={alert.variant} />}\n </FlexCol>\n </FlexRow>\n {isLink && <ArrowRightIcon className={styles.linkIcon} data-testid=\"link-icon\" />}\n </FlexRow>\n );\n};\n"],"names":["React","VeeqoText","Text"],"mappings":";;;;;;;;;;;;;AAYa,MAAA,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,GAAG,KAAK,EACtB,aAAa,GAAG,QAAQ,EACxB,MAAM,EACN,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,QAAQ,GACS,KAAI;AACrB,IAAA,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAK;AAC3C,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa;QAEjC,IAAI,YAAY,IAAI,WAAW,EAAE;YAC/B,OAAO,eAAe,CAAC,CAAC,IAAI,EAAE,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M,IAClBA,cAAA,CAAA,aAAA,CAACC,IAAS,EAAA,EAAC,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,EAAG,EAAA,KAAK,CAAa,KAExED,cAAC,CAAA,aAAA,CAAAE,MAAI,EAAC,EAAA,IAAI,EAAC,OAAO,EAAA;AAChB,wBAAAF,cAAA,CAAA,aAAA,CAACC,IAAS,EAAC,EAAA,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,IAAG,KAAK,CAAa,CACnE,CACR;oBACA,YAAY;oBACZ,WAAW,KACVD,cAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,YAAY,EAClE,EAAA,WAAW,CACR,CACP,CACG;AAEL,gBAAA,IAAI,KACHA,cAAA,CAAA,aAAA,CAACE,MAAI,EAAC,EAAA,IAAI,EAAC,aAAa,EAAA;oBACtBF,cAAC,CAAA,aAAA,CAAAC,IAAS,IAAC,OAAO,EAAC,MAAM,EAAE,EAAA,IAAI,CAAa,CACvC,CACR;AACA,gBAAA,KAAK,IAAID,cAAC,CAAA,aAAA,CAAA,SAAS,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA,CAAI,CAC3D,CACF;AACT,QAAA,MAAM,IAAIA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAc,aAAA,EAAA,WAAW,EAAG,CAAA,CACzE;AAEd;;;;"}
1
+ {"version":3,"file":"ItemContent.js","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/ItemContent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Text } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowRightIcon, DragIndicatorIcon } from '../../../../icons';\nimport { ItemContentProps } from './types';\nimport { Text as VeeqoText } from '../../../Text';\nimport { MiniAlert } from '../../../Alerts/MiniAlert';\nimport { SelectionType } from './SelectionType';\nimport styles from './ItemContent.module.scss';\nimport { FlexRow } from '../../../Flex/FlexRow';\n\nexport const ItemContent = ({\n label,\n hint,\n itemInfoSlot,\n endInfoSlot,\n alert,\n mediaSlot,\n allowsDragging = false,\n shouldDisableSelectionRender = false,\n selectionMode = 'single',\n isLink,\n isSelected = false,\n isHovered = false,\n itemType,\n}: ItemContentProps) => {\n const infoContainerClassNames = useMemo(() => {\n const base = styles.infoContainer;\n\n if (itemInfoSlot && endInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoAndEndInfo]);\n }\n\n if (itemInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoOnly]);\n }\n\n if (endInfoSlot) {\n return buildClassnames([base, styles.hasEndInfoOnly]);\n }\n\n return buildClassnames([base]);\n }, [endInfoSlot, itemInfoSlot]);\n\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n gap=\"base\"\n style={{ flexGrow: 1 }}\n >\n <FlexRow flexWrap=\"nowrap\" gap=\"base\" style={{ flexGrow: 1 }}>\n {allowsDragging && <DragIndicatorIcon data-testid=\"drag-icon\" />}\n <SelectionType\n shouldDisableSelectionRender={shouldDisableSelectionRender}\n selectionMode={selectionMode}\n isSelected={isSelected}\n isLink={isLink}\n />\n {mediaSlot}\n <FlexCol gap=\"xs\" style={{ flexGrow: 1 }}>\n <div className={infoContainerClassNames} data-testid=\"info-container\">\n {itemType === 'grid' ? (\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n ) : (\n <Text slot=\"label\">\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n </Text>\n )}\n {itemInfoSlot}\n {endInfoSlot && (\n <div className={endInfoSlot ? styles.justifyEnd : styles.justifyStart}>\n {endInfoSlot}\n </div>\n )}\n </div>\n\n {hint && (\n <Text slot=\"description\">\n <VeeqoText variant=\"body\">{hint}</VeeqoText>\n </Text>\n )}\n {alert && <MiniAlert title={alert.title} variant={alert.variant} />}\n </FlexCol>\n </FlexRow>\n {isLink && <ArrowRightIcon className={styles.linkIcon} data-testid=\"link-icon\" />}\n </FlexRow>\n );\n};\n"],"names":["React","VeeqoText","Text"],"mappings":";;;;;;;;;;;;;AAYa,MAAA,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,GAAG,KAAK,EACtB,4BAA4B,GAAG,KAAK,EACpC,aAAa,GAAG,QAAQ,EACxB,MAAM,EACN,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,QAAQ,GACS,KAAI;AACrB,IAAA,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAK;AAC3C,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa;QAEjC,IAAI,YAAY,IAAI,WAAW,EAAE;YAC/B,OAAO,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAC7D;AAED,QAAA,IAAI,YAAY,EAAE;YAChB,OAAO,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;AACvD;AAED,QAAA,IAAI,WAAW,EAAE;YACf,OAAO,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;AACtD;AAED,QAAA,OAAO,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC;AAChC,KAAC,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAE/B,QACEA,cAAC,CAAA,aAAA,CAAA,OAAO,EACN,EAAA,QAAQ,EAAC,QAAQ,EACjB,cAAc,EAAC,eAAe,EAC9B,UAAU,EAAC,QAAQ,EACnB,GAAG,EAAC,MAAM,EACV,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,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aAAA,CAACE,MAAI,EAAC,EAAA,IAAI,EAAC,aAAa,EAAA;oBACtBF,cAAC,CAAA,aAAA,CAAAC,IAAS,IAAC,OAAO,EAAC,MAAM,EAAE,EAAA,IAAI,CAAa,CACvC,CACR;AACA,gBAAA,KAAK,IAAID,cAAC,CAAA,aAAA,CAAA,SAAS,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA,CAAI,CAC3D,CACF;AACT,QAAA,MAAM,IAAIA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAc,aAAA,EAAA,WAAW,EAAG,CAAA,CACzE;AAEd;;;;"}
@@ -8,12 +8,14 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
10
10
 
11
- const SelectionType = ({ selectionMode, isSelected, isLink }) => {
12
- if (isLink || selectionMode === 'none')
11
+ const SelectionType = ({ shouldDisableSelectionRender = false, selectionMode, isSelected, isLink, }) => {
12
+ if (isLink || selectionMode === 'none' || shouldDisableSelectionRender)
13
13
  return null;
14
14
  if (selectionMode === 'single')
15
15
  return React__default.default.createElement(Radio.Radio, { checked: isSelected, onChange: () => { } });
16
- return React__default.default.createElement(Checkbox.Checkbox, { checked: isSelected, onChange: () => { } });
16
+ if (selectionMode === 'multiple')
17
+ return React__default.default.createElement(Checkbox.Checkbox, { checked: isSelected, onChange: () => { } });
18
+ return null;
17
19
  };
18
20
 
19
21
  exports.SelectionType = SelectionType;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionType.cjs","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/SelectionType.tsx"],"sourcesContent":["import React from 'react';\nimport { Radio } from '../../../Radio';\nimport { Checkbox } from '../../../Checkbox';\n\ntype SelectionTypeProps = {\n selectionMode: 'single' | 'multiple' | 'none';\n isSelected: boolean;\n isLink?: boolean;\n};\n\nexport const SelectionType = ({ selectionMode, isSelected, isLink }: SelectionTypeProps) => {\n if (isLink || selectionMode === 'none') return null;\n\n if (selectionMode === 'single') return <Radio checked={isSelected} onChange={() => {}} />;\n\n return <Checkbox checked={isSelected} onChange={() => {}} />;\n};\n"],"names":["React","Radio","Checkbox"],"mappings":";;;;;;;;;;AAUO,MAAM,aAAa,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAsB,KAAI;AACzF,IAAA,IAAI,MAAM,IAAI,aAAa,KAAK,MAAM;AAAE,QAAA,OAAO,IAAI;IAEnD,IAAI,aAAa,KAAK,QAAQ;AAAE,QAAA,OAAOA,sBAAC,CAAA,aAAA,CAAAC,WAAK,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;AAEzF,IAAA,OAAOD,sBAAC,CAAA,aAAA,CAAAE,iBAAQ,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;AAC9D;;;;"}
1
+ {"version":3,"file":"SelectionType.cjs","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/SelectionType.tsx"],"sourcesContent":["import React from 'react';\nimport { Radio } from '../../../Radio';\nimport { Checkbox } from '../../../Checkbox';\n\ntype SelectionTypeProps = {\n selectionMode: 'single' | 'multiple' | 'none';\n isSelected: boolean;\n isLink?: boolean;\n shouldDisableSelectionRender?: boolean;\n};\n\nexport const SelectionType = ({\n shouldDisableSelectionRender = false,\n selectionMode,\n isSelected,\n isLink,\n}: SelectionTypeProps) => {\n if (isLink || selectionMode === 'none' || shouldDisableSelectionRender) return null;\n\n if (selectionMode === 'single') return <Radio checked={isSelected} onChange={() => {}} />;\n\n if (selectionMode === 'multiple') return <Checkbox checked={isSelected} onChange={() => {}} />;\n\n return null;\n};\n"],"names":["React","Radio","Checkbox"],"mappings":";;;;;;;;;;AAWa,MAAA,aAAa,GAAG,CAAC,EAC5B,4BAA4B,GAAG,KAAK,EACpC,aAAa,EACb,UAAU,EACV,MAAM,GACa,KAAI;AACvB,IAAA,IAAI,MAAM,IAAI,aAAa,KAAK,MAAM,IAAI,4BAA4B;AAAE,QAAA,OAAO,IAAI;IAEnF,IAAI,aAAa,KAAK,QAAQ;AAAE,QAAA,OAAOA,sBAAC,CAAA,aAAA,CAAAC,WAAK,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;IAEzF,IAAI,aAAa,KAAK,UAAU;AAAE,QAAA,OAAOD,sBAAC,CAAA,aAAA,CAAAE,iBAAQ,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;AAE9F,IAAA,OAAO,IAAI;AACb;;;;"}
@@ -3,6 +3,7 @@ type SelectionTypeProps = {
3
3
  selectionMode: 'single' | 'multiple' | 'none';
4
4
  isSelected: boolean;
5
5
  isLink?: boolean;
6
+ shouldDisableSelectionRender?: boolean;
6
7
  };
7
- export declare const SelectionType: ({ selectionMode, isSelected, isLink }: SelectionTypeProps) => React.JSX.Element | null;
8
+ export declare const SelectionType: ({ shouldDisableSelectionRender, selectionMode, isSelected, isLink, }: SelectionTypeProps) => React.JSX.Element | null;
8
9
  export {};
@@ -2,12 +2,14 @@ import React__default from 'react';
2
2
  import { Radio } from '../../../Radio/Radio.js';
3
3
  import { Checkbox } from '../../../Checkbox/Checkbox.js';
4
4
 
5
- const SelectionType = ({ selectionMode, isSelected, isLink }) => {
6
- if (isLink || selectionMode === 'none')
5
+ const SelectionType = ({ shouldDisableSelectionRender = false, selectionMode, isSelected, isLink, }) => {
6
+ if (isLink || selectionMode === 'none' || shouldDisableSelectionRender)
7
7
  return null;
8
8
  if (selectionMode === 'single')
9
9
  return React__default.createElement(Radio, { checked: isSelected, onChange: () => { } });
10
- return React__default.createElement(Checkbox, { checked: isSelected, onChange: () => { } });
10
+ if (selectionMode === 'multiple')
11
+ return React__default.createElement(Checkbox, { checked: isSelected, onChange: () => { } });
12
+ return null;
11
13
  };
12
14
 
13
15
  export { SelectionType };
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionType.js","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/SelectionType.tsx"],"sourcesContent":["import React from 'react';\nimport { Radio } from '../../../Radio';\nimport { Checkbox } from '../../../Checkbox';\n\ntype SelectionTypeProps = {\n selectionMode: 'single' | 'multiple' | 'none';\n isSelected: boolean;\n isLink?: boolean;\n};\n\nexport const SelectionType = ({ selectionMode, isSelected, isLink }: SelectionTypeProps) => {\n if (isLink || selectionMode === 'none') return null;\n\n if (selectionMode === 'single') return <Radio checked={isSelected} onChange={() => {}} />;\n\n return <Checkbox checked={isSelected} onChange={() => {}} />;\n};\n"],"names":["React"],"mappings":";;;;AAUO,MAAM,aAAa,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAsB,KAAI;AACzF,IAAA,IAAI,MAAM,IAAI,aAAa,KAAK,MAAM;AAAE,QAAA,OAAO,IAAI;IAEnD,IAAI,aAAa,KAAK,QAAQ;AAAE,QAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;AAEzF,IAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;AAC9D;;;;"}
1
+ {"version":3,"file":"SelectionType.js","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/SelectionType.tsx"],"sourcesContent":["import React from 'react';\nimport { Radio } from '../../../Radio';\nimport { Checkbox } from '../../../Checkbox';\n\ntype SelectionTypeProps = {\n selectionMode: 'single' | 'multiple' | 'none';\n isSelected: boolean;\n isLink?: boolean;\n shouldDisableSelectionRender?: boolean;\n};\n\nexport const SelectionType = ({\n shouldDisableSelectionRender = false,\n selectionMode,\n isSelected,\n isLink,\n}: SelectionTypeProps) => {\n if (isLink || selectionMode === 'none' || shouldDisableSelectionRender) return null;\n\n if (selectionMode === 'single') return <Radio checked={isSelected} onChange={() => {}} />;\n\n if (selectionMode === 'multiple') return <Checkbox checked={isSelected} onChange={() => {}} />;\n\n return null;\n};\n"],"names":["React"],"mappings":";;;;AAWa,MAAA,aAAa,GAAG,CAAC,EAC5B,4BAA4B,GAAG,KAAK,EACpC,aAAa,EACb,UAAU,EACV,MAAM,GACa,KAAI;AACvB,IAAA,IAAI,MAAM,IAAI,aAAa,KAAK,MAAM,IAAI,4BAA4B;AAAE,QAAA,OAAO,IAAI;IAEnF,IAAI,aAAa,KAAK,QAAQ;AAAE,QAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;IAEzF,IAAI,aAAa,KAAK,UAAU;AAAE,QAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAO,GAAC,GAAI;AAE9F,IAAA,OAAO,IAAI;AACb;;;;"}
@@ -14,9 +14,9 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
14
14
 
15
15
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
16
16
 
17
- const ListItem = ({ id, label, href, appearance = 'primary', className, ...props }) => {
17
+ const ListItem = ({ id, label, href, appearance = 'primary', shouldDisableSelectionRender = false, className, ...props }) => {
18
18
  const idComputed = useId.useId({ id, prefix: 'list-item' });
19
- return (React__default.default.createElement(reactAriaComponents.ListBoxItem, { id: idComputed, textValue: label, href: href, className: buildClassnames.buildClassnames([item_module.item, item_module[`appearance-${appearance}`], className]), ...props }, ({ selectionMode, allowsDragging, isSelected, isHovered }) => (React__default.default.createElement(ItemContent.ItemContent, { selectionMode: selectionMode, allowsDragging: allowsDragging, isSelected: isSelected, isHovered: isHovered, label: label, isLink: Boolean(href), appearance: appearance, itemType: "list", ...props }))));
19
+ return (React__default.default.createElement(reactAriaComponents.ListBoxItem, { id: idComputed, textValue: label, href: href, className: buildClassnames.buildClassnames([item_module.item, item_module[`appearance-${appearance}`], className]), ...props }, ({ selectionMode, allowsDragging, isSelected, isHovered }) => (React__default.default.createElement(ItemContent.ItemContent, { selectionMode: selectionMode, allowsDragging: allowsDragging, isSelected: isSelected, isHovered: isHovered, label: label, isLink: Boolean(href), appearance: appearance, itemType: "list", shouldDisableSelectionRender: shouldDisableSelectionRender, ...props }))));
20
20
  };
21
21
 
22
22
  exports.ListItem = ListItem;
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.cjs","sources":["../../../../../src/components/SelectDropdown/components/ListItem/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport { ListBoxItem, ListBoxItemRenderProps } from 'react-aria-components';\nimport { useId } from '../../../../hooks';\nimport { ListItemProps } from './types';\nimport { ItemContent } from '../ItemContent';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from '../item.module.scss';\n\nexport const ListItem = ({\n id,\n label,\n href,\n appearance = 'primary',\n className,\n ...props\n}: ListItemProps) => {\n const idComputed = useId({ id, prefix: 'list-item' });\n\n return (\n <ListBoxItem\n id={idComputed}\n textValue={label}\n href={href}\n className={buildClassnames([styles.item, styles[`appearance-${appearance}`], className])}\n {...props}\n >\n {/* use react aria's render props to add more such as isHovered */}\n {({ selectionMode, allowsDragging, isSelected, isHovered }: ListBoxItemRenderProps) => (\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\n isHovered={isHovered}\n label={label}\n isLink={Boolean(href)}\n appearance={appearance}\n itemType=\"list\"\n {...props}\n />\n )}\n </ListBoxItem>\n );\n};\n"],"names":["useId","React","ListBoxItem","buildClassnames","styles","ItemContent"],"mappings":";;;;;;;;;;;;;;;;MASa,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAU,GAAG,SAAS,EACtB,SAAS,EACT,GAAG,KAAK,EACM,KAAI;AAClB,IAAA,MAAM,UAAU,GAAGA,WAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAErD,QACEC,qCAACC,+BAAW,EAAA,EACV,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,KAAK,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAEC,+BAAe,CAAC,CAACC,WAAM,CAAC,IAAI,EAAEA,WAAM,CAAC,CAAA,WAAA,EAAc,UAAU,CAAE,CAAA,CAAC,EAAE,SAAS,CAAC,CAAC,EACpF,GAAA,KAAK,IAGR,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAA0B,MAChFH,sBAAA,CAAA,aAAA,CAACI,uBAAW,EACV,EAAA,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EACrB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAC,MAAM,EAAA,GACX,KAAK,EACT,CAAA,CACH,CACW;AAElB;;;;"}
1
+ {"version":3,"file":"ListItem.cjs","sources":["../../../../../src/components/SelectDropdown/components/ListItem/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport { ListBoxItem, ListBoxItemRenderProps } from 'react-aria-components';\nimport { useId } from '../../../../hooks';\nimport { ListItemProps } from './types';\nimport { ItemContent } from '../ItemContent';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from '../item.module.scss';\n\nexport const ListItem = ({\n id,\n label,\n href,\n appearance = 'primary',\n shouldDisableSelectionRender = false,\n className,\n ...props\n}: ListItemProps) => {\n const idComputed = useId({ id, prefix: 'list-item' });\n\n return (\n <ListBoxItem\n id={idComputed}\n textValue={label}\n href={href}\n className={buildClassnames([styles.item, styles[`appearance-${appearance}`], className])}\n {...props}\n >\n {/* use react aria's render props to add more such as isHovered */}\n {({ selectionMode, allowsDragging, isSelected, isHovered }: ListBoxItemRenderProps) => (\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\n isHovered={isHovered}\n label={label}\n isLink={Boolean(href)}\n appearance={appearance}\n itemType=\"list\"\n shouldDisableSelectionRender={shouldDisableSelectionRender}\n {...props}\n />\n )}\n </ListBoxItem>\n );\n};\n"],"names":["useId","React","ListBoxItem","buildClassnames","styles","ItemContent"],"mappings":";;;;;;;;;;;;;;;;AASa,MAAA,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAU,GAAG,SAAS,EACtB,4BAA4B,GAAG,KAAK,EACpC,SAAS,EACT,GAAG,KAAK,EACM,KAAI;AAClB,IAAA,MAAM,UAAU,GAAGA,WAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAErD,QACEC,qCAACC,+BAAW,EAAA,EACV,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,KAAK,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAEC,+BAAe,CAAC,CAACC,WAAM,CAAC,IAAI,EAAEA,WAAM,CAAC,CAAc,WAAA,EAAA,UAAU,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,EAAA,GACpF,KAAK,EAGR,EAAA,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAA0B,MAChFH,qCAACI,uBAAW,EAAA,EACV,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EACrB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAC,MAAM,EACf,4BAA4B,EAAE,4BAA4B,EAAA,GACtD,KAAK,EACT,CAAA,CACH,CACW;AAElB;;;;"}
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { ListItemProps } from './types';
3
- export declare const ListItem: ({ id, label, href, appearance, className, ...props }: ListItemProps) => React.JSX.Element;
3
+ export declare const ListItem: ({ id, label, href, appearance, shouldDisableSelectionRender, className, ...props }: ListItemProps) => React.JSX.Element;