@economic/taco 0.0.32-alpha.0 → 0.0.33-alpha.4
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.
- package/dist/components/Select/useSelect.d.ts +13 -8
- package/dist/esm/components/Button/util.js +1 -1
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/Group/Group.js +6 -8
- package/dist/esm/components/Group/Group.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +25 -33
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js +7 -8
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js +9 -11
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Input/Input.js +26 -24
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Listbox/Listbox.js +24 -25
- package/dist/esm/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/components/Listbox/useListbox.js +1 -1
- package/dist/esm/components/Listbox/useListbox.js.map +1 -1
- package/dist/esm/components/Listbox/util.js +4 -7
- package/dist/esm/components/Listbox/util.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +10 -11
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/useSelect.js +48 -32
- package/dist/esm/components/Select/useSelect.js.map +1 -1
- package/dist/esm/index.css +3 -3
- package/dist/index.css +3 -3
- package/dist/taco.cjs.development.js +159 -154
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/tailwind.d.ts +1 -1
- package/package.json +2 -2
@@ -3122,17 +3122,17 @@ const icons = {
|
|
3122
3122
|
zoom: Zoom
|
3123
3123
|
};
|
3124
3124
|
|
3125
|
-
|
3126
|
-
var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
3125
|
+
const Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
3127
3126
|
var _props$className;
|
3128
3127
|
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3128
|
+
const {
|
3129
|
+
name,
|
3130
|
+
...otherProps
|
3131
|
+
} = props;
|
3132
|
+
const Component = icons[name];
|
3133
3133
|
/* 24x24 _at the base body font_ - must be em so that they scale with font size - tailwind spacing uses rem */
|
3134
3134
|
|
3135
|
-
|
3135
|
+
const className = cn('inline-flex h-[1.715em] w-[1.715em]', props.className, {
|
3136
3136
|
'p-[3px]': (_props$className = props.className) === null || _props$className === void 0 ? void 0 : _props$className.includes('rounded-full')
|
3137
3137
|
});
|
3138
3138
|
return Component ? React__default.createElement(Component, Object.assign({}, otherProps, {
|
@@ -3144,7 +3144,7 @@ var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
|
3144
3144
|
})) : null;
|
3145
3145
|
});
|
3146
3146
|
|
3147
|
-
var _excluded
|
3147
|
+
var _excluded = ["id"],
|
3148
3148
|
_excluded2 = ["id", "defaultId", "onChange", "as"];
|
3149
3149
|
var AccordionContext = /*#__PURE__*/React__default.createContext({
|
3150
3150
|
as: 'h2'
|
@@ -3182,7 +3182,7 @@ var Content = /*#__PURE__*/React__default.forwardRef(function AccordionContent(p
|
|
3182
3182
|
|
3183
3183
|
var Item = function Item(props) {
|
3184
3184
|
var id = props.id,
|
3185
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded
|
3185
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
3186
3186
|
|
3187
3187
|
return React__default.createElement(AccordionPrimitive.Item, Object.assign({}, otherProps, {
|
3188
3188
|
value: id
|
@@ -3283,7 +3283,7 @@ const getOutlineClasses = state => {
|
|
3283
3283
|
}
|
3284
3284
|
};
|
3285
3285
|
|
3286
|
-
var _excluded$
|
3286
|
+
var _excluded$1 = ["children", "compact", "outline", "state"];
|
3287
3287
|
var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
3288
3288
|
var _cn;
|
3289
3289
|
|
@@ -3293,7 +3293,7 @@ var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
|
3293
3293
|
_props$outline = props.outline,
|
3294
3294
|
outline = _props$outline === void 0 ? false : _props$outline,
|
3295
3295
|
state = props.state,
|
3296
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3296
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
3297
3297
|
|
3298
3298
|
var className = cn('rounded-full border font-bold text-xs uppercase overflow-hidden whitespace-nowrap inline-flex items-center justify-center h-5', (_cn = {}, _cn[getOutlineClasses(state)] = outline, _cn["border-transparent " + getStateClasses(state)] = !outline, _cn['h-2 w-2 min-w-0'] = compact, _cn['h-5 py-0 px-[0.354rem]'] = !compact, _cn), props.className);
|
3299
3299
|
return React.createElement("span", Object.assign({}, otherProps, {
|
@@ -3383,7 +3383,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
|
3383
3383
|
});
|
3384
3384
|
|
3385
3385
|
const getButtonClasses = () => {
|
3386
|
-
return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] h-max inline-flex items-center justify-center border';
|
3386
|
+
return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max inline-flex items-center justify-center border';
|
3387
3387
|
};
|
3388
3388
|
const getAppearanceClasses = (value, icon = false) => {
|
3389
3389
|
switch (value) {
|
@@ -3453,14 +3453,13 @@ const createButton = (props, className, ref) => {
|
|
3453
3453
|
return button;
|
3454
3454
|
};
|
3455
3455
|
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3463
|
-
var className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
|
3456
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
3457
|
+
const {
|
3458
|
+
icon,
|
3459
|
+
rounded = false,
|
3460
|
+
...otherProps
|
3461
|
+
} = props;
|
3462
|
+
const className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
|
3464
3463
|
'rounded-full': rounded,
|
3465
3464
|
rounded: !rounded,
|
3466
3465
|
'cursor-not-allowed opacity-50': props.disabled,
|
@@ -3471,13 +3470,13 @@ var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
|
3471
3470
|
return null;
|
3472
3471
|
}
|
3473
3472
|
|
3474
|
-
return createButton(
|
3473
|
+
return createButton({ ...otherProps,
|
3475
3474
|
children: React.createElement(Icon, {
|
3476
3475
|
name: icon,
|
3477
3476
|
className: "m-0 p-0"
|
3478
3477
|
}),
|
3479
3478
|
'data-taco': 'icon-button'
|
3480
|
-
}
|
3479
|
+
}, className, ref);
|
3481
3480
|
});
|
3482
3481
|
|
3483
3482
|
var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
@@ -3497,10 +3496,10 @@ var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
|
3497
3496
|
}) : null);
|
3498
3497
|
});
|
3499
3498
|
|
3500
|
-
var _excluded$
|
3499
|
+
var _excluded$2 = ["fluid"];
|
3501
3500
|
var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3502
3501
|
var fluid = props.fluid,
|
3503
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3502
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
3504
3503
|
|
3505
3504
|
var className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
|
3506
3505
|
'cursor-not-allowed opacity-50': props.disabled,
|
@@ -3978,7 +3977,7 @@ const Provider = props => {
|
|
3978
3977
|
const useTaco = () => React.useContext(Context);
|
3979
3978
|
const useLocalization = () => useTaco().localization;
|
3980
3979
|
|
3981
|
-
var _excluded$
|
3980
|
+
var _excluded$3 = ["onChange", "value"];
|
3982
3981
|
|
3983
3982
|
var renderDay = function renderDay(day, modifiers) {
|
3984
3983
|
return modifiers.disabled ? React.createElement("span", {
|
@@ -4057,7 +4056,7 @@ var Navbar = /*#__PURE__*/React.memo(function (_ref) {
|
|
4057
4056
|
var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4058
4057
|
var handleChange = props.onChange,
|
4059
4058
|
value = props.value,
|
4060
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
4059
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
|
4061
4060
|
|
4062
4061
|
var _useLocalization2 = useLocalization(),
|
4063
4062
|
locale = _useLocalization2.locale,
|
@@ -4121,7 +4120,7 @@ var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4121
4120
|
})));
|
4122
4121
|
});
|
4123
4122
|
|
4124
|
-
var _excluded$
|
4123
|
+
var _excluded$4 = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
|
4125
4124
|
var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
4126
4125
|
var checked = props.checked,
|
4127
4126
|
highlighted = props.highlighted,
|
@@ -4129,7 +4128,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4129
4128
|
invalid = props.invalid,
|
4130
4129
|
label = props.label,
|
4131
4130
|
onChange = props.onChange,
|
4132
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
4131
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
|
4133
4132
|
|
4134
4133
|
var className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem]', {
|
4135
4134
|
'mr-2': !!label,
|
@@ -4203,21 +4202,22 @@ const getButtonStateClasses = invalid => {
|
|
4203
4202
|
return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4204
4203
|
};
|
4205
4204
|
|
4206
|
-
|
4207
|
-
|
4208
|
-
|
4209
|
-
|
4210
|
-
|
4211
|
-
|
4212
|
-
|
4213
|
-
|
4214
|
-
|
4215
|
-
|
4216
|
-
|
4217
|
-
|
4205
|
+
const Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
4206
|
+
const {
|
4207
|
+
button,
|
4208
|
+
icon,
|
4209
|
+
highlighted,
|
4210
|
+
invalid,
|
4211
|
+
onKeyDown,
|
4212
|
+
autoFocus,
|
4213
|
+
...otherProps
|
4214
|
+
} = props;
|
4215
|
+
const inputRef = useProxiedRef(ref);
|
4216
|
+
const hasContainer = button || icon;
|
4217
|
+
const className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
4218
4218
|
'pr-8': !!hasContainer
|
4219
4219
|
}, !hasContainer && otherProps.className);
|
4220
|
-
React.useEffect(
|
4220
|
+
React.useEffect(() => {
|
4221
4221
|
if (autoFocus && inputRef.current) {
|
4222
4222
|
inputRef.current.focus();
|
4223
4223
|
}
|
@@ -4225,10 +4225,10 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4225
4225
|
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
4226
4226
|
// so we manually override it to ensure _our_ desired behaviour remains intact
|
4227
4227
|
|
4228
|
-
|
4228
|
+
const handleKeyDown = event => {
|
4229
4229
|
if (event.key === 'Home' || event.key === 'End') {
|
4230
4230
|
event.preventDefault();
|
4231
|
-
|
4231
|
+
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
4232
4232
|
event.currentTarget.setSelectionRange(position, position);
|
4233
4233
|
}
|
4234
4234
|
|
@@ -4237,7 +4237,7 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4237
4237
|
}
|
4238
4238
|
};
|
4239
4239
|
|
4240
|
-
|
4240
|
+
const input = React.createElement("input", Object.assign({}, otherProps, {
|
4241
4241
|
className: className,
|
4242
4242
|
"data-taco": "input",
|
4243
4243
|
onKeyDown: handleKeyDown,
|
@@ -4245,19 +4245,21 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4245
4245
|
}));
|
4246
4246
|
|
4247
4247
|
if (hasContainer) {
|
4248
|
-
|
4248
|
+
let extra;
|
4249
4249
|
|
4250
4250
|
if (button) {
|
4251
|
-
var _button$props$disable
|
4251
|
+
var _button$props$disable;
|
4252
4252
|
|
4253
|
-
|
4254
|
-
|
4253
|
+
const disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
|
4254
|
+
const buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', {
|
4255
|
+
[getButtonStateClasses(invalid)]: !props.disabled
|
4256
|
+
}, button.props.className);
|
4255
4257
|
extra = React.cloneElement(button, {
|
4256
4258
|
className: buttonClassName,
|
4257
|
-
disabled
|
4259
|
+
disabled
|
4258
4260
|
});
|
4259
4261
|
} else if (icon) {
|
4260
|
-
|
4262
|
+
const iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
|
4261
4263
|
'text-grey-dark': props.disabled,
|
4262
4264
|
'text-grey-darkest': !props.disabled
|
4263
4265
|
});
|
@@ -4269,7 +4271,7 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4269
4271
|
});
|
4270
4272
|
}
|
4271
4273
|
|
4272
|
-
|
4274
|
+
const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
|
4273
4275
|
return React.createElement("div", {
|
4274
4276
|
className: containerClassName,
|
4275
4277
|
"data-taco": "input-container"
|
@@ -4577,12 +4579,11 @@ const setInputValueByRef = (input, value, event = 'change') => {
|
|
4577
4579
|
input.dispatchEvent(createCustomEvent(event));
|
4578
4580
|
};
|
4579
4581
|
|
4582
|
+
const getValue = value => String(value !== null && value !== void 0 ? value : '');
|
4583
|
+
|
4580
4584
|
const setInputValueByRef$1 = (input, value, event = 'change') => {
|
4581
|
-
setInputValueByRef(input,
|
4585
|
+
setInputValueByRef(input, getValue(value), event);
|
4582
4586
|
};
|
4583
|
-
|
4584
|
-
const getValue = value => value === undefined || value === null ? '' : String(value);
|
4585
|
-
|
4586
4587
|
const getIndexFromValue = (data, value) => {
|
4587
4588
|
const index = data.findIndex(option => getValue(option.value) === getValue(value));
|
4588
4589
|
return index > -1 ? index : undefined;
|
@@ -4607,9 +4608,7 @@ const searchForString = (child, value, strategy = 'includes') => {
|
|
4607
4608
|
|
4608
4609
|
return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
|
4609
4610
|
} else {
|
4610
|
-
|
4611
|
-
|
4612
|
-
return child.toString().toLowerCase()[strategy]((_String = String(value)) === null || _String === void 0 ? void 0 : _String.toLowerCase());
|
4611
|
+
return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
|
4613
4612
|
}
|
4614
4613
|
} catch {
|
4615
4614
|
return false;
|
@@ -5043,12 +5042,12 @@ var useBoundingClientRectListener = function useBoundingClientRectListener(ref)
|
|
5043
5042
|
return dimensions;
|
5044
5043
|
};
|
5045
5044
|
|
5046
|
-
var _excluded$
|
5045
|
+
var _excluded$5 = ["className", "dialog", "style"];
|
5047
5046
|
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5048
5047
|
var externalClassName = props.className,
|
5049
5048
|
dialog = props.dialog,
|
5050
5049
|
style = props.style,
|
5051
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5050
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
|
5052
5051
|
|
5053
5052
|
var _useCombobox = useCombobox(otherProps, ref),
|
5054
5053
|
combobox = _useCombobox.combobox,
|
@@ -5416,7 +5415,7 @@ Popover.Trigger = Trigger$1;
|
|
5416
5415
|
Popover.Content = Content$1;
|
5417
5416
|
Popover.Close = Close$1;
|
5418
5417
|
|
5419
|
-
var _excluded$
|
5418
|
+
var _excluded$6 = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
|
5420
5419
|
var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
5421
5420
|
var _input$disabled;
|
5422
5421
|
|
@@ -5425,7 +5424,7 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
|
5425
5424
|
style = props.style,
|
5426
5425
|
shortcuts = props.shortcuts,
|
5427
5426
|
shortcutsText = props.shortcutsText,
|
5428
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5427
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
|
5429
5428
|
|
5430
5429
|
var _useDatepicker = useDatepicker(otherProps, ref),
|
5431
5430
|
calendar = _useDatepicker.calendar,
|
@@ -5720,7 +5719,7 @@ const Extra = /*#__PURE__*/React.forwardRef(function DialogExtra(props, ref) {
|
|
5720
5719
|
});
|
5721
5720
|
Extra.displayName = 'DialogExtra';
|
5722
5721
|
|
5723
|
-
var _excluded$
|
5722
|
+
var _excluded$7 = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
|
5724
5723
|
|
5725
5724
|
var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
5726
5725
|
return React.useMemo(function () {
|
@@ -5757,7 +5756,7 @@ var Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
|
|
5757
5756
|
_props$size = props.size,
|
5758
5757
|
size = _props$size === void 0 ? 'sm' : _props$size,
|
5759
5758
|
trigger = props.trigger,
|
5760
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5759
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$7);
|
5761
5760
|
|
5762
5761
|
var _useSeparatedChildren = useSeparatedChildren(initialChildren),
|
5763
5762
|
children = _useSeparatedChildren[0],
|
@@ -5807,14 +5806,14 @@ Dialog.Extra = Extra;
|
|
5807
5806
|
Dialog.Drawer = Drawer;
|
5808
5807
|
Dialog.Close = Close$2;
|
5809
5808
|
|
5810
|
-
var _excluded$
|
5809
|
+
var _excluded$8 = ["disabled", "children", "invalid", "message"];
|
5811
5810
|
var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
5812
5811
|
var disabled = props.disabled,
|
5813
5812
|
children = props.children,
|
5814
5813
|
_props$invalid = props.invalid,
|
5815
5814
|
invalid = _props$invalid === void 0 ? false : _props$invalid,
|
5816
5815
|
message = props.message,
|
5817
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5816
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$8);
|
5818
5817
|
|
5819
5818
|
var className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5820
5819
|
'text-grey-dark': disabled
|
@@ -5834,13 +5833,12 @@ var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
|
5834
5833
|
}, message));
|
5835
5834
|
});
|
5836
5835
|
|
5837
|
-
|
5838
|
-
|
5839
|
-
|
5840
|
-
|
5841
|
-
|
5842
|
-
|
5843
|
-
var className = cn('yt-form', {
|
5836
|
+
const Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
5837
|
+
const {
|
5838
|
+
horizontal = false,
|
5839
|
+
...otherProps
|
5840
|
+
} = props;
|
5841
|
+
const className = cn('yt-form', {
|
5844
5842
|
'yt-form--horizontal flex flex-wrap': horizontal
|
5845
5843
|
}, props.className);
|
5846
5844
|
return React.createElement("form", Object.assign({}, otherProps, {
|
@@ -5850,13 +5848,12 @@ var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
|
5850
5848
|
}));
|
5851
5849
|
});
|
5852
5850
|
|
5853
|
-
|
5854
|
-
|
5855
|
-
|
5856
|
-
|
5857
|
-
|
5858
|
-
|
5859
|
-
var className = cn('flex ', props.className);
|
5851
|
+
const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
5852
|
+
const {
|
5853
|
+
as: Tag = 'span',
|
5854
|
+
...otherProps
|
5855
|
+
} = props;
|
5856
|
+
const className = cn('flex ', props.className);
|
5860
5857
|
return React.createElement(Tag, Object.assign({}, otherProps, {
|
5861
5858
|
className: className,
|
5862
5859
|
"data-taco": "group",
|
@@ -5864,19 +5861,18 @@ var Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
5864
5861
|
}));
|
5865
5862
|
});
|
5866
5863
|
|
5867
|
-
|
5868
|
-
var HangerContext = /*#__PURE__*/React.createContext({
|
5864
|
+
const HangerContext = /*#__PURE__*/React.createContext({
|
5869
5865
|
props: {},
|
5870
5866
|
ref: null
|
5871
5867
|
});
|
5872
|
-
|
5868
|
+
const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
|
5873
5869
|
var _props$children;
|
5874
5870
|
|
5875
|
-
|
5876
|
-
|
5871
|
+
const context = React.useContext(HangerContext);
|
5872
|
+
let children = props.children;
|
5877
5873
|
|
5878
5874
|
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
5879
|
-
console.warn(
|
5875
|
+
console.warn(`Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`);
|
5880
5876
|
children = React.createElement("span", null, props.children);
|
5881
5877
|
}
|
5882
5878
|
|
@@ -5886,15 +5882,14 @@ var Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
|
|
5886
5882
|
asChild: true
|
5887
5883
|
}));
|
5888
5884
|
});
|
5889
|
-
|
5890
|
-
|
5891
|
-
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
var className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
|
5885
|
+
const Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
5886
|
+
const context = React.useContext(HangerContext);
|
5887
|
+
const {
|
5888
|
+
texts
|
5889
|
+
} = useLocalization();
|
5890
|
+
const className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
|
5896
5891
|
|
5897
|
-
|
5892
|
+
const handleInteractOutside = event => {
|
5898
5893
|
event.preventDefault();
|
5899
5894
|
};
|
5900
5895
|
|
@@ -5916,25 +5911,20 @@ var Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref)
|
|
5916
5911
|
onClick: context.props.onClose
|
5917
5912
|
})));
|
5918
5913
|
});
|
5919
|
-
|
5920
|
-
|
5921
|
-
|
5922
|
-
|
5923
|
-
|
5924
|
-
|
5925
|
-
|
5926
|
-
|
5927
|
-
|
5928
|
-
|
5929
|
-
|
5930
|
-
};
|
5931
|
-
}, [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
5932
|
-
|
5933
|
-
var _React$useState = React.useState(false),
|
5934
|
-
open = _React$useState[0],
|
5935
|
-
setOpen = _React$useState[1];
|
5914
|
+
const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
5915
|
+
const {
|
5916
|
+
anchor,
|
5917
|
+
children,
|
5918
|
+
defaultOpen = true,
|
5919
|
+
...otherProps
|
5920
|
+
} = props;
|
5921
|
+
const context = React.useMemo(() => ({
|
5922
|
+
props: otherProps,
|
5923
|
+
ref
|
5924
|
+
}), [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
5936
5925
|
|
5937
|
-
React.
|
5926
|
+
const [open, setOpen] = React.useState(false);
|
5927
|
+
React.useEffect(() => {
|
5938
5928
|
if (defaultOpen) {
|
5939
5929
|
setOpen(defaultOpen);
|
5940
5930
|
}
|
@@ -6100,7 +6090,7 @@ const useListbox = ({
|
|
6100
6090
|
onChange: handleInputChange,
|
6101
6091
|
ref: inputRef,
|
6102
6092
|
tabIndex: -1,
|
6103
|
-
value: value
|
6093
|
+
value: value !== null && value !== void 0 ? value : ''
|
6104
6094
|
};
|
6105
6095
|
return {
|
6106
6096
|
list,
|
@@ -7105,20 +7095,21 @@ const useSelect = ({
|
|
7105
7095
|
emptyValue,
|
7106
7096
|
id: nativeId,
|
7107
7097
|
multiselect,
|
7098
|
+
onBlur,
|
7108
7099
|
onClick,
|
7109
7100
|
onChange,
|
7110
7101
|
readOnly,
|
7111
|
-
value
|
7102
|
+
value,
|
7112
7103
|
...otherProps
|
7113
7104
|
}, ref) => {
|
7114
7105
|
const {
|
7115
7106
|
texts
|
7116
7107
|
} = useLocalization();
|
7117
|
-
const
|
7118
|
-
const
|
7108
|
+
const flattenedData = useFlattenedData(data);
|
7109
|
+
const listboxInputRef = useProxiedRef(ref);
|
7119
7110
|
const [open, setOpen] = React.useState(false);
|
7120
7111
|
const id = React.useMemo(() => nativeId || `select_${uuid.v4()}`, [nativeId]);
|
7121
|
-
const
|
7112
|
+
const inputRef = React.useRef(null);
|
7122
7113
|
const buttonId = `${id}-button`; // support 'escape' resetting to the value that was set when the listbox opened
|
7123
7114
|
|
7124
7115
|
const [lastValue, setLastValue] = React.useState(value);
|
@@ -7126,18 +7117,24 @@ const useSelect = ({
|
|
7126
7117
|
setLastValue(value);
|
7127
7118
|
}, [open]);
|
7128
7119
|
React.useEffect(() => {
|
7129
|
-
if (
|
7130
|
-
|
7131
|
-
|
7132
|
-
|
7133
|
-
|
7134
|
-
|
7135
|
-
|
7136
|
-
|
7137
|
-
|
7138
|
-
|
7139
|
-
} else
|
7140
|
-
|
7120
|
+
if (value === undefined) {
|
7121
|
+
if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
|
7122
|
+
setInputValueByRef$1(inputRef.current, defaultValue);
|
7123
|
+
} else {
|
7124
|
+
if (emptyValue !== undefined) {
|
7125
|
+
setInputValueByRef$1(inputRef.current, emptyValue);
|
7126
|
+
} else if (data.length > 0) {
|
7127
|
+
setInputValueByRef$1(inputRef.current, data[0].value);
|
7128
|
+
}
|
7129
|
+
}
|
7130
|
+
} else {
|
7131
|
+
if (!findByValue(flattenedData, value)) {
|
7132
|
+
if (emptyValue !== undefined) {
|
7133
|
+
setInputValueByRef$1(inputRef.current, emptyValue);
|
7134
|
+
} else if (data.length > 0) {
|
7135
|
+
setInputValueByRef$1(inputRef.current, data[0].value);
|
7136
|
+
}
|
7137
|
+
}
|
7141
7138
|
}
|
7142
7139
|
}, []); // event handlers
|
7143
7140
|
|
@@ -7155,7 +7152,7 @@ const useSelect = ({
|
|
7155
7152
|
event.preventDefault();
|
7156
7153
|
|
7157
7154
|
if (lastValue !== undefined) {
|
7158
|
-
setInputValueByRef$1(
|
7155
|
+
setInputValueByRef$1(listboxInputRef.current, lastValue);
|
7159
7156
|
}
|
7160
7157
|
|
7161
7158
|
setOpen(false);
|
@@ -7184,6 +7181,10 @@ const useSelect = ({
|
|
7184
7181
|
|
7185
7182
|
if (!multiselect) {
|
7186
7183
|
setOpen(false);
|
7184
|
+
|
7185
|
+
if (onBlur) {
|
7186
|
+
onBlur(createCustomEvent('blur'));
|
7187
|
+
}
|
7187
7188
|
}
|
7188
7189
|
};
|
7189
7190
|
|
@@ -7194,16 +7195,16 @@ const useSelect = ({
|
|
7194
7195
|
if (multiselect) {
|
7195
7196
|
const selectedValues = (value === null || value === void 0 ? void 0 : value.toString().split(',')) || [];
|
7196
7197
|
|
7197
|
-
if (selectedValues.length ===
|
7198
|
+
if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {
|
7198
7199
|
text = texts.select.allOptionsSelected;
|
7199
7200
|
} else {
|
7200
7201
|
var _findByValue$text, _findByValue;
|
7201
7202
|
|
7202
|
-
text = (_findByValue$text = (_findByValue = findByValue(
|
7203
|
+
text = (_findByValue$text = (_findByValue = findByValue(flattenedData, selectedValues[0])) === null || _findByValue === void 0 ? void 0 : _findByValue.text) !== null && _findByValue$text !== void 0 ? _findByValue$text : '';
|
7203
7204
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
7204
7205
|
}
|
7205
7206
|
} else {
|
7206
|
-
const item = findByValue(
|
7207
|
+
const item = findByValue(flattenedData, value);
|
7207
7208
|
|
7208
7209
|
if (item) {
|
7209
7210
|
text = item.icon ? React.createElement(React.Fragment, null, React.cloneElement(item.icon, {
|
@@ -7219,7 +7220,7 @@ const useSelect = ({
|
|
7219
7220
|
if (onChange) {
|
7220
7221
|
var _item$path$split, _item$path;
|
7221
7222
|
|
7222
|
-
const item = findByValue(
|
7223
|
+
const item = findByValue(flattenedData, event.target.value);
|
7223
7224
|
event.detail = sanitizeItem(item);
|
7224
7225
|
const 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 : [];
|
7225
7226
|
|
@@ -7230,7 +7231,7 @@ const useSelect = ({
|
|
7230
7231
|
let lastPath;
|
7231
7232
|
event.detail.parents = indexes.map(i => {
|
7232
7233
|
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
7233
|
-
return sanitizeItem(
|
7234
|
+
return sanitizeItem(flattenedData.find(i => i.path === lastPath));
|
7234
7235
|
});
|
7235
7236
|
}
|
7236
7237
|
|
@@ -7253,21 +7254,19 @@ const useSelect = ({
|
|
7253
7254
|
data,
|
7254
7255
|
disabled,
|
7255
7256
|
emptyValue,
|
7257
|
+
onBlur,
|
7256
7258
|
onClick: handleListboxClick,
|
7257
7259
|
onChange: event => {
|
7258
|
-
|
7259
|
-
|
7260
|
-
setInputValueByRef$1(internalInputRef.current, (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
|
7260
|
+
setInputValueByRef$1(inputRef.current, event.target.value);
|
7261
7261
|
},
|
7262
7262
|
onKeyDown: handleListboxKeyDown,
|
7263
|
-
ref:
|
7264
|
-
value
|
7265
|
-
multiselect
|
7263
|
+
ref: listboxInputRef,
|
7264
|
+
value
|
7266
7265
|
};
|
7267
7266
|
const input = {
|
7268
7267
|
onChange: handleInputChange,
|
7269
|
-
ref:
|
7270
|
-
value: value !== null && value !== void 0 ? value : ''
|
7268
|
+
ref: inputRef,
|
7269
|
+
value: String(value !== null && value !== void 0 ? value : '')
|
7271
7270
|
};
|
7272
7271
|
return {
|
7273
7272
|
button,
|
@@ -7275,7 +7274,13 @@ const useSelect = ({
|
|
7275
7274
|
input,
|
7276
7275
|
popover: {
|
7277
7276
|
open,
|
7278
|
-
onOpenChange:
|
7277
|
+
onOpenChange: open => {
|
7278
|
+
if (!open && onBlur) {
|
7279
|
+
onBlur(createCustomEvent('blur'));
|
7280
|
+
}
|
7281
|
+
|
7282
|
+
setOpen(open);
|
7283
|
+
}
|
7279
7284
|
},
|
7280
7285
|
text,
|
7281
7286
|
more
|
@@ -9424,22 +9429,22 @@ var useOnClickOutside = function useOnClickOutside(ref, callback) {
|
|
9424
9429
|
}, [ref, callback]);
|
9425
9430
|
};
|
9426
9431
|
|
9427
|
-
|
9428
|
-
|
9429
|
-
|
9430
|
-
|
9431
|
-
|
9432
|
-
|
9433
|
-
|
9432
|
+
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
9433
|
+
onSearch,
|
9434
|
+
...props
|
9435
|
+
}, ref) {
|
9436
|
+
const {
|
9437
|
+
texts
|
9438
|
+
} = useLocalization();
|
9434
9439
|
|
9435
|
-
|
9440
|
+
const handleClick = () => {
|
9436
9441
|
if (!props.disabled) {
|
9437
9442
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(props.value);
|
9438
9443
|
}
|
9439
9444
|
};
|
9440
9445
|
|
9441
|
-
|
9442
|
-
|
9446
|
+
const handleKeyDown = event => {
|
9447
|
+
const isEnterKeyPressed = event.keyCode === keycode('enter');
|
9443
9448
|
|
9444
9449
|
if (isEnterKeyPressed) {
|
9445
9450
|
handleClick();
|