@economic/taco 1.25.3 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +5 -0
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js +46 -0
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +1 -1
- 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/Select/useSelect.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js +48 -0
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -0
- package/dist/esm/packages/taco/src/index.js +6 -4
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/hooks/useIntersectionObserver.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/taco.cjs.development.js +823 -741
- 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 +2 -2
|
@@ -10,6 +10,9 @@ var cn = _interopDefault(require('classnames'));
|
|
|
10
10
|
var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
11
11
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
12
12
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
13
|
+
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
14
|
+
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
|
15
|
+
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
13
16
|
var ReactDayPicker = _interopDefault(require('react-day-picker'));
|
|
14
17
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
15
18
|
var uuid = require('uuid');
|
|
@@ -21,10 +24,7 @@ var interactions = require('@react-aria/interactions');
|
|
|
21
24
|
var framerMotion = require('framer-motion');
|
|
22
25
|
var focus = require('@react-aria/focus');
|
|
23
26
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
24
|
-
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
|
25
27
|
var HoverCardPrimitive = require('@radix-ui/react-hover-card');
|
|
26
|
-
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
27
|
-
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
28
28
|
var reactTable = require('react-table');
|
|
29
29
|
var reactIntersectionObserver = require('react-intersection-observer');
|
|
30
30
|
var reactWindow = require('react-window');
|
|
@@ -3998,241 +3998,732 @@ const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
|
3998
3998
|
}, button);
|
|
3999
3999
|
});
|
|
4000
4000
|
|
|
4001
|
-
|
|
4002
|
-
const
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
value = new Date()
|
|
4011
|
-
}) => {
|
|
4012
|
-
const {
|
|
4013
|
-
texts: {
|
|
4014
|
-
calendar: {
|
|
4015
|
-
actions,
|
|
4016
|
-
months
|
|
4001
|
+
// merges an external ref (optional) with an internal ref (required)
|
|
4002
|
+
const useMergedRef = ref => {
|
|
4003
|
+
const internalRef = React__default.useRef(null);
|
|
4004
|
+
React__default.useEffect(() => {
|
|
4005
|
+
if (ref) {
|
|
4006
|
+
if (typeof ref === 'function') {
|
|
4007
|
+
ref(internalRef.current);
|
|
4008
|
+
} else {
|
|
4009
|
+
ref.current = internalRef.current;
|
|
4017
4010
|
}
|
|
4018
4011
|
}
|
|
4019
|
-
}
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
} = event.target.form;
|
|
4025
|
-
onMonthChange(new Date(year.value, month.value));
|
|
4026
|
-
};
|
|
4027
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4028
|
-
className: "mb-2 flex items-center justify-between"
|
|
4029
|
-
}, /*#__PURE__*/React.createElement("form", {
|
|
4030
|
-
className: "inline-flex space-x-1"
|
|
4031
|
-
}, /*#__PURE__*/React.createElement("select", {
|
|
4032
|
-
className: "h-8 px-2",
|
|
4033
|
-
name: "month",
|
|
4034
|
-
onChange: handleChange,
|
|
4035
|
-
value: value.getMonth()
|
|
4036
|
-
}, months.map((month, i) => /*#__PURE__*/React.createElement("option", {
|
|
4037
|
-
key: month,
|
|
4038
|
-
value: i
|
|
4039
|
-
}, month))), /*#__PURE__*/React.createElement("select", {
|
|
4040
|
-
className: "h-8 px-2",
|
|
4041
|
-
name: "year",
|
|
4042
|
-
onChange: handleChange,
|
|
4043
|
-
value: value.getFullYear()
|
|
4044
|
-
}, years.map(year => /*#__PURE__*/React.createElement("option", {
|
|
4045
|
-
key: year,
|
|
4046
|
-
value: year
|
|
4047
|
-
}, String(year))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconButton, {
|
|
4048
|
-
appearance: "discrete",
|
|
4049
|
-
icon: "chevron-left",
|
|
4050
|
-
"aria-label": actions.previousMonth,
|
|
4051
|
-
onClick: () => onPreviousClick(),
|
|
4052
|
-
rounded: true
|
|
4053
|
-
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
4054
|
-
appearance: "discrete",
|
|
4055
|
-
icon: "chevron-right",
|
|
4056
|
-
"aria-label": actions.nextMonth,
|
|
4057
|
-
onClick: () => onNextClick(),
|
|
4058
|
-
rounded: true
|
|
4059
|
-
})));
|
|
4060
|
-
});
|
|
4061
|
-
const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4012
|
+
}, [ref]);
|
|
4013
|
+
return internalRef;
|
|
4014
|
+
};
|
|
4015
|
+
|
|
4016
|
+
const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
4062
4017
|
const {
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
disabledDays,
|
|
4018
|
+
as: Tag = 'span',
|
|
4019
|
+
orientation = 'horizontal',
|
|
4066
4020
|
...otherProps
|
|
4067
4021
|
} = props;
|
|
4068
|
-
const {
|
|
4069
|
-
|
|
4070
|
-
texts
|
|
4071
|
-
} = useLocalization();
|
|
4072
|
-
const [visibleMonth, setVisibleMonth] = React.useState(value !== null && value !== void 0 ? value : new Date());
|
|
4073
|
-
React.useEffect(() => {
|
|
4074
|
-
if (visibleMonth !== value) {
|
|
4075
|
-
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
|
4076
|
-
}
|
|
4077
|
-
}, [value]);
|
|
4078
|
-
const handleDayClick = (date, modifiers, event) => {
|
|
4079
|
-
if (modifiers.outside || modifiers.disabled) {
|
|
4080
|
-
return;
|
|
4081
|
-
}
|
|
4082
|
-
handleChange(date, event);
|
|
4083
|
-
};
|
|
4084
|
-
const handleCalendarClickToday = () => {
|
|
4085
|
-
const today = new Date();
|
|
4086
|
-
// set to midday to avoid UTC offset causing dates to be mismatched server side
|
|
4087
|
-
today.setHours(12);
|
|
4088
|
-
today.setMinutes(0);
|
|
4089
|
-
today.setSeconds(0);
|
|
4090
|
-
handleChange(today);
|
|
4091
|
-
};
|
|
4092
|
-
const className = cn('flex bg-white text-xs p-4', otherProps.className);
|
|
4093
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4094
|
-
"data-taco": "calendar"
|
|
4095
|
-
}, /*#__PURE__*/React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
|
4096
|
-
className: className,
|
|
4097
|
-
month: visibleMonth,
|
|
4098
|
-
selectedDays: value,
|
|
4099
|
-
locale: locale.substring(0, 2),
|
|
4100
|
-
firstDayOfWeek: 1,
|
|
4101
|
-
months: texts.calendar.months,
|
|
4102
|
-
weekdaysShort: texts.calendar.weekdaysShort,
|
|
4103
|
-
navbarElement: navProps => /*#__PURE__*/React.createElement(Navbar, Object.assign({}, navProps, {
|
|
4104
|
-
onMonthChange: setVisibleMonth,
|
|
4105
|
-
value: visibleMonth
|
|
4106
|
-
})),
|
|
4107
|
-
onDayClick: handleDayClick,
|
|
4108
|
-
onMonthChange: setVisibleMonth,
|
|
4109
|
-
onTodayButtonClick: handleCalendarClickToday,
|
|
4110
|
-
captionElement: () => null,
|
|
4111
|
-
todayButton: texts.calendar.actions.today,
|
|
4112
|
-
numberOfMonths: 1,
|
|
4113
|
-
ref: ref,
|
|
4114
|
-
disabledDays: disabledDays
|
|
4115
|
-
})));
|
|
4116
|
-
});
|
|
4117
|
-
|
|
4118
|
-
const Content$2 = /*#__PURE__*/React.forwardRef(function CardContent(externalProps, ref) {
|
|
4119
|
-
const {
|
|
4120
|
-
noPadding,
|
|
4121
|
-
...props
|
|
4122
|
-
} = externalProps;
|
|
4123
|
-
const className = cn('flex-grow overflow-auto', {
|
|
4124
|
-
'mx-4 mb-4': !noPadding
|
|
4022
|
+
const className = cn('flex gap-2', {
|
|
4023
|
+
'flex-col ': orientation === 'vertical'
|
|
4125
4024
|
}, props.className);
|
|
4126
|
-
return /*#__PURE__*/React.createElement(
|
|
4025
|
+
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, otherProps, {
|
|
4127
4026
|
className: className,
|
|
4027
|
+
"data-taco": "group",
|
|
4128
4028
|
ref: ref
|
|
4129
4029
|
}));
|
|
4130
4030
|
});
|
|
4131
|
-
const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4132
|
-
const {
|
|
4133
|
-
title,
|
|
4134
|
-
menu,
|
|
4135
|
-
children
|
|
4136
|
-
} = props;
|
|
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);
|
|
4138
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4139
|
-
className: className,
|
|
4140
|
-
"data-taco": "card",
|
|
4141
|
-
ref: ref
|
|
4142
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4143
|
-
className: "mx-4 mt-4 mb-2 flex"
|
|
4144
|
-
}, title && /*#__PURE__*/React.createElement("h4", {
|
|
4145
|
-
className: "mb-0 flex-grow text-left"
|
|
4146
|
-
}, title), menu ? /*#__PURE__*/React.createElement(IconButton, {
|
|
4147
|
-
icon: "ellipsis-horizontal",
|
|
4148
|
-
appearance: "discrete",
|
|
4149
|
-
menu: menu,
|
|
4150
|
-
className: "-mt-[4px]"
|
|
4151
|
-
}) : null), children);
|
|
4152
|
-
});
|
|
4153
|
-
Card.Content = Content$2;
|
|
4154
4031
|
|
|
4155
|
-
|
|
4156
|
-
const
|
|
4157
|
-
return
|
|
4032
|
+
const MenuContext = /*#__PURE__*/React.createContext(undefined);
|
|
4033
|
+
const useCurrentMenu = () => {
|
|
4034
|
+
return React.useContext(MenuContext);
|
|
4158
4035
|
};
|
|
4159
4036
|
|
|
4160
|
-
const
|
|
4037
|
+
const Content$2 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref) {
|
|
4038
|
+
const internalRef = useMergedRef(ref);
|
|
4039
|
+
const menu = useCurrentMenu();
|
|
4161
4040
|
const {
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
invalid,
|
|
4166
|
-
label,
|
|
4167
|
-
onChange,
|
|
4041
|
+
align = 'start',
|
|
4042
|
+
children,
|
|
4043
|
+
placement: side,
|
|
4168
4044
|
...otherProps
|
|
4169
4045
|
} = props;
|
|
4170
|
-
const
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
{
|
|
4174
|
-
'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300': !props.disabled && !invalid,
|
|
4175
|
-
'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,
|
|
4176
|
-
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
|
4177
|
-
'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300': invalid && !props.disabled,
|
|
4178
|
-
'self-start': !!label
|
|
4179
|
-
}, props.className);
|
|
4180
|
-
let handleChange;
|
|
4181
|
-
if (onChange) {
|
|
4182
|
-
handleChange = checked => onChange(checked === 'indeterminate' ? false : checked);
|
|
4183
|
-
}
|
|
4184
|
-
let labelledByProps = null;
|
|
4185
|
-
if (label) {
|
|
4186
|
-
labelledByProps = {
|
|
4187
|
-
'aria-labelledby': `${id}-label`,
|
|
4188
|
-
id
|
|
4189
|
-
};
|
|
4190
|
-
}
|
|
4191
|
-
// the enter keyboard shortcut isn't supported by default, but we want it
|
|
4192
|
-
const handleKeyDown = event => {
|
|
4193
|
-
if (event.key === 'Enter') {
|
|
4194
|
-
event.currentTarget.click();
|
|
4195
|
-
}
|
|
4196
|
-
};
|
|
4197
|
-
const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
4198
|
-
"data-taco": "checkbox",
|
|
4199
|
-
checked: indeterminate ? 'indeterminate' : checked,
|
|
4046
|
+
const className = cn('border border-transparent rounded block outline-none p-1 yt-shadow wcag-white', props.className);
|
|
4047
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Portal, null, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Content, Object.assign({}, otherProps, {
|
|
4048
|
+
align: align,
|
|
4200
4049
|
className: className,
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
})));
|
|
4210
|
-
if (label) {
|
|
4211
|
-
const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
|
|
4212
|
-
'cursor-not-allowed text-grey-300': props.disabled
|
|
4213
|
-
});
|
|
4214
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
4215
|
-
className: labelContainerClassName
|
|
4216
|
-
}, element, /*#__PURE__*/React.createElement("label", {
|
|
4217
|
-
htmlFor: id,
|
|
4218
|
-
id: `${id}-label`
|
|
4219
|
-
}, label));
|
|
4220
|
-
}
|
|
4221
|
-
return element;
|
|
4050
|
+
"data-taco": "menu",
|
|
4051
|
+
side: side,
|
|
4052
|
+
sideOffset: 3,
|
|
4053
|
+
style: {
|
|
4054
|
+
minWidth: menu === null || menu === void 0 ? void 0 : menu.minWidth
|
|
4055
|
+
},
|
|
4056
|
+
ref: internalRef
|
|
4057
|
+
}), children));
|
|
4222
4058
|
});
|
|
4223
|
-
Checkbox.displayName = 'Checkbox';
|
|
4224
4059
|
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4060
|
+
const Icon$1 = ({
|
|
4061
|
+
name
|
|
4062
|
+
}) => /*#__PURE__*/React.createElement("span", {
|
|
4063
|
+
className: "absolute left-0 ml-1"
|
|
4064
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4065
|
+
className: "-ml-px -mt-px !h-5 !w-5",
|
|
4066
|
+
name: name
|
|
4067
|
+
}));
|
|
4068
|
+
const useItemStyling = ({
|
|
4069
|
+
disabled,
|
|
4070
|
+
indented,
|
|
4071
|
+
className
|
|
4072
|
+
}) => {
|
|
4073
|
+
const menu = useCurrentMenu();
|
|
4074
|
+
React.useEffect(() => {
|
|
4075
|
+
if (indented && !(menu !== null && menu !== void 0 && menu.indented)) {
|
|
4076
|
+
menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
|
|
4077
|
+
}
|
|
4078
|
+
}, [indented]);
|
|
4079
|
+
return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', {
|
|
4080
|
+
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
4081
|
+
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
|
|
4082
|
+
'cursor-pointer text-black hover:wcag-grey-200 data-[highlighted]:wcag-grey-200': !disabled,
|
|
4083
|
+
'cursor-not-allowed hover:bg-white text-grey-300': disabled
|
|
4084
|
+
}, className);
|
|
4085
|
+
};
|
|
4086
|
+
const Shortcut = props => {
|
|
4087
|
+
return /*#__PURE__*/React.createElement("span", Object.assign({}, props, {
|
|
4088
|
+
className: "text-grey-700 ml-auto pl-3"
|
|
4089
|
+
}));
|
|
4090
|
+
};
|
|
4091
|
+
const Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
|
|
4092
|
+
var _props$disabled;
|
|
4093
|
+
const {
|
|
4094
|
+
dialog,
|
|
4095
|
+
icon,
|
|
4096
|
+
onClick,
|
|
4097
|
+
shortcut,
|
|
4098
|
+
...otherProps
|
|
4099
|
+
} = props;
|
|
4100
|
+
const menu = useCurrentMenu();
|
|
4101
|
+
const className = useItemStyling({
|
|
4102
|
+
disabled: props.disabled,
|
|
4103
|
+
indented: !!icon,
|
|
4104
|
+
className: props.className
|
|
4105
|
+
});
|
|
4106
|
+
const disabled = (_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : props['aria-disabled'];
|
|
4107
|
+
let handleClick;
|
|
4108
|
+
// radix has a bug that does not disable clicks when disabled is set on items
|
|
4109
|
+
if (disabled) {
|
|
4110
|
+
handleClick = event => {
|
|
4111
|
+
event.preventDefault();
|
|
4112
|
+
event.stopPropagation();
|
|
4113
|
+
};
|
|
4114
|
+
}
|
|
4115
|
+
const handleSelect = event => {
|
|
4116
|
+
if (onClick) {
|
|
4117
|
+
onClick(event);
|
|
4118
|
+
}
|
|
4119
|
+
if (props['aria-haspopup'] || typeof dialog === 'function') {
|
|
4120
|
+
event.preventDefault();
|
|
4121
|
+
}
|
|
4122
|
+
};
|
|
4123
|
+
let button = /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Item, Object.assign({}, otherProps, {
|
|
4124
|
+
className: className,
|
|
4125
|
+
onClick: handleClick,
|
|
4126
|
+
onSelect: handleSelect,
|
|
4127
|
+
ref: ref
|
|
4128
|
+
}), icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
4129
|
+
name: icon
|
|
4130
|
+
}), props.children, shortcut && /*#__PURE__*/React.createElement(Shortcut, null, shortcut));
|
|
4131
|
+
if (typeof dialog === 'function') {
|
|
4132
|
+
button = dialog({
|
|
4133
|
+
trigger: button,
|
|
4134
|
+
onClose: menu === null || menu === void 0 ? void 0 : menu.close
|
|
4135
|
+
});
|
|
4136
|
+
}
|
|
4137
|
+
return button;
|
|
4138
|
+
});
|
|
4139
|
+
|
|
4140
|
+
const Link = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
|
|
4141
|
+
const {
|
|
4142
|
+
href,
|
|
4143
|
+
icon,
|
|
4144
|
+
onClick,
|
|
4145
|
+
...otherProps
|
|
4146
|
+
} = props;
|
|
4147
|
+
const menu = useCurrentMenu();
|
|
4148
|
+
const className = useItemStyling({
|
|
4149
|
+
disabled: props.disabled,
|
|
4150
|
+
indented: !!icon,
|
|
4151
|
+
className: props.className
|
|
4152
|
+
});
|
|
4153
|
+
const handleClick = event => {
|
|
4154
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
4155
|
+
menu === null || menu === void 0 ? void 0 : menu.close();
|
|
4156
|
+
};
|
|
4157
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Item, Object.assign({}, otherProps, {
|
|
4158
|
+
asChild: true,
|
|
4159
|
+
className: className,
|
|
4160
|
+
ref: ref,
|
|
4161
|
+
onClick: handleClick
|
|
4162
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
4163
|
+
href: href,
|
|
4164
|
+
target: "_blank"
|
|
4165
|
+
}, icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
4166
|
+
name: icon
|
|
4167
|
+
}), props.children));
|
|
4168
|
+
});
|
|
4169
|
+
|
|
4170
|
+
const Trigger$2 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
|
|
4171
|
+
const menu = useCurrentMenu();
|
|
4172
|
+
const internalRef = useMergedRef(ref);
|
|
4173
|
+
React.useEffect(() => {
|
|
4174
|
+
if (internalRef.current) {
|
|
4175
|
+
menu === null || menu === void 0 ? void 0 : menu.setMinWidth(internalRef.current.getBoundingClientRect().width);
|
|
4176
|
+
}
|
|
4177
|
+
}, [internalRef]);
|
|
4178
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
|
|
4179
|
+
asChild: true,
|
|
4180
|
+
ref: internalRef
|
|
4181
|
+
}));
|
|
4182
|
+
});
|
|
4183
|
+
|
|
4184
|
+
const Checkbox = /*#__PURE__*/React.forwardRef(function MenuCheckboxItem(props, ref) {
|
|
4185
|
+
const {
|
|
4186
|
+
checked,
|
|
4187
|
+
children,
|
|
4188
|
+
onChange,
|
|
4189
|
+
...otherProps
|
|
4190
|
+
} = props;
|
|
4191
|
+
const className = useItemStyling({
|
|
4192
|
+
disabled: props.disabled,
|
|
4193
|
+
indented: true,
|
|
4194
|
+
className: props.className
|
|
4195
|
+
});
|
|
4196
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.CheckboxItem, Object.assign({}, otherProps, {
|
|
4197
|
+
checked: checked,
|
|
4198
|
+
className: className,
|
|
4199
|
+
onCheckedChange: onChange,
|
|
4200
|
+
ref: ref
|
|
4201
|
+
}), /*#__PURE__*/React.createElement(DropdownMenuPrimitive.ItemIndicator, {
|
|
4202
|
+
className: "absolute left-0 ml-1.5"
|
|
4203
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4204
|
+
name: "tick",
|
|
4205
|
+
className: "-ml-px !h-4 !w-4"
|
|
4206
|
+
})), children);
|
|
4207
|
+
});
|
|
4208
|
+
|
|
4209
|
+
const getRadioGroupItemValueAsString = value => String(value !== null && value !== void 0 ? value : '');
|
|
4210
|
+
const findByValue = (values, valueAsString) => values.find(value => getRadioGroupItemValueAsString(value) === valueAsString);
|
|
4211
|
+
const RadioGroupContext = /*#__PURE__*/React.createContext({
|
|
4212
|
+
disabled: false,
|
|
4213
|
+
invalid: false
|
|
4214
|
+
});
|
|
4215
|
+
const RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props, ref) {
|
|
4216
|
+
const context = React.useContext(RadioGroupContext);
|
|
4217
|
+
const {
|
|
4218
|
+
children,
|
|
4219
|
+
value,
|
|
4220
|
+
...otherProps
|
|
4221
|
+
} = props;
|
|
4222
|
+
const isDisabled = context.disabled || props.disabled;
|
|
4223
|
+
const className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2', {
|
|
4224
|
+
'border-grey-300 hover:border-4 focus:yt-focus aria-checked:bg-blue-500 aria-checked:border-blue-500 hover:aria-checked:border-blue-300': !isDisabled && !context.invalid,
|
|
4225
|
+
'border-grey-200 cursor-not-allowed aria-checked:bg-blue-300 aria-checked:border-blue-300 ': isDisabled,
|
|
4226
|
+
'border-red-500 hover:border-4 text-red-500 focus:border-red-500 focus:yt-focus-red aria-checked:bg-red-500 aria-checked:border-red': context.invalid && !isDisabled
|
|
4227
|
+
});
|
|
4228
|
+
const labelClassName = cn('flex items-center gap-2', {
|
|
4229
|
+
'cursor-pointer': !isDisabled,
|
|
4230
|
+
'cursor-not-allowed text-grey-300': isDisabled
|
|
4231
|
+
}, props.className);
|
|
4232
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
4233
|
+
className: labelClassName
|
|
4234
|
+
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Item, Object.assign({}, otherProps, {
|
|
4235
|
+
className: className,
|
|
4236
|
+
disabled: isDisabled,
|
|
4237
|
+
ref: ref,
|
|
4238
|
+
value: getRadioGroupItemValueAsString(value)
|
|
4239
|
+
}), /*#__PURE__*/React.createElement(RadioGroupPrimitive.Indicator, {
|
|
4240
|
+
className: "h-2 w-2 rounded-full bg-white"
|
|
4241
|
+
})), children);
|
|
4242
|
+
});
|
|
4243
|
+
const useRadioGroup = props => {
|
|
4244
|
+
const {
|
|
4245
|
+
children,
|
|
4246
|
+
defaultValue,
|
|
4247
|
+
disabled,
|
|
4248
|
+
invalid,
|
|
4249
|
+
onChange,
|
|
4250
|
+
orientation = 'vertical',
|
|
4251
|
+
value,
|
|
4252
|
+
...otherProps
|
|
4253
|
+
} = props;
|
|
4254
|
+
const values = React.useMemo(() => {
|
|
4255
|
+
const radioGroupItemValues = [];
|
|
4256
|
+
React.Children.forEach(children, child => {
|
|
4257
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
4258
|
+
radioGroupItemValues.push(child.props.value);
|
|
4259
|
+
}
|
|
4260
|
+
});
|
|
4261
|
+
return radioGroupItemValues;
|
|
4262
|
+
}, [children]);
|
|
4263
|
+
const context = React.useMemo(() => ({
|
|
4264
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : false,
|
|
4265
|
+
invalid: invalid !== null && invalid !== void 0 ? invalid : false
|
|
4266
|
+
}), [disabled, invalid]);
|
|
4267
|
+
let valueProps;
|
|
4268
|
+
if (onChange !== undefined) {
|
|
4269
|
+
const handleChange = value => onChange(findByValue(values, value));
|
|
4270
|
+
valueProps = {
|
|
4271
|
+
onValueChange: handleChange,
|
|
4272
|
+
value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined
|
|
4273
|
+
};
|
|
4274
|
+
} else {
|
|
4275
|
+
valueProps = {
|
|
4276
|
+
defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined
|
|
4277
|
+
};
|
|
4278
|
+
}
|
|
4279
|
+
return {
|
|
4280
|
+
context,
|
|
4281
|
+
props: {
|
|
4282
|
+
...otherProps,
|
|
4283
|
+
...valueProps,
|
|
4284
|
+
children,
|
|
4285
|
+
disabled,
|
|
4286
|
+
orientation
|
|
4287
|
+
}
|
|
4288
|
+
};
|
|
4289
|
+
};
|
|
4290
|
+
const RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {
|
|
4291
|
+
const {
|
|
4292
|
+
context,
|
|
4293
|
+
props: otherProps
|
|
4294
|
+
} = useRadioGroup(props);
|
|
4295
|
+
const className = cn('flex items-start gap-y-2', {
|
|
4296
|
+
'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',
|
|
4297
|
+
'flex-col': otherProps.orientation === 'vertical'
|
|
4298
|
+
}, otherProps.className);
|
|
4299
|
+
return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
|
|
4300
|
+
value: context
|
|
4301
|
+
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Root, Object.assign({}, otherProps, {
|
|
4302
|
+
className: className,
|
|
4303
|
+
"data-taco": "radio-group",
|
|
4304
|
+
ref: ref
|
|
4305
|
+
})));
|
|
4306
|
+
});
|
|
4307
|
+
RadioGroup.Item = RadioGroupItem;
|
|
4308
|
+
|
|
4309
|
+
const RadioItem = props => {
|
|
4310
|
+
const context = React.useContext(MenuRadioGroupContext);
|
|
4311
|
+
const {
|
|
4312
|
+
children,
|
|
4313
|
+
value,
|
|
4314
|
+
...otherProps
|
|
4315
|
+
} = props;
|
|
4316
|
+
const disabled = context.disabled || props.disabled;
|
|
4317
|
+
const className = useItemStyling({
|
|
4318
|
+
disabled: disabled,
|
|
4319
|
+
indented: true,
|
|
4320
|
+
className: props.className
|
|
4321
|
+
});
|
|
4322
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.RadioItem, Object.assign({}, otherProps, {
|
|
4323
|
+
className: className,
|
|
4324
|
+
disabled: disabled,
|
|
4325
|
+
value: getRadioGroupItemValueAsString(value)
|
|
4326
|
+
}), /*#__PURE__*/React.createElement(DropdownMenuPrimitive.ItemIndicator, {
|
|
4327
|
+
className: "absolute left-0 ml-1.5"
|
|
4328
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4329
|
+
className: "ml-1 flex h-1.5 w-1.5 rounded-full bg-current "
|
|
4330
|
+
})), children);
|
|
4331
|
+
};
|
|
4332
|
+
const MenuRadioGroupContext = /*#__PURE__*/React.createContext({
|
|
4333
|
+
disabled: false
|
|
4334
|
+
});
|
|
4335
|
+
const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props, ref) {
|
|
4336
|
+
const {
|
|
4337
|
+
context,
|
|
4338
|
+
props: otherProps
|
|
4339
|
+
} = useRadioGroup(props);
|
|
4340
|
+
const className = cn('flex flex-col', props.className);
|
|
4341
|
+
return /*#__PURE__*/React.createElement(MenuRadioGroupContext.Provider, {
|
|
4342
|
+
value: context
|
|
4343
|
+
}, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.RadioGroup, Object.assign({}, otherProps, {
|
|
4344
|
+
className: className,
|
|
4345
|
+
ref: ref
|
|
4346
|
+
})));
|
|
4347
|
+
});
|
|
4348
|
+
RadioGroup$1.Item = RadioItem;
|
|
4349
|
+
|
|
4350
|
+
const Separator = () => {
|
|
4351
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
|
|
4352
|
+
className: "bg-grey-300 my-1 h-px"
|
|
4353
|
+
});
|
|
4354
|
+
};
|
|
4355
|
+
|
|
4356
|
+
const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
|
|
4357
|
+
const menu = useCurrentMenu();
|
|
4358
|
+
const className = cn('flex items-center justify-start h-7 pr-1.5 text-xs text-grey-700', {
|
|
4359
|
+
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
4360
|
+
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented)
|
|
4361
|
+
}, props.className);
|
|
4362
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Label, Object.assign({}, props, {
|
|
4363
|
+
className: className,
|
|
4364
|
+
ref: ref
|
|
4365
|
+
}));
|
|
4366
|
+
});
|
|
4367
|
+
|
|
4368
|
+
const Menu$1 = /*#__PURE__*/React.forwardRef(function Menu(externalProps, ref) {
|
|
4369
|
+
const {
|
|
4370
|
+
children,
|
|
4371
|
+
defaultOpen: defaultProp,
|
|
4372
|
+
onChange,
|
|
4373
|
+
open: prop,
|
|
4374
|
+
trigger,
|
|
4375
|
+
...props
|
|
4376
|
+
} = externalProps;
|
|
4377
|
+
const [indented, setIndented] = React.useState(false);
|
|
4378
|
+
const [minWidth, setMinWidth] = React.useState(undefined);
|
|
4379
|
+
const [open, setOpen] = reactUseControllableState.useControllableState({
|
|
4380
|
+
// uncontrolled
|
|
4381
|
+
defaultProp,
|
|
4382
|
+
// controlled
|
|
4383
|
+
onChange,
|
|
4384
|
+
prop
|
|
4385
|
+
});
|
|
4386
|
+
const context = React.useMemo(() => ({
|
|
4387
|
+
indented,
|
|
4388
|
+
registerIndentation: () => setIndented(true),
|
|
4389
|
+
minWidth,
|
|
4390
|
+
setMinWidth: width => setMinWidth(width),
|
|
4391
|
+
close: () => setOpen(false)
|
|
4392
|
+
}), [indented, minWidth]);
|
|
4393
|
+
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
4394
|
+
value: context
|
|
4395
|
+
}, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
|
4396
|
+
modal: false,
|
|
4397
|
+
open: open,
|
|
4398
|
+
onOpenChange: setOpen
|
|
4399
|
+
}), trigger && /*#__PURE__*/React.createElement(Trigger$2, {
|
|
4400
|
+
ref: ref
|
|
4401
|
+
}, trigger), children));
|
|
4402
|
+
});
|
|
4403
|
+
Menu$1.Trigger = Trigger$2;
|
|
4404
|
+
Menu$1.Content = Content$2;
|
|
4405
|
+
Menu$1.Item = Item$1;
|
|
4406
|
+
Menu$1.Link = Link;
|
|
4407
|
+
Menu$1.Checkbox = Checkbox;
|
|
4408
|
+
Menu$1.Separator = Separator;
|
|
4409
|
+
Menu$1.Header = Header;
|
|
4410
|
+
Menu$1.RadioGroup = RadioGroup$1;
|
|
4411
|
+
|
|
4412
|
+
const useIntersectionObserver = (ref, offset) => {
|
|
4413
|
+
const [intersectedIndexes, setIntersectedIndexes] = React__default.useState({});
|
|
4414
|
+
const handleIntersection = (entries, observer) => {
|
|
4415
|
+
if (observer.root) {
|
|
4416
|
+
const children = Array.from(observer.root.children);
|
|
4417
|
+
const map = {};
|
|
4418
|
+
entries.forEach(entry => {
|
|
4419
|
+
// entries only contains the items being intersected not all children of the ref
|
|
4420
|
+
// so use root and the the entry being intersected to find its real index
|
|
4421
|
+
// on first mount this is different - all children are present
|
|
4422
|
+
map[children.indexOf(entry.target)] = entry.isIntersecting;
|
|
4423
|
+
});
|
|
4424
|
+
setIntersectedIndexes(prev => ({
|
|
4425
|
+
...prev,
|
|
4426
|
+
...map
|
|
4427
|
+
}));
|
|
4428
|
+
}
|
|
4429
|
+
};
|
|
4430
|
+
const intersectedChildIndex = React__default.useMemo(() => {
|
|
4431
|
+
const index = Object.values(intersectedIndexes).indexOf(false);
|
|
4432
|
+
return index > -1 ? index : undefined;
|
|
4433
|
+
}, [intersectedIndexes]);
|
|
4434
|
+
const hasRootMargin = intersectedChildIndex !== undefined && offset;
|
|
4435
|
+
React__default.useEffect(() => {
|
|
4436
|
+
const observer = new IntersectionObserver(handleIntersection, {
|
|
4437
|
+
root: ref.current,
|
|
4438
|
+
// offset the button, but only after the first item has been intersected
|
|
4439
|
+
rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,
|
|
4440
|
+
threshold: 1
|
|
4441
|
+
});
|
|
4442
|
+
if (observer.root) {
|
|
4443
|
+
Array.from(observer.root.children).forEach(item => {
|
|
4444
|
+
if (item.getAttribute('data-intersection-observer') !== 'ignore') {
|
|
4445
|
+
observer.observe(item);
|
|
4446
|
+
}
|
|
4447
|
+
});
|
|
4448
|
+
}
|
|
4449
|
+
return () => {
|
|
4450
|
+
observer.disconnect();
|
|
4451
|
+
};
|
|
4452
|
+
}, [hasRootMargin]);
|
|
4453
|
+
return intersectedChildIndex;
|
|
4454
|
+
};
|
|
4455
|
+
|
|
4456
|
+
const sanitizeButtonPropsForMenuItem = props => {
|
|
4457
|
+
const {
|
|
4458
|
+
appearance: _1,
|
|
4459
|
+
drawer: _2,
|
|
4460
|
+
fluid: _3,
|
|
4461
|
+
hanger: _4,
|
|
4462
|
+
menu: _5,
|
|
4463
|
+
popover: _6,
|
|
4464
|
+
tooltip: _7,
|
|
4465
|
+
...attributes
|
|
4466
|
+
} = props;
|
|
4467
|
+
return attributes;
|
|
4468
|
+
};
|
|
4469
|
+
const OFFSET = 32 + 8;
|
|
4470
|
+
const ButtonGroup = /*#__PURE__*/React__default.forwardRef(function ButtonGroup(props, ref) {
|
|
4471
|
+
const internalRef = useMergedRef(ref);
|
|
4472
|
+
const intersectedChildIndex = useIntersectionObserver(internalRef, OFFSET);
|
|
4473
|
+
const children = React__default.Children.toArray(props.children);
|
|
4474
|
+
const hidden = intersectedChildIndex !== undefined ? children.slice(intersectedChildIndex) : [];
|
|
4475
|
+
return /*#__PURE__*/React__default.createElement(Group, Object.assign({}, props, {
|
|
4476
|
+
ref: internalRef
|
|
4477
|
+
}), children.map((child, index) => /*#__PURE__*/React__default.cloneElement(child, {
|
|
4478
|
+
className: cn(child.props.className, {
|
|
4479
|
+
visible: intersectedChildIndex === undefined || index < intersectedChildIndex,
|
|
4480
|
+
'invisible order-[100] pointer-events-none': intersectedChildIndex !== undefined && index >= intersectedChildIndex
|
|
4481
|
+
})
|
|
4482
|
+
})), hidden.length ? /*#__PURE__*/React__default.createElement(IconButton, {
|
|
4483
|
+
className: "sticky right-0 order-[99]",
|
|
4484
|
+
"data-intesection-observer": "ignore",
|
|
4485
|
+
icon: "more",
|
|
4486
|
+
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, hidden.map((button, index) => /*#__PURE__*/React__default.createElement(Menu$1.Item, Object.assign({
|
|
4487
|
+
key: index
|
|
4488
|
+
}, sanitizeButtonPropsForMenuItem(button.props))))))
|
|
4489
|
+
}) : null);
|
|
4490
|
+
});
|
|
4491
|
+
|
|
4492
|
+
const thisYear = /*#__PURE__*/new Date().getFullYear();
|
|
4493
|
+
const years = [];
|
|
4494
|
+
for (let i = thisYear - 50; i <= thisYear + 10; i += 1) {
|
|
4495
|
+
years.push(i);
|
|
4496
|
+
}
|
|
4497
|
+
const Navbar = /*#__PURE__*/React.memo(({
|
|
4498
|
+
onMonthChange,
|
|
4499
|
+
onNextClick,
|
|
4500
|
+
onPreviousClick,
|
|
4501
|
+
value = new Date()
|
|
4502
|
+
}) => {
|
|
4503
|
+
const {
|
|
4504
|
+
texts: {
|
|
4505
|
+
calendar: {
|
|
4506
|
+
actions,
|
|
4507
|
+
months
|
|
4508
|
+
}
|
|
4509
|
+
}
|
|
4510
|
+
} = useLocalization();
|
|
4511
|
+
const handleChange = function handleChange(event) {
|
|
4512
|
+
const {
|
|
4513
|
+
year,
|
|
4514
|
+
month
|
|
4515
|
+
} = event.target.form;
|
|
4516
|
+
onMonthChange(new Date(year.value, month.value));
|
|
4517
|
+
};
|
|
4518
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4519
|
+
className: "mb-2 flex items-center justify-between"
|
|
4520
|
+
}, /*#__PURE__*/React.createElement("form", {
|
|
4521
|
+
className: "inline-flex space-x-1"
|
|
4522
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
4523
|
+
className: "h-8 px-2",
|
|
4524
|
+
name: "month",
|
|
4525
|
+
onChange: handleChange,
|
|
4526
|
+
value: value.getMonth()
|
|
4527
|
+
}, months.map((month, i) => /*#__PURE__*/React.createElement("option", {
|
|
4528
|
+
key: month,
|
|
4529
|
+
value: i
|
|
4530
|
+
}, month))), /*#__PURE__*/React.createElement("select", {
|
|
4531
|
+
className: "h-8 px-2",
|
|
4532
|
+
name: "year",
|
|
4533
|
+
onChange: handleChange,
|
|
4534
|
+
value: value.getFullYear()
|
|
4535
|
+
}, years.map(year => /*#__PURE__*/React.createElement("option", {
|
|
4536
|
+
key: year,
|
|
4537
|
+
value: year
|
|
4538
|
+
}, String(year))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconButton, {
|
|
4539
|
+
appearance: "discrete",
|
|
4540
|
+
icon: "chevron-left",
|
|
4541
|
+
"aria-label": actions.previousMonth,
|
|
4542
|
+
onClick: () => onPreviousClick(),
|
|
4543
|
+
rounded: true
|
|
4544
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
4545
|
+
appearance: "discrete",
|
|
4546
|
+
icon: "chevron-right",
|
|
4547
|
+
"aria-label": actions.nextMonth,
|
|
4548
|
+
onClick: () => onNextClick(),
|
|
4549
|
+
rounded: true
|
|
4550
|
+
})));
|
|
4551
|
+
});
|
|
4552
|
+
const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4553
|
+
const {
|
|
4554
|
+
onChange: handleChange,
|
|
4555
|
+
value,
|
|
4556
|
+
disabledDays,
|
|
4557
|
+
...otherProps
|
|
4558
|
+
} = props;
|
|
4559
|
+
const {
|
|
4560
|
+
locale,
|
|
4561
|
+
texts
|
|
4562
|
+
} = useLocalization();
|
|
4563
|
+
const [visibleMonth, setVisibleMonth] = React.useState(value !== null && value !== void 0 ? value : new Date());
|
|
4564
|
+
React.useEffect(() => {
|
|
4565
|
+
if (visibleMonth !== value) {
|
|
4566
|
+
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
|
4567
|
+
}
|
|
4568
|
+
}, [value]);
|
|
4569
|
+
const handleDayClick = (date, modifiers, event) => {
|
|
4570
|
+
if (modifiers.outside || modifiers.disabled) {
|
|
4571
|
+
return;
|
|
4572
|
+
}
|
|
4573
|
+
handleChange(date, event);
|
|
4574
|
+
};
|
|
4575
|
+
const handleCalendarClickToday = () => {
|
|
4576
|
+
const today = new Date();
|
|
4577
|
+
// set to midday to avoid UTC offset causing dates to be mismatched server side
|
|
4578
|
+
today.setHours(12);
|
|
4579
|
+
today.setMinutes(0);
|
|
4580
|
+
today.setSeconds(0);
|
|
4581
|
+
handleChange(today);
|
|
4582
|
+
};
|
|
4583
|
+
const className = cn('flex bg-white text-xs p-4', otherProps.className);
|
|
4584
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4585
|
+
"data-taco": "calendar"
|
|
4586
|
+
}, /*#__PURE__*/React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
|
4587
|
+
className: className,
|
|
4588
|
+
month: visibleMonth,
|
|
4589
|
+
selectedDays: value,
|
|
4590
|
+
locale: locale.substring(0, 2),
|
|
4591
|
+
firstDayOfWeek: 1,
|
|
4592
|
+
months: texts.calendar.months,
|
|
4593
|
+
weekdaysShort: texts.calendar.weekdaysShort,
|
|
4594
|
+
navbarElement: navProps => /*#__PURE__*/React.createElement(Navbar, Object.assign({}, navProps, {
|
|
4595
|
+
onMonthChange: setVisibleMonth,
|
|
4596
|
+
value: visibleMonth
|
|
4597
|
+
})),
|
|
4598
|
+
onDayClick: handleDayClick,
|
|
4599
|
+
onMonthChange: setVisibleMonth,
|
|
4600
|
+
onTodayButtonClick: handleCalendarClickToday,
|
|
4601
|
+
captionElement: () => null,
|
|
4602
|
+
todayButton: texts.calendar.actions.today,
|
|
4603
|
+
numberOfMonths: 1,
|
|
4604
|
+
ref: ref,
|
|
4605
|
+
disabledDays: disabledDays
|
|
4606
|
+
})));
|
|
4607
|
+
});
|
|
4608
|
+
|
|
4609
|
+
const Content$3 = /*#__PURE__*/React.forwardRef(function CardContent(externalProps, ref) {
|
|
4610
|
+
const {
|
|
4611
|
+
noPadding,
|
|
4612
|
+
...props
|
|
4613
|
+
} = externalProps;
|
|
4614
|
+
const className = cn('flex-grow overflow-auto', {
|
|
4615
|
+
'mx-4 mb-4': !noPadding
|
|
4616
|
+
}, props.className);
|
|
4617
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
|
4618
|
+
className: className,
|
|
4619
|
+
ref: ref
|
|
4620
|
+
}));
|
|
4621
|
+
});
|
|
4622
|
+
const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4623
|
+
const {
|
|
4624
|
+
title,
|
|
4625
|
+
menu,
|
|
4626
|
+
children
|
|
4627
|
+
} = props;
|
|
4628
|
+
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);
|
|
4629
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4630
|
+
className: className,
|
|
4631
|
+
"data-taco": "card",
|
|
4632
|
+
ref: ref
|
|
4633
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4634
|
+
className: "mx-4 mt-4 mb-2 flex"
|
|
4635
|
+
}, title && /*#__PURE__*/React.createElement("h4", {
|
|
4636
|
+
className: "mb-0 flex-grow text-left"
|
|
4637
|
+
}, title), menu ? /*#__PURE__*/React.createElement(IconButton, {
|
|
4638
|
+
icon: "ellipsis-horizontal",
|
|
4639
|
+
appearance: "discrete",
|
|
4640
|
+
menu: menu,
|
|
4641
|
+
className: "-mt-[4px]"
|
|
4642
|
+
}) : null), children);
|
|
4643
|
+
});
|
|
4644
|
+
Card.Content = Content$3;
|
|
4645
|
+
|
|
4646
|
+
// React 18 has this built-in, when we upgrade this hook should be removed and the uuid dependency should be removed
|
|
4647
|
+
const useId = nativeId => {
|
|
4648
|
+
return React__default.useMemo(() => nativeId !== null && nativeId !== void 0 ? nativeId : uuid.v4(), []);
|
|
4649
|
+
};
|
|
4650
|
+
|
|
4651
|
+
const Checkbox$1 = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4652
|
+
const {
|
|
4653
|
+
checked,
|
|
4654
|
+
highlighted,
|
|
4655
|
+
indeterminate,
|
|
4656
|
+
invalid,
|
|
4657
|
+
label,
|
|
4658
|
+
onChange,
|
|
4659
|
+
...otherProps
|
|
4660
|
+
} = props;
|
|
4661
|
+
const id = useId(props.id);
|
|
4662
|
+
const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus:yt-focus',
|
|
4663
|
+
//hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
|
|
4664
|
+
{
|
|
4665
|
+
'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300': !props.disabled && !invalid,
|
|
4666
|
+
'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,
|
|
4667
|
+
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
|
4668
|
+
'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300': invalid && !props.disabled,
|
|
4669
|
+
'self-start': !!label
|
|
4670
|
+
}, props.className);
|
|
4671
|
+
let handleChange;
|
|
4672
|
+
if (onChange) {
|
|
4673
|
+
handleChange = checked => onChange(checked === 'indeterminate' ? false : checked);
|
|
4674
|
+
}
|
|
4675
|
+
let labelledByProps = null;
|
|
4676
|
+
if (label) {
|
|
4677
|
+
labelledByProps = {
|
|
4678
|
+
'aria-labelledby': `${id}-label`,
|
|
4679
|
+
id
|
|
4680
|
+
};
|
|
4681
|
+
}
|
|
4682
|
+
// the enter keyboard shortcut isn't supported by default, but we want it
|
|
4683
|
+
const handleKeyDown = event => {
|
|
4684
|
+
if (event.key === 'Enter') {
|
|
4685
|
+
event.currentTarget.click();
|
|
4686
|
+
}
|
|
4687
|
+
};
|
|
4688
|
+
const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
4689
|
+
"data-taco": "checkbox",
|
|
4690
|
+
checked: indeterminate ? 'indeterminate' : checked,
|
|
4691
|
+
className: className,
|
|
4692
|
+
onCheckedChange: handleChange,
|
|
4693
|
+
onKeyDown: handleKeyDown,
|
|
4694
|
+
ref: ref
|
|
4695
|
+
}), /*#__PURE__*/React.createElement(CheckboxPrimitive.Indicator, {
|
|
4696
|
+
className: "flex h-full w-full"
|
|
4697
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4698
|
+
name: indeterminate ? 'line' : 'tick',
|
|
4699
|
+
className: "!h-full !w-full"
|
|
4700
|
+
})));
|
|
4701
|
+
if (label) {
|
|
4702
|
+
const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
|
|
4703
|
+
'cursor-not-allowed text-grey-300': props.disabled
|
|
4704
|
+
});
|
|
4705
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
4706
|
+
className: labelContainerClassName
|
|
4707
|
+
}, element, /*#__PURE__*/React.createElement("label", {
|
|
4708
|
+
htmlFor: id,
|
|
4709
|
+
id: `${id}-label`
|
|
4710
|
+
}, label));
|
|
4711
|
+
}
|
|
4712
|
+
return element;
|
|
4713
|
+
});
|
|
4714
|
+
Checkbox$1.displayName = 'Checkbox';
|
|
4715
|
+
|
|
4716
|
+
const getInputClasses = props => {
|
|
4717
|
+
const disabled = props.disabled || !!props['aria-disabled'];
|
|
4718
|
+
const readOnly = props.readOnly || !!props['aria-readonly'];
|
|
4719
|
+
const invalid = props.invalid || !!props['aria-invalid'];
|
|
4720
|
+
return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)]', {
|
|
4721
|
+
// default
|
|
4722
|
+
'border-grey-300 focus:border-blue-300 focus:yt-focus': !invalid,
|
|
4723
|
+
'hover:shadow-[0_0_0.1rem_theme(colors.grey.500)] active:border-blue-700': !invalid && !disabled,
|
|
4724
|
+
// disabled
|
|
4725
|
+
'border-grey-200 text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,
|
|
4726
|
+
// highlighted
|
|
4236
4727
|
'bg-[rgba(255,255,0,0.075)]': props.highlighted && disabled,
|
|
4237
4728
|
'bg-[rgba(255,255,0,0.2)]': props.highlighted && !disabled,
|
|
4238
4729
|
// invalid
|
|
@@ -4295,21 +4786,6 @@ const useBoundingClientRectListener = (ref, dependencies) => {
|
|
|
4295
4786
|
return dimensions;
|
|
4296
4787
|
};
|
|
4297
4788
|
|
|
4298
|
-
// merges an external ref (optional) with an internal ref (required)
|
|
4299
|
-
const useMergedRef = ref => {
|
|
4300
|
-
const internalRef = React__default.useRef(null);
|
|
4301
|
-
React__default.useEffect(() => {
|
|
4302
|
-
if (ref) {
|
|
4303
|
-
if (typeof ref === 'function') {
|
|
4304
|
-
ref(internalRef.current);
|
|
4305
|
-
} else {
|
|
4306
|
-
ref.current = internalRef.current;
|
|
4307
|
-
}
|
|
4308
|
-
}
|
|
4309
|
-
}, [ref]);
|
|
4310
|
-
return internalRef;
|
|
4311
|
-
};
|
|
4312
|
-
|
|
4313
4789
|
const validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];
|
|
4314
4790
|
const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function InputWithoutDeprecatedFeatures(props, ref) {
|
|
4315
4791
|
const {
|
|
@@ -4661,7 +5137,7 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
|
|
|
4661
5137
|
...optionProps
|
|
4662
5138
|
}) => /*#__PURE__*/React.createElement("li", Object.assign({}, optionProps), icon, /*#__PURE__*/React.createElement("span", {
|
|
4663
5139
|
className: "flex-grow truncate text-left"
|
|
4664
|
-
}, children), multiselect && /*#__PURE__*/React.createElement(Checkbox
|
|
5140
|
+
}, children), multiselect && /*#__PURE__*/React.createElement(Checkbox$1
|
|
4665
5141
|
// In multiselect variant, this checkbox only acts as visual representation of item being selected,
|
|
4666
5142
|
// so need to be taken out of screen reader scope.
|
|
4667
5143
|
, {
|
|
@@ -4727,7 +5203,7 @@ const getSelectedIndexesFromValue = (data, value) => {
|
|
|
4727
5203
|
if (typeof value !== 'string') return [];
|
|
4728
5204
|
return value.split(',').map(v => data.findIndex(o => String(o.value) === v)).filter(v => v !== -1);
|
|
4729
5205
|
};
|
|
4730
|
-
const findByValue = (data, value) => {
|
|
5206
|
+
const findByValue$1 = (data, value) => {
|
|
4731
5207
|
return data.find(option => getValue(option.value) === getValue(value));
|
|
4732
5208
|
};
|
|
4733
5209
|
const searchForString = (child, value, strategy = 'includes') => {
|
|
@@ -4938,7 +5414,7 @@ const useCombobox = ({
|
|
|
4938
5414
|
return;
|
|
4939
5415
|
}
|
|
4940
5416
|
if (onChange && event.target.value !== value) {
|
|
4941
|
-
const item = findByValue(flattenedData, event.target.value);
|
|
5417
|
+
const item = findByValue$1(flattenedData, event.target.value);
|
|
4942
5418
|
event.detail = sanitizeItem(item);
|
|
4943
5419
|
const parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
|
4944
5420
|
if (parents !== null && parents.length > 0) {
|
|
@@ -5323,7 +5799,7 @@ const PopoverContext = /*#__PURE__*/React.createContext({
|
|
|
5323
5799
|
props: {},
|
|
5324
5800
|
ref: null
|
|
5325
5801
|
});
|
|
5326
|
-
const Trigger$
|
|
5802
|
+
const Trigger$3 = /*#__PURE__*/React.forwardRef(function PopoverAnchor(props, externalRef) {
|
|
5327
5803
|
var _props$children;
|
|
5328
5804
|
const {
|
|
5329
5805
|
ref: parentRef,
|
|
@@ -5352,7 +5828,7 @@ const RenderPropWrapper = /*#__PURE__*/React.forwardRef(function RenderPropWrapp
|
|
|
5352
5828
|
ref
|
|
5353
5829
|
});
|
|
5354
5830
|
});
|
|
5355
|
-
const Content$
|
|
5831
|
+
const Content$4 = /*#__PURE__*/React.forwardRef(function PopoverContent(props, ref) {
|
|
5356
5832
|
const {
|
|
5357
5833
|
placement: side,
|
|
5358
5834
|
...popoverContentProps
|
|
@@ -5401,10 +5877,10 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(props, ref) {
|
|
|
5401
5877
|
modal: modal,
|
|
5402
5878
|
open: open,
|
|
5403
5879
|
onOpenChange: onChange
|
|
5404
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
5880
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$3, null, trigger), children));
|
|
5405
5881
|
});
|
|
5406
|
-
Popover.Trigger = Trigger$
|
|
5407
|
-
Popover.Content = Content$
|
|
5882
|
+
Popover.Trigger = Trigger$3;
|
|
5883
|
+
Popover.Content = Content$4;
|
|
5408
5884
|
Popover.Close = Close$1;
|
|
5409
5885
|
Popover.Portal = PopoverPrimitive.Portal;
|
|
5410
5886
|
|
|
@@ -5494,7 +5970,7 @@ const useCurrentDialog = () => {
|
|
|
5494
5970
|
return React.useContext(DialogContext);
|
|
5495
5971
|
};
|
|
5496
5972
|
|
|
5497
|
-
const Trigger$
|
|
5973
|
+
const Trigger$4 = /*#__PURE__*/React.forwardRef(function DialogTrigger(props, externalRef) {
|
|
5498
5974
|
const {
|
|
5499
5975
|
ref: parentRef,
|
|
5500
5976
|
props: parentProps
|
|
@@ -5592,7 +6068,7 @@ const RenderPropWrapper$1 = /*#__PURE__*/React.forwardRef(function RenderPropWra
|
|
|
5592
6068
|
...renderProps
|
|
5593
6069
|
});
|
|
5594
6070
|
});
|
|
5595
|
-
const Content$
|
|
6071
|
+
const Content$5 = /*#__PURE__*/React.forwardRef(function DialogContent(props, ref) {
|
|
5596
6072
|
const dialog = useCurrentDialog();
|
|
5597
6073
|
const internalRef = useMergedRef(ref);
|
|
5598
6074
|
const {
|
|
@@ -5759,37 +6235,16 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
|
|
|
5759
6235
|
defaultOpen: defaultOpen,
|
|
5760
6236
|
open: open,
|
|
5761
6237
|
onOpenChange: onChange
|
|
5762
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
6238
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$4, null, trigger), children));
|
|
5763
6239
|
});
|
|
5764
|
-
Dialog.Trigger = Trigger$
|
|
5765
|
-
Dialog.Content = Content$
|
|
6240
|
+
Dialog.Trigger = Trigger$4;
|
|
6241
|
+
Dialog.Content = Content$5;
|
|
5766
6242
|
Dialog.Title = Title$1;
|
|
5767
6243
|
Dialog.Footer = Footer$1;
|
|
5768
6244
|
Dialog.Extra = Extra;
|
|
5769
6245
|
Dialog.Drawer = DialogDrawer;
|
|
5770
6246
|
Dialog.Close = Close$2;
|
|
5771
6247
|
|
|
5772
|
-
const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
5773
|
-
const {
|
|
5774
|
-
as: Tag = 'span',
|
|
5775
|
-
orientation = 'horizontal',
|
|
5776
|
-
...otherProps
|
|
5777
|
-
} = props;
|
|
5778
|
-
const className = cn('flex ', 'gap-2', {
|
|
5779
|
-
'flex-col ': orientation === 'vertical'
|
|
5780
|
-
}, props.className);
|
|
5781
|
-
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, otherProps, {
|
|
5782
|
-
className: className,
|
|
5783
|
-
"data-taco": "group",
|
|
5784
|
-
ref: ref
|
|
5785
|
-
}));
|
|
5786
|
-
});
|
|
5787
|
-
|
|
5788
|
-
const MenuContext = /*#__PURE__*/React.createContext(undefined);
|
|
5789
|
-
const useCurrentMenu = () => {
|
|
5790
|
-
return React.useContext(MenuContext);
|
|
5791
|
-
};
|
|
5792
|
-
|
|
5793
6248
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
5794
6249
|
const DrawerContext = /*#__PURE__*/React.createContext({
|
|
5795
6250
|
closeOnEscape: true,
|
|
@@ -6143,7 +6598,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
|
6143
6598
|
ref: ref
|
|
6144
6599
|
}, content);
|
|
6145
6600
|
});
|
|
6146
|
-
const Content$
|
|
6601
|
+
const Content$6 = /*#__PURE__*/React__default.forwardRef(function Content(props, externalRef) {
|
|
6147
6602
|
const {
|
|
6148
6603
|
children
|
|
6149
6604
|
} = props;
|
|
@@ -6152,7 +6607,7 @@ const Content$5 = /*#__PURE__*/React__default.forwardRef(function Content(props,
|
|
|
6152
6607
|
}), children));
|
|
6153
6608
|
});
|
|
6154
6609
|
|
|
6155
|
-
const Trigger$
|
|
6610
|
+
const Trigger$5 = /*#__PURE__*/React.forwardRef(function DrawerTrigger(props, ref) {
|
|
6156
6611
|
return /*#__PURE__*/React.createElement(DialogPrimitive.Trigger, Object.assign({}, props, {
|
|
6157
6612
|
ref: ref,
|
|
6158
6613
|
asChild: true
|
|
@@ -6240,10 +6695,10 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(props, ref) {
|
|
|
6240
6695
|
modal: variant === 'overlay' ? true : false,
|
|
6241
6696
|
open: open,
|
|
6242
6697
|
onOpenChange: setOpen
|
|
6243
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
6698
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$5, null, trigger), children));
|
|
6244
6699
|
});
|
|
6245
|
-
Drawer.Trigger = Trigger$
|
|
6246
|
-
Drawer.Content = Content$
|
|
6700
|
+
Drawer.Trigger = Trigger$5;
|
|
6701
|
+
Drawer.Content = Content$6;
|
|
6247
6702
|
Drawer.InnerContent = InnerContent;
|
|
6248
6703
|
Drawer.Title = Title$2;
|
|
6249
6704
|
Drawer.Footer = Footer$2;
|
|
@@ -6321,7 +6776,7 @@ const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
|
|
6321
6776
|
ref: ref
|
|
6322
6777
|
}));
|
|
6323
6778
|
});
|
|
6324
|
-
const Content$
|
|
6779
|
+
const Content$7 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
|
6325
6780
|
const {
|
|
6326
6781
|
placement: side
|
|
6327
6782
|
} = props;
|
|
@@ -6380,7 +6835,7 @@ const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
|
|
6380
6835
|
}, anchor && /*#__PURE__*/React.createElement(Anchor, null, anchor), children));
|
|
6381
6836
|
});
|
|
6382
6837
|
Hanger.Anchor = Anchor;
|
|
6383
|
-
Hanger.Content = Content$
|
|
6838
|
+
Hanger.Content = Content$7;
|
|
6384
6839
|
Hanger.Title = Title$3;
|
|
6385
6840
|
|
|
6386
6841
|
const UnstyledArrow$1 = /*#__PURE__*/React.forwardRef(function HoverCardArrow(props, ref) {
|
|
@@ -6405,13 +6860,13 @@ const UnstyledArrow$1 = /*#__PURE__*/React.forwardRef(function HoverCardArrow(pr
|
|
|
6405
6860
|
})));
|
|
6406
6861
|
});
|
|
6407
6862
|
|
|
6408
|
-
const Trigger$
|
|
6863
|
+
const Trigger$6 = /*#__PURE__*/React.forwardRef(function HoverCardTrigger(props, ref) {
|
|
6409
6864
|
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Trigger, Object.assign({}, props, {
|
|
6410
6865
|
asChild: true,
|
|
6411
6866
|
ref: ref
|
|
6412
6867
|
}));
|
|
6413
6868
|
});
|
|
6414
|
-
const Content$
|
|
6869
|
+
const Content$8 = /*#__PURE__*/React.forwardRef(function HoverCardContent(props, ref) {
|
|
6415
6870
|
const {
|
|
6416
6871
|
placement: side
|
|
6417
6872
|
} = props;
|
|
@@ -6431,8 +6886,8 @@ const HoverCard = props => {
|
|
|
6431
6886
|
openDelay: 300
|
|
6432
6887
|
}));
|
|
6433
6888
|
};
|
|
6434
|
-
HoverCard.Trigger = Trigger$
|
|
6435
|
-
HoverCard.Content = Content$
|
|
6889
|
+
HoverCard.Trigger = Trigger$6;
|
|
6890
|
+
HoverCard.Content = Content$8;
|
|
6436
6891
|
|
|
6437
6892
|
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
6438
6893
|
onSearch,
|
|
@@ -6632,7 +7087,7 @@ const useListbox = ({
|
|
|
6632
7087
|
event.persist();
|
|
6633
7088
|
if (onChange) {
|
|
6634
7089
|
var _item$path$split, _item$path;
|
|
6635
|
-
const item = findByValue(data, event.target.value);
|
|
7090
|
+
const item = findByValue$1(data, event.target.value);
|
|
6636
7091
|
event.detail = sanitizeItem(item);
|
|
6637
7092
|
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
7093
|
if (indexes.length > 1) {
|
|
@@ -6801,469 +7256,94 @@ const useMultiListbox = ({
|
|
|
6801
7256
|
setSelectedIndexes(getSelectedIndexesFromValue(data, event.target.value));
|
|
6802
7257
|
if (onChange) {
|
|
6803
7258
|
const detail = [];
|
|
6804
|
-
const valuesArray = event.target.value.split(',');
|
|
6805
|
-
valuesArray.forEach(val => {
|
|
6806
|
-
const item = findByValue(data, val);
|
|
6807
|
-
if (item) {
|
|
6808
|
-
detail.push(item);
|
|
6809
|
-
}
|
|
6810
|
-
});
|
|
6811
|
-
event.detail = detail;
|
|
6812
|
-
onChange(event);
|
|
6813
|
-
}
|
|
6814
|
-
};
|
|
6815
|
-
const list = {
|
|
6816
|
-
...otherProps,
|
|
6817
|
-
'aria-activedescendant': getActiveDescendant(data, currentIndex, id),
|
|
6818
|
-
'aria-multiselectable': true,
|
|
6819
|
-
data,
|
|
6820
|
-
disabled,
|
|
6821
|
-
id,
|
|
6822
|
-
onChange: () => null,
|
|
6823
|
-
onClick: handleListboxClick,
|
|
6824
|
-
onFocus: handleListboxFocus,
|
|
6825
|
-
onKeyDown: handleListboxKeyDown,
|
|
6826
|
-
scrollOnFocus: false,
|
|
6827
|
-
tabIndex: disabled ? -1 : otherProps.tabIndex ? otherProps.tabIndex : 0,
|
|
6828
|
-
value: currentIndex,
|
|
6829
|
-
selectedIndexes,
|
|
6830
|
-
multiselect: true,
|
|
6831
|
-
allOptionsSelected
|
|
6832
|
-
};
|
|
6833
|
-
const input = {
|
|
6834
|
-
name,
|
|
6835
|
-
onChange: handleInputChange,
|
|
6836
|
-
ref: inputRef,
|
|
6837
|
-
tabIndex: -1,
|
|
6838
|
-
value: value !== null && value !== void 0 ? value : ''
|
|
6839
|
-
};
|
|
6840
|
-
return {
|
|
6841
|
-
list,
|
|
6842
|
-
input
|
|
6843
|
-
};
|
|
6844
|
-
};
|
|
6845
|
-
|
|
6846
|
-
const Listbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
6847
|
-
const {
|
|
6848
|
-
className: externalClassName,
|
|
6849
|
-
...otherProps
|
|
6850
|
-
} = props;
|
|
6851
|
-
const {
|
|
6852
|
-
list,
|
|
6853
|
-
input
|
|
6854
|
-
} = useListbox(otherProps, ref);
|
|
6855
|
-
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
|
6856
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
6857
|
-
"data-taco": "listbox",
|
|
6858
|
-
className: className
|
|
6859
|
-
}, /*#__PURE__*/React.createElement(ScrollableList, Object.assign({}, list, {
|
|
6860
|
-
style: {
|
|
6861
|
-
...list.style,
|
|
6862
|
-
maxHeight: 'calc(12rem + 2px)' /* (6 * option height) + listbox border */
|
|
6863
|
-
}
|
|
6864
|
-
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
6865
|
-
className: "hidden",
|
|
6866
|
-
type: "text"
|
|
6867
|
-
})));
|
|
6868
|
-
});
|
|
6869
|
-
const MultiListbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
6870
|
-
const {
|
|
6871
|
-
className: externalClassName,
|
|
6872
|
-
...otherProps
|
|
6873
|
-
} = props;
|
|
6874
|
-
const {
|
|
6875
|
-
list,
|
|
6876
|
-
input
|
|
6877
|
-
} = useMultiListbox(otherProps, ref);
|
|
6878
|
-
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
|
6879
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
6880
|
-
"data-taco": "listbox",
|
|
6881
|
-
className: className
|
|
6882
|
-
}, /*#__PURE__*/React.createElement(ScrollableList, Object.assign({}, list, {
|
|
6883
|
-
style: {
|
|
6884
|
-
...list.style,
|
|
6885
|
-
maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
|
6886
|
-
}
|
|
6887
|
-
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
6888
|
-
className: "hidden",
|
|
6889
|
-
type: "text"
|
|
6890
|
-
})));
|
|
6891
|
-
});
|
|
6892
|
-
|
|
6893
|
-
const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref) {
|
|
6894
|
-
const internalRef = useMergedRef(ref);
|
|
6895
|
-
const menu = useCurrentMenu();
|
|
6896
|
-
const {
|
|
6897
|
-
align = 'start',
|
|
6898
|
-
children,
|
|
6899
|
-
placement: side,
|
|
6900
|
-
...otherProps
|
|
6901
|
-
} = props;
|
|
6902
|
-
const className = cn('border border-transparent rounded block outline-none p-1 yt-shadow wcag-white', props.className);
|
|
6903
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Portal, null, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Content, Object.assign({}, otherProps, {
|
|
6904
|
-
align: align,
|
|
6905
|
-
className: className,
|
|
6906
|
-
"data-taco": "menu",
|
|
6907
|
-
side: side,
|
|
6908
|
-
sideOffset: 3,
|
|
6909
|
-
style: {
|
|
6910
|
-
minWidth: menu === null || menu === void 0 ? void 0 : menu.minWidth
|
|
6911
|
-
},
|
|
6912
|
-
ref: internalRef
|
|
6913
|
-
}), children));
|
|
6914
|
-
});
|
|
6915
|
-
|
|
6916
|
-
const Icon$1 = ({
|
|
6917
|
-
name
|
|
6918
|
-
}) => /*#__PURE__*/React.createElement("span", {
|
|
6919
|
-
className: "absolute left-0 ml-1"
|
|
6920
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
6921
|
-
className: "-ml-px -mt-px !h-5 !w-5",
|
|
6922
|
-
name: name
|
|
6923
|
-
}));
|
|
6924
|
-
const useItemStyling = ({
|
|
6925
|
-
disabled,
|
|
6926
|
-
indented,
|
|
6927
|
-
className
|
|
6928
|
-
}) => {
|
|
6929
|
-
const menu = useCurrentMenu();
|
|
6930
|
-
React.useEffect(() => {
|
|
6931
|
-
if (indented && !(menu !== null && menu !== void 0 && menu.indented)) {
|
|
6932
|
-
menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
|
|
6933
|
-
}
|
|
6934
|
-
}, [indented]);
|
|
6935
|
-
return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', {
|
|
6936
|
-
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
6937
|
-
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
|
|
6938
|
-
'cursor-pointer text-black hover:wcag-grey-200 data-[highlighted]:wcag-grey-200': !disabled,
|
|
6939
|
-
'cursor-not-allowed hover:bg-white text-grey-300': disabled
|
|
6940
|
-
}, className);
|
|
6941
|
-
};
|
|
6942
|
-
const Shortcut = props => {
|
|
6943
|
-
return /*#__PURE__*/React.createElement("span", Object.assign({}, props, {
|
|
6944
|
-
className: "text-grey-700 ml-auto pl-3"
|
|
6945
|
-
}));
|
|
6946
|
-
};
|
|
6947
|
-
const Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
|
|
6948
|
-
var _props$disabled;
|
|
6949
|
-
const {
|
|
6950
|
-
dialog,
|
|
6951
|
-
icon,
|
|
6952
|
-
onClick,
|
|
6953
|
-
shortcut,
|
|
6954
|
-
...otherProps
|
|
6955
|
-
} = props;
|
|
6956
|
-
const menu = useCurrentMenu();
|
|
6957
|
-
const className = useItemStyling({
|
|
6958
|
-
disabled: props.disabled,
|
|
6959
|
-
indented: !!icon,
|
|
6960
|
-
className: props.className
|
|
6961
|
-
});
|
|
6962
|
-
const disabled = (_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : props['aria-disabled'];
|
|
6963
|
-
let handleClick;
|
|
6964
|
-
// radix has a bug that does not disable clicks when disabled is set on items
|
|
6965
|
-
if (disabled) {
|
|
6966
|
-
handleClick = event => {
|
|
6967
|
-
event.preventDefault();
|
|
6968
|
-
event.stopPropagation();
|
|
6969
|
-
};
|
|
6970
|
-
}
|
|
6971
|
-
const handleSelect = event => {
|
|
6972
|
-
if (onClick) {
|
|
6973
|
-
onClick(event);
|
|
6974
|
-
}
|
|
6975
|
-
if (props['aria-haspopup'] || typeof dialog === 'function') {
|
|
6976
|
-
event.preventDefault();
|
|
6977
|
-
}
|
|
6978
|
-
};
|
|
6979
|
-
let button = /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Item, Object.assign({}, otherProps, {
|
|
6980
|
-
className: className,
|
|
6981
|
-
onClick: handleClick,
|
|
6982
|
-
onSelect: handleSelect,
|
|
6983
|
-
ref: ref
|
|
6984
|
-
}), icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
6985
|
-
name: icon
|
|
6986
|
-
}), props.children, shortcut && /*#__PURE__*/React.createElement(Shortcut, null, shortcut));
|
|
6987
|
-
if (typeof dialog === 'function') {
|
|
6988
|
-
button = dialog({
|
|
6989
|
-
trigger: button,
|
|
6990
|
-
onClose: menu === null || menu === void 0 ? void 0 : menu.close
|
|
6991
|
-
});
|
|
6992
|
-
}
|
|
6993
|
-
return button;
|
|
6994
|
-
});
|
|
6995
|
-
|
|
6996
|
-
const Link = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
|
|
6997
|
-
const {
|
|
6998
|
-
href,
|
|
6999
|
-
icon,
|
|
7000
|
-
onClick,
|
|
7001
|
-
...otherProps
|
|
7002
|
-
} = props;
|
|
7003
|
-
const menu = useCurrentMenu();
|
|
7004
|
-
const className = useItemStyling({
|
|
7005
|
-
disabled: props.disabled,
|
|
7006
|
-
indented: !!icon,
|
|
7007
|
-
className: props.className
|
|
7008
|
-
});
|
|
7009
|
-
const handleClick = event => {
|
|
7010
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
7011
|
-
menu === null || menu === void 0 ? void 0 : menu.close();
|
|
7012
|
-
};
|
|
7013
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Item, Object.assign({}, otherProps, {
|
|
7014
|
-
asChild: true,
|
|
7015
|
-
className: className,
|
|
7016
|
-
ref: ref,
|
|
7017
|
-
onClick: handleClick
|
|
7018
|
-
}), /*#__PURE__*/React.createElement("a", {
|
|
7019
|
-
href: href,
|
|
7020
|
-
target: "_blank"
|
|
7021
|
-
}, icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
7022
|
-
name: icon
|
|
7023
|
-
}), props.children));
|
|
7024
|
-
});
|
|
7025
|
-
|
|
7026
|
-
const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
|
|
7027
|
-
const menu = useCurrentMenu();
|
|
7028
|
-
const internalRef = useMergedRef(ref);
|
|
7029
|
-
React.useEffect(() => {
|
|
7030
|
-
if (internalRef.current) {
|
|
7031
|
-
menu === null || menu === void 0 ? void 0 : menu.setMinWidth(internalRef.current.getBoundingClientRect().width);
|
|
7032
|
-
}
|
|
7033
|
-
}, [internalRef]);
|
|
7034
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
|
|
7035
|
-
asChild: true,
|
|
7036
|
-
ref: internalRef
|
|
7037
|
-
}));
|
|
7038
|
-
});
|
|
7039
|
-
|
|
7040
|
-
const Checkbox$1 = /*#__PURE__*/React.forwardRef(function MenuCheckboxItem(props, ref) {
|
|
7041
|
-
const {
|
|
7042
|
-
checked,
|
|
7043
|
-
children,
|
|
7044
|
-
onChange,
|
|
7045
|
-
...otherProps
|
|
7046
|
-
} = props;
|
|
7047
|
-
const className = useItemStyling({
|
|
7048
|
-
disabled: props.disabled,
|
|
7049
|
-
indented: true,
|
|
7050
|
-
className: props.className
|
|
7051
|
-
});
|
|
7052
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.CheckboxItem, Object.assign({}, otherProps, {
|
|
7053
|
-
checked: checked,
|
|
7054
|
-
className: className,
|
|
7055
|
-
onCheckedChange: onChange,
|
|
7056
|
-
ref: ref
|
|
7057
|
-
}), /*#__PURE__*/React.createElement(DropdownMenuPrimitive.ItemIndicator, {
|
|
7058
|
-
className: "absolute left-0 ml-1.5"
|
|
7059
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
7060
|
-
name: "tick",
|
|
7061
|
-
className: "-ml-px !h-4 !w-4"
|
|
7062
|
-
})), children);
|
|
7063
|
-
});
|
|
7259
|
+
const valuesArray = event.target.value.split(',');
|
|
7260
|
+
valuesArray.forEach(val => {
|
|
7261
|
+
const item = findByValue$1(data, val);
|
|
7262
|
+
if (item) {
|
|
7263
|
+
detail.push(item);
|
|
7264
|
+
}
|
|
7265
|
+
});
|
|
7266
|
+
event.detail = detail;
|
|
7267
|
+
onChange(event);
|
|
7268
|
+
}
|
|
7269
|
+
};
|
|
7270
|
+
const list = {
|
|
7271
|
+
...otherProps,
|
|
7272
|
+
'aria-activedescendant': getActiveDescendant(data, currentIndex, id),
|
|
7273
|
+
'aria-multiselectable': true,
|
|
7274
|
+
data,
|
|
7275
|
+
disabled,
|
|
7276
|
+
id,
|
|
7277
|
+
onChange: () => null,
|
|
7278
|
+
onClick: handleListboxClick,
|
|
7279
|
+
onFocus: handleListboxFocus,
|
|
7280
|
+
onKeyDown: handleListboxKeyDown,
|
|
7281
|
+
scrollOnFocus: false,
|
|
7282
|
+
tabIndex: disabled ? -1 : otherProps.tabIndex ? otherProps.tabIndex : 0,
|
|
7283
|
+
value: currentIndex,
|
|
7284
|
+
selectedIndexes,
|
|
7285
|
+
multiselect: true,
|
|
7286
|
+
allOptionsSelected
|
|
7287
|
+
};
|
|
7288
|
+
const input = {
|
|
7289
|
+
name,
|
|
7290
|
+
onChange: handleInputChange,
|
|
7291
|
+
ref: inputRef,
|
|
7292
|
+
tabIndex: -1,
|
|
7293
|
+
value: value !== null && value !== void 0 ? value : ''
|
|
7294
|
+
};
|
|
7295
|
+
return {
|
|
7296
|
+
list,
|
|
7297
|
+
input
|
|
7298
|
+
};
|
|
7299
|
+
};
|
|
7064
7300
|
|
|
7065
|
-
const
|
|
7066
|
-
const findByValue$1 = (values, valueAsString) => values.find(value => getRadioGroupItemValueAsString(value) === valueAsString);
|
|
7067
|
-
const RadioGroupContext = /*#__PURE__*/React.createContext({
|
|
7068
|
-
disabled: false,
|
|
7069
|
-
invalid: false
|
|
7070
|
-
});
|
|
7071
|
-
const RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props, ref) {
|
|
7072
|
-
const context = React.useContext(RadioGroupContext);
|
|
7301
|
+
const Listbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
7073
7302
|
const {
|
|
7074
|
-
|
|
7075
|
-
value,
|
|
7303
|
+
className: externalClassName,
|
|
7076
7304
|
...otherProps
|
|
7077
7305
|
} = props;
|
|
7078
|
-
const isDisabled = context.disabled || props.disabled;
|
|
7079
|
-
const className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2', {
|
|
7080
|
-
'border-grey-300 hover:border-4 focus:yt-focus aria-checked:bg-blue-500 aria-checked:border-blue-500 hover:aria-checked:border-blue-300': !isDisabled && !context.invalid,
|
|
7081
|
-
'border-grey-200 cursor-not-allowed aria-checked:bg-blue-300 aria-checked:border-blue-300 ': isDisabled,
|
|
7082
|
-
'border-red-500 hover:border-4 text-red-500 focus:border-red-500 focus:yt-focus-red aria-checked:bg-red-500 aria-checked:border-red': context.invalid && !isDisabled
|
|
7083
|
-
});
|
|
7084
|
-
const labelClassName = cn('flex items-center gap-2', {
|
|
7085
|
-
'cursor-pointer': !isDisabled,
|
|
7086
|
-
'cursor-not-allowed text-grey-300': isDisabled
|
|
7087
|
-
}, props.className);
|
|
7088
|
-
return /*#__PURE__*/React.createElement("label", {
|
|
7089
|
-
className: labelClassName
|
|
7090
|
-
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Item, Object.assign({}, otherProps, {
|
|
7091
|
-
className: className,
|
|
7092
|
-
disabled: isDisabled,
|
|
7093
|
-
ref: ref,
|
|
7094
|
-
value: getRadioGroupItemValueAsString(value)
|
|
7095
|
-
}), /*#__PURE__*/React.createElement(RadioGroupPrimitive.Indicator, {
|
|
7096
|
-
className: "h-2 w-2 rounded-full bg-white"
|
|
7097
|
-
})), children);
|
|
7098
|
-
});
|
|
7099
|
-
const useRadioGroup = props => {
|
|
7100
7306
|
const {
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
React.Children.forEach(children, child => {
|
|
7113
|
-
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
7114
|
-
radioGroupItemValues.push(child.props.value);
|
|
7115
|
-
}
|
|
7116
|
-
});
|
|
7117
|
-
return radioGroupItemValues;
|
|
7118
|
-
}, [children]);
|
|
7119
|
-
const context = React.useMemo(() => ({
|
|
7120
|
-
disabled: disabled !== null && disabled !== void 0 ? disabled : false,
|
|
7121
|
-
invalid: invalid !== null && invalid !== void 0 ? invalid : false
|
|
7122
|
-
}), [disabled, invalid]);
|
|
7123
|
-
let valueProps;
|
|
7124
|
-
if (onChange !== undefined) {
|
|
7125
|
-
const handleChange = value => onChange(findByValue$1(values, value));
|
|
7126
|
-
valueProps = {
|
|
7127
|
-
onValueChange: handleChange,
|
|
7128
|
-
value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined
|
|
7129
|
-
};
|
|
7130
|
-
} else {
|
|
7131
|
-
valueProps = {
|
|
7132
|
-
defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined
|
|
7133
|
-
};
|
|
7134
|
-
}
|
|
7135
|
-
return {
|
|
7136
|
-
context,
|
|
7137
|
-
props: {
|
|
7138
|
-
...otherProps,
|
|
7139
|
-
...valueProps,
|
|
7140
|
-
children,
|
|
7141
|
-
disabled,
|
|
7142
|
-
orientation
|
|
7307
|
+
list,
|
|
7308
|
+
input
|
|
7309
|
+
} = useListbox(otherProps, ref);
|
|
7310
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
|
7311
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
7312
|
+
"data-taco": "listbox",
|
|
7313
|
+
className: className
|
|
7314
|
+
}, /*#__PURE__*/React.createElement(ScrollableList, Object.assign({}, list, {
|
|
7315
|
+
style: {
|
|
7316
|
+
...list.style,
|
|
7317
|
+
maxHeight: 'calc(12rem + 2px)' /* (6 * option height) + listbox border */
|
|
7143
7318
|
}
|
|
7144
|
-
}
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
const {
|
|
7148
|
-
context,
|
|
7149
|
-
props: otherProps
|
|
7150
|
-
} = useRadioGroup(props);
|
|
7151
|
-
const className = cn('flex items-start gap-y-2', {
|
|
7152
|
-
'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',
|
|
7153
|
-
'flex-col': otherProps.orientation === 'vertical'
|
|
7154
|
-
}, otherProps.className);
|
|
7155
|
-
return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
|
|
7156
|
-
value: context
|
|
7157
|
-
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Root, Object.assign({}, otherProps, {
|
|
7158
|
-
className: className,
|
|
7159
|
-
"data-taco": "radio-group",
|
|
7160
|
-
ref: ref
|
|
7319
|
+
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
7320
|
+
className: "hidden",
|
|
7321
|
+
type: "text"
|
|
7161
7322
|
})));
|
|
7162
7323
|
});
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
const RadioItem = props => {
|
|
7166
|
-
const context = React.useContext(MenuRadioGroupContext);
|
|
7324
|
+
const MultiListbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
7167
7325
|
const {
|
|
7168
|
-
|
|
7169
|
-
value,
|
|
7326
|
+
className: externalClassName,
|
|
7170
7327
|
...otherProps
|
|
7171
7328
|
} = props;
|
|
7172
|
-
const disabled = context.disabled || props.disabled;
|
|
7173
|
-
const className = useItemStyling({
|
|
7174
|
-
disabled: disabled,
|
|
7175
|
-
indented: true,
|
|
7176
|
-
className: props.className
|
|
7177
|
-
});
|
|
7178
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.RadioItem, Object.assign({}, otherProps, {
|
|
7179
|
-
className: className,
|
|
7180
|
-
disabled: disabled,
|
|
7181
|
-
value: getRadioGroupItemValueAsString(value)
|
|
7182
|
-
}), /*#__PURE__*/React.createElement(DropdownMenuPrimitive.ItemIndicator, {
|
|
7183
|
-
className: "absolute left-0 ml-1.5"
|
|
7184
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
7185
|
-
className: "ml-1 flex h-1.5 w-1.5 rounded-full bg-current "
|
|
7186
|
-
})), children);
|
|
7187
|
-
};
|
|
7188
|
-
const MenuRadioGroupContext = /*#__PURE__*/React.createContext({
|
|
7189
|
-
disabled: false
|
|
7190
|
-
});
|
|
7191
|
-
const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props, ref) {
|
|
7192
7329
|
const {
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
} =
|
|
7196
|
-
const className = cn('flex
|
|
7197
|
-
return /*#__PURE__*/React.createElement(
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7330
|
+
list,
|
|
7331
|
+
input
|
|
7332
|
+
} = useMultiListbox(otherProps, ref);
|
|
7333
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
|
7334
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
7335
|
+
"data-taco": "listbox",
|
|
7336
|
+
className: className
|
|
7337
|
+
}, /*#__PURE__*/React.createElement(ScrollableList, Object.assign({}, list, {
|
|
7338
|
+
style: {
|
|
7339
|
+
...list.style,
|
|
7340
|
+
maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
|
7341
|
+
}
|
|
7342
|
+
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
7343
|
+
className: "hidden",
|
|
7344
|
+
type: "text"
|
|
7202
7345
|
})));
|
|
7203
7346
|
});
|
|
7204
|
-
RadioGroup$1.Item = RadioItem;
|
|
7205
|
-
|
|
7206
|
-
const Separator = () => {
|
|
7207
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
|
|
7208
|
-
className: "bg-grey-300 my-1 h-px"
|
|
7209
|
-
});
|
|
7210
|
-
};
|
|
7211
|
-
|
|
7212
|
-
const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
|
|
7213
|
-
const menu = useCurrentMenu();
|
|
7214
|
-
const className = cn('flex items-center justify-start h-7 pr-1.5 text-xs text-grey-700', {
|
|
7215
|
-
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
7216
|
-
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented)
|
|
7217
|
-
}, props.className);
|
|
7218
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Label, Object.assign({}, props, {
|
|
7219
|
-
className: className,
|
|
7220
|
-
ref: ref
|
|
7221
|
-
}));
|
|
7222
|
-
});
|
|
7223
|
-
|
|
7224
|
-
const Menu$1 = /*#__PURE__*/React.forwardRef(function Menu(externalProps, ref) {
|
|
7225
|
-
const {
|
|
7226
|
-
children,
|
|
7227
|
-
defaultOpen: defaultProp,
|
|
7228
|
-
onChange,
|
|
7229
|
-
open: prop,
|
|
7230
|
-
trigger,
|
|
7231
|
-
...props
|
|
7232
|
-
} = externalProps;
|
|
7233
|
-
const [indented, setIndented] = React.useState(false);
|
|
7234
|
-
const [minWidth, setMinWidth] = React.useState(undefined);
|
|
7235
|
-
const [open, setOpen] = reactUseControllableState.useControllableState({
|
|
7236
|
-
// uncontrolled
|
|
7237
|
-
defaultProp,
|
|
7238
|
-
// controlled
|
|
7239
|
-
onChange,
|
|
7240
|
-
prop
|
|
7241
|
-
});
|
|
7242
|
-
const context = React.useMemo(() => ({
|
|
7243
|
-
indented,
|
|
7244
|
-
registerIndentation: () => setIndented(true),
|
|
7245
|
-
minWidth,
|
|
7246
|
-
setMinWidth: width => setMinWidth(width),
|
|
7247
|
-
close: () => setOpen(false)
|
|
7248
|
-
}), [indented, minWidth]);
|
|
7249
|
-
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
7250
|
-
value: context
|
|
7251
|
-
}, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
|
7252
|
-
modal: false,
|
|
7253
|
-
open: open,
|
|
7254
|
-
onOpenChange: setOpen
|
|
7255
|
-
}), trigger && /*#__PURE__*/React.createElement(Trigger$6, {
|
|
7256
|
-
ref: ref
|
|
7257
|
-
}, trigger), children));
|
|
7258
|
-
});
|
|
7259
|
-
Menu$1.Trigger = Trigger$6;
|
|
7260
|
-
Menu$1.Content = Content$8;
|
|
7261
|
-
Menu$1.Item = Item$1;
|
|
7262
|
-
Menu$1.Link = Link;
|
|
7263
|
-
Menu$1.Checkbox = Checkbox$1;
|
|
7264
|
-
Menu$1.Separator = Separator;
|
|
7265
|
-
Menu$1.Header = Header;
|
|
7266
|
-
Menu$1.RadioGroup = RadioGroup$1;
|
|
7267
7347
|
|
|
7268
7348
|
const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
|
|
7269
7349
|
return /*#__PURE__*/React__default.createElement("a", Object.assign({}, props, {
|
|
@@ -7544,7 +7624,7 @@ const useSelect = ({
|
|
|
7544
7624
|
}, [open]);
|
|
7545
7625
|
React.useEffect(() => {
|
|
7546
7626
|
if (value === undefined) {
|
|
7547
|
-
if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
|
|
7627
|
+
if (defaultValue !== undefined && findByValue$1(flattenedData, defaultValue)) {
|
|
7548
7628
|
setInputValueByRef$1(inputRef.current, defaultValue);
|
|
7549
7629
|
} else {
|
|
7550
7630
|
if (emptyValue !== undefined) {
|
|
@@ -7554,7 +7634,7 @@ const useSelect = ({
|
|
|
7554
7634
|
}
|
|
7555
7635
|
}
|
|
7556
7636
|
} else {
|
|
7557
|
-
if (!multiselect && !findByValue(flattenedData, value)) {
|
|
7637
|
+
if (!multiselect && !findByValue$1(flattenedData, value)) {
|
|
7558
7638
|
if (emptyValue !== undefined) {
|
|
7559
7639
|
setInputValueByRef$1(inputRef.current, emptyValue);
|
|
7560
7640
|
} else if (data.length > 0) {
|
|
@@ -7613,11 +7693,11 @@ const useSelect = ({
|
|
|
7613
7693
|
text = texts.select.allOptionsSelected;
|
|
7614
7694
|
} else {
|
|
7615
7695
|
var _findByValue$text, _findByValue;
|
|
7616
|
-
text = (_findByValue$text = (_findByValue = findByValue(flattenedData, selectedValues[0])) === null || _findByValue === void 0 ? void 0 : _findByValue.text) !== null && _findByValue$text !== void 0 ? _findByValue$text : '';
|
|
7696
|
+
text = (_findByValue$text = (_findByValue = findByValue$1(flattenedData, selectedValues[0])) === null || _findByValue === void 0 ? void 0 : _findByValue.text) !== null && _findByValue$text !== void 0 ? _findByValue$text : '';
|
|
7617
7697
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
|
7618
7698
|
}
|
|
7619
7699
|
} else {
|
|
7620
|
-
const item = findByValue(flattenedData, value);
|
|
7700
|
+
const item = findByValue$1(flattenedData, value);
|
|
7621
7701
|
if (item) {
|
|
7622
7702
|
text = item.icon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(item.icon, {
|
|
7623
7703
|
className: cn(item.icon.props.className, 'mr-1 -mt-px')
|
|
@@ -7629,7 +7709,7 @@ const useSelect = ({
|
|
|
7629
7709
|
event.persist();
|
|
7630
7710
|
if (onChange) {
|
|
7631
7711
|
var _item$path$split, _item$path;
|
|
7632
|
-
const item = findByValue(flattenedData, event.target.value);
|
|
7712
|
+
const item = findByValue$1(flattenedData, event.target.value);
|
|
7633
7713
|
event.detail = sanitizeItem(item);
|
|
7634
7714
|
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 : [];
|
|
7635
7715
|
if (indexes.length > 1) {
|
|
@@ -10124,7 +10204,7 @@ const useRowSelect = onSelectedRows => {
|
|
|
10124
10204
|
onSelectedRows({});
|
|
10125
10205
|
}
|
|
10126
10206
|
};
|
|
10127
|
-
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, props, {
|
|
10207
|
+
return /*#__PURE__*/React__default.createElement(Checkbox$1, Object.assign({}, props, {
|
|
10128
10208
|
onChange: onChange
|
|
10129
10209
|
}));
|
|
10130
10210
|
},
|
|
@@ -10149,7 +10229,7 @@ const useRowSelect = onSelectedRows => {
|
|
|
10149
10229
|
}
|
|
10150
10230
|
lastSelectedSortedIndex.current = sortedIndex;
|
|
10151
10231
|
};
|
|
10152
|
-
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, props, {
|
|
10232
|
+
return /*#__PURE__*/React__default.createElement(Checkbox$1, Object.assign({}, props, {
|
|
10153
10233
|
className: "!mt-2.5",
|
|
10154
10234
|
onClick: onClick,
|
|
10155
10235
|
// this is necessary to remove console spam from eslint
|
|
@@ -11239,7 +11319,7 @@ const SelectCell = /*#__PURE__*/React__default.memo(({
|
|
|
11239
11319
|
className: "ml-2",
|
|
11240
11320
|
keys: ['Space']
|
|
11241
11321
|
}))
|
|
11242
|
-
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
11322
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
11243
11323
|
"aria-label": isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect,
|
|
11244
11324
|
className: "hover:border-blue !mt-0",
|
|
11245
11325
|
checked: isSelected,
|
|
@@ -11260,7 +11340,7 @@ function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowInd
|
|
|
11260
11340
|
className: "ml-2",
|
|
11261
11341
|
keys: ['Ctrl', 'A']
|
|
11262
11342
|
}))
|
|
11263
|
-
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
11343
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
11264
11344
|
"aria-label": table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll,
|
|
11265
11345
|
className: "hover:border-blue !mt-0",
|
|
11266
11346
|
checked: table.getIsAllPageRowsSelected(),
|
|
@@ -13283,7 +13363,7 @@ const OrderableColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
13283
13363
|
ref: ref
|
|
13284
13364
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
13285
13365
|
className: "pointer-events-none"
|
|
13286
|
-
}, icon, (_column$columnDef$hea = column.columnDef.header) !== null && _column$columnDef$hea !== void 0 ? _column$columnDef$hea : column.columnDef.id), column.getCanHide() ? /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
13366
|
+
}, icon, (_column$columnDef$hea = column.columnDef.header) !== null && _column$columnDef$hea !== void 0 ? _column$columnDef$hea : column.columnDef.id), column.getCanHide() ? /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
13287
13367
|
checked: column.getIsVisible(),
|
|
13288
13368
|
onChange: column.toggleVisibility
|
|
13289
13369
|
}) : null);
|
|
@@ -15508,9 +15588,10 @@ exports.BadgeIcon = BadgeIcon;
|
|
|
15508
15588
|
exports.Banner = Banner;
|
|
15509
15589
|
exports.Base = Base;
|
|
15510
15590
|
exports.Button = Button$1;
|
|
15591
|
+
exports.ButtonGroup = ButtonGroup;
|
|
15511
15592
|
exports.Calendar = Calendar$1;
|
|
15512
15593
|
exports.Card = Card;
|
|
15513
|
-
exports.Checkbox = Checkbox;
|
|
15594
|
+
exports.Checkbox = Checkbox$1;
|
|
15514
15595
|
exports.CollectionPrimitive = Collection;
|
|
15515
15596
|
exports.Combobox = Combobox;
|
|
15516
15597
|
exports.Datepicker = Datepicker;
|
|
@@ -15560,7 +15641,7 @@ exports.VisuallyHidden = VisuallyHidden;
|
|
|
15560
15641
|
exports.WindowedTable = WindowedTable;
|
|
15561
15642
|
exports.convertRowIndexPathToNumberArray = convertRowIndexPathToNumberArray;
|
|
15562
15643
|
exports.defaultLocalisationTexts = defaultLocalisationTexts;
|
|
15563
|
-
exports.findByValue = findByValue
|
|
15644
|
+
exports.findByValue = findByValue;
|
|
15564
15645
|
exports.format = format;
|
|
15565
15646
|
exports.getByRowIndexPath = getByRowIndexPath;
|
|
15566
15647
|
exports.getNavigationLinkClasses = getNavigationLinkClasses;
|
|
@@ -15578,6 +15659,7 @@ exports.setByRowIndexPath = setByRowIndexPath;
|
|
|
15578
15659
|
exports.useBoundaryOverflowDetection = useBoundaryOverflowDetection;
|
|
15579
15660
|
exports.useBoundingClientRectListener = useBoundingClientRectListener;
|
|
15580
15661
|
exports.useDropTarget = useDropTarget;
|
|
15662
|
+
exports.useIntersectionObserver = useIntersectionObserver;
|
|
15581
15663
|
exports.useIsLargeScreen = useIsLargeScreen;
|
|
15582
15664
|
exports.useListKeyboardNavigation = useListKeyboardNavigation;
|
|
15583
15665
|
exports.useListScrollTo = useListScrollTo;
|