@economic/taco 0.0.1-alpha.8 → 0.0.2-alpha.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 (28) hide show
  1. package/dist/components/Combobox/useCombobox.d.ts +3 -3
  2. package/dist/components/Listbox/Listbox.d.ts +0 -1
  3. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
  4. package/dist/components/Select/Select.d.ts +0 -5
  5. package/dist/components/Select/useSelect.d.ts +5 -4
  6. package/dist/esm/index.css +6 -78
  7. package/dist/esm/src/components/Combobox/Combobox.js +28 -24
  8. package/dist/esm/src/components/Combobox/Combobox.js.map +1 -1
  9. package/dist/esm/src/components/Combobox/useCombobox.js +32 -38
  10. package/dist/esm/src/components/Combobox/useCombobox.js.map +1 -1
  11. package/dist/esm/src/components/Listbox/Listbox.js +21 -5
  12. package/dist/esm/src/components/Listbox/Listbox.js.map +1 -1
  13. package/dist/esm/src/components/Listbox/ScrollableList.js +6 -4
  14. package/dist/esm/src/components/Listbox/ScrollableList.js.map +1 -1
  15. package/dist/esm/src/components/RadioGroup/RadioGroup.js +17 -16
  16. package/dist/esm/src/components/RadioGroup/RadioGroup.js.map +1 -1
  17. package/dist/esm/src/components/Select/Select.js +27 -26
  18. package/dist/esm/src/components/Select/Select.js.map +1 -1
  19. package/dist/esm/src/components/Select/useSelect.js +72 -39
  20. package/dist/esm/src/components/Select/useSelect.js.map +1 -1
  21. package/dist/index.css +6 -78
  22. package/dist/taco.cjs.development.js +211 -159
  23. package/dist/taco.cjs.development.js.map +1 -1
  24. package/dist/taco.cjs.production.min.js +1 -1
  25. package/dist/taco.cjs.production.min.js.map +1 -1
  26. package/dist/utils/tailwind.d.ts +1 -1
  27. package/package.json +2 -3
  28. package/types.json +237 -250
@@ -1,27 +1,25 @@
1
- import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { useMemo, useState, useEffect, createElement, Fragment, cloneElement } from 'react';
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { useState, useMemo, useRef, useEffect, createElement, Fragment, cloneElement } from 'react';
3
3
  import cn from 'classnames';
4
4
  import { v4 } from 'uuid';
5
5
  import { useLocalization } from '../Provider/Provider.js';
6
6
  import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
7
- import { usePopoverState } from 'reakit/Popover';
8
7
  import keycode from 'keycode';
9
- import { useFlattenedData, findByValue, setInputValueByRef } from '../Listbox/util.js';
8
+ import { useFlattenedData, setInputValueByRef, findByValue, sanitizeItem } from '../Listbox/util.js';
10
9
 
