@indico-data/design-system 2.52.0 → 2.53.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/lib/components/forms/date/datePicker/types.d.ts +3 -0
- package/lib/components/forms/input/Input.d.ts +2 -1
- package/lib/components/forms/timePicker/TimePicker.d.ts +7 -0
- package/lib/components/forms/timePicker/TimePicker.stories.d.ts +6 -0
- package/lib/components/forms/timePicker/__tests__/TimePicker.test.d.ts +1 -0
- package/lib/components/forms/timePicker/constants.d.ts +13 -0
- package/lib/components/forms/timePicker/helpers.d.ts +5 -0
- package/lib/components/forms/timePicker/index.d.ts +1 -0
- package/lib/index.css +120 -1
- package/lib/index.d.ts +13 -2
- package/lib/index.esm.css +120 -1
- package/lib/index.esm.js +151 -94
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +151 -93
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/forms/date/datePicker/DatePicker.stories.tsx +67 -4
- package/src/components/forms/date/datePicker/DatePicker.tsx +28 -2
- package/src/components/forms/date/datePicker/styles/DatePicker.scss +9 -0
- package/src/components/forms/date/datePicker/types.ts +3 -0
- package/src/components/forms/form/styles/Form.scss +1 -0
- package/src/components/forms/input/Input.tsx +5 -2
- package/src/components/forms/numberInput/NumberInput.tsx +1 -1
- package/src/components/forms/timePicker/TimePicker.mdx +39 -0
- package/src/components/forms/timePicker/TimePicker.stories.tsx +79 -0
- package/src/components/forms/timePicker/TimePicker.tsx +104 -0
- package/src/components/forms/timePicker/__tests__/TimePicker.test.tsx +26 -0
- package/src/components/forms/timePicker/constants.ts +21 -0
- package/src/components/forms/timePicker/helpers.ts +14 -0
- package/src/components/forms/timePicker/index.ts +1 -0
- package/src/components/forms/timePicker/styles/TimePicker.scss +51 -0
- package/src/index.ts +1 -0
- package/src/styles/index.scss +2 -1
package/lib/index.esm.js
CHANGED
|
@@ -7200,16 +7200,16 @@ const DisplayFormError = ({ message }) => {
|
|
|
7200
7200
|
};
|
|
7201
7201
|
|
|
7202
7202
|
const Input = React__default.forwardRef((_a, ref) => {
|
|
7203
|
-
var { id, name, placeholder, isRequired, isDisabled, readonly, isClearable, errorMessage, helpText, iconName, onChange, onBlur, onKeyDown, className } = _a, rest = __rest(_a, ["id", "name", "placeholder", "isRequired", "isDisabled", "readonly", "isClearable", "errorMessage", "helpText", "iconName", "onChange", "onBlur", "onKeyDown", "className"]);
|
|
7203
|
+
var { id, name, placeholder, isRequired, isDisabled, readonly, isClearable, errorMessage, helpText, maxLength, iconName, onChange, onBlur, onKeyDown, className } = _a, rest = __rest(_a, ["id", "name", "placeholder", "isRequired", "isDisabled", "readonly", "isClearable", "errorMessage", "helpText", "maxLength", "iconName", "onChange", "onBlur", "onKeyDown", "className"]);
|
|
7204
7204
|
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
7205
7205
|
const handleClear = () => {
|
|
7206
|
-
onChange({ target: { value: '' } });
|
|
7206
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: '' } });
|
|
7207
7207
|
};
|
|
7208
7208
|
const inputClasses = classNames('input', {
|
|
7209
7209
|
error: hasErrors,
|
|
7210
7210
|
'input--has-icon': iconName,
|
|
7211
7211
|
}, className);
|
|
7212
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsx("input", Object.assign({ ref: ref, id: id, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, readOnly: readonly, onChange: onChange, onBlur: onBlur, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
7212
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsx("input", Object.assign({ ref: ref, id: id, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, readOnly: readonly, onChange: onChange, onBlur: onBlur, maxLength: maxLength, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
7213
7213
|
});
|
|
7214
7214
|
const LabeledInput = withLabel(Input);
|
|
7215
7215
|
|
|
@@ -13567,37 +13567,38 @@ const getCommonProps = (props) => {
|
|
|
13567
13567
|
});
|
|
13568
13568
|
};
|
|
13569
13569
|
|
|
13570
|
-
const
|
|
13571
|
-
|
|
13572
|
-
const
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
selected: selected,
|
|
13586
|
-
onSelect: onSelect,
|
|
13587
|
-
endMonth: endMonthDefault,
|
|
13588
|
-
},
|
|
13589
|
-
range: {
|
|
13590
|
-
mode: 'range',
|
|
13591
|
-
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
|
|
13592
|
-
selected: selected,
|
|
13593
|
-
onSelect: onSelect,
|
|
13594
|
-
endMonth: endMonthDefault,
|
|
13595
|
-
},
|
|
13570
|
+
const Form = (_a) => {
|
|
13571
|
+
var { children, onSubmit, action, method, target, autocomplete, noValidate, enctype, rel } = _a, rest = __rest(_a, ["children", "onSubmit", "action", "method", "target", "autocomplete", "noValidate", "enctype", "rel"]);
|
|
13572
|
+
const handleSubmit = (e) => {
|
|
13573
|
+
e.preventDefault(); // Prevent the default form submission
|
|
13574
|
+
// Create a FormData object, passing in the form (e.currentTarget)
|
|
13575
|
+
const formData = new FormData(e.currentTarget);
|
|
13576
|
+
// Convert FormData into a plain object
|
|
13577
|
+
const formObject = Array.from(formData.entries()).reduce((obj, [key, value]) => {
|
|
13578
|
+
obj[key] = value.toString();
|
|
13579
|
+
return obj;
|
|
13580
|
+
}, {});
|
|
13581
|
+
// Call the onSubmit prop, if provided, passing the form object instead of the event
|
|
13582
|
+
if (onSubmit) {
|
|
13583
|
+
onSubmit(formObject); // Modified to pass formObject instead of e
|
|
13584
|
+
}
|
|
13596
13585
|
};
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13586
|
+
return (jsx("form", Object.assign({ onSubmit: handleSubmit, action: action, method: method, target: target, autoComplete: autocomplete, noValidate: noValidate, encType: enctype, rel: rel }, rest, { children: children })));
|
|
13587
|
+
};
|
|
13588
|
+
|
|
13589
|
+
const Skeleton = (_a) => {
|
|
13590
|
+
var { className, height, width, isCircle, isFullHeight } = _a, rest = __rest(_a, ["className", "height", "width", "isCircle", "isFullHeight"]);
|
|
13591
|
+
const dynamicStyle = Object.assign(Object.assign({}, (height && { height: typeof height === 'number' ? `${height}px` : height })), (width && { width: typeof width === 'number' ? `${width}px` : width }));
|
|
13592
|
+
const circleClass = isCircle ? 'skeleton--circle' : '';
|
|
13593
|
+
const fullHeightClass = isFullHeight ? 'skeleton--full-height' : '';
|
|
13594
|
+
const combinedClassName = `skeleton ${circleClass} ${fullHeightClass} ${className || ''}`.trim();
|
|
13595
|
+
return jsx("div", Object.assign({ className: combinedClassName, style: dynamicStyle }, rest));
|
|
13596
|
+
};
|
|
13597
|
+
|
|
13598
|
+
const Card = (_a) => {
|
|
13599
|
+
var { className = '', children, title, subtitle, hasBoxShadow = false } = _a, rest = __rest(_a, ["className", "children", "title", "subtitle", "hasBoxShadow"]);
|
|
13600
|
+
const cardClasses = classNames('card', { 'card--box-shadow': hasBoxShadow }, className);
|
|
13601
|
+
return (jsxs("div", Object.assign({ className: cardClasses }, rest, { children: [(title || subtitle) && (jsxs("div", { className: "card__header", children: [title && jsx("h2", { children: title }), subtitle && jsx("p", { children: subtitle })] })), jsx("div", { className: "card__content", children: children })] })));
|
|
13601
13602
|
};
|
|
13602
13603
|
|
|
13603
13604
|
function getNodeName(node) {
|
|
@@ -15300,6 +15301,15 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
|
|
|
15300
15301
|
(isPortal ? (jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
|
|
15301
15302
|
}
|
|
15302
15303
|
|
|
15304
|
+
function Menu(_a) {
|
|
15305
|
+
var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
|
|
15306
|
+
return (jsx("div", Object.assign({ className: classNames('menu', className) }, rest, { children: React__default.Children.map(children, (child) => React__default.isValidElement(child)
|
|
15307
|
+
? React__default.cloneElement(child, {
|
|
15308
|
+
className: classNames(child.props.className, 'menu-item'),
|
|
15309
|
+
})
|
|
15310
|
+
: child) })));
|
|
15311
|
+
}
|
|
15312
|
+
|
|
15303
15313
|
const IconTriggerDatePicker = (props) => {
|
|
15304
15314
|
const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, id, label, onSelect, selected, triggerIcon, triggerIconSize, mode, isOpen, clearOnClose, initialMonth } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "id", "label", "onSelect", "selected", "triggerIcon", "triggerIconSize", "mode", "isOpen", "clearOnClose", "initialMonth"]);
|
|
15305
15315
|
const [localMonth, setLocalMonth] = useState(initialMonth !== null && initialMonth !== void 0 ? initialMonth : new Date());
|
|
@@ -20747,66 +20757,6 @@ function SingleInputDatePicker(props) {
|
|
|
20747
20757
|
return (jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [jsx(LabeledInput, { id: inputId, value: localTextValue, placeholder: inputPlaceholder, isDisabled: isDisabled, iconName: inputIconName, isClearable: isClearable, onChange: handleInputChange, errorMessage: errorMessage, label: 'Single Date Picker', name: 'Date Picker' }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
|
|
20748
20758
|
}
|
|
20749
20759
|
|
|
20750
|
-
const Form = (_a) => {
|
|
20751
|
-
var { children, onSubmit, action, method, target, autocomplete, noValidate, enctype, rel } = _a, rest = __rest(_a, ["children", "onSubmit", "action", "method", "target", "autocomplete", "noValidate", "enctype", "rel"]);
|
|
20752
|
-
const handleSubmit = (e) => {
|
|
20753
|
-
e.preventDefault(); // Prevent the default form submission
|
|
20754
|
-
// Create a FormData object, passing in the form (e.currentTarget)
|
|
20755
|
-
const formData = new FormData(e.currentTarget);
|
|
20756
|
-
// Convert FormData into a plain object
|
|
20757
|
-
const formObject = Array.from(formData.entries()).reduce((obj, [key, value]) => {
|
|
20758
|
-
obj[key] = value.toString();
|
|
20759
|
-
return obj;
|
|
20760
|
-
}, {});
|
|
20761
|
-
// Call the onSubmit prop, if provided, passing the form object instead of the event
|
|
20762
|
-
if (onSubmit) {
|
|
20763
|
-
onSubmit(formObject); // Modified to pass formObject instead of e
|
|
20764
|
-
}
|
|
20765
|
-
};
|
|
20766
|
-
return (jsx("form", Object.assign({ onSubmit: handleSubmit, action: action, method: method, target: target, autoComplete: autocomplete, noValidate: noValidate, encType: enctype, rel: rel }, rest, { children: children })));
|
|
20767
|
-
};
|
|
20768
|
-
|
|
20769
|
-
const Skeleton = (_a) => {
|
|
20770
|
-
var { className, height, width, isCircle, isFullHeight } = _a, rest = __rest(_a, ["className", "height", "width", "isCircle", "isFullHeight"]);
|
|
20771
|
-
const dynamicStyle = Object.assign(Object.assign({}, (height && { height: typeof height === 'number' ? `${height}px` : height })), (width && { width: typeof width === 'number' ? `${width}px` : width }));
|
|
20772
|
-
const circleClass = isCircle ? 'skeleton--circle' : '';
|
|
20773
|
-
const fullHeightClass = isFullHeight ? 'skeleton--full-height' : '';
|
|
20774
|
-
const combinedClassName = `skeleton ${circleClass} ${fullHeightClass} ${className || ''}`.trim();
|
|
20775
|
-
return jsx("div", Object.assign({ className: combinedClassName, style: dynamicStyle }, rest));
|
|
20776
|
-
};
|
|
20777
|
-
|
|
20778
|
-
const Card = (_a) => {
|
|
20779
|
-
var { className = '', children, title, subtitle, hasBoxShadow = false } = _a, rest = __rest(_a, ["className", "children", "title", "subtitle", "hasBoxShadow"]);
|
|
20780
|
-
const cardClasses = classNames('card', { 'card--box-shadow': hasBoxShadow }, className);
|
|
20781
|
-
return (jsxs("div", Object.assign({ className: cardClasses }, rest, { children: [(title || subtitle) && (jsxs("div", { className: "card__header", children: [title && jsx("h2", { children: title }), subtitle && jsx("p", { children: subtitle })] })), jsx("div", { className: "card__content", children: children })] })));
|
|
20782
|
-
};
|
|
20783
|
-
|
|
20784
|
-
function Menu(_a) {
|
|
20785
|
-
var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
|
|
20786
|
-
return (jsx("div", Object.assign({ className: classNames('menu', className) }, rest, { children: React__default.Children.map(children, (child) => React__default.isValidElement(child)
|
|
20787
|
-
? React__default.cloneElement(child, {
|
|
20788
|
-
className: classNames(child.props.className, 'menu-item'),
|
|
20789
|
-
})
|
|
20790
|
-
: child) })));
|
|
20791
|
-
}
|
|
20792
|
-
|
|
20793
|
-
const Pill = (_a) => {
|
|
20794
|
-
var { children, className, color = 'info', size = 'sm' } = _a, rest = __rest(_a, ["children", "className", "color", "size"]);
|
|
20795
|
-
const pillClasses = classNames('pill', className, {
|
|
20796
|
-
[`pill--${color}`]: color,
|
|
20797
|
-
[`pill--${size}`]: size,
|
|
20798
|
-
});
|
|
20799
|
-
return (jsx("div", Object.assign({ className: pillClasses }, rest, { children: children })));
|
|
20800
|
-
};
|
|
20801
|
-
|
|
20802
|
-
const Badge = (_a) => {
|
|
20803
|
-
var { className = '', children, size = 'md', string } = _a, rest = __rest(_a, ["className", "children", "size", "string"]);
|
|
20804
|
-
const badgeClasses = classNames('badge', {
|
|
20805
|
-
[`badge--${size}`]: size,
|
|
20806
|
-
}, className);
|
|
20807
|
-
return (jsx("div", Object.assign({ className: badgeClasses }, rest, { children: string ? jsx("p", { children: string }) : children })));
|
|
20808
|
-
};
|
|
20809
|
-
|
|
20810
20760
|
var lib = {exports: {}};
|
|
20811
20761
|
|
|
20812
20762
|
var Modal$2 = {};
|
|
@@ -22634,6 +22584,14 @@ const Modal = (_a) => {
|
|
|
22634
22584
|
return (jsx(ReactModal, Object.assign({ style: {}, className: modalClasses, overlayClassName: overlayClasses, testId: testId, isOpen: isOpen, onRequestClose: onRequestClose, portalClassName: portalClassName, appElement: appElement, parentSelector: parentSelector, shouldCloseOnOverlayClick: shouldCloseOnOverlayClick, shouldCloseOnEsc: shouldCloseOnEsc, contentElement: contentElement, overlayElement: overlayElement }, rest, { children: jsxs("div", { className: "modal-content", children: [jsx(Button$1, { className: "modal-close-button", onClick: onRequestClose, variant: "link", size: "md", iconLeft: "x-close", ariaLabel: "Close" }), jsx("div", { className: "modal-body", children: children })] }) })));
|
|
22635
22585
|
};
|
|
22636
22586
|
|
|
22587
|
+
const Badge = (_a) => {
|
|
22588
|
+
var { className = '', children, size = 'md', string } = _a, rest = __rest(_a, ["className", "children", "size", "string"]);
|
|
22589
|
+
const badgeClasses = classNames('badge', {
|
|
22590
|
+
[`badge--${size}`]: size,
|
|
22591
|
+
}, className);
|
|
22592
|
+
return (jsx("div", Object.assign({ className: badgeClasses }, rest, { children: string ? jsx("p", { children: string }) : children })));
|
|
22593
|
+
};
|
|
22594
|
+
|
|
22637
22595
|
/**
|
|
22638
22596
|
* table-core
|
|
22639
22597
|
*
|
|
@@ -43008,5 +42966,104 @@ function TanstackTable(_a) {
|
|
|
43008
42966
|
}), children: [jsx("thead", { className: "tanstack-table__thead", children: jsx(TableHeader, { table: table, ref: thRefs }) }), jsx("tbody", { className: "tanstack-table__tbody", children: renderBody() })] }), hasSelectedRows && (jsx(ActionBar, { table: table, TableActions: TableActions, className: actionBarClassName }))] }), shouldRenderPagination ? (jsx(TablePagination, { currentPage: currentPage, rowCount: rowCount, onChangePage: onChangePage, rowsPerPage: rowsPerPage, totalEntriesText: totalEntriesText !== null && totalEntriesText !== void 0 ? totalEntriesText : `${totalRowsOnPage} of ${rowCount} entries` })) : null] }));
|
|
43009
42967
|
}
|
|
43010
42968
|
|
|
43011
|
-
|
|
42969
|
+
const hourOptions = Array.from({ length: 12 }, (_, i) => {
|
|
42970
|
+
const num = `${i + 1}`;
|
|
42971
|
+
return {
|
|
42972
|
+
label: num,
|
|
42973
|
+
value: num,
|
|
42974
|
+
};
|
|
42975
|
+
});
|
|
42976
|
+
const minuteOptions = Array.from({ length: 60 }, (_, i) => {
|
|
42977
|
+
const num = `${i}`.padStart(2, '0');
|
|
42978
|
+
return {
|
|
42979
|
+
label: num,
|
|
42980
|
+
value: num,
|
|
42981
|
+
};
|
|
42982
|
+
});
|
|
42983
|
+
const periodOptions = [
|
|
42984
|
+
{ label: 'AM', value: 'am' },
|
|
42985
|
+
{ label: 'PM', value: 'pm' },
|
|
42986
|
+
];
|
|
42987
|
+
|
|
42988
|
+
// Parse initial time value
|
|
42989
|
+
const parseTimeValue = (time) => {
|
|
42990
|
+
if (!time)
|
|
42991
|
+
return { hours: '12', minutes: '00', period: 'am' };
|
|
42992
|
+
const match = time.match(/(\d{1,2}):(\d{2})\s*(am|pm)/i);
|
|
42993
|
+
if (!match)
|
|
42994
|
+
return { hours: '12', minutes: '00', period: 'am' };
|
|
42995
|
+
const [, hours, minutes, period] = match;
|
|
42996
|
+
return {
|
|
42997
|
+
hours: hours,
|
|
42998
|
+
minutes: minutes,
|
|
42999
|
+
period: period.toLowerCase(),
|
|
43000
|
+
};
|
|
43001
|
+
};
|
|
43002
|
+
|
|
43003
|
+
const TimePicker = ({ timeValue = '', label = 'Time Picker', onTimeChange, }) => {
|
|
43004
|
+
const initialTime = parseTimeValue(timeValue);
|
|
43005
|
+
const [hours, setHours] = useState(initialTime.hours);
|
|
43006
|
+
const [minutes, setMinutes] = useState(initialTime.minutes);
|
|
43007
|
+
const [period, setPeriod] = useState(initialTime.period);
|
|
43008
|
+
const handleHourChange = (option) => {
|
|
43009
|
+
setHours((option === null || option === void 0 ? void 0 : option.value) || '12');
|
|
43010
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(`${(option === null || option === void 0 ? void 0 : option.value) || '12'}:${minutes} ${period.toUpperCase()}`);
|
|
43011
|
+
};
|
|
43012
|
+
const handleMinuteChange = (option) => {
|
|
43013
|
+
setMinutes((option === null || option === void 0 ? void 0 : option.value) || '00');
|
|
43014
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(`${hours}:${(option === null || option === void 0 ? void 0 : option.value) || '00'} ${period.toUpperCase()}`);
|
|
43015
|
+
};
|
|
43016
|
+
const handlePeriodChange = (option) => {
|
|
43017
|
+
setPeriod((option === null || option === void 0 ? void 0 : option.value) || 'am');
|
|
43018
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(`${hours}:${minutes} ${((option === null || option === void 0 ? void 0 : option.value) || 'am').toUpperCase()}`);
|
|
43019
|
+
};
|
|
43020
|
+
return (jsx("div", { className: "time-input-wrapper", children: jsxs(FloatUI, { ariaLabel: label, children: [jsx(LabeledInput, { "data-testid": "time-picker-input", name: "hours", label: label, hasHiddenLabel: true, value: `${hours}:${minutes} ${period.toUpperCase()}`, readonly: true, className: "time-picker-input" }), jsxs(Row, { gutterWidth: 0, className: "time-picker-row", children: [jsx(Col, { xs: "content", children: jsx(Select$1, { menuIsOpen: true, className: "hour-menu", components: { DropdownIndicator: () => null, IndicatorSeparator: () => null }, name: "hours", value: { label: hours, value: hours }, onChange: handleHourChange, options: hourOptions }) }), jsx(Col, { xs: "content", children: jsx(Select$1, { className: "minute-menu", components: { DropdownIndicator: () => null, IndicatorSeparator: () => null }, name: "minutes", options: minuteOptions, menuIsOpen: true, value: { label: minutes.padStart(2, '0'), value: minutes }, onChange: handleMinuteChange }) }), jsx(Col, { xs: "content", children: jsx(Select$1, { menuIsOpen: true, className: "period-menu", components: { DropdownIndicator: () => null, IndicatorSeparator: () => null }, name: "period", options: periodOptions, value: { label: period.toUpperCase(), value: period }, onChange: handlePeriodChange }) })] })] }) }));
|
|
43021
|
+
};
|
|
43022
|
+
|
|
43023
|
+
const DatePicker = (props) => {
|
|
43024
|
+
const { mode = 'single', className, captionLayout = 'dropdown', selected, hasTimePicker = false, id, month, defaultMonth, startMonth, endMonth, components, numberOfMonths, isDisabled, formatters, weekStartsOn, firstWeekContainsDate, today, timeValue, isRequired, min, max, onTimeChange, onSelect, onMonthChange, onNextClick, onPrevClick, onDayClick } = props, rest = __rest(props, ["mode", "className", "captionLayout", "selected", "hasTimePicker", "id", "month", "defaultMonth", "startMonth", "endMonth", "components", "numberOfMonths", "isDisabled", "formatters", "weekStartsOn", "firstWeekContainsDate", "today", "timeValue", "isRequired", "min", "max", "onTimeChange", "onSelect", "onMonthChange", "onNextClick", "onPrevClick", "onDayClick"]);
|
|
43025
|
+
const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
|
|
43026
|
+
const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
|
|
43027
|
+
const modeMap = {
|
|
43028
|
+
single: {
|
|
43029
|
+
mode: 'single',
|
|
43030
|
+
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
|
|
43031
|
+
selected: selected,
|
|
43032
|
+
onSelect: onSelect,
|
|
43033
|
+
endMonth: endMonthDefault,
|
|
43034
|
+
},
|
|
43035
|
+
multiple: {
|
|
43036
|
+
mode: 'multiple',
|
|
43037
|
+
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
|
|
43038
|
+
selected: selected,
|
|
43039
|
+
onSelect: onSelect,
|
|
43040
|
+
endMonth: endMonthDefault,
|
|
43041
|
+
},
|
|
43042
|
+
range: {
|
|
43043
|
+
mode: 'range',
|
|
43044
|
+
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
|
|
43045
|
+
selected: selected,
|
|
43046
|
+
onSelect: onSelect,
|
|
43047
|
+
endMonth: endMonthDefault,
|
|
43048
|
+
},
|
|
43049
|
+
};
|
|
43050
|
+
const modeProps = modeMap[mode];
|
|
43051
|
+
const commonProps = getCommonProps(props);
|
|
43052
|
+
const handleTimeChange = (time) => {
|
|
43053
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
|
|
43054
|
+
};
|
|
43055
|
+
const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
|
|
43056
|
+
return (jsxs(Fragment, { children: [hasTimePicker && (jsx("div", { className: "time-picker-wrapper", children: jsxs(Row, { align: "center", children: [jsx(Col, { xs: "content", children: jsx("p", { className: "ma-0", children: "Select Time" }) }), jsx(Col, { children: jsx(TimePicker, { timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange }) })] }) })), jsx(DayPicker, Object.assign({}, finalProps))] }));
|
|
43057
|
+
};
|
|
43058
|
+
|
|
43059
|
+
const Pill = (_a) => {
|
|
43060
|
+
var { children, className, color = 'info', size = 'sm' } = _a, rest = __rest(_a, ["children", "className", "color", "size"]);
|
|
43061
|
+
const pillClasses = classNames('pill', className, {
|
|
43062
|
+
[`pill--${color}`]: color,
|
|
43063
|
+
[`pill--${size}`]: size,
|
|
43064
|
+
});
|
|
43065
|
+
return (jsx("div", Object.assign({ className: pillClasses }, rest, { children: children })));
|
|
43066
|
+
};
|
|
43067
|
+
|
|
43068
|
+
export { Badge, BarSpinner, Button$1 as Button, Card, Checkbox, CirclePulse, CircleSpinner, Col, Container, DatePicker, FloatUI, Form, Icon, IconTriggerDatePicker, LabeledInput as Input, Menu, Modal, LabeledPasswordInput as PasswordInput, Pill, Radio as RadioInput, Row, Select$1 as SelectInput, SingleInputDatePicker, Skeleton, Table, TanstackTable, LabeledTextarea as Textarea, TimePicker, Toggle as ToggleInput, Tooltip, arrow$2 as arrow, autoPlacement, autoUpdate$1 as autoUpdate, computePosition$2 as computePosition, detectOverflow$1 as detectOverflow, flip$2 as flip, getOverflowAncestors$1 as getOverflowAncestors, hide$1 as hide, inline, limitShift, offset$2 as offset, platform$1 as platform, registerFontAwesomeIcons, shift$2 as shift, size, useFloating$1 as useFloating };
|
|
43012
43069
|
//# sourceMappingURL=index.esm.js.map
|