@economic/taco 1.23.1 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Button/Button.d.ts +13 -0
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/components/DialogDrawer.d.ts +10 -0
- package/dist/components/Drawer/Context.d.ts +18 -0
- package/dist/components/Drawer/Drawer.d.ts +51 -0
- package/dist/components/Drawer/components/Content.d.ts +53 -0
- package/dist/components/Drawer/components/Trigger.d.ts +3 -0
- package/dist/components/Drawer/images.d.ts +1 -0
- package/dist/components/Drawer/types.d.ts +2 -0
- package/dist/components/Drawer/util.d.ts +7 -0
- package/dist/components/Header/Header.d.ts +28 -0
- package/dist/components/Header/components/AgreementSelector.d.ts +18 -0
- package/dist/components/Header/components/Agreements/AgreementDetails.d.ts +20 -0
- package/dist/components/Header/components/Button.d.ts +11 -0
- package/dist/components/Header/components/Link.d.ts +21 -0
- package/dist/components/Header/components/Logo.d.ts +3 -0
- package/dist/components/Header/components/MenuButton.d.ts +5 -0
- package/dist/components/Header/components/PrimaryNavigation.d.ts +3 -0
- package/dist/components/Header/components/SecondaryNavigation.d.ts +3 -0
- package/dist/components/Layout/Layout.d.ts +16 -0
- package/dist/components/Layout/components/Content.d.ts +3 -0
- package/dist/components/Layout/components/Context.d.ts +6 -0
- package/dist/components/Layout/components/Page.d.ts +3 -0
- package/dist/components/Layout/components/Sidebar.d.ts +3 -0
- package/dist/components/Layout/components/Top.d.ts +7 -0
- package/dist/components/Navigation2/Navigation2.d.ts +17 -0
- package/dist/components/Navigation2/components/Content.d.ts +3 -0
- package/dist/components/Navigation2/components/Group.d.ts +9 -0
- package/dist/components/Navigation2/components/Link.d.ts +24 -0
- package/dist/components/Navigation2/components/Section.d.ts +7 -0
- package/dist/components/Navigation2/components/util.d.ts +1 -0
- package/dist/components/Provider/Localization.d.ts +32 -16
- package/dist/esm/packages/taco/src/components/Button/Button.js +2 -0
- package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/util.js +5 -0
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/Dialog.js +3 -3
- package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/{Drawer.js → DialogDrawer.js} +4 -4
- package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Drawer/Context.js +19 -0
- package/dist/esm/packages/taco/src/components/Drawer/Context.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +102 -0
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +292 -0
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js +12 -0
- package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Drawer/util.js +37 -0
- package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/Header.js +30 -0
- package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +136 -0
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreements/AgreementDetails.js +73 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreements/AgreementDetails.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/Button.js +24 -0
- package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/Link.js +49 -0
- package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/Logo.js +73 -0
- package/dist/esm/packages/taco/src/components/Header/components/Logo.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +17 -0
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +134 -0
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +13 -0
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Layout/Layout.js +28 -0
- package/dist/esm/packages/taco/src/components/Layout/Layout.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Content.js +13 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Content.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Context.js +9 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Context.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Page.js +13 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Page.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +83 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Top.js +15 -0
- package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Menu/Menu.js +2 -2
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Link.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +31 -0
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +20 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js +46 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +72 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +25 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/util.js +12 -0
- package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +20 -10
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +4 -1
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/Search.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +1 -1
- package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js +3 -1
- package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIsLargeScreen.js +6 -0
- package/dist/esm/packages/taco/src/hooks/useIsLargeScreen.js.map +1 -0
- package/dist/esm/packages/taco/src/hooks/useMatchMedia.js +18 -0
- package/dist/esm/packages/taco/src/hooks/useMatchMedia.js.map +1 -0
- package/dist/esm/packages/taco/src/index.js +11 -1
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Collection/Collection.js +3 -0
- package/dist/esm/packages/taco/src/primitives/Collection/Collection.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +4 -1
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js +8 -1
- package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js.map +1 -1
- package/dist/hooks/useIsLargeScreen.d.ts +1 -0
- package/dist/hooks/useMatchMedia.d.ts +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/taco.cjs.development.js +1981 -737
- 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/package.json +3 -2
- package/tailwind.config.js +1 -0
- package/types.json +936 -182
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -26
- package/dist/components/Alert/Alert.stories.d.ts +0 -36
- package/dist/components/AlertDialog/AlertDialog.stories.d.ts +0 -10
- package/dist/components/Backdrop/Backdrop.stories.d.ts +0 -7
- package/dist/components/BadgeIcon/BadgeIcon.stories.d.ts +0 -12
- package/dist/components/Banner/Banner.stories.d.ts +0 -5
- package/dist/components/Button/Button.stories.d.ts +0 -77
- package/dist/components/Calendar/Calendar.stories.d.ts +0 -13
- package/dist/components/Card/Card.stories.d.ts +0 -12
- package/dist/components/Datepicker/Datepicker.stories.d.ts +0 -43
- package/dist/components/Dialog/Dialog.stories.d.ts +0 -57
- package/dist/components/Dialog/components/Drawer.d.ts +0 -10
- package/dist/components/Field/Field.stories.d.ts +0 -14
- package/dist/components/Form/Form.stories.d.ts +0 -14
- package/dist/components/Group/Group.stories.d.ts +0 -23
- package/dist/components/Hanger/Hanger.stories.d.ts +0 -11
- package/dist/components/HoverCard/HoverCard.stories.d.ts +0 -16
- package/dist/components/Icon/Icon.stories.d.ts +0 -8
- package/dist/components/IconButton/IconButton.stories.d.ts +0 -12
- package/dist/components/Input/Input.stories.d.ts +0 -17
- package/dist/components/Listbox/Listbox.stories.d.ts +0 -44
- package/dist/components/Menu/Menu.stories.d.ts +0 -73
- package/dist/components/Navigation/Navigation.stories.d.ts +0 -7
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -28
- package/dist/components/Popover/Popover.stories.d.ts +0 -29
- package/dist/components/Progress/Progress.stories.d.ts +0 -9
- package/dist/components/RadioGroup/RadioGroup.stories.d.ts +0 -49
- package/dist/components/ScrollArea/ScrollArea.stories.d.ts +0 -8
- package/dist/components/SearchInput/SearchInput.stories.d.ts +0 -38
- package/dist/components/Select/Select.stories.d.ts +0 -35
- package/dist/components/Select2/Select2.stories.d.ts +0 -57
- package/dist/components/Spinner/Spinner.stories.d.ts +0 -15
- package/dist/components/Table/Table.stories.d.ts +0 -32
- package/dist/components/Table2/Table2.stories.d.ts +0 -48
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -19
- package/dist/components/Tag/Tag.stories.d.ts +0 -9
- package/dist/components/Textarea/Textarea.stories.d.ts +0 -40
- package/dist/components/Toast/Toast.stories.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -26
- package/dist/components/Tour/Tour.stories.d.ts +0 -11
- package/dist/css/Typography.stories.d.ts +0 -6
- package/dist/esm/packages/taco/src/components/Dialog/components/Drawer.js.map +0 -1
- package/dist/hooks/useIsRefOverflowing.d.ts +0 -2
- package/dist/primitives/Collection/Collection.stories.d.ts +0 -8
- package/dist/primitives/Listbox2/Listbox2.stories.d.ts +0 -16
- package/dist/primitives/Sortable/Sortable.stories.d.ts +0 -14
@@ -19,14 +19,14 @@ var dateFns = require('date-fns');
|
|
19
19
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
20
20
|
var interactions = require('@react-aria/interactions');
|
21
21
|
var framerMotion = require('framer-motion');
|
22
|
+
var focus = require('@react-aria/focus');
|
23
|
+
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
24
|
+
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
22
25
|
var HoverCardPrimitive = require('@radix-ui/react-hover-card');
|
23
26
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
24
|
-
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
25
27
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
26
|
-
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
27
28
|
var reactTable = require('react-table');
|
28
29
|
var reactIntersectionObserver = require('react-intersection-observer');
|
29
|
-
var focus = require('@react-aria/focus');
|
30
30
|
var reactWindow = require('react-window');
|
31
31
|
var InfiniteLoader = _interopDefault(require('react-window-infinite-loader'));
|
32
32
|
var set = _interopDefault(require('lodash/set'));
|
@@ -44,6 +44,7 @@ var utilities = require('@dnd-kit/utilities');
|
|
44
44
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
45
45
|
var Joyride = require('react-joyride');
|
46
46
|
var Joyride__default = _interopDefault(Joyride);
|
47
|
+
var reactPortal = require('@radix-ui/react-portal');
|
47
48
|
|
48
49
|
const AVAILABLE_COLORS = ['green', 'yellow', 'red', 'blue', 'purple', 'brown', 'pink', 'orange', 'grey', 'transparent'];
|
49
50
|
const getColorByState = state => {
|
@@ -3648,6 +3649,7 @@ const createButtonWithTooltip = (props, className, ref) => {
|
|
3648
3649
|
const createButtonWithOverlays = (props, buttonBase) => {
|
3649
3650
|
const {
|
3650
3651
|
dialog,
|
3652
|
+
drawer,
|
3651
3653
|
hanger,
|
3652
3654
|
menu,
|
3653
3655
|
popover
|
@@ -3657,6 +3659,10 @@ const createButtonWithOverlays = (props, buttonBase) => {
|
|
3657
3659
|
button = dialog({
|
3658
3660
|
trigger: button
|
3659
3661
|
});
|
3662
|
+
} else if (typeof drawer === 'function') {
|
3663
|
+
button = drawer({
|
3664
|
+
trigger: button
|
3665
|
+
});
|
3660
3666
|
} else if (typeof menu === 'function') {
|
3661
3667
|
button = menu({
|
3662
3668
|
trigger: button
|
@@ -3718,6 +3724,9 @@ const IconButton = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
3718
3724
|
});
|
3719
3725
|
|
3720
3726
|
const defaultLocalisationTexts = {
|
3727
|
+
banner: {
|
3728
|
+
close: 'Close'
|
3729
|
+
},
|
3721
3730
|
calendar: {
|
3722
3731
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
3723
3732
|
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
@@ -3738,21 +3747,25 @@ const defaultLocalisationTexts = {
|
|
3738
3747
|
expand: 'Show calendar',
|
3739
3748
|
shortcuts: 'Shortcuts'
|
3740
3749
|
},
|
3750
|
+
dialog: {
|
3751
|
+
close: 'Close',
|
3752
|
+
drag: 'Drag'
|
3753
|
+
},
|
3741
3754
|
hanger: {
|
3742
3755
|
close: 'Close'
|
3743
3756
|
},
|
3744
|
-
|
3745
|
-
|
3757
|
+
header: {
|
3758
|
+
addAgreement: 'Add agreement',
|
3759
|
+
logout: 'Log off',
|
3760
|
+
more: 'More',
|
3761
|
+
new: 'New',
|
3762
|
+
search: 'Search for agreement...'
|
3746
3763
|
},
|
3747
3764
|
listbox: {
|
3748
3765
|
loading: 'Loading results...',
|
3749
3766
|
empty: 'No results found',
|
3750
3767
|
allOption: 'All'
|
3751
3768
|
},
|
3752
|
-
dialog: {
|
3753
|
-
close: 'Close',
|
3754
|
-
drag: 'Drag'
|
3755
|
-
},
|
3756
3769
|
pagination: {
|
3757
3770
|
label: 'Pagination',
|
3758
3771
|
pageSize: 'Items per page',
|
@@ -3863,6 +3876,11 @@ const defaultLocalisationTexts = {
|
|
3863
3876
|
collapseRow: 'Collapse current row'
|
3864
3877
|
}
|
3865
3878
|
},
|
3879
|
+
searchInput: {
|
3880
|
+
button: 'Search',
|
3881
|
+
placeholder: 'Search...',
|
3882
|
+
clear: 'Clear'
|
3883
|
+
},
|
3866
3884
|
select: {
|
3867
3885
|
allOptionsSelected: 'All'
|
3868
3886
|
},
|
@@ -3888,10 +3906,8 @@ const defaultLocalisationTexts = {
|
|
3888
3906
|
next: 'Next',
|
3889
3907
|
open: 'Open'
|
3890
3908
|
},
|
3891
|
-
|
3892
|
-
|
3893
|
-
placeholder: 'Search...',
|
3894
|
-
clear: 'Clear'
|
3909
|
+
drawer: {
|
3910
|
+
close: 'Close'
|
3895
3911
|
}
|
3896
3912
|
};
|
3897
3913
|
const defaultLocalizationContext = {
|
@@ -3953,6 +3969,7 @@ const Base$1 = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
3953
3969
|
const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3954
3970
|
const {
|
3955
3971
|
dialog,
|
3972
|
+
drawer,
|
3956
3973
|
hanger,
|
3957
3974
|
menu,
|
3958
3975
|
popover,
|
@@ -3974,6 +3991,7 @@ const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
3974
3991
|
}), children);
|
3975
3992
|
return createButtonWithOverlays({
|
3976
3993
|
dialog,
|
3994
|
+
drawer,
|
3977
3995
|
hanger,
|
3978
3996
|
menu,
|
3979
3997
|
popover
|
@@ -4116,7 +4134,7 @@ const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4116
4134
|
menu,
|
4117
4135
|
children
|
4118
4136
|
} = props;
|
4119
|
-
const className = cn('bg-white flex flex-col rounded-xl
|
4137
|
+
const className = cn('bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500', props.className);
|
4120
4138
|
return /*#__PURE__*/React.createElement("div", {
|
4121
4139
|
className: className,
|
4122
4140
|
"data-taco": "card",
|
@@ -5523,10 +5541,17 @@ const useDraggable = ref => {
|
|
5523
5541
|
setDragging(false);
|
5524
5542
|
}
|
5525
5543
|
});
|
5544
|
+
const resetPosition = () => {
|
5545
|
+
setPosition({
|
5546
|
+
x: 0,
|
5547
|
+
y: 0
|
5548
|
+
});
|
5549
|
+
};
|
5526
5550
|
return {
|
5527
5551
|
position,
|
5528
5552
|
dragging,
|
5529
|
-
handleProps: moveProps
|
5553
|
+
handleProps: moveProps,
|
5554
|
+
resetPosition
|
5530
5555
|
};
|
5531
5556
|
};
|
5532
5557
|
|
@@ -5633,7 +5658,7 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
5633
5658
|
})) : null), dialog.elements.drawer, dialog.elements.extra))));
|
5634
5659
|
});
|
5635
5660
|
|
5636
|
-
const
|
5661
|
+
const DialogDrawer = /*#__PURE__*/React.forwardRef(function DialogDrawer(props, ref) {
|
5637
5662
|
var _dialog$drawer, _dialog$drawer2;
|
5638
5663
|
const dialog = useCurrentDialog();
|
5639
5664
|
const className = cn('absolute top-0 -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left', props.className);
|
@@ -5665,7 +5690,7 @@ const Drawer = /*#__PURE__*/React.forwardRef(function DialogDrawer(props, ref) {
|
|
5665
5690
|
ref: ref
|
5666
5691
|
}), typeof props.children === 'function' ? props.children(dialog.drawer) : props.children);
|
5667
5692
|
});
|
5668
|
-
|
5693
|
+
DialogDrawer.displayName = 'DialogDrawer';
|
5669
5694
|
|
5670
5695
|
const Extra = /*#__PURE__*/React.forwardRef(function DialogExtra(props, ref) {
|
5671
5696
|
const className = cn('wcag-grey-100 absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left', props.className);
|
@@ -5684,7 +5709,7 @@ const useSeparatedChildren = initialChildren => {
|
|
5684
5709
|
let extra;
|
5685
5710
|
React.Children.toArray(initialChildren).forEach(child => {
|
5686
5711
|
var _child$type, _child$type2;
|
5687
|
-
if (((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) ===
|
5712
|
+
if (((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === DialogDrawer.displayName) {
|
5688
5713
|
drawer = child;
|
5689
5714
|
} else if (((_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName) === Extra.displayName) {
|
5690
5715
|
extra = child;
|
@@ -5741,50 +5766,9 @@ Dialog.Content = Content$4;
|
|
5741
5766
|
Dialog.Title = Title$1;
|
5742
5767
|
Dialog.Footer = Footer$1;
|
5743
5768
|
Dialog.Extra = Extra;
|
5744
|
-
Dialog.Drawer =
|
5769
|
+
Dialog.Drawer = DialogDrawer;
|
5745
5770
|
Dialog.Close = Close$2;
|
5746
5771
|
|
5747
|
-
const Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
5748
|
-
const {
|
5749
|
-
disabled,
|
5750
|
-
children,
|
5751
|
-
invalid = false,
|
5752
|
-
message,
|
5753
|
-
...otherProps
|
5754
|
-
} = props;
|
5755
|
-
const className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5756
|
-
'text-grey-300': disabled
|
5757
|
-
}, props.className);
|
5758
|
-
const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {
|
5759
|
-
'text-grey-700': !invalid,
|
5760
|
-
'text-red-500': invalid,
|
5761
|
-
'opacity-50': disabled
|
5762
|
-
}, props.className);
|
5763
|
-
return /*#__PURE__*/React.createElement("label", Object.assign({}, otherProps, {
|
5764
|
-
className: className,
|
5765
|
-
"data-taco": "label",
|
5766
|
-
ref: ref
|
5767
|
-
}), children, message && /*#__PURE__*/React.createElement("span", {
|
5768
|
-
className: messageClassName,
|
5769
|
-
role: invalid ? 'alert' : undefined
|
5770
|
-
}, message));
|
5771
|
-
});
|
5772
|
-
|
5773
|
-
const Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
5774
|
-
const {
|
5775
|
-
horizontal = false,
|
5776
|
-
...otherProps
|
5777
|
-
} = props;
|
5778
|
-
const className = cn('yt-form', {
|
5779
|
-
'yt-form--horizontal flex flex-wrap': horizontal
|
5780
|
-
}, props.className);
|
5781
|
-
return /*#__PURE__*/React.createElement("form", Object.assign({}, otherProps, {
|
5782
|
-
className: className,
|
5783
|
-
"data-taco": "form",
|
5784
|
-
ref: ref
|
5785
|
-
}));
|
5786
|
-
});
|
5787
|
-
|
5788
5772
|
const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
5789
5773
|
const {
|
5790
5774
|
as: Tag = 'span',
|
@@ -5801,486 +5785,996 @@ const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
5801
5785
|
}));
|
5802
5786
|
});
|
5803
5787
|
|
5804
|
-
const
|
5805
|
-
|
5788
|
+
const MenuContext = /*#__PURE__*/React.createContext(undefined);
|
5789
|
+
const useCurrentMenu = () => {
|
5790
|
+
return React.useContext(MenuContext);
|
5791
|
+
};
|
5792
|
+
|
5793
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
5794
|
+
const DrawerContext = /*#__PURE__*/React.createContext({
|
5795
|
+
closeOnEscape: true,
|
5796
|
+
showCloseButton: true,
|
5797
|
+
onClose: () => {},
|
5798
|
+
onResize: () => {},
|
5806
5799
|
props: {},
|
5807
|
-
ref: null
|
5800
|
+
ref: null,
|
5801
|
+
size: 'md',
|
5802
|
+
variant: 'embedded'
|
5808
5803
|
});
|
5809
|
-
const
|
5810
|
-
|
5811
|
-
|
5812
|
-
|
5813
|
-
|
5814
|
-
|
5815
|
-
|
5816
|
-
|
5817
|
-
|
5818
|
-
|
5819
|
-
|
5804
|
+
const useCurrentDrawer = () => {
|
5805
|
+
return React.useContext(DrawerContext);
|
5806
|
+
};
|
5807
|
+
|
5808
|
+
const getDrawerSizeClassnames = size => {
|
5809
|
+
switch (size) {
|
5810
|
+
case 'lg':
|
5811
|
+
return 'w-[600px]';
|
5812
|
+
case 'md':
|
5813
|
+
default:
|
5814
|
+
return 'w-[420px]';
|
5820
5815
|
}
|
5821
|
-
|
5822
|
-
|
5823
|
-
|
5824
|
-
|
5816
|
+
};
|
5817
|
+
const getDrawerContentClassNames = (size, variant, open) => {
|
5818
|
+
return cn('bg-white h-full bottom-0 top-0 right-0 transition-none', {
|
5819
|
+
block: open,
|
5820
|
+
hidden: !open,
|
5821
|
+
fixed: variant === 'overlay',
|
5822
|
+
'relative h-full overflow-hidden': variant === 'embedded'
|
5823
|
+
}, getDrawerSizeClassnames(size));
|
5824
|
+
};
|
5825
|
+
const getDrawerContainerClassNames = variant => {
|
5826
|
+
return cn('bg-white mx-auto absolute h-full w-full flex flex-col ', {
|
5827
|
+
'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]': variant === 'overlay',
|
5828
|
+
'border-l border-grey h-full': variant === 'embedded'
|
5829
|
+
});
|
5830
|
+
};
|
5831
|
+
const getDrawerDragHandlerClassNames = () => {
|
5832
|
+
return cn('border-[2px] absolute border-transparent top-0 w-2 h-full cursor-ew-resize left-0 hover:border-l-blue-500');
|
5833
|
+
};
|
5834
|
+
const getBackdropClassNames = open => {
|
5835
|
+
return cn({
|
5836
|
+
block: open,
|
5837
|
+
hidden: !open
|
5838
|
+
});
|
5839
|
+
};
|
5840
|
+
|
5841
|
+
const useGlobalKeyboardShortcut = handler => {
|
5842
|
+
React__default.useEffect(() => {
|
5843
|
+
document.addEventListener('keydown', handler);
|
5844
|
+
return () => {
|
5845
|
+
document.removeEventListener('keydown', handler);
|
5846
|
+
};
|
5847
|
+
}, [handler]);
|
5848
|
+
};
|
5849
|
+
|
5850
|
+
const Bar = props => {
|
5851
|
+
const className = cn(`flex select-none touch-none transition-colors hover:bg-grey`, {
|
5852
|
+
'w-[7px] hover:w-[14px] mr-[2px] hover:px-[2px] hover:mr-0': props.orientation === 'vertical',
|
5853
|
+
'flex-col h-[7px] hover:h-[14px] mb-[2px] hover:py-[2px] hover:mb-0': props.orientation === 'horizontal'
|
5854
|
+
});
|
5855
|
+
return /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Scrollbar, Object.assign({}, props, {
|
5856
|
+
className: className
|
5857
|
+
}));
|
5858
|
+
};
|
5859
|
+
const Thumb = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Thumb, Object.assign({}, props, {
|
5860
|
+
className: "flex-[1] rounded bg-black opacity-50"
|
5861
|
+
}));
|
5862
|
+
const Corner = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Corner, Object.assign({}, props, {
|
5863
|
+
classname: "bg-grey-500"
|
5864
|
+
}));
|
5865
|
+
const ScrollArea = props => {
|
5866
|
+
const {
|
5867
|
+
children,
|
5868
|
+
...otherProps
|
5869
|
+
} = props;
|
5870
|
+
return /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Root, Object.assign({}, otherProps, {
|
5871
|
+
className: cn('overflow-hidden', props.className)
|
5872
|
+
}), /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Viewport, {
|
5873
|
+
className: "h-full w-full"
|
5874
|
+
}, children), /*#__PURE__*/React__default.createElement(Bar, {
|
5875
|
+
orientation: "vertical"
|
5876
|
+
}, /*#__PURE__*/React__default.createElement(Thumb, null)), /*#__PURE__*/React__default.createElement(Bar, {
|
5877
|
+
orientation: "horizontal"
|
5878
|
+
}, /*#__PURE__*/React__default.createElement(Thumb, null)), /*#__PURE__*/React__default.createElement(Corner, null));
|
5879
|
+
};
|
5880
|
+
|
5881
|
+
const RESIZE_MIN = 360;
|
5882
|
+
const RESIZE_MAX = 1000;
|
5883
|
+
var DrawerAnimationDefinition;
|
5884
|
+
(function (DrawerAnimationDefinition) {
|
5885
|
+
DrawerAnimationDefinition["Visible"] = "visible";
|
5886
|
+
DrawerAnimationDefinition["Hidden"] = "hidden";
|
5887
|
+
})(DrawerAnimationDefinition || (DrawerAnimationDefinition = {}));
|
5888
|
+
const RenderPropWrapper$2 = /*#__PURE__*/React__default.forwardRef(function RenderPropWrapper({
|
5889
|
+
children,
|
5890
|
+
onClick,
|
5891
|
+
renderProps
|
5892
|
+
}, ref) {
|
5893
|
+
const close = () => {
|
5894
|
+
onClick(new CustomEvent('close'));
|
5895
|
+
};
|
5896
|
+
return children({
|
5897
|
+
close,
|
5898
|
+
ref,
|
5899
|
+
...renderProps
|
5900
|
+
});
|
5825
5901
|
});
|
5826
|
-
const Title$2 = /*#__PURE__*/
|
5827
|
-
const
|
5828
|
-
|
5829
|
-
|
5902
|
+
const Title$2 = /*#__PURE__*/React__default.forwardRef(function DrawerTitle(props, ref) {
|
5903
|
+
const {
|
5904
|
+
className,
|
5905
|
+
children,
|
5906
|
+
...otherProps
|
5907
|
+
} = props;
|
5908
|
+
/**
|
5909
|
+
* By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,
|
5910
|
+
* where we might want to hide the grey separator. For this reason separator was rendedr with using of classNames,
|
5911
|
+
* so it can be easily overriden in exceptional scenarious.
|
5912
|
+
* */
|
5913
|
+
const cName = cn('grow-0 py-4 pl-4 justyfy-self-start mb-0 border-b-[1px] border-grey-300', className);
|
5914
|
+
return /*#__PURE__*/React__default.createElement(DialogPrimitive.Title, Object.assign({
|
5915
|
+
className: cName
|
5916
|
+
}, otherProps, {
|
5830
5917
|
ref: ref
|
5831
|
-
})
|
5918
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
5919
|
+
className: "line-clamp-2 inline-block w-4/6 overflow-y-hidden"
|
5920
|
+
}, children));
|
5832
5921
|
});
|
5833
|
-
const
|
5922
|
+
const Footer$2 = /*#__PURE__*/React__default.forwardRef(function DrawerFooter(props, ref) {
|
5834
5923
|
const {
|
5835
|
-
|
5924
|
+
className,
|
5925
|
+
...otherProps
|
5836
5926
|
} = props;
|
5837
|
-
|
5927
|
+
/**
|
5928
|
+
* The same scenario as Title, grey separator rendered using classNames to have posibility to override it.
|
5929
|
+
*/
|
5930
|
+
const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-grey-300', props.className);
|
5931
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
5932
|
+
className: cName,
|
5933
|
+
ref: ref
|
5934
|
+
}));
|
5935
|
+
});
|
5936
|
+
const Actions = /*#__PURE__*/React__default.forwardRef(function Actions(props, ref) {
|
5838
5937
|
const {
|
5839
|
-
|
5840
|
-
|
5841
|
-
|
5842
|
-
const
|
5843
|
-
|
5844
|
-
|
5845
|
-
return /*#__PURE__*/React.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React.createElement(PopoverPrimitive.Content, {
|
5846
|
-
className: className,
|
5847
|
-
"data-taco": "hanger",
|
5848
|
-
onInteractOutside: handleInteractOutside,
|
5849
|
-
side: side,
|
5850
|
-
sideOffset: 1,
|
5938
|
+
className,
|
5939
|
+
...otherProps
|
5940
|
+
} = props;
|
5941
|
+
const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);
|
5942
|
+
return /*#__PURE__*/React__default.createElement(Group, Object.assign({}, otherProps, {
|
5943
|
+
className: cName,
|
5851
5944
|
ref: ref
|
5852
|
-
}
|
5853
|
-
|
5854
|
-
|
5945
|
+
}));
|
5946
|
+
});
|
5947
|
+
const Close$3 = /*#__PURE__*/React__default.forwardRef(function DrawerClose(props, ref) {
|
5948
|
+
const {
|
5949
|
+
onClose
|
5950
|
+
} = useCurrentDrawer();
|
5951
|
+
return /*#__PURE__*/React__default.createElement(DialogPrimitive.Close, Object.assign({}, props, {
|
5952
|
+
onClick: onClose,
|
5953
|
+
ref: ref,
|
5855
5954
|
asChild: true
|
5856
|
-
}
|
5857
|
-
appearance: "primary",
|
5858
|
-
"aria-label": texts.hanger.close,
|
5859
|
-
className: "absolute top-0 right-0 ml-2 mr-2 mt-2 text-white",
|
5860
|
-
icon: "close",
|
5861
|
-
onClick: context.onClose
|
5862
|
-
}))));
|
5955
|
+
}));
|
5863
5956
|
});
|
5864
|
-
const
|
5957
|
+
const InnerContent = /*#__PURE__*/React__default.forwardRef(function InnerContent(props, ref) {
|
5865
5958
|
const {
|
5866
|
-
|
5959
|
+
className,
|
5960
|
+
isScrollable = true,
|
5867
5961
|
children,
|
5868
|
-
defaultOpen = true,
|
5869
|
-
onClose,
|
5870
5962
|
...otherProps
|
5871
5963
|
} = props;
|
5872
|
-
const
|
5873
|
-
|
5874
|
-
|
5875
|
-
ref
|
5876
|
-
}),
|
5877
|
-
|
5878
|
-
|
5879
|
-
|
5880
|
-
|
5881
|
-
setOpen(defaultOpen);
|
5882
|
-
}
|
5883
|
-
}, []);
|
5884
|
-
return /*#__PURE__*/React.createElement(HangerContext.Provider, {
|
5885
|
-
value: context
|
5886
|
-
}, /*#__PURE__*/React.createElement(PopoverPrimitive.Root, {
|
5887
|
-
key: String(open),
|
5888
|
-
defaultOpen: open
|
5889
|
-
}, anchor && /*#__PURE__*/React.createElement(Anchor, null, anchor), children));
|
5964
|
+
const cName = cn('grow-1 p-4', className);
|
5965
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
5966
|
+
className: cName,
|
5967
|
+
ref: ref
|
5968
|
+
}), isScrollable ? /*#__PURE__*/React__default.createElement(ScrollArea, {
|
5969
|
+
className: "w-full gap-y-0.5"
|
5970
|
+
}, children) : {
|
5971
|
+
children
|
5972
|
+
});
|
5890
5973
|
});
|
5891
|
-
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
|
5896
|
-
|
5897
|
-
|
5898
|
-
|
5899
|
-
|
5900
|
-
|
5901
|
-
|
5902
|
-
|
5903
|
-
|
5904
|
-
|
5905
|
-
|
5906
|
-
|
5974
|
+
const Portal = props => {
|
5975
|
+
const {
|
5976
|
+
children,
|
5977
|
+
...otherProps
|
5978
|
+
} = props;
|
5979
|
+
const {
|
5980
|
+
open = false,
|
5981
|
+
variant,
|
5982
|
+
outlet
|
5983
|
+
} = useCurrentDrawer();
|
5984
|
+
const backdropClassNames = React__default.useMemo(() => {
|
5985
|
+
return getBackdropClassNames(open);
|
5986
|
+
}, [open]);
|
5987
|
+
if (!outlet) {
|
5988
|
+
return null;
|
5989
|
+
}
|
5990
|
+
return /*#__PURE__*/React__default.createElement(DialogPrimitive.Portal, Object.assign({}, otherProps, {
|
5991
|
+
container: outlet !== null && outlet !== void 0 ? outlet : undefined
|
5992
|
+
}), variant === 'overlay' ? /*#__PURE__*/React__default.createElement(DialogPrimitive.Overlay, {
|
5993
|
+
forceMount: true
|
5994
|
+
}, /*#__PURE__*/React__default.createElement(Backdrop, {
|
5995
|
+
className: backdropClassNames
|
5996
|
+
})) : null, children);
|
5997
|
+
};
|
5998
|
+
const UntrappedFocusDrawerContent = /*#__PURE__*/React__default.forwardRef(function EmbeddedDrawerContent(props, ref) {
|
5999
|
+
const {
|
6000
|
+
onEscape,
|
6001
|
+
children,
|
6002
|
+
...otherProps
|
6003
|
+
} = props;
|
6004
|
+
useGlobalKeyboardShortcut(event => {
|
6005
|
+
if (event.key === 'Escape') {
|
6006
|
+
onEscape(event);
|
5907
6007
|
}
|
5908
|
-
})
|
5909
|
-
|
5910
|
-
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
5911
|
-
}), /*#__PURE__*/React.createElement("path", {
|
5912
|
-
className: "fill-current",
|
5913
|
-
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
|
5914
|
-
})));
|
5915
|
-
});
|
5916
|
-
|
5917
|
-
const Trigger$4 = /*#__PURE__*/React.forwardRef(function HoverCardTrigger(props, ref) {
|
5918
|
-
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Trigger, Object.assign({}, props, {
|
5919
|
-
asChild: true,
|
6008
|
+
});
|
6009
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
5920
6010
|
ref: ref
|
5921
|
-
})
|
6011
|
+
}), /*#__PURE__*/React__default.createElement(focus.FocusScope, {
|
6012
|
+
autoFocus: true,
|
6013
|
+
restoreFocus: true
|
6014
|
+
}, children));
|
5922
6015
|
});
|
5923
|
-
const
|
6016
|
+
const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(props, externalRef) {
|
5924
6017
|
const {
|
5925
|
-
|
6018
|
+
size,
|
6019
|
+
onClose,
|
6020
|
+
onResize,
|
6021
|
+
open = false,
|
6022
|
+
closeOnEscape,
|
6023
|
+
variant,
|
6024
|
+
focusTrap,
|
6025
|
+
showCloseButton,
|
6026
|
+
setOpen
|
6027
|
+
} = useCurrentDrawer();
|
6028
|
+
const {
|
6029
|
+
className,
|
6030
|
+
style,
|
6031
|
+
children,
|
6032
|
+
...otherProps
|
5926
6033
|
} = props;
|
5927
|
-
const className = cn(getPopoverStyleClassnames(), 'min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]', props.className);
|
5928
|
-
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Portal, null, /*#__PURE__*/React.createElement(HoverCardPrimitive.Content, {
|
5929
|
-
className: className,
|
5930
|
-
"data-taco": "hover-card",
|
5931
|
-
side: side,
|
5932
|
-
sideOffset: 1,
|
5933
|
-
ref: ref
|
5934
|
-
}, props.children, /*#__PURE__*/React.createElement(UnstyledArrow$1, {
|
5935
|
-
className: "text-white"
|
5936
|
-
})));
|
5937
|
-
});
|
5938
|
-
const HoverCard = props => {
|
5939
|
-
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Root, Object.assign({}, props, {
|
5940
|
-
openDelay: 300
|
5941
|
-
}));
|
5942
|
-
};
|
5943
|
-
HoverCard.Trigger = Trigger$4;
|
5944
|
-
HoverCard.Content = Content$6;
|
5945
|
-
|
5946
|
-
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
5947
|
-
onSearch,
|
5948
|
-
...props
|
5949
|
-
}, ref) {
|
5950
|
-
const internalRef = useMergedRef(ref);
|
5951
6034
|
const {
|
5952
6035
|
texts
|
5953
6036
|
} = useLocalization();
|
5954
|
-
const
|
5955
|
-
|
5956
|
-
|
5957
|
-
|
5958
|
-
|
5959
|
-
|
6037
|
+
const ref = useMergedRef(externalRef);
|
6038
|
+
// if the drawer was opened by a menu, we need to close the menu when the drawer closes
|
6039
|
+
// the menu is still open (and mounted) because it is the trigger for the drawer
|
6040
|
+
const menu = useCurrentMenu();
|
6041
|
+
let handleCloseAutoFocus;
|
6042
|
+
if (menu) {
|
6043
|
+
handleCloseAutoFocus = () => {
|
6044
|
+
menu.close();
|
6045
|
+
};
|
6046
|
+
}
|
6047
|
+
const containerClassName = React__default.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);
|
6048
|
+
const {
|
6049
|
+
contentClassName,
|
6050
|
+
dragHandlerClassName
|
6051
|
+
} = React__default.useMemo(() => {
|
6052
|
+
const contentClassName = getDrawerContentClassNames(size, variant, open);
|
6053
|
+
const dragHandlerClassName = getDrawerDragHandlerClassNames();
|
6054
|
+
return {
|
6055
|
+
contentClassName,
|
6056
|
+
dragHandlerClassName
|
6057
|
+
};
|
6058
|
+
}, [size, variant, open]);
|
6059
|
+
const handleEscapeKeyDown = event => {
|
6060
|
+
var _ref$current;
|
6061
|
+
const isTargetInsideDrawerContent = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(event.target);
|
6062
|
+
if (isTargetInsideDrawerContent) {
|
6063
|
+
if (!closeOnEscape) {
|
6064
|
+
event.preventDefault();
|
6065
|
+
} else {
|
6066
|
+
setOpen && setOpen(false);
|
6067
|
+
if (onClose) {
|
6068
|
+
onClose();
|
6069
|
+
}
|
6070
|
+
}
|
6071
|
+
}
|
5960
6072
|
};
|
5961
|
-
const
|
5962
|
-
|
5963
|
-
|
5964
|
-
|
5965
|
-
|
5966
|
-
|
6073
|
+
const [containerWidth, setContainerWidth] = React__default.useState();
|
6074
|
+
const dragHandlerRef = React__default.useRef(null);
|
6075
|
+
const {
|
6076
|
+
position,
|
6077
|
+
dragging,
|
6078
|
+
handleProps: dragHandleProps,
|
6079
|
+
resetPosition
|
6080
|
+
} = useDraggable(useMergedRef(dragHandlerRef));
|
6081
|
+
const contentRef = React__default.useRef(null);
|
6082
|
+
React__default.useEffect(() => {
|
6083
|
+
if (onResize) {
|
6084
|
+
onResize(position.x);
|
6085
|
+
}
|
6086
|
+
}, [position]);
|
6087
|
+
React__default.useEffect(() => {
|
6088
|
+
var _contentRef$current;
|
6089
|
+
setContainerWidth((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.offsetWidth);
|
6090
|
+
}, [contentRef, open]);
|
6091
|
+
const resizedWidth = React__default.useMemo(() => {
|
6092
|
+
if (containerWidth) {
|
6093
|
+
return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));
|
6094
|
+
}
|
6095
|
+
return;
|
6096
|
+
}, [containerWidth, position]);
|
6097
|
+
React__default.useEffect(() => {
|
6098
|
+
if (!dragging && resizedWidth) {
|
6099
|
+
setContainerWidth(resizedWidth);
|
6100
|
+
resetPosition();
|
6101
|
+
}
|
6102
|
+
}, [dragging]);
|
6103
|
+
let output;
|
6104
|
+
if (typeof children === 'function') {
|
6105
|
+
output = /*#__PURE__*/React__default.createElement(Close$3, null, /*#__PURE__*/React__default.createElement(RenderPropWrapper$2, null, children));
|
6106
|
+
} else {
|
6107
|
+
output = children;
|
6108
|
+
}
|
6109
|
+
const content = /*#__PURE__*/React__default.createElement("div", {
|
6110
|
+
ref: contentRef,
|
6111
|
+
"data-taco": "drawer",
|
6112
|
+
className: containerClassName
|
6113
|
+
}, /*#__PURE__*/React__default.createElement("div", Object.assign({
|
6114
|
+
className: dragHandlerClassName
|
6115
|
+
}, dragHandleProps, {
|
6116
|
+
"data-testid": "resize-handler",
|
6117
|
+
ref: dragHandlerRef
|
6118
|
+
})), output, showCloseButton ? /*#__PURE__*/React__default.createElement(Close$3, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
6119
|
+
appearance: "discrete",
|
6120
|
+
"aria-label": texts.drawer.close,
|
6121
|
+
className: "absolute top-0 right-0 mt-4 mr-2",
|
6122
|
+
icon: "close"
|
6123
|
+
})) : null);
|
6124
|
+
const styleProp = {
|
6125
|
+
...style,
|
6126
|
+
...{
|
6127
|
+
width: resizedWidth
|
5967
6128
|
}
|
5968
|
-
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
5969
6129
|
};
|
5970
|
-
return /*#__PURE__*/
|
5971
|
-
|
5972
|
-
|
5973
|
-
|
5974
|
-
|
5975
|
-
|
5976
|
-
|
5977
|
-
|
5978
|
-
|
5979
|
-
|
5980
|
-
|
5981
|
-
|
5982
|
-
|
5983
|
-
|
5984
|
-
|
5985
|
-
|
5986
|
-
|
5987
|
-
|
5988
|
-
|
5989
|
-
|
5990
|
-
|
5991
|
-
|
5992
|
-
|
5993
|
-
|
6130
|
+
return focusTrap ? /*#__PURE__*/React__default.createElement(DialogPrimitive.Content, Object.assign({
|
6131
|
+
forceMount: true
|
6132
|
+
}, otherProps, {
|
6133
|
+
className: contentClassName,
|
6134
|
+
onEscapeKeyDown: handleEscapeKeyDown,
|
6135
|
+
onInteractOutside: variant === 'overlay' ? undefined : event => event.preventDefault(),
|
6136
|
+
onCloseAutoFocus: handleCloseAutoFocus,
|
6137
|
+
ref: ref,
|
6138
|
+
style: styleProp
|
6139
|
+
}), content) : /*#__PURE__*/React__default.createElement(UntrappedFocusDrawerContent, {
|
6140
|
+
onEscape: handleEscapeKeyDown,
|
6141
|
+
className: contentClassName,
|
6142
|
+
style: styleProp,
|
6143
|
+
ref: ref
|
6144
|
+
}, content);
|
6145
|
+
});
|
6146
|
+
const Content$5 = /*#__PURE__*/React__default.forwardRef(function Content(props, externalRef) {
|
6147
|
+
const {
|
6148
|
+
children
|
6149
|
+
} = props;
|
6150
|
+
return /*#__PURE__*/React__default.createElement(Portal, null, /*#__PURE__*/React__default.createElement(DrawerContent, Object.assign({}, props, {
|
6151
|
+
ref: externalRef
|
6152
|
+
}), children));
|
6153
|
+
});
|
6154
|
+
|
6155
|
+
const Trigger$4 = /*#__PURE__*/React.forwardRef(function DrawerTrigger(props, ref) {
|
6156
|
+
return /*#__PURE__*/React.createElement(DialogPrimitive.Trigger, Object.assign({}, props, {
|
6157
|
+
ref: ref,
|
6158
|
+
asChild: true
|
5994
6159
|
}));
|
5995
6160
|
});
|
5996
6161
|
|
5997
|
-
|
5998
|
-
const
|
5999
|
-
|
6000
|
-
|
6001
|
-
|
6162
|
+
const Outlet = /*#__PURE__*/React.forwardRef(function Outlet(props, ref) {
|
6163
|
+
const className = cn('h-full ml-auto overflow-hidden flex-shrink-0', props.className);
|
6164
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
6165
|
+
className: className,
|
6166
|
+
"data-taco": "drawer-outlet",
|
6167
|
+
ref: ref
|
6168
|
+
}));
|
6169
|
+
});
|
6170
|
+
// drawerStack getting set by previous drawer instance, to be able to close previous instance, when new instance getting opened.
|
6171
|
+
let drawerStack;
|
6172
|
+
const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(props, ref) {
|
6173
|
+
const {
|
6174
|
+
open: openProp,
|
6175
|
+
defaultOpen: defaultOpenProp,
|
6176
|
+
// if onChange is not provided, then replace it with empty function, needed for useControllableState
|
6177
|
+
onChange = () => {
|
6178
|
+
// do nothing.
|
6179
|
+
},
|
6180
|
+
variant = 'embedded',
|
6181
|
+
className,
|
6182
|
+
closeOnEscape = true,
|
6183
|
+
onResize,
|
6184
|
+
onClose,
|
6185
|
+
size = 'md',
|
6186
|
+
trigger,
|
6187
|
+
children,
|
6188
|
+
focusTrap = props.focusTrap === undefined && props.variant === 'overlay' ? true : props.focusTrap,
|
6189
|
+
showCloseButton = true,
|
6190
|
+
...otherProps
|
6191
|
+
} = props;
|
6192
|
+
const [open, setOpen] = reactUseControllableState.useControllableState({
|
6193
|
+
prop: openProp,
|
6194
|
+
defaultProp: defaultOpenProp,
|
6195
|
+
onChange
|
6002
6196
|
});
|
6197
|
+
const [outlet, setOutlet] = React.useState();
|
6198
|
+
const context = React.useMemo(() => ({
|
6199
|
+
closeOnEscape,
|
6200
|
+
onClose,
|
6201
|
+
onResize,
|
6202
|
+
props: otherProps,
|
6203
|
+
size,
|
6204
|
+
ref,
|
6205
|
+
open,
|
6206
|
+
setOpen,
|
6207
|
+
variant,
|
6208
|
+
focusTrap,
|
6209
|
+
showCloseButton,
|
6210
|
+
outlet
|
6211
|
+
}), [closeOnEscape, open, setOpen, otherProps, variant, onResize, onClose, size, focusTrap, showCloseButton, outlet]);
|
6212
|
+
// this prevents two drawers being open at once and used when one drawer getting opened before another one got closed.
|
6213
|
+
const close = React.useCallback(() => {
|
6214
|
+
setOpen(false);
|
6215
|
+
onClose && onClose();
|
6216
|
+
}, []);
|
6003
6217
|
React.useEffect(() => {
|
6004
|
-
|
6005
|
-
|
6006
|
-
|
6007
|
-
|
6008
|
-
|
6009
|
-
|
6010
|
-
|
6011
|
-
|
6012
|
-
|
6013
|
-
};
|
6014
|
-
}, [tracker.started]);
|
6015
|
-
return {
|
6016
|
-
running: !!tracker.started,
|
6017
|
-
start: () => {
|
6018
|
-
setTracker({
|
6019
|
-
remaining: duration,
|
6020
|
-
started: Date.now()
|
6021
|
-
});
|
6022
|
-
},
|
6023
|
-
pause: () => {
|
6024
|
-
if (tracker.started) {
|
6025
|
-
setTracker({
|
6026
|
-
remaining: tracker.remaining - (Date.now() - tracker.started),
|
6027
|
-
started: null
|
6028
|
-
});
|
6218
|
+
var _document$querySelect;
|
6219
|
+
const outletElement = (_document$querySelect = document.querySelector('[data-taco="drawer-outlet"]')) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.body;
|
6220
|
+
setOutlet(outletElement);
|
6221
|
+
}, []);
|
6222
|
+
React.useEffect(() => {
|
6223
|
+
if (open) {
|
6224
|
+
// if drawerStack is defined, this means that another drawer was opened before
|
6225
|
+
if (drawerStack) {
|
6226
|
+
drawerStack();
|
6029
6227
|
}
|
6030
|
-
|
6031
|
-
|
6032
|
-
if
|
6033
|
-
|
6034
|
-
|
6035
|
-
|
6036
|
-
});
|
6228
|
+
drawerStack = close;
|
6229
|
+
} else {
|
6230
|
+
// if drawerStack is equal to current close callback,
|
6231
|
+
// this means that drawer getting closed completely instead of getting closed on re-open
|
6232
|
+
if (drawerStack === close) {
|
6233
|
+
drawerStack = undefined;
|
6037
6234
|
}
|
6038
6235
|
}
|
6039
|
-
};
|
6040
|
-
|
6041
|
-
|
6042
|
-
|
6043
|
-
|
6044
|
-
|
6045
|
-
|
6046
|
-
|
6047
|
-
|
6048
|
-
|
6049
|
-
|
6050
|
-
|
6051
|
-
|
6052
|
-
|
6053
|
-
|
6054
|
-
|
6055
|
-
|
6056
|
-
};
|
6057
|
-
return {
|
6058
|
-
getNextIndex
|
6059
|
-
};
|
6060
|
-
};
|
6236
|
+
}, [open]);
|
6237
|
+
return /*#__PURE__*/React.createElement(DrawerContext.Provider, {
|
6238
|
+
value: context
|
6239
|
+
}, /*#__PURE__*/React.createElement(DialogPrimitive.Root, {
|
6240
|
+
modal: variant === 'overlay' ? true : false,
|
6241
|
+
open: open,
|
6242
|
+
onOpenChange: setOpen
|
6243
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$4, null, trigger), children));
|
6244
|
+
});
|
6245
|
+
Drawer.Trigger = Trigger$4;
|
6246
|
+
Drawer.Content = Content$5;
|
6247
|
+
Drawer.InnerContent = InnerContent;
|
6248
|
+
Drawer.Title = Title$2;
|
6249
|
+
Drawer.Footer = Footer$2;
|
6250
|
+
Drawer.Close = Close$3;
|
6251
|
+
Drawer.Actions = Actions;
|
6252
|
+
Drawer.Outlet = Outlet;
|
6061
6253
|
|
6062
|
-
const
|
6063
|
-
data: externalData = [],
|
6064
|
-
defaultValue,
|
6065
|
-
disabled,
|
6066
|
-
emptyValue,
|
6067
|
-
id: nativeId,
|
6068
|
-
invalid,
|
6069
|
-
name,
|
6070
|
-
onChange,
|
6071
|
-
onFocus,
|
6072
|
-
onKeyDown,
|
6073
|
-
value = emptyValue,
|
6074
|
-
...otherProps
|
6075
|
-
}, ref) => {
|
6076
|
-
const data = useFlattenedData(emptyValue !== undefined ? [{
|
6077
|
-
text: '',
|
6078
|
-
value: emptyValue
|
6079
|
-
}, ...externalData] : externalData);
|
6080
|
-
const id = React.useMemo(() => nativeId || uuid.v4(), [nativeId]);
|
6081
|
-
const inputRef = useMergedRef(ref);
|
6082
|
-
const currentIndex = value !== undefined ? getIndexFromValue(data, value) : undefined;
|
6254
|
+
const Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
6083
6255
|
const {
|
6084
|
-
getNextIndex
|
6085
|
-
} = useTypeahead({
|
6086
|
-
data,
|
6087
|
-
currentIndex
|
6088
|
-
});
|
6089
|
-
const setInputValueByIndex = index => {
|
6090
|
-
if (index !== undefined) {
|
6091
|
-
const option = data[index];
|
6092
|
-
if (option && !option.disabled) {
|
6093
|
-
setInputValueByRef$1(inputRef.current, option.value);
|
6094
|
-
}
|
6095
|
-
}
|
6096
|
-
};
|
6097
|
-
const handleListboxChange = index => {
|
6098
|
-
setInputValueByIndex(index);
|
6099
|
-
};
|
6100
|
-
React.useEffect(() => {
|
6101
|
-
if (data.length && currentIndex === undefined) {
|
6102
|
-
if (defaultValue !== undefined) {
|
6103
|
-
const defaultValueIndex = getIndexFromValue(data, defaultValue);
|
6104
|
-
if (defaultValueIndex !== undefined) {
|
6105
|
-
setInputValueByIndex(defaultValueIndex);
|
6106
|
-
}
|
6107
|
-
} else {
|
6108
|
-
setInputValueByIndex(0);
|
6109
|
-
}
|
6110
|
-
}
|
6111
|
-
}, [data]);
|
6112
|
-
const handleListboxKeyDown = event => {
|
6113
|
-
const charKey = event.key;
|
6114
|
-
// event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)
|
6115
|
-
// We need to filter out only alphabetical or numeric letters, that's why that condition has been changed
|
6116
|
-
if (charKey.length === 1 && /(\w)/g.test(charKey)) {
|
6117
|
-
const nextIndex = getNextIndex(charKey);
|
6118
|
-
if (nextIndex > -1 && nextIndex !== currentIndex) {
|
6119
|
-
setInputValueByIndex(nextIndex);
|
6120
|
-
}
|
6121
|
-
return;
|
6122
|
-
}
|
6123
|
-
if (onKeyDown) {
|
6124
|
-
event.persist();
|
6125
|
-
onKeyDown(event);
|
6126
|
-
}
|
6127
|
-
};
|
6128
|
-
const handleListboxFocus = event => {
|
6129
|
-
if (currentIndex === undefined && data.length) {
|
6130
|
-
setInputValueByIndex(0);
|
6131
|
-
}
|
6132
|
-
if (onFocus) {
|
6133
|
-
event.persist();
|
6134
|
-
onFocus(event);
|
6135
|
-
}
|
6136
|
-
};
|
6137
|
-
const handleInputChange = event => {
|
6138
|
-
event.persist();
|
6139
|
-
if (onChange) {
|
6140
|
-
var _item$path$split, _item$path;
|
6141
|
-
const item = findByValue(data, event.target.value);
|
6142
|
-
event.detail = sanitizeItem(item);
|
6143
|
-
const indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
|
6144
|
-
if (indexes.length > 1) {
|
6145
|
-
// we don't want to map the current item
|
6146
|
-
indexes.pop();
|
6147
|
-
// we need to rebuild the path as we map
|
6148
|
-
let lastPath;
|
6149
|
-
event.detail.parents = indexes.map(i => {
|
6150
|
-
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
6151
|
-
return sanitizeItem(data.find(i => i.path === lastPath));
|
6152
|
-
});
|
6153
|
-
}
|
6154
|
-
onChange(event);
|
6155
|
-
}
|
6156
|
-
};
|
6157
|
-
const list = {
|
6158
|
-
...otherProps,
|
6159
|
-
'aria-activedescendant': getActiveDescendant(data, currentIndex, id),
|
6160
|
-
data,
|
6161
6256
|
disabled,
|
6162
|
-
|
6163
|
-
invalid,
|
6164
|
-
|
6165
|
-
|
6166
|
-
|
6167
|
-
|
6168
|
-
|
6169
|
-
|
6170
|
-
|
6171
|
-
|
6172
|
-
|
6173
|
-
|
6174
|
-
|
6175
|
-
|
6176
|
-
|
6177
|
-
|
6178
|
-
|
6179
|
-
|
6180
|
-
|
6181
|
-
|
6182
|
-
};
|
6257
|
+
children,
|
6258
|
+
invalid = false,
|
6259
|
+
message,
|
6260
|
+
...otherProps
|
6261
|
+
} = props;
|
6262
|
+
const className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
6263
|
+
'text-grey-300': disabled
|
6264
|
+
}, props.className);
|
6265
|
+
const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {
|
6266
|
+
'text-grey-700': !invalid,
|
6267
|
+
'text-red-500': invalid,
|
6268
|
+
'opacity-50': disabled
|
6269
|
+
}, props.className);
|
6270
|
+
return /*#__PURE__*/React.createElement("label", Object.assign({}, otherProps, {
|
6271
|
+
className: className,
|
6272
|
+
"data-taco": "label",
|
6273
|
+
ref: ref
|
6274
|
+
}), children, message && /*#__PURE__*/React.createElement("span", {
|
6275
|
+
className: messageClassName,
|
6276
|
+
role: invalid ? 'alert' : undefined
|
6277
|
+
}, message));
|
6278
|
+
});
|
6183
6279
|
|
6184
|
-
const
|
6185
|
-
|
6186
|
-
|
6187
|
-
|
6188
|
-
|
6189
|
-
|
6190
|
-
|
6191
|
-
|
6192
|
-
|
6193
|
-
|
6194
|
-
|
6195
|
-
|
6196
|
-
|
6197
|
-
}
|
6280
|
+
const Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
6281
|
+
const {
|
6282
|
+
horizontal = false,
|
6283
|
+
...otherProps
|
6284
|
+
} = props;
|
6285
|
+
const className = cn('yt-form', {
|
6286
|
+
'yt-form--horizontal flex flex-wrap': horizontal
|
6287
|
+
}, props.className);
|
6288
|
+
return /*#__PURE__*/React.createElement("form", Object.assign({}, otherProps, {
|
6289
|
+
className: className,
|
6290
|
+
"data-taco": "form",
|
6291
|
+
ref: ref
|
6292
|
+
}));
|
6293
|
+
});
|
6294
|
+
|
6295
|
+
const HangerContext = /*#__PURE__*/React.createContext({
|
6296
|
+
onClose: undefined,
|
6297
|
+
props: {},
|
6298
|
+
ref: null
|
6299
|
+
});
|
6300
|
+
const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, externalRef) {
|
6301
|
+
var _props$children;
|
6302
|
+
const {
|
6303
|
+
ref: parentRef,
|
6304
|
+
props: parentProps
|
6305
|
+
} = React.useContext(HangerContext);
|
6306
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
6307
|
+
let children = props.children;
|
6308
|
+
if ( /*#__PURE__*/React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
6309
|
+
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`);
|
6310
|
+
children = /*#__PURE__*/React.createElement("span", null, props.children);
|
6311
|
+
}
|
6312
|
+
return /*#__PURE__*/React.createElement(PopoverPrimitive.Anchor, Object.assign({}, parentProps, props, {
|
6313
|
+
ref: refCallback,
|
6314
|
+
asChild: true
|
6315
|
+
}), children);
|
6316
|
+
});
|
6317
|
+
const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
6318
|
+
const className = cn('mb-1 text-base font-bold flex w-full', props.className);
|
6319
|
+
return /*#__PURE__*/React.createElement("span", Object.assign({}, props, {
|
6320
|
+
className: className,
|
6321
|
+
ref: ref
|
6322
|
+
}));
|
6323
|
+
});
|
6324
|
+
const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
6325
|
+
const {
|
6326
|
+
placement: side
|
6327
|
+
} = props;
|
6328
|
+
const context = React.useContext(HangerContext);
|
6198
6329
|
const {
|
6199
6330
|
texts
|
6200
6331
|
} = useLocalization();
|
6201
|
-
const
|
6202
|
-
const
|
6203
|
-
|
6204
|
-
|
6205
|
-
|
6206
|
-
|
6207
|
-
|
6208
|
-
|
6209
|
-
|
6210
|
-
|
6332
|
+
const className = cn('wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm', props.className);
|
6333
|
+
const handleInteractOutside = event => {
|
6334
|
+
event.preventDefault();
|
6335
|
+
};
|
6336
|
+
return /*#__PURE__*/React.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React.createElement(PopoverPrimitive.Content, {
|
6337
|
+
className: className,
|
6338
|
+
"data-taco": "hanger",
|
6339
|
+
onInteractOutside: handleInteractOutside,
|
6340
|
+
side: side,
|
6341
|
+
sideOffset: 1,
|
6342
|
+
ref: ref
|
6343
|
+
}, props.children, /*#__PURE__*/React.createElement(UnstyledArrow, {
|
6344
|
+
className: "text-blue-500"
|
6345
|
+
}), /*#__PURE__*/React.createElement(PopoverPrimitive.Close, {
|
6346
|
+
asChild: true
|
6347
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
6348
|
+
appearance: "primary",
|
6349
|
+
"aria-label": texts.hanger.close,
|
6350
|
+
className: "absolute top-0 right-0 ml-2 mr-2 mt-2 text-white",
|
6351
|
+
icon: "close",
|
6352
|
+
onClick: context.onClose
|
6353
|
+
}))));
|
6354
|
+
});
|
6355
|
+
const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
6211
6356
|
const {
|
6212
|
-
|
6213
|
-
|
6214
|
-
|
6215
|
-
|
6216
|
-
|
6217
|
-
|
6357
|
+
anchor,
|
6358
|
+
children,
|
6359
|
+
defaultOpen = true,
|
6360
|
+
onClose,
|
6361
|
+
...otherProps
|
6362
|
+
} = props;
|
6363
|
+
const context = React.useMemo(() => ({
|
6364
|
+
onClose,
|
6365
|
+
props: otherProps,
|
6366
|
+
ref
|
6367
|
+
}), [onClose, otherProps]);
|
6368
|
+
// we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
6369
|
+
const [open, setOpen] = React.useState(false);
|
6218
6370
|
React.useEffect(() => {
|
6219
|
-
if (
|
6220
|
-
|
6371
|
+
if (defaultOpen) {
|
6372
|
+
setOpen(defaultOpen);
|
6221
6373
|
}
|
6222
6374
|
}, []);
|
6223
|
-
React.
|
6224
|
-
|
6225
|
-
|
6226
|
-
|
6227
|
-
|
6228
|
-
|
6229
|
-
|
6230
|
-
|
6231
|
-
|
6375
|
+
return /*#__PURE__*/React.createElement(HangerContext.Provider, {
|
6376
|
+
value: context
|
6377
|
+
}, /*#__PURE__*/React.createElement(PopoverPrimitive.Root, {
|
6378
|
+
key: String(open),
|
6379
|
+
defaultOpen: open
|
6380
|
+
}, anchor && /*#__PURE__*/React.createElement(Anchor, null, anchor), children));
|
6381
|
+
});
|
6382
|
+
Hanger.Anchor = Anchor;
|
6383
|
+
Hanger.Content = Content$6;
|
6384
|
+
Hanger.Title = Title$3;
|
6385
|
+
|
6386
|
+
const UnstyledArrow$1 = /*#__PURE__*/React.forwardRef(function HoverCardArrow(props, ref) {
|
6387
|
+
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Arrow, {
|
6388
|
+
className: "pointer-events-none -mt-px",
|
6389
|
+
asChild: true,
|
6390
|
+
offset: 2,
|
6391
|
+
width: 30,
|
6392
|
+
height: 11
|
6393
|
+
}, /*#__PURE__*/React.createElement("svg", Object.assign({}, props, {
|
6394
|
+
ref: ref,
|
6395
|
+
viewBox: "0 19 30 11",
|
6396
|
+
style: {
|
6397
|
+
transform: 'rotateZ(180deg)'
|
6398
|
+
}
|
6399
|
+
}), /*#__PURE__*/React.createElement("path", {
|
6400
|
+
className: "text-grey-300 fill-current group-focus:text-blue-300",
|
6401
|
+
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
6402
|
+
}), /*#__PURE__*/React.createElement("path", {
|
6403
|
+
className: "fill-current",
|
6404
|
+
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
|
6405
|
+
})));
|
6406
|
+
});
|
6407
|
+
|
6408
|
+
const Trigger$5 = /*#__PURE__*/React.forwardRef(function HoverCardTrigger(props, ref) {
|
6409
|
+
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Trigger, Object.assign({}, props, {
|
6410
|
+
asChild: true,
|
6411
|
+
ref: ref
|
6412
|
+
}));
|
6413
|
+
});
|
6414
|
+
const Content$7 = /*#__PURE__*/React.forwardRef(function HoverCardContent(props, ref) {
|
6415
|
+
const {
|
6416
|
+
placement: side
|
6417
|
+
} = props;
|
6418
|
+
const className = cn(getPopoverStyleClassnames(), 'min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]', props.className);
|
6419
|
+
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Portal, null, /*#__PURE__*/React.createElement(HoverCardPrimitive.Content, {
|
6420
|
+
className: className,
|
6421
|
+
"data-taco": "hover-card",
|
6422
|
+
side: side,
|
6423
|
+
sideOffset: 1,
|
6424
|
+
ref: ref
|
6425
|
+
}, props.children, /*#__PURE__*/React.createElement(UnstyledArrow$1, {
|
6426
|
+
className: "text-white"
|
6427
|
+
})));
|
6428
|
+
});
|
6429
|
+
const HoverCard = props => {
|
6430
|
+
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Root, Object.assign({}, props, {
|
6431
|
+
openDelay: 300
|
6432
|
+
}));
|
6433
|
+
};
|
6434
|
+
HoverCard.Trigger = Trigger$5;
|
6435
|
+
HoverCard.Content = Content$7;
|
6436
|
+
|
6437
|
+
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
6438
|
+
onSearch,
|
6439
|
+
...props
|
6440
|
+
}, ref) {
|
6441
|
+
const internalRef = useMergedRef(ref);
|
6442
|
+
const {
|
6443
|
+
texts
|
6444
|
+
} = useLocalization();
|
6445
|
+
const handleClick = () => {
|
6446
|
+
var _internalRef$current$, _internalRef$current;
|
6447
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch((_internalRef$current$ = (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.value) !== null && _internalRef$current$ !== void 0 ? _internalRef$current$ : '');
|
6448
|
+
};
|
6449
|
+
const handleCancelClick = () => {
|
6450
|
+
setInputValueByRef(internalRef.current, '');
|
6451
|
+
};
|
6452
|
+
const handleKeyDown = event => {
|
6453
|
+
var _props$onKeyDown;
|
6454
|
+
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
6455
|
+
if (event.isDefaultPrevented()) {
|
6456
|
+
return;
|
6457
|
+
}
|
6458
|
+
if (event.key === 'Enter') {
|
6459
|
+
event.preventDefault();
|
6460
|
+
handleClick();
|
6461
|
+
return;
|
6462
|
+
}
|
6463
|
+
};
|
6464
|
+
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
6465
|
+
"aria-label": texts.searchInput.placeholder,
|
6466
|
+
placeholder: texts.searchInput.placeholder
|
6467
|
+
}, props, {
|
6468
|
+
onKeyDown: handleKeyDown,
|
6469
|
+
postfix: /*#__PURE__*/React.createElement(React.Fragment, null, props.disabled || props.readOnly || !props.value ? null : /*#__PURE__*/React.createElement(IconButton, {
|
6470
|
+
"aria-hidden": true,
|
6471
|
+
className: "group-peer-focus:visible group-peer-hover:visible !text-grey-700 invisible mr-0.5 !h-5 !min-h-[theme(spacing.4)] !w-5 !min-w-[theme(spacing.4)] text-xs hover:visible group-hover:visible",
|
6472
|
+
icon: "close",
|
6473
|
+
onClick: handleCancelClick,
|
6474
|
+
rounded: true,
|
6475
|
+
tabIndex: -1,
|
6476
|
+
tooltip: texts.searchInput.clear
|
6477
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
6478
|
+
"aria-label": texts.searchInput.button,
|
6479
|
+
icon: "search",
|
6480
|
+
className: "group-peer-focus:!border-transparent group-peer-focus:group-peer-active:!border-transparent -mr-2 !border-transparent !bg-transparent focus:!border-transparent",
|
6481
|
+
disabled: props.disabled || props.readOnly,
|
6482
|
+
onClick: handleClick,
|
6483
|
+
tabIndex: -1,
|
6484
|
+
tooltip: texts.searchInput.button
|
6485
|
+
})),
|
6486
|
+
ref: internalRef,
|
6487
|
+
type: "search"
|
6488
|
+
}));
|
6489
|
+
});
|
6490
|
+
|
6491
|
+
function useTimer(duration = 0, callback) {
|
6492
|
+
const timer = React.useRef();
|
6493
|
+
const [tracker, setTracker] = React.useState({
|
6494
|
+
remaining: duration,
|
6495
|
+
started: null
|
6496
|
+
});
|
6497
|
+
React.useEffect(() => {
|
6498
|
+
if (duration) {
|
6499
|
+
if (tracker.started) {
|
6500
|
+
timer.current = window.setTimeout(callback, tracker.remaining);
|
6501
|
+
} else {
|
6502
|
+
clearTimeout(timer.current);
|
6503
|
+
}
|
6504
|
+
}
|
6505
|
+
return () => {
|
6506
|
+
clearTimeout(timer.current);
|
6507
|
+
};
|
6508
|
+
}, [tracker.started]);
|
6509
|
+
return {
|
6510
|
+
running: !!tracker.started,
|
6511
|
+
start: () => {
|
6512
|
+
setTracker({
|
6513
|
+
remaining: duration,
|
6514
|
+
started: Date.now()
|
6515
|
+
});
|
6516
|
+
},
|
6517
|
+
pause: () => {
|
6518
|
+
if (tracker.started) {
|
6519
|
+
setTracker({
|
6520
|
+
remaining: tracker.remaining - (Date.now() - tracker.started),
|
6521
|
+
started: null
|
6522
|
+
});
|
6523
|
+
}
|
6524
|
+
},
|
6525
|
+
resume: () => {
|
6526
|
+
if (tracker.remaining && !tracker.started) {
|
6527
|
+
setTracker({
|
6528
|
+
remaining: tracker.remaining,
|
6529
|
+
started: Date.now()
|
6530
|
+
});
|
6531
|
+
}
|
6532
|
+
}
|
6533
|
+
};
|
6534
|
+
}
|
6535
|
+
|
6536
|
+
const useTypeahead = ({
|
6537
|
+
data,
|
6538
|
+
currentIndex
|
6539
|
+
}) => {
|
6540
|
+
const typeaheadQuery = React.useRef();
|
6541
|
+
const typeaheadQueryTimer = useTimer(1000, () => {
|
6542
|
+
typeaheadQuery.current = undefined;
|
6543
|
+
});
|
6544
|
+
const getNextIndex = charKey => {
|
6545
|
+
const query = (typeaheadQuery.current ? typeaheadQuery.current + charKey : charKey).toLowerCase();
|
6546
|
+
const nextIndex = findNextIndexByValue(data, query, currentIndex);
|
6547
|
+
typeaheadQueryTimer.start();
|
6548
|
+
typeaheadQuery.current = query;
|
6549
|
+
return nextIndex;
|
6550
|
+
};
|
6551
|
+
return {
|
6552
|
+
getNextIndex
|
6553
|
+
};
|
6554
|
+
};
|
6555
|
+
|
6556
|
+
const useListbox = ({
|
6557
|
+
data: externalData = [],
|
6558
|
+
defaultValue,
|
6559
|
+
disabled,
|
6560
|
+
emptyValue,
|
6561
|
+
id: nativeId,
|
6562
|
+
invalid,
|
6563
|
+
name,
|
6564
|
+
onChange,
|
6565
|
+
onFocus,
|
6566
|
+
onKeyDown,
|
6567
|
+
value = emptyValue,
|
6568
|
+
...otherProps
|
6569
|
+
}, ref) => {
|
6570
|
+
const data = useFlattenedData(emptyValue !== undefined ? [{
|
6571
|
+
text: '',
|
6572
|
+
value: emptyValue
|
6573
|
+
}, ...externalData] : externalData);
|
6574
|
+
const id = React.useMemo(() => nativeId || uuid.v4(), [nativeId]);
|
6575
|
+
const inputRef = useMergedRef(ref);
|
6576
|
+
const currentIndex = value !== undefined ? getIndexFromValue(data, value) : undefined;
|
6577
|
+
const {
|
6578
|
+
getNextIndex
|
6579
|
+
} = useTypeahead({
|
6580
|
+
data,
|
6581
|
+
currentIndex
|
6582
|
+
});
|
6583
|
+
const setInputValueByIndex = index => {
|
6232
6584
|
if (index !== undefined) {
|
6233
6585
|
const option = data[index];
|
6234
6586
|
if (option && !option.disabled) {
|
6235
|
-
|
6236
|
-
let newInputValue = '';
|
6237
|
-
const currentInputValue = (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value;
|
6238
|
-
const currentValuesArray = (currentInputValue === null || currentInputValue === void 0 ? void 0 : currentInputValue.split(',')) || [];
|
6239
|
-
const optionAlreadySelected = currentValuesArray.findIndex(val => val === String(option.value)) !== -1;
|
6240
|
-
// Handling the select_all option
|
6241
|
-
if (option.value === '#ALL-OPTIONS#') {
|
6242
|
-
if (!allOptionsSelected) {
|
6243
|
-
newInputValue = data.filter((option, index) => index !== 0 && !option.disabled).map(option => option.value).join(',');
|
6244
|
-
} else {
|
6245
|
-
newInputValue = '';
|
6246
|
-
}
|
6247
|
-
} else {
|
6248
|
-
// Handling rest options
|
6249
|
-
if (optionAlreadySelected) {
|
6250
|
-
newInputValue = currentValuesArray.filter(val => val !== String(option.value)).join(',');
|
6251
|
-
} else {
|
6252
|
-
newInputValue = currentInputValue ? `${currentInputValue},${option.value}` : option.value;
|
6253
|
-
}
|
6254
|
-
}
|
6255
|
-
setInputValueByRef$1(inputRef.current, newInputValue);
|
6587
|
+
setInputValueByRef$1(inputRef.current, option.value);
|
6256
6588
|
}
|
6257
6589
|
}
|
6258
6590
|
};
|
6259
|
-
const
|
6260
|
-
|
6261
|
-
if (!data[index].disabled) {
|
6262
|
-
setCurrentIndex(index);
|
6263
|
-
setInputValueByIndex(index);
|
6264
|
-
}
|
6265
|
-
if (onClick) {
|
6266
|
-
onClick(event);
|
6267
|
-
}
|
6591
|
+
const handleListboxChange = index => {
|
6592
|
+
setInputValueByIndex(index);
|
6268
6593
|
};
|
6269
|
-
|
6594
|
+
React.useEffect(() => {
|
6595
|
+
if (data.length && currentIndex === undefined) {
|
6596
|
+
if (defaultValue !== undefined) {
|
6597
|
+
const defaultValueIndex = getIndexFromValue(data, defaultValue);
|
6598
|
+
if (defaultValueIndex !== undefined) {
|
6599
|
+
setInputValueByIndex(defaultValueIndex);
|
6600
|
+
}
|
6601
|
+
} else {
|
6602
|
+
setInputValueByIndex(0);
|
6603
|
+
}
|
6604
|
+
}
|
6605
|
+
}, [data]);
|
6606
|
+
const handleListboxKeyDown = event => {
|
6270
6607
|
const charKey = event.key;
|
6271
6608
|
// event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)
|
6272
6609
|
// We need to filter out only alphabetical or numeric letters, that's why that condition has been changed
|
6273
6610
|
if (charKey.length === 1 && /(\w)/g.test(charKey)) {
|
6274
6611
|
const nextIndex = getNextIndex(charKey);
|
6275
6612
|
if (nextIndex > -1 && nextIndex !== currentIndex) {
|
6276
|
-
|
6613
|
+
setInputValueByIndex(nextIndex);
|
6277
6614
|
}
|
6278
6615
|
return;
|
6279
6616
|
}
|
6280
|
-
|
6281
|
-
|
6282
|
-
|
6283
|
-
|
6617
|
+
if (onKeyDown) {
|
6618
|
+
event.persist();
|
6619
|
+
onKeyDown(event);
|
6620
|
+
}
|
6621
|
+
};
|
6622
|
+
const handleListboxFocus = event => {
|
6623
|
+
if (currentIndex === undefined && data.length) {
|
6624
|
+
setInputValueByIndex(0);
|
6625
|
+
}
|
6626
|
+
if (onFocus) {
|
6627
|
+
event.persist();
|
6628
|
+
onFocus(event);
|
6629
|
+
}
|
6630
|
+
};
|
6631
|
+
const handleInputChange = event => {
|
6632
|
+
event.persist();
|
6633
|
+
if (onChange) {
|
6634
|
+
var _item$path$split, _item$path;
|
6635
|
+
const item = findByValue(data, event.target.value);
|
6636
|
+
event.detail = sanitizeItem(item);
|
6637
|
+
const indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
|
6638
|
+
if (indexes.length > 1) {
|
6639
|
+
// we don't want to map the current item
|
6640
|
+
indexes.pop();
|
6641
|
+
// we need to rebuild the path as we map
|
6642
|
+
let lastPath;
|
6643
|
+
event.detail.parents = indexes.map(i => {
|
6644
|
+
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
6645
|
+
return sanitizeItem(data.find(i => i.path === lastPath));
|
6646
|
+
});
|
6647
|
+
}
|
6648
|
+
onChange(event);
|
6649
|
+
}
|
6650
|
+
};
|
6651
|
+
const list = {
|
6652
|
+
...otherProps,
|
6653
|
+
'aria-activedescendant': getActiveDescendant(data, currentIndex, id),
|
6654
|
+
data,
|
6655
|
+
disabled,
|
6656
|
+
id,
|
6657
|
+
invalid,
|
6658
|
+
onChange: handleListboxChange,
|
6659
|
+
onFocus: handleListboxFocus,
|
6660
|
+
onKeyDown: handleListboxKeyDown,
|
6661
|
+
scrollOnFocus: true,
|
6662
|
+
tabIndex: disabled ? -1 : otherProps.tabIndex ? otherProps.tabIndex : 0,
|
6663
|
+
value: currentIndex
|
6664
|
+
};
|
6665
|
+
const input = {
|
6666
|
+
name,
|
6667
|
+
onChange: handleInputChange,
|
6668
|
+
ref: inputRef,
|
6669
|
+
tabIndex: -1,
|
6670
|
+
value: value !== null && value !== void 0 ? value : ''
|
6671
|
+
};
|
6672
|
+
return {
|
6673
|
+
list,
|
6674
|
+
input
|
6675
|
+
};
|
6676
|
+
};
|
6677
|
+
|
6678
|
+
const useMultiListbox = ({
|
6679
|
+
data: externalData = [],
|
6680
|
+
defaultValue,
|
6681
|
+
disabled,
|
6682
|
+
emptyValue: _,
|
6683
|
+
id: nativeId,
|
6684
|
+
name,
|
6685
|
+
onClick,
|
6686
|
+
onChange,
|
6687
|
+
onFocus,
|
6688
|
+
onKeyDown,
|
6689
|
+
value,
|
6690
|
+
...otherProps
|
6691
|
+
}, ref) => {
|
6692
|
+
const {
|
6693
|
+
texts
|
6694
|
+
} = useLocalization();
|
6695
|
+
const id = React.useMemo(() => nativeId || uuid.v4(), [nativeId]);
|
6696
|
+
const inputRef = useMergedRef(ref);
|
6697
|
+
const data = React.useMemo(() => {
|
6698
|
+
return [{
|
6699
|
+
text: texts.listbox.allOption,
|
6700
|
+
value: '#ALL-OPTIONS#'
|
6701
|
+
}, ...externalData];
|
6702
|
+
}, [externalData]);
|
6703
|
+
const [currentIndex, setCurrentIndex] = React.useState(getIndexFromValue(data, value) || 0);
|
6704
|
+
const [allOptionsSelected, setAllOptionsSelected] = React.useState(false);
|
6705
|
+
const {
|
6706
|
+
getNextIndex
|
6707
|
+
} = useTypeahead({
|
6708
|
+
data,
|
6709
|
+
currentIndex
|
6710
|
+
});
|
6711
|
+
const [selectedIndexes, setSelectedIndexes] = React.useState(getSelectedIndexesFromValue(data, value));
|
6712
|
+
React.useEffect(() => {
|
6713
|
+
if (defaultValue && !value) {
|
6714
|
+
setInputValueByRef$1(inputRef.current, defaultValue.toString());
|
6715
|
+
}
|
6716
|
+
}, []);
|
6717
|
+
React.useEffect(() => {
|
6718
|
+
const selectableItemsCount = data.filter(item => !item.disabled).length - 1;
|
6719
|
+
if (selectableItemsCount === selectedIndexes.length) {
|
6720
|
+
setAllOptionsSelected(true);
|
6721
|
+
} else {
|
6722
|
+
setAllOptionsSelected(false);
|
6723
|
+
}
|
6724
|
+
}, [selectedIndexes, data]);
|
6725
|
+
const setInputValueByIndex = index => {
|
6726
|
+
if (index !== undefined) {
|
6727
|
+
const option = data[index];
|
6728
|
+
if (option && !option.disabled) {
|
6729
|
+
var _inputRef$current;
|
6730
|
+
let newInputValue = '';
|
6731
|
+
const currentInputValue = (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value;
|
6732
|
+
const currentValuesArray = (currentInputValue === null || currentInputValue === void 0 ? void 0 : currentInputValue.split(',')) || [];
|
6733
|
+
const optionAlreadySelected = currentValuesArray.findIndex(val => val === String(option.value)) !== -1;
|
6734
|
+
// Handling the select_all option
|
6735
|
+
if (option.value === '#ALL-OPTIONS#') {
|
6736
|
+
if (!allOptionsSelected) {
|
6737
|
+
newInputValue = data.filter((option, index) => index !== 0 && !option.disabled).map(option => option.value).join(',');
|
6738
|
+
} else {
|
6739
|
+
newInputValue = '';
|
6740
|
+
}
|
6741
|
+
} else {
|
6742
|
+
// Handling rest options
|
6743
|
+
if (optionAlreadySelected) {
|
6744
|
+
newInputValue = currentValuesArray.filter(val => val !== String(option.value)).join(',');
|
6745
|
+
} else {
|
6746
|
+
newInputValue = currentInputValue ? `${currentInputValue},${option.value}` : option.value;
|
6747
|
+
}
|
6748
|
+
}
|
6749
|
+
setInputValueByRef$1(inputRef.current, newInputValue);
|
6750
|
+
}
|
6751
|
+
}
|
6752
|
+
};
|
6753
|
+
const handleListboxClick = (event, index) => {
|
6754
|
+
event.preventDefault();
|
6755
|
+
if (!data[index].disabled) {
|
6756
|
+
setCurrentIndex(index);
|
6757
|
+
setInputValueByIndex(index);
|
6758
|
+
}
|
6759
|
+
if (onClick) {
|
6760
|
+
onClick(event);
|
6761
|
+
}
|
6762
|
+
};
|
6763
|
+
const handleListboxKeyDown = (event, index) => {
|
6764
|
+
const charKey = event.key;
|
6765
|
+
// event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)
|
6766
|
+
// We need to filter out only alphabetical or numeric letters, that's why that condition has been changed
|
6767
|
+
if (charKey.length === 1 && /(\w)/g.test(charKey)) {
|
6768
|
+
const nextIndex = getNextIndex(charKey);
|
6769
|
+
if (nextIndex > -1 && nextIndex !== currentIndex) {
|
6770
|
+
setCurrentIndex(nextIndex);
|
6771
|
+
}
|
6772
|
+
return;
|
6773
|
+
}
|
6774
|
+
switch (event.key) {
|
6775
|
+
case ' ':
|
6776
|
+
{
|
6777
|
+
event.preventDefault();
|
6284
6778
|
setInputValueByIndex(index);
|
6285
6779
|
break;
|
6286
6780
|
}
|
@@ -6396,12 +6890,7 @@ const MultiListbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref)
|
|
6396
6890
|
})));
|
6397
6891
|
});
|
6398
6892
|
|
6399
|
-
const
|
6400
|
-
const useCurrentMenu = () => {
|
6401
|
-
return React.useContext(MenuContext);
|
6402
|
-
};
|
6403
|
-
|
6404
|
-
const Content$7 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref) {
|
6893
|
+
const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref) {
|
6405
6894
|
const internalRef = useMergedRef(ref);
|
6406
6895
|
const menu = useCurrentMenu();
|
6407
6896
|
const {
|
@@ -6534,7 +7023,7 @@ const Link = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
|
|
6534
7023
|
}), props.children));
|
6535
7024
|
});
|
6536
7025
|
|
6537
|
-
const Trigger$
|
7026
|
+
const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
|
6538
7027
|
const menu = useCurrentMenu();
|
6539
7028
|
const internalRef = useMergedRef(ref);
|
6540
7029
|
React.useEffect(() => {
|
@@ -6763,12 +7252,12 @@ const Menu$1 = /*#__PURE__*/React.forwardRef(function Menu(externalProps, ref) {
|
|
6763
7252
|
modal: false,
|
6764
7253
|
open: open,
|
6765
7254
|
onOpenChange: setOpen
|
6766
|
-
}), trigger && /*#__PURE__*/React.createElement(Trigger$
|
7255
|
+
}), trigger && /*#__PURE__*/React.createElement(Trigger$6, {
|
6767
7256
|
ref: ref
|
6768
7257
|
}, trigger), children));
|
6769
7258
|
});
|
6770
|
-
Menu$1.Trigger = Trigger$
|
6771
|
-
Menu$1.Content = Content$
|
7259
|
+
Menu$1.Trigger = Trigger$6;
|
7260
|
+
Menu$1.Content = Content$8;
|
6772
7261
|
Menu$1.Item = Item$1;
|
6773
7262
|
Menu$1.Link = Link;
|
6774
7263
|
Menu$1.Checkbox = Checkbox$1;
|
@@ -7766,7 +8255,10 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
|
|
7766
8255
|
if (internalRef.current) {
|
7767
8256
|
const options = getOptionsFromCollection(internalRef.current, querySelector);
|
7768
8257
|
if (options.length && options.length !== lastLengthRef.current) {
|
7769
|
-
|
8258
|
+
let selected = internalRef.current.querySelectorAll(`[aria-current="true"]`);
|
8259
|
+
if (selected.length === 0) {
|
8260
|
+
selected = internalRef.current.querySelectorAll(`[aria-selected]`);
|
8261
|
+
}
|
7770
8262
|
if (selected.length === 1) {
|
7771
8263
|
if (options) {
|
7772
8264
|
const firstSelected = selected.item(0);
|
@@ -7870,6 +8362,13 @@ const isSkippableItem = element => {
|
|
7870
8362
|
return element.getAttribute('role') === 'presentation' || !!element.hasAttribute('disabled') || !!element.getAttribute('aria-disabled') || !!element.getAttribute('aria-hidden');
|
7871
8363
|
};
|
7872
8364
|
|
8365
|
+
|
8366
|
+
|
8367
|
+
var Collection = {
|
8368
|
+
__proto__: null,
|
8369
|
+
Root: Root
|
8370
|
+
};
|
8371
|
+
|
7873
8372
|
const Listbox2Context = /*#__PURE__*/React__default.createContext({});
|
7874
8373
|
const useListbox2Context = () => React__default.useContext(Listbox2Context);
|
7875
8374
|
|
@@ -7992,7 +8491,7 @@ const Group$1 = /*#__PURE__*/React__default.forwardRef(function Listbox2Group(pr
|
|
7992
8491
|
const Listbox2GroupContext = /*#__PURE__*/React__default.createContext({});
|
7993
8492
|
const useListbox2GroupContext = () => React__default.useContext(Listbox2GroupContext);
|
7994
8493
|
|
7995
|
-
const Title$
|
8494
|
+
const Title$4 = /*#__PURE__*/React__default.forwardRef(function Listbox2Group(props, ref) {
|
7996
8495
|
const {
|
7997
8496
|
id: nativeId,
|
7998
8497
|
...otherProps
|
@@ -8352,14 +8851,14 @@ const Group$2 = /*#__PURE__*/React__default.forwardRef(function Select2Group(pro
|
|
8352
8851
|
return /*#__PURE__*/React__default.createElement(Group$1, Object.assign({}, attributes, {
|
8353
8852
|
className: className,
|
8354
8853
|
ref: ref
|
8355
|
-
}), /*#__PURE__*/React__default.createElement(Title$
|
8854
|
+
}), /*#__PURE__*/React__default.createElement(Title$4, {
|
8356
8855
|
className: "sticky top-0 bg-white px-2 font-bold leading-8"
|
8357
8856
|
}, heading), children);
|
8358
8857
|
});
|
8359
8858
|
|
8360
|
-
const Title$
|
8859
|
+
const Title$5 = /*#__PURE__*/React__default.forwardRef(function Select2Title(props, ref) {
|
8361
8860
|
const className = cn('flex items-center text-xs pl-2 h-8', props.className);
|
8362
|
-
return /*#__PURE__*/React__default.createElement(Title$
|
8861
|
+
return /*#__PURE__*/React__default.createElement(Title$4, Object.assign({}, props, {
|
8363
8862
|
className: className,
|
8364
8863
|
ref: ref
|
8365
8864
|
}));
|
@@ -8382,38 +8881,7 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
|
|
8382
8881
|
return boundaryChildIndex;
|
8383
8882
|
};
|
8384
8883
|
|
8385
|
-
const
|
8386
|
-
const className = cn(`flex select-none touch-none transition-colors hover:bg-grey`, {
|
8387
|
-
'w-[7px] hover:w-[14px] mr-[2px] hover:px-[2px] hover:mr-0': props.orientation === 'vertical',
|
8388
|
-
'flex-col h-[7px] hover:h-[14px] mb-[2px] hover:py-[2px] hover:mb-0': props.orientation === 'horizontal'
|
8389
|
-
});
|
8390
|
-
return /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Scrollbar, Object.assign({}, props, {
|
8391
|
-
className: className
|
8392
|
-
}));
|
8393
|
-
};
|
8394
|
-
const Thumb = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Thumb, Object.assign({}, props, {
|
8395
|
-
className: "flex-[1] rounded bg-black opacity-50"
|
8396
|
-
}));
|
8397
|
-
const Corner = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Corner, Object.assign({}, props, {
|
8398
|
-
classname: "bg-grey-500"
|
8399
|
-
}));
|
8400
|
-
const ScrollArea = props => {
|
8401
|
-
const {
|
8402
|
-
children,
|
8403
|
-
...otherProps
|
8404
|
-
} = props;
|
8405
|
-
return /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Root, Object.assign({}, otherProps, {
|
8406
|
-
className: cn('overflow-hidden', props.className)
|
8407
|
-
}), /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Viewport, {
|
8408
|
-
className: "h-full w-full"
|
8409
|
-
}, children), /*#__PURE__*/React__default.createElement(Bar, {
|
8410
|
-
orientation: "vertical"
|
8411
|
-
}, /*#__PURE__*/React__default.createElement(Thumb, null)), /*#__PURE__*/React__default.createElement(Bar, {
|
8412
|
-
orientation: "horizontal"
|
8413
|
-
}, /*#__PURE__*/React__default.createElement(Thumb, null)), /*#__PURE__*/React__default.createElement(Corner, null));
|
8414
|
-
};
|
8415
|
-
|
8416
|
-
const Trigger$6 = /*#__PURE__*/React__default.forwardRef(function Select2Trigger(props, ref) {
|
8884
|
+
const Trigger$7 = /*#__PURE__*/React__default.forwardRef(function Select2Trigger(props, ref) {
|
8417
8885
|
const {
|
8418
8886
|
multiple,
|
8419
8887
|
value
|
@@ -8900,7 +9368,7 @@ const Create = props => {
|
|
8900
9368
|
}, searchQuery)));
|
8901
9369
|
};
|
8902
9370
|
|
8903
|
-
const Collection = props => {
|
9371
|
+
const Collection$1 = props => {
|
8904
9372
|
const {
|
8905
9373
|
children
|
8906
9374
|
} = props;
|
@@ -9052,7 +9520,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
9052
9520
|
}), /*#__PURE__*/React__default.createElement(PopoverPrimitive.Trigger, {
|
9053
9521
|
asChild: true,
|
9054
9522
|
"data-taco": "Select2"
|
9055
|
-
}, /*#__PURE__*/React__default.createElement(Trigger$
|
9523
|
+
}, /*#__PURE__*/React__default.createElement(Trigger$7, Object.assign({}, otherProps, {
|
9056
9524
|
"aria-haspopup": "listbox",
|
9057
9525
|
onBlur: handleBlur,
|
9058
9526
|
onKeyDown: handleKeyDown,
|
@@ -9096,14 +9564,14 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
9096
9564
|
setValue: setValue,
|
9097
9565
|
tabIndex: -1,
|
9098
9566
|
value: value
|
9099
|
-
}, /*#__PURE__*/React__default.createElement(Collection, null, filteredChildren), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
9567
|
+
}, /*#__PURE__*/React__default.createElement(Collection$1, null, filteredChildren), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
9100
9568
|
onCreate: onCreate,
|
9101
9569
|
options: flattenedChildren
|
9102
9570
|
}) : null))))));
|
9103
9571
|
});
|
9104
9572
|
Select2.Option = Option$1;
|
9105
9573
|
Select2.Group = Group$2;
|
9106
|
-
Select2.Title = Title$
|
9574
|
+
Select2.Title = Title$5;
|
9107
9575
|
const ControlledHiddenField = props => {
|
9108
9576
|
const {
|
9109
9577
|
emptyValue,
|
@@ -12153,7 +12621,7 @@ const HeaderMenu = ({
|
|
12153
12621
|
})) : null;
|
12154
12622
|
};
|
12155
12623
|
|
12156
|
-
const Footer$
|
12624
|
+
const Footer$3 = function Footer(props) {
|
12157
12625
|
const {
|
12158
12626
|
children,
|
12159
12627
|
footer,
|
@@ -13049,12 +13517,13 @@ const ExpandedRow = ({
|
|
13049
13517
|
|
13050
13518
|
const useBoundaryOverflowDetection = (ref, dependencies = []) => {
|
13051
13519
|
const [boundaryIndex, setBoundaryIndex] = React__default.useState();
|
13520
|
+
const dimensions = useBoundingClientRectListener(ref, dependencies);
|
13052
13521
|
React__default.useEffect(() => {
|
13053
13522
|
if (ref.current) {
|
13054
13523
|
const boundaryChildIndex = getIndexOfFirstChildOverflowingParent(ref.current);
|
13055
13524
|
setBoundaryIndex(boundaryChildIndex);
|
13056
13525
|
}
|
13057
|
-
}, [ref, ...dependencies]);
|
13526
|
+
}, [ref, dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, ...dependencies]);
|
13058
13527
|
return boundaryIndex;
|
13059
13528
|
};
|
13060
13529
|
|
@@ -13452,15 +13921,6 @@ const guessComparatorsBasedOnControl = (instance, control) => {
|
|
13452
13921
|
}
|
13453
13922
|
};
|
13454
13923
|
|
13455
|
-
const useGlobalKeyboardShortcut = handler => {
|
13456
|
-
React__default.useEffect(() => {
|
13457
|
-
document.addEventListener('keydown', handler);
|
13458
|
-
return () => {
|
13459
|
-
document.removeEventListener('keydown', handler);
|
13460
|
-
};
|
13461
|
-
}, [handler]);
|
13462
|
-
};
|
13463
|
-
|
13464
13924
|
const FiltersButton = ({
|
13465
13925
|
length,
|
13466
13926
|
table
|
@@ -13999,7 +14459,7 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
|
|
13999
14459
|
key: footerGroup.id,
|
14000
14460
|
role: "row",
|
14001
14461
|
className: "contents"
|
14002
|
-
}, footerGroup.headers.map((footer, cellIndex) => /*#__PURE__*/React__default.createElement(Footer$
|
14462
|
+
}, footerGroup.headers.map((footer, cellIndex) => /*#__PURE__*/React__default.createElement(Footer$3, {
|
14003
14463
|
key: footer.id,
|
14004
14464
|
footer: footer,
|
14005
14465
|
index: cellIndex,
|
@@ -14012,228 +14472,1003 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
|
|
14012
14472
|
table: table
|
14013
14473
|
}) : null);
|
14014
14474
|
});
|
14015
|
-
Table2.Column = Column$2;
|
14475
|
+
Table2.Column = Column$2;
|
14476
|
+
|
14477
|
+
const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|
14478
|
+
const {
|
14479
|
+
id,
|
14480
|
+
defaultId,
|
14481
|
+
children,
|
14482
|
+
onChange,
|
14483
|
+
orientation = 'horizontal',
|
14484
|
+
...otherProps
|
14485
|
+
} = props;
|
14486
|
+
const className = cn('yt-tabs', `yt-tabs--${orientation}`, {
|
14487
|
+
'flex w-full': orientation === 'vertical'
|
14488
|
+
}, props.className);
|
14489
|
+
return /*#__PURE__*/React.createElement(TabsPrimitive.Root, Object.assign({}, otherProps, {
|
14490
|
+
className: className,
|
14491
|
+
"data-taco": "tabs",
|
14492
|
+
defaultValue: defaultId,
|
14493
|
+
dir: "ltr",
|
14494
|
+
onValueChange: onChange,
|
14495
|
+
orientation: orientation,
|
14496
|
+
ref: ref,
|
14497
|
+
value: id
|
14498
|
+
}), children);
|
14499
|
+
});
|
14500
|
+
const TabList = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
|
14501
|
+
const className = cn('yt-tab__list border-b border-grey-300 flex flex-row m-0 mb-4', props.className);
|
14502
|
+
return /*#__PURE__*/React.createElement(TabsPrimitive.List, Object.assign({}, props, {
|
14503
|
+
className: className,
|
14504
|
+
ref: ref
|
14505
|
+
}));
|
14506
|
+
});
|
14507
|
+
const TabTrigger = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
|
14508
|
+
const {
|
14509
|
+
id,
|
14510
|
+
disabled,
|
14511
|
+
...otherProps
|
14512
|
+
} = props;
|
14513
|
+
const className = cn('yt-tab bg-transparent border-b-2 border-transparent text-grey-700 m-0 py-2 px-4', disabled ? 'cursor-not-allowed !text-grey-500' : 'cursor-pointer rounded-t hover:border-grey-300 aria-selected:border-blue-500 aria-selected:text-black aria-selected:hover:border-blue-300 hover:text-black active:yt-focus active:border-blue-500 focus:yt-focus focus:border-blue-500', props.className);
|
14514
|
+
return /*#__PURE__*/React.createElement(TabsPrimitive.Trigger, Object.assign({}, otherProps, {
|
14515
|
+
className: className,
|
14516
|
+
disabled: disabled,
|
14517
|
+
ref: ref,
|
14518
|
+
style: {
|
14519
|
+
transition: 'border 0.2s ease-in'
|
14520
|
+
},
|
14521
|
+
value: id
|
14522
|
+
}));
|
14523
|
+
});
|
14524
|
+
const TabContent = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
|
14525
|
+
const {
|
14526
|
+
id,
|
14527
|
+
...otherProps
|
14528
|
+
} = props;
|
14529
|
+
const className = cn('yt-tab__panel outline-none', props.className);
|
14530
|
+
return /*#__PURE__*/React.createElement(TabsPrimitive.Content, Object.assign({}, otherProps, {
|
14531
|
+
className: className,
|
14532
|
+
ref: ref,
|
14533
|
+
value: id
|
14534
|
+
}));
|
14535
|
+
});
|
14536
|
+
Tabs.List = TabList;
|
14537
|
+
Tabs.Trigger = TabTrigger;
|
14538
|
+
Tabs.Content = TabContent;
|
14539
|
+
|
14540
|
+
const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
14541
|
+
const {
|
14542
|
+
defaultValue: _,
|
14543
|
+
highlighted,
|
14544
|
+
invalid,
|
14545
|
+
onKeyDown,
|
14546
|
+
...otherProps
|
14547
|
+
} = props;
|
14548
|
+
const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);
|
14549
|
+
// home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
|
14550
|
+
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
14551
|
+
// so we manually override it to ensure _our_ desired behaviour remains intact
|
14552
|
+
const handleKeyDown = event => {
|
14553
|
+
if (event.key === 'Home' || event.key === 'End') {
|
14554
|
+
event.preventDefault();
|
14555
|
+
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
14556
|
+
event.currentTarget.setSelectionRange(position, position);
|
14557
|
+
event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;
|
14558
|
+
}
|
14559
|
+
if (onKeyDown) {
|
14560
|
+
onKeyDown(event);
|
14561
|
+
}
|
14562
|
+
};
|
14563
|
+
return /*#__PURE__*/React.createElement("textarea", Object.assign({}, otherProps, {
|
14564
|
+
className: classNames,
|
14565
|
+
"data-taco": "textarea",
|
14566
|
+
onKeyDown: handleKeyDown,
|
14567
|
+
ref: ref
|
14568
|
+
}));
|
14569
|
+
});
|
14570
|
+
|
14571
|
+
const Tooltip$1 = ({
|
14572
|
+
continuous,
|
14573
|
+
index,
|
14574
|
+
isLastStep,
|
14575
|
+
step,
|
14576
|
+
backProps,
|
14577
|
+
primaryProps,
|
14578
|
+
skipProps,
|
14579
|
+
tooltipProps,
|
14580
|
+
size,
|
14581
|
+
locale,
|
14582
|
+
disableTourSkipOnEsc
|
14583
|
+
}) => {
|
14584
|
+
const skipButtonRef = React.useRef(null);
|
14585
|
+
React.useEffect(() => {
|
14586
|
+
const onWindowKeyDown = event => {
|
14587
|
+
if (!disableTourSkipOnEsc) {
|
14588
|
+
if (event.key === 'Escape' && skipButtonRef.current !== null) {
|
14589
|
+
event.preventDefault();
|
14590
|
+
skipButtonRef.current.click();
|
14591
|
+
return;
|
14592
|
+
}
|
14593
|
+
}
|
14594
|
+
};
|
14595
|
+
window.addEventListener('keydown', onWindowKeyDown);
|
14596
|
+
return () => {
|
14597
|
+
window.removeEventListener('keydown', onWindowKeyDown);
|
14598
|
+
};
|
14599
|
+
}, []);
|
14600
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, tooltipProps, {
|
14601
|
+
className: "yt-tour__step w-88 relative rounded bg-white p-4"
|
14602
|
+
}), /*#__PURE__*/React.createElement(IconButton, Object.assign({}, skipProps, {
|
14603
|
+
ref: skipButtonRef,
|
14604
|
+
appearance: "discrete",
|
14605
|
+
icon: "close",
|
14606
|
+
title: locale.skip,
|
14607
|
+
"aria-label": locale.skip,
|
14608
|
+
className: "absolute top-0 right-0 mt-1 mr-1"
|
14609
|
+
})), step.title && /*#__PURE__*/React.createElement("h5", null, step.title), step.content, /*#__PURE__*/React.createElement(Group, {
|
14610
|
+
className: "mt-4 justify-end"
|
14611
|
+
}, index > 0 && /*#__PURE__*/React.createElement(Button$1, Object.assign({}, backProps, {
|
14612
|
+
appearance: "discrete"
|
14613
|
+
}), locale.back), /*#__PURE__*/React.createElement(Button$1, Object.assign({}, primaryProps, {
|
14614
|
+
appearance: "primary"
|
14615
|
+
}), continuous ? isLastStep ? `${locale.last} (${index + 1}/${size})` : `${locale.next} (${index + 1}/${size})` : locale.close)));
|
14616
|
+
};
|
14617
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
14618
|
+
const TourStep = _props => null;
|
14619
|
+
const Tour = props => {
|
14620
|
+
const {
|
14621
|
+
texts: {
|
14622
|
+
tour
|
14623
|
+
}
|
14624
|
+
} = useLocalization();
|
14625
|
+
const {
|
14626
|
+
autoStart: run,
|
14627
|
+
onComplete,
|
14628
|
+
onClose,
|
14629
|
+
onReady,
|
14630
|
+
spotlightClicks,
|
14631
|
+
disableCloseOnEsc: disableTourSkipOnEsc,
|
14632
|
+
disableScrollParentFix = false,
|
14633
|
+
scrollOffset,
|
14634
|
+
...rest
|
14635
|
+
} = props;
|
14636
|
+
const steps = React.useMemo(() => {
|
14637
|
+
return React.Children.map(props.children, child => {
|
14638
|
+
const step = {
|
14639
|
+
disableBeacon: !child.props.showBeacon,
|
14640
|
+
target: child.props.selector,
|
14641
|
+
placement: child.props.position,
|
14642
|
+
title: child.props.title,
|
14643
|
+
content: child.props.children
|
14644
|
+
};
|
14645
|
+
return step;
|
14646
|
+
});
|
14647
|
+
}, [props.children]);
|
14648
|
+
const getStep = React.useCallback(selector => {
|
14649
|
+
var _props$children$find;
|
14650
|
+
return (_props$children$find = props.children.find(child => child.props.selector === selector)) === null || _props$children$find === void 0 ? void 0 : _props$children$find.props;
|
14651
|
+
}, [props.children]);
|
14652
|
+
const callback = state => {
|
14653
|
+
if (state.action === Joyride.ACTIONS.SKIP && state.lifecycle === Joyride.LIFECYCLE.COMPLETE) {
|
14654
|
+
if (onClose) {
|
14655
|
+
onClose(getStep(state.step.target));
|
14656
|
+
}
|
14657
|
+
}
|
14658
|
+
if (state.type === Joyride.EVENTS.TOUR_END) {
|
14659
|
+
if (onComplete) {
|
14660
|
+
onComplete();
|
14661
|
+
}
|
14662
|
+
}
|
14663
|
+
if (state.lifecycle === Joyride.LIFECYCLE.READY) {
|
14664
|
+
if (onReady) {
|
14665
|
+
onReady(getStep(state.step.target));
|
14666
|
+
}
|
14667
|
+
}
|
14668
|
+
};
|
14669
|
+
return /*#__PURE__*/React.createElement(Joyride__default, Object.assign({}, rest, {
|
14670
|
+
run: run,
|
14671
|
+
steps: steps,
|
14672
|
+
showProgress: true,
|
14673
|
+
floaterProps: {
|
14674
|
+
disableAnimation: true
|
14675
|
+
},
|
14676
|
+
tooltipComponent: tooltipProps => /*#__PURE__*/React.createElement(Tooltip$1, Object.assign({}, tooltipProps, {
|
14677
|
+
locale: tour,
|
14678
|
+
disableTourSkipOnEsc: disableTourSkipOnEsc
|
14679
|
+
})),
|
14680
|
+
locale: tour,
|
14681
|
+
spotlightPadding: 8,
|
14682
|
+
spotlightClicks: spotlightClicks,
|
14683
|
+
disableScrollParentFix: disableScrollParentFix,
|
14684
|
+
callback: callback,
|
14685
|
+
scrollOffset: scrollOffset,
|
14686
|
+
styles: {
|
14687
|
+
/** style beacon */
|
14688
|
+
options: {
|
14689
|
+
// tailwind.theme.colors.blue.300
|
14690
|
+
primaryColor: '#6ba4ff'
|
14691
|
+
}
|
14692
|
+
},
|
14693
|
+
disableCloseOnEsc: true
|
14694
|
+
}));
|
14695
|
+
};
|
14696
|
+
Tour.Step = TourStep;
|
14697
|
+
|
14698
|
+
const Button$3 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
14699
|
+
const {
|
14700
|
+
as = 'li',
|
14701
|
+
...attributes
|
14702
|
+
} = props;
|
14703
|
+
const className = cn(getButtonClasses$1(), props.className);
|
14704
|
+
const Tag = as;
|
14705
|
+
return /*#__PURE__*/React__default.createElement(Tag, {
|
14706
|
+
className: "contents"
|
14707
|
+
}, /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
|
14708
|
+
appearance: "discrete",
|
14709
|
+
className: className,
|
14710
|
+
"data-taco": "header-button",
|
14711
|
+
ref: ref
|
14712
|
+
})));
|
14713
|
+
});
|
14714
|
+
const getButtonClasses$1 = () => cn('!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer !rounded-full relative', 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white');
|
14715
|
+
|
14716
|
+
const Link$1 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
|
14717
|
+
const {
|
14718
|
+
as = 'li',
|
14719
|
+
children,
|
14720
|
+
icon,
|
14721
|
+
isNew,
|
14722
|
+
tooltip,
|
14723
|
+
...otherProps
|
14724
|
+
} = props;
|
14725
|
+
const {
|
14726
|
+
texts
|
14727
|
+
} = useLocalization();
|
14728
|
+
const Tag = as;
|
14729
|
+
const className = cn(getLinkClasses(icon), 'relative', props.className);
|
14730
|
+
let link = /*#__PURE__*/React__default.createElement("a", Object.assign({}, otherProps, {
|
14731
|
+
className: className,
|
14732
|
+
"data-taco": "header-link",
|
14733
|
+
ref: ref,
|
14734
|
+
tabIndex: 0
|
14735
|
+
}), icon ? /*#__PURE__*/React__default.createElement(Icon, {
|
14736
|
+
name: icon
|
14737
|
+
}) : null, children, isNew ? /*#__PURE__*/React__default.createElement(Badge, {
|
14738
|
+
color: "blue",
|
14739
|
+
small: true,
|
14740
|
+
className: "absolute top-0 right-0 -mt-1.5 -mr-2.5 !h-3 !px-0.5 text-[0.55rem] font-normal"
|
14741
|
+
}, texts.header.new) : null);
|
14742
|
+
if (tooltip) {
|
14743
|
+
link = /*#__PURE__*/React__default.createElement(Tooltip, {
|
14744
|
+
title: tooltip
|
14745
|
+
}, link);
|
14746
|
+
}
|
14747
|
+
return /*#__PURE__*/React__default.createElement(Tag, {
|
14748
|
+
className: "contents"
|
14749
|
+
}, link);
|
14750
|
+
});
|
14751
|
+
const getLinkClasses = (icon = undefined) => cn('flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ', 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white', {
|
14752
|
+
'!rounded-full !h-9 !w-9': icon,
|
14753
|
+
'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon
|
14754
|
+
});
|
14755
|
+
|
14756
|
+
const Logo = /*#__PURE__*/React__default.forwardRef(function Logo(props, ref) {
|
14757
|
+
const className = cn('-mr-[156px] xs:-mr-14 md:!mr-0 h-9 shrink-0 w-[180px]', props.className);
|
14758
|
+
return /*#__PURE__*/React__default.createElement("svg", Object.assign({}, props, {
|
14759
|
+
className: className,
|
14760
|
+
ref: ref,
|
14761
|
+
viewBox: "0 0 127 13",
|
14762
|
+
xmlns: "http://www.w3.org/2000/svg"
|
14763
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
14764
|
+
className: "fill-white"
|
14765
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
14766
|
+
className: "fill-white",
|
14767
|
+
d: "M5.716016 1.34924242c3.029712.25015152 6.374384 1.74121213 8.2804 3.86060606 2.4384 2.71227273 1.603248 5.42454542-1.877568 6.05681822-3.480816.6322727-8.2804-1.0498485-10.720832-3.76212125C-.471424 5.42848485-.41656 3.35242424 1.27 2.2080303l9.67232 6.92742425-5.226304-7.78621213z",
|
14768
|
+
fillRule: "nonzero"
|
14769
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
14770
|
+
className: "hidden md:flex"
|
14771
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
14772
|
+
d: "M53.67528 11.2509091l-1.2192-4.72727274c-.176784-.56333333-.24384-1.12666666-.36576-1.6880303h-.026416c-.107696.57515152-.148336 1.13848485-.308864 1.71363636l-1.22936 4.70954548h-2.101088l2.822448-9.87409093h1.647952l2.942336 9.86424243-2.162048.0019697z",
|
14773
|
+
fillRule: "nonzero"
|
14774
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14775
|
+
d: "M21.553424 1.38469697l1.2192 4.72727273c.174752.56333333.241808 1.12469697.363728 1.6880303h.026416c.107696-.57515152.148336-1.13848485.310896-1.71363636l1.2192-4.70954546h2.105152L23.9776 11.2410606h-1.64592l-2.938272-9.85636363h2.160016z",
|
14776
|
+
fillRule: "nonzero"
|
14777
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14778
|
+
fillRule: "nonzero",
|
14779
|
+
d: "M28.313888 1.38666667h2.01168v9.86424243h-2.01168z"
|
14780
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14781
|
+
fillRule: "nonzero",
|
14782
|
+
d: "M41.694608 1.38666667l.983488 5.82045454h.026416l.808736-5.82045454h2.700528l1.0668 9.86424243h-2.064512l-.485648-7.10469698h-.028448l-.323088 2.43257576-.865632 4.67212122h-1.550416l-.98552-4.72333334L40.64 4.32939394v-.18318182h-.026416l-.296672 7.10469698h-2.160016l.890016-9.86424243z"
|
14783
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14784
|
+
d: "M35.310064 1.38469697c-.3577988.27917284-.6303655.64756811-.788416 1.06560606-.526288 1.22909091.036576 2.16666667.534416 3.00575758.073152.12409091.148336.24818181.217424.37227272 1.085088 1.80424243 1.515872 3.13378788.705104 5.02863637-.056896.1339394-.191008.3939394-.191008.3939394h-2.424176c.3204254-.2482168.5741848-.5678542.739648-.9316667.556768-1.30196967-.099568-2.49166664-.735584-3.64393937-.764032-1.37878788-1.552448-2.81863636-.715264-4.78045455.079248-.18712121.254-.50424242.254-.50424242l2.403856-.00590909z",
|
14785
|
+
fillRule: "nonzero"
|
14786
|
+
}))), /*#__PURE__*/React__default.createElement("g", {
|
14787
|
+
className: "xs:flex xs:-translate-x-[40px] hidden md:!translate-x-0"
|
14788
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
14789
|
+
className: "stroke-white",
|
14790
|
+
d: "M61.496448 0v12.8680303",
|
14791
|
+
strokeWidth: "1.68"
|
14792
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
14793
|
+
className: "fill-white"
|
14794
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
14795
|
+
d: "M70.841616 9.70863636c-.999744 0-1.7888373-.29479798-2.36728-.88439394-.5784427-.58959596-.867664-1.40964646-.867664-2.46015151 0-1.05707071.2709333-1.89681818.8128-2.51924243.5304376-.61728629 1.3256457-.96197654 2.15392-.93363636.7626734-.03509605 1.5014967.26264579 2.013712.81151515.4944533.53969697.7410027 1.25272728.739648 2.13909091v.62833334h-4.659376c.022352.77015151.221488 1.35318181.6096 1.7530303.388112.39984848.916432.59090909 1.607312.59090909.743701-.00293405 1.4788698-.15377248 2.160016-.44318182v.88636364c-.3298144.14174433-.6736336.25063692-1.02616.325-.3855929.07188992-.7778273.1048941-1.170432.09848485m-.27432-5.95242425c-.4900374-.02138848-.9649513.16736328-1.298448.51606061-.3477231.40033357-.5485505.90121019-.570992 1.42409091h3.53568c0-.62636364-.14224-1.1069697-.430784-1.43984849-.3103282-.34233825-.7661196-.52691285-1.235456-.50030303",
|
14796
|
+
fillRule: "nonzero"
|
14797
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14798
|
+
d: "M75.053952 6.25575758c-.0151689-.21657791.0536783-.43083638.19304-.60075758.1381463-.1429001.3347885-.21871211.536448-.20681818.2081607-.01140173.4114497.0638378.5588.20681818.2680858.35762602.2680858.84191943 0 1.19954545-.3018073.26987298-.7638609.27916874-1.07696.02166667-.1529999-.17086259-.2265151-.39533511-.2032-.62045454",
|
14799
|
+
fillRule: "nonzero"
|
14800
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14801
|
+
d: "M81.586832 9.70863636c-.979424 0-1.73736-.29217171-2.273808-.87651515-.536448-.58434343-.8073813-1.41095959-.8128-2.47984848 0-1.09777778.2709333-1.94540404.8128-2.54287879.5418667-.59747475 1.318768-.89686869 2.330704-.89818182.3279782-.00003668.654999.03430434.97536.10242424.2639542.04817256.5206342.12824173.764032.23833334l-.31496.845c-.2397537-.0929503-.4871838-.16608946-.739648-.21863637-.2330197-.05435362-.4715521-.08342113-.7112-.08666666-1.373632 0-2.060448.84959596-2.060448 2.54878788 0 .80494949.1673013 1.42343434.501904 1.85545454.33528.42939394.83312.64606061 1.491488.64606061.5966181-.00678768 1.1861142-.12655871 1.735328-.35257576v.87848485c-.5339642.24467285-1.120715.3615322-1.710944.34075757",
|
14802
|
+
fillRule: "nonzero"
|
14803
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14804
|
+
d: "M90.690192 6.30893939c0 1.06757576-.278384 1.90207071-.835152 2.50348485-.556768.60141414-1.3241867.90146465-2.302256.90015152-.5660565.00980534-1.1238362-.13269357-1.611376-.41166667-.4744234-.28111893-.8520726-.69243374-1.085088-1.18181818-.2674171-.5661279-.3987341-1.18372355-.384048-1.80621212 0-1.06888889.2756747-1.90207071.827024-2.49954546.5513493-.59747474 1.316736-.89555555 2.29616-.89424242.8559447-.03726298 1.6841715.29875604 2.257552.91590909.556768.61060606.8358293 1.43656566.837184 2.47787879m-5.155184 0c0 .83777778.17272 1.47595959.51816 1.91454545.34544.43858586.85344.65787879 1.524.65787879s1.1799147-.21863636 1.528064-.65590909.522224-1.07611111.522224-1.91651515c0-.83515152-.1740747-1.46873738-.522224-1.90075758-.3481493-.4320202-.861568-.64868687-1.540256-.65-.67056 0-1.176528.21469697-1.517904.64015152-.341376.42545454-.512064 1.06363636-.512064 1.91060606",
|
14805
|
+
fillRule: "nonzero"
|
14806
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14807
|
+
d: "M96.989392 9.58848485V5.34575758c0-.53444445-.1253067-.9329798-.37592-1.19560606-.251968-.2639394-.644144-.3939394-1.180592-.3939394-.707136 0-1.225296.18580808-1.55448.55742424-.329184.37161617-.493776.98419192-.493776 1.83772728v3.43909091h-1.02616V3.03136364h.83312l.168656.89621212h.048768c.213947-.32669621.5199877-.58712571.881888-.75045455.3956439-.18075251.8285923-.27169306 1.265936-.26590909.8128 0 1.4257867.19040404 1.83896.57121212.4131733.38080808.6163733.99010101.6096 1.82787879v4.27818182h-1.016z",
|
14808
|
+
fillRule: "nonzero"
|
14809
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14810
|
+
d: "M105.759504 6.30893939c0 1.06757576-.277707 1.90207071-.83312 2.50348485-.555413.60141414-1.322832.90146465-2.302256.90015152-.566147.01053143-1.124127-.1320188-1.611376-.41166667-.474546-.2815508-.852738-.69268701-1.08712-1.18181818-.2666505-.56630799-.397268-1.18388155-.382016-1.80621212 0-1.06888889.2756747-1.90207071.827024-2.49954546.551349-.59747474 1.316736-.89555555 2.29616-.89424242.948267 0 1.700107.30530303 2.25552.91590909.555413.61060606.834475 1.43525253.837184 2.47393939m-5.155184 0c0 .83777778.17272 1.4759596.51816 1.91454546.34544.43924242.855472.65787879 1.526032.65787879.589088.03526465 1.159066-.20939357 1.528064-.65590909.348149-.43727273.521547-1.07611112.520192-1.91651516-.001355-.84040404-.174752-1.4739899-.520192-1.90075757-.349504-.43333334-.861568-.65-1.540256-.65-.678688 0-1.17856.21469697-1.519936.64015151-.341376.42545455-.512064 1.06363637-.512064 1.91060606",
|
14811
|
+
fillRule: "nonzero"
|
14812
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14813
|
+
d: "M116.1796 9.58848485V5.32409091c0-.52525253-.115147-.91919192-.34544-1.18181818-.229616-.26-.58928-.3939394-1.074928-.3939394-.635339 0-1.109472.1779293-1.4224.53378788-.312928.35585859-.465328.90212121-.4572 1.63878788v3.66166667h-1.016V5.32409091c0-.52525253-.115824-.91919192-.347472-1.18181818-.229616-.26-.58928-.3939394-1.078992-.3939394-.642112 0-1.113536.1969697-1.410208.55939394-.296672.36242425-.449072.98484849-.449072 1.83575758v3.43909091h-1.016V3.03136364h.83312l.166624.89621212h.0508c.192326-.31859024.474248-.57752095.8128-.74651515.36534-.18279258.771528-.27547583 1.182624-.26984849 1.05664 0 1.748197.3709596 2.074672 1.11287879h.048768c.20551-.34688729.509496-.62924665.875792-.81348485.403616-.20402984.853472-.30695163 1.308608-.29939394.765387 0 1.338411.19040404 1.719072.57121212.380661.38080808.570992.99010101.570992 1.82787879v4.27818182h-1.02616z",
|
14814
|
+
fillRule: "nonzero"
|
14815
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14816
|
+
d: "M119.16664 1.25272727c-.016875-.18221767.045768-.36295537.17272-.49833333.243232-.21393452.614272-.21393452.857504 0 .129279.13353172.194239.31385023.178816.49636364.015568.18371514-.049334.36530074-.178816.50030303-.240531.22061195-.616973.22061195-.857504 0-.125769-.13683457-.188192-.31765204-.17272-.50030303v.00196969zm1.111504 8.33378788h-1.02616V3.03136364h1.02616v6.55515151z",
|
14817
|
+
fillRule: "nonzero"
|
14818
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
14819
|
+
d: "M125.091952 9.70863636c-.979424 0-1.738037-.29217171-2.27584-.87651515-.537803-.58434343-.808736-1.41095959-.8128-2.47984848 0-1.09777778.270933-1.94540404.8128-2.54287879.541867-.59747475 1.318768-.89686869 2.330704-.89818182.327978-.00003668.654999.03430434.97536.10242424.264596.04821437.521943.12827865.766064.23833334l-.31496.845c-.239852-.09267891-.487258-.16581103-.739648-.21863637-.233047-.05421-.471563-.08327549-.7112-.08666666-1.373632 0-2.061125.84959596-2.06248 2.54878788 0 .80494949.167979 1.42343434.503936 1.85545454.33528.42939394.83312.64606061 1.491488.64606061.595961-.00679074 1.184792-.12656681 1.733296-.35257576v.87848485c-.533172.24487796-1.119318.3617557-1.708912.34075757",
|
14820
|
+
fillRule: "nonzero"
|
14821
|
+
}))));
|
14822
|
+
});
|
14823
|
+
|
14824
|
+
const getChildWidths = parent => {
|
14825
|
+
const widths = [];
|
14826
|
+
for (let index = 0; index < parent.children.length; index++) {
|
14827
|
+
const childRect = parent.children[index].getBoundingClientRect();
|
14828
|
+
widths.push(childRect.width);
|
14829
|
+
}
|
14830
|
+
return widths;
|
14831
|
+
};
|
14832
|
+
const ChildrenWidth = ({
|
14833
|
+
setWidth,
|
14834
|
+
children
|
14835
|
+
}) => {
|
14836
|
+
const ref = React__default.useRef(null);
|
14837
|
+
const [show, setShow] = React__default.useState(true);
|
14838
|
+
React__default.useEffect(() => {
|
14839
|
+
// Calculate the width of children, and then hides the portal
|
14840
|
+
if (ref.current && show) {
|
14841
|
+
setWidth(getChildWidths(ref.current));
|
14842
|
+
setShow(false);
|
14843
|
+
}
|
14844
|
+
}, [show]);
|
14845
|
+
React__default.useEffect(() => {
|
14846
|
+
// If children changes, then we render the children to calculate their width
|
14847
|
+
if (!show) {
|
14848
|
+
setShow(true);
|
14849
|
+
}
|
14850
|
+
}, [children]);
|
14851
|
+
return show ? /*#__PURE__*/React__default.createElement(reactPortal.Portal, {
|
14852
|
+
className: cn('invisible absolute z-[-10] flex translate-x-[-1000px]'),
|
14853
|
+
ref: ref
|
14854
|
+
}, children) : null;
|
14855
|
+
};
|
14856
|
+
const useBoundaryIndex = (wrapperWidth, buttonRef, childWidths) => {
|
14857
|
+
// Primary navigation has a gap of gap-1, so we need to take the gap value in account as well
|
14858
|
+
// left gap + right gap = 8px
|
14859
|
+
const GAP = 8;
|
14860
|
+
return React__default.useMemo(() => {
|
14861
|
+
if (childWidths.length && wrapperWidth && buttonRef.current) {
|
14862
|
+
const realWidth = wrapperWidth - buttonRef.current.getBoundingClientRect().width - GAP;
|
14863
|
+
let boundary;
|
14864
|
+
let total = 0;
|
14865
|
+
childWidths.every((width, index) => {
|
14866
|
+
const nextWidth = total + width + GAP;
|
14867
|
+
if (nextWidth > realWidth) {
|
14868
|
+
boundary = index;
|
14869
|
+
return false;
|
14870
|
+
}
|
14871
|
+
total = nextWidth;
|
14872
|
+
return true;
|
14873
|
+
});
|
14874
|
+
return boundary;
|
14875
|
+
}
|
14876
|
+
return undefined;
|
14877
|
+
}, [childWidths, wrapperWidth]);
|
14878
|
+
};
|
14879
|
+
const PrimaryNavigation = /*#__PURE__*/React__default.forwardRef(function PrimaryNavigation(props, ref) {
|
14880
|
+
var _rect$width;
|
14881
|
+
const {
|
14882
|
+
texts
|
14883
|
+
} = useLocalization();
|
14884
|
+
const internalRef = useMergedRef(ref);
|
14885
|
+
const rect = useBoundingClientRectListener(internalRef);
|
14886
|
+
const buttonRef = React__default.useRef(null);
|
14887
|
+
const [childWidths, setChildWidths] = React__default.useState([]);
|
14888
|
+
const boundaryIndex = useBoundaryIndex((_rect$width = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _rect$width !== void 0 ? _rect$width : 0, buttonRef, childWidths);
|
14889
|
+
const className = cn('flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative', props.className);
|
14890
|
+
const moreButtonClassName = cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]');
|
14891
|
+
const [visibleChildren, hiddenChildren] = React__default.useMemo(() => {
|
14892
|
+
const visibleChildren = [];
|
14893
|
+
const hiddenChildren = [];
|
14894
|
+
React__default.Children.forEach(props.children, (child, index) => {
|
14895
|
+
if ( /*#__PURE__*/React__default.isValidElement(child) && !!child) {
|
14896
|
+
if (boundaryIndex && index >= boundaryIndex) {
|
14897
|
+
hiddenChildren.push(child);
|
14898
|
+
} else {
|
14899
|
+
visibleChildren.push(child);
|
14900
|
+
}
|
14901
|
+
}
|
14902
|
+
});
|
14903
|
+
return [visibleChildren, hiddenChildren];
|
14904
|
+
}, [boundaryIndex, props.children]);
|
14905
|
+
return /*#__PURE__*/React__default.createElement("nav", Object.assign({}, props, {
|
14906
|
+
className: className,
|
14907
|
+
ref: internalRef
|
14908
|
+
}), /*#__PURE__*/React__default.createElement("ul", {
|
14909
|
+
className: "mb-0 flex h-full w-full items-center gap-1 overflow-hidden px-1"
|
14910
|
+
}, visibleChildren, /*#__PURE__*/React__default.createElement("li", {
|
14911
|
+
className: cn({
|
14912
|
+
invisible: boundaryIndex === undefined
|
14913
|
+
})
|
14914
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
14915
|
+
className: moreButtonClassName,
|
14916
|
+
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
14917
|
+
className: "hidden lg:block"
|
14918
|
+
}, hiddenChildren.map((child, index) => {
|
14919
|
+
const href = child.props.to || child.props.href;
|
14920
|
+
const target = href !== null && href !== void 0 && href.startsWith('http') ? '_blank' : '_self';
|
14921
|
+
// Removing className prop so that custom styling cannot be applied on Menu.Link
|
14922
|
+
const {
|
14923
|
+
as,
|
14924
|
+
className: _,
|
14925
|
+
...otherProps
|
14926
|
+
} = child.props;
|
14927
|
+
if (as) {
|
14928
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
14929
|
+
as: Menu$1.Link,
|
14930
|
+
key: index,
|
14931
|
+
target,
|
14932
|
+
...otherProps
|
14933
|
+
});
|
14934
|
+
}
|
14935
|
+
return /*#__PURE__*/React__default.createElement(Menu$1.Link, Object.assign({
|
14936
|
+
key: index,
|
14937
|
+
target: target
|
14938
|
+
}, otherProps));
|
14939
|
+
}))),
|
14940
|
+
ref: buttonRef
|
14941
|
+
}, texts.header.more))), /*#__PURE__*/React__default.createElement(ChildrenWidth, {
|
14942
|
+
setWidth: setChildWidths
|
14943
|
+
}, props.children));
|
14944
|
+
});
|
14945
|
+
|
14946
|
+
const SecondaryNavigation = /*#__PURE__*/React__default.forwardRef(function SecondaryNavigation(props, ref) {
|
14947
|
+
const className = cn('flex h-full items-center gap-2 mb-0', props.className);
|
14948
|
+
return /*#__PURE__*/React__default.createElement("ul", Object.assign({}, props, {
|
14949
|
+
className: className,
|
14950
|
+
ref: ref
|
14951
|
+
}));
|
14952
|
+
});
|
14953
|
+
|
14954
|
+
const MenuButton = /*#__PURE__*/React__default.forwardRef(function MenuButton(props, ref) {
|
14955
|
+
const className = cn(getButtonClasses$1(), 'ml-1 -mr-1 !bg-transparent hover:!bg-white/[.08] focus:!bg-white/[.08]] lg:hidden');
|
14956
|
+
return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, props, {
|
14957
|
+
className: className,
|
14958
|
+
"data-taco": "header-toggle-sidebar",
|
14959
|
+
icon: "menu",
|
14960
|
+
ref: ref
|
14961
|
+
}));
|
14962
|
+
});
|
14963
|
+
|
14964
|
+
const AgreementDetails = props => {
|
14965
|
+
const {
|
14966
|
+
children,
|
14967
|
+
className: customClassName,
|
14968
|
+
fallbackImageSrc,
|
14969
|
+
...agreement
|
14970
|
+
} = props;
|
14971
|
+
const className = cn('w-full rounded flex w-full px-1.5 xl:px-2 gap-2 overflow-hidden text-left items-center', customClassName);
|
14972
|
+
let badge;
|
14973
|
+
if (agreement.isAdministrator) {
|
14974
|
+
badge = /*#__PURE__*/React__default.createElement(Badge, {
|
14975
|
+
color: "blue",
|
14976
|
+
small: true,
|
14977
|
+
className: "ml-2"
|
14978
|
+
}, "Admin");
|
14979
|
+
} else if (agreement.isDeveloper) {
|
14980
|
+
badge = /*#__PURE__*/React__default.createElement(Badge, {
|
14981
|
+
color: "blue",
|
14982
|
+
small: true,
|
14983
|
+
className: "ml-2"
|
14984
|
+
}, "Developer");
|
14985
|
+
}
|
14986
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
14987
|
+
className: className
|
14988
|
+
}, /*#__PURE__*/React__default.createElement(Image, {
|
14989
|
+
fallbackSrc: fallbackImageSrc,
|
14990
|
+
src: agreement.imageSrc,
|
14991
|
+
title: `${agreement.name} - ${agreement.number} ${agreement.userId}`
|
14992
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
14993
|
+
className: "flex flex-col overflow-hidden"
|
14994
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
14995
|
+
className: "flex truncate text-white",
|
14996
|
+
title: agreement.name
|
14997
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
14998
|
+
className: "truncate"
|
14999
|
+
}, agreement.name), ' ', agreement.secure ? /*#__PURE__*/React__default.createElement(Icon, {
|
15000
|
+
name: "secure-tick",
|
15001
|
+
className: "ml-1 mt-0.5 mb-0.5 !h-4 !w-4 flex-shrink-0 flex-grow-0"
|
15002
|
+
}) : null), /*#__PURE__*/React__default.createElement("span", {
|
15003
|
+
className: "text-grey-100 whitespace-nowrap text-xs"
|
15004
|
+
}, agreement.number, " ", agreement.userId, " ", badge)), children);
|
15005
|
+
};
|
15006
|
+
const Image = /*#__PURE__*/React__default.forwardRef(function AccountImage(props, ref) {
|
15007
|
+
const {
|
15008
|
+
src,
|
15009
|
+
fallbackSrc,
|
15010
|
+
...otherProps
|
15011
|
+
} = props;
|
15012
|
+
const [loaded, setLoaded] = React__default.useState(false);
|
15013
|
+
const handleLoad = () => setLoaded(true);
|
15014
|
+
const handleError = event => {
|
15015
|
+
event.target.src = fallbackSrc;
|
15016
|
+
};
|
15017
|
+
const className = cn('h-9 w-9 rounded-full shrink-0 group-focus:yt-focus-dark xl:group-focus:shadow-none', {
|
15018
|
+
visible: loaded
|
15019
|
+
}, props.className);
|
15020
|
+
return /*#__PURE__*/React__default.createElement("img", Object.assign({}, otherProps, {
|
15021
|
+
className: className,
|
15022
|
+
src: src,
|
15023
|
+
onLoad: handleLoad,
|
15024
|
+
onError: handleError,
|
15025
|
+
alt: "Company logo",
|
15026
|
+
ref: ref
|
15027
|
+
}));
|
15028
|
+
});
|
15029
|
+
|
15030
|
+
const Container$1 = props => {
|
15031
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
15032
|
+
className: "-ml-3 flex flex-shrink-0 flex-grow-0 items-center gap-2 xl:ml-auto xl:w-64 xl:pr-2",
|
15033
|
+
"data-taco": "header-agreements"
|
15034
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
15035
|
+
className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
|
15036
|
+
}), props.children);
|
15037
|
+
};
|
15038
|
+
function AgreementDisplay(props) {
|
15039
|
+
const {
|
15040
|
+
currentAgreement,
|
15041
|
+
fallbackImageSrc
|
15042
|
+
} = props;
|
15043
|
+
return /*#__PURE__*/React__default.createElement(Container$1, null, /*#__PURE__*/React__default.createElement(AgreementDetails, Object.assign({}, currentAgreement, {
|
15044
|
+
className: "h-12 [&>span>span]:hidden xl:[&>span>span]:flex ",
|
15045
|
+
fallbackImageSrc: fallbackImageSrc
|
15046
|
+
})));
|
15047
|
+
}
|
15048
|
+
function AgreementSelector(props) {
|
15049
|
+
const {
|
15050
|
+
agreements,
|
15051
|
+
currentAgreement,
|
15052
|
+
fallbackImageSrc,
|
15053
|
+
filterAgreement = () => true,
|
15054
|
+
filterClientAgreement = () => true,
|
15055
|
+
onAddAgreement: handleAddAgreement,
|
15056
|
+
onChangeAgreement,
|
15057
|
+
onLogout: handleLogout,
|
15058
|
+
open: prop,
|
15059
|
+
setOpen: onChange
|
15060
|
+
} = props;
|
15061
|
+
const {
|
15062
|
+
texts
|
15063
|
+
} = useLocalization();
|
15064
|
+
const collectionRef = React__default.useRef(null);
|
15065
|
+
const [open, setOpen] = reactUseControllableState.useControllableState({
|
15066
|
+
onChange,
|
15067
|
+
prop
|
15068
|
+
});
|
15069
|
+
const [search, setSearch] = React__default.useState('');
|
15070
|
+
React__default.useEffect(() => {
|
15071
|
+
setSearch('');
|
15072
|
+
}, [open]);
|
15073
|
+
const handleKeyDown = event => {
|
15074
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter') {
|
15075
|
+
var _collectionRef$curren;
|
15076
|
+
event.preventDefault();
|
15077
|
+
(_collectionRef$curren = collectionRef.current) === null || _collectionRef$curren === void 0 ? void 0 : _collectionRef$curren.dispatchEvent(createCustomKeyboardEvent(event));
|
15078
|
+
}
|
15079
|
+
};
|
15080
|
+
const handleChangeAgreement = agreement => {
|
15081
|
+
onChangeAgreement(agreement);
|
15082
|
+
setOpen(false);
|
15083
|
+
};
|
15084
|
+
return /*#__PURE__*/React__default.createElement(Container$1, null, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Root, {
|
15085
|
+
open: open,
|
15086
|
+
onOpenChange: setOpen
|
15087
|
+
}, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Trigger, {
|
15088
|
+
className: "xl:focus-visible:yt-focus-dark [&:focus-visible_img]:yt-focus-dark w-full rounded outline-none xl:[&:focus-visible_img]:shadow-none"
|
15089
|
+
}, /*#__PURE__*/React__default.createElement(AgreementDetails, Object.assign({}, currentAgreement, {
|
15090
|
+
className: "h-12 flex-grow xl:hover:bg-white/[0.16] [&>span>span]:hidden xl:[&>span>span]:flex [[aria-current='true']>&]:bg-white/[0.16]",
|
15091
|
+
fallbackImageSrc: fallbackImageSrc
|
15092
|
+
}), agreements ? /*#__PURE__*/React__default.createElement(Icon, {
|
15093
|
+
className: "ml-auto hidden flex-shrink-0 flex-grow-0 text-white xl:flex",
|
15094
|
+
name: open ? 'chevron-up' : 'chevron-down'
|
15095
|
+
}) : null)), /*#__PURE__*/React__default.createElement(PopoverPrimitive.Content, {
|
15096
|
+
className: "z-[996] mt-2 flex h-[calc(100vh_-_theme(spacing.16))] w-64 flex-col gap-1 bg-blue-900"
|
15097
|
+
}, /*#__PURE__*/React__default.createElement(SearchInput, {
|
15098
|
+
autoFocus: true,
|
15099
|
+
className: "focus-visible:!yt-focus-dark mx-2 !border-transparent !bg-white/[0.08] !text-white hover:!bg-white/[0.16] hover:!shadow-none focus:!bg-white/[0.16] active:!bg-white/[0.16] [&+div>button]:!text-white",
|
15100
|
+
onChange: event => setSearch(event.target.value),
|
15101
|
+
onKeyDown: handleKeyDown,
|
15102
|
+
placeholder: texts.header.search
|
15103
|
+
}), /*#__PURE__*/React__default.createElement(Root, {
|
15104
|
+
querySelector: "button",
|
15105
|
+
className: "-my-1 flex w-full flex-grow flex-col gap-1 overflow-auto px-2 py-1 outline-none",
|
15106
|
+
ref: collectionRef,
|
15107
|
+
tabIndex: -1
|
15108
|
+
}, agreements === null || agreements === void 0 ? void 0 : agreements.filter(agreement => filterAgreement(agreement, filterBySearchValue(search))).map(agreement => {
|
15109
|
+
const button = createAgreementButton(agreement, fallbackImageSrc, handleChangeAgreement, isCurrentAgreement(agreement, currentAgreement));
|
15110
|
+
if (agreement.clients) {
|
15111
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
15112
|
+
className: "flex flex-col gap-px [&>*:first-child>span]:!rounded-t [&>*:last-child>span]:!rounded-b [&>*>span]:!rounded-none",
|
15113
|
+
key: `${agreement.number}_${agreement.userId}_clients`
|
15114
|
+
}, filterBySearchValue(search)(agreement) ? button : null, agreement.clients.filter(agreement => filterClientAgreement(agreement, filterBySearchValue(search))).map(clientAgreement => createAgreementButton(clientAgreement, fallbackImageSrc, handleChangeAgreement, isCurrentAgreement(clientAgreement, currentAgreement))));
|
15115
|
+
}
|
15116
|
+
return button;
|
15117
|
+
})), handleAddAgreement ? /*#__PURE__*/React__default.createElement(Button$1, {
|
15118
|
+
className: "focus-visible:!yt-focus-dark my-1 mx-2 !h-9 shrink-0 !bg-white/[0.08] !text-white hover:!bg-white/[0.16]",
|
15119
|
+
onClick: handleAddAgreement
|
15120
|
+
}, texts.header.addAgreement) : null, /*#__PURE__*/React__default.createElement("hr", {
|
15121
|
+
className: "my-0 h-px w-full bg-white/[0.08]"
|
15122
|
+
}), /*#__PURE__*/React__default.createElement("a", {
|
15123
|
+
className: "focus-visible:yt-focus-dark mx-2 mb-2 flex h-8 shrink-0 items-center justify-center rounded text-white hover:cursor-pointer hover:text-white hover:underline focus-visible:outline-none",
|
15124
|
+
onClick: handleLogout,
|
15125
|
+
tabIndex: 0
|
15126
|
+
}, texts.header.logout))));
|
15127
|
+
}
|
15128
|
+
const filterBySearchValue = search => agreement => {
|
15129
|
+
if (!search || !search.length) {
|
15130
|
+
return true;
|
15131
|
+
}
|
15132
|
+
const matchesAgreementNumber = String(agreement.number).indexOf(search) > -1;
|
15133
|
+
const matchesCompanyName = agreement.name.toLowerCase().indexOf(search.toLowerCase()) > -1;
|
15134
|
+
return matchesAgreementNumber || matchesCompanyName;
|
15135
|
+
};
|
15136
|
+
const isCurrentAgreement = (agreement, currentAgreement) => {
|
15137
|
+
return agreement.number === currentAgreement.number && agreement.userId === currentAgreement.userId;
|
15138
|
+
};
|
15139
|
+
const createAgreementButton = (agreement, fallbackImageSrc, onChangeAgreement, isCurrentAgreement = false) => /*#__PURE__*/React__default.createElement("button", {
|
15140
|
+
"aria-current": isCurrentAgreement ? 'true' : undefined,
|
15141
|
+
className: "focus:yt-focus-dark w-full rounded outline-none",
|
15142
|
+
"data-taco": "header-agreements-agreement",
|
15143
|
+
key: `${agreement.number}_${agreement.userId}`,
|
15144
|
+
onClick: () => onChangeAgreement(agreement),
|
15145
|
+
onKeyDown: () => onChangeAgreement(agreement),
|
15146
|
+
tabIndex: 0
|
15147
|
+
}, /*#__PURE__*/React__default.createElement(AgreementDetails, Object.assign({}, agreement, {
|
15148
|
+
className: "h-14 bg-white/[0.08] xl:hover:bg-white/[0.16] [[aria-current='true']>&]:bg-white/[0.16]",
|
15149
|
+
fallbackImageSrc: fallbackImageSrc
|
15150
|
+
})));
|
15151
|
+
|
15152
|
+
const Header$2 = /*#__PURE__*/React__default.forwardRef(function Header(props, ref) {
|
15153
|
+
const className = cn('bg-blue-900 flex h-16 w-full shrink-0 items-center gap-4 pl-2', '[&>a:focus-visible]:yt-focus-dark [&>a]:px-2 [&>a]:rounded [&>a]:h-[calc(100%-14px)]',
|
15154
|
+
// styles for logo wrapped inside an anchor
|
15155
|
+
props.className);
|
15156
|
+
return /*#__PURE__*/React__default.createElement("header", Object.assign({}, props, {
|
15157
|
+
className: className,
|
15158
|
+
ref: ref
|
15159
|
+
}));
|
15160
|
+
});
|
15161
|
+
Header$2.AgreementDisplay = AgreementDisplay;
|
15162
|
+
Header$2.AgreementSelector = AgreementSelector;
|
15163
|
+
Header$2.Button = Button$3;
|
15164
|
+
Header$2.Link = Link$1;
|
15165
|
+
Header$2.Logo = Logo;
|
15166
|
+
Header$2.PrimaryNavigation = PrimaryNavigation;
|
15167
|
+
Header$2.SecondaryNavigation = SecondaryNavigation;
|
15168
|
+
Header$2.MenuButton = MenuButton;
|
15169
|
+
|
15170
|
+
const LayoutContext = /*#__PURE__*/React__default.createContext({
|
15171
|
+
sidebarOpen: false,
|
15172
|
+
setSidebarOpen: () => undefined
|
15173
|
+
});
|
15174
|
+
|
15175
|
+
const Content$9 = /*#__PURE__*/React__default.forwardRef(function LayoutContent(props, ref) {
|
15176
|
+
const className = cn('flex-grow overflow-y-auto bg-white flex flex-shrink flex-col relative', props.className);
|
15177
|
+
return /*#__PURE__*/React__default.createElement("main", Object.assign({}, props, {
|
15178
|
+
className: className,
|
15179
|
+
ref: ref
|
15180
|
+
}));
|
15181
|
+
});
|
15182
|
+
|
15183
|
+
const useMatchMedia = (query, defaultMatches = false) => {
|
15184
|
+
const [matches, setMatches] = React__default.useState(defaultMatches);
|
15185
|
+
const handleChange = React__default.useCallback(event => setMatches(event.matches), []);
|
15186
|
+
React__default.useEffect(() => {
|
15187
|
+
const mediaQuery = window.matchMedia(query);
|
15188
|
+
setMatches(mediaQuery.matches);
|
15189
|
+
mediaQuery.addEventListener('change', handleChange);
|
15190
|
+
return () => {
|
15191
|
+
mediaQuery.removeEventListener('change', handleChange);
|
15192
|
+
};
|
15193
|
+
}, []);
|
15194
|
+
return matches;
|
15195
|
+
};
|
15196
|
+
|
15197
|
+
const useIsLargeScreen = () => useMatchMedia('(min-width: 1024px)', window.innerWidth > 1024);
|
15198
|
+
|
15199
|
+
const SidebarBackdrop = /*#__PURE__*/React__default.forwardRef(function SidebarBackdrop(props, ref) {
|
15200
|
+
const internalRef = useMergedRef(ref);
|
15201
|
+
React__default.useEffect(() => {
|
15202
|
+
if (internalRef.current) {
|
15203
|
+
internalRef.current.style.opacity = '1'; // Trigger the animation
|
15204
|
+
}
|
15205
|
+
|
15206
|
+
return () => {
|
15207
|
+
if (internalRef.current) {
|
15208
|
+
internalRef.current.style.opacity = '0'; // Reset to the initial value
|
15209
|
+
}
|
15210
|
+
};
|
15211
|
+
}, []);
|
15212
|
+
return /*#__PURE__*/React__default.createElement(Backdrop, Object.assign({}, props, {
|
15213
|
+
className: "absolute z-[1] opacity-0 transition-opacity duration-300",
|
15214
|
+
ref: internalRef
|
15215
|
+
}));
|
15216
|
+
});
|
15217
|
+
const Sidebar = /*#__PURE__*/React__default.forwardRef(function LayoutSidebar(props, ref) {
|
15218
|
+
const {
|
15219
|
+
children,
|
15220
|
+
...attributes
|
15221
|
+
} = props;
|
15222
|
+
const {
|
15223
|
+
sidebarOpen,
|
15224
|
+
setSidebarOpen
|
15225
|
+
} = React__default.useContext(LayoutContext);
|
15226
|
+
const isLargeScreen = useIsLargeScreen();
|
15227
|
+
const isSmallScreen = !isLargeScreen;
|
15228
|
+
// if it's a large screen we override the open state and make it always visible
|
15229
|
+
const isVisible = isLargeScreen || sidebarOpen;
|
15230
|
+
// ensures the menu is always closed by default when resizing to a smaller window size
|
15231
|
+
React__default.useEffect(() => {
|
15232
|
+
setSidebarOpen(isLargeScreen);
|
15233
|
+
}, [isLargeScreen]);
|
15234
|
+
React__default.useEffect(() => {
|
15235
|
+
const handleEscapeKey = event => {
|
15236
|
+
if (event.key === 'Escape') {
|
15237
|
+
event.preventDefault();
|
15238
|
+
event.stopPropagation();
|
15239
|
+
setSidebarOpen(false);
|
15240
|
+
}
|
15241
|
+
};
|
15242
|
+
if (isSmallScreen && sidebarOpen) {
|
15243
|
+
window.addEventListener('keydown', handleEscapeKey);
|
15244
|
+
}
|
15245
|
+
return () => {
|
15246
|
+
window.removeEventListener('keydown', handleEscapeKey);
|
15247
|
+
};
|
15248
|
+
}, [isSmallScreen, sidebarOpen]);
|
15249
|
+
const showBackdrop = isSmallScreen && sidebarOpen === true;
|
15250
|
+
const className = cn('bg-grey-50 h-full w-64 flex-shrink-0 flex-grow-0', {
|
15251
|
+
'transition-[transform] duration-300 absolute z-10 aria-hidden:-translate-x-64': isSmallScreen,
|
15252
|
+
'border-r-2 border-black/[.08] ': !showBackdrop
|
15253
|
+
}, props.className);
|
15254
|
+
const toggleSidebar = () => setSidebarOpen(open => !open);
|
15255
|
+
const content = typeof children === 'function' ? children({
|
15256
|
+
isLargeScreen,
|
15257
|
+
open: sidebarOpen,
|
15258
|
+
toggleSidebar
|
15259
|
+
}) : children;
|
15260
|
+
if (!content) {
|
15261
|
+
return null;
|
15262
|
+
}
|
15263
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("nav", Object.assign({}, attributes, {
|
15264
|
+
"data-responsive": isSmallScreen,
|
15265
|
+
"aria-hidden": !isVisible,
|
15266
|
+
className: className,
|
15267
|
+
ref: ref
|
15268
|
+
}), content), showBackdrop ? /*#__PURE__*/React__default.createElement(SidebarBackdrop, {
|
15269
|
+
onClick: () => setSidebarOpen(false)
|
15270
|
+
}) : null);
|
15271
|
+
});
|
15272
|
+
|
15273
|
+
const Top = props => {
|
15274
|
+
const {
|
15275
|
+
setSidebarOpen
|
15276
|
+
} = React__default.useContext(LayoutContext);
|
15277
|
+
const toggleSidebar = () => setSidebarOpen(open => !open);
|
15278
|
+
return typeof props.children === 'function' ? props.children({
|
15279
|
+
toggleSidebar
|
15280
|
+
}) : props.children;
|
15281
|
+
};
|
15282
|
+
|
15283
|
+
const Page = /*#__PURE__*/React__default.forwardRef(function LayoutPage(props, ref) {
|
15284
|
+
const className = cn('flex flex-grow overflow-hidden relative', props.className);
|
15285
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
|
15286
|
+
className: className,
|
15287
|
+
ref: ref
|
15288
|
+
}));
|
15289
|
+
});
|
15290
|
+
|
15291
|
+
const Layout$1 = /*#__PURE__*/React__default.forwardRef(function Layout(props, ref) {
|
15292
|
+
const [sidebarOpen, setSidebarOpen] = React__default.useState(false);
|
15293
|
+
const className = cn('flex h-screen w-screen flex-col overflow-hidden relative', props.className);
|
15294
|
+
return /*#__PURE__*/React__default.createElement(LayoutContext.Provider, {
|
15295
|
+
value: {
|
15296
|
+
sidebarOpen,
|
15297
|
+
setSidebarOpen
|
15298
|
+
}
|
15299
|
+
}, /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
|
15300
|
+
className: className,
|
15301
|
+
ref: ref
|
15302
|
+
})));
|
15303
|
+
});
|
15304
|
+
Layout$1.Top = Top;
|
15305
|
+
Layout$1.Page = Page;
|
15306
|
+
Layout$1.Sidebar = Sidebar;
|
15307
|
+
Layout$1.Content = Content$9;
|
14016
15308
|
|
14017
|
-
const
|
15309
|
+
const Group$3 = /*#__PURE__*/React__default.forwardRef(function Group(props, ref) {
|
14018
15310
|
const {
|
14019
|
-
id,
|
14020
|
-
defaultId,
|
14021
15311
|
children,
|
14022
|
-
|
14023
|
-
|
14024
|
-
|
15312
|
+
defaultExpanded = false,
|
15313
|
+
heading,
|
15314
|
+
onClick,
|
15315
|
+
...attributes
|
14025
15316
|
} = props;
|
14026
|
-
const
|
14027
|
-
|
14028
|
-
|
14029
|
-
|
15317
|
+
const [expanded, setExpanded] = React__default.useState(defaultExpanded);
|
15318
|
+
const className = cn('flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black/[.06] focus-visible:yt-focus-dark', attributes.className);
|
15319
|
+
const handleClick = event => {
|
15320
|
+
setExpanded(!expanded);
|
15321
|
+
if (onClick) {
|
15322
|
+
onClick(event);
|
15323
|
+
}
|
15324
|
+
};
|
15325
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
15326
|
+
role: "none",
|
15327
|
+
className: "[[role=menubar]>&]:px-3"
|
15328
|
+
}, /*#__PURE__*/React__default.createElement("button", Object.assign({}, attributes, {
|
15329
|
+
"aria-haspopup": "true",
|
15330
|
+
"aria-expanded": expanded,
|
15331
|
+
"data-taco": "navigation2-group",
|
14030
15332
|
className: className,
|
14031
|
-
|
14032
|
-
defaultValue: defaultId,
|
14033
|
-
dir: "ltr",
|
14034
|
-
onValueChange: onChange,
|
14035
|
-
orientation: orientation,
|
15333
|
+
onClick: handleClick,
|
14036
15334
|
ref: ref,
|
14037
|
-
|
14038
|
-
}),
|
15335
|
+
role: "menuitem"
|
15336
|
+
}), /*#__PURE__*/React__default.createElement(Icon, {
|
15337
|
+
className: "-ml-2 !h-5 !w-5",
|
15338
|
+
name: expanded ? 'chevron-down-solid' : 'chevron-right-solid'
|
15339
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
15340
|
+
className: "flex-grow truncate"
|
15341
|
+
}, heading)), /*#__PURE__*/React__default.createElement("ul", {
|
15342
|
+
className: cn('mb-0 flex flex-col gap-y-px pt-px', {
|
15343
|
+
hidden: !expanded
|
15344
|
+
}),
|
15345
|
+
role: "menu"
|
15346
|
+
}, children));
|
14039
15347
|
});
|
14040
|
-
|
14041
|
-
|
14042
|
-
|
14043
|
-
|
14044
|
-
|
14045
|
-
|
15348
|
+
|
15349
|
+
const getAdjacentClasses = () => cn(
|
15350
|
+
// styling if the element is proceeded by a link item
|
15351
|
+
'[[role=menubar]>[data-taco=navigation2-link-item]+&]:mt-2', "[[role=menubar]>[data-taco='navigation2-link-item']+&]:border-t-2", "[[role=menubar]>[data-taco='navigation2-link-item']+&]:pt-2 ",
|
15352
|
+
// styling if the element is proceeded by content
|
15353
|
+
"[[role=menubar]>[data-taco='navigation2-content']+&]:border-t-2", "[[role=menubar]>[data-taco='navigation2-content']+&]:pt-2",
|
15354
|
+
// styling if the element is proceeded by a section
|
15355
|
+
"[[role=menubar]>[data-taco='navigation2-section']+&]:border-t-2", "[[role=menubar]>[data-taco='navigation2-section']+&]:pt-2");
|
15356
|
+
|
15357
|
+
const getNavigationLinkClasses = (isDraggedOver = false) => cn('group relative flex w-full items-center rounded leading-8 !text-black px-2 focus-visible:yt-focus-dark',
|
15358
|
+
// override styles for links that are children of collapsible menus
|
15359
|
+
'font-bold [[role=menu]>li>&]:font-normal [[role=menu]>li>&]:pl-5',
|
15360
|
+
// override styles to adjust icons included in menu links
|
15361
|
+
'[&_[data-taco="icon"]]:!h-5 [&_[data-taco="icon"]]:!w-5',
|
15362
|
+
// override styles to adjust badges included in menu links
|
15363
|
+
'[&>span_[data-taco="badge"]]:mr-2.5 [[role=menu]>li>&>span_[data-taco="badge"]]:mr-2', {
|
15364
|
+
'hover:bg-black/[.06] aria-current-page:bg-blue-500/[.1]': !isDraggedOver,
|
15365
|
+
'!bg-blue-500 !text-white [&>*]:!text-white': isDraggedOver
|
14046
15366
|
});
|
14047
|
-
const
|
15367
|
+
const Link$2 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
|
14048
15368
|
const {
|
14049
|
-
|
14050
|
-
|
14051
|
-
|
15369
|
+
active,
|
15370
|
+
children,
|
15371
|
+
icon,
|
15372
|
+
menu,
|
15373
|
+
onDrop,
|
15374
|
+
total,
|
15375
|
+
...attributes
|
14052
15376
|
} = props;
|
14053
|
-
const
|
14054
|
-
|
15377
|
+
const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);
|
15378
|
+
const className = cn(getNavigationLinkClasses(isDraggedOver), attributes.className);
|
15379
|
+
const listClassName = cn('[[role=menubar]>&]:px-3 border-grey-200', getAdjacentClasses(), {
|
15380
|
+
'[&>*]:pointer-events-none': isDraggedOver
|
15381
|
+
});
|
15382
|
+
return /*#__PURE__*/React__default.createElement("li", Object.assign({}, dropTargetProps, {
|
15383
|
+
className: listClassName,
|
15384
|
+
"data-taco": "navigation2-link-item",
|
15385
|
+
role: "none"
|
15386
|
+
}), /*#__PURE__*/React__default.createElement("a", Object.assign({}, attributes, {
|
15387
|
+
"aria-current": active ? 'page' : undefined,
|
14055
15388
|
className: className,
|
14056
|
-
|
15389
|
+
"data-taco": "navigation2-link",
|
14057
15390
|
ref: ref,
|
14058
|
-
|
14059
|
-
|
14060
|
-
|
14061
|
-
|
14062
|
-
|
15391
|
+
role: "menuitem",
|
15392
|
+
tabIndex: 0
|
15393
|
+
}), icon ? /*#__PURE__*/React__default.createElement(Icon, {
|
15394
|
+
className: "mr-1.5 [[role=menu]>li>a>&]:mr-0.5 [[role=menu]>li>a>&]:-ml-1.5",
|
15395
|
+
name: icon
|
15396
|
+
}) : null, /*#__PURE__*/React__default.createElement("span", {
|
15397
|
+
className: "flex flex-grow items-center truncate"
|
15398
|
+
}, children), menu ? /*#__PURE__*/React__default.createElement(IconButton, {
|
15399
|
+
appearance: "discrete",
|
15400
|
+
icon: "more",
|
15401
|
+
"aria-label": "More",
|
15402
|
+
rounded: true,
|
15403
|
+
className: cn('-mr-1.5 hidden flex-shrink-0 flex-grow-0 transition-none group-hover:flex aria-expanded:flex', {
|
15404
|
+
'absolute right-0 !mr-0.5': total !== undefined
|
15405
|
+
}),
|
15406
|
+
menu: menu,
|
15407
|
+
onClick: event => {
|
15408
|
+
event.preventDefault();
|
15409
|
+
event.stopPropagation();
|
15410
|
+
}
|
15411
|
+
}) : null, total !== undefined ? /*#__PURE__*/React__default.createElement(Badge, {
|
15412
|
+
className: cn('flex-shrink-0 flex-grow-0 !font-normal', {
|
15413
|
+
'group-hover:hidden [[aria-expanded="true"]+&]:hidden ': menu
|
15414
|
+
}),
|
15415
|
+
color: "transparent"
|
15416
|
+
}, total) : null));
|
14063
15417
|
});
|
14064
|
-
|
15418
|
+
|
15419
|
+
const Section = /*#__PURE__*/React__default.forwardRef(function Navigation2(props, ref) {
|
14065
15420
|
const {
|
14066
|
-
|
14067
|
-
|
15421
|
+
children,
|
15422
|
+
heading,
|
15423
|
+
...attributes
|
14068
15424
|
} = props;
|
14069
|
-
const className = cn('
|
14070
|
-
return /*#__PURE__*/
|
15425
|
+
const className = cn('w-full overflow-auto px-3 py-2 flex-grow border-grey-200 bg-grey-50 [[role=menubar]>&:first-child]:pt-0', getAdjacentClasses(), props.className);
|
15426
|
+
return /*#__PURE__*/React__default.createElement("li", Object.assign({}, attributes, {
|
14071
15427
|
className: className,
|
15428
|
+
"data-taco": "navigation2-section",
|
14072
15429
|
ref: ref,
|
14073
|
-
|
14074
|
-
})
|
15430
|
+
role: "none"
|
15431
|
+
}), heading ? /*#__PURE__*/React__default.createElement("span", {
|
15432
|
+
className: "text-grey-500 mb-px truncate pl-5 text-xs font-bold uppercase leading-8 lg:hidden"
|
15433
|
+
}, heading) : null, /*#__PURE__*/React__default.createElement("ul", {
|
15434
|
+
className: "mb-0 flex flex-col gap-y-px"
|
15435
|
+
}, children));
|
14075
15436
|
});
|
14076
|
-
Tabs.List = TabList;
|
14077
|
-
Tabs.Trigger = TabTrigger;
|
14078
|
-
Tabs.Content = TabContent;
|
14079
15437
|
|
14080
|
-
const
|
15438
|
+
const Content$a = /*#__PURE__*/React__default.forwardRef(function Navigation2(props, ref) {
|
14081
15439
|
const {
|
14082
|
-
|
14083
|
-
|
14084
|
-
invalid,
|
14085
|
-
onKeyDown,
|
14086
|
-
...otherProps
|
15440
|
+
children,
|
15441
|
+
...attributes
|
14087
15442
|
} = props;
|
14088
|
-
const
|
14089
|
-
|
14090
|
-
|
14091
|
-
|
14092
|
-
|
14093
|
-
|
14094
|
-
|
14095
|
-
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
14096
|
-
event.currentTarget.setSelectionRange(position, position);
|
14097
|
-
event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;
|
14098
|
-
}
|
14099
|
-
if (onKeyDown) {
|
14100
|
-
onKeyDown(event);
|
14101
|
-
}
|
14102
|
-
};
|
14103
|
-
return /*#__PURE__*/React.createElement("textarea", Object.assign({}, otherProps, {
|
14104
|
-
className: classNames,
|
14105
|
-
"data-taco": "textarea",
|
14106
|
-
onKeyDown: handleKeyDown,
|
14107
|
-
ref: ref
|
14108
|
-
}));
|
15443
|
+
const className = cn('w-full overflow-auto p-3 mt-auto border-grey-200 flex-shrink-0 z-10 bg-grey-50 [[role=menubar]>&:last-child]:pb-0', getAdjacentClasses(), props.className);
|
15444
|
+
return /*#__PURE__*/React__default.createElement("li", Object.assign({}, attributes, {
|
15445
|
+
className: className,
|
15446
|
+
"data-taco": "navigation2-content",
|
15447
|
+
ref: ref,
|
15448
|
+
role: "none"
|
15449
|
+
}), children);
|
14109
15450
|
});
|
14110
15451
|
|
14111
|
-
const
|
14112
|
-
continuous,
|
14113
|
-
index,
|
14114
|
-
isLastStep,
|
14115
|
-
step,
|
14116
|
-
backProps,
|
14117
|
-
primaryProps,
|
14118
|
-
skipProps,
|
14119
|
-
tooltipProps,
|
14120
|
-
size,
|
14121
|
-
locale,
|
14122
|
-
disableTourSkipOnEsc
|
14123
|
-
}) => {
|
14124
|
-
const skipButtonRef = React.useRef(null);
|
14125
|
-
React.useEffect(() => {
|
14126
|
-
const onWindowKeyDown = event => {
|
14127
|
-
if (!disableTourSkipOnEsc) {
|
14128
|
-
if (event.key === 'Escape' && skipButtonRef.current !== null) {
|
14129
|
-
event.preventDefault();
|
14130
|
-
skipButtonRef.current.click();
|
14131
|
-
return;
|
14132
|
-
}
|
14133
|
-
}
|
14134
|
-
};
|
14135
|
-
window.addEventListener('keydown', onWindowKeyDown);
|
14136
|
-
return () => {
|
14137
|
-
window.removeEventListener('keydown', onWindowKeyDown);
|
14138
|
-
};
|
14139
|
-
}, []);
|
14140
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, tooltipProps, {
|
14141
|
-
className: "yt-tour__step w-88 relative rounded bg-white p-4"
|
14142
|
-
}), /*#__PURE__*/React.createElement(IconButton, Object.assign({}, skipProps, {
|
14143
|
-
ref: skipButtonRef,
|
14144
|
-
appearance: "discrete",
|
14145
|
-
icon: "close",
|
14146
|
-
title: locale.skip,
|
14147
|
-
"aria-label": locale.skip,
|
14148
|
-
className: "absolute top-0 right-0 mt-1 mr-1"
|
14149
|
-
})), step.title && /*#__PURE__*/React.createElement("h5", null, step.title), step.content, /*#__PURE__*/React.createElement(Group, {
|
14150
|
-
className: "mt-4 justify-end"
|
14151
|
-
}, index > 0 && /*#__PURE__*/React.createElement(Button$1, Object.assign({}, backProps, {
|
14152
|
-
appearance: "discrete"
|
14153
|
-
}), locale.back), /*#__PURE__*/React.createElement(Button$1, Object.assign({}, primaryProps, {
|
14154
|
-
appearance: "primary"
|
14155
|
-
}), continuous ? isLastStep ? `${locale.last} (${index + 1}/${size})` : `${locale.next} (${index + 1}/${size})` : locale.close)));
|
14156
|
-
};
|
14157
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
14158
|
-
const TourStep = _props => null;
|
14159
|
-
const Tour = props => {
|
14160
|
-
const {
|
14161
|
-
texts: {
|
14162
|
-
tour
|
14163
|
-
}
|
14164
|
-
} = useLocalization();
|
15452
|
+
const Navigation2 = /*#__PURE__*/React__default.forwardRef(function Navigation2(props, ref) {
|
14165
15453
|
const {
|
14166
|
-
|
14167
|
-
|
14168
|
-
onClose,
|
14169
|
-
onReady,
|
14170
|
-
spotlightClicks,
|
14171
|
-
disableCloseOnEsc: disableTourSkipOnEsc,
|
14172
|
-
disableScrollParentFix = false,
|
14173
|
-
scrollOffset,
|
14174
|
-
...rest
|
15454
|
+
children,
|
15455
|
+
...attributes
|
14175
15456
|
} = props;
|
14176
|
-
const
|
14177
|
-
|
14178
|
-
|
14179
|
-
|
14180
|
-
|
14181
|
-
|
14182
|
-
|
14183
|
-
|
14184
|
-
};
|
14185
|
-
return step;
|
14186
|
-
});
|
14187
|
-
}, [props.children]);
|
14188
|
-
const getStep = React.useCallback(selector => {
|
14189
|
-
var _props$children$find;
|
14190
|
-
return (_props$children$find = props.children.find(child => child.props.selector === selector)) === null || _props$children$find === void 0 ? void 0 : _props$children$find.props;
|
14191
|
-
}, [props.children]);
|
14192
|
-
const callback = state => {
|
14193
|
-
if (state.action === Joyride.ACTIONS.SKIP && state.lifecycle === Joyride.LIFECYCLE.COMPLETE) {
|
14194
|
-
if (onClose) {
|
14195
|
-
onClose(getStep(state.step.target));
|
14196
|
-
}
|
14197
|
-
}
|
14198
|
-
if (state.type === Joyride.EVENTS.TOUR_END) {
|
14199
|
-
if (onComplete) {
|
14200
|
-
onComplete();
|
14201
|
-
}
|
14202
|
-
}
|
14203
|
-
if (state.lifecycle === Joyride.LIFECYCLE.READY) {
|
14204
|
-
if (onReady) {
|
14205
|
-
onReady(getStep(state.step.target));
|
14206
|
-
}
|
15457
|
+
const className = cn('m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-grey-50', props.className);
|
15458
|
+
return /*#__PURE__*/React__default.createElement("ul", Object.assign({}, attributes, {
|
15459
|
+
className: className,
|
15460
|
+
"data-taco": "navigation2",
|
15461
|
+
ref: ref,
|
15462
|
+
role: "menubar",
|
15463
|
+
style: {
|
15464
|
+
opacity: 0.999
|
14207
15465
|
}
|
14208
|
-
};
|
14209
|
-
|
14210
|
-
|
14211
|
-
|
14212
|
-
|
14213
|
-
|
14214
|
-
disableAnimation: true
|
14215
|
-
},
|
14216
|
-
tooltipComponent: tooltipProps => /*#__PURE__*/React.createElement(Tooltip$1, Object.assign({}, tooltipProps, {
|
14217
|
-
locale: tour,
|
14218
|
-
disableTourSkipOnEsc: disableTourSkipOnEsc
|
14219
|
-
})),
|
14220
|
-
locale: tour,
|
14221
|
-
spotlightPadding: 8,
|
14222
|
-
spotlightClicks: spotlightClicks,
|
14223
|
-
disableScrollParentFix: disableScrollParentFix,
|
14224
|
-
callback: callback,
|
14225
|
-
scrollOffset: scrollOffset,
|
14226
|
-
styles: {
|
14227
|
-
/** style beacon */
|
14228
|
-
options: {
|
14229
|
-
// tailwind.theme.colors.blue.300
|
14230
|
-
primaryColor: '#6ba4ff'
|
14231
|
-
}
|
14232
|
-
},
|
14233
|
-
disableCloseOnEsc: true
|
14234
|
-
}));
|
14235
|
-
};
|
14236
|
-
Tour.Step = TourStep;
|
15466
|
+
}), children);
|
15467
|
+
});
|
15468
|
+
Navigation2.Group = Group$3;
|
15469
|
+
Navigation2.Link = Link$2;
|
15470
|
+
Navigation2.Section = Section;
|
15471
|
+
Navigation2.Content = Content$a;
|
14237
15472
|
|
14238
15473
|
const useOnClickOutside = (ref, callback) => {
|
14239
15474
|
React__default.useEffect(() => {
|
@@ -14265,23 +15500,28 @@ exports.Button = Button$1;
|
|
14265
15500
|
exports.Calendar = Calendar$1;
|
14266
15501
|
exports.Card = Card;
|
14267
15502
|
exports.Checkbox = Checkbox;
|
15503
|
+
exports.CollectionPrimitive = Collection;
|
14268
15504
|
exports.Combobox = Combobox;
|
14269
15505
|
exports.Datepicker = Datepicker;
|
14270
15506
|
exports.Dialog = Dialog;
|
15507
|
+
exports.Drawer = Drawer;
|
14271
15508
|
exports.Field = Field;
|
14272
15509
|
exports.Form = Form;
|
14273
15510
|
exports.Group = Group;
|
14274
15511
|
exports.Hanger = Hanger;
|
15512
|
+
exports.Header = Header$2;
|
14275
15513
|
exports.HoverCard = HoverCard;
|
14276
15514
|
exports.Icon = Icon;
|
14277
15515
|
exports.IconButton = IconButton;
|
14278
15516
|
exports.Input = Input;
|
15517
|
+
exports.Layout = Layout$1;
|
14279
15518
|
exports.Listbox = Listbox;
|
14280
15519
|
exports.LocalizationContext = LocalizationContext;
|
14281
15520
|
exports.LocalizationProvider = LocalizationProvider;
|
14282
15521
|
exports.Menu = Menu$1;
|
14283
15522
|
exports.MultiListbox = MultiListbox;
|
14284
15523
|
exports.Navigation = Navigation;
|
15524
|
+
exports.Navigation2 = Navigation2;
|
14285
15525
|
exports.PaginatedTable = PaginatedTable;
|
14286
15526
|
exports.Pagination = Pagination;
|
14287
15527
|
exports.Popover = Popover;
|
@@ -14299,7 +15539,7 @@ exports.Table2 = Table2;
|
|
14299
15539
|
exports.Tabs = Tabs;
|
14300
15540
|
exports.Tag = Tag$1;
|
14301
15541
|
exports.Textarea = Textarea;
|
14302
|
-
exports.Title = Title$
|
15542
|
+
exports.Title = Title$3;
|
14303
15543
|
exports.ToastProvider = ToastProvider;
|
14304
15544
|
exports.Tooltip = Tooltip;
|
14305
15545
|
exports.Tour = Tour;
|
@@ -14312,6 +15552,7 @@ exports.defaultLocalisationTexts = defaultLocalisationTexts;
|
|
14312
15552
|
exports.findByValue = findByValue$1;
|
14313
15553
|
exports.format = format;
|
14314
15554
|
exports.getByRowIndexPath = getByRowIndexPath;
|
15555
|
+
exports.getNavigationLinkClasses = getNavigationLinkClasses;
|
14315
15556
|
exports.getNextIndexFromKey = getNextIndexFromKey;
|
14316
15557
|
exports.getParentRowIndexPath = getParentRowIndexPath;
|
14317
15558
|
exports.getRadioGroupItemValueAsString = getRadioGroupItemValueAsString;
|
@@ -14323,11 +15564,14 @@ exports.parseFromCustomString = parseFromCustomString;
|
|
14323
15564
|
exports.parseFromISOString = parseFromISOString;
|
14324
15565
|
exports.removeChildTableRow = removeChildTableRow;
|
14325
15566
|
exports.setByRowIndexPath = setByRowIndexPath;
|
15567
|
+
exports.useBoundaryOverflowDetection = useBoundaryOverflowDetection;
|
14326
15568
|
exports.useBoundingClientRectListener = useBoundingClientRectListener;
|
14327
15569
|
exports.useDropTarget = useDropTarget;
|
15570
|
+
exports.useIsLargeScreen = useIsLargeScreen;
|
14328
15571
|
exports.useListKeyboardNavigation = useListKeyboardNavigation;
|
14329
15572
|
exports.useListScrollTo = useListScrollTo;
|
14330
15573
|
exports.useLocalization = useLocalization;
|
15574
|
+
exports.useMatchMedia = useMatchMedia;
|
14331
15575
|
exports.useMergedRef = useMergedRef;
|
14332
15576
|
exports.useOnClickOutside = useOnClickOutside;
|
14333
15577
|
exports.usePagination = usePagination;
|