11
- var _excluded = ["aria-label", "aria-labelledby", "data", "disabled", "emptyValue", "id", "multiselect", "onClick", "readOnly", "showSelectedIcon", "value"];
10
+ var _excluded = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "emptyValue", "id", "multiselect", "onClick", "onChange", "readOnly", "value"];
12
11
  var useSelect = function useSelect(_ref, ref) {
13
12
  var ariaLabel = _ref['aria-label'],
14
13
  ariaLabelledBy = _ref['aria-labelledby'],
15
14
  _ref$data = _ref.data,
16
15
  data = _ref$data === void 0 ? [] : _ref$data,
16
+ defaultValue = _ref.defaultValue,
17
17
  disabled = _ref.disabled,
18
18
  emptyValue = _ref.emptyValue,
19
19
  nativeId = _ref.id,
20
20
  multiselect = _ref.multiselect,
21
- onClick = _ref.onClick,
21
+ onChange = _ref.onChange,
22
22
  readOnly = _ref.readOnly,
23
- _ref$showSelectedIcon = _ref.showSelectedIcon,
24
- showSelectedIcon = _ref$showSelectedIcon === void 0 ? false : _ref$showSelectedIcon,
25
23
  _ref$value = _ref.value,
26
24
  value = _ref$value === void 0 ? emptyValue : _ref$value,
27
25
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
@@ -31,36 +29,39 @@ var useSelect = function useSelect(_ref, ref) {
31
29
 
32
30
  var searchData = useFlattenedData(data);
33
31
  var inputRef = useProxiedRef(ref);
34
- var popover = usePopoverState({
35
- gutter: 4,
36
- placement: 'bottom-start'
37
- });
32
+
33
+ var _React$useState = useState(false),
34
+ open = _React$useState[0],
35
+ setOpen = _React$useState[1];
36
+
38
37
  var id = useMemo(function () {
39
38
  return nativeId || "select_" + v4();
40
39
  }, [nativeId]);
40
+ var internalInputRef = useRef(null);
41
41
  var buttonId = id + "-button"; // support 'escape' resetting to the value that was set when the listbox opened
42
42
 
43
- var _React$useState = useState(value),
44
- lastValue = _React$useState[0],
45
- setLastValue = _React$useState[1];
43
+ var _React$useState2 = useState(value),
44
+ lastValue = _React$useState2[0],
45
+ setLastValue = _React$useState2[1];
46
46
 
47
47
  useEffect(function () {
48
48
  setLastValue(value);
49
- }, [popover.visible]); // event handlers
50
-
51
- var handleButtonClick = function handleButtonClick(event) {
52
- popover.toggle();
53
-
54
- if (onClick) {
55
- event.persist();
56
- onClick(event);
49
+ }, [open]);
50
+ useEffect(function () {
51
+ if (defaultValue !== undefined && value === undefined) {
52
+ setInputValueByRef(internalInputRef.current, defaultValue);
57
53
  }
58
- };
54
+ }, [defaultValue]);
55
+ useEffect(function () {
56
+ if (value !== undefined) {
57
+ setInputValueByRef(internalInputRef.current, value);
58
+ }
59
+ }, []); // event handlers
59
60
 
60
61
  var handleButtonKeyDown = function handleButtonKeyDown(event) {
61
62
  if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {
62
63
  event.preventDefault();
63
- popover.toggle();
64
+ setOpen(true);
64
65
  }
65
66
  };
66
67
 
@@ -74,7 +75,7 @@ var useSelect = function useSelect(_ref, ref) {
74
75
  setInputValueByRef(inputRef.current, lastValue);
75
76
  }
76
77
 
77
- popover.hide();
78
+ setOpen(false);
78
79
  break;
79
80
  }
80
81
 
@@ -85,7 +86,7 @@ var useSelect = function useSelect(_ref, ref) {
85
86
  event.preventDefault();
86
87
  }
87
88
 
88
- popover.hide();
89
+ setOpen(false);
89
90
  break;
90
91
  }
91
92
  }
@@ -99,7 +100,7 @@ var useSelect = function useSelect(_ref, ref) {
99
100
  event.preventDefault();
100
101
 
101
102
  if (!multiselect) {
102
- popover.hide();
103
+ setOpen(false);
103
104
  }
104
105
  };
105
106
 
