@economic/taco 0.0.1-alpha.1533 → 0.0.1-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Backdrop/Backdrop.d.ts +3 -0
- package/dist/components/Button/Button.d.ts +39 -1
- package/dist/components/Button/util.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Dialog/Context.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts +14 -12
- package/dist/components/Hanger/Hanger.d.ts +4 -9
- package/dist/components/Icon/components/MatchEntries.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/IconButton/IconButton.d.ts +38 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +2 -2
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Navigation/Navigation.d.ts +4 -4
- package/dist/components/Popover/Popover.d.ts +5 -9
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +4 -0
- package/dist/components/Select/useSelect.d.ts +1 -1
- package/dist/components/Table/Table.storyexample.d.ts +1 -1
- package/dist/components/Table/components/PaginatedTable.d.ts +2 -2
- package/dist/components/Table/components/Table.d.ts +2 -2
- package/dist/components/Table/components/WindowedTable.d.ts +2 -2
- package/dist/components/Table/types.d.ts +2 -2
- package/dist/components/Tabs/Tabs.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +11 -1
- package/dist/components/Treeview/Treeview.d.ts +2 -2
- package/dist/esm/index.css +96 -119
- package/dist/esm/src/components/Backdrop/Backdrop.js +12 -0
- package/dist/esm/src/components/Backdrop/Backdrop.js.map +1 -0
- package/dist/esm/src/components/Button/Button.js +6 -9
- package/dist/esm/src/components/Button/Button.js.map +1 -1
- package/dist/esm/src/components/Button/util.js +42 -1
- package/dist/esm/src/components/Button/util.js.map +1 -1
- package/dist/esm/src/components/Calendar/Calendar.js +1 -1
- package/dist/esm/src/components/Checkbox/Checkbox.js +9 -1
- package/dist/esm/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/src/components/Datepicker/Datepicker.js +2 -2
- package/dist/esm/src/components/Dialog/Context.js +1 -0
- package/dist/esm/src/components/Dialog/Context.js.map +1 -1
- package/dist/esm/src/components/Dialog/Dialog.js +5 -4
- package/dist/esm/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/src/components/Dialog/components/Content.js +13 -13
- package/dist/esm/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/src/components/Dialog/components/Drawer.js +2 -1
- package/dist/esm/src/components/Dialog/components/Drawer.js.map +1 -1
- package/dist/esm/src/components/Dialog/components/Extra.js +2 -1
- package/dist/esm/src/components/Dialog/components/Extra.js.map +1 -1
- package/dist/esm/src/components/Dialog/components/Trigger.js +2 -1
- package/dist/esm/src/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/src/components/Hanger/Hanger.js +12 -9
- package/dist/esm/src/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/src/components/Icon/components/MatchEntries.js +18 -0
- package/dist/esm/src/components/Icon/components/MatchEntries.js.map +1 -0
- package/dist/esm/src/components/Icon/components/index.js +2 -0
- package/dist/esm/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/src/components/IconButton/IconButton.js +9 -11
- package/dist/esm/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/src/components/Input/util.js +6 -6
- package/dist/esm/src/components/Input/util.js.map +1 -1
- package/dist/esm/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/src/components/Navigation/Navigation.js +5 -4
- package/dist/esm/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/src/components/Pagination/PageNumbers.js +1 -1
- package/dist/esm/src/components/Pagination/Pagination.js +2 -1
- package/dist/esm/src/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/src/components/Popover/Popover.js +9 -6
- package/dist/esm/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/src/components/SearchInput/SearchInput.js +8 -7
- package/dist/esm/src/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/src/components/Select/Select.js +2 -1
- package/dist/esm/src/components/Select/Select.js.map +1 -1
- package/dist/esm/src/components/Select/useSelect.js +12 -5
- package/dist/esm/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/src/components/Table/components/PaginatedTable.js.map +1 -1
- package/dist/esm/src/components/Table/components/Table.js.map +1 -1
- package/dist/esm/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/src/components/Table/hooks/plugins/useRowActions.js +11 -5
- package/dist/esm/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/src/components/Table/hooks/plugins/useRowSelect.js +3 -3
- package/dist/esm/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
- package/dist/esm/src/components/Table/util/renderColumn.js +4 -3
- package/dist/esm/src/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/src/components/Table/util/renderRow.js +4 -3
- package/dist/esm/src/components/Table/util/renderRow.js.map +1 -1
- package/dist/esm/src/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/src/components/Toast/Toast.js +1 -1
- package/dist/esm/src/components/Tooltip/Tooltip.js +11 -10
- package/dist/esm/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/src/components/Tour/Tour.js +2 -2
- package/dist/esm/src/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/src/index.js +8 -7
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/primitives/Button.js +2 -12
- package/dist/esm/src/primitives/Button.js.map +1 -1
- package/dist/esm/src/utils/mergeRefs.js +14 -0
- package/dist/esm/src/utils/mergeRefs.js.map +1 -0
- package/dist/index.css +96 -119
- package/dist/index.d.ts +1 -0
- package/dist/primitives/Button.d.ts +0 -4
- package/dist/taco.cjs.development.js +1660 -1570
- 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/mergeRefs.d.ts +2 -0
- package/dist/utils/tailwind.d.ts +1 -1
- package/package.json +5 -3
- package/plugins/tailwindcss-aria-attributes.js +73 -0
- package/types.json +7310 -0
@@ -9,17 +9,17 @@ var React__default = _interopDefault(React);
|
|
9
9
|
var cn = _interopDefault(require('classnames'));
|
10
10
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
11
11
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
12
|
-
var
|
12
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
13
13
|
var uuid = require('uuid');
|
14
14
|
var framerMotion = require('framer-motion');
|
15
|
+
var DialogPrimitive = require('@radix-ui/react-dialog');
|
16
|
+
var interactions = require('@react-aria/interactions');
|
17
|
+
var ReactDayPicker = _interopDefault(require('react-day-picker'));
|
15
18
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
16
19
|
var Popover$1 = require('reakit/Popover');
|
17
20
|
var keycode = _interopDefault(require('keycode'));
|
18
21
|
var debounce = _interopDefault(require('lodash/debounce'));
|
19
22
|
var dateFns = require('date-fns');
|
20
|
-
var PopoverPrimitive = require('@radix-ui/react-popover');
|
21
|
-
var DialogPrimitive = require('@radix-ui/react-dialog');
|
22
|
-
var interactions = require('@react-aria/interactions');
|
23
23
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
24
24
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
25
25
|
var reactTable = require('react-table');
|
@@ -1800,6 +1800,20 @@ function IconMatchAmount(props, svgRef) {
|
|
1800
1800
|
|
1801
1801
|
var MatchAmount = /*#__PURE__*/React.forwardRef(IconMatchAmount);
|
1802
1802
|
|
1803
|
+
function IconMatchEntries(props, svgRef) {
|
1804
|
+
return React.createElement("svg", Object.assign({
|
1805
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1806
|
+
viewBox: "0 0 24 24",
|
1807
|
+
ref: svgRef
|
1808
|
+
}, props), React.createElement("path", {
|
1809
|
+
d: "M19.25 3a1.75 1.75 0 011.744 1.606L21 4.75v14.5a1.75 1.75 0 01-1.606 1.744L19.25 21H12v-1.5h7.25a.25.25 0 00.243-.193l.007-.057V5.996L19.406 6H4.5l.001 6H3V4.75a1.75 1.75 0 011.606-1.744L4.75 3h14.5zM3.696 15.809l.082.038 2.143 1.237.074.052a.5.5 0 01.147.55l-.038.081-.052.074a.5.5 0 01-.55.147l-.081-.038-.878-.505a2.5 2.5 0 004 1.525.75.75 0 11.925 1.181 4.002 4.002 0 01-6.343-2.173l-.402.695-.052.074a.5.5 0 01-.852-.492l.038-.082 1.238-2.143.051-.074a.5.5 0 01.55-.147zM7.002 13a4.001 4.001 0 013.92 3.197l.357-.62a.5.5 0 01.602-.221l.081.038a.5.5 0 01.221.601l-.038.082-1.237 2.143a.5.5 0 01-.601.221l-.082-.038-2.143-1.237a.5.5 0 01.418-.904l.082.038.914.528a2.5 2.5 0 00-4.034-1.798.75.75 0 11-.924-1.181A3.985 3.985 0 017.002 13zm10.248 2a.75.75 0 110 1.5h-2.5a.75.75 0 110-1.5h2.5zm-.125-3.5c.483 0 .875.336.875.75s-.392.75-.875.75h-5.25c-.483 0-.875-.336-.875-.75s.392-.75.875-.75h5.25zM17.25 8a.75.75 0 110 1.5H6.75a.75.75 0 010-1.5h10.5z",
|
1810
|
+
fill: "currentColor",
|
1811
|
+
fillRule: "evenodd"
|
1812
|
+
}));
|
1813
|
+
}
|
1814
|
+
|
1815
|
+
var MatchEntries = /*#__PURE__*/React.forwardRef(IconMatchEntries);
|
1816
|
+
|
1803
1817
|
function IconMileage(props, svgRef) {
|
1804
1818
|
return React.createElement("svg", Object.assign({
|
1805
1819
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -2993,6 +3007,7 @@ var icons = {
|
|
2993
3007
|
log: Log,
|
2994
3008
|
market: Market,
|
2995
3009
|
'match-amount': MatchAmount,
|
3010
|
+
'match-entries': MatchEntries,
|
2996
3011
|
mileage: Mileage,
|
2997
3012
|
minus: Minus,
|
2998
3013
|
'modal-resize': ModalResize,
|
@@ -3173,6 +3188,13 @@ Accordion.Item = Item;
|
|
3173
3188
|
Accordion.Trigger = Trigger;
|
3174
3189
|
Accordion.Content = Content;
|
3175
3190
|
|
3191
|
+
var Backdrop = function Backdrop(props) {
|
3192
|
+
var className = cn('fixed inset-0 cursor-default overflow-y-auto bg-[rgba(50,46,62,0.8)] animate-[fade-in_150ms] aria-hidden:hidden', props.className);
|
3193
|
+
return React.createElement("div", Object.assign({}, props, {
|
3194
|
+
className: className
|
3195
|
+
}));
|
3196
|
+
};
|
3197
|
+
|
3176
3198
|
var VisuallyHidden = /*#__PURE__*/React.forwardRef(function VisuallyHidden(props, ref) {
|
3177
3199
|
return React.createElement("span", Object.assign({}, props, {
|
3178
3200
|
className: "sr-only",
|
@@ -3274,43 +3296,16 @@ var getBannerIcon = function getBannerIcon(type) {
|
|
3274
3296
|
}
|
3275
3297
|
};
|
3276
3298
|
|
3277
|
-
var _excluded$3 = ["
|
3278
|
-
var Tooltip = function Tooltip(_ref) {
|
3279
|
-
var title = _ref.title,
|
3280
|
-
children = _ref.children,
|
3281
|
-
placement = _ref.placement,
|
3282
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
3283
|
-
|
3284
|
-
return React.createElement(TooltipPrimitive.Root, {
|
3285
|
-
delayDuration: 50
|
3286
|
-
}, React.createElement(TooltipPrimitive.Trigger, {
|
3287
|
-
asChild: true
|
3288
|
-
}, children), React.createElement(TooltipPrimitive.Content, Object.assign({}, otherProps, {
|
3289
|
-
asChild: true,
|
3290
|
-
side: placement,
|
3291
|
-
sideOffset: 5
|
3292
|
-
}), React.createElement("div", {
|
3293
|
-
className: "px-2 py-1 rounded-sm wcag-purple text-xs font-bold animate-[fade-in_150ms]",
|
3294
|
-
"data-taco": "tooltip",
|
3295
|
-
style: {
|
3296
|
-
transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
|
3297
|
-
}
|
3298
|
-
}, React.createElement(TooltipPrimitive.Arrow, {
|
3299
|
-
className: "fill-purple stroke-purple"
|
3300
|
-
}), title)));
|
3301
|
-
};
|
3302
|
-
|
3303
|
-
var _excluded$4 = ["disabled", "target", "tooltip", "type"];
|
3299
|
+
var _excluded$3 = ["disabled", "target", "type"];
|
3304
3300
|
var Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3305
3301
|
var disabled = props.disabled,
|
3306
3302
|
target = props.target,
|
3307
|
-
tooltip = props.tooltip,
|
3308
3303
|
_props$type = props.type,
|
3309
3304
|
type = _props$type === void 0 ? 'button' : _props$type,
|
3310
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3305
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
|
3311
3306
|
|
3312
3307
|
var Tag = props.href ? 'a' : 'button';
|
3313
|
-
|
3308
|
+
return React.createElement(Tag, Object.assign({}, otherProps, {
|
3314
3309
|
"aria-disabled": disabled ? 'true' : undefined,
|
3315
3310
|
disabled: disabled,
|
3316
3311
|
target: Tag === 'a' ? target : undefined,
|
@@ -3319,108 +3314,69 @@ var Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
3319
3314
|
}), React.Children.count(props.children) > 1 ? React.Children.map(props.children, function (child) {
|
3320
3315
|
return typeof child === 'string' ? React.createElement("span", null, child) : child;
|
3321
3316
|
}) : props.children);
|
3322
|
-
|
3323
|
-
if (tooltip) {
|
3324
|
-
return React.createElement(Tooltip, {
|
3325
|
-
title: tooltip
|
3326
|
-
}, button);
|
3327
|
-
}
|
3328
|
-
|
3329
|
-
return button;
|
3330
3317
|
});
|
3331
3318
|
|
3332
|
-
var
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
}
|
3339
|
-
|
3340
|
-
switch (value) {
|
3341
|
-
case 'primary':
|
3342
|
-
return "yt-blue-solid border-blue\n focus:bg-blue focus:text-white focus:yt-focus\n active:bg-blue-dark active:text-white \n hover:bg-blue-light hover:border-blue-light hover:text-white\n hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white\n disabled:hover:yt-blue-solid";
|
3343
|
-
|
3344
|
-
case 'danger':
|
3345
|
-
return "yt-red-solid border-red\n focus:bg-red focus:text-white focus:yt-focus-red\n active:bg-red-dark active:text-white \n hover:bg-red-light hover:text-white\n hover:focus:bg-red-light hover:focus:text-white\n disabled:hover:yt-red-solid";
|
3346
|
-
|
3347
|
-
case 'ghost':
|
3348
|
-
return "yt-blue-inverted\n focus:bg-transparent focus:text-blue focus:yt-focus\n active:bg-blue-lightest active:border-blue active:text-blue-dark \n hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light\n hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light\n disabled:hover:yt-blue-inverted";
|
3349
|
-
|
3350
|
-
case 'discrete':
|
3351
|
-
{
|
3352
|
-
if (icon) {
|
3353
|
-
return "bg-transparent text-black border-transparent\n focus:text-black focus:yt-focus\n active:text-black\n hover:text-grey-darkest\n hover:focus:text-grey-darkest\n disabled:hover:yt-transparent";
|
3354
|
-
}
|
3355
|
-
|
3356
|
-
return "yt-transparent border-transparent\n focus:text-blue focus:yt-focus\n active:text-blue-dark\n hover:text-blue-light\n hover:focus:text-blue-light\n disabled:hover:yt-transparent";
|
3357
|
-
}
|
3358
|
-
|
3359
|
-
default:
|
3360
|
-
return "yt-grey-solid border-grey\n focus:bg-grey focus:yt-focus\n active:bg-grey-dark active:text-black\n hover:bg-grey-light hover:text-grey-darkest\n hover:focus:bg-grey-light hover:focus:text-grey-darkest\n disabled:hover:yt-grey-solid";
|
3361
|
-
}
|
3362
|
-
};
|
3363
|
-
|
3364
|
-
var _excluded$5 = ["appearance", "icon", "rounded"];
|
3365
|
-
var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
3366
|
-
var appearance = props.appearance,
|
3367
|
-
icon = props.icon,
|
3368
|
-
_props$rounded = props.rounded,
|
3369
|
-
rounded = _props$rounded === void 0 ? false : _props$rounded,
|
3370
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
|
3371
|
-
|
3372
|
-
var className = cn(getButtonClasses(), getAppearanceClasses(appearance, true), {
|
3373
|
-
'rounded-full': rounded,
|
3374
|
-
rounded: !rounded,
|
3375
|
-
'cursor-not-allowed opacity-50': props.disabled,
|
3376
|
-
'focus:yt-focus active:focus:yt-focus': !props.disabled
|
3377
|
-
}, props.className);
|
3378
|
-
|
3379
|
-
if (!icon) {
|
3380
|
-
return null;
|
3381
|
-
}
|
3319
|
+
var _excluded$4 = ["title", "children", "placement"];
|
3320
|
+
var Tooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3321
|
+
var title = props.title,
|
3322
|
+
children = props.children,
|
3323
|
+
placement = props.placement,
|
3324
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
|
3382
3325
|
|
3383
|
-
return React.createElement(
|
3384
|
-
|
3385
|
-
|
3326
|
+
return React.createElement(TooltipPrimitive.Root, {
|
3327
|
+
delayDuration: 50
|
3328
|
+
}, React.createElement(TooltipPrimitive.Trigger, {
|
3329
|
+
asChild: true,
|
3386
3330
|
ref: ref
|
3387
|
-
}), React.createElement(
|
3388
|
-
|
3389
|
-
|
3390
|
-
|
3331
|
+
}, children), React.createElement(TooltipPrimitive.Content, Object.assign({}, otherProps, {
|
3332
|
+
asChild: true,
|
3333
|
+
side: placement,
|
3334
|
+
sideOffset: 3
|
3335
|
+
}), React.createElement("div", {
|
3336
|
+
className: "wcag-purple animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold",
|
3337
|
+
"data-taco": "tooltip",
|
3338
|
+
style: {
|
3339
|
+
transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
|
3340
|
+
}
|
3341
|
+
}, React.createElement(TooltipPrimitive.Arrow, {
|
3342
|
+
className: "fill-purple stroke-purple"
|
3343
|
+
}), title)));
|
3391
3344
|
});
|
3392
3345
|
|
3393
|
-
var
|
3394
|
-
|
3395
|
-
|
3396
|
-
|
3397
|
-
|
3398
|
-
|
3399
|
-
|
3400
|
-
|
3401
|
-
|
3402
|
-
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3407
|
-
})
|
3346
|
+
var _excluded$5 = ["placement"];
|
3347
|
+
var UnstyledArrow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3348
|
+
return React.createElement(PopoverPrimitive.Arrow, {
|
3349
|
+
className: "pointer-events-none -mt-px",
|
3350
|
+
asChild: true,
|
3351
|
+
offset: 2,
|
3352
|
+
width: 30,
|
3353
|
+
height: 11
|
3354
|
+
}, React.createElement("svg", Object.assign({}, props, {
|
3355
|
+
ref: ref,
|
3356
|
+
viewBox: "0 19 30 11",
|
3357
|
+
style: {
|
3358
|
+
transform: 'rotateZ(180deg)'
|
3359
|
+
}
|
3360
|
+
}), React.createElement("path", {
|
3361
|
+
className: "text-grey-dark group-focus:text-blue-light fill-current",
|
3362
|
+
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
3363
|
+
}), React.createElement("path", {
|
3364
|
+
className: "fill-current",
|
3365
|
+
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
|
3366
|
+
})));
|
3408
3367
|
});
|
3368
|
+
var UnstyledContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3369
|
+
var side = props.placement,
|
3370
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
|
3409
3371
|
|
3410
|
-
var
|
3411
|
-
|
3412
|
-
var appearance = props.appearance,
|
3413
|
-
fluid = props.fluid,
|
3414
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
|
3415
|
-
|
3416
|
-
var className = cn(getButtonClasses(), getAppearanceClasses(appearance), 'rounded px-3', {
|
3417
|
-
'cursor-not-allowed opacity-50': props.disabled,
|
3418
|
-
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
3419
|
-
'w-full': fluid
|
3420
|
-
}, props.className);
|
3421
|
-
return React.createElement(Button, Object.assign({}, otherProps, {
|
3372
|
+
var className = cn('border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group ', props.className);
|
3373
|
+
return React.createElement(PopoverPrimitive.Content, Object.assign({}, otherProps, {
|
3422
3374
|
className: className,
|
3423
|
-
|
3375
|
+
side: side,
|
3376
|
+
sideOffset: 1,
|
3377
|
+
style: _extends({}, props.style, {
|
3378
|
+
zIndex: 996
|
3379
|
+
}),
|
3424
3380
|
ref: ref
|
3425
3381
|
}));
|
3426
3382
|
});
|
@@ -3479,12 +3435,12 @@ function useTimer(duration, callback) {
|
|
3479
3435
|
};
|
3480
3436
|
}
|
3481
3437
|
|
3482
|
-
var _excluded$
|
3438
|
+
var _excluded$6 = ["delay", "label"];
|
3483
3439
|
var Spinner$1 = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
3484
3440
|
var _props$delay = props.delay,
|
3485
3441
|
delay = _props$delay === void 0 ? 500 : _props$delay,
|
3486
3442
|
label = props.label,
|
3487
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3443
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
|
3488
3444
|
|
3489
3445
|
var _React$useState = React__default.useState(!delay),
|
3490
3446
|
visible = _React$useState[0],
|
@@ -3567,13 +3523,13 @@ var getBadgeIcon = function getBadgeIcon(type) {
|
|
3567
3523
|
}
|
3568
3524
|
};
|
3569
3525
|
|
3570
|
-
var _excluded$
|
3526
|
+
var _excluded$7 = ["content", "lastUpdated", "onClose", "options"];
|
3571
3527
|
var Toast = function Toast(_ref) {
|
3572
3528
|
var content = _ref.content,
|
3573
3529
|
lastUpdated = _ref.lastUpdated,
|
3574
3530
|
handleClose = _ref.onClose,
|
3575
3531
|
options = _ref.options,
|
3576
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
3532
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
3577
3533
|
|
3578
3534
|
var _useLocalization = useLocalization(),
|
3579
3535
|
texts = _useLocalization.texts;
|
@@ -3636,7 +3592,7 @@ var Toast = function Toast(_ref) {
|
|
3636
3592
|
}));
|
3637
3593
|
};
|
3638
3594
|
|
3639
|
-
var _excluded$
|
3595
|
+
var _excluded$8 = ["children"];
|
3640
3596
|
var DEFAULT_AUTO_CLOSE_TIMEOUT = 7500;
|
3641
3597
|
var ToastContext = /*#__PURE__*/React.createContext({});
|
3642
3598
|
|
@@ -3662,7 +3618,7 @@ var insertToastWithoutDuplicates = function insertToastWithoutDuplicates(current
|
|
3662
3618
|
|
3663
3619
|
var ToastProvider = function ToastProvider(_ref) {
|
3664
3620
|
var children = _ref.children,
|
3665
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
3621
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
3666
3622
|
|
3667
3623
|
var _React$useState = React.useState([]),
|
3668
3624
|
toasts = _React$useState[0],
|
@@ -3923,187 +3879,102 @@ var useLocalization = function useLocalization() {
|
|
3923
3879
|
return useTaco().localization;
|
3924
3880
|
};
|
3925
3881
|
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3932
|
-
|
3933
|
-
|
3934
|
-
|
3935
|
-
|
3936
|
-
|
3937
|
-
for (var i = thisYear - 10; i <= thisYear + 10; i += 1) {
|
3938
|
-
years.push(i);
|
3882
|
+
function mergeRefs(refs) {
|
3883
|
+
return function (value) {
|
3884
|
+
refs.forEach(function (ref) {
|
3885
|
+
if (typeof ref === 'function') {
|
3886
|
+
ref(value);
|
3887
|
+
} else if (ref != null) {
|
3888
|
+
ref.current = value;
|
3889
|
+
}
|
3890
|
+
});
|
3891
|
+
};
|
3939
3892
|
}
|
3940
3893
|
|
3941
|
-
var
|
3942
|
-
|
3943
|
-
|
3944
|
-
|
3945
|
-
|
3946
|
-
|
3947
|
-
|
3894
|
+
var _excluded$9 = ["children"];
|
3895
|
+
var HangerContext = /*#__PURE__*/React.createContext({
|
3896
|
+
props: {},
|
3897
|
+
ref: null
|
3898
|
+
});
|
3899
|
+
var Anchor = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3900
|
+
var context = React.useContext(HangerContext);
|
3901
|
+
return React.createElement(PopoverPrimitive.Anchor, Object.assign({}, context.props, props, {
|
3902
|
+
ref: mergeRefs([context.ref, ref]),
|
3903
|
+
asChild: true
|
3904
|
+
}));
|
3905
|
+
});
|
3906
|
+
var Content$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3948
3907
|
var _useLocalization = useLocalization(),
|
3949
|
-
|
3950
|
-
actions = _useLocalization$text.actions,
|
3951
|
-
months = _useLocalization$text.months;
|
3908
|
+
texts = _useLocalization.texts;
|
3952
3909
|
|
3953
|
-
var
|
3954
|
-
|
3955
|
-
|
3956
|
-
|
3957
|
-
onMonthChange(new Date(year.value, month.value));
|
3910
|
+
var className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
|
3911
|
+
|
3912
|
+
var handleInteractOutside = function handleInteractOutside(event) {
|
3913
|
+
event.preventDefault();
|
3958
3914
|
};
|
3959
3915
|
|
3960
|
-
return React.createElement(
|
3961
|
-
className: "flex justify-between items-center mb-2"
|
3962
|
-
}, React.createElement("form", {
|
3963
|
-
className: "inline-flex space-x-1"
|
3964
|
-
}, React.createElement("select", {
|
3965
|
-
className: "h-8 px-2",
|
3966
|
-
name: "month",
|
3967
|
-
onChange: handleChange,
|
3968
|
-
value: value.getMonth()
|
3969
|
-
}, months.map(function (month, i) {
|
3970
|
-
return React.createElement("option", {
|
3971
|
-
value: i
|
3972
|
-
}, month);
|
3973
|
-
})), React.createElement("select", {
|
3974
|
-
className: "h-8 px-2",
|
3975
|
-
name: "year",
|
3976
|
-
onChange: handleChange,
|
3977
|
-
value: value.getFullYear()
|
3978
|
-
}, years.map(function (year) {
|
3979
|
-
return React.createElement("option", {
|
3980
|
-
value: year
|
3981
|
-
}, String(year));
|
3982
|
-
}))), React.createElement("div", null, React.createElement(IconButton, {
|
3983
|
-
appearance: "discrete",
|
3984
|
-
icon: "chevron-left",
|
3985
|
-
"aria-label": actions.previousMonth,
|
3986
|
-
onClick: function onClick() {
|
3987
|
-
return onPreviousClick();
|
3988
|
-
},
|
3989
|
-
rounded: true
|
3990
|
-
}), React.createElement(IconButton, {
|
3991
|
-
appearance: "discrete",
|
3992
|
-
icon: "chevron-right",
|
3993
|
-
"aria-label": actions.nextMonth,
|
3994
|
-
onClick: function onClick() {
|
3995
|
-
return onNextClick();
|
3996
|
-
},
|
3997
|
-
rounded: true
|
3998
|
-
})));
|
3999
|
-
});
|
4000
|
-
var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4001
|
-
var handleChange = props.onChange,
|
4002
|
-
value = props.value,
|
4003
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$a);
|
4004
|
-
|
4005
|
-
var _useLocalization2 = useLocalization(),
|
4006
|
-
locale = _useLocalization2.locale,
|
4007
|
-
texts = _useLocalization2.texts;
|
4008
|
-
|
4009
|
-
var _React$useState = React.useState(value !== null && value !== void 0 ? value : new Date()),
|
4010
|
-
visibleMonth = _React$useState[0],
|
4011
|
-
setVisibleMonth = _React$useState[1];
|
4012
|
-
|
4013
|
-
React.useEffect(function () {
|
4014
|
-
if (visibleMonth !== value) {
|
4015
|
-
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
4016
|
-
}
|
4017
|
-
}, [value]);
|
4018
|
-
|
4019
|
-
var handleDayClick = function handleDayClick(date, modifiers, event) {
|
4020
|
-
if (modifiers.outside || modifiers.disabled) {
|
4021
|
-
return;
|
4022
|
-
}
|
4023
|
-
|
4024
|
-
handleChange(date, event);
|
4025
|
-
};
|
4026
|
-
|
4027
|
-
var handleCalendarClickToday = function handleCalendarClickToday() {
|
4028
|
-
var today = new Date(); // set to midday to avoid UTC offset causing dates to be mismatched server side
|
4029
|
-
|
4030
|
-
today.setHours(12);
|
4031
|
-
today.setMinutes(0);
|
4032
|
-
today.setSeconds(0);
|
4033
|
-
handleChange(today);
|
4034
|
-
};
|
4035
|
-
|
4036
|
-
var className = cn('flex bg-white text-xs p-4', otherProps.className);
|
4037
|
-
return React.createElement("div", {
|
4038
|
-
"data-taco": "calendar"
|
4039
|
-
}, React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
3916
|
+
return React.createElement(UnstyledContent, {
|
4040
3917
|
className: className,
|
4041
|
-
|
4042
|
-
|
4043
|
-
|
4044
|
-
firstDayOfWeek: 1,
|
4045
|
-
months: texts.calendar.months,
|
4046
|
-
weekdaysShort: texts.calendar.weekdaysShort,
|
4047
|
-
navbarElement: function navbarElement(navProps) {
|
4048
|
-
return React.createElement(Navbar, Object.assign({}, navProps, {
|
4049
|
-
onMonthChange: setVisibleMonth,
|
4050
|
-
value: visibleMonth
|
4051
|
-
}));
|
4052
|
-
},
|
4053
|
-
onDayClick: handleDayClick,
|
4054
|
-
onMonthChange: setVisibleMonth,
|
4055
|
-
onTodayButtonClick: handleCalendarClickToday,
|
4056
|
-
captionElement: function captionElement() {
|
4057
|
-
return null;
|
4058
|
-
},
|
4059
|
-
todayButton: texts.calendar.actions.today,
|
4060
|
-
showOutsideDays: true,
|
4061
|
-
renderDay: renderDay,
|
4062
|
-
numberOfMonths: 1,
|
3918
|
+
"data-taco": "hanger",
|
3919
|
+
onInteractOutside: handleInteractOutside,
|
3920
|
+
placement: props.placement,
|
4063
3921
|
ref: ref
|
3922
|
+
}, props.children, React.createElement(UnstyledArrow, {
|
3923
|
+
className: "text-blue"
|
3924
|
+
}), React.createElement(PopoverPrimitive.Close, {
|
3925
|
+
asChild: true
|
3926
|
+
}, React.createElement(IconButton, {
|
3927
|
+
appearance: "primary",
|
3928
|
+
"aria-label": texts.hanger.close,
|
3929
|
+
className: "absolute top-0 right-0 ml-2 mr-2 mt-2 text-white",
|
3930
|
+
icon: "close",
|
3931
|
+
onClick: props.onClose
|
4064
3932
|
})));
|
4065
3933
|
});
|
3934
|
+
var Hanger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3935
|
+
var children = props.children,
|
3936
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$9);
|
4066
3937
|
|
4067
|
-
var
|
4068
|
-
|
4069
|
-
|
4070
|
-
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4082
|
-
'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled
|
4083
|
-
}, props.className);
|
4084
|
-
var element = React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, {
|
4085
|
-
"data-taco": "checkbox",
|
4086
|
-
checked: indeterminate ? 'indeterminate' : checked,
|
4087
|
-
className: className,
|
4088
|
-
onCheckedChange: onChange,
|
4089
|
-
ref: ref
|
4090
|
-
}), React.createElement(CheckboxPrimitive.Indicator, {
|
4091
|
-
className: "flex h-full w-full"
|
4092
|
-
}, React.createElement(Icon, {
|
4093
|
-
name: indeterminate ? 'line' : 'tick',
|
4094
|
-
className: "!h-full !w-full"
|
4095
|
-
})));
|
3938
|
+
var context = React.useMemo(function () {
|
3939
|
+
return {
|
3940
|
+
props: otherProps,
|
3941
|
+
ref: ref
|
3942
|
+
};
|
3943
|
+
}, [otherProps]);
|
3944
|
+
return React.createElement(HangerContext.Provider, {
|
3945
|
+
value: context
|
3946
|
+
}, React.createElement(PopoverPrimitive.Root, {
|
3947
|
+
children: children,
|
3948
|
+
defaultOpen: true
|
3949
|
+
}));
|
3950
|
+
});
|
3951
|
+
Hanger.Anchor = Anchor;
|
3952
|
+
Hanger.Content = Content$1;
|
4096
3953
|
|
4097
|
-
|
4098
|
-
|
4099
|
-
|
4100
|
-
|
4101
|
-
|
4102
|
-
|
4103
|
-
|
4104
|
-
|
3954
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
3955
|
+
var DialogContext = /*#__PURE__*/React.createContext({
|
3956
|
+
close: function close() {},
|
3957
|
+
draggable: false,
|
3958
|
+
drawer: undefined,
|
3959
|
+
elements: {
|
3960
|
+
drawer: undefined,
|
3961
|
+
extra: undefined
|
3962
|
+
},
|
3963
|
+
onClose: function onClose() {},
|
3964
|
+
props: {},
|
3965
|
+
ref: null,
|
3966
|
+
size: 'sm'
|
3967
|
+
});
|
3968
|
+
var useCurrentDialog = function useCurrentDialog() {
|
3969
|
+
return React.useContext(DialogContext);
|
3970
|
+
};
|
4105
3971
|
|
4106
|
-
|
3972
|
+
var Trigger$1 = /*#__PURE__*/React.forwardRef(function DialogTrigger(props, ref) {
|
3973
|
+
var dialog = useCurrentDialog();
|
3974
|
+
return React.createElement(DialogPrimitive.Trigger, Object.assign({}, dialog.props, props, {
|
3975
|
+
ref: mergeRefs([dialog.ref, ref]),
|
3976
|
+
asChild: true
|
3977
|
+
}));
|
4107
3978
|
});
|
4108
3979
|
|
4109
3980
|
var useProxiedRef = function useProxiedRef(ref) {
|
@@ -4120,225 +3991,893 @@ var useProxiedRef = function useProxiedRef(ref) {
|
|
4120
3991
|
return internalRef;
|
4121
3992
|
};
|
4122
3993
|
|
4123
|
-
var
|
4124
|
-
var
|
3994
|
+
var useDraggable = function useDraggable(ref) {
|
3995
|
+
var _React$useState = React__default.useState({
|
3996
|
+
x: 0,
|
3997
|
+
y: 0
|
3998
|
+
}),
|
3999
|
+
position = _React$useState[0],
|
4000
|
+
setPosition = _React$useState[1];
|
4125
4001
|
|
4126
|
-
|
4127
|
-
|
4128
|
-
|
4129
|
-
}, _cn[getStateClasses$1(props.state)] = !props.disabled, _cn['bg-[rgba(255,255,0,0.075)]'] = props.highlighted && props.disabled, _cn['bg-[rgba(255,255,0,0.2)]'] = props.highlighted && !props.disabled, _cn));
|
4130
|
-
};
|
4131
|
-
var getStateClasses$1 = function getStateClasses(value) {
|
4132
|
-
switch (value) {
|
4133
|
-
case 'success':
|
4134
|
-
return 'border-green hover:shadow-[0_0_0.15rem_theme(colors.green.DEFAULT)] focus:border-green-light focus:yt-focus-green active:border-green-dark';
|
4002
|
+
var _useMove = interactions.useMove({
|
4003
|
+
onMove: function onMove(event) {
|
4004
|
+
var _ref$current;
|
4135
4005
|
|
4136
|
-
|
4137
|
-
return 'border-red hover:shadow-[0_0_0.15rem_theme(colors.red.DEFAULT)] focus:border-red-light focus:yt-focus-red active:border-red-dark';
|
4006
|
+
var rect = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect(); // Prevent dragging out of bounds
|
4138
4007
|
|
4139
|
-
|
4140
|
-
|
4008
|
+
// Prevent dragging out of bounds
|
4009
|
+
if (rect && (rect.left + event.deltaX < 0 || rect.right + event.deltaX > window.innerWidth || rect.top + event.deltaY < 0 || rect.bottom + event.deltaY > window.innerHeight)) {
|
4010
|
+
return;
|
4011
|
+
}
|
4141
4012
|
|
4142
|
-
|
4143
|
-
|
4013
|
+
setPosition(function (_ref) {
|
4014
|
+
var x = _ref.x,
|
4015
|
+
y = _ref.y;
|
4016
|
+
x += event.deltaX;
|
4017
|
+
y += event.deltaY;
|
4018
|
+
return {
|
4019
|
+
x: x,
|
4020
|
+
y: y
|
4021
|
+
};
|
4022
|
+
});
|
4023
|
+
}
|
4024
|
+
}),
|
4025
|
+
moveProps = _useMove.moveProps;
|
4144
4026
|
|
4145
|
-
|
4146
|
-
|
4147
|
-
|
4027
|
+
return {
|
4028
|
+
position: position,
|
4029
|
+
handleProps: moveProps
|
4030
|
+
};
|
4148
4031
|
};
|
4149
|
-
var getButtonStateClasses = function getButtonStateClasses(value) {
|
4150
|
-
switch (value) {
|
4151
|
-
case 'success':
|
4152
|
-
return 'border-green focus:border-green-light focus:yt-focus-green peer-focus:border-green-light peer-focus:peer-active:border-green-dark';
|
4153
|
-
|
4154
|
-
case 'error':
|
4155
|
-
return 'border-red focus:border-red-light focus:yt-focus-red peer-focus:border-red-light peer-focus:peer-active:border-red-dark';
|
4156
|
-
|
4157
|
-
case 'warning':
|
4158
|
-
return 'border-yellow-dark focus:border-yellow-dark focus:yt-focus-yellow peer-focus:peer-active:border-yellow-dark';
|
4159
|
-
|
4160
|
-
case 'information':
|
4161
|
-
return 'border-blue focus:border-blue-light peer-focus:border-blue-light peer-focus:peer-active:border-blue-dark';
|
4162
4032
|
|
4163
|
-
|
4164
|
-
|
4165
|
-
|
4033
|
+
var MenuContext = /*#__PURE__*/React.createContext(undefined);
|
4034
|
+
var useCurrentMenu = function useCurrentMenu() {
|
4035
|
+
return React.useContext(MenuContext);
|
4166
4036
|
};
|
4167
4037
|
|
4168
|
-
var _excluded$
|
4169
|
-
var
|
4170
|
-
var
|
4171
|
-
|
4172
|
-
|
4173
|
-
autoFocus = props.autoFocus,
|
4174
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
4038
|
+
var _excluded$a = ["as"];
|
4039
|
+
var Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
4040
|
+
var _props$as = props.as,
|
4041
|
+
Tag = _props$as === void 0 ? 'span' : _props$as,
|
4042
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$a);
|
4175
4043
|
|
4176
|
-
var
|
4177
|
-
|
4178
|
-
var className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
4179
|
-
'pr-8': !!hasContainer
|
4180
|
-
}, !hasContainer && otherProps.className);
|
4181
|
-
React.useEffect(function () {
|
4182
|
-
if (autoFocus && inputRef.current) {
|
4183
|
-
inputRef.current.focus();
|
4184
|
-
}
|
4185
|
-
}, []);
|
4186
|
-
var input = React.createElement("input", Object.assign({}, otherProps, {
|
4044
|
+
var className = cn('flex ', props.className);
|
4045
|
+
return React.createElement(Tag, Object.assign({}, otherProps, {
|
4187
4046
|
className: className,
|
4188
|
-
"data-taco": "
|
4189
|
-
ref:
|
4047
|
+
"data-taco": "group",
|
4048
|
+
ref: ref
|
4190
4049
|
}));
|
4050
|
+
});
|
4191
4051
|
|
4192
|
-
|
4193
|
-
|
4194
|
-
|
4195
|
-
|
4196
|
-
|
4197
|
-
|
4198
|
-
var disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
|
4199
|
-
var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(state)] = !props.disabled, _cn), button.props.className);
|
4200
|
-
extra = React.cloneElement(button, {
|
4201
|
-
className: buttonClassName,
|
4202
|
-
disabled: disabled
|
4203
|
-
});
|
4204
|
-
} else if (icon) {
|
4205
|
-
var 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', {
|
4206
|
-
'text-grey-dark': props.disabled,
|
4207
|
-
'text-grey-darkest': !props.disabled
|
4208
|
-
});
|
4209
|
-
extra = typeof icon === 'string' ? React.createElement(Icon, {
|
4210
|
-
className: iconClassName,
|
4211
|
-
name: icon
|
4212
|
-
}) : React.cloneElement(icon, {
|
4213
|
-
className: cn(iconClassName, icon.props.className)
|
4214
|
-
});
|
4215
|
-
}
|
4216
|
-
|
4217
|
-
var containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
|
4218
|
-
return React.createElement("div", {
|
4219
|
-
className: containerClassName,
|
4220
|
-
"data-taco": "input-container"
|
4221
|
-
}, input, extra);
|
4222
|
-
}
|
4223
|
-
|
4224
|
-
return input;
|
4052
|
+
var Title = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
4053
|
+
return React.createElement(DialogPrimitive.Title, Object.assign({}, props, {
|
4054
|
+
className: "text-center",
|
4055
|
+
ref: ref
|
4056
|
+
}));
|
4225
4057
|
});
|
4058
|
+
var Footer = /*#__PURE__*/React.forwardRef(function DialogFooter(props, ref) {
|
4059
|
+
return React.createElement("div", Object.assign({}, props, {
|
4060
|
+
className: "mt-8 flex justify-end",
|
4061
|
+
ref: ref
|
4062
|
+
}), React.createElement(Group, null, props.children));
|
4063
|
+
});
|
4064
|
+
var Close$1 = /*#__PURE__*/React.forwardRef(function DialogClose(props, ref) {
|
4065
|
+
var dialog = useCurrentDialog();
|
4066
|
+
return React.createElement(DialogPrimitive.Close, Object.assign({
|
4067
|
+
onClick: dialog.onClose
|
4068
|
+
}, props, {
|
4069
|
+
ref: ref,
|
4070
|
+
asChild: true
|
4071
|
+
}));
|
4072
|
+
});
|
4073
|
+
var Content$2 = /*#__PURE__*/React.forwardRef(function DialogContent(props, ref) {
|
4074
|
+
var dialog = useCurrentDialog();
|
4075
|
+
var internalRef = useProxiedRef(ref);
|
4226
4076
|
|
4227
|
-
var
|
4228
|
-
|
4229
|
-
|
4230
|
-
}
|
4231
|
-
|
4232
|
-
var previousKey = direction === 'horizontal' ? 'left' : 'up';
|
4233
|
-
var nextKey = direction === 'horizontal' ? 'right' : 'down';
|
4234
|
-
|
4235
|
-
switch (keyCode) {
|
4236
|
-
case keycode(previousKey):
|
4237
|
-
return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
|
4238
|
-
|
4239
|
-
case keycode(nextKey):
|
4240
|
-
return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
|
4077
|
+
var _useDraggable = useDraggable(internalRef),
|
4078
|
+
position = _useDraggable.position,
|
4079
|
+
dragHandleProps = _useDraggable.handleProps;
|
4241
4080
|
|
4242
|
-
|
4243
|
-
|
4081
|
+
var _useLocalization = useLocalization(),
|
4082
|
+
texts = _useLocalization.texts; // if the dialog was opened by a menu, we need to close the menu when the dialog closes
|
4083
|
+
// the menu is still open (and mounted) because it is the trigger for the dialog
|
4244
4084
|
|
4245
|
-
case keycode('end'):
|
4246
|
-
return length - 1;
|
4247
4085
|
|
4248
|
-
|
4249
|
-
|
4250
|
-
}
|
4251
|
-
};
|
4252
|
-
var useListKeyboardNavigation = function useListKeyboardNavigation(length, options) {
|
4253
|
-
if (length === void 0) {
|
4254
|
-
length = 0;
|
4255
|
-
}
|
4086
|
+
var menu = useCurrentMenu();
|
4087
|
+
var handleCloseAutoFocus;
|
4256
4088
|
|
4257
|
-
if (
|
4258
|
-
|
4259
|
-
|
4089
|
+
if (menu) {
|
4090
|
+
handleCloseAutoFocus = function handleCloseAutoFocus() {
|
4091
|
+
return menu.close();
|
4260
4092
|
};
|
4261
4093
|
}
|
4262
4094
|
|
4263
|
-
var
|
4264
|
-
|
4265
|
-
|
4095
|
+
var className = cn('bg-white rounded mt-16 mx-auto', {
|
4096
|
+
'w-128 text-center justify-center': dialog.size === 'dialog',
|
4097
|
+
'w-xs': dialog.size === 'xs',
|
4098
|
+
'w-sm': dialog.size === 'sm',
|
4099
|
+
'w-md': dialog.size === 'md',
|
4100
|
+
'w-lg': dialog.size === 'lg'
|
4101
|
+
});
|
4102
|
+
var containerClassName = cn('bg-white p-6 rounded relative z-[999]', 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]', {
|
4103
|
+
'rounded-b-none': !!dialog.elements.extra
|
4104
|
+
}, props.className); // the chosen behaviour in taco is that outside clicks do not close the dialog
|
4266
4105
|
|
4267
|
-
var
|
4268
|
-
|
4106
|
+
var handleInteractOutside = function handleInteractOutside(event) {
|
4107
|
+
return event.preventDefault();
|
4108
|
+
};
|
4269
4109
|
|
4270
|
-
|
4271
|
-
event.preventDefault();
|
4272
|
-
}
|
4110
|
+
var output;
|
4273
4111
|
|
4274
|
-
|
4275
|
-
|
4112
|
+
if (typeof props.children === 'function') {
|
4113
|
+
output = props.children({
|
4114
|
+
drawer: dialog.drawer,
|
4115
|
+
close: dialog.close
|
4116
|
+
});
|
4117
|
+
} else {
|
4118
|
+
output = props.children;
|
4119
|
+
}
|
4276
4120
|
|
4277
|
-
return
|
4278
|
-
|
4121
|
+
return React.createElement(DialogPrimitive.Portal, null, React.createElement(DialogPrimitive.Overlay, {
|
4122
|
+
asChild: true
|
4123
|
+
}, React.createElement(Backdrop, null, React.createElement(DialogPrimitive.Content, Object.assign({}, props, {
|
4124
|
+
className: className,
|
4125
|
+
onEscapeKeyDown: dialog.onClose,
|
4126
|
+
onInteractOutside: handleInteractOutside,
|
4127
|
+
onCloseAutoFocus: handleCloseAutoFocus,
|
4128
|
+
ref: ref,
|
4129
|
+
style: _extends({}, props.style, {
|
4130
|
+
left: dialog.draggable ? "calc(50% + " + position.x + "px)" : undefined,
|
4131
|
+
top: dialog.draggable ? "calc(50% + " + position.y + "px)" : undefined
|
4132
|
+
})
|
4133
|
+
}), React.createElement("div", {
|
4134
|
+
className: containerClassName,
|
4135
|
+
"data-taco": "dialog"
|
4136
|
+
}, output, dialog.draggable && React.createElement("div", Object.assign({}, dragHandleProps, {
|
4137
|
+
"aria-label": texts.dialog.drag,
|
4138
|
+
className: "yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center"
|
4139
|
+
})), React.createElement(DialogPrimitive.Close, {
|
4140
|
+
asChild: true,
|
4141
|
+
onClick: dialog.onClose
|
4142
|
+
}, React.createElement(IconButton, {
|
4143
|
+
appearance: "discrete",
|
4144
|
+
"aria-label": texts.dialog.close,
|
4145
|
+
className: "absolute top-0 right-0 mt-2 mr-2",
|
4146
|
+
icon: "close"
|
4147
|
+
}))), dialog.elements.drawer, dialog.elements.extra))));
|
4148
|
+
});
|
4279
4149
|
|
4280
|
-
var
|
4281
|
-
var
|
4150
|
+
var Drawer = /*#__PURE__*/React.forwardRef(function DialogDrawer(props, ref) {
|
4151
|
+
var _dialog$drawer, _dialog$drawer2;
|
4282
4152
|
|
4283
|
-
|
4284
|
-
|
4285
|
-
|
4286
|
-
|
4153
|
+
var dialog = useCurrentDialog();
|
4154
|
+
return React.createElement(framerMotion.motion.div, Object.assign({}, props, {
|
4155
|
+
className: "absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left",
|
4156
|
+
"data-taco": "dialog-drawer",
|
4157
|
+
"aria-hidden": !((_dialog$drawer = dialog.drawer) !== null && _dialog$drawer !== void 0 && _dialog$drawer.open),
|
4158
|
+
variants: {
|
4159
|
+
visible: {
|
4160
|
+
left: '100%',
|
4161
|
+
display: 'block',
|
4162
|
+
transition: {
|
4163
|
+
ease: 'easeOut',
|
4164
|
+
duration: 0.2
|
4165
|
+
}
|
4166
|
+
},
|
4167
|
+
hidden: {
|
4168
|
+
left: '0%',
|
4169
|
+
transition: {
|
4170
|
+
ease: 'easeOut',
|
4171
|
+
duration: 0.2
|
4172
|
+
},
|
4173
|
+
transitionEnd: {
|
4174
|
+
display: 'none'
|
4175
|
+
}
|
4176
|
+
}
|
4177
|
+
},
|
4178
|
+
animate: (_dialog$drawer2 = dialog.drawer) !== null && _dialog$drawer2 !== void 0 && _dialog$drawer2.open ? 'visible' : 'hidden',
|
4179
|
+
ref: ref
|
4180
|
+
}));
|
4181
|
+
});
|
4287
4182
|
|
4288
|
-
|
4289
|
-
|
4290
|
-
|
4291
|
-
|
4292
|
-
|
4293
|
-
}
|
4294
|
-
};
|
4183
|
+
var Extra = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4184
|
+
return React.createElement("div", Object.assign({}, props, {
|
4185
|
+
className: "bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left",
|
4186
|
+
"data-taco": "dialog-extra",
|
4187
|
+
ref: ref
|
4188
|
+
}));
|
4189
|
+
});
|
4295
4190
|
|
4296
|
-
var
|
4297
|
-
var scrollTo = function scrollTo(index) {
|
4298
|
-
if (internalRef && internalRef.current) {
|
4299
|
-
if (index !== undefined) {
|
4300
|
-
var activeRef = itemRefs[index];
|
4191
|
+
var _excluded$b = ["children", "draggable", "onClose", "open", "size"];
|
4301
4192
|
|
4302
|
-
|
4303
|
-
|
4304
|
-
|
4193
|
+
var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
4194
|
+
return React.useMemo(function () {
|
4195
|
+
var children = [];
|
4196
|
+
var drawer;
|
4197
|
+
var extra;
|
4198
|
+
React.Children.forEach(initialChildren, function (child) {
|
4199
|
+
if (child.type.displayName === 'Drawer') {
|
4200
|
+
drawer = child;
|
4201
|
+
} else if (child.type.displayName === 'Extra') {
|
4202
|
+
extra = child;
|
4305
4203
|
} else {
|
4306
|
-
|
4204
|
+
children.push(child);
|
4307
4205
|
}
|
4308
|
-
}
|
4309
|
-
|
4310
|
-
|
4311
|
-
return {
|
4312
|
-
scrollTo: scrollTo
|
4313
|
-
};
|
4206
|
+
});
|
4207
|
+
return [children, drawer, extra];
|
4208
|
+
}, [initialChildren]);
|
4314
4209
|
};
|
4315
4210
|
|
4316
|
-
var
|
4317
|
-
|
4318
|
-
|
4319
|
-
|
4320
|
-
|
4211
|
+
var Dialog = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4212
|
+
var initialChildren = props.children,
|
4213
|
+
_props$draggable = props.draggable,
|
4214
|
+
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
4215
|
+
onClose = props.onClose,
|
4216
|
+
defaultOpen = props.open,
|
4217
|
+
_props$size = props.size,
|
4218
|
+
size = _props$size === void 0 ? 'sm' : _props$size,
|
4219
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
4321
4220
|
|
4322
|
-
var
|
4323
|
-
|
4221
|
+
var _useSeparatedChildren = useSeparatedChildren(initialChildren),
|
4222
|
+
children = _useSeparatedChildren[0],
|
4223
|
+
drawer = _useSeparatedChildren[1],
|
4224
|
+
extra = _useSeparatedChildren[2];
|
4324
4225
|
|
4325
|
-
|
4326
|
-
|
4327
|
-
|
4328
|
-
} else if (data[nextIndex] && data[nextIndex].disabled) {
|
4329
|
-
return getNextEnabledItem(event, data, nextIndex);
|
4330
|
-
}
|
4331
|
-
}
|
4226
|
+
var _React$useState = React.useState(defaultOpen),
|
4227
|
+
open = _React$useState[0],
|
4228
|
+
setOpen = _React$useState[1];
|
4332
4229
|
|
4333
|
-
|
4334
|
-
|
4230
|
+
var _React$useState2 = React.useState(false),
|
4231
|
+
drawerOpen = _React$useState2[0],
|
4232
|
+
setDrawerOpen = _React$useState2[1];
|
4335
4233
|
|
4336
|
-
var
|
4337
|
-
|
4338
|
-
|
4339
|
-
|
4340
|
-
|
4341
|
-
|
4234
|
+
var context = React.useMemo(function () {
|
4235
|
+
return {
|
4236
|
+
close: function close() {
|
4237
|
+
return setOpen(false);
|
4238
|
+
},
|
4239
|
+
draggable: draggable,
|
4240
|
+
drawer: {
|
4241
|
+
open: drawerOpen,
|
4242
|
+
toggle: function toggle() {
|
4243
|
+
return setDrawerOpen(function (isDrawerOpen) {
|
4244
|
+
return !isDrawerOpen;
|
4245
|
+
});
|
4246
|
+
}
|
4247
|
+
},
|
4248
|
+
elements: {
|
4249
|
+
drawer: drawer,
|
4250
|
+
extra: extra
|
4251
|
+
},
|
4252
|
+
onClose: onClose,
|
4253
|
+
props: otherProps,
|
4254
|
+
size: size,
|
4255
|
+
ref: ref
|
4256
|
+
};
|
4257
|
+
}, [open, drawerOpen, drawer, extra, otherProps]);
|
4258
|
+
return React.createElement(DialogContext.Provider, {
|
4259
|
+
value: context
|
4260
|
+
}, React.createElement(DialogPrimitive.Root, {
|
4261
|
+
children: children,
|
4262
|
+
open: open,
|
4263
|
+
onOpenChange: setOpen
|
4264
|
+
}));
|
4265
|
+
});
|
4266
|
+
Dialog.Trigger = Trigger$1;
|
4267
|
+
Dialog.Content = Content$2;
|
4268
|
+
Dialog.Title = Title;
|
4269
|
+
Dialog.Footer = Footer;
|
4270
|
+
Dialog.Extra = Extra;
|
4271
|
+
Dialog.Drawer = Drawer;
|
4272
|
+
Dialog.Close = Close$1;
|
4273
|
+
|
4274
|
+
var _excluded$c = ["children"];
|
4275
|
+
var PopoverContext = /*#__PURE__*/React.createContext({
|
4276
|
+
props: {},
|
4277
|
+
ref: null
|
4278
|
+
});
|
4279
|
+
var Trigger$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4280
|
+
var context = React.useContext(PopoverContext);
|
4281
|
+
return React.createElement(PopoverPrimitive.Trigger, Object.assign({}, context.props, props, {
|
4282
|
+
ref: mergeRefs([context.ref, ref]),
|
4283
|
+
asChild: true
|
4284
|
+
}));
|
4285
|
+
});
|
4286
|
+
var RenderPropWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
4287
|
+
var children = _ref.children,
|
4288
|
+
onClick = _ref.onClick;
|
4289
|
+
|
4290
|
+
var close = function close() {
|
4291
|
+
onClick(new CustomEvent('hide'));
|
4292
|
+
};
|
4293
|
+
|
4294
|
+
return children({
|
4295
|
+
close: close,
|
4296
|
+
ref: ref
|
4297
|
+
});
|
4298
|
+
});
|
4299
|
+
var Content$3 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4300
|
+
var className = cn('bg-white focus:border-blue-light', props.className);
|
4301
|
+
var output;
|
4302
|
+
|
4303
|
+
if (typeof props.children === 'function') {
|
4304
|
+
output = React.createElement(PopoverPrimitive.Close, {
|
4305
|
+
asChild: true
|
4306
|
+
}, React.createElement(RenderPropWrapper, null, props.children));
|
4307
|
+
} else {
|
4308
|
+
output = props.children;
|
4309
|
+
}
|
4310
|
+
|
4311
|
+
return React.createElement(UnstyledContent, {
|
4312
|
+
className: className,
|
4313
|
+
placement: props.placement,
|
4314
|
+
ref: ref
|
4315
|
+
}, output, React.createElement(UnstyledArrow, {
|
4316
|
+
className: "text-white"
|
4317
|
+
}));
|
4318
|
+
});
|
4319
|
+
var Close$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4320
|
+
return React.createElement(PopoverPrimitive.Close, Object.assign({}, props, {
|
4321
|
+
ref: ref,
|
4322
|
+
asChild: true
|
4323
|
+
}));
|
4324
|
+
});
|
4325
|
+
var Popover = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4326
|
+
var children = props.children,
|
4327
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
4328
|
+
|
4329
|
+
var context = React.useMemo(function () {
|
4330
|
+
return {
|
4331
|
+
props: otherProps,
|
4332
|
+
ref: ref
|
4333
|
+
};
|
4334
|
+
}, [otherProps]);
|
4335
|
+
return React.createElement(PopoverContext.Provider, {
|
4336
|
+
value: context
|
4337
|
+
}, React.createElement(PopoverPrimitive.Root, {
|
4338
|
+
children: children
|
4339
|
+
}));
|
4340
|
+
});
|
4341
|
+
Popover.Trigger = Trigger$2;
|
4342
|
+
Popover.Content = Content$3;
|
4343
|
+
Popover.Close = Close$2;
|
4344
|
+
|
4345
|
+
var _excluded$d = ["dialog", "hanger", "popover", "tooltip"];
|
4346
|
+
var getButtonClasses = function getButtonClasses() {
|
4347
|
+
return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] leading-6 inline-flex items-center justify-center transition-all delay-100 ease-in border';
|
4348
|
+
};
|
4349
|
+
var getAppearanceClasses = function getAppearanceClasses(value, icon) {
|
4350
|
+
if (icon === void 0) {
|
4351
|
+
icon = false;
|
4352
|
+
}
|
4353
|
+
|
4354
|
+
switch (value) {
|
4355
|
+
case 'primary':
|
4356
|
+
return "yt-blue-solid border-blue\n focus:bg-blue focus:text-white focus:yt-focus\n active:bg-blue-dark active:text-white \n hover:bg-blue-light hover:border-blue-light hover:text-white\n hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white\n disabled:hover:yt-blue-solid";
|
4357
|
+
|
4358
|
+
case 'danger':
|
4359
|
+
return "yt-red-solid border-red\n focus:bg-red focus:text-white focus:yt-focus-red\n active:bg-red-dark active:text-white \n hover:bg-red-light hover:text-white\n hover:focus:bg-red-light hover:focus:text-white\n disabled:hover:yt-red-solid";
|
4360
|
+
|
4361
|
+
case 'ghost':
|
4362
|
+
return "yt-blue-inverted\n focus:bg-transparent focus:text-blue focus:yt-focus\n active:bg-blue-lightest active:border-blue active:text-blue-dark \n hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light\n hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light\n disabled:hover:yt-blue-inverted";
|
4363
|
+
|
4364
|
+
case 'discrete':
|
4365
|
+
{
|
4366
|
+
if (icon) {
|
4367
|
+
return "bg-transparent text-black border-transparent\n focus:text-black focus:yt-focus\n active:text-black\n hover:text-grey-darkest\n hover:focus:text-grey-darkest\n disabled:hover:yt-transparent";
|
4368
|
+
}
|
4369
|
+
|
4370
|
+
return "yt-transparent border-transparent\n focus:text-blue focus:yt-focus\n active:text-blue-dark\n hover:text-blue-light\n hover:focus:text-blue-light\n disabled:hover:yt-transparent";
|
4371
|
+
}
|
4372
|
+
|
4373
|
+
default:
|
4374
|
+
return "yt-grey-solid border-grey\n focus:bg-grey focus:yt-focus\n active:bg-grey-dark active:text-black\n hover:bg-grey-light hover:text-grey-darkest\n hover:focus:bg-grey-light hover:focus:text-grey-darkest\n disabled:hover:yt-grey-solid";
|
4375
|
+
}
|
4376
|
+
};
|
4377
|
+
var createButton = function createButton(props, className, ref) {
|
4378
|
+
var dialog = props.dialog,
|
4379
|
+
hanger = props.hanger,
|
4380
|
+
popover = props.popover,
|
4381
|
+
tooltip = props.tooltip,
|
4382
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$d);
|
4383
|
+
|
4384
|
+
var button = React__default.createElement(Button, Object.assign({}, otherProps, {
|
4385
|
+
className: className,
|
4386
|
+
ref: ref
|
4387
|
+
}));
|
4388
|
+
|
4389
|
+
if (hanger) {
|
4390
|
+
button = React__default.createElement(Hanger, Object.assign({}, hanger.props), React__default.createElement(Hanger.Anchor, null, button), hanger.props.children);
|
4391
|
+
}
|
4392
|
+
|
4393
|
+
if (dialog) {
|
4394
|
+
button = React__default.createElement(Dialog, Object.assign({}, dialog.props), React__default.createElement(Dialog.Trigger, null, button), dialog.props.children);
|
4395
|
+
}
|
4396
|
+
|
4397
|
+
if (popover) {
|
4398
|
+
button = React__default.createElement(Popover, Object.assign({}, popover.props), React__default.createElement(Popover.Trigger, null, button), popover.props.children);
|
4399
|
+
}
|
4400
|
+
|
4401
|
+
if (tooltip) {
|
4402
|
+
button = React__default.createElement(Tooltip, {
|
4403
|
+
title: tooltip
|
4404
|
+
}, button);
|
4405
|
+
}
|
4406
|
+
|
4407
|
+
return button;
|
4408
|
+
};
|
4409
|
+
|
4410
|
+
var _excluded$e = ["appearance", "icon", "rounded"];
|
4411
|
+
var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
4412
|
+
var appearance = props.appearance,
|
4413
|
+
icon = props.icon,
|
4414
|
+
_props$rounded = props.rounded,
|
4415
|
+
rounded = _props$rounded === void 0 ? false : _props$rounded,
|
4416
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
4417
|
+
|
4418
|
+
var className = cn(getButtonClasses(), getAppearanceClasses(appearance, true), {
|
4419
|
+
'rounded-full': rounded,
|
4420
|
+
rounded: !rounded,
|
4421
|
+
'cursor-not-allowed opacity-50': props.disabled,
|
4422
|
+
'focus:yt-focus active:focus:yt-focus': !props.disabled
|
4423
|
+
}, props.className);
|
4424
|
+
|
4425
|
+
if (!icon) {
|
4426
|
+
return null;
|
4427
|
+
}
|
4428
|
+
|
4429
|
+
return createButton(_extends({}, otherProps, {
|
4430
|
+
children: React.createElement(Icon, {
|
4431
|
+
name: icon,
|
4432
|
+
className: "m-0 p-0"
|
4433
|
+
}),
|
4434
|
+
'data-taco': 'icon-button'
|
4435
|
+
}), className, ref);
|
4436
|
+
});
|
4437
|
+
|
4438
|
+
var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
4439
|
+
var children = props.children,
|
4440
|
+
state = props.state,
|
4441
|
+
onClose = props.onClose;
|
4442
|
+
var className = cn('bg-white relative flex items-center px-4 h-12 shadow-lg z-10', props.className);
|
4443
|
+
return React.createElement("div", {
|
4444
|
+
className: className,
|
4445
|
+
"data-taco": "banner",
|
4446
|
+
ref: ref
|
4447
|
+
}, getBannerIcon(state), children, onClose ? React.createElement(IconButton, {
|
4448
|
+
className: "ml-auto",
|
4449
|
+
icon: "close",
|
4450
|
+
appearance: "discrete",
|
4451
|
+
onClick: onClose
|
4452
|
+
}) : null);
|
4453
|
+
});
|
4454
|
+
|
4455
|
+
var _excluded$f = ["appearance", "fluid"];
|
4456
|
+
var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
4457
|
+
var appearance = props.appearance,
|
4458
|
+
fluid = props.fluid,
|
4459
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$f);
|
4460
|
+
|
4461
|
+
var className = cn(getButtonClasses(), getAppearanceClasses(appearance), 'rounded px-3', {
|
4462
|
+
'cursor-not-allowed opacity-50': props.disabled,
|
4463
|
+
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
4464
|
+
'w-full': fluid
|
4465
|
+
}, props.className);
|
4466
|
+
return createButton(_extends({}, otherProps, {
|
4467
|
+
'data-taco': 'button'
|
4468
|
+
}), className, ref);
|
4469
|
+
});
|
4470
|
+
|
4471
|
+
var _excluded$g = ["onChange", "value"];
|
4472
|
+
|
4473
|
+
var renderDay = function renderDay(day, modifiers) {
|
4474
|
+
return modifiers.disabled ? React.createElement("span", {
|
4475
|
+
className: "dot"
|
4476
|
+
}) : day.getDate();
|
4477
|
+
};
|
4478
|
+
|
4479
|
+
var thisYear = /*#__PURE__*/new Date().getFullYear();
|
4480
|
+
var years = [];
|
4481
|
+
|
4482
|
+
for (var i = thisYear - 10; i <= thisYear + 10; i += 1) {
|
4483
|
+
years.push(i);
|
4484
|
+
}
|
4485
|
+
|
4486
|
+
var Navbar = /*#__PURE__*/React.memo(function (_ref) {
|
4487
|
+
var onMonthChange = _ref.onMonthChange,
|
4488
|
+
onNextClick = _ref.onNextClick,
|
4489
|
+
onPreviousClick = _ref.onPreviousClick,
|
4490
|
+
_ref$value = _ref.value,
|
4491
|
+
value = _ref$value === void 0 ? new Date() : _ref$value;
|
4492
|
+
|
4493
|
+
var _useLocalization = useLocalization(),
|
4494
|
+
_useLocalization$text = _useLocalization.texts.calendar,
|
4495
|
+
actions = _useLocalization$text.actions,
|
4496
|
+
months = _useLocalization$text.months;
|
4497
|
+
|
4498
|
+
var handleChange = function handleChange(event) {
|
4499
|
+
var _event$target$form = event.target.form,
|
4500
|
+
year = _event$target$form.year,
|
4501
|
+
month = _event$target$form.month;
|
4502
|
+
onMonthChange(new Date(year.value, month.value));
|
4503
|
+
};
|
4504
|
+
|
4505
|
+
return React.createElement("div", {
|
4506
|
+
className: "flex justify-between items-center mb-2"
|
4507
|
+
}, React.createElement("form", {
|
4508
|
+
className: "inline-flex space-x-1"
|
4509
|
+
}, React.createElement("select", {
|
4510
|
+
className: "h-8 px-2",
|
4511
|
+
name: "month",
|
4512
|
+
onChange: handleChange,
|
4513
|
+
value: value.getMonth()
|
4514
|
+
}, months.map(function (month, i) {
|
4515
|
+
return React.createElement("option", {
|
4516
|
+
value: i
|
4517
|
+
}, month);
|
4518
|
+
})), React.createElement("select", {
|
4519
|
+
className: "h-8 px-2",
|
4520
|
+
name: "year",
|
4521
|
+
onChange: handleChange,
|
4522
|
+
value: value.getFullYear()
|
4523
|
+
}, years.map(function (year) {
|
4524
|
+
return React.createElement("option", {
|
4525
|
+
value: year
|
4526
|
+
}, String(year));
|
4527
|
+
}))), React.createElement("div", null, React.createElement(IconButton, {
|
4528
|
+
appearance: "discrete",
|
4529
|
+
icon: "chevron-left",
|
4530
|
+
"aria-label": actions.previousMonth,
|
4531
|
+
onClick: function onClick() {
|
4532
|
+
return onPreviousClick();
|
4533
|
+
},
|
4534
|
+
rounded: true
|
4535
|
+
}), React.createElement(IconButton, {
|
4536
|
+
appearance: "discrete",
|
4537
|
+
icon: "chevron-right",
|
4538
|
+
"aria-label": actions.nextMonth,
|
4539
|
+
onClick: function onClick() {
|
4540
|
+
return onNextClick();
|
4541
|
+
},
|
4542
|
+
rounded: true
|
4543
|
+
})));
|
4544
|
+
});
|
4545
|
+
var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4546
|
+
var handleChange = props.onChange,
|
4547
|
+
value = props.value,
|
4548
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$g);
|
4549
|
+
|
4550
|
+
var _useLocalization2 = useLocalization(),
|
4551
|
+
locale = _useLocalization2.locale,
|
4552
|
+
texts = _useLocalization2.texts;
|
4553
|
+
|
4554
|
+
var _React$useState = React.useState(value !== null && value !== void 0 ? value : new Date()),
|
4555
|
+
visibleMonth = _React$useState[0],
|
4556
|
+
setVisibleMonth = _React$useState[1];
|
4557
|
+
|
4558
|
+
React.useEffect(function () {
|
4559
|
+
if (visibleMonth !== value) {
|
4560
|
+
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
4561
|
+
}
|
4562
|
+
}, [value]);
|
4563
|
+
|
4564
|
+
var handleDayClick = function handleDayClick(date, modifiers, event) {
|
4565
|
+
if (modifiers.outside || modifiers.disabled) {
|
4566
|
+
return;
|
4567
|
+
}
|
4568
|
+
|
4569
|
+
handleChange(date, event);
|
4570
|
+
};
|
4571
|
+
|
4572
|
+
var handleCalendarClickToday = function handleCalendarClickToday() {
|
4573
|
+
var today = new Date(); // set to midday to avoid UTC offset causing dates to be mismatched server side
|
4574
|
+
|
4575
|
+
today.setHours(12);
|
4576
|
+
today.setMinutes(0);
|
4577
|
+
today.setSeconds(0);
|
4578
|
+
handleChange(today);
|
4579
|
+
};
|
4580
|
+
|
4581
|
+
var className = cn('flex bg-white text-xs p-4', otherProps.className);
|
4582
|
+
return React.createElement("div", {
|
4583
|
+
"data-taco": "calendar"
|
4584
|
+
}, React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
4585
|
+
className: className,
|
4586
|
+
month: visibleMonth,
|
4587
|
+
selectedDays: value,
|
4588
|
+
locale: locale.substring(0, 2),
|
4589
|
+
firstDayOfWeek: 1,
|
4590
|
+
months: texts.calendar.months,
|
4591
|
+
weekdaysShort: texts.calendar.weekdaysShort,
|
4592
|
+
navbarElement: function navbarElement(navProps) {
|
4593
|
+
return React.createElement(Navbar, Object.assign({}, navProps, {
|
4594
|
+
onMonthChange: setVisibleMonth,
|
4595
|
+
value: visibleMonth
|
4596
|
+
}));
|
4597
|
+
},
|
4598
|
+
onDayClick: handleDayClick,
|
4599
|
+
onMonthChange: setVisibleMonth,
|
4600
|
+
onTodayButtonClick: handleCalendarClickToday,
|
4601
|
+
captionElement: function captionElement() {
|
4602
|
+
return null;
|
4603
|
+
},
|
4604
|
+
todayButton: texts.calendar.actions.today,
|
4605
|
+
showOutsideDays: true,
|
4606
|
+
renderDay: renderDay,
|
4607
|
+
numberOfMonths: 1,
|
4608
|
+
ref: ref
|
4609
|
+
})));
|
4610
|
+
});
|
4611
|
+
|
4612
|
+
var _excluded$h = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
|
4613
|
+
var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
4614
|
+
var checked = props.checked,
|
4615
|
+
highlighted = props.highlighted,
|
4616
|
+
indeterminate = props.indeterminate,
|
4617
|
+
invalid = props.invalid,
|
4618
|
+
label = props.label,
|
4619
|
+
onChange = props.onChange,
|
4620
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$h);
|
4621
|
+
|
4622
|
+
var className = cn('h-5 w-5 border rounded text-sm', {
|
4623
|
+
'mr-2': !!label,
|
4624
|
+
'border-grey-dark text-blue focus:border-blue focus:yt-focus': !props.disabled && !invalid,
|
4625
|
+
'border-grey text-blue-light cursor-not-allowed': props.disabled,
|
4626
|
+
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
4627
|
+
'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled
|
4628
|
+
}, props.className);
|
4629
|
+
var handleChange;
|
4630
|
+
|
4631
|
+
if (onChange) {
|
4632
|
+
handleChange = function handleChange(checked) {
|
4633
|
+
return onChange(checked === 'indeterminate' ? false : checked);
|
4634
|
+
};
|
4635
|
+
}
|
4636
|
+
|
4637
|
+
var element = React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, {
|
4638
|
+
"data-taco": "checkbox",
|
4639
|
+
checked: indeterminate ? 'indeterminate' : checked,
|
4640
|
+
className: className,
|
4641
|
+
onCheckedChange: handleChange,
|
4642
|
+
ref: ref
|
4643
|
+
}), React.createElement(CheckboxPrimitive.Indicator, {
|
4644
|
+
className: "flex h-full w-full"
|
4645
|
+
}, React.createElement(Icon, {
|
4646
|
+
name: indeterminate ? 'line' : 'tick',
|
4647
|
+
className: "!h-full !w-full"
|
4648
|
+
})));
|
4649
|
+
|
4650
|
+
if (label) {
|
4651
|
+
var labelClassName = cn('flex items-center cursor-pointer', {
|
4652
|
+
'cursor-not-allowed text-grey-dark': props.disabled
|
4653
|
+
});
|
4654
|
+
return React.createElement("label", {
|
4655
|
+
className: labelClassName
|
4656
|
+
}, element, label);
|
4657
|
+
}
|
4658
|
+
|
4659
|
+
return element;
|
4660
|
+
});
|
4661
|
+
|
4662
|
+
var getInputClasses = function getInputClasses(props) {
|
4663
|
+
var _cn;
|
4664
|
+
|
4665
|
+
return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex leading-6 px-2 relative w-full text-ellipsis transition-all delay-100 ease-in flex items-center', (_cn = {
|
4666
|
+
'cursor-not-allowed text-black bg-grey': props.readOnly,
|
4667
|
+
'border-grey text-opacity-25 cursor-not-allowed': props.disabled
|
4668
|
+
}, _cn[getStateClasses$1(props.state)] = !props.disabled, _cn['bg-[rgba(255,255,0,0.075)]'] = props.highlighted && props.disabled, _cn['bg-[rgba(255,255,0,0.2)]'] = props.highlighted && !props.disabled, _cn));
|
4669
|
+
};
|
4670
|
+
var getStateClasses$1 = function getStateClasses(value) {
|
4671
|
+
switch (value) {
|
4672
|
+
case 'success':
|
4673
|
+
return 'border-green hover:shadow-[0_0_0.15rem_theme(colors.green.DEFAULT)] focus:border-green-light focus:yt-focus-green active:border-green-dark';
|
4674
|
+
|
4675
|
+
case 'error':
|
4676
|
+
return 'border-red hover:shadow-[0_0_0.15rem_theme(colors.red.DEFAULT)] focus:border-red-light focus:yt-focus-red active:border-red-dark';
|
4677
|
+
|
4678
|
+
case 'warning':
|
4679
|
+
return 'border-yellow-dark hover:shadow-[0_0_0.15rem_theme(colors.yellow.dark)] focus:yt-focus-yellow active:border-yellow-dark';
|
4680
|
+
|
4681
|
+
case 'information':
|
4682
|
+
return 'border-blue hover:shadow-[0_0_0.15rem_theme(colors.blue.dark)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
|
4683
|
+
|
4684
|
+
default:
|
4685
|
+
return 'border-grey-dark hover:shadow-[0_0_0.1rem_theme(colors.grey.darker)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
|
4686
|
+
}
|
4687
|
+
};
|
4688
|
+
var getButtonStateClasses = function getButtonStateClasses(value) {
|
4689
|
+
switch (value) {
|
4690
|
+
case 'success':
|
4691
|
+
return '!border-green focus:!border-green-light focus:yt-focus-green peer-focus:!border-green-light peer-focus:peer-active:!border-green-dark';
|
4692
|
+
|
4693
|
+
case 'error':
|
4694
|
+
return '!border-red focus:!border-red-light focus:yt-focus-red peer-focus:!border-red-light peer-focus:peer-active:!border-red-dark';
|
4695
|
+
|
4696
|
+
case 'warning':
|
4697
|
+
return '!border-yellow-dark focus:!border-yellow-dark focus:yt-focus-yellow peer-focus:peer-active:!border-yellow-dark';
|
4698
|
+
|
4699
|
+
case 'information':
|
4700
|
+
return '!border-blue focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4701
|
+
|
4702
|
+
default:
|
4703
|
+
return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4704
|
+
}
|
4705
|
+
};
|
4706
|
+
|
4707
|
+
var _excluded$i = ["button", "defaultValue", "icon", "highlighted", "state", "autoFocus"];
|
4708
|
+
var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
4709
|
+
var button = props.button,
|
4710
|
+
icon = props.icon,
|
4711
|
+
state = props.state,
|
4712
|
+
autoFocus = props.autoFocus,
|
4713
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$i);
|
4714
|
+
|
4715
|
+
var inputRef = useProxiedRef(ref);
|
4716
|
+
var hasContainer = button || icon;
|
4717
|
+
var className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
4718
|
+
'pr-8': !!hasContainer
|
4719
|
+
}, !hasContainer && otherProps.className);
|
4720
|
+
React.useEffect(function () {
|
4721
|
+
if (autoFocus && inputRef.current) {
|
4722
|
+
inputRef.current.focus();
|
4723
|
+
}
|
4724
|
+
}, []);
|
4725
|
+
var input = React.createElement("input", Object.assign({}, otherProps, {
|
4726
|
+
className: className,
|
4727
|
+
"data-taco": "input",
|
4728
|
+
ref: inputRef
|
4729
|
+
}));
|
4730
|
+
|
4731
|
+
if (hasContainer) {
|
4732
|
+
var extra;
|
4733
|
+
|
4734
|
+
if (button) {
|
4735
|
+
var _button$props$disable, _cn;
|
4736
|
+
|
4737
|
+
var disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
|
4738
|
+
var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(state)] = !props.disabled, _cn), button.props.className);
|
4739
|
+
extra = React.cloneElement(button, {
|
4740
|
+
className: buttonClassName,
|
4741
|
+
disabled: disabled
|
4742
|
+
});
|
4743
|
+
} else if (icon) {
|
4744
|
+
var 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', {
|
4745
|
+
'text-grey-dark': props.disabled,
|
4746
|
+
'text-grey-darkest': !props.disabled
|
4747
|
+
});
|
4748
|
+
extra = typeof icon === 'string' ? React.createElement(Icon, {
|
4749
|
+
className: iconClassName,
|
4750
|
+
name: icon
|
4751
|
+
}) : React.cloneElement(icon, {
|
4752
|
+
className: cn(iconClassName, icon.props.className)
|
4753
|
+
});
|
4754
|
+
}
|
4755
|
+
|
4756
|
+
var containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
|
4757
|
+
return React.createElement("div", {
|
4758
|
+
className: containerClassName,
|
4759
|
+
"data-taco": "input-container"
|
4760
|
+
}, input, extra);
|
4761
|
+
}
|
4762
|
+
|
4763
|
+
return input;
|
4764
|
+
});
|
4765
|
+
|
4766
|
+
var getNextIndexFromKeycode = function getNextIndexFromKeycode(keyCode, length, index, direction) {
|
4767
|
+
if (direction === void 0) {
|
4768
|
+
direction = 'vertical';
|
4769
|
+
}
|
4770
|
+
|
4771
|
+
var previousKey = direction === 'horizontal' ? 'left' : 'up';
|
4772
|
+
var nextKey = direction === 'horizontal' ? 'right' : 'down';
|
4773
|
+
|
4774
|
+
switch (keyCode) {
|
4775
|
+
case keycode(previousKey):
|
4776
|
+
return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
|
4777
|
+
|
4778
|
+
case keycode(nextKey):
|
4779
|
+
return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
|
4780
|
+
|
4781
|
+
case keycode('home'):
|
4782
|
+
return 0;
|
4783
|
+
|
4784
|
+
case keycode('end'):
|
4785
|
+
return length - 1;
|
4786
|
+
|
4787
|
+
default:
|
4788
|
+
return;
|
4789
|
+
}
|
4790
|
+
};
|
4791
|
+
var useListKeyboardNavigation = function useListKeyboardNavigation(length, options) {
|
4792
|
+
if (length === void 0) {
|
4793
|
+
length = 0;
|
4794
|
+
}
|
4795
|
+
|
4796
|
+
if (options === void 0) {
|
4797
|
+
options = {
|
4798
|
+
direction: 'vertical'
|
4799
|
+
};
|
4800
|
+
}
|
4801
|
+
|
4802
|
+
var _React$useState = React__default.useState(options.initialIndex),
|
4803
|
+
index = _React$useState[0],
|
4804
|
+
setIndex = _React$useState[1];
|
4805
|
+
|
4806
|
+
var getNextIndex = function getNextIndex(event) {
|
4807
|
+
var nextIndex = getNextIndexFromKeycode(event.keyCode, length, index, options.direction);
|
4808
|
+
|
4809
|
+
if (nextIndex !== undefined) {
|
4810
|
+
event.preventDefault();
|
4811
|
+
}
|
4812
|
+
|
4813
|
+
return nextIndex;
|
4814
|
+
};
|
4815
|
+
|
4816
|
+
return [index, setIndex, getNextIndex];
|
4817
|
+
};
|
4818
|
+
|
4819
|
+
var scrollToChildElement = function scrollToChildElement(parent, child) {
|
4820
|
+
var clientHeight = parent.clientHeight;
|
4821
|
+
|
4822
|
+
if (parent.scrollHeight > clientHeight) {
|
4823
|
+
var scrollTop = parent.scrollTop;
|
4824
|
+
var scrollBottom = clientHeight + scrollTop;
|
4825
|
+
var childBottom = child.offsetTop + child.offsetHeight;
|
4826
|
+
|
4827
|
+
if (childBottom > scrollBottom) {
|
4828
|
+
parent.scrollTop = childBottom - clientHeight;
|
4829
|
+
} else if (child.offsetTop < scrollTop) {
|
4830
|
+
parent.scrollTop = child.offsetTop;
|
4831
|
+
}
|
4832
|
+
}
|
4833
|
+
};
|
4834
|
+
|
4835
|
+
var useListScrollTo = function useListScrollTo(internalRef, itemRefs) {
|
4836
|
+
var scrollTo = function scrollTo(index) {
|
4837
|
+
if (internalRef && internalRef.current) {
|
4838
|
+
if (index !== undefined) {
|
4839
|
+
var activeRef = itemRefs[index];
|
4840
|
+
|
4841
|
+
if (activeRef && activeRef.current) {
|
4842
|
+
scrollToChildElement(internalRef.current, activeRef.current);
|
4843
|
+
}
|
4844
|
+
} else {
|
4845
|
+
internalRef.current.scrollTop = 0;
|
4846
|
+
}
|
4847
|
+
}
|
4848
|
+
};
|
4849
|
+
|
4850
|
+
return {
|
4851
|
+
scrollTo: scrollTo
|
4852
|
+
};
|
4853
|
+
};
|
4854
|
+
|
4855
|
+
var _excluded$j = ["data", "disabled", "highlighted", "id", "loading", "onChange", "onClick", "onFocus", "onKeyDown", "readOnly", "scrollOnFocus", "state", "value", "multiselect", "selectedIndexes", "allOptionsSelected"],
|
4856
|
+
_excluded2$1 = ["children", "icon"];
|
4857
|
+
var getId = function getId(id, value) {
|
4858
|
+
return id + "_" + value;
|
4859
|
+
};
|
4860
|
+
|
4861
|
+
var getNextEnabledItem = function getNextEnabledItem(event, data, index) {
|
4862
|
+
var nextIndex = getNextIndexFromKeycode(event.keyCode, data.length, index);
|
4863
|
+
|
4864
|
+
if (nextIndex) {
|
4865
|
+
if (nextIndex === index) {
|
4866
|
+
return index;
|
4867
|
+
} else if (data[nextIndex] && data[nextIndex].disabled) {
|
4868
|
+
return getNextEnabledItem(event, data, nextIndex);
|
4869
|
+
}
|
4870
|
+
}
|
4871
|
+
|
4872
|
+
return nextIndex;
|
4873
|
+
};
|
4874
|
+
|
4875
|
+
var ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(props, ref) {
|
4876
|
+
var data = props.data,
|
4877
|
+
disabled = props.disabled,
|
4878
|
+
id = props.id,
|
4879
|
+
loading = props.loading,
|
4880
|
+
setCurrentIndex = props.onChange,
|
4342
4881
|
onClick = props.onClick,
|
4343
4882
|
onFocus = props.onFocus,
|
4344
4883
|
onKeyDown = props.onKeyDown,
|
@@ -4351,7 +4890,7 @@ var ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(props
|
|
4351
4890
|
selectedIndexes = _props$selectedIndexe === void 0 ? [] : _props$selectedIndexe,
|
4352
4891
|
_props$allOptionsSele = props.allOptionsSelected,
|
4353
4892
|
allOptionsSelected = _props$allOptionsSele === void 0 ? false : _props$allOptionsSele,
|
4354
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
4893
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$j);
|
4355
4894
|
|
4356
4895
|
var listRef = useProxiedRef(ref);
|
4357
4896
|
var itemRefs = React.useMemo(function () {
|
@@ -4531,7 +5070,7 @@ var setInputValueByRef = function setInputValueByRef(input, value, event) {
|
|
4531
5070
|
input.dispatchEvent(createCustomEvent(event));
|
4532
5071
|
};
|
4533
5072
|
|
4534
|
-
var _excluded$
|
5073
|
+
var _excluded$k = ["hasChildren", "path"];
|
4535
5074
|
var setInputValueByRef$1 = function setInputValueByRef$1(input, value, event) {
|
4536
5075
|
if (event === void 0) {
|
4537
5076
|
event = 'change';
|
@@ -4649,1087 +5188,677 @@ var useFlattenedData = function useFlattenedData(data) {
|
|
4649
5188
|
};
|
4650
5189
|
var sanitizeItem = function sanitizeItem(item) {
|
4651
5190
|
if (item) {
|
4652
|
-
var rest = _objectWithoutPropertiesLoose(item, _excluded$
|
4653
|
-
|
4654
|
-
return rest;
|
4655
|
-
}
|
4656
|
-
|
4657
|
-
return undefined;
|
4658
|
-
};
|
4659
|
-
var getOptionParents = function getOptionParents(data, path) {
|
4660
|
-
var _path$split;
|
4661
|
-
|
4662
|
-
var indexes = (_path$split = path === null || path === void 0 ? void 0 : path.split('.')) !== null && _path$split !== void 0 ? _path$split : [];
|
4663
|
-
|
4664
|
-
if (indexes.length > 1) {
|
4665
|
-
// we don't want to map the current item
|
4666
|
-
indexes.pop(); // we need to rebuild the path as we map
|
4667
|
-
|
4668
|
-
var lastPath;
|
4669
|
-
return indexes.map(function (i) {
|
4670
|
-
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
4671
|
-
return sanitizeItem(data.find(function (i) {
|
4672
|
-
return i.path === lastPath;
|
4673
|
-
}));
|
4674
|
-
});
|
4675
|
-
}
|
4676
|
-
|
4677
|
-
return null;
|
4678
|
-
};
|
4679
|
-
var filterData = function filterData(data, value) {
|
4680
|
-
if (value === void 0) {
|
4681
|
-
value = '';
|
4682
|
-
}
|
4683
|
-
|
4684
|
-
if (value === '' || value === null) {
|
4685
|
-
return data;
|
4686
|
-
}
|
4687
|
-
|
4688
|
-
var filteredOptionValues = new Set();
|
4689
|
-
|
4690
|
-
var shouldFilterOption = function shouldFilterOption(option) {
|
4691
|
-
if (option.disabled) {
|
4692
|
-
return false;
|
4693
|
-
}
|
4694
|
-
|
4695
|
-
return searchForString(option.text, String(value));
|
4696
|
-
};
|
4697
|
-
|
4698
|
-
data.forEach(function (option) {
|
4699
|
-
if (shouldFilterOption(option)) {
|
4700
|
-
var parents = getOptionParents(data, option.path);
|
4701
|
-
filteredOptionValues.add(option.value);
|
4702
|
-
|
4703
|
-
if (parents !== null) {
|
4704
|
-
parents.forEach(function (option) {
|
4705
|
-
return filteredOptionValues.add(option === null || option === void 0 ? void 0 : option.value);
|
4706
|
-
});
|
4707
|
-
}
|
4708
|
-
}
|
4709
|
-
});
|
4710
|
-
return data.filter(function (_ref) {
|
4711
|
-
var value = _ref.value;
|
4712
|
-
return filteredOptionValues.has(value);
|
4713
|
-
});
|
4714
|
-
};
|
4715
|
-
|
4716
|
-
var _excluded$f = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "id", "inline", "loading", "onChange", "onClick", "onKeyDown", "readOnly", "value"];
|
4717
|
-
|
4718
|
-
var convertToInputValue = function convertToInputValue(value) {
|
4719
|
-
return String(value !== null && value !== void 0 ? value : '');
|
4720
|
-
};
|
4721
|
-
|
4722
|
-
var useCombobox = function useCombobox(_ref, ref) {
|
4723
|
-
var ariaLabel = _ref['aria-label'],
|
4724
|
-
ariaLabelledBy = _ref['aria-labelledby'],
|
4725
|
-
_ref$data = _ref.data,
|
4726
|
-
unfilteredData = _ref$data === void 0 ? [] : _ref$data,
|
4727
|
-
defaultValue = _ref.defaultValue,
|
4728
|
-
disabled = _ref.disabled,
|
4729
|
-
inline = _ref.inline,
|
4730
|
-
onChange = _ref.onChange,
|
4731
|
-
onClick = _ref.onClick,
|
4732
|
-
onKeyDown = _ref.onKeyDown,
|
4733
|
-
readOnly = _ref.readOnly,
|
4734
|
-
value = _ref.value,
|
4735
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
4736
|
-
|
4737
|
-
var inputRef = useProxiedRef(ref);
|
4738
|
-
var listRef = React.useRef(null);
|
4739
|
-
var popover = Popover$1.usePopoverState({
|
4740
|
-
gutter: 4,
|
4741
|
-
placement: 'bottom-start'
|
4742
|
-
});
|
4743
|
-
var listId = React.useMemo(function () {
|
4744
|
-
return uuid.v4();
|
4745
|
-
}, []);
|
4746
|
-
|
4747
|
-
var _React$useState = React.useState(convertToInputValue(value)),
|
4748
|
-
inputValue = _React$useState[0],
|
4749
|
-
setInputValue = _React$useState[1];
|
4750
|
-
|
4751
|
-
var shouldFilterData = !inline || inline && inputValue !== convertToInputValue(value);
|
4752
|
-
var flattenedData = useFlattenedData(unfilteredData);
|
4753
|
-
var data = React.useMemo(function () {
|
4754
|
-
return shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData;
|
4755
|
-
}, [shouldFilterData, inputValue, flattenedData]); // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state
|
4756
|
-
|
4757
|
-
var _React$useState2 = React.useState(inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined),
|
4758
|
-
currentIndex = _React$useState2[0],
|
4759
|
-
setCurrentIndex = _React$useState2[1];
|
4760
|
-
|
4761
|
-
var setInputValueByIndex = function setInputValueByIndex(index) {
|
4762
|
-
if (index !== undefined) {
|
4763
|
-
var option = data[index];
|
4764
|
-
|
4765
|
-
if (option && !option.disabled) {
|
4766
|
-
setInputValueByRef$1(inputRef.current, option.value, 'focusout');
|
4767
|
-
}
|
4768
|
-
}
|
4769
|
-
};
|
5191
|
+
var rest = _objectWithoutPropertiesLoose(item, _excluded$k);
|
4770
5192
|
|
4771
|
-
|
4772
|
-
|
4773
|
-
return;
|
4774
|
-
}
|
4775
|
-
|
4776
|
-
var option = data[index]; // if the selected option is not already selected, trigger blur event
|
4777
|
-
|
4778
|
-
if (option.value !== value) {
|
4779
|
-
setInputValueByIndex(index);
|
4780
|
-
} else {
|
4781
|
-
// if the selected option is already selected, refill input with its value
|
4782
|
-
setInputValue(convertToInputValue(value));
|
4783
|
-
}
|
4784
|
-
}; // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set
|
4785
|
-
|
4786
|
-
|
4787
|
-
React.useEffect(function () {
|
4788
|
-
if (defaultValue && !value) {
|
4789
|
-
setInputValueByIndex(getIndexFromValue(data, defaultValue));
|
4790
|
-
}
|
4791
|
-
}, [data]); // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc
|
4792
|
-
|
4793
|
-
React.useEffect(function () {
|
4794
|
-
if (value !== undefined && value !== inputValue) {
|
4795
|
-
setInputValue(convertToInputValue(value));
|
4796
|
-
}
|
4797
|
-
}, [value]); // show listbox based on input value
|
4798
|
-
|
4799
|
-
React.useEffect(function () {
|
4800
|
-
// don't show the popover if the internal (input) value already is the current value
|
4801
|
-
// this prevents the popover showing after selecting a value or pressing escape
|
4802
|
-
var isCurrentValue = value !== undefined && value !== null && inputValue === String(value);
|
4803
|
-
|
4804
|
-
if (inputValue && data.length && !isCurrentValue) {
|
4805
|
-
setCurrentIndex(0);
|
4806
|
-
|
4807
|
-
if (!popover.visible) {
|
4808
|
-
popover.show();
|
4809
|
-
}
|
4810
|
-
} else {
|
4811
|
-
popover.hide();
|
4812
|
-
}
|
4813
|
-
}, [inputValue, data]);
|
4814
|
-
React.useEffect(function () {
|
4815
|
-
if (popover.visible) {
|
4816
|
-
setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
|
4817
|
-
} else {
|
4818
|
-
setCurrentIndex(undefined);
|
4819
|
-
}
|
4820
|
-
}, [popover.visible]); // event handlers
|
4821
|
-
|
4822
|
-
var handleInputBlur = function handleInputBlur(event) {
|
4823
|
-
event.persist();
|
4824
|
-
|
4825
|
-
if (event.relatedTarget === listRef.current) {
|
4826
|
-
event.preventDefault();
|
4827
|
-
return;
|
4828
|
-
}
|
4829
|
-
|
4830
|
-
if (onChange && event.target.value !== value) {
|
4831
|
-
var item = findByValue(flattenedData, event.target.value);
|
4832
|
-
event.detail = sanitizeItem(item);
|
4833
|
-
var parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
4834
|
-
|
4835
|
-
if (parents !== null && parents.length > 0) {
|
4836
|
-
event.detail.parents = parents;
|
4837
|
-
}
|
4838
|
-
|
4839
|
-
onChange(event);
|
4840
|
-
}
|
4841
|
-
|
4842
|
-
if (props.onBlur) {
|
4843
|
-
props.onBlur(event);
|
4844
|
-
}
|
4845
|
-
};
|
4846
|
-
|
4847
|
-
var handleInputChange = function handleInputChange(event) {
|
4848
|
-
setInputValue(event.target.value);
|
4849
|
-
};
|
4850
|
-
|
4851
|
-
var handleInputClick = function handleInputClick(event) {
|
4852
|
-
if (inline || !popover.visible && inputValue && data.length) {
|
4853
|
-
popover.show();
|
4854
|
-
}
|
4855
|
-
|
4856
|
-
if (onClick) {
|
4857
|
-
event.persist();
|
4858
|
-
onClick(event);
|
4859
|
-
}
|
4860
|
-
};
|
4861
|
-
|
4862
|
-
var handleInputKeyDown = function handleInputKeyDown(event) {
|
4863
|
-
event.persist();
|
4864
|
-
|
4865
|
-
switch (event.keyCode) {
|
4866
|
-
case keycode('backspace'):
|
4867
|
-
{
|
4868
|
-
return;
|
4869
|
-
}
|
4870
|
-
|
4871
|
-
case keycode('escape'):
|
4872
|
-
{
|
4873
|
-
event.preventDefault();
|
4874
|
-
setInputValue(convertToInputValue(value));
|
4875
|
-
popover.hide();
|
4876
|
-
return;
|
4877
|
-
}
|
4878
|
-
|
4879
|
-
case keycode('tab'):
|
4880
|
-
case keycode('enter'):
|
4881
|
-
{
|
4882
|
-
if (event.keyCode !== keycode('tab')) {
|
4883
|
-
event.preventDefault();
|
4884
|
-
}
|
4885
|
-
|
4886
|
-
setCurrentValue(currentIndex);
|
4887
|
-
popover.hide();
|
4888
|
-
return;
|
4889
|
-
}
|
4890
|
-
|
4891
|
-
case keycode('up'):
|
4892
|
-
case keycode('down'):
|
4893
|
-
case keycode('home'):
|
4894
|
-
case keycode('end'):
|
4895
|
-
{
|
4896
|
-
if (popover.visible) {
|
4897
|
-
event.preventDefault();
|
4898
|
-
}
|
5193
|
+
return rest;
|
5194
|
+
}
|
4899
5195
|
|
4900
|
-
|
4901
|
-
|
4902
|
-
|
5196
|
+
return undefined;
|
5197
|
+
};
|
5198
|
+
var getOptionParents = function getOptionParents(data, path) {
|
5199
|
+
var _path$split;
|
4903
5200
|
|
5201
|
+
var indexes = (_path$split = path === null || path === void 0 ? void 0 : path.split('.')) !== null && _path$split !== void 0 ? _path$split : [];
|
4904
5202
|
|
4905
|
-
|
4906
|
-
|
4907
|
-
|
5203
|
+
if (indexes.length > 1) {
|
5204
|
+
// we don't want to map the current item
|
5205
|
+
indexes.pop(); // we need to rebuild the path as we map
|
4908
5206
|
|
4909
|
-
|
4910
|
-
|
4911
|
-
|
4912
|
-
|
4913
|
-
|
4914
|
-
|
4915
|
-
|
4916
|
-
|
5207
|
+
var lastPath;
|
5208
|
+
return indexes.map(function (i) {
|
5209
|
+
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
5210
|
+
return sanitizeItem(data.find(function (i) {
|
5211
|
+
return i.path === lastPath;
|
5212
|
+
}));
|
5213
|
+
});
|
5214
|
+
}
|
4917
5215
|
|
4918
|
-
|
4919
|
-
|
4920
|
-
|
4921
|
-
|
4922
|
-
|
5216
|
+
return null;
|
5217
|
+
};
|
5218
|
+
var filterData = function filterData(data, value) {
|
5219
|
+
if (value === void 0) {
|
5220
|
+
value = '';
|
5221
|
+
}
|
4923
5222
|
|
4924
|
-
|
4925
|
-
|
4926
|
-
}
|
5223
|
+
if (value === '' || value === null) {
|
5224
|
+
return data;
|
5225
|
+
}
|
4927
5226
|
|
4928
|
-
var
|
4929
|
-
event.preventDefault();
|
4930
|
-
setCurrentValue(index);
|
4931
|
-
popover.hide();
|
4932
|
-
};
|
5227
|
+
var filteredOptionValues = new Set();
|
4933
5228
|
|
4934
|
-
var
|
4935
|
-
|
4936
|
-
|
4937
|
-
|
4938
|
-
|
5229
|
+
var shouldFilterOption = function shouldFilterOption(option) {
|
5230
|
+
if (option.disabled) {
|
5231
|
+
return false;
|
5232
|
+
}
|
5233
|
+
|
5234
|
+
return searchForString(option.text, String(value));
|
4939
5235
|
};
|
4940
5236
|
|
4941
|
-
|
4942
|
-
|
4943
|
-
|
4944
|
-
|
4945
|
-
'aria-autocomplete': 'list',
|
4946
|
-
// Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element
|
4947
|
-
'aria-activedescendant': currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,
|
4948
|
-
'aria-labelledby': ariaLabelledBy,
|
4949
|
-
disabled: disabled,
|
4950
|
-
onBlur: !disabled && !readOnly ? handleInputBlur : undefined,
|
4951
|
-
onChange: !disabled && !readOnly ? handleInputChange : undefined,
|
4952
|
-
onClick: !disabled && !readOnly ? handleInputClick : undefined,
|
4953
|
-
onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,
|
4954
|
-
readOnly: readOnly,
|
4955
|
-
ref: inputRef,
|
4956
|
-
type: 'text',
|
4957
|
-
value: inputValue || ''
|
4958
|
-
});
|
5237
|
+
data.forEach(function (option) {
|
5238
|
+
if (shouldFilterOption(option)) {
|
5239
|
+
var parents = getOptionParents(data, option.path);
|
5240
|
+
filteredOptionValues.add(option.value);
|
4959
5241
|
|
4960
|
-
|
4961
|
-
|
4962
|
-
|
4963
|
-
|
4964
|
-
id: listId,
|
4965
|
-
onChange: handleListboxChange,
|
4966
|
-
onClick: handleListboxClick,
|
4967
|
-
ref: listRef,
|
4968
|
-
scrollOnFocus: false,
|
4969
|
-
tabIndex: -1,
|
4970
|
-
value: currentIndex
|
4971
|
-
};
|
4972
|
-
return {
|
4973
|
-
combobox: combobox,
|
4974
|
-
input: input,
|
4975
|
-
list: list,
|
4976
|
-
popover: _extends({}, popover, {
|
4977
|
-
visible: !data.length ? false : popover.visible,
|
4978
|
-
container: {
|
4979
|
-
tabIndex: -1,
|
4980
|
-
'aria-label': ariaLabel,
|
4981
|
-
'aria-labelledby': ariaLabelledBy,
|
4982
|
-
unstable_initialFocusRef: inputRef
|
5242
|
+
if (parents !== null) {
|
5243
|
+
parents.forEach(function (option) {
|
5244
|
+
return filteredOptionValues.add(option === null || option === void 0 ? void 0 : option.value);
|
5245
|
+
});
|
4983
5246
|
}
|
4984
|
-
}
|
4985
|
-
};
|
5247
|
+
}
|
5248
|
+
});
|
5249
|
+
return data.filter(function (_ref) {
|
5250
|
+
var value = _ref.value;
|
5251
|
+
return filteredOptionValues.has(value);
|
5252
|
+
});
|
4986
5253
|
};
|
4987
5254
|
|
4988
|
-
var
|
4989
|
-
|
5255
|
+
var _excluded$l = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "id", "inline", "loading", "onChange", "onClick", "onKeyDown", "readOnly", "value"];
|
5256
|
+
|
5257
|
+
var convertToInputValue = function convertToInputValue(value) {
|
5258
|
+
return String(value !== null && value !== void 0 ? value : '');
|
4990
5259
|
};
|
4991
5260
|
|
4992
|
-
var
|
4993
|
-
var
|
4994
|
-
|
4995
|
-
|
5261
|
+
var useCombobox = function useCombobox(_ref, ref) {
|
5262
|
+
var ariaLabel = _ref['aria-label'],
|
5263
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
5264
|
+
_ref$data = _ref.data,
|
5265
|
+
unfilteredData = _ref$data === void 0 ? [] : _ref$data,
|
5266
|
+
defaultValue = _ref.defaultValue,
|
5267
|
+
disabled = _ref.disabled,
|
5268
|
+
inline = _ref.inline,
|
5269
|
+
onChange = _ref.onChange,
|
5270
|
+
onClick = _ref.onClick,
|
5271
|
+
onKeyDown = _ref.onKeyDown,
|
5272
|
+
readOnly = _ref.readOnly,
|
5273
|
+
value = _ref.value,
|
5274
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
4996
5275
|
|
4997
|
-
var
|
5276
|
+
var inputRef = useProxiedRef(ref);
|
5277
|
+
var listRef = React.useRef(null);
|
5278
|
+
var popover = Popover$1.usePopoverState({
|
5279
|
+
gutter: 4,
|
5280
|
+
placement: 'bottom-start'
|
5281
|
+
});
|
5282
|
+
var listId = React.useMemo(function () {
|
5283
|
+
return uuid.v4();
|
5284
|
+
}, []);
|
4998
5285
|
|
4999
|
-
var _React$
|
5000
|
-
|
5001
|
-
|
5286
|
+
var _React$useState = React.useState(convertToInputValue(value)),
|
5287
|
+
inputValue = _React$useState[0],
|
5288
|
+
setInputValue = _React$useState[1];
|
5002
5289
|
|
5003
|
-
var
|
5004
|
-
|
5005
|
-
|
5290
|
+
var shouldFilterData = !inline || inline && inputValue !== convertToInputValue(value);
|
5291
|
+
var flattenedData = useFlattenedData(unfilteredData);
|
5292
|
+
var data = React.useMemo(function () {
|
5293
|
+
return shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData;
|
5294
|
+
}, [shouldFilterData, inputValue, flattenedData]); // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state
|
5006
5295
|
|
5007
|
-
|
5008
|
-
|
5009
|
-
|
5296
|
+
var _React$useState2 = React.useState(inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined),
|
5297
|
+
currentIndex = _React$useState2[0],
|
5298
|
+
setCurrentIndex = _React$useState2[1];
|
5010
5299
|
|
5011
|
-
|
5012
|
-
|
5013
|
-
|
5014
|
-
window.addEventListener('resize', debouncedResize);
|
5015
|
-
return function () {
|
5016
|
-
clearTimeout(timeout);
|
5017
|
-
window.removeEventListener('resize', debouncedResize);
|
5018
|
-
};
|
5019
|
-
}, [ref.current, visibility]);
|
5020
|
-
React.useEffect(function () {
|
5021
|
-
var newRefElementVisibility = getVisibility(ref.current);
|
5300
|
+
var setInputValueByIndex = function setInputValueByIndex(index) {
|
5301
|
+
if (index !== undefined) {
|
5302
|
+
var option = data[index];
|
5022
5303
|
|
5023
|
-
|
5024
|
-
|
5025
|
-
|
5026
|
-
// the consumer to rerender and that will cause the above hook to recalculate the dimensions
|
5027
|
-
setVisibility(newRefElementVisibility);
|
5304
|
+
if (option && !option.disabled) {
|
5305
|
+
setInputValueByRef$1(inputRef.current, option.value, 'focusout');
|
5306
|
+
}
|
5028
5307
|
}
|
5029
|
-
}
|
5030
|
-
return dimensions;
|
5031
|
-
};
|
5032
|
-
|
5033
|
-
var _excluded$g = ["className", "style"],
|
5034
|
-
_excluded2$2 = ["container"];
|
5035
|
-
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5036
|
-
var externalClassName = props.className,
|
5037
|
-
style = props.style,
|
5038
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$g);
|
5308
|
+
};
|
5039
5309
|
|
5040
|
-
var
|
5041
|
-
|
5042
|
-
|
5043
|
-
|
5044
|
-
list = _useCombobox.list;
|
5310
|
+
var setCurrentValue = function setCurrentValue(index) {
|
5311
|
+
if (index === undefined) {
|
5312
|
+
return;
|
5313
|
+
}
|
5045
5314
|
|
5046
|
-
|
5047
|
-
base = _objectWithoutPropertiesLoose(popover, _excluded2$2);
|
5315
|
+
var option = data[index]; // if the selected option is not already selected, trigger blur event
|
5048
5316
|
|
5049
|
-
|
5050
|
-
|
5051
|
-
|
5052
|
-
|
5053
|
-
|
5054
|
-
|
5055
|
-
|
5056
|
-
"data-taco": "combobox",
|
5057
|
-
style: style
|
5058
|
-
}, React.createElement(Popover$1.PopoverDisclosure, Object.assign({}, base, {
|
5059
|
-
ref: internalRef
|
5060
|
-
}), function (_ref) {
|
5061
|
-
var ref = _ref.ref;
|
5062
|
-
return React.createElement("span", Object.assign({}, combobox, {
|
5063
|
-
className: "w-full",
|
5064
|
-
ref: ref
|
5065
|
-
}), React.createElement(Input, Object.assign({}, input, {
|
5066
|
-
autoComplete: "off",
|
5067
|
-
button: props.inline ? React.createElement(IconButton, {
|
5068
|
-
icon: popover.visible ? 'chevron-up' : 'chevron-down',
|
5069
|
-
onClick: popover.toggle,
|
5070
|
-
tabIndex: -1
|
5071
|
-
}) : props.button
|
5072
|
-
})));
|
5073
|
-
}), !otherProps.disabled && React.createElement(Popover$1.Popover, Object.assign({}, base, container), React.createElement(ScrollableList, Object.assign({}, list, {
|
5074
|
-
className: cn('border-blue w-auto max-w-[theme(spacing.96)] max-h-[calc(12rem+2px)]'),
|
5075
|
-
style: {
|
5076
|
-
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
5077
|
-
},
|
5078
|
-
tabIndex: popover.visible ? 0 : -1
|
5079
|
-
}))));
|
5080
|
-
});
|
5317
|
+
if (option.value !== value) {
|
5318
|
+
setInputValueByIndex(index);
|
5319
|
+
} else {
|
5320
|
+
// if the selected option is already selected, refill input with its value
|
5321
|
+
setInputValue(convertToInputValue(value));
|
5322
|
+
}
|
5323
|
+
}; // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set
|
5081
5324
|
|
5082
|
-
var format = function format(date, mask) {
|
5083
|
-
if (mask === void 0) {
|
5084
|
-
mask = 'dd.mm.yy';
|
5085
|
-
}
|
5086
5325
|
|
5087
|
-
|
5088
|
-
|
5089
|
-
|
5326
|
+
React.useEffect(function () {
|
5327
|
+
if (defaultValue && !value) {
|
5328
|
+
setInputValueByIndex(getIndexFromValue(data, defaultValue));
|
5329
|
+
}
|
5330
|
+
}, [data]); // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc
|
5090
5331
|
|
5091
|
-
|
5332
|
+
React.useEffect(function () {
|
5333
|
+
if (value !== undefined && value !== inputValue) {
|
5334
|
+
setInputValue(convertToInputValue(value));
|
5335
|
+
}
|
5336
|
+
}, [value]); // show listbox based on input value
|
5092
5337
|
|
5093
|
-
|
5094
|
-
|
5095
|
-
|
5338
|
+
React.useEffect(function () {
|
5339
|
+
// don't show the popover if the internal (input) value already is the current value
|
5340
|
+
// this prevents the popover showing after selecting a value or pressing escape
|
5341
|
+
var isCurrentValue = value !== undefined && value !== null && inputValue === String(value);
|
5096
5342
|
|
5097
|
-
|
5098
|
-
|
5099
|
-
};
|
5343
|
+
if (inputValue && data.length && !isCurrentValue) {
|
5344
|
+
setCurrentIndex(0);
|
5100
5345
|
|
5101
|
-
|
5102
|
-
|
5103
|
-
|
5104
|
-
|
5105
|
-
|
5106
|
-
|
5346
|
+
if (!popover.visible) {
|
5347
|
+
popover.show();
|
5348
|
+
}
|
5349
|
+
} else {
|
5350
|
+
popover.hide();
|
5351
|
+
}
|
5352
|
+
}, [inputValue, data]);
|
5353
|
+
React.useEffect(function () {
|
5354
|
+
if (popover.visible) {
|
5355
|
+
setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
|
5356
|
+
} else {
|
5357
|
+
setCurrentIndex(undefined);
|
5358
|
+
}
|
5359
|
+
}, [popover.visible]); // event handlers
|
5107
5360
|
|
5108
|
-
|
5109
|
-
|
5110
|
-
}
|
5361
|
+
var handleInputBlur = function handleInputBlur(event) {
|
5362
|
+
event.persist();
|
5111
5363
|
|
5112
|
-
|
5113
|
-
|
5114
|
-
|
5364
|
+
if (event.relatedTarget === listRef.current) {
|
5365
|
+
event.preventDefault();
|
5366
|
+
return;
|
5367
|
+
}
|
5115
5368
|
|
5116
|
-
|
5117
|
-
|
5118
|
-
|
5119
|
-
|
5120
|
-
var mm = sanitizedMask.findIndex(function (x) {
|
5121
|
-
return x === 'mm';
|
5122
|
-
});
|
5123
|
-
var yy = sanitizedMask.findIndex(function (x) {
|
5124
|
-
return x === 'yy' || x === 'yyyy';
|
5125
|
-
});
|
5126
|
-
var day;
|
5127
|
-
var month;
|
5128
|
-
var year;
|
5369
|
+
if (onChange && event.target.value !== value) {
|
5370
|
+
var item = findByValue(flattenedData, event.target.value);
|
5371
|
+
event.detail = sanitizeItem(item);
|
5372
|
+
var parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
5129
5373
|
|
5130
|
-
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5374
|
+
if (parents !== null && parents.length > 0) {
|
5375
|
+
event.detail.parents = parents;
|
5376
|
+
}
|
5377
|
+
|
5378
|
+
onChange(event);
|
5134
5379
|
}
|
5135
5380
|
|
5136
|
-
|
5381
|
+
if (props.onBlur) {
|
5382
|
+
props.onBlur(event);
|
5383
|
+
}
|
5137
5384
|
};
|
5138
5385
|
|
5139
|
-
var
|
5386
|
+
var handleInputChange = function handleInputChange(event) {
|
5387
|
+
setInputValue(event.target.value);
|
5388
|
+
};
|
5140
5389
|
|
5141
|
-
|
5142
|
-
|
5143
|
-
|
5144
|
-
|
5145
|
-
month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);
|
5146
|
-
year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years
|
5147
|
-
} else {
|
5148
|
-
day = inputParts[dd];
|
5149
|
-
month = inputParts[mm];
|
5150
|
-
year = getFullYear(inputParts[yy]);
|
5151
|
-
}
|
5390
|
+
var handleInputClick = function handleInputClick(event) {
|
5391
|
+
if (inline || !popover.visible && inputValue && data.length) {
|
5392
|
+
popover.show();
|
5393
|
+
}
|
5152
5394
|
|
5153
|
-
|
5154
|
-
|
5155
|
-
|
5156
|
-
|
5157
|
-
|
5158
|
-
/* year */
|
5159
|
-
Object.is(year, NaN) ? currentDate.getFullYear() : year,
|
5160
|
-
/* month */
|
5161
|
-
Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day
|
5395
|
+
if (onClick) {
|
5396
|
+
event.persist();
|
5397
|
+
onClick(event);
|
5398
|
+
}
|
5399
|
+
};
|
5162
5400
|
|
5163
|
-
|
5164
|
-
|
5165
|
-
/* hours */
|
5166
|
-
12,
|
5167
|
-
/* minutes */
|
5168
|
-
0 // set to midday to avoid UTC offset causing dates to be mismatched server side
|
5169
|
-
);
|
5170
|
-
};
|
5171
|
-
var parseFromISOString = function parseFromISOString(date) {
|
5172
|
-
var tempDate = new Date(date);
|
5173
|
-
return dateFns.isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;
|
5174
|
-
};
|
5401
|
+
var handleInputKeyDown = function handleInputKeyDown(event) {
|
5402
|
+
event.persist();
|
5175
5403
|
|
5176
|
-
|
5177
|
-
|
5178
|
-
|
5179
|
-
|
5180
|
-
|
5181
|
-
value = _ref.value,
|
5182
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
5404
|
+
switch (event.keyCode) {
|
5405
|
+
case keycode('backspace'):
|
5406
|
+
{
|
5407
|
+
return;
|
5408
|
+
}
|
5183
5409
|
|
5184
|
-
|
5410
|
+
case keycode('escape'):
|
5411
|
+
{
|
5412
|
+
event.preventDefault();
|
5413
|
+
setInputValue(convertToInputValue(value));
|
5414
|
+
popover.hide();
|
5415
|
+
return;
|
5416
|
+
}
|
5185
5417
|
|
5186
|
-
|
5187
|
-
|
5418
|
+
case keycode('tab'):
|
5419
|
+
case keycode('enter'):
|
5420
|
+
{
|
5421
|
+
if (event.keyCode !== keycode('tab')) {
|
5422
|
+
event.preventDefault();
|
5423
|
+
}
|
5188
5424
|
|
5189
|
-
|
5190
|
-
|
5191
|
-
|
5425
|
+
setCurrentValue(currentIndex);
|
5426
|
+
popover.hide();
|
5427
|
+
return;
|
5428
|
+
}
|
5192
5429
|
|
5430
|
+
case keycode('up'):
|
5431
|
+
case keycode('down'):
|
5432
|
+
case keycode('home'):
|
5433
|
+
case keycode('end'):
|
5434
|
+
{
|
5435
|
+
if (popover.visible) {
|
5436
|
+
event.preventDefault();
|
5437
|
+
}
|
5193
5438
|
|
5194
|
-
|
5195
|
-
|
5196
|
-
|
5439
|
+
break;
|
5440
|
+
}
|
5441
|
+
} // we aren't focused on the list, so manually forward the keydown event to it
|
5197
5442
|
|
5198
|
-
if (formattedValue !== internalValue) {
|
5199
|
-
setInternalValue(formattedValue);
|
5200
|
-
}
|
5201
|
-
} else {
|
5202
|
-
setInternalValue('');
|
5203
|
-
}
|
5204
|
-
}, [value]); // event handlers
|
5205
5443
|
|
5206
|
-
|
5207
|
-
|
5208
|
-
|
5209
|
-
var formattedValue = valueAsDate ? format(valueAsDate) || '' : '';
|
5210
|
-
event.target.value = formattedValue;
|
5444
|
+
if (listRef.current) {
|
5445
|
+
listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
|
5446
|
+
}
|
5211
5447
|
|
5212
|
-
if (
|
5213
|
-
event.
|
5214
|
-
|
5215
|
-
|
5216
|
-
|
5217
|
-
|
5448
|
+
if (inline && !popover.visible) {
|
5449
|
+
if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {
|
5450
|
+
event.preventDefault();
|
5451
|
+
var initialIndex = event.keyCode === keycode('up') ? data.length - 1 : 0;
|
5452
|
+
setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
|
5453
|
+
popover.show();
|
5454
|
+
}
|
5218
5455
|
}
|
5219
5456
|
|
5220
|
-
if (
|
5221
|
-
|
5457
|
+
if (!event.isDefaultPrevented() && onKeyDown) {
|
5458
|
+
event.persist();
|
5459
|
+
onKeyDown(event);
|
5222
5460
|
}
|
5223
5461
|
};
|
5224
5462
|
|
5225
|
-
var
|
5226
|
-
|
5463
|
+
var handleListboxChange = function handleListboxChange(index) {
|
5464
|
+
setCurrentIndex(index);
|
5227
5465
|
};
|
5228
5466
|
|
5229
|
-
var
|
5230
|
-
|
5467
|
+
var handleListboxClick = function handleListboxClick(event, index) {
|
5468
|
+
event.preventDefault();
|
5469
|
+
setCurrentValue(index);
|
5470
|
+
popover.hide();
|
5231
5471
|
};
|
5232
5472
|
|
5233
|
-
var
|
5234
|
-
|
5235
|
-
|
5236
|
-
|
5473
|
+
var combobox = {
|
5474
|
+
'aria-expanded': popover.visible,
|
5475
|
+
'aria-owns': listId,
|
5476
|
+
'aria-haspopup': 'listbox',
|
5477
|
+
role: 'combobox'
|
5478
|
+
};
|
5479
|
+
|
5480
|
+
var input = _extends({}, props, {
|
5481
|
+
'aria-controls': listId,
|
5482
|
+
// Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions
|
5483
|
+
// are related to the string that is present in the textbox
|
5484
|
+
'aria-autocomplete': 'list',
|
5485
|
+
// Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element
|
5486
|
+
'aria-activedescendant': currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,
|
5487
|
+
'aria-labelledby': ariaLabelledBy,
|
5488
|
+
disabled: disabled,
|
5489
|
+
onBlur: !disabled && !readOnly ? handleInputBlur : undefined,
|
5490
|
+
onChange: !disabled && !readOnly ? handleInputChange : undefined,
|
5491
|
+
onClick: !disabled && !readOnly ? handleInputClick : undefined,
|
5492
|
+
onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,
|
5493
|
+
readOnly: readOnly,
|
5237
5494
|
ref: inputRef,
|
5238
5495
|
type: 'text',
|
5239
|
-
value:
|
5240
|
-
});
|
5241
|
-
|
5242
|
-
var calendarProps = _extends({}, calendar, {
|
5243
|
-
onChange: handleChange,
|
5244
|
-
value: value
|
5496
|
+
value: inputValue || ''
|
5245
5497
|
});
|
5246
5498
|
|
5499
|
+
var list = {
|
5500
|
+
'aria-labelledby': ariaLabelledBy,
|
5501
|
+
data: data,
|
5502
|
+
disabled: disabled,
|
5503
|
+
id: listId,
|
5504
|
+
onChange: handleListboxChange,
|
5505
|
+
onClick: handleListboxClick,
|
5506
|
+
ref: listRef,
|
5507
|
+
scrollOnFocus: false,
|
5508
|
+
tabIndex: -1,
|
5509
|
+
value: currentIndex
|
5510
|
+
};
|
5247
5511
|
return {
|
5248
|
-
|
5249
|
-
|
5512
|
+
combobox: combobox,
|
5513
|
+
input: input,
|
5514
|
+
list: list,
|
5515
|
+
popover: _extends({}, popover, {
|
5516
|
+
visible: !data.length ? false : popover.visible,
|
5517
|
+
container: {
|
5518
|
+
tabIndex: -1,
|
5519
|
+
'aria-label': ariaLabel,
|
5520
|
+
'aria-labelledby': ariaLabelledBy,
|
5521
|
+
unstable_initialFocusRef: inputRef
|
5522
|
+
}
|
5523
|
+
})
|
5250
5524
|
};
|
5251
5525
|
};
|
5252
5526
|
|
5253
|
-
var
|
5254
|
-
|
5255
|
-
|
5256
|
-
className: "pointer-events-none -mt-px",
|
5257
|
-
asChild: true,
|
5258
|
-
offset: 2,
|
5259
|
-
width: 30,
|
5260
|
-
height: 11
|
5261
|
-
}, React.createElement("svg", Object.assign({}, props, {
|
5262
|
-
ref: ref,
|
5263
|
-
viewBox: "0 19 30 11",
|
5264
|
-
style: {
|
5265
|
-
transform: 'rotateZ(180deg)'
|
5266
|
-
}
|
5267
|
-
}), React.createElement("path", {
|
5268
|
-
className: "text-grey-dark group-focus:text-blue-light fill-current",
|
5269
|
-
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
5270
|
-
}), React.createElement("path", {
|
5271
|
-
className: "fill-current",
|
5272
|
-
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
|
5273
|
-
})));
|
5274
|
-
});
|
5275
|
-
var UnstyledContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5276
|
-
var side = props.placement,
|
5277
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$i);
|
5278
|
-
|
5279
|
-
var className = cn('border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group ', props.className);
|
5280
|
-
return React.createElement(PopoverPrimitive.Content, Object.assign({}, otherProps, {
|
5281
|
-
className: className,
|
5282
|
-
side: side,
|
5283
|
-
sideOffset: 1,
|
5284
|
-
style: _extends({}, props.style, {
|
5285
|
-
zIndex: 996
|
5286
|
-
}),
|
5287
|
-
ref: ref
|
5288
|
-
}));
|
5289
|
-
});
|
5527
|
+
var getVisibility = function getVisibility(element) {
|
5528
|
+
return Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));
|
5529
|
+
};
|
5290
5530
|
|
5291
|
-
var
|
5292
|
-
var
|
5293
|
-
|
5294
|
-
|
5295
|
-
var Trigger$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5296
|
-
var context = React.useContext(PopoverContext);
|
5297
|
-
return React.createElement(PopoverPrimitive.Trigger, Object.assign({}, context.props, props, {
|
5298
|
-
ref: ref,
|
5299
|
-
asChild: true
|
5300
|
-
}));
|
5301
|
-
});
|
5302
|
-
var RenderPropWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
5303
|
-
var children = _ref.children,
|
5304
|
-
onClick = _ref.onClick;
|
5531
|
+
var useBoundingClientRectListener = function useBoundingClientRectListener(ref) {
|
5532
|
+
var _React$useState = React.useState(undefined),
|
5533
|
+
dimensions = _React$useState[0],
|
5534
|
+
setDimensions = _React$useState[1];
|
5305
5535
|
|
5306
|
-
var
|
5307
|
-
onClick(new CustomEvent('hide'));
|
5308
|
-
};
|
5536
|
+
var isRefElementVisible = getVisibility(ref.current);
|
5309
5537
|
|
5310
|
-
|
5311
|
-
|
5312
|
-
|
5313
|
-
});
|
5314
|
-
});
|
5315
|
-
var Content$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5316
|
-
var className = cn('bg-white focus:border-blue-light', props.className);
|
5317
|
-
var output;
|
5538
|
+
var _React$useState2 = React.useState(isRefElementVisible),
|
5539
|
+
visibility = _React$useState2[0],
|
5540
|
+
setVisibility = _React$useState2[1];
|
5318
5541
|
|
5319
|
-
|
5320
|
-
|
5321
|
-
|
5322
|
-
}, React.createElement(RenderPropWrapper, null, props.children));
|
5323
|
-
} else {
|
5324
|
-
output = props.children;
|
5325
|
-
}
|
5542
|
+
var resize = function resize() {
|
5543
|
+
if (visibility) {
|
5544
|
+
var _ref$current;
|
5326
5545
|
|
5327
|
-
|
5328
|
-
|
5329
|
-
|
5330
|
-
ref: ref
|
5331
|
-
}, output, React.createElement(UnstyledArrow, {
|
5332
|
-
className: "text-white"
|
5333
|
-
}));
|
5334
|
-
});
|
5335
|
-
var Close$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5336
|
-
return React.createElement(PopoverPrimitive.Close, Object.assign({}, props, {
|
5337
|
-
ref: ref,
|
5338
|
-
asChild: true
|
5339
|
-
}));
|
5340
|
-
});
|
5341
|
-
var Popover = function Popover(props) {
|
5342
|
-
var children = props.children,
|
5343
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$j);
|
5546
|
+
setDimensions((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect());
|
5547
|
+
}
|
5548
|
+
};
|
5344
5549
|
|
5345
|
-
|
5346
|
-
|
5347
|
-
|
5550
|
+
React.useEffect(function () {
|
5551
|
+
var timeout = setTimeout(resize, 0);
|
5552
|
+
var debouncedResize = debounce(resize, 250);
|
5553
|
+
window.addEventListener('resize', debouncedResize);
|
5554
|
+
return function () {
|
5555
|
+
clearTimeout(timeout);
|
5556
|
+
window.removeEventListener('resize', debouncedResize);
|
5348
5557
|
};
|
5349
|
-
}, [
|
5350
|
-
|
5351
|
-
|
5352
|
-
}, React.createElement(PopoverPrimitive.Root, {
|
5353
|
-
children: children
|
5354
|
-
}));
|
5355
|
-
};
|
5356
|
-
Popover.Trigger = Trigger$1;
|
5357
|
-
Popover.Content = Content$1;
|
5358
|
-
Popover.Close = Close$1;
|
5558
|
+
}, [ref.current, visibility]);
|
5559
|
+
React.useEffect(function () {
|
5560
|
+
var newRefElementVisibility = getVisibility(ref.current);
|
5359
5561
|
|
5360
|
-
|
5361
|
-
|
5362
|
-
|
5562
|
+
if (visibility !== newRefElementVisibility) {
|
5563
|
+
// When visibility of an element changes, then the new visibility of the element can only be checked after the
|
5564
|
+
// component has rendered. That's why the visibility check is inside the useEffect. This useEffect will cause
|
5565
|
+
// the consumer to rerender and that will cause the above hook to recalculate the dimensions
|
5566
|
+
setVisibility(newRefElementVisibility);
|
5567
|
+
}
|
5568
|
+
});
|
5569
|
+
return dimensions;
|
5570
|
+
};
|
5363
5571
|
|
5572
|
+
var _excluded$m = ["className", "style"],
|
5573
|
+
_excluded2$2 = ["container"];
|
5574
|
+
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5364
5575
|
var externalClassName = props.className,
|
5365
|
-
handleReset = props.onReset,
|
5366
5576
|
style = props.style,
|
5367
|
-
|
5368
|
-
shortcutsText = props.shortcutsText,
|
5369
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$k);
|
5577
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$m);
|
5370
5578
|
|
5371
|
-
var
|
5372
|
-
|
5373
|
-
input =
|
5579
|
+
var _useCombobox = useCombobox(otherProps, ref),
|
5580
|
+
combobox = _useCombobox.combobox,
|
5581
|
+
input = _useCombobox.input,
|
5582
|
+
popover = _useCombobox.popover,
|
5583
|
+
list = _useCombobox.list;
|
5374
5584
|
|
5375
|
-
var
|
5376
|
-
|
5585
|
+
var container = popover.container,
|
5586
|
+
base = _objectWithoutPropertiesLoose(popover, _excluded2$2);
|
5377
5587
|
|
5378
|
-
var
|
5588
|
+
var internalRef = React.useRef(null);
|
5589
|
+
var selectDimensions = useBoundingClientRectListener(internalRef);
|
5590
|
+
var className = cn('inline-flex relative', {
|
5591
|
+
'yt-combobox--inline': props.inline
|
5592
|
+
}, externalClassName);
|
5379
5593
|
return React.createElement("span", {
|
5380
5594
|
className: className,
|
5381
|
-
"data-taco": "
|
5595
|
+
"data-taco": "combobox",
|
5382
5596
|
style: style
|
5383
|
-
}, React.createElement(
|
5384
|
-
|
5385
|
-
|
5386
|
-
|
5387
|
-
|
5388
|
-
|
5389
|
-
|
5390
|
-
|
5391
|
-
|
5392
|
-
|
5393
|
-
|
5394
|
-
|
5395
|
-
close();
|
5396
|
-
},
|
5597
|
+
}, React.createElement(Popover$1.PopoverDisclosure, Object.assign({}, base, {
|
5598
|
+
ref: internalRef
|
5599
|
+
}), function (_ref) {
|
5600
|
+
var ref = _ref.ref;
|
5601
|
+
return React.createElement("span", Object.assign({}, combobox, {
|
5602
|
+
className: "w-full",
|
5603
|
+
ref: ref
|
5604
|
+
}), React.createElement(Input, Object.assign({}, input, {
|
5605
|
+
autoComplete: "off",
|
5606
|
+
button: props.inline ? React.createElement(IconButton, {
|
5607
|
+
icon: popover.visible ? 'chevron-up' : 'chevron-down',
|
5608
|
+
onClick: popover.toggle,
|
5397
5609
|
tabIndex: -1
|
5398
|
-
})
|
5399
|
-
|
5400
|
-
|
5401
|
-
|
5402
|
-
|
5403
|
-
|
5404
|
-
|
5405
|
-
|
5406
|
-
|
5407
|
-
onClick: function onClick(event) {
|
5408
|
-
event.persist();
|
5409
|
-
shortcut.onClick(event);
|
5410
|
-
close();
|
5411
|
-
}
|
5412
|
-
}, shortcut.text));
|
5413
|
-
})), handleReset && React.createElement("button", {
|
5414
|
-
className: "text-blue hover:text-blue-light inline-flex border-none bg-transparent text-xs cursor-pointer mt-auto my-4 mx-auto",
|
5415
|
-
onClick: function onClick(event) {
|
5416
|
-
event.persist();
|
5417
|
-
handleReset(event);
|
5418
|
-
close();
|
5419
|
-
}
|
5420
|
-
}, texts.datepicker.clear)));
|
5421
|
-
}))
|
5422
|
-
})));
|
5423
|
-
});
|
5424
|
-
|
5425
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
5426
|
-
var DialogContext = /*#__PURE__*/React.createContext({
|
5427
|
-
close: function close() {},
|
5428
|
-
draggable: false,
|
5429
|
-
drawer: undefined,
|
5430
|
-
elements: {
|
5431
|
-
drawer: undefined,
|
5432
|
-
extra: undefined
|
5433
|
-
},
|
5434
|
-
onClose: function onClose() {},
|
5435
|
-
props: {},
|
5436
|
-
size: 'sm'
|
5610
|
+
}) : props.button
|
5611
|
+
})));
|
5612
|
+
}), !otherProps.disabled && React.createElement(Popover$1.Popover, Object.assign({}, base, container), React.createElement(ScrollableList, Object.assign({}, list, {
|
5613
|
+
className: cn('border-blue w-auto max-w-[theme(spacing.96)] max-h-[calc(12rem+2px)]'),
|
5614
|
+
style: {
|
5615
|
+
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
5616
|
+
},
|
5617
|
+
tabIndex: popover.visible ? 0 : -1
|
5618
|
+
}))));
|
5437
5619
|
});
|
5438
|
-
var useCurrentDialog = function useCurrentDialog() {
|
5439
|
-
return React.useContext(DialogContext);
|
5440
|
-
};
|
5441
5620
|
|
5442
|
-
var
|
5443
|
-
|
5444
|
-
|
5445
|
-
|
5446
|
-
asChild: true
|
5447
|
-
}));
|
5448
|
-
});
|
5621
|
+
var format = function format(date, mask) {
|
5622
|
+
if (mask === void 0) {
|
5623
|
+
mask = 'dd.mm.yy';
|
5624
|
+
}
|
5449
5625
|
|
5450
|
-
|
5451
|
-
|
5452
|
-
|
5453
|
-
y: 0
|
5454
|
-
}),
|
5455
|
-
position = _React$useState[0],
|
5456
|
-
setPosition = _React$useState[1];
|
5626
|
+
if (!date) {
|
5627
|
+
return undefined;
|
5628
|
+
}
|
5457
5629
|
|
5458
|
-
var
|
5459
|
-
onMove: function onMove(event) {
|
5460
|
-
var _ref$current;
|
5630
|
+
var value = dateFns.isDate(date) ? date : dateFns.toDate(date);
|
5461
5631
|
|
5462
|
-
|
5632
|
+
if (!dateFns.isValid(value)) {
|
5633
|
+
return undefined;
|
5634
|
+
}
|
5463
5635
|
|
5464
|
-
|
5465
|
-
|
5466
|
-
|
5467
|
-
}
|
5636
|
+
var pad = function pad(v) {
|
5637
|
+
return String(v).length === 1 ? "0" + v : v.toString();
|
5638
|
+
};
|
5468
5639
|
|
5469
|
-
|
5470
|
-
|
5471
|
-
|
5472
|
-
|
5473
|
-
|
5474
|
-
|
5475
|
-
|
5476
|
-
|
5477
|
-
|
5478
|
-
|
5640
|
+
return mask.replace('dd', pad(value.getDate())).replace('mm', pad(value.getMonth() + 1)).replace('yy', String(value.getFullYear()).slice(2));
|
5641
|
+
};
|
5642
|
+
var parseFromCustomString = function parseFromCustomString(date, mask) {
|
5643
|
+
if (date === void 0) {
|
5644
|
+
date = '';
|
5645
|
+
}
|
5646
|
+
|
5647
|
+
if (mask === void 0) {
|
5648
|
+
mask = 'dd.mm.yy';
|
5649
|
+
}
|
5650
|
+
|
5651
|
+
if (!date || !date.length) {
|
5652
|
+
return undefined;
|
5653
|
+
}
|
5654
|
+
|
5655
|
+
var sanitizedMask = mask.split(/[^dmy]/);
|
5656
|
+
var dd = sanitizedMask.findIndex(function (x) {
|
5657
|
+
return x === 'dd';
|
5658
|
+
});
|
5659
|
+
var mm = sanitizedMask.findIndex(function (x) {
|
5660
|
+
return x === 'mm';
|
5661
|
+
});
|
5662
|
+
var yy = sanitizedMask.findIndex(function (x) {
|
5663
|
+
return x === 'yy' || x === 'yyyy';
|
5664
|
+
});
|
5665
|
+
var day;
|
5666
|
+
var month;
|
5667
|
+
var year;
|
5668
|
+
|
5669
|
+
var getFullYear = function getFullYear(y) {
|
5670
|
+
if (y && y.length === 2) {
|
5671
|
+
var z = Number.parseInt(y, 10);
|
5672
|
+
return z > 50 ? "19" + y : "20" + y;
|
5479
5673
|
}
|
5480
|
-
}),
|
5481
|
-
moveProps = _useMove.moveProps;
|
5482
5674
|
|
5483
|
-
|
5484
|
-
position: position,
|
5485
|
-
handleProps: moveProps
|
5675
|
+
return y;
|
5486
5676
|
};
|
5487
|
-
};
|
5488
5677
|
|
5489
|
-
var
|
5490
|
-
var useCurrentMenu = function useCurrentMenu() {
|
5491
|
-
return React.useContext(MenuContext);
|
5492
|
-
};
|
5678
|
+
var inputParts = date.split(/\D/);
|
5493
5679
|
|
5494
|
-
|
5495
|
-
var
|
5496
|
-
|
5497
|
-
|
5498
|
-
|
5680
|
+
if (inputParts.length === 1) {
|
5681
|
+
var fullDate = inputParts[0];
|
5682
|
+
var unseparatedMask = mask.replace(/[^dmy]/g, '');
|
5683
|
+
day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);
|
5684
|
+
month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);
|
5685
|
+
year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years
|
5686
|
+
} else {
|
5687
|
+
day = inputParts[dd];
|
5688
|
+
month = inputParts[mm];
|
5689
|
+
year = getFullYear(inputParts[yy]);
|
5690
|
+
}
|
5499
5691
|
|
5500
|
-
|
5501
|
-
|
5502
|
-
|
5503
|
-
|
5504
|
-
|
5505
|
-
|
5506
|
-
|
5692
|
+
day = Number.parseInt(day, 10);
|
5693
|
+
month = Number.parseInt(month, 10);
|
5694
|
+
year = Number.parseInt(year, 10);
|
5695
|
+
var currentDate = new Date();
|
5696
|
+
return new Date(
|
5697
|
+
/* year */
|
5698
|
+
Object.is(year, NaN) ? currentDate.getFullYear() : year,
|
5699
|
+
/* month */
|
5700
|
+
Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day
|
5507
5701
|
|
5508
|
-
|
5509
|
-
|
5510
|
-
|
5511
|
-
|
5512
|
-
|
5513
|
-
|
5514
|
-
|
5515
|
-
|
5516
|
-
|
5517
|
-
|
5518
|
-
|
5519
|
-
}
|
5520
|
-
var Close$2 = /*#__PURE__*/React.forwardRef(function DialogClose(props, ref) {
|
5521
|
-
var dialog = useCurrentDialog();
|
5522
|
-
return React.createElement(DialogPrimitive.Close, Object.assign({
|
5523
|
-
onClick: dialog.onClose
|
5524
|
-
}, props, {
|
5525
|
-
ref: ref,
|
5526
|
-
asChild: true
|
5527
|
-
}));
|
5528
|
-
});
|
5529
|
-
var Content$2 = /*#__PURE__*/React.forwardRef(function DialogContent(props, ref) {
|
5530
|
-
var dialog = useCurrentDialog();
|
5531
|
-
var internalRef = useProxiedRef(ref);
|
5702
|
+
/* day */
|
5703
|
+
Object.is(day, NaN) ? currentDate.getDate() : day,
|
5704
|
+
/* hours */
|
5705
|
+
12,
|
5706
|
+
/* minutes */
|
5707
|
+
0 // set to midday to avoid UTC offset causing dates to be mismatched server side
|
5708
|
+
);
|
5709
|
+
};
|
5710
|
+
var parseFromISOString = function parseFromISOString(date) {
|
5711
|
+
var tempDate = new Date(date);
|
5712
|
+
return dateFns.isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;
|
5713
|
+
};
|
5532
5714
|
|
5533
|
-
|
5534
|
-
|
5535
|
-
|
5715
|
+
var _excluded$n = ["defaultValue", "calendar", "onBlur", "onChange", "value"];
|
5716
|
+
var useDatepicker = function useDatepicker(_ref, ref) {
|
5717
|
+
var calendar = _ref.calendar,
|
5718
|
+
onBlur = _ref.onBlur,
|
5719
|
+
onChange = _ref.onChange,
|
5720
|
+
value = _ref.value,
|
5721
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$n);
|
5536
5722
|
|
5537
|
-
var
|
5538
|
-
texts = _useLocalization.texts; // if the dialog was opened by a menu, we need to close the menu when the dialog closes
|
5539
|
-
// the menu is still open (and mounted) because it is the trigger for the dialog
|
5723
|
+
var inputRef = useProxiedRef(ref);
|
5540
5724
|
|
5725
|
+
var _useLocalization = useLocalization(),
|
5726
|
+
formatting = _useLocalization.formatting;
|
5541
5727
|
|
5542
|
-
var
|
5543
|
-
|
5728
|
+
var _React$useState = React.useState(value ? format(value, formatting.date) : ''),
|
5729
|
+
internalValue = _React$useState[0],
|
5730
|
+
setInternalValue = _React$useState[1]; // update internal value if it changed 'externally'
|
5544
5731
|
|
5545
|
-
if (menu) {
|
5546
|
-
handleCloseAutoFocus = function handleCloseAutoFocus() {
|
5547
|
-
return menu.close();
|
5548
|
-
};
|
5549
|
-
}
|
5550
5732
|
|
5551
|
-
|
5552
|
-
|
5553
|
-
|
5554
|
-
'w-sm': dialog.size === 'sm',
|
5555
|
-
'w-md': dialog.size === 'md',
|
5556
|
-
'w-lg': dialog.size === 'lg'
|
5557
|
-
});
|
5558
|
-
var containerClassName = cn('yt-dialog bg-white p-6 rounded relative z-10', {
|
5559
|
-
'rounded-b-none': !!dialog.elements.extra
|
5560
|
-
}, props.className);
|
5561
|
-
var overlayClassName = cn('fixed inset-0 cursor-default overflow-y-auto bg-[rgba(50,46,62,0.8)] animate-[fade-in_150ms] aria-hidden:hidden'); // the chosen behaviour in taco is that outside clicks do not close the dialog
|
5733
|
+
React.useEffect(function () {
|
5734
|
+
if (value) {
|
5735
|
+
var formattedValue = format(value, formatting.date);
|
5562
5736
|
|
5563
|
-
|
5564
|
-
|
5565
|
-
|
5737
|
+
if (formattedValue !== internalValue) {
|
5738
|
+
setInternalValue(formattedValue);
|
5739
|
+
}
|
5740
|
+
} else {
|
5741
|
+
setInternalValue('');
|
5742
|
+
}
|
5743
|
+
}, [value]); // event handlers
|
5566
5744
|
|
5567
|
-
var
|
5745
|
+
var handleInputBlur = function handleInputBlur(event) {
|
5746
|
+
event.persist();
|
5747
|
+
var valueAsDate = parseFromCustomString(event.target.value);
|
5748
|
+
var formattedValue = valueAsDate ? format(valueAsDate) || '' : '';
|
5749
|
+
event.target.value = formattedValue;
|
5568
5750
|
|
5569
|
-
|
5570
|
-
|
5571
|
-
|
5572
|
-
|
5573
|
-
|
5574
|
-
|
5575
|
-
|
5576
|
-
}
|
5751
|
+
if (onChange) {
|
5752
|
+
event.detail = valueAsDate;
|
5753
|
+
onChange(event);
|
5754
|
+
} else {
|
5755
|
+
// update the internal value to use the formatted date
|
5756
|
+
setInternalValue(formattedValue);
|
5757
|
+
}
|
5577
5758
|
|
5578
|
-
|
5579
|
-
|
5580
|
-
|
5581
|
-
|
5582
|
-
"data-taco": "dialog",
|
5583
|
-
onEscapeKeyDown: dialog.onClose,
|
5584
|
-
onInteractOutside: handleInteractOutside,
|
5585
|
-
onCloseAutoFocus: handleCloseAutoFocus,
|
5586
|
-
ref: ref,
|
5587
|
-
style: _extends({}, props.style, {
|
5588
|
-
left: dialog.draggable ? "calc(50% + " + position.x + "px)" : undefined,
|
5589
|
-
top: dialog.draggable ? "calc(50% + " + position.y + "px)" : undefined
|
5590
|
-
})
|
5591
|
-
}), React.createElement("div", {
|
5592
|
-
className: containerClassName
|
5593
|
-
}, output, dialog.draggable && React.createElement("div", Object.assign({}, dragHandleProps, {
|
5594
|
-
"aria-label": texts.dialog.drag,
|
5595
|
-
className: "yt-dialog__drag absolute-center-x h-3 rounded bg-grey-light cursor-move text-center w-24 top-1.5"
|
5596
|
-
})), React.createElement(DialogPrimitive.Close, {
|
5597
|
-
asChild: true,
|
5598
|
-
onClick: dialog.onClose
|
5599
|
-
}, React.createElement(IconButton, {
|
5600
|
-
appearance: "discrete",
|
5601
|
-
"aria-label": texts.dialog.close,
|
5602
|
-
className: "absolute top-0 right-0 mt-2 mr-2",
|
5603
|
-
icon: "close"
|
5604
|
-
}))), dialog.elements.drawer, dialog.elements.extra)));
|
5605
|
-
});
|
5759
|
+
if (onBlur) {
|
5760
|
+
onBlur(event);
|
5761
|
+
}
|
5762
|
+
};
|
5606
5763
|
|
5607
|
-
var
|
5608
|
-
|
5764
|
+
var handleInputChange = function handleInputChange(event) {
|
5765
|
+
setInternalValue(event.target.value);
|
5766
|
+
};
|
5609
5767
|
|
5610
|
-
var
|
5611
|
-
|
5612
|
-
|
5613
|
-
"aria-hidden": !((_dialog$drawer = dialog.drawer) !== null && _dialog$drawer !== void 0 && _dialog$drawer.open),
|
5614
|
-
variants: {
|
5615
|
-
visible: {
|
5616
|
-
left: '100%',
|
5617
|
-
display: 'block',
|
5618
|
-
transition: {
|
5619
|
-
ease: 'easeOut',
|
5620
|
-
duration: 0.2
|
5621
|
-
}
|
5622
|
-
},
|
5623
|
-
hidden: {
|
5624
|
-
left: '0%',
|
5625
|
-
transition: {
|
5626
|
-
ease: 'easeOut',
|
5627
|
-
duration: 0.2
|
5628
|
-
},
|
5629
|
-
transitionEnd: {
|
5630
|
-
display: 'none'
|
5631
|
-
}
|
5632
|
-
}
|
5633
|
-
},
|
5634
|
-
animate: (_dialog$drawer2 = dialog.drawer) !== null && _dialog$drawer2 !== void 0 && _dialog$drawer2.open ? 'visible' : 'hidden',
|
5635
|
-
ref: ref
|
5636
|
-
}));
|
5637
|
-
});
|
5768
|
+
var handleChange = function handleChange(date) {
|
5769
|
+
setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
|
5770
|
+
};
|
5638
5771
|
|
5639
|
-
var
|
5640
|
-
|
5641
|
-
|
5642
|
-
|
5643
|
-
|
5644
|
-
|
5772
|
+
var inputProps = _extends({}, props, {
|
5773
|
+
autoComplete: 'off',
|
5774
|
+
onBlur: handleInputBlur,
|
5775
|
+
onChange: handleInputChange,
|
5776
|
+
ref: inputRef,
|
5777
|
+
type: 'text',
|
5778
|
+
value: internalValue
|
5779
|
+
});
|
5645
5780
|
|
5646
|
-
var
|
5781
|
+
var calendarProps = _extends({}, calendar, {
|
5782
|
+
onChange: handleChange,
|
5783
|
+
value: value
|
5784
|
+
});
|
5647
5785
|
|
5648
|
-
|
5649
|
-
|
5650
|
-
|
5651
|
-
|
5652
|
-
var extra;
|
5653
|
-
React.Children.forEach(initialChildren, function (child) {
|
5654
|
-
if (child.type.displayName === 'Drawer') {
|
5655
|
-
drawer = child;
|
5656
|
-
} else if (child.type.displayName === 'Extra') {
|
5657
|
-
extra = child;
|
5658
|
-
} else {
|
5659
|
-
children.push(child);
|
5660
|
-
}
|
5661
|
-
});
|
5662
|
-
return [children, drawer, extra];
|
5663
|
-
}, [initialChildren]);
|
5786
|
+
return {
|
5787
|
+
input: inputProps,
|
5788
|
+
calendar: calendarProps
|
5789
|
+
};
|
5664
5790
|
};
|
5665
5791
|
|
5666
|
-
var
|
5667
|
-
|
5668
|
-
|
5669
|
-
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
5670
|
-
onClose = props.onClose,
|
5671
|
-
defaultOpen = props.open,
|
5672
|
-
_props$size = props.size,
|
5673
|
-
size = _props$size === void 0 ? 'sm' : _props$size,
|
5674
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$m);
|
5792
|
+
var _excluded$o = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
|
5793
|
+
var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
5794
|
+
var _input$disabled;
|
5675
5795
|
|
5676
|
-
var
|
5677
|
-
|
5678
|
-
|
5679
|
-
|
5796
|
+
var externalClassName = props.className,
|
5797
|
+
handleReset = props.onReset,
|
5798
|
+
style = props.style,
|
5799
|
+
shortcuts = props.shortcuts,
|
5800
|
+
shortcutsText = props.shortcutsText,
|
5801
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$o);
|
5680
5802
|
|
5681
|
-
var
|
5682
|
-
|
5683
|
-
|
5803
|
+
var _useDatepicker = useDatepicker(otherProps, ref),
|
5804
|
+
calendar = _useDatepicker.calendar,
|
5805
|
+
input = _useDatepicker.input;
|
5684
5806
|
|
5685
|
-
var
|
5686
|
-
|
5687
|
-
setDrawerOpen = _React$useState2[1];
|
5807
|
+
var _useLocalization = useLocalization(),
|
5808
|
+
texts = _useLocalization.texts;
|
5688
5809
|
|
5689
|
-
var
|
5690
|
-
|
5691
|
-
|
5692
|
-
|
5693
|
-
|
5694
|
-
|
5695
|
-
|
5696
|
-
|
5697
|
-
|
5698
|
-
|
5699
|
-
|
5700
|
-
|
5810
|
+
var className = cn('inline-flex w-full text-black font-normal', externalClassName);
|
5811
|
+
return React.createElement("span", {
|
5812
|
+
className: className,
|
5813
|
+
"data-taco": "datepicker",
|
5814
|
+
style: style
|
5815
|
+
}, React.createElement(Input, Object.assign({}, input, {
|
5816
|
+
button: React.createElement(Popover, null, React.createElement(Popover.Trigger, null, React.createElement(IconButton, {
|
5817
|
+
"aria-label": texts.datepicker.expand,
|
5818
|
+
disabled: (_input$disabled = input.disabled) !== null && _input$disabled !== void 0 ? _input$disabled : input.readOnly,
|
5819
|
+
icon: "calendar"
|
5820
|
+
})), React.createElement(Popover.Content, null, function (_ref) {
|
5821
|
+
var close = _ref.close;
|
5822
|
+
return React.createElement("div", {
|
5823
|
+
className: "flex -m-3"
|
5824
|
+
}, React.createElement(Calendar$1, Object.assign({}, calendar, {
|
5825
|
+
onChange: function onChange(date, event) {
|
5826
|
+
calendar.onChange(date, event);
|
5827
|
+
close();
|
5828
|
+
},
|
5829
|
+
tabIndex: -1
|
5830
|
+
})), shortcuts && React.createElement("div", {
|
5831
|
+
className: "border-l border-grey-dark flex flex-col"
|
5832
|
+
}, React.createElement("span", {
|
5833
|
+
className: "font-semibold text-xs m-4 flex items-center h-8 w-32 mb-3"
|
5834
|
+
}, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), React.createElement("ul", null, shortcuts.map(function (shortcut, i) {
|
5835
|
+
return React.createElement("li", {
|
5836
|
+
key: i
|
5837
|
+
}, React.createElement("button", {
|
5838
|
+
className: "w-full px-4 py-1 flex items-start hover:bg-grey-light text-xs",
|
5839
|
+
onClick: function onClick(event) {
|
5840
|
+
event.persist();
|
5841
|
+
shortcut.onClick(event);
|
5842
|
+
close();
|
5843
|
+
}
|
5844
|
+
}, shortcut.text));
|
5845
|
+
})), handleReset && React.createElement("button", {
|
5846
|
+
className: "text-blue hover:text-blue-light inline-flex border-none bg-transparent text-xs cursor-pointer mt-auto my-4 mx-auto",
|
5847
|
+
onClick: function onClick(event) {
|
5848
|
+
event.persist();
|
5849
|
+
handleReset(event);
|
5850
|
+
close();
|
5701
5851
|
}
|
5702
|
-
},
|
5703
|
-
|
5704
|
-
|
5705
|
-
|
5706
|
-
},
|
5707
|
-
onClose: onClose,
|
5708
|
-
props: otherProps,
|
5709
|
-
size: size
|
5710
|
-
};
|
5711
|
-
}, [open, drawerOpen, drawer, extra, otherProps]);
|
5712
|
-
return React.createElement(DialogContext.Provider, {
|
5713
|
-
value: context
|
5714
|
-
}, React.createElement(DialogPrimitive.Root, {
|
5715
|
-
children: children,
|
5716
|
-
open: open,
|
5717
|
-
onOpenChange: setOpen
|
5718
|
-
}));
|
5719
|
-
};
|
5720
|
-
Dialog.Trigger = Trigger$2;
|
5721
|
-
Dialog.Content = Content$2;
|
5722
|
-
Dialog.Title = Title;
|
5723
|
-
Dialog.Footer = Footer;
|
5724
|
-
Dialog.Extra = Extra;
|
5725
|
-
Dialog.Drawer = Drawer;
|
5726
|
-
Dialog.Close = Close$2;
|
5852
|
+
}, texts.datepicker.clear)));
|
5853
|
+
}))
|
5854
|
+
})));
|
5855
|
+
});
|
5727
5856
|
|
5728
|
-
var _excluded$
|
5857
|
+
var _excluded$p = ["horizontal"];
|
5729
5858
|
var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
5730
5859
|
var _props$horizontal = props.horizontal,
|
5731
5860
|
horizontal = _props$horizontal === void 0 ? false : _props$horizontal,
|
5732
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5861
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$p);
|
5733
5862
|
|
5734
5863
|
var className = cn('yt-form', {
|
5735
5864
|
'yt-form--horizontal flex flex-wrap': horizontal
|
@@ -5741,68 +5870,10 @@ var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
|
5741
5870
|
}));
|
5742
5871
|
});
|
5743
5872
|
|
5744
|
-
var _excluded$
|
5745
|
-
var HangerContext = /*#__PURE__*/React.createContext({
|
5746
|
-
props: {}
|
5747
|
-
});
|
5748
|
-
var Anchor = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5749
|
-
var context = React.useContext(HangerContext);
|
5750
|
-
return React.createElement(PopoverPrimitive.Anchor, Object.assign({}, context.props, props, {
|
5751
|
-
ref: ref,
|
5752
|
-
asChild: true
|
5753
|
-
}));
|
5754
|
-
});
|
5755
|
-
var Content$3 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5756
|
-
var _useLocalization = useLocalization(),
|
5757
|
-
texts = _useLocalization.texts;
|
5758
|
-
|
5759
|
-
var className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
|
5760
|
-
|
5761
|
-
var handleInteractOutside = function handleInteractOutside(event) {
|
5762
|
-
event.preventDefault();
|
5763
|
-
};
|
5764
|
-
|
5765
|
-
return React.createElement(UnstyledContent, {
|
5766
|
-
className: className,
|
5767
|
-
"data-taco": "hanger",
|
5768
|
-
onInteractOutside: handleInteractOutside,
|
5769
|
-
placement: props.placement,
|
5770
|
-
ref: ref
|
5771
|
-
}, props.children, React.createElement(UnstyledArrow, {
|
5772
|
-
className: "text-blue"
|
5773
|
-
}), React.createElement(PopoverPrimitive.Close, {
|
5774
|
-
asChild: true
|
5775
|
-
}, React.createElement(IconButton, {
|
5776
|
-
appearance: "primary",
|
5777
|
-
"aria-label": texts.hanger.close,
|
5778
|
-
className: "text-white ml-2 absolute top-0 right-0 mr-2 mt-2",
|
5779
|
-
icon: "close",
|
5780
|
-
onClick: props.onClose
|
5781
|
-
})));
|
5782
|
-
});
|
5783
|
-
var Hanger = function Hanger(props) {
|
5784
|
-
var children = props.children,
|
5785
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$o);
|
5786
|
-
|
5787
|
-
var context = React.useMemo(function () {
|
5788
|
-
return {
|
5789
|
-
props: otherProps
|
5790
|
-
};
|
5791
|
-
}, [otherProps]);
|
5792
|
-
return React.createElement(HangerContext.Provider, {
|
5793
|
-
value: context
|
5794
|
-
}, React.createElement(PopoverPrimitive.Root, {
|
5795
|
-
children: children,
|
5796
|
-
defaultOpen: true
|
5797
|
-
}));
|
5798
|
-
};
|
5799
|
-
Hanger.Anchor = Anchor;
|
5800
|
-
Hanger.Content = Content$3;
|
5801
|
-
|
5802
|
-
var _excluded$p = ["onSearch"];
|
5873
|
+
var _excluded$q = ["onSearch"];
|
5803
5874
|
var SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput(_ref, ref) {
|
5804
5875
|
var onSearch = _ref.onSearch,
|
5805
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
5876
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
|
5806
5877
|
|
5807
5878
|
var _useLocalization = useLocalization(),
|
5808
5879
|
texts = _useLocalization.texts;
|
@@ -5835,13 +5906,13 @@ var SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput(_ref, ref)
|
|
5835
5906
|
}));
|
5836
5907
|
});
|
5837
5908
|
|
5838
|
-
var _excluded$
|
5909
|
+
var _excluded$r = ["disabled", "children", "message", "state"];
|
5839
5910
|
var Label = /*#__PURE__*/React.forwardRef(function Label(props, ref) {
|
5840
5911
|
var disabled = props.disabled,
|
5841
5912
|
children = props.children,
|
5842
5913
|
message = props.message,
|
5843
5914
|
state = props.state,
|
5844
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5915
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$r);
|
5845
5916
|
|
5846
5917
|
var className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5847
5918
|
'text-grey-dark': disabled
|
@@ -5885,7 +5956,7 @@ var useTypeahead = function useTypeahead(_ref) {
|
|
5885
5956
|
};
|
5886
5957
|
};
|
5887
5958
|
|
5888
|
-
var _excluded$
|
5959
|
+
var _excluded$s = ["data", "defaultValue", "disabled", "emptyValue", "id", "name", "onChange", "onFocus", "onKeyDown", "value"];
|
5889
5960
|
var useListbox = function useListbox(_ref, ref) {
|
5890
5961
|
var _ref$data = _ref.data,
|
5891
5962
|
externalData = _ref$data === void 0 ? [] : _ref$data,
|
@@ -5899,7 +5970,7 @@ var useListbox = function useListbox(_ref, ref) {
|
|
5899
5970
|
onKeyDown = _ref.onKeyDown,
|
5900
5971
|
_ref$value = _ref.value,
|
5901
5972
|
value = _ref$value === void 0 ? emptyValue : _ref$value,
|
5902
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
5973
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
5903
5974
|
|
5904
5975
|
var data = useFlattenedData(emptyValue !== undefined ? [{
|
5905
5976
|
text: '',
|
@@ -6028,7 +6099,7 @@ var useListbox = function useListbox(_ref, ref) {
|
|
6028
6099
|
};
|
6029
6100
|
};
|
6030
6101
|
|
6031
|
-
var _excluded$
|
6102
|
+
var _excluded$t = ["data", "defaultValue", "disabled", "id", "name", "onClick", "onChange", "onFocus", "onKeyDown", "value"];
|
6032
6103
|
var useMultiListbox = function useMultiListbox(_ref, ref) {
|
6033
6104
|
var _ref$data = _ref.data,
|
6034
6105
|
externalData = _ref$data === void 0 ? [] : _ref$data,
|
@@ -6041,7 +6112,7 @@ var useMultiListbox = function useMultiListbox(_ref, ref) {
|
|
6041
6112
|
onFocus = _ref.onFocus,
|
6042
6113
|
onKeyDown = _ref.onKeyDown,
|
6043
6114
|
value = _ref.value,
|
6044
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
6115
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
6045
6116
|
|
6046
6117
|
var _useLocalization = useLocalization(),
|
6047
6118
|
texts = _useLocalization.texts;
|
@@ -6240,11 +6311,11 @@ var useMultiListbox = function useMultiListbox(_ref, ref) {
|
|
6240
6311
|
};
|
6241
6312
|
};
|
6242
6313
|
|
6243
|
-
var _excluded$
|
6314
|
+
var _excluded$u = ["className"],
|
6244
6315
|
_excluded2$3 = ["className"];
|
6245
6316
|
var Listbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
6246
6317
|
var externalClassName = props.className,
|
6247
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6318
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$u);
|
6248
6319
|
|
6249
6320
|
var _useListbox = useListbox(otherProps, ref),
|
6250
6321
|
list = _useListbox.list,
|
@@ -6273,7 +6344,7 @@ var MultiListbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
6273
6344
|
})));
|
6274
6345
|
});
|
6275
6346
|
|
6276
|
-
var _excluded$
|
6347
|
+
var _excluded$v = ["children", "placement"];
|
6277
6348
|
|
6278
6349
|
var getAppearanceClasses$1 = function getAppearanceClasses(appearance) {
|
6279
6350
|
switch (appearance) {
|
@@ -6301,7 +6372,7 @@ var Content$4 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
6301
6372
|
|
6302
6373
|
var children = props.children,
|
6303
6374
|
side = props.placement,
|
6304
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6375
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$v);
|
6305
6376
|
|
6306
6377
|
var className = cn('border rounded block outline-none p-1', getAppearanceClasses$1(menu === null || menu === void 0 ? void 0 : menu.appearance), props.className);
|
6307
6378
|
return React.createElement(DropdownMenuPrimitive.Content, Object.assign({}, otherProps, {
|
@@ -6317,7 +6388,7 @@ var Content$4 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
6317
6388
|
}), children);
|
6318
6389
|
});
|
6319
6390
|
|
6320
|
-
var _excluded$
|
6391
|
+
var _excluded$w = ["icon", "shortcut"];
|
6321
6392
|
var Icon$1 = function Icon$1(_ref) {
|
6322
6393
|
var name = _ref.name;
|
6323
6394
|
return React.createElement("span", {
|
@@ -6400,7 +6471,7 @@ var Shortcut = function Shortcut(props) {
|
|
6400
6471
|
var Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
|
6401
6472
|
var icon = props.icon,
|
6402
6473
|
shortcut = props.shortcut,
|
6403
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6474
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$w);
|
6404
6475
|
|
6405
6476
|
var className = useItemStyling({
|
6406
6477
|
disabled: props.disabled,
|
@@ -6432,11 +6503,11 @@ var Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
|
|
6432
6503
|
}), props.children, shortcut && React.createElement(Shortcut, null, shortcut));
|
6433
6504
|
});
|
6434
6505
|
|
6435
|
-
var _excluded$
|
6506
|
+
var _excluded$x = ["href", "icon"];
|
6436
6507
|
var Link = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
|
6437
6508
|
var href = props.href,
|
6438
6509
|
icon = props.icon,
|
6439
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6510
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$x);
|
6440
6511
|
|
6441
6512
|
var className = useItemStyling({
|
6442
6513
|
disabled: props.disabled,
|
@@ -6481,12 +6552,12 @@ var Trigger$3 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
|
|
6481
6552
|
}));
|
6482
6553
|
});
|
6483
6554
|
|
6484
|
-
var _excluded$
|
6555
|
+
var _excluded$y = ["checked", "children", "onChange"];
|
6485
6556
|
var Checkbox$1 = function Checkbox(props) {
|
6486
6557
|
var checked = props.checked,
|
6487
6558
|
children = props.children,
|
6488
6559
|
onChange = props.onChange,
|
6489
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6560
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$y);
|
6490
6561
|
|
6491
6562
|
var className = useItemStyling({
|
6492
6563
|
disabled: props.disabled,
|
@@ -6505,7 +6576,7 @@ var Checkbox$1 = function Checkbox(props) {
|
|
6505
6576
|
})), children);
|
6506
6577
|
};
|
6507
6578
|
|
6508
|
-
var _excluded$
|
6579
|
+
var _excluded$z = ["children", "value"],
|
6509
6580
|
_excluded2$4 = ["children", "defaultValue", "disabled", "invalid", "onChange", "orientation", "value"];
|
6510
6581
|
var getRadioGroupItemValueAsString = function getRadioGroupItemValueAsString(value) {
|
6511
6582
|
return value === undefined || value === null ? '' : String(value);
|
@@ -6524,7 +6595,7 @@ var RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props
|
|
6524
6595
|
|
6525
6596
|
var children = props.children,
|
6526
6597
|
value = props.value,
|
6527
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6598
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$z);
|
6528
6599
|
|
6529
6600
|
var disabled = context.disabled || props.disabled;
|
6530
6601
|
var className = cn('flex items-center justify-center h-4 w-4 mr-2 rounded-full bg-white border-2 ', {
|
@@ -6613,13 +6684,13 @@ var RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {
|
|
6613
6684
|
});
|
6614
6685
|
RadioGroup.Item = RadioGroupItem;
|
6615
6686
|
|
6616
|
-
var _excluded$
|
6687
|
+
var _excluded$A = ["children", "value"];
|
6617
6688
|
var RadioItem = function RadioItem(props) {
|
6618
6689
|
var context = React.useContext(MenuRadioGroupContext);
|
6619
6690
|
|
6620
6691
|
var children = props.children,
|
6621
6692
|
value = props.value,
|
6622
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6693
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$A);
|
6623
6694
|
|
6624
6695
|
var disabled = context.disabled || props.disabled;
|
6625
6696
|
var className = useItemStyling({
|
@@ -6765,7 +6836,7 @@ Menu.Separator = Separator;
|
|
6765
6836
|
Menu.Header = Header;
|
6766
6837
|
Menu.RadioGroup = RadioGroup$1;
|
6767
6838
|
|
6768
|
-
var _excluded$
|
6839
|
+
var _excluded$B = ["children", "className", "expanded", "title", "fixed", "onClick"];
|
6769
6840
|
var TreeviewItem = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
6770
6841
|
return React__default.createElement("a", Object.assign({}, props, {
|
6771
6842
|
ref: ref
|
@@ -6779,7 +6850,7 @@ var TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
6779
6850
|
title = props.title,
|
6780
6851
|
fixed = props.fixed,
|
6781
6852
|
onClick = props.onClick,
|
6782
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6853
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$B);
|
6783
6854
|
|
6784
6855
|
var _React$useState = React__default.useState(fixed || initialExpanded),
|
6785
6856
|
expanded = _React$useState[0],
|
@@ -6879,7 +6950,7 @@ var useDropTarget = function useDropTarget(onDrop) {
|
|
6879
6950
|
return [isDraggedOver, props];
|
6880
6951
|
};
|
6881
6952
|
|
6882
|
-
var _excluded$
|
6953
|
+
var _excluded$C = ["active", "children", "onDrop", "postfix", "prefix", "role"],
|
6883
6954
|
_excluded2$5 = ["children"];
|
6884
6955
|
var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
6885
6956
|
var active = props.active,
|
@@ -6888,7 +6959,7 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
6888
6959
|
postfix = props.postfix,
|
6889
6960
|
prefix = props.prefix,
|
6890
6961
|
role = props.role,
|
6891
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6962
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$C);
|
6892
6963
|
|
6893
6964
|
var proxyRef = useProxiedRef(ref);
|
6894
6965
|
|
@@ -6922,7 +6993,7 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
6922
6993
|
}), prefix && React__default.createElement("span", {
|
6923
6994
|
className: "yt-navigation__item__prefix flex items-center"
|
6924
6995
|
}, prefix), React__default.createElement("a", Object.assign({}, otherProps, {
|
6925
|
-
className: "flex-grow
|
6996
|
+
className: "block flex-grow truncate",
|
6926
6997
|
ref: proxyRef
|
6927
6998
|
}), children), postfix && React__default.createElement("span", {
|
6928
6999
|
className: "yt-navigation__item__postfix ml-1"
|
@@ -6930,7 +7001,7 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
6930
7001
|
});
|
6931
7002
|
var Panel = /*#__PURE__*/React__default.forwardRef(function Panel(props, ref) {
|
6932
7003
|
return React__default.createElement("div", Object.assign({}, props, {
|
6933
|
-
className: cn('bg-white p-3
|
7004
|
+
className: cn('w-full bg-white p-3', props.className),
|
6934
7005
|
ref: ref
|
6935
7006
|
}));
|
6936
7007
|
});
|
@@ -6978,11 +7049,11 @@ var Menu$1 = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
|
|
6978
7049
|
return scrollableAreas;
|
6979
7050
|
}, [props.children]);
|
6980
7051
|
return React__default.createElement(Treeview, Object.assign({}, props, {
|
6981
|
-
className: cn('
|
7052
|
+
className: cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className),
|
6982
7053
|
ref: ref
|
6983
7054
|
}), scrollableAreas.map(function (area, i) {
|
6984
7055
|
return Array.isArray(area) ? React__default.createElement("div", {
|
6985
|
-
className: "flex
|
7056
|
+
className: "divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto",
|
6986
7057
|
key: i
|
6987
7058
|
}, area) : area;
|
6988
7059
|
}));
|
@@ -6995,6 +7066,7 @@ var Navigation = /*#__PURE__*/React__default.forwardRef(function Navigation(prop
|
|
6995
7066
|
var className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);
|
6996
7067
|
return React__default.createElement("div", Object.assign({}, otherProps, {
|
6997
7068
|
className: className,
|
7069
|
+
"data-taco": "navigation",
|
6998
7070
|
ref: ref
|
6999
7071
|
}), children);
|
7000
7072
|
});
|
@@ -7051,7 +7123,7 @@ var PageNumbers = function PageNumbers(_ref) {
|
|
7051
7123
|
}));
|
7052
7124
|
};
|
7053
7125
|
|
7054
|
-
var _excluded$
|
7126
|
+
var _excluded$D = ["aria-label", "aria-labelledby", "data", "disabled", "emptyValue", "id", "multiselect", "onClick", "readOnly", "showSelectedIcon", "value"];
|
7055
7127
|
var useSelect = function useSelect(_ref, ref) {
|
7056
7128
|
var ariaLabel = _ref['aria-label'],
|
7057
7129
|
ariaLabelledBy = _ref['aria-labelledby'],
|
@@ -7063,9 +7135,11 @@ var useSelect = function useSelect(_ref, ref) {
|
|
7063
7135
|
multiselect = _ref.multiselect,
|
7064
7136
|
onClick = _ref.onClick,
|
7065
7137
|
readOnly = _ref.readOnly,
|
7138
|
+
_ref$showSelectedIcon = _ref.showSelectedIcon,
|
7139
|
+
showSelectedIcon = _ref$showSelectedIcon === void 0 ? false : _ref$showSelectedIcon,
|
7066
7140
|
_ref$value = _ref.value,
|
7067
7141
|
value = _ref$value === void 0 ? emptyValue : _ref$value,
|
7068
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
7142
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$D);
|
7069
7143
|
|
7070
7144
|
var _useLocalization = useLocalization(),
|
7071
7145
|
texts = _useLocalization.texts;
|
@@ -7162,9 +7236,13 @@ var useSelect = function useSelect(_ref, ref) {
|
|
7162
7236
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
7163
7237
|
}
|
7164
7238
|
} else {
|
7165
|
-
var
|
7239
|
+
var item = findByValue(searchData, value);
|
7166
7240
|
|
7167
|
-
|
7241
|
+
if (item) {
|
7242
|
+
text = showSelectedIcon && item.icon ? React.createElement(React.Fragment, null, React.cloneElement(item.icon, {
|
7243
|
+
className: cn(item.icon.props.className, 'mr-1')
|
7244
|
+
}), item.text) : item.text;
|
7245
|
+
}
|
7168
7246
|
}
|
7169
7247
|
}
|
7170
7248
|
|
@@ -7208,14 +7286,14 @@ var useSelect = function useSelect(_ref, ref) {
|
|
7208
7286
|
};
|
7209
7287
|
};
|
7210
7288
|
|
7211
|
-
var _excluded$
|
7289
|
+
var _excluded$E = ["autoFocus", "className", "highlighted", "style"],
|
7212
7290
|
_excluded2$6 = ["container"],
|
7213
7291
|
_excluded3 = ["editable"];
|
7214
7292
|
var BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
|
7215
7293
|
var autoFocus = props.autoFocus,
|
7216
7294
|
externalClassName = props.className,
|
7217
7295
|
style = props.style,
|
7218
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
7296
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$E);
|
7219
7297
|
|
7220
7298
|
var _useSelect = useSelect(otherProps, ref),
|
7221
7299
|
button = _useSelect.button,
|
@@ -7269,8 +7347,9 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
|
|
7269
7347
|
}), props.multiselect ? renderMultiSelection() : React.createElement("span", {
|
7270
7348
|
className: "flex-grow"
|
7271
7349
|
}, text), React.createElement("span", {
|
7272
|
-
className: "h-8 w-8
|
7350
|
+
className: "flex h-8 w-8 items-center justify-center"
|
7273
7351
|
}, React.createElement(Icon, {
|
7352
|
+
className: "group-hover:text-grey-darkest text-black",
|
7274
7353
|
name: popover.visible ? 'chevron-up' : 'chevron-down'
|
7275
7354
|
})));
|
7276
7355
|
}), !otherProps.disabled && React.createElement(Popover$1.Popover, Object.assign({}, base, container), props.multiselect ? React.createElement(MultiListbox, Object.assign({}, commonListboxProps)) : React.createElement(Listbox, Object.assign({}, commonListboxProps))));
|
@@ -7361,7 +7440,7 @@ var usePagination = function usePagination(initialPageIndex, initialPageSize) {
|
|
7361
7440
|
};
|
7362
7441
|
};
|
7363
7442
|
|
7364
|
-
var _excluded$
|
7443
|
+
var _excluded$F = ["length", "pageIndex", "pageSize", "pageSizes", "setPageIndex", "setPageSize", "showPageControls", "showPageNumbers", "showPageSize", "dangerouslyHijackGlobalKeyboardNavigation"];
|
7365
7444
|
|
7366
7445
|
var getShowingLabel = function getShowingLabel(length, pageIndex, pageSize, texts) {
|
7367
7446
|
var minItemIndex = pageIndex * pageSize + 1;
|
@@ -7385,7 +7464,7 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7385
7464
|
showPageSize = _props$showPageSize === void 0 ? true : _props$showPageSize,
|
7386
7465
|
_props$dangerouslyHij = props.dangerouslyHijackGlobalKeyboardNavigation,
|
7387
7466
|
dangerouslyHijackGlobalKeyboardNavigation = _props$dangerouslyHij === void 0 ? false : _props$dangerouslyHij,
|
7388
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
7467
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$F);
|
7389
7468
|
|
7390
7469
|
var _useLocalization = useLocalization(),
|
7391
7470
|
texts = _useLocalization.texts;
|
@@ -7404,6 +7483,7 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7404
7483
|
var className = cn('inline-flex relative justify-between items-center', props.className);
|
7405
7484
|
return React.createElement("div", Object.assign({}, otherProps, {
|
7406
7485
|
className: className,
|
7486
|
+
"data-taco": "pagination",
|
7407
7487
|
ref: ref
|
7408
7488
|
}), showPageSize && React.createElement("span", {
|
7409
7489
|
className: "mr-4"
|
@@ -7467,13 +7547,13 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7467
7547
|
})));
|
7468
7548
|
});
|
7469
7549
|
|
7470
|
-
var _excluded$
|
7550
|
+
var _excluded$G = ["duration"];
|
7471
7551
|
var Progress = function Progress(_ref) {
|
7472
7552
|
var _cn;
|
7473
7553
|
|
7474
7554
|
var _ref$duration = _ref.duration,
|
7475
7555
|
duration = _ref$duration === void 0 ? undefined : _ref$duration,
|
7476
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
7556
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$G);
|
7477
7557
|
|
7478
7558
|
var style;
|
7479
7559
|
|
@@ -7497,7 +7577,7 @@ var Progress = function Progress(_ref) {
|
|
7497
7577
|
}));
|
7498
7578
|
};
|
7499
7579
|
|
7500
|
-
var _excluded$
|
7580
|
+
var _excluded$H = ["children"];
|
7501
7581
|
var sanitizeRowProps = function sanitizeRowProps(row, rowExpansionRenderer) {
|
7502
7582
|
var _row$subRows;
|
7503
7583
|
|
@@ -7537,7 +7617,7 @@ var getColumnsFromChildren = function getColumnsFromChildren(children, rowExpans
|
|
7537
7617
|
.map(function (_ref) {
|
7538
7618
|
var _ref$props = _ref.props,
|
7539
7619
|
groupChildren = _ref$props.children,
|
7540
|
-
props = _objectWithoutPropertiesLoose(_ref$props, _excluded$
|
7620
|
+
props = _objectWithoutPropertiesLoose(_ref$props, _excluded$H);
|
7541
7621
|
|
7542
7622
|
var column = _extends({}, props);
|
7543
7623
|
|
@@ -7782,6 +7862,8 @@ var useRowEditing = function useRowEditing(uniqueId) {
|
|
7782
7862
|
return plugin;
|
7783
7863
|
};
|
7784
7864
|
|
7865
|
+
var actionGroupClassName = '-mt-1 -mb-1 h-8 flex';
|
7866
|
+
|
7785
7867
|
var hasActions = function hasActions(inlineEditingUniqueId, handlers, actions) {
|
7786
7868
|
return !!actions || handlers.onRowCreate || handlers.onRowCopy || handlers.onRowDelete || !!inlineEditingUniqueId || handlers.onRowEdit;
|
7787
7869
|
};
|
@@ -7882,7 +7964,9 @@ var EditModeActions = function EditModeActions() {
|
|
7882
7964
|
document.removeEventListener('keydown', listener);
|
7883
7965
|
};
|
7884
7966
|
}, []);
|
7885
|
-
return React__default.createElement(
|
7967
|
+
return React__default.createElement("div", {
|
7968
|
+
className: actionGroupClassName
|
7969
|
+
}, React__default.createElement(IconButton, {
|
7886
7970
|
appearance: "primary",
|
7887
7971
|
icon: "tick",
|
7888
7972
|
type: "submit",
|
@@ -7907,7 +7991,7 @@ var useRowActions = function useRowActions(inlineEditingUniqueId, handlers, acti
|
|
7907
7991
|
hooks.visibleColumns.push(function (columns) {
|
7908
7992
|
return [].concat(columns, [{
|
7909
7993
|
id: '_actions',
|
7910
|
-
className: '
|
7994
|
+
className: 'flex justify-end px-1 overflow-visible',
|
7911
7995
|
flex: "0 0 calc((" + actionsLength + " * 2rem) + .5rem)",
|
7912
7996
|
Cell: function Cell(_ref) {
|
7913
7997
|
var row = _ref.row;
|
@@ -8005,7 +8089,9 @@ var useRowActions = function useRowActions(inlineEditingUniqueId, handlers, acti
|
|
8005
8089
|
}))) : null);
|
8006
8090
|
|
8007
8091
|
if (windowed) {
|
8008
|
-
return React__default.createElement(
|
8092
|
+
return React__default.createElement("div", {
|
8093
|
+
className: actionGroupClassName
|
8094
|
+
}, output);
|
8009
8095
|
}
|
8010
8096
|
|
8011
8097
|
return React__default.createElement(reactIntersectionObserver.InView, {
|
@@ -8013,7 +8099,8 @@ var useRowActions = function useRowActions(inlineEditingUniqueId, handlers, acti
|
|
8013
8099
|
}, function (_ref2) {
|
8014
8100
|
var inView = _ref2.inView,
|
8015
8101
|
ref = _ref2.ref;
|
8016
|
-
return React__default.createElement(
|
8102
|
+
return React__default.createElement("div", {
|
8103
|
+
className: actionGroupClassName,
|
8017
8104
|
ref: ref
|
8018
8105
|
}, inView ? output : null);
|
8019
8106
|
});
|
@@ -8027,7 +8114,7 @@ var useRowActions = function useRowActions(inlineEditingUniqueId, handlers, acti
|
|
8027
8114
|
return plugin;
|
8028
8115
|
};
|
8029
8116
|
|
8030
|
-
var _excluded$
|
8117
|
+
var _excluded$I = ["onChange"],
|
8031
8118
|
_excluded2$7 = ["onChange"];
|
8032
8119
|
|
8033
8120
|
var toggleBetween = function toggleBetween(fromRowIndex, toRowIndex) {
|
@@ -8075,7 +8162,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
8075
8162
|
rows = _ref.rows;
|
8076
8163
|
|
8077
8164
|
var _getToggleAllRowsSele = getToggleAllRowsSelectedProps(),
|
8078
|
-
props = _objectWithoutPropertiesLoose(_getToggleAllRowsSele, _excluded$
|
8165
|
+
props = _objectWithoutPropertiesLoose(_getToggleAllRowsSele, _excluded$I);
|
8079
8166
|
|
8080
8167
|
var onChange = function onChange(checked) {
|
8081
8168
|
if (checked) {
|
@@ -8088,7 +8175,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
8088
8175
|
|
8089
8176
|
return React__default.createElement(Checkbox, Object.assign({}, props, {
|
8090
8177
|
onChange: onChange,
|
8091
|
-
className: "
|
8178
|
+
className: "mt-px"
|
8092
8179
|
}));
|
8093
8180
|
},
|
8094
8181
|
Cell: function Cell(_ref2) {
|
@@ -8120,7 +8207,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
8120
8207
|
};
|
8121
8208
|
|
8122
8209
|
return React__default.createElement(Checkbox, Object.assign({}, props, {
|
8123
|
-
className: "
|
8210
|
+
className: "mt-px",
|
8124
8211
|
onClick: onClick,
|
8125
8212
|
// this is necessary to remove console spam from eslint
|
8126
8213
|
onChange: function onChange() {
|
@@ -8129,7 +8216,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
8129
8216
|
}));
|
8130
8217
|
},
|
8131
8218
|
flex: '0 0 36px',
|
8132
|
-
className: 'flex-col justify-start'
|
8219
|
+
className: 'flex-col justify-start !pb-0'
|
8133
8220
|
}].concat(columns);
|
8134
8221
|
});
|
8135
8222
|
}
|
@@ -8389,7 +8476,7 @@ var useRowDraggable = function useRowDraggable(onRowDrag) {
|
|
8389
8476
|
return plugin;
|
8390
8477
|
};
|
8391
8478
|
|
8392
|
-
var _excluded$
|
8479
|
+
var _excluded$J = ["children", "data", "dangerouslyHijackGlobalKeyboardNavigation", "onRowClick", "onRowDrag", "onSelectedRows", "rowClassName", "rowExpansionRenderer", "rowHeight", "selectedRows", "disableSorting", "manualSorting", "onSort", "sortRules", "disablePagination", "length", "onPaginate", "pageSize", "pageIndex", "inlineEditingUniqueId", "onRowCreate", "actions", "onRowEdit", "onRowCopy", "onRowDelete", "onRowActive", "windowed"],
|
8393
8480
|
_excluded2$8 = ["headerGroups", "rows", "sortedRows", "prepareRow", "state", "page", "gotoPage", "setPageSize"];
|
8394
8481
|
|
8395
8482
|
var useTableRowActive = function useTableRowActive(activeIndex, rows, rowExpansionRenderer, handleonRowActive) {
|
@@ -8494,7 +8581,7 @@ var useTable = function useTable(props, ref) {
|
|
8494
8581
|
onRowActive = props.onRowActive,
|
8495
8582
|
_props$windowed = props.windowed,
|
8496
8583
|
windowed = _props$windowed === void 0 ? false : _props$windowed,
|
8497
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
8584
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$J);
|
8498
8585
|
|
8499
8586
|
if (onSelectedRows && !selectedRows || !onSelectedRows && selectedRows) {
|
8500
8587
|
throw new Error('Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection');
|
@@ -8611,13 +8698,13 @@ var useTable = function useTable(props, ref) {
|
|
8611
8698
|
};
|
8612
8699
|
};
|
8613
8700
|
|
8614
|
-
var _excluded$
|
8701
|
+
var _excluded$K = ["row", "index", "instance", "headerGroups"];
|
8615
8702
|
|
8616
8703
|
var renderCell = function renderCell(cell, row) {
|
8617
8704
|
var props = _extends({}, cell.getCellProps(), {
|
8618
8705
|
className: cn('yt-table__cell', cell.column.className, {
|
8619
|
-
'
|
8620
|
-
'
|
8706
|
+
'justify-start text-left': cell.column.align === 'left',
|
8707
|
+
'justify-end text-right': cell.column.align === 'right'
|
8621
8708
|
}),
|
8622
8709
|
style: _extends({}, cell.column.style, {
|
8623
8710
|
flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex
|
@@ -8625,7 +8712,8 @@ var renderCell = function renderCell(cell, row) {
|
|
8625
8712
|
});
|
8626
8713
|
|
8627
8714
|
return React__default.createElement("div", Object.assign({}, props, {
|
8628
|
-
role: "gridcell"
|
8715
|
+
role: "gridcell",
|
8716
|
+
"data-taco": "table-cell"
|
8629
8717
|
}), cell.render('Cell') || null);
|
8630
8718
|
};
|
8631
8719
|
|
@@ -8633,7 +8721,7 @@ var Row = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
8633
8721
|
var row = _ref.row,
|
8634
8722
|
index = _ref.index,
|
8635
8723
|
instance = _ref.instance,
|
8636
|
-
rowProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
8724
|
+
rowProps = _objectWithoutPropertiesLoose(_ref, _excluded$K);
|
8637
8725
|
|
8638
8726
|
var activeIndex = rowProps.activeIndex,
|
8639
8727
|
onRowClick = rowProps.onRowClick,
|
@@ -8720,8 +8808,8 @@ var Column = function Column(_ref) {
|
|
8720
8808
|
className: cn('yt-table__cell', cell.className, {
|
8721
8809
|
'yt-table__cell__group': !!cell.columns,
|
8722
8810
|
'yt-table__cell--disable-sort': cell.disableSorting,
|
8723
|
-
'
|
8724
|
-
'
|
8811
|
+
'justify-start text-left': cell.align === 'left',
|
8812
|
+
'justify-end text-right': cell.align === 'right'
|
8725
8813
|
}),
|
8726
8814
|
style: _extends({}, cell.style, {
|
8727
8815
|
flex: cell.flex
|
@@ -8733,13 +8821,14 @@ var Column = function Column(_ref) {
|
|
8733
8821
|
}
|
8734
8822
|
|
8735
8823
|
return React__default.createElement("div", Object.assign({}, props, {
|
8736
|
-
key: cell.id
|
8824
|
+
key: cell.id,
|
8825
|
+
"data-taco": "table-column"
|
8737
8826
|
}), React__default.createElement("span", null, cell.render('Header')), cell.isSorted ? React__default.createElement(Icon, {
|
8738
8827
|
name: cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'
|
8739
8828
|
}) : null);
|
8740
8829
|
};
|
8741
8830
|
|
8742
|
-
var _excluded$
|
8831
|
+
var _excluded$L = ["autoFocus", "children", "disableSorting", "headerGroups", "headerRef", "bodyRef"];
|
8743
8832
|
var DefaultEmptyState = function DefaultEmptyState() {
|
8744
8833
|
return null;
|
8745
8834
|
};
|
@@ -8751,7 +8840,7 @@ var BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(props,
|
|
8751
8840
|
headerGroups = props.headerGroups,
|
8752
8841
|
headerRef = props.headerRef,
|
8753
8842
|
bodyRef = props.bodyRef,
|
8754
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
8843
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$L);
|
8755
8844
|
|
8756
8845
|
React__default.useEffect(function () {
|
8757
8846
|
if (autoFocus && tableRef.current) {
|
@@ -8786,11 +8875,11 @@ var BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(props,
|
|
8786
8875
|
}, children));
|
8787
8876
|
});
|
8788
8877
|
|
8789
|
-
var _excluded$
|
8878
|
+
var _excluded$M = ["emptyStateRenderer"];
|
8790
8879
|
var Table = /*#__PURE__*/React__default.forwardRef(function Table(props, ref) {
|
8791
8880
|
var _props$emptyStateRend = props.emptyStateRenderer,
|
8792
8881
|
emptyStateRenderer = _props$emptyStateRend === void 0 ? DefaultEmptyState : _props$emptyStateRend,
|
8793
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
8882
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$M);
|
8794
8883
|
|
8795
8884
|
var tableRef = useProxiedRef(ref);
|
8796
8885
|
|
@@ -8855,14 +8944,14 @@ PaginatedTable.Group = function () {
|
|
8855
8944
|
return null;
|
8856
8945
|
};
|
8857
8946
|
|
8858
|
-
var _excluded$
|
8947
|
+
var _excluded$N = ["height"],
|
8859
8948
|
_excluded2$9 = ["emptyStateRenderer", "length", "loadMore"];
|
8860
8949
|
var ROW_HEIGHT = 40;
|
8861
8950
|
var VariableRow = /*#__PURE__*/React__default.memo(function (_ref) {
|
8862
8951
|
var data = _ref.data,
|
8863
8952
|
index = _ref.index,
|
8864
8953
|
_ref$style = _ref.style,
|
8865
|
-
style = _objectWithoutPropertiesLoose(_ref$style, _excluded$
|
8954
|
+
style = _objectWithoutPropertiesLoose(_ref$style, _excluded$N);
|
8866
8955
|
|
8867
8956
|
var _useLocalization = useLocalization(),
|
8868
8957
|
texts = _useLocalization.texts;
|
@@ -9228,7 +9317,7 @@ var useTableRowCreation = function useTableRowCreation(data, tableRef) {
|
|
9228
9317
|
};
|
9229
9318
|
};
|
9230
9319
|
|
9231
|
-
var _excluded$
|
9320
|
+
var _excluded$O = ["id", "defaultId", "children", "onChange", "orientation"],
|
9232
9321
|
_excluded2$a = ["id", "disabled"],
|
9233
9322
|
_excluded3$1 = ["id"];
|
9234
9323
|
var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|
@@ -9238,7 +9327,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|
|
9238
9327
|
onChange = props.onChange,
|
9239
9328
|
_props$orientation = props.orientation,
|
9240
9329
|
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
9241
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
9330
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$O);
|
9242
9331
|
|
9243
9332
|
var className = cn('yt-tabs', "yt-tabs--" + orientation, {
|
9244
9333
|
'flex w-full': orientation === 'vertical'
|
@@ -9292,9 +9381,9 @@ Tabs.List = TabList;
|
|
9292
9381
|
Tabs.Trigger = TabTrigger;
|
9293
9382
|
Tabs.Content = TabContent;
|
9294
9383
|
|
9295
|
-
var _excluded$
|
9384
|
+
var _excluded$P = ["defaultValue", "highlighted", "state"];
|
9296
9385
|
var Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
9297
|
-
var otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
9386
|
+
var otherProps = _objectWithoutPropertiesLoose(props, _excluded$P);
|
9298
9387
|
|
9299
9388
|
var classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);
|
9300
9389
|
return React.createElement("textarea", Object.assign({}, otherProps, {
|
@@ -9303,11 +9392,11 @@ var Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
|
9303
9392
|
}));
|
9304
9393
|
});
|
9305
9394
|
|
9306
|
-
var _excluded$
|
9395
|
+
var _excluded$Q = ["label", "onChange"];
|
9307
9396
|
var Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
9308
9397
|
var label = props.label,
|
9309
9398
|
onChange = props.onChange,
|
9310
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
9399
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$Q);
|
9311
9400
|
|
9312
9401
|
var className = cn('group h-6 w-10 flex rounded-full inline-flex', {
|
9313
9402
|
'mr-2': !!label,
|
@@ -9643,7 +9732,7 @@ var tailwind_config = {
|
|
9643
9732
|
};
|
9644
9733
|
var tailwind_config_1 = tailwind_config.theme;
|
9645
9734
|
|
9646
|
-
var _excluded$
|
9735
|
+
var _excluded$R = ["autoStart", "onComplete", "onClose", "onReady", "spotlightClicks", "disableCloseOnEsc", "disableScrollParentFix"];
|
9647
9736
|
|
9648
9737
|
var Tooltip$1 = function Tooltip(_ref) {
|
9649
9738
|
var continuous = _ref.continuous,
|
@@ -9708,7 +9797,7 @@ var Tour = function Tour(props) {
|
|
9708
9797
|
disableTourSkipOnEsc = props.disableCloseOnEsc,
|
9709
9798
|
_props$disableScrollP = props.disableScrollParentFix,
|
9710
9799
|
disableScrollParentFix = _props$disableScrollP === void 0 ? false : _props$disableScrollP,
|
9711
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$
|
9800
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$R);
|
9712
9801
|
|
9713
9802
|
var steps = React.useMemo(function () {
|
9714
9803
|
return React__default.Children.map(props.children, function (child) {
|
@@ -9803,6 +9892,7 @@ var useOnClickOutside = function useOnClickOutside(ref, callback) {
|
|
9803
9892
|
};
|
9804
9893
|
|
9805
9894
|
exports.Accordion = Accordion;
|
9895
|
+
exports.Backdrop = Backdrop;
|
9806
9896
|
exports.Badge = Badge;
|
9807
9897
|
exports.Banner = Banner;
|
9808
9898
|
exports.Button = Button$1;
|