@economic/taco 1.1.5-alpha.102 → 1.1.5-alpha.127
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/Accordion/Accordion.stories.d.ts +26 -0
- package/dist/components/Backdrop/Backdrop.stories.d.ts +7 -0
- package/dist/components/Badge/Badge.stories.d.ts +15 -0
- package/dist/components/Banner/Banner.stories.d.ts +23 -0
- package/dist/components/Button/Button.stories.d.ts +69 -0
- package/dist/components/Calendar/Calendar.d.ts +3 -1
- package/dist/components/Calendar/Calendar.stories.d.ts +13 -0
- package/dist/components/Card/Card.stories.d.ts +12 -0
- package/dist/components/Datepicker/Datepicker.stories.d.ts +43 -0
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/Dialog.stories.d.ts +54 -0
- package/dist/components/Field/Field.stories.d.ts +14 -0
- package/dist/components/Form/Form.stories.d.ts +14 -0
- package/dist/components/Group/Group.d.ts +11 -1
- package/dist/components/Group/Group.stories.d.ts +23 -0
- package/dist/components/Hanger/Hanger.stories.d.ts +11 -0
- package/dist/components/HoverCard/HoverCard.stories.d.ts +28 -0
- package/dist/components/Icon/Icon.stories.d.ts +24 -0
- package/dist/components/Icon/components/ChevronLeftSolid.d.ts +3 -0
- package/dist/components/Icon/components/ChevronRightSolid.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/IconButton/IconButton.stories.d.ts +45 -0
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.stories.d.ts +43 -0
- package/dist/components/Listbox/Listbox.stories.d.ts +44 -0
- package/dist/components/Menu/Menu.d.ts +2 -2
- package/dist/components/Menu/Menu.stories.d.ts +93 -0
- 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.stories.d.ts +7 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +28 -0
- package/dist/components/Popover/Popover.stories.d.ts +14 -0
- package/dist/components/Progress/Progress.stories.d.ts +8 -0
- package/dist/components/RadioGroup/RadioGroup.stories.d.ts +49 -0
- package/dist/components/SearchInput/SearchInput.stories.d.ts +41 -0
- package/dist/components/Select/Select.stories.d.ts +35 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +15 -0
- package/dist/components/Table/Table.stories.d.ts +32 -0
- package/dist/components/Table/util/rowIndexPath.d.ts +2 -2
- package/dist/components/Tabs/Tabs.stories.d.ts +19 -0
- package/dist/components/Textarea/Textarea.stories.d.ts +40 -0
- package/dist/components/Toast/Toast.d.ts +2 -2
- package/dist/components/Toast/Toast.stories.d.ts +12 -0
- package/dist/components/Toast/Toaster.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.stories.d.ts +25 -0
- package/dist/components/Tour/Tour.stories.d.ts +11 -0
- package/dist/css/Typography.stories.d.ts +6 -0
- package/dist/esm/components/Badge/Badge.js +1 -1
- package/dist/esm/components/Badge/Badge.js.map +1 -1
- package/dist/esm/components/Calendar/Calendar.js +4 -11
- package/dist/esm/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/components/Combobox/useCombobox.js +12 -13
- package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +39 -58
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
- package/dist/esm/components/Field/Field.js +10 -12
- package/dist/esm/components/Field/Field.js.map +1 -1
- package/dist/esm/components/Form/Form.js +6 -8
- package/dist/esm/components/Form/Form.js.map +1 -1
- package/dist/esm/components/Group/Group.js +9 -8
- package/dist/esm/components/Group/Group.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +27 -35
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/HoverCard/HoverCard.js +8 -9
- package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js +7 -8
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronLeftSolid.js +20 -0
- package/dist/esm/components/Icon/components/ChevronLeftSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronRightSolid.js +20 -0
- package/dist/esm/components/Icon/components/ChevronRightSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/index.js +4 -0
- package/dist/esm/components/Icon/components/index.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js +9 -11
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Input/Input.js +25 -25
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Listbox/Listbox.js +24 -25
- package/dist/esm/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/components/Listbox/ScrollableList.js +2 -2
- package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/components/Listbox/useListbox.js +3 -2
- package/dist/esm/components/Listbox/useListbox.js.map +1 -1
- package/dist/esm/components/Listbox/useMultiListbox.js +7 -7
- package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
- package/dist/esm/components/Menu/Menu.js +16 -34
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
- package/dist/esm/components/Navigation/Navigation.js +36 -44
- package/dist/esm/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +39 -56
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Pagination/usePaginationShortcuts.js +4 -5
- package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +29 -34
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/Popover/Primitives.js.map +1 -1
- package/dist/esm/components/Progress/Progress.js +11 -15
- package/dist/esm/components/Progress/Progress.js.map +1 -1
- package/dist/esm/components/Provider/Provider.js +13 -18
- package/dist/esm/components/Provider/Provider.js.map +1 -1
- package/dist/esm/components/RadioGroup/RadioGroup.js +45 -57
- package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +10 -12
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Select/Select.js +30 -31
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/useSelect.js +6 -7
- package/dist/esm/components/Select/useSelect.js.map +1 -1
- package/dist/esm/components/Spinner/Spinner.js +12 -19
- package/dist/esm/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/components/Switch/Switch.js +9 -10
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js +2 -3
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/components/Table/hooks/useTable.js +5 -1
- package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +18 -13
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
- package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +25 -27
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Textarea/Textarea.js +11 -9
- package/dist/esm/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/components/Toast/Toast.js +6 -1
- package/dist/esm/components/Toast/Toast.js.map +1 -1
- package/dist/esm/components/Toast/Toaster.js +88 -118
- package/dist/esm/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/components/Toast/util.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +7 -8
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Tour/Tour.js +46 -53
- package/dist/esm/components/Tour/Tour.js.map +1 -1
- package/dist/esm/components/Treeview/Treeview.js +26 -36
- package/dist/esm/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/esm/index.css +623 -635
- package/dist/esm/index.js +1 -1
- package/dist/esm/primitives/Button.js.map +1 -1
- package/dist/esm/utils/hooks/useListKeyboardNavigation.js +10 -11
- package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -1
- package/dist/esm/utils/input.js +1 -1
- package/dist/esm/utils/input.js.map +1 -1
- package/dist/index.css +623 -635
- package/dist/primitives/Button.d.ts +2 -1
- package/dist/taco.cjs.development.js +709 -783
- 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/hooks/useListKeyboardNavigation.d.ts +1 -1
- package/package.json +5 -6
- package/types.json +18 -4
@@ -14,7 +14,6 @@ var uuid = require('uuid');
|
|
14
14
|
var framerMotion = require('framer-motion');
|
15
15
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
16
16
|
var PopoverPrimitive = require('@radix-ui/react-popover');
|
17
|
-
var keycode = _interopDefault(require('keycode'));
|
18
17
|
var debounce = _interopDefault(require('lodash/debounce'));
|
19
18
|
var dateFns = require('date-fns');
|
20
19
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
@@ -517,6 +516,22 @@ function IconChevronLeftDouble(props, svgRef) {
|
|
517
516
|
|
518
517
|
var ChevronLeftDouble = /*#__PURE__*/React.forwardRef(IconChevronLeftDouble);
|
519
518
|
|
519
|
+
function IconChevronLeftSolid(props, svgRef) {
|
520
|
+
return React.createElement("svg", Object.assign({
|
521
|
+
fill: "none",
|
522
|
+
xmlns: "http://www.w3.org/2000/svg",
|
523
|
+
viewBox: "0 0 24 24",
|
524
|
+
ref: svgRef
|
525
|
+
}, props), React.createElement("path", {
|
526
|
+
fillRule: "evenodd",
|
527
|
+
clipRule: "evenodd",
|
528
|
+
d: "M15.5 6.207a.5.5 0 00-.854-.353l-5.792 5.792a.5.5 0 000 .708l5.792 5.792a.5.5 0 00.854-.353V6.207z",
|
529
|
+
fill: "currentColor"
|
530
|
+
}));
|
531
|
+
}
|
532
|
+
|
533
|
+
var ChevronLeftSolid = /*#__PURE__*/React.forwardRef(IconChevronLeftSolid);
|
534
|
+
|
520
535
|
function IconChevronLeft(props, svgRef) {
|
521
536
|
return React.createElement("svg", Object.assign({
|
522
537
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -545,6 +560,22 @@ function IconChevronRightDouble(props, svgRef) {
|
|
545
560
|
|
546
561
|
var ChevronRightDouble = /*#__PURE__*/React.forwardRef(IconChevronRightDouble);
|
547
562
|
|
563
|
+
function IconChevronRightSolid(props, svgRef) {
|
564
|
+
return React.createElement("svg", Object.assign({
|
565
|
+
fill: "none",
|
566
|
+
xmlns: "http://www.w3.org/2000/svg",
|
567
|
+
viewBox: "0 0 24 24",
|
568
|
+
ref: svgRef
|
569
|
+
}, props), React.createElement("path", {
|
570
|
+
fillRule: "evenodd",
|
571
|
+
clipRule: "evenodd",
|
572
|
+
d: "M8.5 17.793a.5.5 0 00.854.353l5.792-5.792a.5.5 0 000-.708L9.354 5.854a.5.5 0 00-.854.353v11.586z",
|
573
|
+
fill: "currentColor"
|
574
|
+
}));
|
575
|
+
}
|
576
|
+
|
577
|
+
var ChevronRightSolid = /*#__PURE__*/React.forwardRef(IconChevronRightSolid);
|
578
|
+
|
548
579
|
function IconChevronRight(props, svgRef) {
|
549
580
|
return React.createElement("svg", Object.assign({
|
550
581
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -3025,8 +3056,10 @@ const icons = {
|
|
3025
3056
|
'chevron-down-solid': ChevronDownSolid,
|
3026
3057
|
'chevron-down': ChevronDown,
|
3027
3058
|
'chevron-left-double': ChevronLeftDouble,
|
3059
|
+
'chevron-left-solid': ChevronLeftSolid,
|
3028
3060
|
'chevron-left': ChevronLeft,
|
3029
3061
|
'chevron-right-double': ChevronRightDouble,
|
3062
|
+
'chevron-right-solid': ChevronRightSolid,
|
3030
3063
|
'chevron-right': ChevronRight,
|
3031
3064
|
'chevron-up-double': ChevronUpDouble,
|
3032
3065
|
'chevron-up-solid': ChevronUpSolid,
|
@@ -3203,17 +3236,17 @@ const icons = {
|
|
3203
3236
|
zoom: Zoom
|
3204
3237
|
};
|
3205
3238
|
|
3206
|
-
|
3207
|
-
var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
3239
|
+
const Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
3208
3240
|
var _props$className;
|
3209
3241
|
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3242
|
+
const {
|
3243
|
+
name,
|
3244
|
+
...otherProps
|
3245
|
+
} = props;
|
3246
|
+
const Component = icons[name];
|
3214
3247
|
/* 24x24 _at the base body font_ - must be em so that they scale with font size - tailwind spacing uses rem */
|
3215
3248
|
|
3216
|
-
|
3249
|
+
const className = cn('inline-flex h-[1.715em] w-[1.715em] flex-shrink-0', props.className, {
|
3217
3250
|
'p-[3px]': (_props$className = props.className) === null || _props$className === void 0 ? void 0 : _props$className.includes('rounded-full')
|
3218
3251
|
});
|
3219
3252
|
return Component ? React__default.createElement(Component, Object.assign({}, otherProps, {
|
@@ -3225,7 +3258,7 @@ var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
|
3225
3258
|
})) : null;
|
3226
3259
|
});
|
3227
3260
|
|
3228
|
-
var _excluded
|
3261
|
+
var _excluded = ["id"],
|
3229
3262
|
_excluded2 = ["id", "defaultId", "onChange", "as"];
|
3230
3263
|
var AccordionContext = /*#__PURE__*/React__default.createContext({
|
3231
3264
|
as: 'h2'
|
@@ -3263,7 +3296,7 @@ var Content = /*#__PURE__*/React__default.forwardRef(function AccordionContent(p
|
|
3263
3296
|
|
3264
3297
|
var Item = function Item(props) {
|
3265
3298
|
var id = props.id,
|
3266
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded
|
3299
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
3267
3300
|
|
3268
3301
|
return React__default.createElement(AccordionPrimitive.Item, Object.assign({}, otherProps, {
|
3269
3302
|
value: id
|
@@ -3318,7 +3351,7 @@ var Backdrop = /*#__PURE__*/React.forwardRef(function Backdrop(props, ref) {
|
|
3318
3351
|
}));
|
3319
3352
|
});
|
3320
3353
|
|
3321
|
-
|
3354
|
+
const VisuallyHidden = /*#__PURE__*/React.forwardRef(function VisuallyHidden(props, ref) {
|
3322
3355
|
return React.createElement("span", Object.assign({}, props, {
|
3323
3356
|
className: "sr-only",
|
3324
3357
|
ref: ref
|
@@ -3364,7 +3397,7 @@ const getOutlineClasses = state => {
|
|
3364
3397
|
}
|
3365
3398
|
};
|
3366
3399
|
|
3367
|
-
var _excluded$
|
3400
|
+
var _excluded$1 = ["children", "compact", "outline", "state"];
|
3368
3401
|
var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
3369
3402
|
var _cn;
|
3370
3403
|
|
@@ -3374,9 +3407,9 @@ var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
|
3374
3407
|
_props$outline = props.outline,
|
3375
3408
|
outline = _props$outline === void 0 ? false : _props$outline,
|
3376
3409
|
state = props.state,
|
3377
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3410
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
3378
3411
|
|
3379
|
-
var className = cn('rounded-full border font-bold text-xs uppercase overflow-hidden whitespace-nowrap inline-flex items-center justify-center
|
3412
|
+
var className = cn('rounded-full border font-bold text-xs uppercase overflow-hidden whitespace-nowrap inline-flex items-center justify-center', (_cn = {}, _cn[getOutlineClasses(state)] = outline, _cn["border-transparent " + getStateClasses(state)] = !outline, _cn['h-2 w-2 min-w-0'] = compact, _cn['h-5 py-0 px-1.5'] = !compact, _cn), props.className);
|
3380
3413
|
return React.createElement("span", Object.assign({}, otherProps, {
|
3381
3414
|
"aria-atomic": "true",
|
3382
3415
|
"aria-live": "polite",
|
@@ -3436,13 +3469,13 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
3436
3469
|
}), React.Children.count(props.children) > 1 ? React.Children.map(props.children, child => typeof child === 'string' ? React.createElement("span", null, child) : child) : props.children);
|
3437
3470
|
});
|
3438
3471
|
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3472
|
+
const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
3473
|
+
const {
|
3474
|
+
title,
|
3475
|
+
children,
|
3476
|
+
placement,
|
3477
|
+
...otherProps
|
3478
|
+
} = props;
|
3446
3479
|
return React.createElement(TooltipPrimitive.Root, {
|
3447
3480
|
delayDuration: 50
|
3448
3481
|
}, React.createElement(TooltipPrimitive.Trigger, {
|
@@ -3534,14 +3567,13 @@ const createButton = (props, className, ref) => {
|
|
3534
3567
|
return button;
|
3535
3568
|
};
|
3536
3569
|
|
3537
|
-
|
3538
|
-
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3543
|
-
|
3544
|
-
var className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
|
3570
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
3571
|
+
const {
|
3572
|
+
icon,
|
3573
|
+
rounded = false,
|
3574
|
+
...otherProps
|
3575
|
+
} = props;
|
3576
|
+
const className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
|
3545
3577
|
'rounded-full': rounded,
|
3546
3578
|
rounded: !rounded,
|
3547
3579
|
'cursor-not-allowed opacity-50': props.disabled,
|
@@ -3552,13 +3584,13 @@ var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
|
3552
3584
|
return null;
|
3553
3585
|
}
|
3554
3586
|
|
3555
|
-
return createButton(
|
3587
|
+
return createButton({ ...otherProps,
|
3556
3588
|
children: React.createElement(Icon, {
|
3557
3589
|
name: icon,
|
3558
3590
|
className: "m-0 p-0"
|
3559
3591
|
}),
|
3560
3592
|
'data-taco': 'icon-button'
|
3561
|
-
}
|
3593
|
+
}, className, ref);
|
3562
3594
|
});
|
3563
3595
|
|
3564
3596
|
var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
@@ -3578,10 +3610,10 @@ var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
|
3578
3610
|
}) : null);
|
3579
3611
|
});
|
3580
3612
|
|
3581
|
-
var _excluded$
|
3613
|
+
var _excluded$2 = ["fluid"];
|
3582
3614
|
var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3583
3615
|
var fluid = props.fluid,
|
3584
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3616
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
3585
3617
|
|
3586
3618
|
var className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
|
3587
3619
|
'cursor-not-allowed opacity-50': props.disabled,
|
@@ -3652,27 +3684,21 @@ function useTimer(duration = 0, callback) {
|
|
3652
3684
|
};
|
3653
3685
|
}
|
3654
3686
|
|
3655
|
-
|
3656
|
-
|
3657
|
-
|
3658
|
-
|
3659
|
-
|
3660
|
-
|
3661
|
-
|
3662
|
-
|
3663
|
-
|
3664
|
-
setVisibility = _React$useState[1];
|
3665
|
-
|
3666
|
-
React__default.useEffect(function () {
|
3667
|
-
var timeout;
|
3687
|
+
const Spinner$1 = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
3688
|
+
const {
|
3689
|
+
delay = 500,
|
3690
|
+
label,
|
3691
|
+
...otherProps
|
3692
|
+
} = props;
|
3693
|
+
const [visible, setVisibility] = React__default.useState(!delay);
|
3694
|
+
React__default.useEffect(() => {
|
3695
|
+
let timeout;
|
3668
3696
|
|
3669
3697
|
if (delay) {
|
3670
|
-
timeout = window.setTimeout(
|
3671
|
-
return setVisibility(true);
|
3672
|
-
}, delay);
|
3698
|
+
timeout = window.setTimeout(() => setVisibility(true), delay);
|
3673
3699
|
}
|
3674
3700
|
|
3675
|
-
return
|
3701
|
+
return () => {
|
3676
3702
|
if (timeout) {
|
3677
3703
|
clearTimeout(timeout);
|
3678
3704
|
}
|
@@ -3683,7 +3709,7 @@ var Spinner$1 = /*#__PURE__*/React__default.forwardRef(function Spinner(props, r
|
|
3683
3709
|
return null;
|
3684
3710
|
}
|
3685
3711
|
|
3686
|
-
|
3712
|
+
const className = cn('inline-flex flex-col relative items-center', otherProps.className);
|
3687
3713
|
return React__default.createElement("div", Object.assign({}, otherProps, {
|
3688
3714
|
className: className,
|
3689
3715
|
"data-taco": "spinner",
|
@@ -3763,6 +3789,11 @@ const Toast = ({
|
|
3763
3789
|
});
|
3764
3790
|
const timer = useTimer(autoClose, handleClose);
|
3765
3791
|
const controls = framerMotion.useAnimation();
|
3792
|
+
|
3793
|
+
if (!content) {
|
3794
|
+
console.warn(`Toast requires 'content' property, which can't be empty string, null or undefined. Current content value is set to ${content === '' ? 'empty string' : content}.`);
|
3795
|
+
}
|
3796
|
+
|
3766
3797
|
React__default.useEffect(() => {
|
3767
3798
|
if (autoClose) {
|
3768
3799
|
timer.start();
|
@@ -3798,7 +3829,7 @@ const Toast = ({
|
|
3798
3829
|
"data-taco": "toast",
|
3799
3830
|
onMouseEnter: timer.pause,
|
3800
3831
|
onMouseLeave: timer.resume
|
3801
|
-
}), getBadgeIcon(type),
|
3832
|
+
}), getBadgeIcon(type), React__default.createElement("div", {
|
3802
3833
|
className: "flex-grow"
|
3803
3834
|
}, content), React__default.createElement(IconButton, {
|
3804
3835
|
appearance: "discrete",
|
@@ -3809,62 +3840,49 @@ const Toast = ({
|
|
3809
3840
|
}));
|
3810
3841
|
};
|
3811
3842
|
|
3812
|
-
|
3813
|
-
|
3814
|
-
var ToastContext = /*#__PURE__*/React.createContext({});
|
3843
|
+
const DEFAULT_AUTO_CLOSE_TIMEOUT = 7500;
|
3844
|
+
const ToastContext = /*#__PURE__*/React.createContext({});
|
3815
3845
|
|
3816
|
-
|
3817
|
-
|
3818
|
-
|
3819
|
-
return JSON.stringify(toast.content) === JSON.stringify(content);
|
3820
|
-
});
|
3846
|
+
const insertToastWithoutDuplicates = (currentToasts, id, content, options, close) => {
|
3847
|
+
const nextToasts = [...currentToasts];
|
3848
|
+
const existingToastIndex = currentToasts.findIndex(toast => JSON.stringify(toast.content) === JSON.stringify(content));
|
3821
3849
|
|
3822
3850
|
if (existingToastIndex > -1) {
|
3823
3851
|
nextToasts[existingToastIndex].lastDuplicateId = id;
|
3824
3852
|
nextToasts[existingToastIndex].lastUpdated = Date.now();
|
3825
3853
|
} else {
|
3826
3854
|
nextToasts.push({
|
3827
|
-
id
|
3855
|
+
id,
|
3828
3856
|
content: typeof content === 'function' ? content(close) : content,
|
3829
|
-
options
|
3857
|
+
options
|
3830
3858
|
});
|
3831
3859
|
}
|
3832
3860
|
|
3833
3861
|
return nextToasts;
|
3834
3862
|
};
|
3835
3863
|
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
3840
|
-
|
3841
|
-
toasts = _React$useState[0],
|
3842
|
-
setToasts = _React$useState[1];
|
3864
|
+
const ToastProvider = ({
|
3865
|
+
children,
|
3866
|
+
...props
|
3867
|
+
}) => {
|
3868
|
+
const [toasts, setToasts] = React.useState([]);
|
3843
3869
|
|
3844
|
-
|
3845
|
-
setToasts(
|
3846
|
-
return currentToasts.filter(function (toast) {
|
3847
|
-
return toast.id !== id;
|
3848
|
-
});
|
3849
|
-
});
|
3870
|
+
const handleClose = id => {
|
3871
|
+
setToasts(currentToasts => currentToasts.filter(toast => toast.id !== id));
|
3850
3872
|
}; // memoize (useCallback) this function,
|
3851
3873
|
// it is the value of the context provider and we don't want it to trigger state tree re-renders on provider children
|
3852
3874
|
|
3853
3875
|
|
3854
|
-
|
3855
|
-
|
3876
|
+
const toaster = React.useCallback((content, options) => {
|
3877
|
+
const id = uuid.v4();
|
3856
3878
|
|
3857
|
-
|
3858
|
-
return handleClose(id);
|
3859
|
-
};
|
3879
|
+
const close = () => handleClose(id);
|
3860
3880
|
|
3861
|
-
setToasts(
|
3862
|
-
return insertToastWithoutDuplicates(currentToasts, id, content, options, close);
|
3863
|
-
});
|
3881
|
+
setToasts(currentToasts => insertToastWithoutDuplicates(currentToasts, id, content, options, close));
|
3864
3882
|
|
3865
|
-
|
3866
|
-
setToasts(
|
3867
|
-
|
3883
|
+
const update = (content, options) => {
|
3884
|
+
setToasts(currentToasts => {
|
3885
|
+
const nextToasts = currentToasts.filter(toast => {
|
3868
3886
|
if (toast.lastDuplicateId) {
|
3869
3887
|
return toast.lastDuplicateId !== id;
|
3870
3888
|
}
|
@@ -3875,80 +3893,70 @@ var ToastProvider = function ToastProvider(_ref) {
|
|
3875
3893
|
});
|
3876
3894
|
};
|
3877
3895
|
|
3878
|
-
|
3879
|
-
update(content,
|
3880
|
-
autoClose: DEFAULT_AUTO_CLOSE_TIMEOUT
|
3881
|
-
|
3896
|
+
const success = (content, options) => {
|
3897
|
+
update(content, {
|
3898
|
+
autoClose: DEFAULT_AUTO_CLOSE_TIMEOUT,
|
3899
|
+
...options,
|
3882
3900
|
type: 'success'
|
3883
|
-
})
|
3901
|
+
});
|
3884
3902
|
};
|
3885
3903
|
|
3886
|
-
|
3887
|
-
update(content,
|
3904
|
+
const error = (content, options) => {
|
3905
|
+
update(content, { ...options,
|
3888
3906
|
type: 'error'
|
3889
|
-
})
|
3907
|
+
});
|
3890
3908
|
};
|
3891
3909
|
|
3892
|
-
|
3893
|
-
update(content,
|
3910
|
+
const warning = (content, options) => {
|
3911
|
+
update(content, { ...options,
|
3894
3912
|
type: 'warning'
|
3895
|
-
})
|
3913
|
+
});
|
3896
3914
|
};
|
3897
3915
|
|
3898
|
-
|
3899
|
-
update(content,
|
3916
|
+
const information = (content, options) => {
|
3917
|
+
update(content, { ...options,
|
3900
3918
|
type: 'information'
|
3901
|
-
})
|
3919
|
+
});
|
3902
3920
|
};
|
3903
3921
|
|
3904
|
-
|
3905
|
-
update(content,
|
3922
|
+
const loading = (content, options) => {
|
3923
|
+
update(content, { ...options,
|
3906
3924
|
type: 'loading'
|
3907
|
-
})
|
3925
|
+
});
|
3908
3926
|
};
|
3909
3927
|
|
3910
3928
|
return {
|
3911
|
-
success
|
3912
|
-
error
|
3913
|
-
warning
|
3914
|
-
information
|
3915
|
-
loading
|
3916
|
-
close
|
3929
|
+
success,
|
3930
|
+
error,
|
3931
|
+
warning,
|
3932
|
+
information,
|
3933
|
+
loading,
|
3934
|
+
close
|
3917
3935
|
};
|
3918
3936
|
}, []); // no need to rebind these every render, do them once in an effect
|
3919
3937
|
|
3920
|
-
React.useEffect(
|
3921
|
-
toaster.success =
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3925
|
-
|
3926
|
-
}));
|
3927
|
-
};
|
3938
|
+
React.useEffect(() => {
|
3939
|
+
toaster.success = (content, options) => toaster(content, {
|
3940
|
+
autoClose: DEFAULT_AUTO_CLOSE_TIMEOUT,
|
3941
|
+
...options,
|
3942
|
+
type: 'success'
|
3943
|
+
});
|
3928
3944
|
|
3929
|
-
toaster.error =
|
3930
|
-
|
3931
|
-
|
3932
|
-
}));
|
3933
|
-
};
|
3945
|
+
toaster.error = (content, options) => toaster(content, { ...options,
|
3946
|
+
type: 'error'
|
3947
|
+
});
|
3934
3948
|
|
3935
|
-
toaster.warning =
|
3936
|
-
|
3937
|
-
|
3938
|
-
}));
|
3939
|
-
};
|
3949
|
+
toaster.warning = (content, options) => toaster(content, { ...options,
|
3950
|
+
type: 'warning'
|
3951
|
+
});
|
3940
3952
|
|
3941
|
-
toaster.information =
|
3942
|
-
|
3943
|
-
|
3944
|
-
}));
|
3945
|
-
};
|
3953
|
+
toaster.information = (content, options) => toaster(content, { ...options,
|
3954
|
+
type: 'information'
|
3955
|
+
});
|
3946
3956
|
|
3947
|
-
toaster.loading =
|
3948
|
-
|
3949
|
-
|
3950
|
-
}));
|
3951
|
-
};
|
3957
|
+
toaster.loading = (content, options) => toaster(content, { ...options,
|
3958
|
+
type: 'loading'
|
3959
|
+
});
|
3952
3960
|
}, []);
|
3953
3961
|
return React.createElement(ToastContext.Provider, Object.assign({}, props, {
|
3954
3962
|
value: toaster
|
@@ -3958,43 +3966,37 @@ var ToastProvider = function ToastProvider(_ref) {
|
|
3958
3966
|
role: "log"
|
3959
3967
|
}, React.createElement(framerMotion.AnimatePresence, {
|
3960
3968
|
initial: false
|
3961
|
-
}, toasts.map(
|
3962
|
-
|
3963
|
-
|
3969
|
+
}, toasts.map(toast => React.createElement(framerMotion.motion.div, {
|
3970
|
+
key: toast.id,
|
3971
|
+
transition: {
|
3972
|
+
type: 'spring',
|
3973
|
+
damping: 20,
|
3974
|
+
stiffness: 300
|
3975
|
+
},
|
3976
|
+
initial: {
|
3977
|
+
opacity: 0,
|
3978
|
+
y: 10,
|
3979
|
+
scale: 0.5
|
3980
|
+
},
|
3981
|
+
animate: {
|
3982
|
+
opacity: 1,
|
3983
|
+
y: 0,
|
3984
|
+
scale: 1
|
3985
|
+
},
|
3986
|
+
exit: {
|
3987
|
+
opacity: 0,
|
3988
|
+
scale: 0.5,
|
3964
3989
|
transition: {
|
3965
|
-
|
3966
|
-
damping: 20,
|
3967
|
-
stiffness: 300
|
3968
|
-
},
|
3969
|
-
initial: {
|
3970
|
-
opacity: 0,
|
3971
|
-
y: 10,
|
3972
|
-
scale: 0.5
|
3973
|
-
},
|
3974
|
-
animate: {
|
3975
|
-
opacity: 1,
|
3976
|
-
y: 0,
|
3977
|
-
scale: 1
|
3978
|
-
},
|
3979
|
-
exit: {
|
3980
|
-
opacity: 0,
|
3981
|
-
scale: 0.5,
|
3982
|
-
transition: {
|
3983
|
-
duration: 0.2
|
3984
|
-
}
|
3990
|
+
duration: 0.2
|
3985
3991
|
}
|
3986
|
-
}
|
3987
|
-
|
3988
|
-
|
3989
|
-
|
3990
|
-
})));
|
3991
|
-
}))));
|
3992
|
-
};
|
3993
|
-
var useToast = function useToast() {
|
3994
|
-
return React.useContext(ToastContext);
|
3992
|
+
}
|
3993
|
+
}, React.createElement(Toast, Object.assign({}, toast, {
|
3994
|
+
onClose: () => handleClose(toast.id)
|
3995
|
+
})))))));
|
3995
3996
|
};
|
3997
|
+
const useToast = () => React.useContext(ToastContext);
|
3996
3998
|
|
3997
|
-
|
3999
|
+
const defaultLocalisationTexts = {
|
3998
4000
|
calendar: {
|
3999
4001
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
4000
4002
|
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
@@ -4069,44 +4071,32 @@ var defaultLocalisationTexts = {
|
|
4069
4071
|
inputLabel: 'Search...'
|
4070
4072
|
}
|
4071
4073
|
};
|
4072
|
-
|
4074
|
+
const defaultLocalizationContext = {
|
4073
4075
|
locale: 'en-GB',
|
4074
4076
|
texts: defaultLocalisationTexts,
|
4075
4077
|
formatting: {
|
4076
4078
|
date: 'dd.mm.yy'
|
4077
4079
|
}
|
4078
4080
|
};
|
4079
|
-
|
4081
|
+
const Context = /*#__PURE__*/React.createContext({
|
4080
4082
|
localization: defaultLocalizationContext
|
4081
4083
|
});
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4085
|
-
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4089
|
-
|
4090
|
-
}, [localization]);
|
4084
|
+
const Provider = props => {
|
4085
|
+
const {
|
4086
|
+
children,
|
4087
|
+
localization = defaultLocalizationContext
|
4088
|
+
} = props;
|
4089
|
+
const value = React.useMemo(() => ({
|
4090
|
+
localization
|
4091
|
+
}), [localization]);
|
4091
4092
|
return React.createElement(Context.Provider, {
|
4092
4093
|
value: value
|
4093
4094
|
}, React.createElement(ToastProvider, null, children));
|
4094
4095
|
};
|
4095
|
-
|
4096
|
-
|
4097
|
-
};
|
4098
|
-
var useLocalization = function useLocalization() {
|
4099
|
-
return useTaco().localization;
|
4100
|
-
};
|
4101
|
-
|
4102
|
-
var _excluded$8 = ["onChange", "value"];
|
4103
|
-
|
4104
|
-
var renderDay = function renderDay(day, modifiers) {
|
4105
|
-
return modifiers.disabled ? React.createElement("span", {
|
4106
|
-
className: "dot"
|
4107
|
-
}) : day.getDate();
|
4108
|
-
};
|
4096
|
+
const useTaco = () => React.useContext(Context);
|
4097
|
+
const useLocalization = () => useTaco().localization;
|
4109
4098
|
|
4099
|
+
var _excluded$3 = ["onChange", "value", "disabledDays"];
|
4110
4100
|
var thisYear = /*#__PURE__*/new Date().getFullYear();
|
4111
4101
|
var years = [];
|
4112
4102
|
|
@@ -4178,7 +4168,8 @@ var Navbar = /*#__PURE__*/React.memo(function (_ref) {
|
|
4178
4168
|
var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4179
4169
|
var handleChange = props.onChange,
|
4180
4170
|
value = props.value,
|
4181
|
-
|
4171
|
+
disabledDays = props.disabledDays,
|
4172
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
|
4182
4173
|
|
4183
4174
|
var _useLocalization2 = useLocalization(),
|
4184
4175
|
locale = _useLocalization2.locale,
|
@@ -4235,14 +4226,13 @@ var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4235
4226
|
return null;
|
4236
4227
|
},
|
4237
4228
|
todayButton: texts.calendar.actions.today,
|
4238
|
-
showOutsideDays: true,
|
4239
|
-
renderDay: renderDay,
|
4240
4229
|
numberOfMonths: 1,
|
4241
|
-
ref: ref
|
4230
|
+
ref: ref,
|
4231
|
+
disabledDays: disabledDays
|
4242
4232
|
})));
|
4243
4233
|
});
|
4244
4234
|
|
4245
|
-
var _excluded$
|
4235
|
+
var _excluded$4 = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
|
4246
4236
|
var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
4247
4237
|
var checked = props.checked,
|
4248
4238
|
highlighted = props.highlighted,
|
@@ -4250,7 +4240,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4250
4240
|
invalid = props.invalid,
|
4251
4241
|
label = props.label,
|
4252
4242
|
onChange = props.onChange,
|
4253
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
4243
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
|
4254
4244
|
|
4255
4245
|
var className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
|
4256
4246
|
props.className, {
|
@@ -4324,21 +4314,22 @@ const getButtonStateClasses = invalid => {
|
|
4324
4314
|
return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4325
4315
|
};
|
4326
4316
|
|
4327
|
-
|
4328
|
-
|
4329
|
-
|
4330
|
-
|
4331
|
-
|
4332
|
-
|
4333
|
-
|
4334
|
-
|
4335
|
-
|
4336
|
-
|
4337
|
-
|
4338
|
-
|
4317
|
+
const Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
4318
|
+
const {
|
4319
|
+
button,
|
4320
|
+
icon,
|
4321
|
+
highlighted,
|
4322
|
+
invalid,
|
4323
|
+
onKeyDown,
|
4324
|
+
autoFocus,
|
4325
|
+
...otherProps
|
4326
|
+
} = props;
|
4327
|
+
const inputRef = useProxiedRef(ref);
|
4328
|
+
const hasContainer = button || icon;
|
4329
|
+
const className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
4339
4330
|
'pr-8': !!hasContainer
|
4340
4331
|
}, !hasContainer && otherProps.className);
|
4341
|
-
React.useEffect(
|
4332
|
+
React.useEffect(() => {
|
4342
4333
|
if (autoFocus && inputRef.current) {
|
4343
4334
|
inputRef.current.focus();
|
4344
4335
|
}
|
@@ -4346,10 +4337,10 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4346
4337
|
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
4347
4338
|
// so we manually override it to ensure _our_ desired behaviour remains intact
|
4348
4339
|
|
4349
|
-
|
4340
|
+
const handleKeyDown = event => {
|
4350
4341
|
if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
|
4351
4342
|
event.preventDefault();
|
4352
|
-
|
4343
|
+
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
4353
4344
|
event.currentTarget.setSelectionRange(position, position);
|
4354
4345
|
}
|
4355
4346
|
|
@@ -4358,7 +4349,7 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4358
4349
|
}
|
4359
4350
|
};
|
4360
4351
|
|
4361
|
-
|
4352
|
+
const input = React.createElement("input", Object.assign({}, otherProps, {
|
4362
4353
|
className: className,
|
4363
4354
|
"data-taco": "input",
|
4364
4355
|
onKeyDown: handleKeyDown,
|
@@ -4366,19 +4357,19 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4366
4357
|
}));
|
4367
4358
|
|
4368
4359
|
if (hasContainer) {
|
4369
|
-
|
4360
|
+
let extra;
|
4370
4361
|
|
4371
4362
|
if (button) {
|
4372
|
-
|
4373
|
-
|
4374
|
-
|
4375
|
-
|
4363
|
+
const disabled = button.props.disabled || otherProps.disabled;
|
4364
|
+
const buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', {
|
4365
|
+
[getButtonStateClasses(invalid)]: !props.disabled
|
4366
|
+
}, button.props.className);
|
4376
4367
|
extra = React.cloneElement(button, {
|
4377
4368
|
className: buttonClassName,
|
4378
|
-
disabled
|
4369
|
+
disabled
|
4379
4370
|
});
|
4380
4371
|
} else if (icon) {
|
4381
|
-
|
4372
|
+
const iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
|
4382
4373
|
'text-grey-dark': props.disabled,
|
4383
4374
|
'text-grey-darkest': !props.disabled
|
4384
4375
|
});
|
@@ -4390,7 +4381,7 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4390
4381
|
});
|
4391
4382
|
}
|
4392
4383
|
|
4393
|
-
|
4384
|
+
const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
|
4394
4385
|
return React.createElement("div", {
|
4395
4386
|
className: containerClassName,
|
4396
4387
|
"data-taco": "input-container"
|
@@ -4400,25 +4391,25 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4400
4391
|
return input;
|
4401
4392
|
});
|
4402
4393
|
|
4403
|
-
var
|
4394
|
+
var getNextIndexFromKey = function getNextIndexFromKey(key, length, index, direction) {
|
4404
4395
|
if (direction === void 0) {
|
4405
4396
|
direction = 'vertical';
|
4406
4397
|
}
|
4407
4398
|
|
4408
|
-
var previousKey = direction === 'horizontal' ? '
|
4409
|
-
var nextKey = direction === 'horizontal' ? '
|
4399
|
+
var previousKey = direction === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
4400
|
+
var nextKey = direction === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
4410
4401
|
|
4411
|
-
switch (
|
4412
|
-
case
|
4402
|
+
switch (key) {
|
4403
|
+
case previousKey:
|
4413
4404
|
return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
|
4414
4405
|
|
4415
|
-
case
|
4406
|
+
case nextKey:
|
4416
4407
|
return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
|
4417
4408
|
|
4418
|
-
case
|
4409
|
+
case 'Home':
|
4419
4410
|
return 0;
|
4420
4411
|
|
4421
|
-
case
|
4412
|
+
case 'End':
|
4422
4413
|
return length - 1;
|
4423
4414
|
|
4424
4415
|
default:
|
@@ -4441,7 +4432,7 @@ var useListKeyboardNavigation = function useListKeyboardNavigation(length, optio
|
|
4441
4432
|
setIndex = _React$useState[1];
|
4442
4433
|
|
4443
4434
|
var getNextIndex = function getNextIndex(event) {
|
4444
|
-
var nextIndex =
|
4435
|
+
var nextIndex = getNextIndexFromKey(event.key, length, index, options.direction);
|
4445
4436
|
|
4446
4437
|
if (nextIndex !== undefined) {
|
4447
4438
|
event.preventDefault();
|
@@ -4492,7 +4483,7 @@ var useListScrollTo = function useListScrollTo(internalRef, itemRefs) {
|
|
4492
4483
|
const getId = (id, value) => `${id}_${value}`;
|
4493
4484
|
|
4494
4485
|
const getNextEnabledItem = (event, data, index) => {
|
4495
|
-
const nextIndex =
|
4486
|
+
const nextIndex = getNextIndexFromKey(event.key, data.length, index);
|
4496
4487
|
|
4497
4488
|
if (nextIndex) {
|
4498
4489
|
if (nextIndex === index) {
|
@@ -4675,7 +4666,7 @@ const createCustomKeyboardEvent = event => {
|
|
4675
4666
|
} else {
|
4676
4667
|
customKeyboardEvent = document.createEvent('Event');
|
4677
4668
|
customKeyboardEvent.initEvent(event.type, true, true);
|
4678
|
-
customKeyboardEvent.
|
4669
|
+
customKeyboardEvent.key = event.key;
|
4679
4670
|
customKeyboardEvent.charCode = event.charCode;
|
4680
4671
|
}
|
4681
4672
|
|
@@ -4986,13 +4977,13 @@ const useCombobox = ({
|
|
4986
4977
|
const handleInputKeyDown = event => {
|
4987
4978
|
event.persist();
|
4988
4979
|
|
4989
|
-
switch (event.
|
4990
|
-
case
|
4980
|
+
switch (event.key) {
|
4981
|
+
case 'Backspace':
|
4991
4982
|
{
|
4992
4983
|
return;
|
4993
4984
|
}
|
4994
4985
|
|
4995
|
-
case
|
4986
|
+
case 'Escape':
|
4996
4987
|
{
|
4997
4988
|
event.preventDefault();
|
4998
4989
|
setInputValue(convertToInputValue(value));
|
@@ -5000,10 +4991,10 @@ const useCombobox = ({
|
|
5000
4991
|
return;
|
5001
4992
|
}
|
5002
4993
|
|
5003
|
-
case
|
5004
|
-
case
|
4994
|
+
case 'Tab':
|
4995
|
+
case 'Enter':
|
5005
4996
|
{
|
5006
|
-
if (event.
|
4997
|
+
if (event.key !== 'Tab') {
|
5007
4998
|
event.preventDefault();
|
5008
4999
|
}
|
5009
5000
|
|
@@ -5012,7 +5003,7 @@ const useCombobox = ({
|
|
5012
5003
|
return;
|
5013
5004
|
}
|
5014
5005
|
|
5015
|
-
case
|
5006
|
+
case 'ArrowDown':
|
5016
5007
|
if (open) {
|
5017
5008
|
event.preventDefault();
|
5018
5009
|
} else {
|
@@ -5023,9 +5014,9 @@ const useCombobox = ({
|
|
5023
5014
|
|
5024
5015
|
break;
|
5025
5016
|
|
5026
|
-
case
|
5027
|
-
case
|
5028
|
-
case
|
5017
|
+
case 'ArrowUp':
|
5018
|
+
case 'Home':
|
5019
|
+
case 'End':
|
5029
5020
|
{
|
5030
5021
|
if (open) {
|
5031
5022
|
event.preventDefault();
|
@@ -5041,9 +5032,9 @@ const useCombobox = ({
|
|
5041
5032
|
}
|
5042
5033
|
|
5043
5034
|
if (inline && !open) {
|
5044
|
-
if (event.
|
5035
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
5045
5036
|
event.preventDefault();
|
5046
|
-
const initialIndex = event.
|
5037
|
+
const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;
|
5047
5038
|
setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
|
5048
5039
|
setOpen(true);
|
5049
5040
|
}
|
@@ -5161,12 +5152,12 @@ var useBoundingClientRectListener = function useBoundingClientRectListener(ref)
|
|
5161
5152
|
return dimensions;
|
5162
5153
|
};
|
5163
5154
|
|
5164
|
-
var _excluded$
|
5155
|
+
var _excluded$5 = ["className", "dialog", "style"];
|
5165
5156
|
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5166
5157
|
var externalClassName = props.className,
|
5167
5158
|
dialog = props.dialog,
|
5168
5159
|
style = props.style,
|
5169
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5160
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
|
5170
5161
|
|
5171
5162
|
var _useCombobox = useCombobox(otherProps, ref),
|
5172
5163
|
combobox = _useCombobox.combobox,
|
@@ -5459,19 +5450,18 @@ function mergeRefs(refs) {
|
|
5459
5450
|
};
|
5460
5451
|
}
|
5461
5452
|
|
5462
|
-
|
5463
|
-
var PopoverContext = /*#__PURE__*/React.createContext({
|
5453
|
+
const PopoverContext = /*#__PURE__*/React.createContext({
|
5464
5454
|
props: {},
|
5465
5455
|
ref: null
|
5466
5456
|
});
|
5467
|
-
|
5457
|
+
const Trigger$1 = /*#__PURE__*/React.forwardRef(function PopoverTrigger(props, ref) {
|
5468
5458
|
var _props$children;
|
5469
5459
|
|
5470
|
-
|
5471
|
-
|
5460
|
+
const context = React.useContext(PopoverContext);
|
5461
|
+
let children = props.children;
|
5472
5462
|
|
5473
5463
|
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
5474
|
-
console.warn(
|
5464
|
+
console.warn(`Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`);
|
5475
5465
|
children = React.createElement("span", null, props.children);
|
5476
5466
|
}
|
5477
5467
|
|
@@ -5481,22 +5471,22 @@ var Trigger$1 = /*#__PURE__*/React.forwardRef(function PopoverTrigger(props, ref
|
|
5481
5471
|
asChild: true
|
5482
5472
|
}));
|
5483
5473
|
});
|
5484
|
-
|
5485
|
-
|
5486
|
-
|
5487
|
-
|
5488
|
-
|
5474
|
+
const RenderPropWrapper = /*#__PURE__*/React.forwardRef(function RenderPropWrapper({
|
5475
|
+
children,
|
5476
|
+
onClick
|
5477
|
+
}, ref) {
|
5478
|
+
const close = () => {
|
5489
5479
|
onClick(new CustomEvent('hide'));
|
5490
5480
|
};
|
5491
5481
|
|
5492
5482
|
return children({
|
5493
|
-
close
|
5494
|
-
ref
|
5483
|
+
close,
|
5484
|
+
ref
|
5495
5485
|
});
|
5496
5486
|
});
|
5497
|
-
|
5498
|
-
|
5499
|
-
|
5487
|
+
const Content$1 = /*#__PURE__*/React.forwardRef(function PopoverContent(props, ref) {
|
5488
|
+
const className = cn('bg-white focus:border-blue-light', props.className);
|
5489
|
+
let output;
|
5500
5490
|
|
5501
5491
|
if (typeof props.children === 'function') {
|
5502
5492
|
output = React.createElement(PopoverPrimitive.Close, {
|
@@ -5514,23 +5504,20 @@ var Content$1 = /*#__PURE__*/React.forwardRef(function PopoverContent(props, ref
|
|
5514
5504
|
className: "text-white"
|
5515
5505
|
}));
|
5516
5506
|
});
|
5517
|
-
|
5518
|
-
|
5519
|
-
|
5520
|
-
|
5521
|
-
|
5522
|
-
|
5523
|
-
|
5524
|
-
|
5525
|
-
|
5526
|
-
|
5527
|
-
|
5528
|
-
|
5529
|
-
|
5530
|
-
|
5531
|
-
ref: ref
|
5532
|
-
};
|
5533
|
-
}, [otherProps]);
|
5507
|
+
const Close$1 = /*#__PURE__*/React.forwardRef((props, ref) => React.createElement(PopoverPrimitive.Close, Object.assign({}, props, {
|
5508
|
+
ref: ref,
|
5509
|
+
asChild: true
|
5510
|
+
})));
|
5511
|
+
const Popover = /*#__PURE__*/React.forwardRef(function Popover(props, ref) {
|
5512
|
+
const {
|
5513
|
+
children,
|
5514
|
+
trigger,
|
5515
|
+
...otherProps
|
5516
|
+
} = props;
|
5517
|
+
const context = React.useMemo(() => ({
|
5518
|
+
props: otherProps,
|
5519
|
+
ref
|
5520
|
+
}), [otherProps]);
|
5534
5521
|
return React.createElement(PopoverContext.Provider, {
|
5535
5522
|
value: context
|
5536
5523
|
}, React.createElement(PopoverPrimitive.Root, null, trigger && React.createElement(Trigger$1, null, trigger), children));
|
@@ -5539,14 +5526,14 @@ Popover.Trigger = Trigger$1;
|
|
5539
5526
|
Popover.Content = Content$1;
|
5540
5527
|
Popover.Close = Close$1;
|
5541
5528
|
|
5542
|
-
var _excluded$
|
5529
|
+
var _excluded$6 = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
|
5543
5530
|
var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
5544
5531
|
var externalClassName = props.className,
|
5545
5532
|
handleReset = props.onReset,
|
5546
5533
|
style = props.style,
|
5547
5534
|
shortcuts = props.shortcuts,
|
5548
5535
|
shortcutsText = props.shortcutsText,
|
5549
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5536
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
|
5550
5537
|
|
5551
5538
|
var _useDatepicker = useDatepicker(otherProps, ref),
|
5552
5539
|
calendar = _useDatepicker.calendar,
|
@@ -5841,7 +5828,7 @@ const Extra = /*#__PURE__*/React.forwardRef(function DialogExtra(props, ref) {
|
|
5841
5828
|
});
|
5842
5829
|
Extra.displayName = 'DialogExtra';
|
5843
5830
|
|
5844
|
-
var _excluded$
|
5831
|
+
var _excluded$7 = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
|
5845
5832
|
|
5846
5833
|
var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
5847
5834
|
return React.useMemo(function () {
|
@@ -5878,7 +5865,7 @@ var Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
|
|
5878
5865
|
_props$size = props.size,
|
5879
5866
|
size = _props$size === void 0 ? 'sm' : _props$size,
|
5880
5867
|
trigger = props.trigger,
|
5881
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5868
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$7);
|
5882
5869
|
|
5883
5870
|
var _useSeparatedChildren = useSeparatedChildren(initialChildren),
|
5884
5871
|
children = _useSeparatedChildren[0],
|
@@ -5928,19 +5915,18 @@ Dialog.Extra = Extra;
|
|
5928
5915
|
Dialog.Drawer = Drawer;
|
5929
5916
|
Dialog.Close = Close$2;
|
5930
5917
|
|
5931
|
-
|
5932
|
-
|
5933
|
-
|
5934
|
-
|
5935
|
-
|
5936
|
-
|
5937
|
-
|
5938
|
-
|
5939
|
-
|
5940
|
-
var className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5918
|
+
const Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
5919
|
+
const {
|
5920
|
+
disabled,
|
5921
|
+
children,
|
5922
|
+
invalid = false,
|
5923
|
+
message,
|
5924
|
+
...otherProps
|
5925
|
+
} = props;
|
5926
|
+
const className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5941
5927
|
'text-grey-dark': disabled
|
5942
5928
|
}, props.className);
|
5943
|
-
|
5929
|
+
const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {
|
5944
5930
|
'text-grey-darkest': !invalid,
|
5945
5931
|
'text-red': invalid,
|
5946
5932
|
'opacity-50': disabled
|
@@ -5955,13 +5941,12 @@ var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
|
5955
5941
|
}, message));
|
5956
5942
|
});
|
5957
5943
|
|
5958
|
-
|
5959
|
-
|
5960
|
-
|
5961
|
-
|
5962
|
-
|
5963
|
-
|
5964
|
-
var className = cn('yt-form', {
|
5944
|
+
const Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
5945
|
+
const {
|
5946
|
+
horizontal = false,
|
5947
|
+
...otherProps
|
5948
|
+
} = props;
|
5949
|
+
const className = cn('yt-form', {
|
5965
5950
|
'yt-form--horizontal flex flex-wrap': horizontal
|
5966
5951
|
}, props.className);
|
5967
5952
|
return React.createElement("form", Object.assign({}, otherProps, {
|
@@ -5971,13 +5956,15 @@ var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
|
5971
5956
|
}));
|
5972
5957
|
});
|
5973
5958
|
|
5974
|
-
|
5975
|
-
|
5976
|
-
|
5977
|
-
|
5978
|
-
|
5979
|
-
|
5980
|
-
|
5959
|
+
const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
5960
|
+
const {
|
5961
|
+
as: Tag = 'span',
|
5962
|
+
orientation = 'horizontal',
|
5963
|
+
...otherProps
|
5964
|
+
} = props;
|
5965
|
+
const className = cn('flex ', 'gap-2', {
|
5966
|
+
'flex-col ': orientation === 'vertical'
|
5967
|
+
}, props.className);
|
5981
5968
|
return React.createElement(Tag, Object.assign({}, otherProps, {
|
5982
5969
|
className: className,
|
5983
5970
|
"data-taco": "group",
|
@@ -5985,19 +5972,18 @@ var Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
5985
5972
|
}));
|
5986
5973
|
});
|
5987
5974
|
|
5988
|
-
|
5989
|
-
var HangerContext = /*#__PURE__*/React.createContext({
|
5975
|
+
const HangerContext = /*#__PURE__*/React.createContext({
|
5990
5976
|
props: {},
|
5991
5977
|
ref: null
|
5992
5978
|
});
|
5993
|
-
|
5979
|
+
const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
|
5994
5980
|
var _props$children;
|
5995
5981
|
|
5996
|
-
|
5997
|
-
|
5982
|
+
const context = React.useContext(HangerContext);
|
5983
|
+
let children = props.children;
|
5998
5984
|
|
5999
5985
|
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
6000
|
-
console.warn(
|
5986
|
+
console.warn(`Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`);
|
6001
5987
|
children = React.createElement("span", null, props.children);
|
6002
5988
|
}
|
6003
5989
|
|
@@ -6007,22 +5993,21 @@ var Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
|
|
6007
5993
|
asChild: true
|
6008
5994
|
}));
|
6009
5995
|
});
|
6010
|
-
|
6011
|
-
|
5996
|
+
const Title$1 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
5997
|
+
const className = cn('mb-1 text-base font-bold flex w-full', props.className);
|
6012
5998
|
return React.createElement("span", Object.assign({}, props, {
|
6013
5999
|
className: className,
|
6014
6000
|
ref: ref
|
6015
6001
|
}));
|
6016
6002
|
});
|
6017
|
-
|
6018
|
-
|
6019
|
-
|
6020
|
-
|
6021
|
-
|
6022
|
-
|
6023
|
-
var className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent max-w-sm', props.className);
|
6003
|
+
const Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
6004
|
+
const context = React.useContext(HangerContext);
|
6005
|
+
const {
|
6006
|
+
texts
|
6007
|
+
} = useLocalization();
|
6008
|
+
const className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent max-w-sm', props.className);
|
6024
6009
|
|
6025
|
-
|
6010
|
+
const handleInteractOutside = event => {
|
6026
6011
|
event.preventDefault();
|
6027
6012
|
};
|
6028
6013
|
|
@@ -6044,25 +6029,20 @@ var Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref)
|
|
6044
6029
|
onClick: context.props.onClose
|
6045
6030
|
})));
|
6046
6031
|
});
|
6047
|
-
|
6048
|
-
|
6049
|
-
|
6050
|
-
|
6051
|
-
|
6052
|
-
|
6053
|
-
|
6054
|
-
|
6055
|
-
|
6056
|
-
|
6057
|
-
|
6058
|
-
};
|
6059
|
-
}, [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
6060
|
-
|
6061
|
-
var _React$useState = React.useState(false),
|
6062
|
-
open = _React$useState[0],
|
6063
|
-
setOpen = _React$useState[1];
|
6032
|
+
const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
6033
|
+
const {
|
6034
|
+
anchor,
|
6035
|
+
children,
|
6036
|
+
defaultOpen = true,
|
6037
|
+
...otherProps
|
6038
|
+
} = props;
|
6039
|
+
const context = React.useMemo(() => ({
|
6040
|
+
props: otherProps,
|
6041
|
+
ref
|
6042
|
+
}), [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
6064
6043
|
|
6065
|
-
React.
|
6044
|
+
const [open, setOpen] = React.useState(false);
|
6045
|
+
React.useEffect(() => {
|
6066
6046
|
if (defaultOpen) {
|
6067
6047
|
setOpen(defaultOpen);
|
6068
6048
|
}
|
@@ -6078,25 +6058,25 @@ Hanger.Anchor = Anchor;
|
|
6078
6058
|
Hanger.Content = Content$3;
|
6079
6059
|
Hanger.Title = Title$1;
|
6080
6060
|
|
6081
|
-
|
6082
|
-
var Trigger$3 = /*#__PURE__*/React.forwardRef(function HoverCardTrigger(props, ref) {
|
6061
|
+
const Trigger$3 = /*#__PURE__*/React.forwardRef(function HoverCardTrigger(props, ref) {
|
6083
6062
|
return React.createElement(HoverCardPrimitive.Trigger, Object.assign({}, props, {
|
6084
6063
|
asChild: true,
|
6085
6064
|
ref: ref
|
6086
6065
|
}));
|
6087
6066
|
});
|
6088
|
-
|
6089
|
-
|
6090
|
-
|
6091
|
-
|
6092
|
-
|
6067
|
+
const Content$4 = /*#__PURE__*/React.forwardRef(function HoverCardContent(externalProps, ref) {
|
6068
|
+
const {
|
6069
|
+
placement,
|
6070
|
+
...props
|
6071
|
+
} = externalProps;
|
6072
|
+
const className = cn('bg-white rounded p-3 yt-shadow', props.className);
|
6093
6073
|
return React.createElement(HoverCardPrimitive.Content, Object.assign({}, props, {
|
6094
6074
|
className: className,
|
6095
6075
|
ref: ref,
|
6096
6076
|
side: placement
|
6097
6077
|
}));
|
6098
6078
|
});
|
6099
|
-
|
6079
|
+
const HoverCard = props => {
|
6100
6080
|
return React.createElement(HoverCardPrimitive.Root, Object.assign({}, props, {
|
6101
6081
|
openDelay: 300
|
6102
6082
|
}));
|
@@ -6104,24 +6084,24 @@ var HoverCard = function HoverCard(props) {
|
|
6104
6084
|
HoverCard.Trigger = Trigger$3;
|
6105
6085
|
HoverCard.Content = Content$4;
|
6106
6086
|
|
6107
|
-
|
6108
|
-
|
6109
|
-
|
6110
|
-
|
6111
|
-
|
6112
|
-
|
6113
|
-
|
6087
|
+
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
6088
|
+
onSearch,
|
6089
|
+
...props
|
6090
|
+
}, ref) {
|
6091
|
+
const {
|
6092
|
+
texts
|
6093
|
+
} = useLocalization();
|
6114
6094
|
|
6115
|
-
|
6095
|
+
const handleClick = () => {
|
6116
6096
|
if (!props.disabled) {
|
6117
6097
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(props.value);
|
6118
6098
|
}
|
6119
6099
|
};
|
6120
6100
|
|
6121
|
-
|
6101
|
+
const handleKeyDown = event => {
|
6122
6102
|
var _props$onKeyDown;
|
6123
6103
|
|
6124
|
-
|
6104
|
+
const isEnterKeyPressed = event.key === 'Enter';
|
6125
6105
|
|
6126
6106
|
if (isEnterKeyPressed) {
|
6127
6107
|
handleClick();
|
@@ -6224,9 +6204,10 @@ const useListbox = ({
|
|
6224
6204
|
}, [data]);
|
6225
6205
|
|
6226
6206
|
const handleListboxKeyDown = event => {
|
6227
|
-
const charKey = String.fromCharCode(event.keyCode)
|
6207
|
+
const charKey = event.key; // event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)
|
6208
|
+
// We need to filter out only alphabetical or numeric letters, that's why that condition has been changed
|
6228
6209
|
|
6229
|
-
if (charKey.
|
6210
|
+
if (charKey.length === 1 && /(\w)/g.test(charKey)) {
|
6230
6211
|
const nextIndex = getNextIndex(charKey);
|
6231
6212
|
|
6232
6213
|
if (nextIndex > -1 && nextIndex !== currentIndex) {
|
@@ -6399,9 +6380,10 @@ const useMultiListbox = ({
|
|
6399
6380
|
};
|
6400
6381
|
|
6401
6382
|
const handleListboxKeyDown = (event, index) => {
|
6402
|
-
const charKey = String.fromCharCode(event.keyCode)
|
6383
|
+
const charKey = event.key; // event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)
|
6384
|
+
// We need to filter out only alphabetical or numeric letters, that's why that condition has been changed
|
6403
6385
|
|
6404
|
-
if (charKey.
|
6386
|
+
if (charKey.length === 1 && /(\w)/g.test(charKey)) {
|
6405
6387
|
const nextIndex = getNextIndex(charKey);
|
6406
6388
|
|
6407
6389
|
if (nextIndex > -1 && nextIndex !== currentIndex) {
|
@@ -6411,22 +6393,22 @@ const useMultiListbox = ({
|
|
6411
6393
|
return;
|
6412
6394
|
}
|
6413
6395
|
|
6414
|
-
switch (event.
|
6415
|
-
case
|
6396
|
+
switch (event.key) {
|
6397
|
+
case ' ':
|
6416
6398
|
{
|
6417
6399
|
event.preventDefault();
|
6418
6400
|
setInputValueByIndex(index);
|
6419
6401
|
break;
|
6420
6402
|
}
|
6421
6403
|
|
6422
|
-
case
|
6404
|
+
case 'Enter':
|
6423
6405
|
{
|
6424
6406
|
setInputValueByIndex(index);
|
6425
6407
|
break;
|
6426
6408
|
}
|
6427
6409
|
}
|
6428
6410
|
|
6429
|
-
setCurrentIndex(index);
|
6411
|
+
setCurrentIndex(index !== undefined ? index : 0);
|
6430
6412
|
|
6431
6413
|
if (onKeyDown) {
|
6432
6414
|
event.persist();
|
@@ -6490,49 +6472,49 @@ const useMultiListbox = ({
|
|
6490
6472
|
};
|
6491
6473
|
};
|
6492
6474
|
|
6493
|
-
|
6494
|
-
|
6495
|
-
|
6496
|
-
|
6497
|
-
|
6498
|
-
|
6499
|
-
|
6500
|
-
|
6501
|
-
|
6502
|
-
|
6503
|
-
var className = cn('bg-white inline-flex relative w-full', externalClassName);
|
6475
|
+
const Listbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
6476
|
+
const {
|
6477
|
+
className: externalClassName,
|
6478
|
+
...otherProps
|
6479
|
+
} = props;
|
6480
|
+
const {
|
6481
|
+
list,
|
6482
|
+
input
|
6483
|
+
} = useListbox(otherProps, ref);
|
6484
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
6504
6485
|
return React.createElement("span", {
|
6505
6486
|
"data-taco": "listbox",
|
6506
6487
|
className: className
|
6507
6488
|
}, React.createElement(ScrollableList, Object.assign({}, list, {
|
6508
|
-
style:
|
6489
|
+
style: { ...list.style,
|
6509
6490
|
maxHeight: 'calc(12rem + 2px)'
|
6510
6491
|
/* (6 * option height) + listbox border */
|
6511
6492
|
|
6512
|
-
}
|
6493
|
+
}
|
6513
6494
|
})), React.createElement("input", Object.assign({}, input, {
|
6514
6495
|
className: "hidden",
|
6515
6496
|
type: "text"
|
6516
6497
|
})));
|
6517
6498
|
});
|
6518
|
-
|
6519
|
-
|
6520
|
-
|
6521
|
-
|
6522
|
-
|
6523
|
-
|
6524
|
-
|
6525
|
-
|
6526
|
-
|
6499
|
+
const MultiListbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
6500
|
+
const {
|
6501
|
+
className: externalClassName,
|
6502
|
+
...otherProps
|
6503
|
+
} = props;
|
6504
|
+
const {
|
6505
|
+
list,
|
6506
|
+
input
|
6507
|
+
} = useMultiListbox(otherProps, ref);
|
6508
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
6527
6509
|
return React.createElement("span", {
|
6528
6510
|
"data-taco": "listbox",
|
6529
6511
|
className: className
|
6530
6512
|
}, React.createElement(ScrollableList, Object.assign({}, list, {
|
6531
|
-
style:
|
6513
|
+
style: { ...list.style,
|
6532
6514
|
maxHeight: 'calc(12rem + 2px + 2px)'
|
6533
6515
|
/* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
6534
6516
|
|
6535
|
-
}
|
6517
|
+
}
|
6536
6518
|
})), React.createElement("input", Object.assign({}, input, {
|
6537
6519
|
className: "hidden",
|
6538
6520
|
type: "text"
|
@@ -6715,34 +6697,26 @@ const Checkbox$1 = props => {
|
|
6715
6697
|
})), children);
|
6716
6698
|
};
|
6717
6699
|
|
6718
|
-
|
6719
|
-
|
6720
|
-
|
6721
|
-
return String(value !== null && value !== void 0 ? value : '');
|
6722
|
-
};
|
6723
|
-
var findByValue$1 = function findByValue(values, valueAsString) {
|
6724
|
-
return values.find(function (value) {
|
6725
|
-
return getRadioGroupItemValueAsString(value) === valueAsString;
|
6726
|
-
});
|
6727
|
-
};
|
6728
|
-
var RadioGroupContext = /*#__PURE__*/React.createContext({
|
6700
|
+
const getRadioGroupItemValueAsString = value => String(value !== null && value !== void 0 ? value : '');
|
6701
|
+
const findByValue$1 = (values, valueAsString) => values.find(value => getRadioGroupItemValueAsString(value) === valueAsString);
|
6702
|
+
const RadioGroupContext = /*#__PURE__*/React.createContext({
|
6729
6703
|
disabled: false,
|
6730
6704
|
invalid: false
|
6731
6705
|
});
|
6732
|
-
|
6733
|
-
|
6734
|
-
|
6735
|
-
|
6736
|
-
|
6737
|
-
|
6738
|
-
|
6739
|
-
|
6740
|
-
|
6706
|
+
const RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props, ref) {
|
6707
|
+
const context = React.useContext(RadioGroupContext);
|
6708
|
+
const {
|
6709
|
+
children,
|
6710
|
+
value,
|
6711
|
+
...otherProps
|
6712
|
+
} = props;
|
6713
|
+
const isDisabled = context.disabled || props.disabled;
|
6714
|
+
const className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2', {
|
6741
6715
|
'border-grey-dark hover:border-4 focus:yt-focus aria-checked:bg-blue aria-checked:border-blue hover:aria-checked:border-blue-light': !isDisabled && !context.invalid,
|
6742
6716
|
'border-grey cursor-not-allowed aria-checked:bg-blue-light aria-checked:border-blue-light ': isDisabled,
|
6743
6717
|
'border-red hover:border-4 text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red': context.invalid && !isDisabled
|
6744
6718
|
});
|
6745
|
-
|
6719
|
+
const labelClassName = cn('flex items-center gap-2', {
|
6746
6720
|
'cursor-pointer': !isDisabled,
|
6747
6721
|
'cursor-not-allowed text-grey-dark': isDisabled
|
6748
6722
|
}, props.className);
|
@@ -6757,38 +6731,34 @@ var RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props
|
|
6757
6731
|
className: "h-2 w-2 rounded-full bg-white"
|
6758
6732
|
})), children);
|
6759
6733
|
});
|
6760
|
-
|
6761
|
-
|
6762
|
-
|
6763
|
-
|
6764
|
-
|
6765
|
-
|
6766
|
-
|
6767
|
-
|
6768
|
-
|
6769
|
-
|
6770
|
-
|
6771
|
-
|
6772
|
-
|
6773
|
-
React.Children.forEach(children,
|
6734
|
+
const useRadioGroup = props => {
|
6735
|
+
const {
|
6736
|
+
children,
|
6737
|
+
defaultValue,
|
6738
|
+
disabled,
|
6739
|
+
invalid,
|
6740
|
+
onChange,
|
6741
|
+
orientation = 'vertical',
|
6742
|
+
value,
|
6743
|
+
...otherProps
|
6744
|
+
} = props;
|
6745
|
+
const values = React.useMemo(() => {
|
6746
|
+
const radioGroupItemValues = [];
|
6747
|
+
React.Children.forEach(children, child => {
|
6774
6748
|
if (React.isValidElement(child)) {
|
6775
6749
|
radioGroupItemValues.push(child.props.value);
|
6776
6750
|
}
|
6777
6751
|
});
|
6778
6752
|
return radioGroupItemValues;
|
6779
6753
|
}, [children]);
|
6780
|
-
|
6781
|
-
|
6782
|
-
|
6783
|
-
|
6784
|
-
|
6785
|
-
}, [disabled, invalid]);
|
6786
|
-
var valueProps;
|
6754
|
+
const context = React.useMemo(() => ({
|
6755
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : false,
|
6756
|
+
invalid: invalid !== null && invalid !== void 0 ? invalid : false
|
6757
|
+
}), [disabled, invalid]);
|
6758
|
+
let valueProps;
|
6787
6759
|
|
6788
6760
|
if (onChange !== undefined) {
|
6789
|
-
|
6790
|
-
return onChange(findByValue$1(values, value));
|
6791
|
-
};
|
6761
|
+
const handleChange = value => onChange(findByValue$1(values, value));
|
6792
6762
|
|
6793
6763
|
valueProps = {
|
6794
6764
|
onValueChange: handleChange,
|
@@ -6801,19 +6771,20 @@ var useRadioGroup = function useRadioGroup(props) {
|
|
6801
6771
|
}
|
6802
6772
|
|
6803
6773
|
return {
|
6804
|
-
context
|
6805
|
-
props:
|
6806
|
-
|
6807
|
-
|
6808
|
-
|
6774
|
+
context,
|
6775
|
+
props: { ...otherProps,
|
6776
|
+
...valueProps,
|
6777
|
+
children,
|
6778
|
+
orientation
|
6779
|
+
}
|
6809
6780
|
};
|
6810
6781
|
};
|
6811
|
-
|
6812
|
-
|
6813
|
-
|
6814
|
-
|
6815
|
-
|
6816
|
-
|
6782
|
+
const RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {
|
6783
|
+
const {
|
6784
|
+
context,
|
6785
|
+
props: otherProps
|
6786
|
+
} = useRadioGroup(props);
|
6787
|
+
const className = cn('flex items-start gap-y-2', {
|
6817
6788
|
'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',
|
6818
6789
|
'flex-col': otherProps.orientation === 'vertical'
|
6819
6790
|
}, otherProps.className);
|
@@ -6884,39 +6855,22 @@ const Header = props => {
|
|
6884
6855
|
}));
|
6885
6856
|
};
|
6886
6857
|
|
6887
|
-
|
6888
|
-
|
6889
|
-
|
6890
|
-
|
6891
|
-
|
6892
|
-
|
6893
|
-
|
6894
|
-
|
6895
|
-
|
6896
|
-
|
6897
|
-
|
6898
|
-
|
6899
|
-
|
6900
|
-
|
6901
|
-
|
6902
|
-
|
6903
|
-
_setMinWidth = _React$useState3[1];
|
6904
|
-
|
6905
|
-
var context = React.useMemo(function () {
|
6906
|
-
return {
|
6907
|
-
indented: indented,
|
6908
|
-
registerIndentation: function registerIndentation() {
|
6909
|
-
return setIndented(true);
|
6910
|
-
},
|
6911
|
-
minWidth: minWidth,
|
6912
|
-
setMinWidth: function setMinWidth(width) {
|
6913
|
-
return _setMinWidth(width);
|
6914
|
-
},
|
6915
|
-
close: function close() {
|
6916
|
-
return setOpen(false);
|
6917
|
-
}
|
6918
|
-
};
|
6919
|
-
}, [indented, minWidth]);
|
6858
|
+
const Menu$1 = externalProps => {
|
6859
|
+
const {
|
6860
|
+
children,
|
6861
|
+
trigger,
|
6862
|
+
...props
|
6863
|
+
} = externalProps;
|
6864
|
+
const [open, setOpen] = React.useState(false);
|
6865
|
+
const [indented, setIndented] = React.useState(false);
|
6866
|
+
const [minWidth, setMinWidth] = React.useState(undefined);
|
6867
|
+
const context = React.useMemo(() => ({
|
6868
|
+
indented,
|
6869
|
+
registerIndentation: () => setIndented(true),
|
6870
|
+
minWidth,
|
6871
|
+
setMinWidth: width => setMinWidth(width),
|
6872
|
+
close: () => setOpen(false)
|
6873
|
+
}), [indented, minWidth]);
|
6920
6874
|
return React.createElement(MenuContext.Provider, {
|
6921
6875
|
value: context
|
6922
6876
|
}, React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
@@ -6934,44 +6888,39 @@ Menu$1.Separator = Separator;
|
|
6934
6888
|
Menu$1.Header = Header;
|
6935
6889
|
Menu$1.RadioGroup = RadioGroup$1;
|
6936
6890
|
|
6937
|
-
|
6938
|
-
var TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
|
6891
|
+
const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
|
6939
6892
|
return React__default.createElement("a", Object.assign({}, props, {
|
6940
6893
|
ref: ref
|
6941
6894
|
}));
|
6942
6895
|
});
|
6943
|
-
|
6944
|
-
|
6945
|
-
|
6946
|
-
|
6947
|
-
|
6948
|
-
|
6949
|
-
|
6950
|
-
|
6951
|
-
|
6952
|
-
|
6953
|
-
|
6954
|
-
|
6955
|
-
setExpanded = _React$useState[1];
|
6956
|
-
|
6957
|
-
React__default.useEffect(function () {
|
6896
|
+
const TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function TreeviewGroup(props, ref) {
|
6897
|
+
const {
|
6898
|
+
children,
|
6899
|
+
className: externalClassName,
|
6900
|
+
expanded: initialExpanded = false,
|
6901
|
+
title,
|
6902
|
+
fixed,
|
6903
|
+
onClick,
|
6904
|
+
...otherProps
|
6905
|
+
} = props;
|
6906
|
+
const [expanded, setExpanded] = React__default.useState(fixed || initialExpanded);
|
6907
|
+
React__default.useEffect(() => {
|
6958
6908
|
if (!fixed) {
|
6959
6909
|
setExpanded(fixed || initialExpanded);
|
6960
6910
|
}
|
6961
6911
|
}, [fixed, initialExpanded]);
|
6962
|
-
|
6912
|
+
const listClassName = cn('flex-col mb-0', {
|
6963
6913
|
flex: expanded,
|
6964
6914
|
hidden: !expanded
|
6965
6915
|
});
|
6966
|
-
|
6967
|
-
var itemProps = _extends({}, otherProps, {
|
6916
|
+
const itemProps = { ...otherProps,
|
6968
6917
|
'aria-expanded': expanded,
|
6969
6918
|
role: 'treeitem',
|
6970
6919
|
tabIndex: -1
|
6971
|
-
}
|
6920
|
+
};
|
6972
6921
|
|
6973
|
-
|
6974
|
-
|
6922
|
+
const handleClick = event => {
|
6923
|
+
const nextState = !expanded;
|
6975
6924
|
|
6976
6925
|
if (!fixed) {
|
6977
6926
|
setExpanded(nextState);
|
@@ -6982,7 +6931,7 @@ var TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function TreeviewGrou
|
|
6982
6931
|
}
|
6983
6932
|
};
|
6984
6933
|
|
6985
|
-
|
6934
|
+
const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;
|
6986
6935
|
return React__default.createElement("div", Object.assign({}, itemProps, {
|
6987
6936
|
className: className,
|
6988
6937
|
ref: ref
|
@@ -6991,18 +6940,14 @@ var TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function TreeviewGrou
|
|
6991
6940
|
}, typeof title === 'function' ? title(expanded) : title), React__default.createElement("ul", {
|
6992
6941
|
role: "group",
|
6993
6942
|
className: listClassName
|
6994
|
-
}, React__default.Children.toArray(children).filter(
|
6995
|
-
|
6996
|
-
|
6997
|
-
|
6998
|
-
|
6999
|
-
|
7000
|
-
}, React__default.cloneElement(item, {
|
7001
|
-
role: 'treeitem'
|
7002
|
-
}));
|
7003
|
-
})));
|
6943
|
+
}, React__default.Children.toArray(children).filter(item => !!item).map((item, i) => React__default.createElement("li", {
|
6944
|
+
key: i,
|
6945
|
+
role: "none"
|
6946
|
+
}, React__default.cloneElement(item, {
|
6947
|
+
role: 'treeitem'
|
6948
|
+
})))));
|
7004
6949
|
});
|
7005
|
-
|
6950
|
+
const Treeview = /*#__PURE__*/React__default.forwardRef(function Treeview(props, ref) {
|
7006
6951
|
return React__default.createElement("div", Object.assign({}, props, {
|
7007
6952
|
ref: ref,
|
7008
6953
|
role: "tree"
|
@@ -7048,25 +6993,20 @@ var useDropTarget = function useDropTarget(onDrop) {
|
|
7048
6993
|
return [isDraggedOver, props];
|
7049
6994
|
};
|
7050
6995
|
|
7051
|
-
|
7052
|
-
|
7053
|
-
|
7054
|
-
|
7055
|
-
|
7056
|
-
|
7057
|
-
|
7058
|
-
|
7059
|
-
|
7060
|
-
|
7061
|
-
|
7062
|
-
|
7063
|
-
|
7064
|
-
|
7065
|
-
isDraggedOver = _useDropTarget[0],
|
7066
|
-
dropTargetProps = _useDropTarget[1];
|
7067
|
-
|
7068
|
-
var isTreeitem = role === 'treeitem';
|
7069
|
-
var className = cn('yt-navigation__item cursor-pointer', {
|
6996
|
+
const Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
6997
|
+
const {
|
6998
|
+
active,
|
6999
|
+
children,
|
7000
|
+
onDrop,
|
7001
|
+
postfix,
|
7002
|
+
prefix,
|
7003
|
+
role,
|
7004
|
+
...otherProps
|
7005
|
+
} = props;
|
7006
|
+
const proxyRef = useProxiedRef(ref);
|
7007
|
+
const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);
|
7008
|
+
const isTreeitem = role === 'treeitem';
|
7009
|
+
const className = cn('yt-navigation__item cursor-pointer', {
|
7070
7010
|
'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,
|
7071
7011
|
'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,
|
7072
7012
|
'yt-navigation__item--active': active && !isDraggedOver,
|
@@ -7074,7 +7014,7 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
7074
7014
|
'yt-navigation__item--dropping bg-blue': isDraggedOver
|
7075
7015
|
}, props.className);
|
7076
7016
|
|
7077
|
-
|
7017
|
+
const handleClick = event => {
|
7078
7018
|
if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {
|
7079
7019
|
return;
|
7080
7020
|
}
|
@@ -7097,19 +7037,19 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
7097
7037
|
className: "yt-navigation__item__postfix ml-1"
|
7098
7038
|
}, postfix));
|
7099
7039
|
});
|
7100
|
-
|
7040
|
+
const Panel = /*#__PURE__*/React__default.forwardRef(function Panel(props, ref) {
|
7101
7041
|
return React__default.createElement("div", Object.assign({}, props, {
|
7102
7042
|
className: cn('w-full bg-white p-3', props.className),
|
7103
7043
|
ref: ref
|
7104
7044
|
}));
|
7105
7045
|
});
|
7106
|
-
|
7107
|
-
|
7046
|
+
const MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props, ref) {
|
7047
|
+
const className = cn('flex-shrink-0 space-y-1 outline-none', {
|
7108
7048
|
'bg-white pb-2': props.fixed
|
7109
7049
|
}, props.className);
|
7110
7050
|
|
7111
|
-
|
7112
|
-
|
7051
|
+
const title = expanded => {
|
7052
|
+
const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {
|
7113
7053
|
'mb-1': expanded,
|
7114
7054
|
'cursor-pointer hover:text-blue': !props.fixed
|
7115
7055
|
});
|
@@ -7126,16 +7066,15 @@ var MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props,
|
|
7126
7066
|
ref: ref
|
7127
7067
|
}));
|
7128
7068
|
});
|
7129
|
-
|
7130
|
-
|
7131
|
-
|
7132
|
-
React__default.Children.toArray(props.children).filter(
|
7133
|
-
|
7134
|
-
}).map(function (child) {
|
7069
|
+
const Menu$2 = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
|
7070
|
+
const scrollableAreas = React__default.useMemo(() => {
|
7071
|
+
const scrollableAreas = [];
|
7072
|
+
const children = React__default.Children.toArray(props.children).filter(child => !!child);
|
7073
|
+
children.forEach(child => {
|
7135
7074
|
if (child.props.fixed) {
|
7136
7075
|
scrollableAreas.push(child);
|
7137
7076
|
} else {
|
7138
|
-
|
7077
|
+
const x = scrollableAreas[scrollableAreas.length - 1];
|
7139
7078
|
|
7140
7079
|
if (Array.isArray(x)) {
|
7141
7080
|
x.push(child);
|
@@ -7149,19 +7088,18 @@ var Menu$2 = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
|
|
7149
7088
|
return React__default.createElement(Treeview, Object.assign({}, props, {
|
7150
7089
|
className: cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className),
|
7151
7090
|
ref: ref
|
7152
|
-
}), scrollableAreas.map(
|
7153
|
-
|
7154
|
-
|
7155
|
-
|
7156
|
-
}, area) : area;
|
7157
|
-
}));
|
7091
|
+
}), scrollableAreas.map((area, i) => Array.isArray(area) ? React__default.createElement("div", {
|
7092
|
+
className: "divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto",
|
7093
|
+
key: i
|
7094
|
+
}, area) : area));
|
7158
7095
|
});
|
7159
7096
|
Menu$2.Group = MenuGroup;
|
7160
|
-
|
7161
|
-
|
7162
|
-
|
7163
|
-
|
7164
|
-
|
7097
|
+
const Navigation = /*#__PURE__*/React__default.forwardRef(function Navigation(props, ref) {
|
7098
|
+
const {
|
7099
|
+
children,
|
7100
|
+
...otherProps
|
7101
|
+
} = props;
|
7102
|
+
const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);
|
7165
7103
|
return React__default.createElement("div", Object.assign({}, otherProps, {
|
7166
7104
|
className: className,
|
7167
7105
|
"data-taco": "navigation",
|
@@ -7269,15 +7207,15 @@ const useSelect = ({
|
|
7269
7207
|
}, []); // event handlers
|
7270
7208
|
|
7271
7209
|
const handleButtonKeyDown = event => {
|
7272
|
-
if (event.
|
7210
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
7273
7211
|
event.preventDefault();
|
7274
7212
|
setOpen(true);
|
7275
7213
|
}
|
7276
7214
|
};
|
7277
7215
|
|
7278
7216
|
const handleListboxKeyDown = event => {
|
7279
|
-
switch (event.
|
7280
|
-
case
|
7217
|
+
switch (event.key) {
|
7218
|
+
case 'Escape':
|
7281
7219
|
{
|
7282
7220
|
event.preventDefault();
|
7283
7221
|
|
@@ -7289,10 +7227,10 @@ const useSelect = ({
|
|
7289
7227
|
break;
|
7290
7228
|
}
|
7291
7229
|
|
7292
|
-
case
|
7293
|
-
case
|
7230
|
+
case 'Tab':
|
7231
|
+
case 'Enter':
|
7294
7232
|
{
|
7295
|
-
if (event.
|
7233
|
+
if (event.key !== 'Tab') {
|
7296
7234
|
event.preventDefault();
|
7297
7235
|
}
|
7298
7236
|
|
@@ -7417,54 +7355,52 @@ const useSelect = ({
|
|
7417
7355
|
};
|
7418
7356
|
};
|
7419
7357
|
|
7420
|
-
|
7421
|
-
|
7422
|
-
|
7423
|
-
|
7424
|
-
|
7425
|
-
|
7426
|
-
|
7427
|
-
|
7428
|
-
|
7429
|
-
|
7430
|
-
|
7431
|
-
|
7432
|
-
|
7433
|
-
|
7434
|
-
|
7435
|
-
|
7436
|
-
|
7437
|
-
|
7438
|
-
|
7439
|
-
var className = cn('inline-flex relative w-full', {
|
7358
|
+
const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
|
7359
|
+
const {
|
7360
|
+
autoFocus,
|
7361
|
+
className: externalClassName,
|
7362
|
+
highlighted,
|
7363
|
+
style,
|
7364
|
+
...otherProps
|
7365
|
+
} = props;
|
7366
|
+
const {
|
7367
|
+
button,
|
7368
|
+
listbox,
|
7369
|
+
popover,
|
7370
|
+
input,
|
7371
|
+
text,
|
7372
|
+
more = 0
|
7373
|
+
} = useSelect(otherProps, ref);
|
7374
|
+
const internalRef = React.useRef(null);
|
7375
|
+
const selectDimensions = useBoundingClientRectListener(internalRef);
|
7376
|
+
const className = cn('inline-flex relative w-full', {
|
7440
7377
|
'yt-select--readonly': props.readOnly
|
7441
7378
|
}, externalClassName);
|
7442
|
-
|
7379
|
+
const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {
|
7443
7380
|
'border-blue': popover.open
|
7444
7381
|
});
|
7445
|
-
React.useEffect(
|
7382
|
+
React.useEffect(() => {
|
7446
7383
|
if (autoFocus && internalRef.current) {
|
7447
7384
|
internalRef.current.focus();
|
7448
7385
|
}
|
7449
7386
|
}, []);
|
7450
7387
|
|
7451
|
-
|
7388
|
+
const renderMultiSelection = () => {
|
7452
7389
|
return React.createElement(React.Fragment, null, React.createElement("span", {
|
7453
7390
|
className: "flex-grow truncate text-left"
|
7454
7391
|
}, text), more > 0 && React.createElement(Badge, {
|
7455
7392
|
className: "ml-2"
|
7456
|
-
},
|
7393
|
+
}, `+${more}`));
|
7457
7394
|
};
|
7458
7395
|
|
7459
|
-
|
7396
|
+
const commonListboxProps = { ...listbox,
|
7460
7397
|
className: 'w-auto',
|
7461
7398
|
invalid: undefined,
|
7462
7399
|
style: {
|
7463
7400
|
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
7464
7401
|
},
|
7465
7402
|
tabIndex: popover.open ? 0 : -1
|
7466
|
-
}
|
7467
|
-
|
7403
|
+
};
|
7468
7404
|
return React.createElement("span", {
|
7469
7405
|
className: className,
|
7470
7406
|
"data-taco": "select",
|
@@ -7487,9 +7423,11 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
|
|
7487
7423
|
type: "text"
|
7488
7424
|
}))));
|
7489
7425
|
});
|
7490
|
-
|
7491
|
-
|
7492
|
-
|
7426
|
+
const Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
|
7427
|
+
const {
|
7428
|
+
editable,
|
7429
|
+
...otherProps
|
7430
|
+
} = props;
|
7493
7431
|
|
7494
7432
|
if (editable) {
|
7495
7433
|
return React.createElement(Combobox, Object.assign({}, otherProps, {
|
@@ -7511,25 +7449,25 @@ const usePaginationShortcuts = ({
|
|
7511
7449
|
dangerouslyHijackGlobalKeyboardNavigation: useGlobalKeyboardNavigation
|
7512
7450
|
}) => {
|
7513
7451
|
const onKeyDown = event => {
|
7514
|
-
if (setPageIndex && event.
|
7452
|
+
if (setPageIndex && event.key === 'Home') {
|
7515
7453
|
event.preventDefault();
|
7516
7454
|
setPageIndex(0);
|
7517
7455
|
return;
|
7518
7456
|
}
|
7519
7457
|
|
7520
|
-
if (setPageIndex && event.
|
7458
|
+
if (setPageIndex && event.key === 'End') {
|
7521
7459
|
event.preventDefault();
|
7522
7460
|
setPageIndex(maxPageIndex);
|
7523
7461
|
return;
|
7524
7462
|
}
|
7525
7463
|
|
7526
|
-
if (setPageIndex && event.
|
7464
|
+
if (setPageIndex && event.key === 'PageUp') {
|
7527
7465
|
event.preventDefault();
|
7528
7466
|
setPageIndex(Math.max(0, pageIndex - 1));
|
7529
7467
|
return;
|
7530
7468
|
}
|
7531
7469
|
|
7532
|
-
if (setPageIndex && event.
|
7470
|
+
if (setPageIndex && event.key === 'PageDown') {
|
7533
7471
|
event.preventDefault();
|
7534
7472
|
setPageIndex(Math.min(maxPageIndex, pageIndex + 1));
|
7535
7473
|
return;
|
@@ -7560,47 +7498,41 @@ const usePagination = (initialPageIndex = 0, initialPageSize = 10) => {
|
|
7560
7498
|
};
|
7561
7499
|
};
|
7562
7500
|
|
7563
|
-
|
7564
|
-
|
7565
|
-
|
7566
|
-
var minItemIndex = pageIndex * pageSize + 1;
|
7567
|
-
var maxItemIndex = (pageIndex + 1) * pageSize;
|
7501
|
+
const getShowingLabel = (length, pageIndex, pageSize, texts) => {
|
7502
|
+
const minItemIndex = pageIndex * pageSize + 1;
|
7503
|
+
const maxItemIndex = (pageIndex + 1) * pageSize;
|
7568
7504
|
return texts.pagination.showingXofYofTotal.replace('[X]', length === 0 ? '0' : String(minItemIndex)).replace('[Y]', String(maxItemIndex > length ? length : maxItemIndex)).replace('[total]', String(length));
|
7569
7505
|
};
|
7570
7506
|
|
7571
|
-
|
7572
|
-
|
7573
|
-
|
7574
|
-
|
7575
|
-
|
7576
|
-
|
7577
|
-
|
7578
|
-
|
7579
|
-
|
7580
|
-
|
7581
|
-
|
7582
|
-
|
7583
|
-
|
7584
|
-
|
7585
|
-
|
7586
|
-
|
7587
|
-
|
7588
|
-
|
7589
|
-
|
7590
|
-
texts = _useLocalization.texts;
|
7591
|
-
|
7592
|
-
var maxPageIndex = Math.ceil(length / pageSize) - 1;
|
7593
|
-
var showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;
|
7507
|
+
const Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
7508
|
+
const {
|
7509
|
+
length,
|
7510
|
+
pageIndex,
|
7511
|
+
pageSize,
|
7512
|
+
pageSizes = [10, 25, 50, 100, 500],
|
7513
|
+
setPageIndex,
|
7514
|
+
setPageSize,
|
7515
|
+
showPageControls = true,
|
7516
|
+
showPageNumbers = true,
|
7517
|
+
showPageSize = true,
|
7518
|
+
dangerouslyHijackGlobalKeyboardNavigation = false,
|
7519
|
+
...otherProps
|
7520
|
+
} = props;
|
7521
|
+
const {
|
7522
|
+
texts
|
7523
|
+
} = useLocalization();
|
7524
|
+
const maxPageIndex = Math.ceil(length / pageSize) - 1;
|
7525
|
+
const showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;
|
7594
7526
|
usePaginationShortcuts({
|
7595
|
-
setPageIndex
|
7596
|
-
maxPageIndex
|
7597
|
-
pageIndex
|
7598
|
-
dangerouslyHijackGlobalKeyboardNavigation
|
7527
|
+
setPageIndex,
|
7528
|
+
maxPageIndex,
|
7529
|
+
pageIndex,
|
7530
|
+
dangerouslyHijackGlobalKeyboardNavigation
|
7599
7531
|
});
|
7600
|
-
|
7601
|
-
|
7602
|
-
|
7603
|
-
|
7532
|
+
const pageCount = Math.ceil(length / pageSize);
|
7533
|
+
const canPreviousPage = pageIndex > 0;
|
7534
|
+
const canNextPage = pageIndex < pageCount - 1;
|
7535
|
+
const className = cn('inline-flex relative justify-between items-center', props.className);
|
7604
7536
|
return React.createElement("div", Object.assign({}, otherProps, {
|
7605
7537
|
className: className,
|
7606
7538
|
"data-taco": "pagination",
|
@@ -7610,13 +7542,11 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7610
7542
|
}, getShowingLabel(length, pageIndex, pageSize, texts), React.createElement(Select, {
|
7611
7543
|
"aria-label": texts.pagination.pageSize,
|
7612
7544
|
className: "ml-4 !w-20",
|
7613
|
-
data: pageSizes.map(
|
7614
|
-
|
7615
|
-
|
7616
|
-
|
7617
|
-
|
7618
|
-
}),
|
7619
|
-
onChange: function onChange(event) {
|
7545
|
+
data: pageSizes.map(pageSize => ({
|
7546
|
+
text: String(pageSize),
|
7547
|
+
value: pageSize
|
7548
|
+
})),
|
7549
|
+
onChange: event => {
|
7620
7550
|
setPageIndex(0);
|
7621
7551
|
setPageSize(Number(event.target.value));
|
7622
7552
|
},
|
@@ -7628,18 +7558,14 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7628
7558
|
appearance: "default",
|
7629
7559
|
disabled: !canPreviousPage,
|
7630
7560
|
icon: "arrow-start",
|
7631
|
-
onClick:
|
7632
|
-
return setPageIndex(0);
|
7633
|
-
},
|
7561
|
+
onClick: () => setPageIndex(0),
|
7634
7562
|
"aria-label": showShortcutTexts ? texts.pagination.actions.firstPageWithShortcut : texts.pagination.actions.firstPage,
|
7635
7563
|
tooltip: showShortcutTexts ? texts.pagination.actions.firstPageWithShortcut : texts.pagination.actions.firstPage
|
7636
7564
|
}), React.createElement(IconButton, {
|
7637
7565
|
appearance: "default",
|
7638
7566
|
disabled: !canPreviousPage,
|
7639
7567
|
icon: "arrow-left",
|
7640
|
-
onClick:
|
7641
|
-
return setPageIndex(pageIndex - 1);
|
7642
|
-
},
|
7568
|
+
onClick: () => setPageIndex(pageIndex - 1),
|
7643
7569
|
"aria-label": showShortcutTexts ? texts.pagination.actions.previousPageWithShortcut : texts.pagination.actions.previousPage,
|
7644
7570
|
tooltip: showShortcutTexts ? texts.pagination.actions.previousPageWithShortcut : texts.pagination.actions.previousPage
|
7645
7571
|
}), showPageNumbers && pageCount > 0 && React.createElement(PageNumbers, {
|
@@ -7650,43 +7576,36 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7650
7576
|
appearance: "default",
|
7651
7577
|
disabled: !canNextPage,
|
7652
7578
|
icon: "arrow-right",
|
7653
|
-
onClick:
|
7654
|
-
return setPageIndex(pageIndex + 1);
|
7655
|
-
},
|
7579
|
+
onClick: () => setPageIndex(pageIndex + 1),
|
7656
7580
|
"aria-label": showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage,
|
7657
7581
|
tooltip: showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage
|
7658
7582
|
}), React.createElement(IconButton, {
|
7659
7583
|
appearance: "default",
|
7660
7584
|
disabled: !canNextPage,
|
7661
7585
|
icon: "arrow-end",
|
7662
|
-
onClick:
|
7663
|
-
return setPageIndex(pageCount - 1);
|
7664
|
-
},
|
7586
|
+
onClick: () => setPageIndex(pageCount - 1),
|
7665
7587
|
"aria-label": showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage,
|
7666
7588
|
tooltip: showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage
|
7667
7589
|
})));
|
7668
7590
|
});
|
7669
7591
|
|
7670
|
-
|
7671
|
-
|
7672
|
-
|
7673
|
-
|
7674
|
-
|
7675
|
-
duration = _ref$duration === void 0 ? undefined : _ref$duration,
|
7676
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
7677
|
-
|
7678
|
-
var style;
|
7592
|
+
const Progress = ({
|
7593
|
+
duration = undefined,
|
7594
|
+
...props
|
7595
|
+
}) => {
|
7596
|
+
let style;
|
7679
7597
|
|
7680
7598
|
if (duration) {
|
7681
7599
|
style = {
|
7682
|
-
animationDuration: duration
|
7600
|
+
animationDuration: `${duration}ms`
|
7683
7601
|
};
|
7684
7602
|
}
|
7685
7603
|
|
7686
|
-
|
7687
|
-
|
7688
|
-
"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']": !duration
|
7689
|
-
|
7604
|
+
const className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);
|
7605
|
+
const progressClassName = cn('yt-progress__bar block h-1', {
|
7606
|
+
"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']": !duration,
|
7607
|
+
[`w-0 bg-grey-dark animate-[progress_linear]`]: duration
|
7608
|
+
});
|
7690
7609
|
return React__default.createElement("span", Object.assign({}, props, {
|
7691
7610
|
"data-taco": "progress",
|
7692
7611
|
className: className
|
@@ -7978,7 +7897,7 @@ const getActions = (actions, row = undefined) => {
|
|
7978
7897
|
const secondary = [];
|
7979
7898
|
|
7980
7899
|
if (actions) {
|
7981
|
-
let visibleActions = actions.filter(x => !!x);
|
7900
|
+
let visibleActions = actions.filter(x => !!x && typeof x !== 'boolean');
|
7982
7901
|
|
7983
7902
|
if (row) {
|
7984
7903
|
visibleActions = visibleActions.filter(action => {
|
@@ -8048,7 +7967,7 @@ const EditModeActions = () => {
|
|
8048
7967
|
const listener = event => {
|
8049
7968
|
var _event$target, _event$target$form;
|
8050
7969
|
|
8051
|
-
if (event.
|
7970
|
+
if (event.key === 'Escape' && (_event$target = event.target) !== null && _event$target !== void 0 && (_event$target$form = _event$target.form) !== null && _event$target$form !== void 0 && _event$target$form.reset) {
|
8052
7971
|
event.preventDefault();
|
8053
7972
|
event.target.form.reset();
|
8054
7973
|
}
|
@@ -8301,7 +8220,13 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
8301
8220
|
const [activeIndex, setActiveIndex] = reactUseControllableState.useControllableState({
|
8302
8221
|
prop: props.activeIndex,
|
8303
8222
|
defaultProp: props.defaultActiveIndex !== undefined ? props.defaultActiveIndex : useGlobalKeyboardNavigation ? 0 : undefined,
|
8304
|
-
onChange:
|
8223
|
+
onChange: index => {
|
8224
|
+
if (index !== undefined) {
|
8225
|
+
var _props$onChangeActive;
|
8226
|
+
|
8227
|
+
(_props$onChangeActive = props.onChangeActiveIndex) === null || _props$onChangeActive === void 0 ? void 0 : _props$onChangeActive.call(props, index);
|
8228
|
+
}
|
8229
|
+
}
|
8305
8230
|
});
|
8306
8231
|
|
8307
8232
|
const onKeyDown = event => {
|
@@ -8324,24 +8249,24 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
8324
8249
|
if (currentRow) {
|
8325
8250
|
const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);
|
8326
8251
|
|
8327
|
-
if (rowProps.onRowClick && event.
|
8252
|
+
if (rowProps.onRowClick && event.key === 'Enter') {
|
8328
8253
|
event.preventDefault();
|
8329
8254
|
rowProps.onRowClick(sanitizedRow);
|
8330
8255
|
return;
|
8331
8256
|
}
|
8332
8257
|
|
8333
|
-
if (currentRow.toggleRowSelected && event.
|
8258
|
+
if (currentRow.toggleRowSelected && event.key === ' ') {
|
8334
8259
|
event.preventDefault();
|
8335
8260
|
currentRow.toggleRowSelected();
|
8336
8261
|
return;
|
8337
8262
|
}
|
8338
8263
|
|
8339
8264
|
if (currentRow.toggleRowExpanded) {
|
8340
|
-
if (currentRow.isExpanded && event.
|
8265
|
+
if (currentRow.isExpanded && event.key === 'ArrowLeft') {
|
8341
8266
|
event.preventDefault();
|
8342
8267
|
currentRow.toggleRowExpanded();
|
8343
8268
|
return;
|
8344
|
-
} else if (!currentRow.isExpanded && event.
|
8269
|
+
} else if (!currentRow.isExpanded && event.key === 'ArrowRight') {
|
8345
8270
|
event.preventDefault();
|
8346
8271
|
currentRow.toggleRowExpanded();
|
8347
8272
|
return;
|
@@ -8351,7 +8276,7 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
8351
8276
|
|
8352
8277
|
if (currentRow.toggleRowEditing) {
|
8353
8278
|
if (currentRow.canEdit && !currentRow.isEditing) {
|
8354
|
-
if (rowProps.onRowCreate && event.shiftKey && event.
|
8279
|
+
if (rowProps.onRowCreate && event.shiftKey && event.key === 'n') {
|
8355
8280
|
event.preventDefault();
|
8356
8281
|
|
8357
8282
|
if (!currentRow.isExpanded) {
|
@@ -8362,7 +8287,7 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
8362
8287
|
return;
|
8363
8288
|
}
|
8364
8289
|
|
8365
|
-
if (event.
|
8290
|
+
if (event.key === 'e') {
|
8366
8291
|
event.preventDefault();
|
8367
8292
|
currentRow.toggleRowEditing();
|
8368
8293
|
return;
|
@@ -8370,19 +8295,19 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
8370
8295
|
}
|
8371
8296
|
}
|
8372
8297
|
|
8373
|
-
if (rowProps.onRowEdit && event.
|
8298
|
+
if (rowProps.onRowEdit && event.key === 'e' && !isModifierKeyPressed) {
|
8374
8299
|
event.preventDefault();
|
8375
8300
|
rowProps.onRowEdit(sanitizedRow, event);
|
8376
8301
|
return;
|
8377
8302
|
}
|
8378
8303
|
|
8379
|
-
if (rowProps.onRowCopy && event.
|
8304
|
+
if (rowProps.onRowCopy && event.key === 'c' && !isModifierKeyPressed) {
|
8380
8305
|
event.preventDefault();
|
8381
8306
|
rowProps.onRowCopy(sanitizedRow, event);
|
8382
8307
|
return;
|
8383
8308
|
}
|
8384
8309
|
|
8385
|
-
if (rowProps.onRowDelete && event.
|
8310
|
+
if (rowProps.onRowDelete && event.key === 'Delete' && !isModifierKeyPressed) {
|
8386
8311
|
event.preventDefault();
|
8387
8312
|
rowProps.onRowDelete(sanitizedRow, event);
|
8388
8313
|
return;
|
@@ -8390,7 +8315,7 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
8390
8315
|
}
|
8391
8316
|
}
|
8392
8317
|
|
8393
|
-
const nextIndex =
|
8318
|
+
const nextIndex = getNextIndexFromKey(event.key, rows.length, activeIndex);
|
8394
8319
|
|
8395
8320
|
if (nextIndex !== undefined) {
|
8396
8321
|
event.preventDefault();
|
@@ -8617,7 +8542,7 @@ const useTable = (props, ref) => {
|
|
8617
8542
|
const {
|
8618
8543
|
children,
|
8619
8544
|
data,
|
8620
|
-
dangerouslyHijackGlobalKeyboardNavigation:
|
8545
|
+
dangerouslyHijackGlobalKeyboardNavigation: _,
|
8621
8546
|
onRowClick,
|
8622
8547
|
onRowDrag,
|
8623
8548
|
onSelectedRows,
|
@@ -8630,6 +8555,10 @@ const useTable = (props, ref) => {
|
|
8630
8555
|
manualSorting,
|
8631
8556
|
onSort,
|
8632
8557
|
sortRules,
|
8558
|
+
//index
|
8559
|
+
activeIndex: _1,
|
8560
|
+
defaultActiveIndex: _2,
|
8561
|
+
onChangeActiveIndex: _3,
|
8633
8562
|
// pagination
|
8634
8563
|
disablePagination = true,
|
8635
8564
|
length,
|
@@ -9301,19 +9230,16 @@ const useTableRowCreation = (data, tableRef) => {
|
|
9301
9230
|
};
|
9302
9231
|
};
|
9303
9232
|
|
9304
|
-
|
9305
|
-
|
9306
|
-
|
9307
|
-
|
9308
|
-
|
9309
|
-
|
9310
|
-
|
9311
|
-
|
9312
|
-
|
9313
|
-
|
9314
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$t);
|
9315
|
-
|
9316
|
-
var className = cn('yt-tabs', "yt-tabs--" + orientation, {
|
9233
|
+
const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|
9234
|
+
const {
|
9235
|
+
id,
|
9236
|
+
defaultId,
|
9237
|
+
children,
|
9238
|
+
onChange,
|
9239
|
+
orientation = 'horizontal',
|
9240
|
+
...otherProps
|
9241
|
+
} = props;
|
9242
|
+
const className = cn('yt-tabs', `yt-tabs--${orientation}`, {
|
9317
9243
|
'flex w-full': orientation === 'vertical'
|
9318
9244
|
}, props.className);
|
9319
9245
|
return React.createElement(TabsPrimitive.Root, Object.assign({}, otherProps, {
|
@@ -9327,19 +9253,20 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|
|
9327
9253
|
value: id
|
9328
9254
|
}), children);
|
9329
9255
|
});
|
9330
|
-
|
9331
|
-
|
9256
|
+
const TabList = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
|
9257
|
+
const className = cn('yt-tab__list border-b border-grey-light flex flex-row m-0 mb-4', props.className);
|
9332
9258
|
return React.createElement(TabsPrimitive.List, Object.assign({}, props, {
|
9333
9259
|
className: className,
|
9334
9260
|
ref: ref
|
9335
9261
|
}));
|
9336
9262
|
});
|
9337
|
-
|
9338
|
-
|
9339
|
-
|
9340
|
-
|
9341
|
-
|
9342
|
-
|
9263
|
+
const TabTrigger = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
|
9264
|
+
const {
|
9265
|
+
id,
|
9266
|
+
disabled,
|
9267
|
+
...otherProps
|
9268
|
+
} = props;
|
9269
|
+
const className = cn('yt-tab bg-transparent border-b-2 border-transparent text-grey-darkest m-0 py-2 px-4', disabled ? 'cursor-not-allowed !text-grey-darker' : 'cursor-pointer rounded-t hover:border-grey-dark aria-selected:border-blue aria-selected:text-black aria-selected:hover:border-blue-light hover:text-black active:yt-focus active:border-blue focus:yt-focus focus:border-blue', props.className);
|
9343
9270
|
return React.createElement(TabsPrimitive.Trigger, Object.assign({}, otherProps, {
|
9344
9271
|
className: className,
|
9345
9272
|
disabled: disabled,
|
@@ -9350,11 +9277,12 @@ var TabTrigger = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
|
|
9350
9277
|
value: id
|
9351
9278
|
}));
|
9352
9279
|
});
|
9353
|
-
|
9354
|
-
|
9355
|
-
|
9356
|
-
|
9357
|
-
|
9280
|
+
const TabContent = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
|
9281
|
+
const {
|
9282
|
+
id,
|
9283
|
+
...otherProps
|
9284
|
+
} = props;
|
9285
|
+
const className = cn('yt-tab__panel outline-none', props.className);
|
9358
9286
|
return React.createElement(TabsPrimitive.Content, Object.assign({}, otherProps, {
|
9359
9287
|
className: className,
|
9360
9288
|
ref: ref,
|
@@ -9365,19 +9293,22 @@ Tabs.List = TabList;
|
|
9365
9293
|
Tabs.Trigger = TabTrigger;
|
9366
9294
|
Tabs.Content = TabContent;
|
9367
9295
|
|
9368
|
-
|
9369
|
-
|
9370
|
-
|
9371
|
-
|
9372
|
-
|
9373
|
-
|
9296
|
+
const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
9297
|
+
const {
|
9298
|
+
defaultValue: _,
|
9299
|
+
highlighted,
|
9300
|
+
invalid,
|
9301
|
+
onKeyDown,
|
9302
|
+
...otherProps
|
9303
|
+
} = props;
|
9304
|
+
const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className); // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
|
9374
9305
|
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
9375
9306
|
// so we manually override it to ensure _our_ desired behaviour remains intact
|
9376
9307
|
|
9377
|
-
|
9308
|
+
const handleKeyDown = event => {
|
9378
9309
|
if (event.key === 'Home' || event.key === 'End') {
|
9379
9310
|
event.preventDefault();
|
9380
|
-
|
9311
|
+
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
9381
9312
|
event.currentTarget.setSelectionRange(position, position);
|
9382
9313
|
event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;
|
9383
9314
|
}
|
@@ -9395,18 +9326,18 @@ var Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
|
9395
9326
|
}));
|
9396
9327
|
});
|
9397
9328
|
|
9398
|
-
|
9399
|
-
|
9400
|
-
|
9401
|
-
|
9402
|
-
|
9403
|
-
|
9404
|
-
|
9329
|
+
const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
9330
|
+
const {
|
9331
|
+
label,
|
9332
|
+
onChange,
|
9333
|
+
...otherProps
|
9334
|
+
} = props;
|
9335
|
+
const className = cn('group h-5 w-9 flex rounded-full inline-flex', {
|
9405
9336
|
'mr-2': !!label,
|
9406
9337
|
'bg-grey-darker hover:bg-grey-dark aria-checked:bg-blue aria-checked:hover:bg-blue-light focus:yt-focus': !props.disabled,
|
9407
9338
|
'bg-grey-light cursor-not-allowed aria-checked:bg-blue-light': props.disabled
|
9408
9339
|
}, props.className);
|
9409
|
-
|
9340
|
+
const element = React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, {
|
9410
9341
|
className: className,
|
9411
9342
|
onCheckedChange: onChange,
|
9412
9343
|
ref: ref
|
@@ -9415,7 +9346,7 @@ var Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
|
9415
9346
|
}));
|
9416
9347
|
|
9417
9348
|
if (label) {
|
9418
|
-
|
9349
|
+
const labelClassName = cn('flex items-center cursor-pointer', {
|
9419
9350
|
'cursor-not-allowed text-grey-dark': props.disabled
|
9420
9351
|
});
|
9421
9352
|
return React.createElement("label", {
|
@@ -9426,25 +9357,24 @@ var Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
|
9426
9357
|
return element;
|
9427
9358
|
});
|
9428
9359
|
|
9429
|
-
|
9430
|
-
|
9431
|
-
|
9432
|
-
|
9433
|
-
|
9434
|
-
|
9435
|
-
|
9436
|
-
|
9437
|
-
|
9438
|
-
|
9439
|
-
|
9440
|
-
|
9441
|
-
|
9442
|
-
|
9443
|
-
|
9444
|
-
|
9445
|
-
var onWindowKeyDown = function onWindowKeyDown(event) {
|
9360
|
+
const Tooltip$1 = ({
|
9361
|
+
continuous,
|
9362
|
+
index,
|
9363
|
+
isLastStep,
|
9364
|
+
step,
|
9365
|
+
backProps,
|
9366
|
+
primaryProps,
|
9367
|
+
skipProps,
|
9368
|
+
tooltipProps,
|
9369
|
+
size,
|
9370
|
+
locale,
|
9371
|
+
disableTourSkipOnEsc
|
9372
|
+
}) => {
|
9373
|
+
const skipButtonRef = React.useRef(null);
|
9374
|
+
React.useEffect(() => {
|
9375
|
+
const onWindowKeyDown = event => {
|
9446
9376
|
if (!disableTourSkipOnEsc) {
|
9447
|
-
if (event.
|
9377
|
+
if (event.key === 'Escape' && skipButtonRef.current !== null) {
|
9448
9378
|
event.preventDefault();
|
9449
9379
|
skipButtonRef.current.click();
|
9450
9380
|
return;
|
@@ -9453,7 +9383,7 @@ var Tooltip$1 = function Tooltip(_ref) {
|
|
9453
9383
|
};
|
9454
9384
|
|
9455
9385
|
window.addEventListener('keydown', onWindowKeyDown);
|
9456
|
-
return
|
9386
|
+
return () => {
|
9457
9387
|
window.removeEventListener('keydown', onWindowKeyDown);
|
9458
9388
|
};
|
9459
9389
|
}, []);
|
@@ -9472,31 +9402,31 @@ var Tooltip$1 = function Tooltip(_ref) {
|
|
9472
9402
|
appearance: "discrete"
|
9473
9403
|
}), locale.back), React.createElement(Button$1, Object.assign({}, primaryProps, {
|
9474
9404
|
appearance: "primary"
|
9475
|
-
}), continuous ? isLastStep ? locale.last
|
9405
|
+
}), continuous ? isLastStep ? `${locale.last} (${index + 1}/${size})` : `${locale.next} (${index + 1}/${size})` : locale.close)));
|
9476
9406
|
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
9477
9407
|
|
9478
9408
|
|
9479
|
-
|
9480
|
-
|
9481
|
-
|
9482
|
-
|
9483
|
-
|
9484
|
-
|
9485
|
-
|
9486
|
-
|
9487
|
-
|
9488
|
-
|
9489
|
-
|
9490
|
-
|
9491
|
-
|
9492
|
-
|
9493
|
-
|
9494
|
-
|
9495
|
-
|
9496
|
-
|
9497
|
-
|
9498
|
-
return React.Children.map(props.children,
|
9499
|
-
|
9409
|
+
const TourStep = _props => null;
|
9410
|
+
const Tour = props => {
|
9411
|
+
const {
|
9412
|
+
texts: {
|
9413
|
+
tour
|
9414
|
+
}
|
9415
|
+
} = useLocalization();
|
9416
|
+
const {
|
9417
|
+
autoStart: run,
|
9418
|
+
onComplete,
|
9419
|
+
onClose,
|
9420
|
+
onReady,
|
9421
|
+
spotlightClicks,
|
9422
|
+
disableCloseOnEsc: disableTourSkipOnEsc,
|
9423
|
+
disableScrollParentFix = false,
|
9424
|
+
scrollOffset,
|
9425
|
+
...rest
|
9426
|
+
} = props;
|
9427
|
+
const steps = React.useMemo(() => {
|
9428
|
+
return React.Children.map(props.children, child => {
|
9429
|
+
const step = {
|
9500
9430
|
disableBeacon: !child.props.showBeacon,
|
9501
9431
|
target: child.props.selector,
|
9502
9432
|
placement: child.props.position,
|
@@ -9506,12 +9436,10 @@ var Tour = function Tour(props) {
|
|
9506
9436
|
return step;
|
9507
9437
|
});
|
9508
9438
|
}, [props.children]);
|
9509
|
-
|
9439
|
+
const getStep = React.useCallback(selector => {
|
9510
9440
|
var _props$children$find;
|
9511
9441
|
|
9512
|
-
return (_props$children$find = props.children.find(
|
9513
|
-
return child.props.selector === selector;
|
9514
|
-
})) === null || _props$children$find === void 0 ? void 0 : _props$children$find.props;
|
9442
|
+
return (_props$children$find = props.children.find(child => child.props.selector === selector)) === null || _props$children$find === void 0 ? void 0 : _props$children$find.props;
|
9515
9443
|
}, [props.children]);
|
9516
9444
|
|
9517
9445
|
function callback(state) {
|
@@ -9541,12 +9469,10 @@ var Tour = function Tour(props) {
|
|
9541
9469
|
floaterProps: {
|
9542
9470
|
disableAnimation: true
|
9543
9471
|
},
|
9544
|
-
tooltipComponent:
|
9545
|
-
|
9546
|
-
|
9547
|
-
|
9548
|
-
}));
|
9549
|
-
},
|
9472
|
+
tooltipComponent: tooltipProps => React.createElement(Tooltip$1, Object.assign({}, tooltipProps, {
|
9473
|
+
locale: tour,
|
9474
|
+
disableTourSkipOnEsc: disableTourSkipOnEsc
|
9475
|
+
})),
|
9550
9476
|
locale: tour,
|
9551
9477
|
spotlightPadding: 8,
|
9552
9478
|
spotlightClicks: spotlightClicks,
|
@@ -9588,10 +9514,10 @@ var useOnClickOutside = function useOnClickOutside(ref, callback) {
|
|
9588
9514
|
}, [ref, callback]);
|
9589
9515
|
};
|
9590
9516
|
|
9591
|
-
var _excluded$
|
9517
|
+
var _excluded$8 = ["noPadding"];
|
9592
9518
|
var Content$6 = /*#__PURE__*/React.forwardRef(function CardContent(externalProps, ref) {
|
9593
9519
|
var noPadding = externalProps.noPadding,
|
9594
|
-
props = _objectWithoutPropertiesLoose(externalProps, _excluded$
|
9520
|
+
props = _objectWithoutPropertiesLoose(externalProps, _excluded$8);
|
9595
9521
|
|
9596
9522
|
var className = cn('flex-grow overflow-auto', {
|
9597
9523
|
'mx-4 mb-4': !noPadding
|
@@ -9672,7 +9598,7 @@ exports.defaultLocalisationTexts = defaultLocalisationTexts;
|
|
9672
9598
|
exports.findByValue = findByValue$1;
|
9673
9599
|
exports.format = format;
|
9674
9600
|
exports.getByRowIndexPath = getByRowIndexPath;
|
9675
|
-
exports.
|
9601
|
+
exports.getNextIndexFromKey = getNextIndexFromKey;
|
9676
9602
|
exports.getParentRowIndexPath = getParentRowIndexPath;
|
9677
9603
|
exports.getRadioGroupItemValueAsString = getRadioGroupItemValueAsString;
|
9678
9604
|
exports.icons = icons;
|