@seeqdev/qomponents 0.0.14 → 0.0.16

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 (92) hide show
  1. package/README.md +76 -2
  2. package/dist/Button/Button.js +71 -0
  3. package/dist/Button/Button.js.map +1 -0
  4. package/dist/Button/Button.stories.d.ts +1 -0
  5. package/dist/Button/Button.stories.js +58 -0
  6. package/dist/Button/Button.stories.js.map +1 -0
  7. package/dist/Button/Button.test.js +49 -0
  8. package/dist/Button/Button.test.js.map +1 -0
  9. package/dist/Button/Button.types.d.ts +2 -0
  10. package/dist/Button/Button.types.js +4 -0
  11. package/dist/Button/Button.types.js.map +1 -0
  12. package/dist/Button/index.js +2 -0
  13. package/dist/Button/index.js.map +1 -0
  14. package/dist/Checkbox/Checkbox.js +23 -0
  15. package/dist/Checkbox/Checkbox.js.map +1 -0
  16. package/dist/Checkbox/Checkbox.stories.js +29 -0
  17. package/dist/Checkbox/Checkbox.stories.js.map +1 -0
  18. package/dist/Checkbox/Checkbox.test.js +94 -0
  19. package/dist/Checkbox/Checkbox.test.js.map +1 -0
  20. package/dist/Checkbox/Checkbox.types.js +2 -0
  21. package/dist/Checkbox/Checkbox.types.js.map +1 -0
  22. package/dist/Checkbox/index.js +2 -0
  23. package/dist/Checkbox/index.js.map +1 -0
  24. package/dist/Icon/Icon.js +54 -0
  25. package/dist/Icon/Icon.js.map +1 -0
  26. package/dist/Icon/Icon.stories.js +40 -0
  27. package/dist/Icon/Icon.stories.js.map +1 -0
  28. package/dist/Icon/Icon.test.js +55 -0
  29. package/dist/Icon/Icon.test.js.map +1 -0
  30. package/dist/Icon/Icon.types.js +16 -0
  31. package/dist/Icon/Icon.types.js.map +1 -0
  32. package/dist/Icon/index.js +2 -0
  33. package/dist/Icon/index.js.map +1 -0
  34. package/dist/Select/Select.js +168 -0
  35. package/dist/Select/Select.js.map +1 -0
  36. package/dist/Select/Select.stories.js +72 -0
  37. package/dist/Select/Select.stories.js.map +1 -0
  38. package/dist/Select/Select.test.js +161 -0
  39. package/dist/Select/Select.test.js.map +1 -0
  40. package/dist/Select/Select.types.js +2 -0
  41. package/dist/Select/Select.types.js.map +1 -0
  42. package/dist/Select/index.js +2 -0
  43. package/dist/Select/index.js.map +1 -0
  44. package/dist/TextArea/TextArea.js +15 -0
  45. package/dist/TextArea/TextArea.js.map +1 -0
  46. package/dist/TextArea/TextArea.stories.js +35 -0
  47. package/dist/TextArea/TextArea.stories.js.map +1 -0
  48. package/dist/TextArea/TextArea.test.js +68 -0
  49. package/dist/TextArea/TextArea.test.js.map +1 -0
  50. package/dist/TextArea/TextArea.types.js +2 -0
  51. package/dist/TextArea/TextArea.types.js.map +1 -0
  52. package/dist/TextArea/index.js +2 -0
  53. package/dist/TextArea/index.js.map +1 -0
  54. package/dist/TextField/TextField.js +56 -0
  55. package/dist/TextField/TextField.js.map +1 -0
  56. package/dist/TextField/TextField.stories.js +37 -0
  57. package/dist/TextField/TextField.stories.js.map +1 -0
  58. package/dist/TextField/TextField.test.js +35 -0
  59. package/dist/TextField/TextField.test.js.map +1 -0
  60. package/dist/TextField/TextField.types.js +2 -0
  61. package/dist/TextField/TextField.types.js.map +1 -0
  62. package/dist/TextField/index.js +2 -0
  63. package/dist/TextField/index.js.map +1 -0
  64. package/dist/Tooltip/Tooltip.js +30 -0
  65. package/dist/Tooltip/Tooltip.js.map +1 -0
  66. package/dist/Tooltip/Tooltip.stories.js +32 -0
  67. package/dist/Tooltip/Tooltip.stories.js.map +1 -0
  68. package/dist/Tooltip/Tooltip.types.js +3 -0
  69. package/dist/Tooltip/Tooltip.types.js.map +1 -0
  70. package/dist/Tooltip/index.js +2 -0
  71. package/dist/Tooltip/index.js.map +1 -0
  72. package/dist/example/.eslintrc.cjs +14 -0
  73. package/dist/example/README.md +33 -0
  74. package/dist/example/index.html +13 -0
  75. package/dist/example/package.json +30 -0
  76. package/dist/example/src/Example.tsx +146 -0
  77. package/dist/example/src/index.css +73 -0
  78. package/dist/example/src/main.tsx +10 -0
  79. package/dist/example/src/vite-env.d.ts +1 -0
  80. package/dist/example/tsconfig.json +33 -0
  81. package/dist/example/tsconfig.node.json +10 -0
  82. package/dist/example/vite.config.ts +12 -0
  83. package/dist/index.esm.js +12 -9
  84. package/dist/index.esm.js.map +1 -1
  85. package/dist/index.js +12 -9
  86. package/dist/index.js.map +1 -1
  87. package/dist/styles.css +8 -4
  88. package/dist/types.js +2 -0
  89. package/dist/types.js.map +1 -0
  90. package/dist/utils/browserId.js +29 -0
  91. package/dist/utils/browserId.js.map +1 -0
  92. package/package.json +1 -1
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen } from '@testing-library/react';
4
+ import Icon from './Icon';
5
+ describe('Icon', () => {
6
+ class Context {
7
+ testId = 'iconTestId';
8
+ icon = 'testIcon';
9
+ props = {
10
+ icon: this.icon,
11
+ onClick: jest.fn(),
12
+ testId: this.testId,
13
+ };
14
+ }
15
+ let tc;
16
+ beforeEach(() => {
17
+ tc = new Context();
18
+ });
19
+ const renderIcon = (props) => render(React.createElement(Icon, { ...props }));
20
+ it('renders icon', () => {
21
+ renderIcon(tc.props);
22
+ expect(screen.getByTestId(tc.testId)).toHaveClass(tc.icon);
23
+ });
24
+ it('renders large icon', () => {
25
+ renderIcon({ ...tc.props, large: true });
26
+ expect(screen.getByTestId(tc.testId)).toHaveClass('fa-lg');
27
+ });
28
+ it('renders small icon', () => {
29
+ renderIcon({ ...tc.props, small: true });
30
+ expect(screen.getByTestId(tc.testId)).toHaveClass('fa-sm');
31
+ });
32
+ describe('icon types', () => {
33
+ it('renders the theme type by default', () => {
34
+ renderIcon(tc.props);
35
+ expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-color-dark');
36
+ });
37
+ it('renders the white icon', () => {
38
+ renderIcon({ ...tc.props, type: 'white' });
39
+ expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-white');
40
+ });
41
+ it('renders the text-type icon', () => {
42
+ renderIcon({ ...tc.props, type: 'text' });
43
+ expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-text-color');
44
+ });
45
+ it('renders the color-type icon', () => {
46
+ renderIcon({ ...tc.props, type: 'color', color: '#AABBFF' });
47
+ expect(screen.getByTestId(tc.testId)).toHaveStyle('color: #AABBFF');
48
+ });
49
+ it('renders a warning if type=color and no color is provided', () => {
50
+ renderIcon({ ...tc.props, type: 'color' });
51
+ expect(screen.getByText('Icon with type="color" must have prop color specified.')).toBeInTheDocument();
52
+ });
53
+ });
54
+ });
55
+ //# sourceMappingURL=Icon.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.test.js","sourceRoot":"","sources":["../../src/Icon/Icon.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,IAAI,MAAM,QAAQ,CAAC;AAG1B,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,MAAM,OAAO;QACX,MAAM,GAAG,YAAY,CAAC;QACtB,IAAI,GAAG,UAAU,CAAC;QAClB,KAAK,GAAc;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;YAClB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;KACH;IAED,IAAI,EAAW,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,CAAC,KAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAC,IAAI,OAAK,KAAK,GAAI,CAAC,CAAC;IAErE,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;QACtB,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC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H,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7D,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YAClE,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC3C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,wDAAwD,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACzG,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ export const iconTypes = [
2
+ 'theme',
3
+ 'white',
4
+ 'dark-gray',
5
+ 'darkish-gray',
6
+ 'gray',
7
+ 'color',
8
+ 'info',
9
+ 'text',
10
+ 'warning',
11
+ 'inherit',
12
+ 'danger',
13
+ 'theme-light',
14
+ 'success',
15
+ ];
16
+ //# sourceMappingURL=Icon.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.types.js","sourceRoot":"","sources":["../../src/Icon/Icon.types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO;IACP,OAAO;IACP,WAAW;IACX,cAAc;IACd,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,aAAa;IACb,SAAS;CACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './Icon';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,168 @@
1
+ import React from 'react';
2
+ import '../styles.css';
3
+ import { createFilter, default as ReactSelect } from 'react-select';
4
+ import CreatableSelect from 'react-select/creatable';
5
+ const baseClasses = ['focus:tw-ring-0', 'disabled:tw-cursor-not-allowed'].join(' ');
6
+ const containerStyles = ['tw-bg-white', 'dark:tw-bg-sq-dark-background'].join(' ');
7
+ const errorClasses = 'tw-border-sq-danger-color';
8
+ const borderColorClasses = ['tw-border-sq-disabled-gray', 'dark:tw-border-sq-dark-disabled-gray'].join(' ');
9
+ const borderStyles = [
10
+ 'tw-border-solid',
11
+ 'tw-border',
12
+ 'hover:tw-border-sq-color-dark',
13
+ 'focus:tw-border-sq-color-dark',
14
+ 'active:tw-border-sq-color-dark',
15
+ 'dark:hover:tw-border-sq-color-dark-dark',
16
+ 'dark:focus:tw-border-sq-color-dark-dark',
17
+ 'dark:active:tw-border-sq-color-dark-dark',
18
+ ].join(' ');
19
+ const textStyles = ['tw-text-sq-text-color', 'dark:tw-text-sq-dark-text', 'tw-text-sm'].join(' ');
20
+ const textActiveStyles = [
21
+ 'hover:tw-text-sq-color-dark',
22
+ 'focus:tw-text-sq-color-dark',
23
+ 'active:tw-text-sq-color-dark',
24
+ 'dark:tw-text-sq-dark-disabled-gray',
25
+ 'dark:hover:tw-text-sq-color-dark-dark',
26
+ 'dark:focus:tw-text-sq-color-dark-dark',
27
+ 'dark:active:tw-text-sq-color-dark-dark',
28
+ ].join(' ');
29
+ const menuStyles = [
30
+ 'tw-border-solid',
31
+ 'tw-border',
32
+ 'tw-rounded-b',
33
+ 'tw-border-sq-disabled-gray',
34
+ 'dark:tw-border-sq-dark-disabled-gray',
35
+ 'tw-whitespace-nowrap',
36
+ 'tw-min-w-fit',
37
+ '!tw-z-[9999]',
38
+ ].join(' ');
39
+ const menuListStyles = [
40
+ 'tw-rounded-b',
41
+ 'tw-bg-white',
42
+ 'dark:tw-bg-sq-dark-background',
43
+ 'tw-min-w-fit',
44
+ '!tw-z-[9999]',
45
+ 'specSelectMenu',
46
+ ].join(' ');
47
+ const groupHeadingStyles = [
48
+ 'tw-bg-sq-light-gray',
49
+ 'dark:tw-bg-sq-dark-disabled-gray',
50
+ 'tw-text-sq-darkish-gray',
51
+ 'tw-py-1',
52
+ 'tw-px-2.5',
53
+ 'specSelectGroupHeading',
54
+ ].join(' ');
55
+ const optionStyles = [
56
+ 'hover:tw-bg-sq-gray-highlight',
57
+ 'hover:tw-cursor-pointer',
58
+ 'dark:hover:tw-bg-sq-gray-highlight-dark',
59
+ 'tw-py-1',
60
+ 'tw-px-2.5',
61
+ 'specSelectOption',
62
+ ].join(' ');
63
+ const disabledClasses = ['tw-bg-sq-field-disabled-gray', 'tw-cursor-not-allowed'].join(' ');
64
+ const dropDownIndicatorStyles = `tw-text-sq-disabled-gray ${textActiveStyles} specOpenIt`;
65
+ const placeholderStyles = ['tw-text-gray-400', 'dark:tw-text-sq-dark-text-lighter', 'specOpenSelect'].join(' ');
66
+ const multiValueStyles = [
67
+ 'tw-bg-sq-disabled-gray',
68
+ 'dark:tw-bg-sq-multi-gray-dark',
69
+ 'tw-text-sm',
70
+ 'tw-py-0.5',
71
+ 'tw-px-1',
72
+ 'tw-m-0.5',
73
+ 'tw-rounded-sm',
74
+ 'specOpenSelect',
75
+ ].join(' ');
76
+ /**
77
+ * Select Component
78
+ * - based on react-select (https://react-select.com/)
79
+ *
80
+ * For ease of testing most of the elements of this select can be identified by classNames prefixed with "spec".
81
+ *
82
+ */
83
+ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no matching options', isSearchable = true, creatable = false, isMulti = false, isClearable = false, closeMenuOnSelect = true, id, inputId, menuPortalTarget, getOptionLabel, getSelectedValueLabel, getOptionValue, onChange, menuIsOpen, menuPlacement = 'auto', extraClassNames, inputGroup, filterConfig, filterOption, small = false, isDisabled = false, showError = false, isLoading = false, formatGroupLabel, onRemove, defaultValue, }) => {
84
+ const getOptionOrSelectedLabel = (option, { context }) => {
85
+ const getSelectedOptionLabel = getSelectedValueLabel ? getSelectedValueLabel : getOptionLabel;
86
+ if (getOptionLabel || getSelectedValueLabel) {
87
+ if (context === 'value') {
88
+ return getSelectedOptionLabel ? getSelectedOptionLabel(option) : option.label;
89
+ }
90
+ else {
91
+ return getOptionLabel ? getOptionLabel(option) : option.label;
92
+ }
93
+ }
94
+ else {
95
+ return option.label;
96
+ }
97
+ };
98
+ const interceptOnChange = (newValue, actionMeta) => {
99
+ if (isMulti && onRemove && actionMeta.action === 'remove-value') {
100
+ onRemove({ id: actionMeta.removedValue });
101
+ return;
102
+ }
103
+ onChange(newValue);
104
+ };
105
+ const props = {
106
+ id,
107
+ value,
108
+ inputId,
109
+ placeholder,
110
+ closeMenuOnSelect,
111
+ blurInputOnSelect: closeMenuOnSelect,
112
+ isSearchable: creatable ? true : isSearchable,
113
+ isMulti,
114
+ isClearable,
115
+ isLoading,
116
+ defaultValue,
117
+ noOptionsMessage: () => noOptionsMessage,
118
+ menuPortalTarget,
119
+ menuIsOpen,
120
+ onChange: interceptOnChange,
121
+ unstyled: true,
122
+ menuPlacement,
123
+ formatOptionLabel: getOptionOrSelectedLabel,
124
+ formatGroupLabel,
125
+ getOptionValue,
126
+ options,
127
+ isDisabled,
128
+ hideSelectedOptions: isMulti,
129
+ filterOption: filterOption ? filterOption : filterConfig ? createFilter(filterConfig) : undefined,
130
+ classNames: {
131
+ control: ({ menuIsOpen }) => {
132
+ let border = menuIsOpen ? 'tw-rounded-t-sm' : 'tw-rounded-sm';
133
+ // if it's on the left side of the input group make sure the right side is straight and not curved
134
+ if (inputGroup === 'left') {
135
+ border = menuIsOpen ? 'tw-rounded-tl-sm' : 'tw-rounded-l-sm';
136
+ }
137
+ else if (inputGroup === 'right') {
138
+ border = menuIsOpen ? 'tw-rounded-tr-sm' : 'tw-rounded-r-sm';
139
+ }
140
+ const appliedClasses = `${borderStyles} ${border} ${showError ? errorClasses : borderColorClasses} ${small ? 'reactSelectMinHeightSmall' : 'reactSelectMinHeight'} `;
141
+ return `${appliedClasses} ${baseClasses} specSelectControl ${isDisabled ? disabledClasses : ''} ${small ? 'tw-pl-2 tw-pr-1' : 'tw-pl-2.5 tw-pr-1.5'}`;
142
+ },
143
+ placeholder: () => placeholderStyles,
144
+ container: () => `${textStyles} ${containerStyles} ${extraClassNames}`,
145
+ input: () => textStyles + ' specSelectInput',
146
+ menuList: () => menuListStyles,
147
+ menu: () => menuStyles,
148
+ menuPortal: () => '!tw-z-[9000]',
149
+ dropdownIndicator: () => dropDownIndicatorStyles,
150
+ option: ({ isSelected, isDisabled }) => {
151
+ let classes = optionStyles;
152
+ if (isDisabled) {
153
+ classes += ' specDisabledOption ';
154
+ }
155
+ return isSelected ? classes + ' tw-bg-sq-colored-hover dark:tw-bg-sq-colored-hover-dark' : classes;
156
+ },
157
+ singleValue: () => 'specOpenSelect',
158
+ multiValue: () => multiValueStyles,
159
+ multiValueRemove: () => 'hover:tw-text-sq-danger-color specSelectMultiValueRemove',
160
+ clearIndicator: () => 'tw-text-sq-disabled-gray hover:tw-text-sq-danger-color specClearSelect',
161
+ group: () => 'specSelectGroup',
162
+ groupHeading: () => groupHeadingStyles,
163
+ },
164
+ };
165
+ return creatable ? React.createElement(CreatableSelect, { ...props }) : React.createElement(ReactSelect, { ...props });
166
+ };
167
+ export default Select;
168
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.js","sourceRoot":"","sources":["../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AAC,GAAG,UAAU,IAAI,eAAe,IAAI,eAAe,EAAE;YACtE,KAAK,EAAE,GAAG,EAAE,CAAC,UAAU,GAAG,kBAAkB;YAC5C,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc;YAC9B,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU;YACtB,UAAU,EAAE,GAAG,EAAE,CAAC,cAAc;YAChC,iBAAiB,EAAE,GAAG,EAAE,CAAC,uBAAuB;YAChD,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,EAAgD,EAAE,EAAE;gBACnF,IAAI,OAAO,GAAG,YAAY,CAAC;gBAC3B,IAAI,UAAU,EAAE;oBACd,OAAO,IAAI,sBAAsB,CAAC;iBACnC;gBACD,OAAO,UAAU,CAAC,CAAC,CAAC,OAAO,GAAG,0DAA0D,CAAC,CAAC,CAAC,OAAO,CAAC;YACrG,CAAC;YACD,WAAW,EAAE,GAAG,EAAE,CAAC,gBAAgB;YACnC,UAAU,EAAE,GAAG,EAAE,CAAC,gBAAgB;YAClC,gBAAgB,EAAE,GAAG,EAAE,CAAC,0DAA0D;YAClF,cAAc,EAAE,GAAG,EAAE,CAAC,wEAAwE;YAC9F,KAAK,EAAE,GAAG,EAAE,CAAC,iBAAiB;YAC9B,YAAY,EAAE,GAAG,EAAE,CAAC,kBAAkB;SACvC;KACF,CAAC;IAEF,OAAO,SAAS,CAAC,CAAC,CAAC,oBAAC,eAAe,OAAM,KAAa,GAAI,CAAC,CAAC,CAAC,oBAAC,WAAW,OAAK,KAAK,GAAI,CAAC;AAC1F,CAAC,CAAC;AACF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import Select from './Select';
3
+ import TextField from '../TextField';
4
+ export default {
5
+ title: 'Select',
6
+ };
7
+ export const AllSelectVariants = () => {
8
+ const options = [
9
+ { value: 'a', label: 'Chocolate' },
10
+ { value: 'b', label: 'Strawberry' },
11
+ { value: 'c', label: 'Vanilla' },
12
+ { value: 'd', label: 'Rocky Road' },
13
+ { value: 'e', label: 'Crazy Cow' },
14
+ { value: 'f', label: 'Almond Joy' },
15
+ { value: 'g', label: 'All of the above' },
16
+ ];
17
+ const colorOptions = [
18
+ { value: 'h', label: 'pink' },
19
+ { value: 'i', label: 'purple' },
20
+ { value: 'j', label: 'green' },
21
+ { value: 'k', label: 'red' },
22
+ ];
23
+ const groupedOptions = [
24
+ {
25
+ label: 'Ice Cream Flavors',
26
+ options: options,
27
+ },
28
+ {
29
+ label: 'Colors',
30
+ options: colorOptions,
31
+ },
32
+ ];
33
+ const allSelects = () => (React.createElement(React.Fragment, null,
34
+ React.createElement("div", { className: "tw-p-5" },
35
+ React.createElement(Select, { id: "hello", onChange: () => { }, options: options, placeholder: "single value" })),
36
+ React.createElement("div", { className: "tw-p-5" },
37
+ React.createElement(Select, { id: "hello", onChange: () => { }, options: options, placeholder: "single value - small", small: true })),
38
+ React.createElement("div", { className: "tw-p-5" },
39
+ React.createElement(Select, { id: "disabled", onChange: () => { }, options: options, placeholder: "disabled", isDisabled: true })),
40
+ React.createElement("div", { className: "tw-p-5" },
41
+ React.createElement(Select, { id: "error", onChange: () => { }, options: options, placeholder: "error", showError: true })),
42
+ React.createElement("div", { className: "tw-p-5" },
43
+ React.createElement(Select, { onChange: () => { }, options: options, placeholder: "stays open", closeMenuOnSelect: false, creatable: true })),
44
+ React.createElement("div", { className: "tw-p-5" },
45
+ React.createElement(Select, { onChange: () => { }, options: groupedOptions, placeholder: "grouped" })),
46
+ React.createElement("div", { className: "tw-p-5" },
47
+ React.createElement(Select, { onChange: () => { }, options: options, creatable: true, placeholder: "create option" })),
48
+ React.createElement("div", { className: "tw-p-5" },
49
+ React.createElement(Select, { onChange: () => { }, options: options, isClearable: true, placeholder: "clearable" })),
50
+ React.createElement("div", { className: "tw-p-5" },
51
+ React.createElement(Select, { onChange: () => { }, options: options, placeholder: "multi-select", isMulti: true, isSearchable: false })),
52
+ React.createElement("div", { className: "tw-p-5" },
53
+ React.createElement(Select, { onChange: () => { }, placeholder: "type to search", options: options, isSearchable: true })),
54
+ React.createElement("div", { className: "tw-p-5 tw-flex tw-flex-row" },
55
+ React.createElement(Select, { onChange: () => { }, placeholder: "type to search", options: options, inputGroup: "left", extraClassNames: "tw-w-[200px]" }),
56
+ React.createElement(TextField, { onChange: () => { }, placeholder: "text goes here", inputGroup: "right" }))));
57
+ const renderAllVariations = () => (React.createElement(React.Fragment, null,
58
+ React.createElement("div", { className: "tw-grid tw-gap-4" },
59
+ allSelects(),
60
+ React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" }, allSelects()))));
61
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
62
+ React.createElement("div", { className: "color_topic" },
63
+ React.createElement("b", null, "Topic Colors"),
64
+ renderAllVariations()),
65
+ React.createElement("div", { className: "color_analysis" },
66
+ React.createElement("b", null, "Analysis Colors"),
67
+ renderAllVariations()),
68
+ React.createElement("div", { className: "color_datalab" },
69
+ React.createElement("b", null, "Datalab Colors"),
70
+ renderAllVariations())));
71
+ };
72
+ //# sourceMappingURL=Select.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.stories.js","sourceRoot":"","sources":["../../src/Select/Select.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,eAAe;IACb,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG;QACd,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAClC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE;QACnC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;QAChC,EAAE,KAAK,EAAE,GAAG,EAAE,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C,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,WAAW,EAAC,gBAAgB,EAAC,OAAO,EAAE,OAAc,EAAE,YAAY,EAAE,IAAI,GAAI,CACpG;QAEN,6BAAK,SAAS,EAAC,4BAA4B;YACzC,oBAAC,MAAM,IACL,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAClB,WAAW,EAAC,gBAAgB,EAC5B,OAAO,EAAE,OAAc,EACvB,UAAU,EAAC,MAAM,EACjB,eAAe,EAAC,cAAc,GAC9B;YACF,oBAAC,SAAS,IAAC,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,WAAW,EAAC,gBAAgB,EAAC,UAAU,EAAC,OAAO,GAAG,CAC7E,CACL,CACJ,CAAC;IACF,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAChC;QACE,6BAAK,SAAS,EAAC,kBAAkB;YAC9B,UAAU,EAAE;YACb,6BAAK,SAAS,EAAC,kCAAkC,IAAE,UAAU,EAAE,CAAO,CAClE,CACL,CACJ,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,161 @@
1
+ import React from 'react';
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen } from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
5
+ import Select from './Select';
6
+ describe('Select', () => {
7
+ class Context {
8
+ testId = 'selectTestId';
9
+ label = 'button label';
10
+ options = [
11
+ { label: 'vanilla', value: 'a' },
12
+ { label: 'chocolate', value: 'b' },
13
+ { label: 'strawberry', value: 'c' },
14
+ ];
15
+ otherOptions = [
16
+ { label: 'red', value: 'd' },
17
+ { label: 'green', value: 'e' },
18
+ ];
19
+ groupedOptions = [
20
+ {
21
+ label: 'Ice Cream Flavors',
22
+ options: this.options,
23
+ },
24
+ {
25
+ label: 'Colors',
26
+ options: this.otherOptions,
27
+ },
28
+ ];
29
+ props = {
30
+ onChange: jest.fn(),
31
+ options: this.options,
32
+ };
33
+ }
34
+ let tc;
35
+ beforeEach(() => {
36
+ tc = new Context();
37
+ });
38
+ const openSelect = async () => {
39
+ const select = document.querySelector(`.specOpenSelect`);
40
+ await userEvent.click(select);
41
+ };
42
+ const renderSelect = (props) => render(React.createElement("div", { id: "wrapper" },
43
+ React.createElement(Select, { ...props })));
44
+ it('renders the select', () => {
45
+ renderSelect(tc.props);
46
+ expect(document.querySelector('.specSelectControl')).toBeInTheDocument();
47
+ });
48
+ it('displays options', async () => {
49
+ renderSelect(tc.props);
50
+ await openSelect();
51
+ expect(document.querySelectorAll('.specSelectOption')).toHaveLength(3);
52
+ });
53
+ it('displays grouped options', async () => {
54
+ renderSelect({ ...tc.props, options: tc.groupedOptions });
55
+ await openSelect();
56
+ expect(document.querySelectorAll('.specSelectOption')).toHaveLength(5);
57
+ expect(document.querySelectorAll('.specSelectGroupHeading')).toHaveLength(2);
58
+ expect(document.querySelectorAll('.specSelectGroup')).toHaveLength(2);
59
+ });
60
+ it('reflects error state', () => {
61
+ renderSelect({ ...tc.props, showError: true });
62
+ expect(document.querySelector('.specSelectControl')).toHaveClass('tw-border-sq-danger-color');
63
+ });
64
+ it('reflects custom render function for option', async () => {
65
+ const getOptionLabel = (option) => (React.createElement("div", null,
66
+ option.label,
67
+ React.createElement("br", null),
68
+ "custom formatting applied"));
69
+ renderSelect({ ...tc.props, getOptionLabel });
70
+ await openSelect();
71
+ expect(document.querySelectorAll('.specSelectOption')[0]).toHaveTextContent('custom formatting applied');
72
+ });
73
+ it('reflects custom render for selected option', async () => {
74
+ const getSelectedValueLabel = (option) => (React.createElement("div", null,
75
+ option.label,
76
+ React.createElement("br", null),
77
+ "the chosen one"));
78
+ renderSelect({ ...tc.props, getSelectedValueLabel });
79
+ await openSelect();
80
+ await userEvent.click(screen.getByText(tc.options[0].label));
81
+ expect(document.querySelectorAll('.specOpenSelect')[0]).toHaveTextContent('the chosen one');
82
+ });
83
+ it('renders the provided value as selected', () => {
84
+ const value = tc.options[1];
85
+ renderSelect({ ...tc.props, value });
86
+ expect(document.querySelectorAll('.specOpenSelect')[0]).toHaveTextContent(value.label);
87
+ });
88
+ it('renders the provided placeholder', () => {
89
+ const placeholder = 'choose your favorite flavor';
90
+ renderSelect({ ...tc.props, placeholder });
91
+ expect(screen.getByText(placeholder)).toBeInTheDocument();
92
+ });
93
+ it('renders the provided noOptionsMessage', async () => {
94
+ const noOptionsMessage = 'Nothing to see here.';
95
+ renderSelect({ ...tc.props, noOptionsMessage, options: [] });
96
+ await openSelect();
97
+ expect(screen.getByText(noOptionsMessage)).toBeInTheDocument();
98
+ });
99
+ it('supports multi selection', async () => {
100
+ const isMulti = true;
101
+ renderSelect({ ...tc.props, isMulti });
102
+ await openSelect();
103
+ await userEvent.click(screen.getByText(tc.options[0].label));
104
+ await openSelect();
105
+ await userEvent.click(screen.getByText(tc.options[1].label));
106
+ expect(document.querySelectorAll('.specOpenSelect')).toHaveLength(2);
107
+ });
108
+ it('renders isClearable', async () => {
109
+ const isClearable = true;
110
+ const placeholder = 'no worries - you can clear this.';
111
+ renderSelect({ ...tc.props, isClearable, placeholder });
112
+ await openSelect();
113
+ await userEvent.click(screen.getByText(tc.options[0].label));
114
+ expect(document.querySelectorAll('.specOpenSelect')[0]).toHaveTextContent(tc.options[0].label);
115
+ expect(document.querySelector('.specClearSelect')).toBeInTheDocument();
116
+ await userEvent.click(document.querySelector('.specClearSelect'));
117
+ expect(document.querySelectorAll('.specOpenSelect')[0]).toHaveTextContent(placeholder);
118
+ });
119
+ it('supports menuIsOpen', async () => {
120
+ const menuIsOpen = true;
121
+ renderSelect({ ...tc.props, menuIsOpen, menuPortalTarget: document.querySelector('#wrapper') });
122
+ expect(document.querySelectorAll('.specSelectOption')).toHaveLength(tc.options.length);
123
+ });
124
+ it('supports closeMenuOnSelect', async () => {
125
+ const closeMenuOnSelect = false;
126
+ renderSelect({ ...tc.props, closeMenuOnSelect });
127
+ await openSelect();
128
+ await userEvent.click(screen.getByText(tc.options[1].label));
129
+ await userEvent.click(screen.getByText(tc.options[2].label));
130
+ expect(document.querySelectorAll('.specOpenSelect')[0]).toHaveTextContent(tc.options[2].label);
131
+ });
132
+ it('removes selected option from multi-select options list', async () => {
133
+ const closeMenuOnSelect = false;
134
+ renderSelect({ ...tc.props, isMulti: true, closeMenuOnSelect });
135
+ await openSelect();
136
+ await userEvent.click(screen.getByText(tc.options[1].label));
137
+ await userEvent.click(screen.getByText(tc.options[2].label));
138
+ expect(document.querySelectorAll('.specSelectOption')).toHaveLength(tc.options.length - 2);
139
+ });
140
+ it('calls onChange handler', async () => {
141
+ const onChange = jest.fn();
142
+ renderSelect({ ...tc.props, onChange });
143
+ await openSelect();
144
+ await userEvent.click(screen.getByText(tc.options[1].label));
145
+ expect(onChange).toHaveBeenCalledWith(tc.options[1]);
146
+ });
147
+ it('includes inputId', async () => {
148
+ const inputId = 'idMe';
149
+ renderSelect({ ...tc.props, inputId });
150
+ expect(document.querySelector(`#${inputId}`)).toBeInTheDocument();
151
+ });
152
+ it('supports creating options', async () => {
153
+ const inputId = 'idMe';
154
+ const favorite = 'Almond Joy';
155
+ renderSelect({ ...tc.props, creatable: true, inputId });
156
+ await openSelect();
157
+ await userEvent.type(document.querySelector(`#${inputId}`), favorite);
158
+ expect(screen.getByText(`Create "${favorite}"`)).toBeInTheDocument();
159
+ });
160
+ });
161
+ //# sourceMappingURL=Select.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.test.js","sourceRoot":"","sources":["../../src/Select/Select.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1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,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QACxD,MAAM,UAAU,EAAE,CAAC;QACnB,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,OAAO,EAAE,CAAE,EAAE,QAAQ,CAAC,CAAC;QACvE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,QAAQ,GAAG,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Select.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.types.js","sourceRoot":"","sources":["../../src/Select/Select.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { default } from './Select';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import '../styles.css';
3
+ const baseClasses = 'tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm' +
4
+ ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border tw-text-sm';
5
+ const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +
6
+ ' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark dark:tw-placeholder-sq-dark-text-lighter';
7
+ const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark tw-placeholder-gray-400';
8
+ /**
9
+ * TextArea.
10
+ */
11
+ export const TextArea = ({ readonly = false, onChange, onKeyUp, id, name, rows = 3, cols = undefined, value, placeholder, extraClassNames, testId, autofocus = false, }) => {
12
+ const appliedClasses = `${baseClasses} ${extraClassNames} ${lightTheme} ${darkTheme}`;
13
+ return (React.createElement("textarea", { "data-testid": testId, name: name, id: id, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, onChange: onChange, onKeyUp: onKeyUp, rows: rows, cols: cols, autoFocus: autofocus }));
14
+ };
15
+ //# sourceMappingURL=TextArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../src/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,eAAe,CAAC;AAEvB,MAAM,WAAW,GACf,iEAAiE;IACjE,6EAA6E,CAAC;AAEhF,MAAM,SAAS,GACb,8FAA8F;IAC9F,4HAA4H,CAAC;AAC/H,MAAM,UAAU,GACd,uIAAuI,CAAC;AAE1I;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA2C,CAAC,EAC/D,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,SAAS,EAChB,KAAK,EACL,WAAW,EACX,eAAe,EACf,MAAM,EACN,SAAS,GAAG,KAAK,GAClB,EAAE,EAAE;IACH,MAAM,cAAc,GAAG,GAAG,WAAW,IAAI,eAAe,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;IAEtF,OAAO,CACL,iDACe,MAAM,EACnB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,GACpB,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { TextArea } from './TextArea';
3
+ export default {
4
+ title: 'TextArea',
5
+ };
6
+ export const AllTextAreas = () => {
7
+ const renderAllVariations = () => (React.createElement(React.Fragment, null,
8
+ React.createElement("div", { className: "tw-p-4 light" },
9
+ React.createElement("div", { className: "tw-p-4" },
10
+ React.createElement(TextArea, { value: "Short text provided." })),
11
+ React.createElement("div", { className: "tw-p-4" },
12
+ React.createElement(TextArea, { value: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Odio morbi quis commodo odio aenean. Lectus sit amet est placerat in egestas erat. Dui nunc mattis enim ut tellus. Dictumst vestibulum rhoncus est pellentesque elit ullamcorper. Nibh mauris cursus mattis molestie a. Aenean vel elit scelerisque mauris pellentesque. Nunc sed id semper risus in hendrerit gravida rutrum quisque. Tortor dignissim convallis aenean et tortor at risus. Vitae congue mauris rhoncus aenean vel elit scelerisque. Tellus id interdum velit laoreet id donec ultrices. Ac turpis egestas maecenas pharetra. Commodo odio aenean sed adipiscing diam donec adipiscing tristique risus. Consequat interdum varius sit amet mattis. Lacus laoreet non curabitur gravida arcu ac tortor. Vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum. Odio ut enim blandit volutpat maecenas volutpat." })),
13
+ React.createElement("div", { className: "tw-p-4" },
14
+ React.createElement(TextArea, { placeholder: "placeholder text" })),
15
+ React.createElement("div", { className: "tw-p-4" },
16
+ React.createElement(TextArea, { value: "read-only", readonly: true }))),
17
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
18
+ React.createElement("div", { className: "tw-p-4" },
19
+ React.createElement(TextArea, { value: "value provided" })),
20
+ React.createElement("div", { className: "tw-p-4" },
21
+ React.createElement(TextArea, { placeholder: "placeholder text" })),
22
+ React.createElement("div", { className: "tw-p-4" },
23
+ React.createElement(TextArea, { value: "read-only", readonly: true })))));
24
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
25
+ React.createElement("div", { className: "color_topic" },
26
+ React.createElement("b", null, "Topic Colors"),
27
+ renderAllVariations()),
28
+ React.createElement("div", { className: "color_analysis" },
29
+ React.createElement("b", null, "Analysis Colors"),
30
+ renderAllVariations()),
31
+ React.createElement("div", { className: "color_datalab" },
32
+ React.createElement("b", null, "Datalab Colors"),
33
+ renderAllVariations())));
34
+ };
35
+ //# sourceMappingURL=TextArea.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextArea.stories.js","sourceRoot":"","sources":["../../src/TextArea/TextArea.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,eAAe;IACb,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAChC;QACE,6BAAK,SAAS,EAAC,cAAc;YAC3B,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,QAAQ,IAAC,KAAK,EAAC,sBAAsB,GAAG,CACrC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,QAAQ,IAAC,KAAK,EAAC,q7BAAq7B,GAAG,CACp8B;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,QAAQ,IAAC,WAAW,EAAC,kBAAkB,GAAG,CACvC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,QAAQ,IAAC,KAAK,EAAC,WAAW,EAAC,QAAQ,EAAE,IAAI,GAAI,CAC1C,CACF;QAEN,6BAAK,SAAS,EAAC,yCAAyC;YACtD,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,QAAQ,IAAC,KAAK,EAAC,gBAAgB,GAAG,CAC/B;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBA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