@economic/taco 0.0.33-alpha.0 → 0.0.33-alpha.6
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/Listbox/useMultiListbox.d.ts +1 -1
- package/dist/components/Select/useSelect.d.ts +13 -8
- package/dist/esm/components/Banner/Banner.js +7 -5
- package/dist/esm/components/Banner/Banner.js.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js +15 -18
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/Datepicker/Datepicker.js +48 -52
- package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +39 -58
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Field/Field.js +10 -12
- package/dist/esm/components/Field/Field.js.map +1 -1
- package/dist/esm/components/Form/Form.js +6 -8
- package/dist/esm/components/Form/Form.js.map +1 -1
- package/dist/esm/components/Group/Group.js +6 -8
- package/dist/esm/components/Group/Group.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +25 -33
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js +7 -8
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js +9 -11
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Input/Input.js +26 -24
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Listbox/Listbox.js +24 -25
- package/dist/esm/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/components/Listbox/useListbox.js +1 -1
- package/dist/esm/components/Listbox/useListbox.js.map +1 -1
- package/dist/esm/components/Listbox/useMultiListbox.js +1 -0
- package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
- package/dist/esm/components/Listbox/util.js +4 -7
- package/dist/esm/components/Listbox/util.js.map +1 -1
- package/dist/esm/components/Menu/Menu.js +20 -43
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/Navigation/Navigation.js +35 -44
- package/dist/esm/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +39 -56
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +29 -34
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/Progress/Progress.js +11 -15
- package/dist/esm/components/Progress/Progress.js.map +1 -1
- package/dist/esm/components/Provider/Provider.js +13 -18
- package/dist/esm/components/Provider/Provider.js.map +1 -1
- package/dist/esm/components/RadioGroup/RadioGroup.js +45 -57
- package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +10 -11
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Select/Select.js +30 -31
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/useSelect.js +48 -30
- package/dist/esm/components/Select/useSelect.js.map +1 -1
- package/dist/taco.cjs.development.js +570 -667
- 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
@@ -3122,17 +3122,17 @@ const icons = {
|
|
3122
3122
|
zoom: Zoom
|
3123
3123
|
};
|
3124
3124
|
|
3125
|
-
|
3126
|
-
var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
3125
|
+
const Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
3127
3126
|
var _props$className;
|
3128
3127
|
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3128
|
+
const {
|
3129
|
+
name,
|
3130
|
+
...otherProps
|
3131
|
+
} = props;
|
3132
|
+
const Component = icons[name];
|
3133
3133
|
/* 24x24 _at the base body font_ - must be em so that they scale with font size - tailwind spacing uses rem */
|
3134
3134
|
|
3135
|
-
|
3135
|
+
const className = cn('inline-flex h-[1.715em] w-[1.715em]', props.className, {
|
3136
3136
|
'p-[3px]': (_props$className = props.className) === null || _props$className === void 0 ? void 0 : _props$className.includes('rounded-full')
|
3137
3137
|
});
|
3138
3138
|
return Component ? React__default.createElement(Component, Object.assign({}, otherProps, {
|
@@ -3144,7 +3144,7 @@ var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
|
3144
3144
|
})) : null;
|
3145
3145
|
});
|
3146
3146
|
|
3147
|
-
var _excluded
|
3147
|
+
var _excluded = ["id"],
|
3148
3148
|
_excluded2 = ["id", "defaultId", "onChange", "as"];
|
3149
3149
|
var AccordionContext = /*#__PURE__*/React__default.createContext({
|
3150
3150
|
as: 'h2'
|
@@ -3182,7 +3182,7 @@ var Content = /*#__PURE__*/React__default.forwardRef(function AccordionContent(p
|
|
3182
3182
|
|
3183
3183
|
var Item = function Item(props) {
|
3184
3184
|
var id = props.id,
|
3185
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded
|
3185
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
3186
3186
|
|
3187
3187
|
return React__default.createElement(AccordionPrimitive.Item, Object.assign({}, otherProps, {
|
3188
3188
|
value: id
|
@@ -3283,7 +3283,7 @@ const getOutlineClasses = state => {
|
|
3283
3283
|
}
|
3284
3284
|
};
|
3285
3285
|
|
3286
|
-
var _excluded$
|
3286
|
+
var _excluded$1 = ["children", "compact", "outline", "state"];
|
3287
3287
|
var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
3288
3288
|
var _cn;
|
3289
3289
|
|
@@ -3293,7 +3293,7 @@ var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
|
3293
3293
|
_props$outline = props.outline,
|
3294
3294
|
outline = _props$outline === void 0 ? false : _props$outline,
|
3295
3295
|
state = props.state,
|
3296
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3296
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
3297
3297
|
|
3298
3298
|
var className = cn('rounded-full border font-bold text-xs uppercase overflow-hidden whitespace-nowrap inline-flex items-center justify-center h-5', (_cn = {}, _cn[getOutlineClasses(state)] = outline, _cn["border-transparent " + getStateClasses(state)] = !outline, _cn['h-2 w-2 min-w-0'] = compact, _cn['h-5 py-0 px-[0.354rem]'] = !compact, _cn), props.className);
|
3299
3299
|
return React.createElement("span", Object.assign({}, otherProps, {
|
@@ -3453,14 +3453,13 @@ const createButton = (props, className, ref) => {
|
|
3453
3453
|
return button;
|
3454
3454
|
};
|
3455
3455
|
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3463
|
-
var className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
|
3456
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
3457
|
+
const {
|
3458
|
+
icon,
|
3459
|
+
rounded = false,
|
3460
|
+
...otherProps
|
3461
|
+
} = props;
|
3462
|
+
const className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
|
3464
3463
|
'rounded-full': rounded,
|
3465
3464
|
rounded: !rounded,
|
3466
3465
|
'cursor-not-allowed opacity-50': props.disabled,
|
@@ -3471,20 +3470,22 @@ var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
|
3471
3470
|
return null;
|
3472
3471
|
}
|
3473
3472
|
|
3474
|
-
return createButton(
|
3473
|
+
return createButton({ ...otherProps,
|
3475
3474
|
children: React.createElement(Icon, {
|
3476
3475
|
name: icon,
|
3477
3476
|
className: "m-0 p-0"
|
3478
3477
|
}),
|
3479
3478
|
'data-taco': 'icon-button'
|
3480
|
-
}
|
3479
|
+
}, className, ref);
|
3481
3480
|
});
|
3482
3481
|
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3482
|
+
const Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
3483
|
+
const {
|
3484
|
+
children,
|
3485
|
+
state,
|
3486
|
+
onClose
|
3487
|
+
} = props;
|
3488
|
+
const className = cn('bg-white relative flex items-center px-4 h-12 shadow-lg z-10', props.className);
|
3488
3489
|
return React.createElement("div", {
|
3489
3490
|
className: className,
|
3490
3491
|
"data-taco": "banner",
|
@@ -3497,10 +3498,10 @@ var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
|
3497
3498
|
}) : null);
|
3498
3499
|
});
|
3499
3500
|
|
3500
|
-
var _excluded$
|
3501
|
+
var _excluded$2 = ["fluid"];
|
3501
3502
|
var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3502
3503
|
var fluid = props.fluid,
|
3503
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3504
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
3504
3505
|
|
3505
3506
|
var className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
|
3506
3507
|
'cursor-not-allowed opacity-50': props.disabled,
|
@@ -3878,7 +3879,7 @@ const ToastProvider = ({
|
|
3878
3879
|
};
|
3879
3880
|
const useToast = () => React.useContext(ToastContext);
|
3880
3881
|
|
3881
|
-
|
3882
|
+
const defaultLocalisationTexts = {
|
3882
3883
|
calendar: {
|
3883
3884
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
3884
3885
|
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
@@ -3953,67 +3954,62 @@ var defaultLocalisationTexts = {
|
|
3953
3954
|
inputLabel: 'Search...'
|
3954
3955
|
}
|
3955
3956
|
};
|
3956
|
-
|
3957
|
+
const defaultLocalizationContext = {
|
3957
3958
|
locale: 'en-GB',
|
3958
3959
|
texts: defaultLocalisationTexts,
|
3959
3960
|
formatting: {
|
3960
3961
|
date: 'dd.mm.yy'
|
3961
3962
|
}
|
3962
3963
|
};
|
3963
|
-
|
3964
|
+
const Context = /*#__PURE__*/React.createContext({
|
3964
3965
|
localization: defaultLocalizationContext
|
3965
3966
|
});
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3971
|
-
|
3972
|
-
|
3973
|
-
|
3974
|
-
}, [localization]);
|
3967
|
+
const Provider = props => {
|
3968
|
+
const {
|
3969
|
+
children,
|
3970
|
+
localization = defaultLocalizationContext
|
3971
|
+
} = props;
|
3972
|
+
const value = React.useMemo(() => ({
|
3973
|
+
localization
|
3974
|
+
}), [localization]);
|
3975
3975
|
return React.createElement(Context.Provider, {
|
3976
3976
|
value: value
|
3977
3977
|
}, React.createElement(ToastProvider, null, children));
|
3978
3978
|
};
|
3979
|
-
|
3980
|
-
|
3981
|
-
};
|
3982
|
-
var useLocalization = function useLocalization() {
|
3983
|
-
return useTaco().localization;
|
3984
|
-
};
|
3979
|
+
const useTaco = () => React.useContext(Context);
|
3980
|
+
const useLocalization = () => useTaco().localization;
|
3985
3981
|
|
3986
|
-
|
3982
|
+
const renderDay = (day, modifiers) => modifiers.disabled ? React.createElement("span", {
|
3983
|
+
className: "dot"
|
3984
|
+
}) : day.getDate();
|
3987
3985
|
|
3988
|
-
|
3989
|
-
|
3990
|
-
className: "dot"
|
3991
|
-
}) : day.getDate();
|
3992
|
-
};
|
3993
|
-
|
3994
|
-
var thisYear = /*#__PURE__*/new Date().getFullYear();
|
3995
|
-
var years = [];
|
3986
|
+
const thisYear = /*#__PURE__*/new Date().getFullYear();
|
3987
|
+
const years = [];
|
3996
3988
|
|
3997
|
-
for (
|
3989
|
+
for (let i = thisYear - 10; i <= thisYear + 10; i += 1) {
|
3998
3990
|
years.push(i);
|
3999
3991
|
}
|
4000
3992
|
|
4001
|
-
|
4002
|
-
|
4003
|
-
|
4004
|
-
|
4005
|
-
|
4006
|
-
|
3993
|
+
const Navbar = /*#__PURE__*/React.memo(({
|
3994
|
+
onMonthChange,
|
3995
|
+
onNextClick,
|
3996
|
+
onPreviousClick,
|
3997
|
+
value = new Date()
|
3998
|
+
}) => {
|
3999
|
+
const {
|
4000
|
+
texts: {
|
4001
|
+
calendar: {
|
4002
|
+
actions,
|
4003
|
+
months
|
4004
|
+
}
|
4005
|
+
}
|
4006
|
+
} = useLocalization();
|
4007
4007
|
|
4008
|
-
|
4009
|
-
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4013
|
-
var handleChange = function handleChange(event) {
|
4014
|
-
var _event$target$form = event.target.form,
|
4015
|
-
year = _event$target$form.year,
|
4016
|
-
month = _event$target$form.month;
|
4008
|
+
const handleChange = function handleChange(event) {
|
4009
|
+
const {
|
4010
|
+
year,
|
4011
|
+
month
|
4012
|
+
} = event.target.form;
|
4017
4013
|
onMonthChange(new Date(year.value, month.value));
|
4018
4014
|
};
|
4019
4015
|
|
@@ -4026,59 +4022,49 @@ var Navbar = /*#__PURE__*/React.memo(function (_ref) {
|
|
4026
4022
|
name: "month",
|
4027
4023
|
onChange: handleChange,
|
4028
4024
|
value: value.getMonth()
|
4029
|
-
}, months.map(
|
4030
|
-
|
4031
|
-
|
4032
|
-
|
4033
|
-
}, month);
|
4034
|
-
})), React.createElement("select", {
|
4025
|
+
}, months.map((month, i) => React.createElement("option", {
|
4026
|
+
key: month,
|
4027
|
+
value: i
|
4028
|
+
}, month))), React.createElement("select", {
|
4035
4029
|
className: "h-8 px-2",
|
4036
4030
|
name: "year",
|
4037
4031
|
onChange: handleChange,
|
4038
4032
|
value: value.getFullYear()
|
4039
|
-
}, years.map(
|
4040
|
-
|
4041
|
-
|
4042
|
-
|
4043
|
-
}, String(year));
|
4044
|
-
}))), React.createElement("div", null, React.createElement(IconButton, {
|
4033
|
+
}, years.map(year => React.createElement("option", {
|
4034
|
+
key: year,
|
4035
|
+
value: year
|
4036
|
+
}, String(year))))), React.createElement("div", null, React.createElement(IconButton, {
|
4045
4037
|
appearance: "discrete",
|
4046
4038
|
icon: "chevron-left",
|
4047
4039
|
"aria-label": actions.previousMonth,
|
4048
|
-
onClick:
|
4049
|
-
return onPreviousClick();
|
4050
|
-
},
|
4040
|
+
onClick: () => onPreviousClick(),
|
4051
4041
|
rounded: true
|
4052
4042
|
}), React.createElement(IconButton, {
|
4053
4043
|
appearance: "discrete",
|
4054
4044
|
icon: "chevron-right",
|
4055
4045
|
"aria-label": actions.nextMonth,
|
4056
|
-
onClick:
|
4057
|
-
return onNextClick();
|
4058
|
-
},
|
4046
|
+
onClick: () => onNextClick(),
|
4059
4047
|
rounded: true
|
4060
4048
|
})));
|
4061
4049
|
});
|
4062
|
-
|
4063
|
-
|
4064
|
-
|
4065
|
-
|
4066
|
-
|
4067
|
-
|
4068
|
-
|
4069
|
-
|
4070
|
-
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4075
|
-
React.useEffect(function () {
|
4050
|
+
const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4051
|
+
const {
|
4052
|
+
onChange: handleChange,
|
4053
|
+
value,
|
4054
|
+
...otherProps
|
4055
|
+
} = props;
|
4056
|
+
const {
|
4057
|
+
locale,
|
4058
|
+
texts
|
4059
|
+
} = useLocalization();
|
4060
|
+
const [visibleMonth, setVisibleMonth] = React.useState(value !== null && value !== void 0 ? value : new Date());
|
4061
|
+
React.useEffect(() => {
|
4076
4062
|
if (visibleMonth !== value) {
|
4077
4063
|
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
4078
4064
|
}
|
4079
4065
|
}, [value]);
|
4080
4066
|
|
4081
|
-
|
4067
|
+
const handleDayClick = (date, modifiers, event) => {
|
4082
4068
|
if (modifiers.outside || modifiers.disabled) {
|
4083
4069
|
return;
|
4084
4070
|
}
|
@@ -4086,8 +4072,8 @@ var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4086
4072
|
handleChange(date, event);
|
4087
4073
|
};
|
4088
4074
|
|
4089
|
-
|
4090
|
-
|
4075
|
+
const handleCalendarClickToday = () => {
|
4076
|
+
const today = new Date(); // set to midday to avoid UTC offset causing dates to be mismatched server side
|
4091
4077
|
|
4092
4078
|
today.setHours(12);
|
4093
4079
|
today.setMinutes(0);
|
@@ -4095,7 +4081,7 @@ var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4095
4081
|
handleChange(today);
|
4096
4082
|
};
|
4097
4083
|
|
4098
|
-
|
4084
|
+
const className = cn('flex bg-white text-xs p-4', otherProps.className);
|
4099
4085
|
return React.createElement("div", {
|
4100
4086
|
"data-taco": "calendar"
|
4101
4087
|
}, React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
@@ -4106,18 +4092,14 @@ var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4106
4092
|
firstDayOfWeek: 1,
|
4107
4093
|
months: texts.calendar.months,
|
4108
4094
|
weekdaysShort: texts.calendar.weekdaysShort,
|
4109
|
-
navbarElement:
|
4110
|
-
|
4111
|
-
|
4112
|
-
|
4113
|
-
}));
|
4114
|
-
},
|
4095
|
+
navbarElement: navProps => React.createElement(Navbar, Object.assign({}, navProps, {
|
4096
|
+
onMonthChange: setVisibleMonth,
|
4097
|
+
value: visibleMonth
|
4098
|
+
})),
|
4115
4099
|
onDayClick: handleDayClick,
|
4116
4100
|
onMonthChange: setVisibleMonth,
|
4117
4101
|
onTodayButtonClick: handleCalendarClickToday,
|
4118
|
-
captionElement:
|
4119
|
-
return null;
|
4120
|
-
},
|
4102
|
+
captionElement: () => null,
|
4121
4103
|
todayButton: texts.calendar.actions.today,
|
4122
4104
|
showOutsideDays: true,
|
4123
4105
|
renderDay: renderDay,
|
@@ -4126,32 +4108,30 @@ var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4126
4108
|
})));
|
4127
4109
|
});
|
4128
4110
|
|
4129
|
-
|
4130
|
-
|
4131
|
-
|
4132
|
-
|
4133
|
-
|
4134
|
-
|
4135
|
-
|
4136
|
-
|
4137
|
-
|
4138
|
-
|
4139
|
-
|
4111
|
+
const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
4112
|
+
const {
|
4113
|
+
checked,
|
4114
|
+
highlighted,
|
4115
|
+
indeterminate,
|
4116
|
+
invalid,
|
4117
|
+
label,
|
4118
|
+
onChange,
|
4119
|
+
...otherProps
|
4120
|
+
} = props;
|
4121
|
+
const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem]', {
|
4140
4122
|
'mr-2': !!label,
|
4141
4123
|
'border-grey-dark text-blue focus:border-blue focus:yt-focus': !props.disabled && !invalid,
|
4142
4124
|
'border-grey text-blue-light cursor-not-allowed': props.disabled,
|
4143
4125
|
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
4144
4126
|
'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled
|
4145
4127
|
});
|
4146
|
-
|
4128
|
+
let handleChange;
|
4147
4129
|
|
4148
4130
|
if (onChange) {
|
4149
|
-
handleChange =
|
4150
|
-
return onChange(checked === 'indeterminate' ? false : checked);
|
4151
|
-
};
|
4131
|
+
handleChange = checked => onChange(checked === 'indeterminate' ? false : checked);
|
4152
4132
|
}
|
4153
4133
|
|
4154
|
-
|
4134
|
+
const element = React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, {
|
4155
4135
|
"data-taco": "checkbox",
|
4156
4136
|
checked: indeterminate ? 'indeterminate' : checked,
|
4157
4137
|
className: className,
|
@@ -4165,7 +4145,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4165
4145
|
})));
|
4166
4146
|
|
4167
4147
|
if (label) {
|
4168
|
-
|
4148
|
+
const labelClassName = cn('flex items-center cursor-pointer', {
|
4169
4149
|
'cursor-not-allowed text-grey-dark': props.disabled
|
4170
4150
|
}, props.className);
|
4171
4151
|
return React.createElement("label", {
|
@@ -4208,21 +4188,22 @@ const getButtonStateClasses = invalid => {
|
|
4208
4188
|
return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4209
4189
|
};
|
4210
4190
|
|
4211
|
-
|
4212
|
-
|
4213
|
-
|
4214
|
-
|
4215
|
-
|
4216
|
-
|
4217
|
-
|
4218
|
-
|
4219
|
-
|
4220
|
-
|
4221
|
-
|
4222
|
-
|
4191
|
+
const Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
4192
|
+
const {
|
4193
|
+
button,
|
4194
|
+
icon,
|
4195
|
+
highlighted,
|
4196
|
+
invalid,
|
4197
|
+
onKeyDown,
|
4198
|
+
autoFocus,
|
4199
|
+
...otherProps
|
4200
|
+
} = props;
|
4201
|
+
const inputRef = useProxiedRef(ref);
|
4202
|
+
const hasContainer = button || icon;
|
4203
|
+
const className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
4223
4204
|
'pr-8': !!hasContainer
|
4224
4205
|
}, !hasContainer && otherProps.className);
|
4225
|
-
React.useEffect(
|
4206
|
+
React.useEffect(() => {
|
4226
4207
|
if (autoFocus && inputRef.current) {
|
4227
4208
|
inputRef.current.focus();
|
4228
4209
|
}
|
@@ -4230,10 +4211,10 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4230
4211
|
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
4231
4212
|
// so we manually override it to ensure _our_ desired behaviour remains intact
|
4232
4213
|
|
4233
|
-
|
4214
|
+
const handleKeyDown = event => {
|
4234
4215
|
if (event.key === 'Home' || event.key === 'End') {
|
4235
4216
|
event.preventDefault();
|
4236
|
-
|
4217
|
+
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
4237
4218
|
event.currentTarget.setSelectionRange(position, position);
|
4238
4219
|
}
|
4239
4220
|
|
@@ -4242,7 +4223,7 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4242
4223
|
}
|
4243
4224
|
};
|
4244
4225
|
|
4245
|
-
|
4226
|
+
const input = React.createElement("input", Object.assign({}, otherProps, {
|
4246
4227
|
className: className,
|
4247
4228
|
"data-taco": "input",
|
4248
4229
|
onKeyDown: handleKeyDown,
|
@@ -4250,19 +4231,21 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4250
4231
|
}));
|
4251
4232
|
|
4252
4233
|
if (hasContainer) {
|
4253
|
-
|
4234
|
+
let extra;
|
4254
4235
|
|
4255
4236
|
if (button) {
|
4256
|
-
var _button$props$disable
|
4237
|
+
var _button$props$disable;
|
4257
4238
|
|
4258
|
-
|
4259
|
-
|
4239
|
+
const disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
|
4240
|
+
const buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', {
|
4241
|
+
[getButtonStateClasses(invalid)]: !props.disabled
|
4242
|
+
}, button.props.className);
|
4260
4243
|
extra = React.cloneElement(button, {
|
4261
4244
|
className: buttonClassName,
|
4262
|
-
disabled
|
4245
|
+
disabled
|
4263
4246
|
});
|
4264
4247
|
} else if (icon) {
|
4265
|
-
|
4248
|
+
const iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
|
4266
4249
|
'text-grey-dark': props.disabled,
|
4267
4250
|
'text-grey-darkest': !props.disabled
|
4268
4251
|
});
|
@@ -4274,7 +4257,7 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4274
4257
|
});
|
4275
4258
|
}
|
4276
4259
|
|
4277
|
-
|
4260
|
+
const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
|
4278
4261
|
return React.createElement("div", {
|
4279
4262
|
className: containerClassName,
|
4280
4263
|
"data-taco": "input-container"
|
@@ -4582,12 +4565,11 @@ const setInputValueByRef = (input, value, event = 'change') => {
|
|
4582
4565
|
input.dispatchEvent(createCustomEvent(event));
|
4583
4566
|
};
|
4584
4567
|
|
4568
|
+
const getValue = value => String(value !== null && value !== void 0 ? value : '');
|
4569
|
+
|
4585
4570
|
const setInputValueByRef$1 = (input, value, event = 'change') => {
|
4586
|
-
setInputValueByRef(input,
|
4571
|
+
setInputValueByRef(input, getValue(value), event);
|
4587
4572
|
};
|
4588
|
-
|
4589
|
-
const getValue = value => value === undefined || value === null ? '' : String(value);
|
4590
|
-
|
4591
4573
|
const getIndexFromValue = (data, value) => {
|
4592
4574
|
const index = data.findIndex(option => getValue(option.value) === getValue(value));
|
4593
4575
|
return index > -1 ? index : undefined;
|
@@ -4612,9 +4594,7 @@ const searchForString = (child, value, strategy = 'includes') => {
|
|
4612
4594
|
|
4613
4595
|
return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
|
4614
4596
|
} else {
|
4615
|
-
|
4616
|
-
|
4617
|
-
return child.toString().toLowerCase()[strategy]((_String = String(value)) === null || _String === void 0 ? void 0 : _String.toLowerCase());
|
4597
|
+
return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
|
4618
4598
|
}
|
4619
4599
|
} catch {
|
4620
4600
|
return false;
|
@@ -5048,12 +5028,12 @@ var useBoundingClientRectListener = function useBoundingClientRectListener(ref)
|
|
5048
5028
|
return dimensions;
|
5049
5029
|
};
|
5050
5030
|
|
5051
|
-
var _excluded$
|
5031
|
+
var _excluded$3 = ["className", "dialog", "style"];
|
5052
5032
|
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5053
5033
|
var externalClassName = props.className,
|
5054
5034
|
dialog = props.dialog,
|
5055
5035
|
style = props.style,
|
5056
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5036
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
|
5057
5037
|
|
5058
5038
|
var _useCombobox = useCombobox(otherProps, ref),
|
5059
5039
|
combobox = _useCombobox.combobox,
|
@@ -5345,19 +5325,18 @@ function mergeRefs(refs) {
|
|
5345
5325
|
};
|
5346
5326
|
}
|
5347
5327
|
|
5348
|
-
|
5349
|
-
var PopoverContext = /*#__PURE__*/React.createContext({
|
5328
|
+
const PopoverContext = /*#__PURE__*/React.createContext({
|
5350
5329
|
props: {},
|
5351
5330
|
ref: null
|
5352
5331
|
});
|
5353
|
-
|
5332
|
+
const Trigger$1 = /*#__PURE__*/React.forwardRef(function PopoverTrigger(props, ref) {
|
5354
5333
|
var _props$children;
|
5355
5334
|
|
5356
|
-
|
5357
|
-
|
5335
|
+
const context = React.useContext(PopoverContext);
|
5336
|
+
let children = props.children;
|
5358
5337
|
|
5359
5338
|
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
5360
|
-
console.warn(
|
5339
|
+
console.warn(`Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`);
|
5361
5340
|
children = React.createElement("span", null, props.children);
|
5362
5341
|
}
|
5363
5342
|
|
@@ -5367,22 +5346,22 @@ var Trigger$1 = /*#__PURE__*/React.forwardRef(function PopoverTrigger(props, ref
|
|
5367
5346
|
asChild: true
|
5368
5347
|
}));
|
5369
5348
|
});
|
5370
|
-
|
5371
|
-
|
5372
|
-
|
5373
|
-
|
5374
|
-
|
5349
|
+
const RenderPropWrapper = /*#__PURE__*/React.forwardRef(function RenderPropWrapper({
|
5350
|
+
children,
|
5351
|
+
onClick
|
5352
|
+
}, ref) {
|
5353
|
+
const close = () => {
|
5375
5354
|
onClick(new CustomEvent('hide'));
|
5376
5355
|
};
|
5377
5356
|
|
5378
5357
|
return children({
|
5379
|
-
close
|
5380
|
-
ref
|
5358
|
+
close,
|
5359
|
+
ref
|
5381
5360
|
});
|
5382
5361
|
});
|
5383
|
-
|
5384
|
-
|
5385
|
-
|
5362
|
+
const Content$1 = /*#__PURE__*/React.forwardRef(function PopoverContent(props, ref) {
|
5363
|
+
const className = cn('bg-white focus:border-blue-light', props.className);
|
5364
|
+
let output;
|
5386
5365
|
|
5387
5366
|
if (typeof props.children === 'function') {
|
5388
5367
|
output = React.createElement(PopoverPrimitive.Close, {
|
@@ -5400,23 +5379,20 @@ var Content$1 = /*#__PURE__*/React.forwardRef(function PopoverContent(props, ref
|
|
5400
5379
|
className: "text-white"
|
5401
5380
|
}));
|
5402
5381
|
});
|
5403
|
-
|
5404
|
-
|
5405
|
-
|
5406
|
-
|
5407
|
-
|
5408
|
-
|
5409
|
-
|
5410
|
-
|
5411
|
-
|
5412
|
-
|
5413
|
-
|
5414
|
-
|
5415
|
-
|
5416
|
-
|
5417
|
-
ref: ref
|
5418
|
-
};
|
5419
|
-
}, [otherProps]);
|
5382
|
+
const Close$1 = /*#__PURE__*/React.forwardRef((props, ref) => React.createElement(PopoverPrimitive.Close, Object.assign({}, props, {
|
5383
|
+
ref: ref,
|
5384
|
+
asChild: true
|
5385
|
+
})));
|
5386
|
+
const Popover = /*#__PURE__*/React.forwardRef(function Popover(props, ref) {
|
5387
|
+
const {
|
5388
|
+
children,
|
5389
|
+
trigger,
|
5390
|
+
...otherProps
|
5391
|
+
} = props;
|
5392
|
+
const context = React.useMemo(() => ({
|
5393
|
+
props: otherProps,
|
5394
|
+
ref
|
5395
|
+
}), [otherProps]);
|
5420
5396
|
return React.createElement(PopoverContext.Provider, {
|
5421
5397
|
value: context
|
5422
5398
|
}, React.createElement(PopoverPrimitive.Root, null, trigger && React.createElement(Trigger$1, null, trigger), children));
|
@@ -5425,25 +5401,25 @@ Popover.Trigger = Trigger$1;
|
|
5425
5401
|
Popover.Content = Content$1;
|
5426
5402
|
Popover.Close = Close$1;
|
5427
5403
|
|
5428
|
-
|
5429
|
-
var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
5404
|
+
const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
5430
5405
|
var _input$disabled;
|
5431
5406
|
|
5432
|
-
|
5433
|
-
|
5434
|
-
|
5435
|
-
|
5436
|
-
|
5437
|
-
|
5438
|
-
|
5439
|
-
|
5440
|
-
|
5441
|
-
|
5442
|
-
|
5443
|
-
|
5444
|
-
|
5445
|
-
|
5446
|
-
|
5407
|
+
const {
|
5408
|
+
className: externalClassName,
|
5409
|
+
onReset: handleReset,
|
5410
|
+
style,
|
5411
|
+
shortcuts,
|
5412
|
+
shortcutsText,
|
5413
|
+
...otherProps
|
5414
|
+
} = props;
|
5415
|
+
const {
|
5416
|
+
calendar,
|
5417
|
+
input
|
5418
|
+
} = useDatepicker(otherProps, ref);
|
5419
|
+
const {
|
5420
|
+
texts
|
5421
|
+
} = useLocalization();
|
5422
|
+
const className = cn('inline-flex w-full text-black font-normal', externalClassName);
|
5447
5423
|
return React.createElement("span", {
|
5448
5424
|
className: className,
|
5449
5425
|
"data-taco": "datepicker",
|
@@ -5453,40 +5429,37 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
|
5453
5429
|
"aria-label": texts.datepicker.expand,
|
5454
5430
|
disabled: (_input$disabled = input.disabled) !== null && _input$disabled !== void 0 ? _input$disabled : input.readOnly,
|
5455
5431
|
icon: "calendar"
|
5456
|
-
})), React.createElement(Popover.Content, null,
|
5457
|
-
|
5458
|
-
|
5459
|
-
|
5460
|
-
|
5461
|
-
|
5462
|
-
|
5463
|
-
|
5464
|
-
|
5465
|
-
|
5466
|
-
|
5467
|
-
|
5468
|
-
|
5469
|
-
|
5470
|
-
|
5471
|
-
|
5472
|
-
|
5473
|
-
|
5474
|
-
|
5475
|
-
|
5476
|
-
|
5477
|
-
|
5478
|
-
|
5479
|
-
|
5480
|
-
|
5481
|
-
|
5482
|
-
|
5483
|
-
|
5484
|
-
|
5485
|
-
|
5486
|
-
|
5487
|
-
}
|
5488
|
-
}, texts.datepicker.clear)));
|
5489
|
-
}))
|
5432
|
+
})), React.createElement(Popover.Content, null, ({
|
5433
|
+
close
|
5434
|
+
}) => React.createElement("div", {
|
5435
|
+
className: "flex -m-3"
|
5436
|
+
}, React.createElement(Calendar$1, Object.assign({}, calendar, {
|
5437
|
+
onChange: (date, event) => {
|
5438
|
+
calendar.onChange(date, event);
|
5439
|
+
close();
|
5440
|
+
},
|
5441
|
+
tabIndex: -1
|
5442
|
+
})), shortcuts && React.createElement("div", {
|
5443
|
+
className: "border-l border-grey-dark flex flex-col"
|
5444
|
+
}, React.createElement("span", {
|
5445
|
+
className: "font-semibold text-xs m-4 flex items-center h-8 w-32 mb-3"
|
5446
|
+
}, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), React.createElement("ul", null, shortcuts.map((shortcut, i) => React.createElement("li", {
|
5447
|
+
key: i
|
5448
|
+
}, React.createElement("button", {
|
5449
|
+
className: "w-full px-4 py-1 flex items-start hover:bg-grey-light text-xs",
|
5450
|
+
onClick: event => {
|
5451
|
+
event.persist();
|
5452
|
+
shortcut.onClick(event);
|
5453
|
+
close();
|
5454
|
+
}
|
5455
|
+
}, shortcut.text)))), handleReset && React.createElement("button", {
|
5456
|
+
className: "text-blue hover:text-blue-light inline-flex border-none bg-transparent text-xs cursor-pointer mt-auto my-4 mx-auto",
|
5457
|
+
onClick: event => {
|
5458
|
+
event.persist();
|
5459
|
+
handleReset(event);
|
5460
|
+
close();
|
5461
|
+
}
|
5462
|
+
}, texts.datepicker.clear)))))
|
5490
5463
|
})));
|
5491
5464
|
});
|
5492
5465
|
|
@@ -5729,14 +5702,12 @@ const Extra = /*#__PURE__*/React.forwardRef(function DialogExtra(props, ref) {
|
|
5729
5702
|
});
|
5730
5703
|
Extra.displayName = 'DialogExtra';
|
5731
5704
|
|
5732
|
-
|
5733
|
-
|
5734
|
-
|
5735
|
-
|
5736
|
-
|
5737
|
-
|
5738
|
-
var extra;
|
5739
|
-
React.Children.toArray(initialChildren).forEach(function (child) {
|
5705
|
+
const useSeparatedChildren = initialChildren => {
|
5706
|
+
return React.useMemo(() => {
|
5707
|
+
const children = [];
|
5708
|
+
let drawer;
|
5709
|
+
let extra;
|
5710
|
+
React.Children.toArray(initialChildren).forEach(child => {
|
5740
5711
|
var _child$type, _child$type2;
|
5741
5712
|
|
5742
5713
|
if (((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === Drawer.displayName) {
|
@@ -5751,55 +5722,39 @@ var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
|
5751
5722
|
}, [initialChildren]);
|
5752
5723
|
};
|
5753
5724
|
|
5754
|
-
|
5755
|
-
|
5756
|
-
|
5757
|
-
|
5758
|
-
|
5759
|
-
|
5760
|
-
|
5761
|
-
|
5762
|
-
|
5763
|
-
|
5764
|
-
|
5765
|
-
|
5766
|
-
|
5767
|
-
|
5768
|
-
|
5769
|
-
|
5770
|
-
|
5771
|
-
|
5772
|
-
|
5773
|
-
|
5774
|
-
|
5775
|
-
|
5776
|
-
|
5777
|
-
|
5778
|
-
|
5779
|
-
|
5780
|
-
|
5781
|
-
|
5782
|
-
|
5783
|
-
|
5784
|
-
|
5785
|
-
|
5786
|
-
|
5787
|
-
return setDrawerOpen(function (isDrawerOpen) {
|
5788
|
-
return !isDrawerOpen;
|
5789
|
-
});
|
5790
|
-
}
|
5791
|
-
},
|
5792
|
-
elements: {
|
5793
|
-
drawer: drawer,
|
5794
|
-
extra: extra
|
5795
|
-
},
|
5796
|
-
onClose: onClose,
|
5797
|
-
props: otherProps,
|
5798
|
-
showCloseButton: showCloseButton,
|
5799
|
-
size: size,
|
5800
|
-
ref: ref
|
5801
|
-
};
|
5802
|
-
}, [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]);
|
5725
|
+
const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
|
5726
|
+
const {
|
5727
|
+
children: initialChildren,
|
5728
|
+
closeOnEscape = true,
|
5729
|
+
defaultOpen,
|
5730
|
+
draggable = false,
|
5731
|
+
onChange,
|
5732
|
+
onClose,
|
5733
|
+
open,
|
5734
|
+
showCloseButton = true,
|
5735
|
+
size = 'sm',
|
5736
|
+
trigger,
|
5737
|
+
...otherProps
|
5738
|
+
} = props;
|
5739
|
+
const [children, drawer, extra] = useSeparatedChildren(initialChildren);
|
5740
|
+
const [drawerOpen, setDrawerOpen] = React.useState(false);
|
5741
|
+
const context = React.useMemo(() => ({
|
5742
|
+
closeOnEscape,
|
5743
|
+
draggable,
|
5744
|
+
drawer: {
|
5745
|
+
open: drawerOpen,
|
5746
|
+
toggle: () => setDrawerOpen(isDrawerOpen => !isDrawerOpen)
|
5747
|
+
},
|
5748
|
+
elements: {
|
5749
|
+
drawer,
|
5750
|
+
extra
|
5751
|
+
},
|
5752
|
+
onClose,
|
5753
|
+
props: otherProps,
|
5754
|
+
showCloseButton,
|
5755
|
+
size,
|
5756
|
+
ref
|
5757
|
+
}), [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]);
|
5803
5758
|
return React.createElement(DialogContext.Provider, {
|
5804
5759
|
value: context
|
5805
5760
|
}, React.createElement(DialogPrimitive.Root, {
|
@@ -5816,19 +5771,18 @@ Dialog.Extra = Extra;
|
|
5816
5771
|
Dialog.Drawer = Drawer;
|
5817
5772
|
Dialog.Close = Close$2;
|
5818
5773
|
|
5819
|
-
|
5820
|
-
|
5821
|
-
|
5822
|
-
|
5823
|
-
|
5824
|
-
|
5825
|
-
|
5826
|
-
|
5827
|
-
|
5828
|
-
var className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5774
|
+
const Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
5775
|
+
const {
|
5776
|
+
disabled,
|
5777
|
+
children,
|
5778
|
+
invalid = false,
|
5779
|
+
message,
|
5780
|
+
...otherProps
|
5781
|
+
} = props;
|
5782
|
+
const className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5829
5783
|
'text-grey-dark': disabled
|
5830
5784
|
}, props.className);
|
5831
|
-
|
5785
|
+
const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {
|
5832
5786
|
'text-grey-darkest': !invalid,
|
5833
5787
|
'text-red': invalid,
|
5834
5788
|
'opacity-50': disabled
|
@@ -5843,13 +5797,12 @@ var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
|
5843
5797
|
}, message));
|
5844
5798
|
});
|
5845
5799
|
|
5846
|
-
|
5847
|
-
|
5848
|
-
|
5849
|
-
|
5850
|
-
|
5851
|
-
|
5852
|
-
var className = cn('yt-form', {
|
5800
|
+
const Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
5801
|
+
const {
|
5802
|
+
horizontal = false,
|
5803
|
+
...otherProps
|
5804
|
+
} = props;
|
5805
|
+
const className = cn('yt-form', {
|
5853
5806
|
'yt-form--horizontal flex flex-wrap': horizontal
|
5854
5807
|
}, props.className);
|
5855
5808
|
return React.createElement("form", Object.assign({}, otherProps, {
|
@@ -5859,13 +5812,12 @@ var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
|
5859
5812
|
}));
|
5860
5813
|
});
|
5861
5814
|
|
5862
|
-
|
5863
|
-
|
5864
|
-
|
5865
|
-
|
5866
|
-
|
5867
|
-
|
5868
|
-
var className = cn('flex ', props.className);
|
5815
|
+
const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
5816
|
+
const {
|
5817
|
+
as: Tag = 'span',
|
5818
|
+
...otherProps
|
5819
|
+
} = props;
|
5820
|
+
const className = cn('flex ', props.className);
|
5869
5821
|
return React.createElement(Tag, Object.assign({}, otherProps, {
|
5870
5822
|
className: className,
|
5871
5823
|
"data-taco": "group",
|
@@ -5873,19 +5825,18 @@ var Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
5873
5825
|
}));
|
5874
5826
|
});
|
5875
5827
|
|
5876
|
-
|
5877
|
-
var HangerContext = /*#__PURE__*/React.createContext({
|
5828
|
+
const HangerContext = /*#__PURE__*/React.createContext({
|
5878
5829
|
props: {},
|
5879
5830
|
ref: null
|
5880
5831
|
});
|
5881
|
-
|
5832
|
+
const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
|
5882
5833
|
var _props$children;
|
5883
5834
|
|
5884
|
-
|
5885
|
-
|
5835
|
+
const context = React.useContext(HangerContext);
|
5836
|
+
let children = props.children;
|
5886
5837
|
|
5887
5838
|
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
5888
|
-
console.warn(
|
5839
|
+
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`);
|
5889
5840
|
children = React.createElement("span", null, props.children);
|
5890
5841
|
}
|
5891
5842
|
|
@@ -5895,15 +5846,14 @@ var Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
|
|
5895
5846
|
asChild: true
|
5896
5847
|
}));
|
5897
5848
|
});
|
5898
|
-
|
5899
|
-
|
5900
|
-
|
5901
|
-
|
5902
|
-
|
5903
|
-
|
5904
|
-
var className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
|
5849
|
+
const Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
5850
|
+
const context = React.useContext(HangerContext);
|
5851
|
+
const {
|
5852
|
+
texts
|
5853
|
+
} = useLocalization();
|
5854
|
+
const className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
|
5905
5855
|
|
5906
|
-
|
5856
|
+
const handleInteractOutside = event => {
|
5907
5857
|
event.preventDefault();
|
5908
5858
|
};
|
5909
5859
|
|
@@ -5925,25 +5875,20 @@ var Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref)
|
|
5925
5875
|
onClick: context.props.onClose
|
5926
5876
|
})));
|
5927
5877
|
});
|
5928
|
-
|
5929
|
-
|
5930
|
-
|
5931
|
-
|
5932
|
-
|
5933
|
-
|
5934
|
-
|
5935
|
-
|
5936
|
-
|
5937
|
-
|
5938
|
-
|
5939
|
-
};
|
5940
|
-
}, [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
5941
|
-
|
5942
|
-
var _React$useState = React.useState(false),
|
5943
|
-
open = _React$useState[0],
|
5944
|
-
setOpen = _React$useState[1];
|
5878
|
+
const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
5879
|
+
const {
|
5880
|
+
anchor,
|
5881
|
+
children,
|
5882
|
+
defaultOpen = true,
|
5883
|
+
...otherProps
|
5884
|
+
} = props;
|
5885
|
+
const context = React.useMemo(() => ({
|
5886
|
+
props: otherProps,
|
5887
|
+
ref
|
5888
|
+
}), [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
5945
5889
|
|
5946
|
-
React.
|
5890
|
+
const [open, setOpen] = React.useState(false);
|
5891
|
+
React.useEffect(() => {
|
5947
5892
|
if (defaultOpen) {
|
5948
5893
|
setOpen(defaultOpen);
|
5949
5894
|
}
|
@@ -6109,7 +6054,7 @@ const useListbox = ({
|
|
6109
6054
|
onChange: handleInputChange,
|
6110
6055
|
ref: inputRef,
|
6111
6056
|
tabIndex: -1,
|
6112
|
-
value: value
|
6057
|
+
value: value !== null && value !== void 0 ? value : ''
|
6113
6058
|
};
|
6114
6059
|
return {
|
6115
6060
|
list,
|
@@ -6121,6 +6066,7 @@ const useMultiListbox = ({
|
|
6121
6066
|
data: externalData = [],
|
6122
6067
|
defaultValue,
|
6123
6068
|
disabled,
|
6069
|
+
emptyValue: _,
|
6124
6070
|
id: nativeId,
|
6125
6071
|
name,
|
6126
6072
|
onClick,
|
@@ -6302,49 +6248,49 @@ const useMultiListbox = ({
|
|
6302
6248
|
};
|
6303
6249
|
};
|
6304
6250
|
|
6305
|
-
|
6306
|
-
|
6307
|
-
|
6308
|
-
|
6309
|
-
|
6310
|
-
|
6311
|
-
|
6312
|
-
|
6313
|
-
|
6314
|
-
|
6315
|
-
var className = cn('bg-white inline-flex relative w-full', externalClassName);
|
6251
|
+
const Listbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
6252
|
+
const {
|
6253
|
+
className: externalClassName,
|
6254
|
+
...otherProps
|
6255
|
+
} = props;
|
6256
|
+
const {
|
6257
|
+
list,
|
6258
|
+
input
|
6259
|
+
} = useListbox(otherProps, ref);
|
6260
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
6316
6261
|
return React.createElement("span", {
|
6317
6262
|
"data-taco": "listbox",
|
6318
6263
|
className: className
|
6319
6264
|
}, React.createElement(ScrollableList, Object.assign({}, list, {
|
6320
|
-
style:
|
6265
|
+
style: { ...list.style,
|
6321
6266
|
maxHeight: 'calc(12rem + 2px)'
|
6322
6267
|
/* (6 * option height) + listbox border */
|
6323
6268
|
|
6324
|
-
}
|
6269
|
+
}
|
6325
6270
|
})), React.createElement("input", Object.assign({}, input, {
|
6326
6271
|
className: "hidden",
|
6327
6272
|
type: "text"
|
6328
6273
|
})));
|
6329
6274
|
});
|
6330
|
-
|
6331
|
-
|
6332
|
-
|
6333
|
-
|
6334
|
-
|
6335
|
-
|
6336
|
-
|
6337
|
-
|
6338
|
-
|
6275
|
+
const MultiListbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
6276
|
+
const {
|
6277
|
+
className: externalClassName,
|
6278
|
+
...otherProps
|
6279
|
+
} = props;
|
6280
|
+
const {
|
6281
|
+
list,
|
6282
|
+
input
|
6283
|
+
} = useMultiListbox(otherProps, ref);
|
6284
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
6339
6285
|
return React.createElement("span", {
|
6340
6286
|
"data-taco": "listbox",
|
6341
6287
|
className: className
|
6342
6288
|
}, React.createElement(ScrollableList, Object.assign({}, list, {
|
6343
|
-
style:
|
6289
|
+
style: { ...list.style,
|
6344
6290
|
maxHeight: 'calc(12rem + 2px + 2px)'
|
6345
6291
|
/* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
6346
6292
|
|
6347
|
-
}
|
6293
|
+
}
|
6348
6294
|
})), React.createElement("input", Object.assign({}, input, {
|
6349
6295
|
className: "hidden",
|
6350
6296
|
type: "text"
|
@@ -6607,34 +6553,26 @@ const Checkbox$1 = props => {
|
|
6607
6553
|
})), children);
|
6608
6554
|
};
|
6609
6555
|
|
6610
|
-
|
6611
|
-
|
6612
|
-
|
6613
|
-
return value === null ? '' : String(value);
|
6614
|
-
};
|
6615
|
-
var findByValue$1 = function findByValue(values, valueAsString) {
|
6616
|
-
return values.find(function (value) {
|
6617
|
-
return getRadioGroupItemValueAsString(value) === valueAsString;
|
6618
|
-
});
|
6619
|
-
};
|
6620
|
-
var RadioGroupContext = /*#__PURE__*/React.createContext({
|
6556
|
+
const getRadioGroupItemValueAsString = value => value === null ? '' : String(value);
|
6557
|
+
const findByValue$1 = (values, valueAsString) => values.find(value => getRadioGroupItemValueAsString(value) === valueAsString);
|
6558
|
+
const RadioGroupContext = /*#__PURE__*/React.createContext({
|
6621
6559
|
disabled: false,
|
6622
6560
|
invalid: false
|
6623
6561
|
});
|
6624
|
-
|
6625
|
-
|
6626
|
-
|
6627
|
-
|
6628
|
-
|
6629
|
-
|
6630
|
-
|
6631
|
-
|
6632
|
-
|
6562
|
+
const RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props, ref) {
|
6563
|
+
const context = React.useContext(RadioGroupContext);
|
6564
|
+
const {
|
6565
|
+
children,
|
6566
|
+
value,
|
6567
|
+
...otherProps
|
6568
|
+
} = props;
|
6569
|
+
const disabled = context.disabled || props.disabled;
|
6570
|
+
const className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mr-2 mt-[0.2rem] rounded-full bg-white border-2 ', {
|
6633
6571
|
'border-grey-dark focus:border-blue focus:yt-focus aria-checked:bg-blue aria-checked:border-blue': !disabled && !context.invalid,
|
6634
6572
|
'border-grey cursor-not-allowed aria-checked:bg-grey-dark aria-checked:border-grey-dark': disabled,
|
6635
6573
|
'border-red text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red': context.invalid && !disabled
|
6636
6574
|
});
|
6637
|
-
|
6575
|
+
const labelClassName = cn('flex items-center cursor-pointer', {
|
6638
6576
|
'cursor-not-allowed text-grey-dark': disabled
|
6639
6577
|
}, props.className);
|
6640
6578
|
return React.createElement("label", {
|
@@ -6648,38 +6586,34 @@ var RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props
|
|
6648
6586
|
className: "h-2 w-2 rounded-full bg-white"
|
6649
6587
|
})), children);
|
6650
6588
|
});
|
6651
|
-
|
6652
|
-
|
6653
|
-
|
6654
|
-
|
6655
|
-
|
6656
|
-
|
6657
|
-
|
6658
|
-
|
6659
|
-
|
6660
|
-
|
6661
|
-
|
6662
|
-
|
6663
|
-
|
6664
|
-
React.Children.forEach(children,
|
6589
|
+
const useRadioGroup = props => {
|
6590
|
+
const {
|
6591
|
+
children,
|
6592
|
+
defaultValue,
|
6593
|
+
disabled,
|
6594
|
+
invalid,
|
6595
|
+
onChange,
|
6596
|
+
orientation = 'vertical',
|
6597
|
+
value,
|
6598
|
+
...otherProps
|
6599
|
+
} = props;
|
6600
|
+
const values = React.useMemo(() => {
|
6601
|
+
const radioGroupItemValues = [];
|
6602
|
+
React.Children.forEach(children, child => {
|
6665
6603
|
if (React.isValidElement(child)) {
|
6666
6604
|
radioGroupItemValues.push(child.props.value);
|
6667
6605
|
}
|
6668
6606
|
});
|
6669
6607
|
return radioGroupItemValues;
|
6670
6608
|
}, [children]);
|
6671
|
-
|
6672
|
-
|
6673
|
-
|
6674
|
-
|
6675
|
-
|
6676
|
-
}, [disabled, invalid]);
|
6677
|
-
var valueProps;
|
6609
|
+
const context = React.useMemo(() => ({
|
6610
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : false,
|
6611
|
+
invalid: invalid !== null && invalid !== void 0 ? invalid : false
|
6612
|
+
}), [disabled, invalid]);
|
6613
|
+
let valueProps;
|
6678
6614
|
|
6679
6615
|
if (onChange !== undefined) {
|
6680
|
-
|
6681
|
-
return onChange(findByValue$1(values, value));
|
6682
|
-
};
|
6616
|
+
const handleChange = value => onChange(findByValue$1(values, value));
|
6683
6617
|
|
6684
6618
|
valueProps = {
|
6685
6619
|
onValueChange: handleChange,
|
@@ -6692,19 +6626,20 @@ var useRadioGroup = function useRadioGroup(props) {
|
|
6692
6626
|
}
|
6693
6627
|
|
6694
6628
|
return {
|
6695
|
-
context
|
6696
|
-
props:
|
6697
|
-
|
6698
|
-
|
6699
|
-
|
6629
|
+
context,
|
6630
|
+
props: { ...otherProps,
|
6631
|
+
...valueProps,
|
6632
|
+
children,
|
6633
|
+
orientation
|
6634
|
+
}
|
6700
6635
|
};
|
6701
6636
|
};
|
6702
|
-
|
6703
|
-
|
6704
|
-
|
6705
|
-
|
6706
|
-
|
6707
|
-
|
6637
|
+
const RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {
|
6638
|
+
const {
|
6639
|
+
context,
|
6640
|
+
props: otherProps
|
6641
|
+
} = useRadioGroup(props);
|
6642
|
+
const className = cn('flex items-start', {
|
6708
6643
|
'flex-wrap space-x-4': otherProps.orientation === 'horizontal',
|
6709
6644
|
'flex-col space-y-2': otherProps.orientation === 'vertical'
|
6710
6645
|
}, otherProps.className);
|
@@ -6817,48 +6752,26 @@ const Header = props => {
|
|
6817
6752
|
}));
|
6818
6753
|
};
|
6819
6754
|
|
6820
|
-
|
6821
|
-
|
6822
|
-
|
6823
|
-
|
6824
|
-
|
6825
|
-
|
6826
|
-
|
6827
|
-
|
6828
|
-
|
6829
|
-
|
6830
|
-
|
6831
|
-
|
6832
|
-
|
6833
|
-
|
6834
|
-
|
6835
|
-
|
6836
|
-
|
6837
|
-
|
6838
|
-
|
6839
|
-
|
6840
|
-
minWidth = _React$useState4[0],
|
6841
|
-
_setMinWidth = _React$useState4[1];
|
6842
|
-
|
6843
|
-
var context = React.useMemo(function () {
|
6844
|
-
return {
|
6845
|
-
appearance: appearance,
|
6846
|
-
setAppearance: function setAppearance(appearance) {
|
6847
|
-
return _setAppearance(appearance);
|
6848
|
-
},
|
6849
|
-
indented: indented,
|
6850
|
-
registerIndentation: function registerIndentation() {
|
6851
|
-
return setIndented(true);
|
6852
|
-
},
|
6853
|
-
minWidth: minWidth,
|
6854
|
-
setMinWidth: function setMinWidth(width) {
|
6855
|
-
return _setMinWidth(width);
|
6856
|
-
},
|
6857
|
-
close: function close() {
|
6858
|
-
return setOpen(false);
|
6859
|
-
}
|
6860
|
-
};
|
6861
|
-
}, [indented, minWidth, appearance]);
|
6755
|
+
const Menu = externalProps => {
|
6756
|
+
const {
|
6757
|
+
appearance: externalAppearance,
|
6758
|
+
children,
|
6759
|
+
trigger,
|
6760
|
+
...props
|
6761
|
+
} = externalProps;
|
6762
|
+
const [open, setOpen] = React.useState(false);
|
6763
|
+
const [appearance, setAppearance] = React.useState(externalAppearance !== null && externalAppearance !== void 0 ? externalAppearance : 'default');
|
6764
|
+
const [indented, setIndented] = React.useState(false);
|
6765
|
+
const [minWidth, setMinWidth] = React.useState(undefined);
|
6766
|
+
const context = React.useMemo(() => ({
|
6767
|
+
appearance,
|
6768
|
+
setAppearance: appearance => setAppearance(appearance),
|
6769
|
+
indented,
|
6770
|
+
registerIndentation: () => setIndented(true),
|
6771
|
+
minWidth,
|
6772
|
+
setMinWidth: width => setMinWidth(width),
|
6773
|
+
close: () => setOpen(false)
|
6774
|
+
}), [indented, minWidth, appearance]);
|
6862
6775
|
return React.createElement(MenuContext.Provider, {
|
6863
6776
|
value: context
|
6864
6777
|
}, React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
@@ -6978,25 +6891,20 @@ const useDropTarget = onDrop => {
|
|
6978
6891
|
return [isDraggedOver, props];
|
6979
6892
|
};
|
6980
6893
|
|
6981
|
-
|
6982
|
-
|
6983
|
-
|
6984
|
-
|
6985
|
-
|
6986
|
-
|
6987
|
-
|
6988
|
-
|
6989
|
-
|
6990
|
-
|
6991
|
-
|
6992
|
-
|
6993
|
-
|
6994
|
-
|
6995
|
-
isDraggedOver = _useDropTarget[0],
|
6996
|
-
dropTargetProps = _useDropTarget[1];
|
6997
|
-
|
6998
|
-
var isTreeitem = role === 'treeitem';
|
6999
|
-
var className = cn('yt-navigation__item cursor-pointer', {
|
6894
|
+
const Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
6895
|
+
const {
|
6896
|
+
active,
|
6897
|
+
children,
|
6898
|
+
onDrop,
|
6899
|
+
postfix,
|
6900
|
+
prefix,
|
6901
|
+
role,
|
6902
|
+
...otherProps
|
6903
|
+
} = props;
|
6904
|
+
const proxyRef = useProxiedRef(ref);
|
6905
|
+
const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);
|
6906
|
+
const isTreeitem = role === 'treeitem';
|
6907
|
+
const className = cn('yt-navigation__item cursor-pointer', {
|
7000
6908
|
'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,
|
7001
6909
|
'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,
|
7002
6910
|
'yt-navigation__item--active': active && !isDraggedOver,
|
@@ -7004,7 +6912,7 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
7004
6912
|
'yt-navigation__item--dropping bg-blue': isDraggedOver
|
7005
6913
|
}, props.className);
|
7006
6914
|
|
7007
|
-
|
6915
|
+
const handleClick = event => {
|
7008
6916
|
if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {
|
7009
6917
|
return;
|
7010
6918
|
}
|
@@ -7027,19 +6935,19 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
7027
6935
|
className: "yt-navigation__item__postfix ml-1"
|
7028
6936
|
}, postfix));
|
7029
6937
|
});
|
7030
|
-
|
6938
|
+
const Panel = /*#__PURE__*/React__default.forwardRef(function Panel(props, ref) {
|
7031
6939
|
return React__default.createElement("div", Object.assign({}, props, {
|
7032
6940
|
className: cn('w-full bg-white p-3', props.className),
|
7033
6941
|
ref: ref
|
7034
6942
|
}));
|
7035
6943
|
});
|
7036
|
-
|
7037
|
-
|
6944
|
+
const MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props, ref) {
|
6945
|
+
const className = cn('flex-shrink-0 space-y-1 outline-none', {
|
7038
6946
|
'bg-white pb-2': props.fixed
|
7039
6947
|
}, props.className);
|
7040
6948
|
|
7041
|
-
|
7042
|
-
|
6949
|
+
const title = expanded => {
|
6950
|
+
const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {
|
7043
6951
|
'mb-1': expanded,
|
7044
6952
|
'cursor-pointer hover:text-blue': !props.fixed
|
7045
6953
|
});
|
@@ -7056,16 +6964,14 @@ var MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props,
|
|
7056
6964
|
ref: ref
|
7057
6965
|
}));
|
7058
6966
|
});
|
7059
|
-
|
7060
|
-
|
7061
|
-
|
7062
|
-
React__default.Children.toArray(props.children).filter(
|
7063
|
-
return !!child;
|
7064
|
-
}).map(function (child) {
|
6967
|
+
const Menu$1 = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
|
6968
|
+
const scrollableAreas = React__default.useMemo(() => {
|
6969
|
+
const scrollableAreas = [];
|
6970
|
+
React__default.Children.toArray(props.children).filter(child => !!child).map(child => {
|
7065
6971
|
if (child.props.fixed) {
|
7066
6972
|
scrollableAreas.push(child);
|
7067
6973
|
} else {
|
7068
|
-
|
6974
|
+
const x = scrollableAreas[scrollableAreas.length - 1];
|
7069
6975
|
|
7070
6976
|
if (Array.isArray(x)) {
|
7071
6977
|
x.push(child);
|
@@ -7079,19 +6985,18 @@ var Menu$1 = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
|
|
7079
6985
|
return React__default.createElement(Treeview, Object.assign({}, props, {
|
7080
6986
|
className: cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className),
|
7081
6987
|
ref: ref
|
7082
|
-
}), scrollableAreas.map(
|
7083
|
-
|
7084
|
-
|
7085
|
-
|
7086
|
-
}, area) : area;
|
7087
|
-
}));
|
6988
|
+
}), scrollableAreas.map((area, i) => Array.isArray(area) ? React__default.createElement("div", {
|
6989
|
+
className: "divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto",
|
6990
|
+
key: i
|
6991
|
+
}, area) : area));
|
7088
6992
|
});
|
7089
6993
|
Menu$1.Group = MenuGroup;
|
7090
|
-
|
7091
|
-
|
7092
|
-
|
7093
|
-
|
7094
|
-
|
6994
|
+
const Navigation = /*#__PURE__*/React__default.forwardRef(function Navigation(props, ref) {
|
6995
|
+
const {
|
6996
|
+
children,
|
6997
|
+
...otherProps
|
6998
|
+
} = props;
|
6999
|
+
const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);
|
7095
7000
|
return React__default.createElement("div", Object.assign({}, otherProps, {
|
7096
7001
|
className: className,
|
7097
7002
|
"data-taco": "navigation",
|
@@ -7155,20 +7060,21 @@ const useSelect = ({
|
|
7155
7060
|
emptyValue,
|
7156
7061
|
id: nativeId,
|
7157
7062
|
multiselect,
|
7063
|
+
onBlur,
|
7158
7064
|
onClick,
|
7159
7065
|
onChange,
|
7160
7066
|
readOnly,
|
7161
|
-
value
|
7067
|
+
value,
|
7162
7068
|
...otherProps
|
7163
7069
|
}, ref) => {
|
7164
7070
|
const {
|
7165
7071
|
texts
|
7166
7072
|
} = useLocalization();
|
7167
|
-
const
|
7168
|
-
const
|
7073
|
+
const flattenedData = useFlattenedData(data);
|
7074
|
+
const listboxInputRef = useProxiedRef(ref);
|
7169
7075
|
const [open, setOpen] = React.useState(false);
|
7170
7076
|
const id = React.useMemo(() => nativeId || `select_${uuid.v4()}`, [nativeId]);
|
7171
|
-
const
|
7077
|
+
const inputRef = React.useRef(null);
|
7172
7078
|
const buttonId = `${id}-button`; // support 'escape' resetting to the value that was set when the listbox opened
|
7173
7079
|
|
7174
7080
|
const [lastValue, setLastValue] = React.useState(value);
|
@@ -7176,16 +7082,24 @@ const useSelect = ({
|
|
7176
7082
|
setLastValue(value);
|
7177
7083
|
}, [open]);
|
7178
7084
|
React.useEffect(() => {
|
7179
|
-
if (
|
7180
|
-
|
7181
|
-
|
7182
|
-
|
7183
|
-
|
7184
|
-
|
7185
|
-
|
7186
|
-
|
7187
|
-
|
7188
|
-
|
7085
|
+
if (value === undefined) {
|
7086
|
+
if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
|
7087
|
+
setInputValueByRef$1(inputRef.current, defaultValue);
|
7088
|
+
} else {
|
7089
|
+
if (emptyValue !== undefined) {
|
7090
|
+
setInputValueByRef$1(inputRef.current, emptyValue);
|
7091
|
+
} else if (data.length > 0) {
|
7092
|
+
setInputValueByRef$1(inputRef.current, data[0].value);
|
7093
|
+
}
|
7094
|
+
}
|
7095
|
+
} else {
|
7096
|
+
if (!multiselect && !findByValue(flattenedData, value)) {
|
7097
|
+
if (emptyValue !== undefined) {
|
7098
|
+
setInputValueByRef$1(inputRef.current, emptyValue);
|
7099
|
+
} else if (data.length > 0) {
|
7100
|
+
setInputValueByRef$1(inputRef.current, data[0].value);
|
7101
|
+
}
|
7102
|
+
}
|
7189
7103
|
}
|
7190
7104
|
}, []); // event handlers
|
7191
7105
|
|
@@ -7203,7 +7117,7 @@ const useSelect = ({
|
|
7203
7117
|
event.preventDefault();
|
7204
7118
|
|
7205
7119
|
if (lastValue !== undefined) {
|
7206
|
-
setInputValueByRef$1(
|
7120
|
+
setInputValueByRef$1(listboxInputRef.current, lastValue);
|
7207
7121
|
}
|
7208
7122
|
|
7209
7123
|
setOpen(false);
|
@@ -7232,6 +7146,10 @@ const useSelect = ({
|
|
7232
7146
|
|
7233
7147
|
if (!multiselect) {
|
7234
7148
|
setOpen(false);
|
7149
|
+
|
7150
|
+
if (onBlur) {
|
7151
|
+
onBlur(createCustomEvent('blur'));
|
7152
|
+
}
|
7235
7153
|
}
|
7236
7154
|
};
|
7237
7155
|
|
@@ -7242,16 +7160,16 @@ const useSelect = ({
|
|
7242
7160
|
if (multiselect) {
|
7243
7161
|
const selectedValues = (value === null || value === void 0 ? void 0 : value.toString().split(',')) || [];
|
7244
7162
|
|
7245
|
-
if (selectedValues.length ===
|
7163
|
+
if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {
|
7246
7164
|
text = texts.select.allOptionsSelected;
|
7247
7165
|
} else {
|
7248
7166
|
var _findByValue$text, _findByValue;
|
7249
7167
|
|
7250
|
-
text = (_findByValue$text = (_findByValue = findByValue(
|
7168
|
+
text = (_findByValue$text = (_findByValue = findByValue(flattenedData, selectedValues[0])) === null || _findByValue === void 0 ? void 0 : _findByValue.text) !== null && _findByValue$text !== void 0 ? _findByValue$text : '';
|
7251
7169
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
7252
7170
|
}
|
7253
7171
|
} else {
|
7254
|
-
const item = findByValue(
|
7172
|
+
const item = findByValue(flattenedData, value);
|
7255
7173
|
|
7256
7174
|
if (item) {
|
7257
7175
|
text = item.icon ? React.createElement(React.Fragment, null, React.cloneElement(item.icon, {
|
@@ -7267,7 +7185,7 @@ const useSelect = ({
|
|
7267
7185
|
if (onChange) {
|
7268
7186
|
var _item$path$split, _item$path;
|
7269
7187
|
|
7270
|
-
const item = findByValue(
|
7188
|
+
const item = findByValue(flattenedData, event.target.value);
|
7271
7189
|
event.detail = sanitizeItem(item);
|
7272
7190
|
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 : [];
|
7273
7191
|
|
@@ -7278,7 +7196,7 @@ const useSelect = ({
|
|
7278
7196
|
let lastPath;
|
7279
7197
|
event.detail.parents = indexes.map(i => {
|
7280
7198
|
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
7281
|
-
return sanitizeItem(
|
7199
|
+
return sanitizeItem(flattenedData.find(i => i.path === lastPath));
|
7282
7200
|
});
|
7283
7201
|
}
|
7284
7202
|
|
@@ -7301,21 +7219,19 @@ const useSelect = ({
|
|
7301
7219
|
data,
|
7302
7220
|
disabled,
|
7303
7221
|
emptyValue,
|
7222
|
+
onBlur,
|
7304
7223
|
onClick: handleListboxClick,
|
7305
7224
|
onChange: event => {
|
7306
|
-
|
7307
|
-
|
7308
|
-
setInputValueByRef$1(internalInputRef.current, (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
|
7225
|
+
setInputValueByRef$1(inputRef.current, event.target.value);
|
7309
7226
|
},
|
7310
7227
|
onKeyDown: handleListboxKeyDown,
|
7311
|
-
ref:
|
7312
|
-
value
|
7313
|
-
multiselect
|
7228
|
+
ref: listboxInputRef,
|
7229
|
+
value
|
7314
7230
|
};
|
7315
7231
|
const input = {
|
7316
7232
|
onChange: handleInputChange,
|
7317
|
-
ref:
|
7318
|
-
value: value !== null && value !== void 0 ? value : ''
|
7233
|
+
ref: inputRef,
|
7234
|
+
value: String(value !== null && value !== void 0 ? value : '')
|
7319
7235
|
};
|
7320
7236
|
return {
|
7321
7237
|
button,
|
@@ -7323,61 +7239,65 @@ const useSelect = ({
|
|
7323
7239
|
input,
|
7324
7240
|
popover: {
|
7325
7241
|
open,
|
7326
|
-
onOpenChange:
|
7242
|
+
onOpenChange: open => {
|
7243
|
+
if (!open && onBlur) {
|
7244
|
+
onBlur(createCustomEvent('blur'));
|
7245
|
+
}
|
7246
|
+
|
7247
|
+
setOpen(open);
|
7248
|
+
}
|
7327
7249
|
},
|
7328
7250
|
text,
|
7329
7251
|
more
|
7330
7252
|
};
|
7331
7253
|
};
|
7332
7254
|
|
7333
|
-
|
7334
|
-
|
7335
|
-
|
7336
|
-
|
7337
|
-
|
7338
|
-
|
7339
|
-
|
7340
|
-
|
7341
|
-
|
7342
|
-
|
7343
|
-
|
7344
|
-
|
7345
|
-
|
7346
|
-
|
7347
|
-
|
7348
|
-
|
7349
|
-
|
7350
|
-
|
7351
|
-
|
7352
|
-
var className = cn('inline-flex relative w-full', {
|
7255
|
+
const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
|
7256
|
+
const {
|
7257
|
+
autoFocus,
|
7258
|
+
className: externalClassName,
|
7259
|
+
highlighted,
|
7260
|
+
style,
|
7261
|
+
...otherProps
|
7262
|
+
} = props;
|
7263
|
+
const {
|
7264
|
+
button,
|
7265
|
+
listbox,
|
7266
|
+
popover,
|
7267
|
+
input,
|
7268
|
+
text,
|
7269
|
+
more = 0
|
7270
|
+
} = useSelect(otherProps, ref);
|
7271
|
+
const internalRef = React.useRef(null);
|
7272
|
+
const selectDimensions = useBoundingClientRectListener(internalRef);
|
7273
|
+
const className = cn('inline-flex relative w-full', {
|
7353
7274
|
'yt-select--readonly': props.readOnly
|
7354
7275
|
}, externalClassName);
|
7355
|
-
|
7276
|
+
const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {
|
7356
7277
|
'border-blue': popover.open
|
7357
7278
|
});
|
7358
|
-
React.useEffect(
|
7279
|
+
React.useEffect(() => {
|
7359
7280
|
if (autoFocus && internalRef.current) {
|
7360
7281
|
internalRef.current.focus();
|
7361
7282
|
}
|
7362
7283
|
}, []);
|
7363
7284
|
|
7364
|
-
|
7285
|
+
const renderMultiSelection = () => {
|
7365
7286
|
return React.createElement(React.Fragment, null, React.createElement("span", {
|
7366
7287
|
className: "flex-grow truncate text-left"
|
7367
7288
|
}, text), more > 0 && React.createElement(Badge, {
|
7368
7289
|
className: "ml-2"
|
7369
|
-
},
|
7290
|
+
}, `+${more}`));
|
7370
7291
|
};
|
7371
7292
|
|
7372
|
-
|
7293
|
+
const commonListboxProps = { ...listbox,
|
7373
7294
|
className: 'w-auto',
|
7374
7295
|
invalid: undefined,
|
7375
7296
|
style: {
|
7376
7297
|
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
7377
7298
|
},
|
7378
7299
|
tabIndex: popover.open ? 0 : -1
|
7379
|
-
}
|
7380
|
-
|
7300
|
+
};
|
7381
7301
|
return React.createElement("span", {
|
7382
7302
|
className: className,
|
7383
7303
|
"data-taco": "select",
|
@@ -7400,9 +7320,11 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
|
|
7400
7320
|
type: "text"
|
7401
7321
|
}))));
|
7402
7322
|
});
|
7403
|
-
|
7404
|
-
|
7405
|
-
|
7323
|
+
const Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
|
7324
|
+
const {
|
7325
|
+
editable,
|
7326
|
+
...otherProps
|
7327
|
+
} = props;
|
7406
7328
|
|
7407
7329
|
if (editable) {
|
7408
7330
|
return React.createElement(Combobox, Object.assign({}, otherProps, {
|
@@ -7473,47 +7395,41 @@ const usePagination = (initialPageIndex = 0, initialPageSize = 10) => {
|
|
7473
7395
|
};
|
7474
7396
|
};
|
7475
7397
|
|
7476
|
-
|
7477
|
-
|
7478
|
-
|
7479
|
-
var minItemIndex = pageIndex * pageSize + 1;
|
7480
|
-
var maxItemIndex = (pageIndex + 1) * pageSize;
|
7398
|
+
const getShowingLabel = (length, pageIndex, pageSize, texts) => {
|
7399
|
+
const minItemIndex = pageIndex * pageSize + 1;
|
7400
|
+
const maxItemIndex = (pageIndex + 1) * pageSize;
|
7481
7401
|
return texts.pagination.showingXofYofTotal.replace('[X]', length === 0 ? '0' : String(minItemIndex)).replace('[Y]', String(maxItemIndex > length ? length : maxItemIndex)).replace('[total]', String(length));
|
7482
7402
|
};
|
7483
7403
|
|
7484
|
-
|
7485
|
-
|
7486
|
-
|
7487
|
-
|
7488
|
-
|
7489
|
-
|
7490
|
-
|
7491
|
-
|
7492
|
-
|
7493
|
-
|
7494
|
-
|
7495
|
-
|
7496
|
-
|
7497
|
-
|
7498
|
-
|
7499
|
-
|
7500
|
-
|
7501
|
-
|
7502
|
-
|
7503
|
-
texts = _useLocalization.texts;
|
7504
|
-
|
7505
|
-
var maxPageIndex = Math.ceil(length / pageSize) - 1;
|
7506
|
-
var showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;
|
7404
|
+
const Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
7405
|
+
const {
|
7406
|
+
length,
|
7407
|
+
pageIndex,
|
7408
|
+
pageSize,
|
7409
|
+
pageSizes = [10, 25, 50, 100, 500],
|
7410
|
+
setPageIndex,
|
7411
|
+
setPageSize,
|
7412
|
+
showPageControls = true,
|
7413
|
+
showPageNumbers = true,
|
7414
|
+
showPageSize = true,
|
7415
|
+
dangerouslyHijackGlobalKeyboardNavigation = false,
|
7416
|
+
...otherProps
|
7417
|
+
} = props;
|
7418
|
+
const {
|
7419
|
+
texts
|
7420
|
+
} = useLocalization();
|
7421
|
+
const maxPageIndex = Math.ceil(length / pageSize) - 1;
|
7422
|
+
const showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;
|
7507
7423
|
usePaginationShortcuts({
|
7508
|
-
setPageIndex
|
7509
|
-
maxPageIndex
|
7510
|
-
pageIndex
|
7511
|
-
dangerouslyHijackGlobalKeyboardNavigation
|
7424
|
+
setPageIndex,
|
7425
|
+
maxPageIndex,
|
7426
|
+
pageIndex,
|
7427
|
+
dangerouslyHijackGlobalKeyboardNavigation
|
7512
7428
|
});
|
7513
|
-
|
7514
|
-
|
7515
|
-
|
7516
|
-
|
7429
|
+
const pageCount = Math.ceil(length / pageSize);
|
7430
|
+
const canPreviousPage = pageIndex > 0;
|
7431
|
+
const canNextPage = pageIndex < pageCount - 1;
|
7432
|
+
const className = cn('inline-flex relative justify-between items-center', props.className);
|
7517
7433
|
return React.createElement("div", Object.assign({}, otherProps, {
|
7518
7434
|
className: className,
|
7519
7435
|
"data-taco": "pagination",
|
@@ -7523,13 +7439,11 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7523
7439
|
}, getShowingLabel(length, pageIndex, pageSize, texts), React.createElement(Select, {
|
7524
7440
|
"aria-label": texts.pagination.pageSize,
|
7525
7441
|
className: "ml-4 !w-20",
|
7526
|
-
data: pageSizes.map(
|
7527
|
-
|
7528
|
-
|
7529
|
-
|
7530
|
-
|
7531
|
-
}),
|
7532
|
-
onChange: function onChange(event) {
|
7442
|
+
data: pageSizes.map(pageSize => ({
|
7443
|
+
text: String(pageSize),
|
7444
|
+
value: pageSize
|
7445
|
+
})),
|
7446
|
+
onChange: event => {
|
7533
7447
|
setPageIndex(0);
|
7534
7448
|
setPageSize(Number(event.target.value));
|
7535
7449
|
},
|
@@ -7541,18 +7455,14 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7541
7455
|
appearance: "default",
|
7542
7456
|
disabled: !canPreviousPage,
|
7543
7457
|
icon: "arrow-start",
|
7544
|
-
onClick:
|
7545
|
-
return setPageIndex(0);
|
7546
|
-
},
|
7458
|
+
onClick: () => setPageIndex(0),
|
7547
7459
|
"aria-label": showShortcutTexts ? texts.pagination.actions.firstPageWithShortcut : texts.pagination.actions.firstPage,
|
7548
7460
|
tooltip: showShortcutTexts ? texts.pagination.actions.firstPageWithShortcut : texts.pagination.actions.firstPage
|
7549
7461
|
}), React.createElement(IconButton, {
|
7550
7462
|
appearance: "default",
|
7551
7463
|
disabled: !canPreviousPage,
|
7552
7464
|
icon: "arrow-left",
|
7553
|
-
onClick:
|
7554
|
-
return setPageIndex(pageIndex - 1);
|
7555
|
-
},
|
7465
|
+
onClick: () => setPageIndex(pageIndex - 1),
|
7556
7466
|
"aria-label": showShortcutTexts ? texts.pagination.actions.previousPageWithShortcut : texts.pagination.actions.previousPage,
|
7557
7467
|
tooltip: showShortcutTexts ? texts.pagination.actions.previousPageWithShortcut : texts.pagination.actions.previousPage
|
7558
7468
|
}), showPageNumbers && pageCount > 0 && React.createElement(PageNumbers, {
|
@@ -7563,43 +7473,36 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7563
7473
|
appearance: "default",
|
7564
7474
|
disabled: !canNextPage,
|
7565
7475
|
icon: "arrow-right",
|
7566
|
-
onClick:
|
7567
|
-
return setPageIndex(pageIndex + 1);
|
7568
|
-
},
|
7476
|
+
onClick: () => setPageIndex(pageIndex + 1),
|
7569
7477
|
"aria-label": showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage,
|
7570
7478
|
tooltip: showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage
|
7571
7479
|
}), React.createElement(IconButton, {
|
7572
7480
|
appearance: "default",
|
7573
7481
|
disabled: !canNextPage,
|
7574
7482
|
icon: "arrow-end",
|
7575
|
-
onClick:
|
7576
|
-
return setPageIndex(pageCount - 1);
|
7577
|
-
},
|
7483
|
+
onClick: () => setPageIndex(pageCount - 1),
|
7578
7484
|
"aria-label": showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage,
|
7579
7485
|
tooltip: showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage
|
7580
7486
|
})));
|
7581
7487
|
});
|
7582
7488
|
|
7583
|
-
|
7584
|
-
|
7585
|
-
|
7586
|
-
|
7587
|
-
|
7588
|
-
duration = _ref$duration === void 0 ? undefined : _ref$duration,
|
7589
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$m);
|
7590
|
-
|
7591
|
-
var style;
|
7489
|
+
const Progress = ({
|
7490
|
+
duration = undefined,
|
7491
|
+
...props
|
7492
|
+
}) => {
|
7493
|
+
let style;
|
7592
7494
|
|
7593
7495
|
if (duration) {
|
7594
7496
|
style = {
|
7595
|
-
animationDuration: duration
|
7497
|
+
animationDuration: `${duration}ms`
|
7596
7498
|
};
|
7597
7499
|
}
|
7598
7500
|
|
7599
|
-
|
7600
|
-
|
7601
|
-
"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']": !duration
|
7602
|
-
|
7501
|
+
const className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);
|
7502
|
+
const progressClassName = cn('yt-progress__bar block h-1', {
|
7503
|
+
"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']": !duration,
|
7504
|
+
[`w-0 bg-grey-dark animate-[progress_linear]`]: duration
|
7505
|
+
});
|
7603
7506
|
return React__default.createElement("span", Object.assign({}, props, {
|
7604
7507
|
"data-taco": "progress",
|
7605
7508
|
className: className
|
@@ -9491,22 +9394,22 @@ var useOnClickOutside = function useOnClickOutside(ref, callback) {
|
|
9491
9394
|
}, [ref, callback]);
|
9492
9395
|
};
|
9493
9396
|
|
9494
|
-
|
9495
|
-
|
9496
|
-
|
9497
|
-
|
9498
|
-
|
9499
|
-
|
9500
|
-
|
9397
|
+
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
9398
|
+
onSearch,
|
9399
|
+
...props
|
9400
|
+
}, ref) {
|
9401
|
+
const {
|
9402
|
+
texts
|
9403
|
+
} = useLocalization();
|
9501
9404
|
|
9502
|
-
|
9405
|
+
const handleClick = () => {
|
9503
9406
|
if (!props.disabled) {
|
9504
9407
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(props.value);
|
9505
9408
|
}
|
9506
9409
|
};
|
9507
9410
|
|
9508
|
-
|
9509
|
-
|
9411
|
+
const handleKeyDown = event => {
|
9412
|
+
const isEnterKeyPressed = event.keyCode === keycode('enter');
|
9510
9413
|
|
9511
9414
|
if (isEnterKeyPressed) {
|
9512
9415
|
handleClick();
|