@@ -124,21 +125,47 @@ var useSelect = function useSelect(_ref, ref) {
124
125
  var item = findByValue(searchData, value);
125
126
 
126
127
  if (item) {
127
- text = showSelectedIcon && item.icon ? createElement(Fragment, null, cloneElement(item.icon, {
128
- className: cn(item.icon.props.className, 'mr-1')
128
+ text = item.icon ? createElement(Fragment, null, cloneElement(item.icon, {
129
+ className: cn(item.icon.props.className, 'mr-1 -mt-px')
129
130
  }), item.text) : item.text;
130
131
  }
131
132
  }
132
133
  }
133
134
 
135
+ var handleInputChange = function handleInputChange(event) {
136
+ event.persist();
137
+
138
+ if (onChange) {
139
+ var _item$path$split, _item$path;
140
+
141
+ var _item = findByValue(searchData, event.target.value);
142
+
143
+ event.detail = sanitizeItem(_item);
144
+ var indexes = (_item$path$split = _item === null || _item === void 0 ? void 0 : (_item$path = _item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
145
+
146
+ if (indexes.length > 1) {
147
+ // we don't want to map the current item
148
+ indexes.pop(); // we need to rebuild the path as we map
149
+
150
+ var lastPath;
151
+ event.detail.parents = indexes.map(function (i) {
152
+ lastPath = lastPath ? [lastPath, i].join('.') : i;
153
+ return sanitizeItem(searchData.find(function (i) {
154
+ return i.path === lastPath;
155
+ }));
156
+ });
157
+ }
158
+
159
+ onChange(event);
160
+ }
161
+ };
162
+
134
163
  var button = {
135
- 'aria-expanded': popover.visible,
136
164
  'aria-haspopup': 'listbox',
137
165
  'aria-label': ariaLabel ? ariaLabel + " " + text : undefined,
138
166
  'aria-labelledby': ariaLabelledBy ? ariaLabelledBy + " " + buttonId : undefined,
139
167
  disabled: disabled,
140
168
  id: buttonId,
141
- onClick: !disabled && !readOnly ? handleButtonClick : undefined,
142
169
  onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,
143
170
  type: 'button'
144
171
  };
@@ -150,22 +177,28 @@ var useSelect = function useSelect(_ref, ref) {
150
177
  disabled: disabled,
151
178
  emptyValue: emptyValue,
152
179
  onClick: handleListboxClick,
180
+ onChange: function onChange(event) {
181
+ setInputValueByRef(internalInputRef.current, event.detail.value);
182
+ },
153
183
  onKeyDown: handleListboxKeyDown,
154
184
  ref: inputRef,
155
185
  value: value,
156
186
  multiselect: multiselect
157
187
  });
158
188
 
189
+ var input = {
190
+ onChange: handleInputChange,
191
+ ref: internalInputRef,
192
+ value: value !== null && value !== void 0 ? value : ''
193
+ };
159
194
  return {
160
195
  button: button,
161
196
  listbox: listbox,
162
- popover: _extends({}, popover, {
163
- container: {
164
- tabIndex: -1,
165
- 'aria-label': ariaLabel,
166
- 'aria-labelledby': ariaLabelledBy
167
- }
168
- }),
197
+ input: input,
198
+ popover: {
199
+ open: open,
200
+ onOpenChange: setOpen
201
+ },
169
202
  text: text,
170
203
  more: more
171
204
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useSelect.js","sources":["../../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport cn from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport { useLocalization } from '../Provider/Provider';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { usePopoverState, PopoverStateReturn, PopoverHTMLProps } from 'reakit/Popover';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: React.ButtonHTMLAttributes<HTMLButtonElement>;\n listbox: ListboxProps;\n popover: PopoverStateReturn & { container: PopoverHTMLProps };\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onClick,\n readOnly,\n showSelectedIcon = false,\n value = emptyValue,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const searchData = useFlattenedData(data);\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const popover = usePopoverState({ gutter: 4, placement: 'bottom-start' });\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [popover.visible]);\n\n // event handlers\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>): void => {\n popover.toggle();\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\n event.preventDefault();\n popover.toggle();\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.keyCode) {\n case keycode('escape'): {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(inputRef.current, lastValue);\n }\n\n popover.hide();\n break;\n }\n\n case keycode('tab'):\n case keycode('enter'): {\n if (event.keyCode !== keycode('tab')) {\n event.preventDefault();\n }\n popover.hide();\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n popover.hide();\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === searchData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(searchData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(searchData, value);\n\n if (item) {\n text =\n showSelectedIcon && item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const button: React.ButtonHTMLAttributes<HTMLButtonElement> = {\n 'aria-expanded': popover.visible,\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled,\n id: buttonId,\n onClick: !disabled && !readOnly ? handleButtonClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n type: 'button',\n };\n\n const listbox = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onClick: handleListboxClick,\n onKeyDown: handleListboxKeyDown,\n ref: inputRef,\n value,\n multiselect,\n };\n\n return {\n button,\n listbox,\n popover: {\n ...popover,\n container: {\n tabIndex: -1,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ref","ariaLabel","ariaLabelledBy","data","disabled","emptyValue","nativeId","id","multiselect","onClick","readOnly","showSelectedIcon","value","otherProps","useLocalization","texts","searchData","useFlattenedData","inputRef","useProxiedRef","popover","usePopoverState","gutter","placement","React","uuid","buttonId","lastValue","setLastValue","visible","handleButtonClick","event","toggle","persist","handleButtonKeyDown","keyCode","keycode","preventDefault","handleListboxKeyDown","undefined","setInputValueByRef","current","hide","onKeyDown","handleListboxClick","text","more","selectedValues","toString","split","length","filter","item","select","allOptionsSelected","findByValue","icon","className","cn","props","button","type","listbox","container","tabIndex"],"mappings":";;;;;;;;;;;IAo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0D;AAM1DG,IAAAA,EAAE,EAAEmB,QANsD;AAO1DjB,IAAAA,OAAO,EAAE,CAACL,QAAD,IAAa,CAACM,QAAd,GAAyBoB,iBAAzB,GAA6CS,SAPI;AAQ1DI,IAAAA,SAAS,EAAE,CAACvC,QAAD,IAAa,CAACM,QAAd,GAAyBwB,mBAAzB,GAA+CK,SARA;AAS1DsB,IAAAA,IAAI,EAAE;AAToD,GAA9D;;AAYA,MAAMC,OAAO,gBACNjD,UADM;AAET,kBAAcZ,SAFL;AAGT,uBAAmBC,cAHV;AAITC,IAAAA,IAAI,EAAJA,IAJS;AAKTC,IAAAA,QAAQ,EAARA,QALS;AAMTC,IAAAA,UAAU,EAAVA,UANS;AAOTI,IAAAA,OAAO,EAAEmC,kBAPA;AAQTD,IAAAA,SAAS,EAAEL,oBARF;AASTtC,IAAAA,GAAG,EAAEkB,QATI;AAUTN,IAAAA,KAAK,EAALA,KAVS;AAWTJ,IAAAA,WAAW,EAAXA;AAXS,IAAb;;AAcA,SAAO;AACHoD,IAAAA,MAAM,EAANA,MADG;AAEHE,IAAAA,OAAO,EAAPA,OAFG;AAGH1C,IAAAA,OAAO,eACAA,OADA;AAEH2C,MAAAA,SAAS,EAAE;AACPC,QAAAA,QAAQ,EAAE,CAAC,CADJ;AAEP,sBAAc/D,SAFP;AAGP,2BAAmBC;AAHZ;AAFR,MAHJ;AAWH2C,IAAAA,IAAI,EAAJA,IAXG;AAYHC,IAAAA,IAAI,EAAJA;AAZG,GAAP;AAcH;;;;"}
1
+ {"version":3,"file":"useSelect.js","sources":["../../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport cn from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport { useLocalization } from '../Provider/Provider';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: React.ButtonHTMLAttributes<HTMLButtonElement>;\n listbox: ListboxProps;\n input: any;\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onClick,\n onChange,\n readOnly,\n value = emptyValue,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const searchData = useFlattenedData(data);\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const internalInputRef = React.useRef(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (defaultValue !== undefined && value === undefined) {\n setInputValueByRef(internalInputRef.current, defaultValue);\n }\n }, [defaultValue]);\n\n React.useEffect(() => {\n if (value !== undefined) {\n setInputValueByRef(internalInputRef.current, value);\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.keyCode) {\n case keycode('escape'): {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(inputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case keycode('tab'):\n case keycode('enter'): {\n if (event.keyCode !== keycode('tab')) {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === searchData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(searchData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(searchData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(searchData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(searchData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const button: React.ButtonHTMLAttributes<HTMLButtonElement> = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled,\n id: buttonId,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n type: 'button',\n };\n\n const listbox = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(internalInputRef.current, event.detail.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: inputRef,\n value,\n multiselect,\n };\n\n const input = {\n onChange: handleInputChange,\n ref: internalInputRef,\n value: value ?? '',\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: setOpen,\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ref","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","nativeId","id","multiselect","onChange","readOnly","value","otherProps","useLocalization","texts","searchData","useFlattenedData","inputRef","useProxiedRef","React","open","setOpen","uuid","internalInputRef","buttonId","lastValue","setLastValue","undefined","setInputValueByRef","current","handleButtonKeyDown","event","keyCode","keycode","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","text","more","selectedValues","toString","split","length","filter","item","select","allOptionsSelected","findByValue","icon","className","cn","props","handleInputChange","persist","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","onClick","input","popover","onOpenChange"],"mappings":";;;;;;;;;;IAoBaA,SAAS,GAAG,SAAZA,SAAY,OAgBrBC,GAhBqB;MAEHC,iBAAd;MACmBC,sBAAnB;uBACAC;MAAAA,8BAAO;MACPC,oBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACIC,gBAAJC;MACAC,mBAAAA;MAEAC,gBAAAA;MACAC,gBAAAA;wBACAC;MAAAA,gCAAQN;MACLO;;AAIP,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AACA,MAAMC,UAAU,GAAGC,gBAAgB,CAACd,IAAD,CAAnC;AACA,MAAMe,QAAQ,GAAGC,aAAa,CAAmBnB,GAAnB,CAA9B;;AACA,wBAAwBoB,QAAA,CAAe,KAAf,CAAxB;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACA,MAAMd,EAAE,GAAGY,OAAA,CAAc;AAAA,WAAMb,QAAQ,gBA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,WAAW,EAAXA;AAdS,IAAb;;AAiBA,MAAM+D,KAAK,GAAG;AACV9D,IAAAA,QAAQ,EAAE4C,iBADA;AAEVtD,IAAAA,GAAG,EAAEwB,gBAFK;AAGVZ,IAAAA,KAAK,EAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW;AAHN,GAAd;AAMA,SAAO;AACHwD,IAAAA,MAAM,EAANA,MADG;AAEHE,IAAAA,OAAO,EAAPA,OAFG;AAGHE,IAAAA,KAAK,EAALA,KAHG;AAIHC,IAAAA,OAAO,EAAE;AACLpD,MAAAA,IAAI,EAAJA,IADK;AAELqD,MAAAA,YAAY,EAAEpD;AAFT,KAJN;AAQHiB,IAAAA,IAAI,EAAJA,IARG;AASHC,IAAAA,IAAI,EAAJA;AATG,GAAP;AAWH;;;;"}
package/dist/index.css CHANGED
@@ -357,20 +357,11 @@
357
357
  @apply font-semibold;
358
358
  }
359
359
 
360
- [data-taco='scrollable-list'][disabled] {
361
- @apply pointer-events-none;
362
- }
363
-
364
- [data-taco='scrollable-list'][disabled],
365
- [data-taco='scrollable-list'][readonly] {
366
- @apply cursor-not-allowed;
367
- }
368
-
369
360
  [data-taco='scrollable-list'].yt-list--multiselect li:first-child {
370
- @apply pl-4 border-b-2 border-grey-light; /* Listbox max-height is dependant on this border-bottom-width value! */
361
+ @apply border-grey-light border-b-2 pl-4; /* Listbox max-height is dependant on this border-bottom-width value! */
371
362
  }
372
363
 
373
- [data-taco='scrollable-list'] li [data-taco='icon'] {
364
+ [data-taco='scrollable-list'] li > [data-taco='icon'] {
374
365
  @apply mr-2;
375
366
  }
376
367
 
@@ -406,29 +397,19 @@
406
397
  [data-taco='scrollable-list'] li.yt-list__empty,
407
398
  [data-taco='scrollable-list'] li.yt-list__empty:hover,
408
399
  [data-taco='scrollable-list'] li.yt-list__empty:focus {
409
- @apply bg-white text-grey-darkest italic overflow-hidden;
400
+ @apply text-grey-darkest overflow-hidden bg-white italic;
410
401
  }
411
402
 
412
403
  [data-taco='scrollable-list'] li.yt-list__empty [data-taco='spinner'] {
413
404
  @apply mr-2 mt-2 h-5 w-5 opacity-75;
414
405
  }
415
406
 
416
- .yt-combobox.yt-combobox--inline .yt-input__container > .yt-button {
417
- @apply yt-transparent text-grey-darkest border-0 shadow-none;
418
- }
419
-
420
- .yt-combobox.yt-combobox--inline .yt-input__container > .yt-button:hover,
421
- .yt-combobox.yt-combobox--inline .yt-input__container > .yt-button:active,
422
- .yt-combobox.yt-combobox--inline .yt-input__container > .yt-button:focus {
423
- @apply yt-transparent text-black;
424
- }
425
-
426
- .yt-combobox [role='dialog'] {
407
+ [data-taco='combobox'] [role='dialog'] {
427
408
  @apply z-50;
428
409
  }
429
410
 
430
- .yt-combobox > [aria-expanded='true'] + [role='dialog'] > ul,
431
- .yt-combobox > [aria-expanded='true'] + [role='dialog'] > ul:hover {
411
+ [data-taco='combobox'] > [aria-expanded='true'] + [role='dialog'] > ul,
412
+ [data-taco='combobox'] > [aria-expanded='true'] + [role='dialog'] > ul:hover {
432
413
  @apply border-blue;
433
414
  }
434
415
 
@@ -453,22 +434,6 @@
453
434
  min-height: 0;
454
435
  }
455
436
 
456
- .yt-listbox {
457
- @apply relative inline-flex w-full bg-white;
458
- }
459
-
460
- .yt-listbox > input {
461
- display: none;
462
- }
463
-
464
- .yt-listbox [data-taco='scrollable-list'] {
465
- max-height: calc(12rem + 2px); /* (6 * option height) + listbox border */
466
- }
467
-
468
- .yt-listbox [data-taco='scrollable-list'].yt-list--multiselect {
469
- max-height: calc(12rem + 2px + 2px); /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
470
- }
471
-
472
437
  .yt-navigation__item a,
473
438
  .yt-navigation__item .yt-navigation__item__postfix {
474
439
  @apply text-black;
@@ -508,43 +473,6 @@
508
473
  @apply border-white text-white;
509
474
  }
510
475
 
511
- [data-taco='select'] > button.yt-input {
512
- @apply relative inline-flex w-full items-center px-0;
513
- }
514
-
515
- [data-taco='select'] > button.yt-input > span:first-child {
516
- @apply flex-grow truncate pl-2 text-left;
517
- }
518
-
519
- [data-taco='select'] > button.yt-input .yt-icon {
520
- @apply pointer-events-none;
521
- }
522
-
523
- [data-taco='select'] > button.yt-input[disabled] .yt-icon {
524
- @apply text-grey-dark;
525
- }
526
-
527
- [data-taco='select'][data-taco='select']--readonly > button.yt-input {
528
- @apply cursor-not-allowed;
529
- }
530
-
531
- [data-taco='select'] > button.yt-input[aria-expanded='true'],
532
- [data-taco='select'] > button.yt-input[aria-expanded='true']:hover {
533
- @apply border-blue;
534
- }
535
-
536
- [data-taco='select'] > button.yt-input[aria-expanded='true'] + .yt-listbox {
537
- @apply mt-1 flex;
538
- }
539
-
540
- [data-taco='select'] [role='dialog'] {
541
- @apply z-50;
542
- }
543
-
544
- [data-taco='select'] .yt-list {
545
- max-width: theme('spacing.96');
546
- }
547
-
548
476
  .yt-toast:hover [data-taco='progress-bar'] {
549
477
  animation-play-state: paused;
550
478
  }