@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.js
CHANGED
|
@@ -7225,16 +7225,16 @@ const DisplayFormError = ({ message }) => {
|
|
|
7225
7225
|
};
|
|
7226
7226
|
|
|
7227
7227
|
const Input = React__namespace.default.forwardRef((_a, ref) => {
|
|
7228
|
-
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"]);
|
|
7228
|
+
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"]);
|
|
7229
7229
|
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
7230
7230
|
const handleClear = () => {
|
|
7231
|
-
onChange({ target: { value: '' } });
|
|
7231
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: '' } });
|
|
7232
7232
|
};
|
|
7233
7233
|
const inputClasses = classNames('input', {
|
|
7234
7234
|
error: hasErrors,
|
|
7235
7235
|
'input--has-icon': iconName,
|
|
7236
7236
|
}, className);
|
|
7237
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.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 && (jsxRuntime.jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
7237
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.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 && (jsxRuntime.jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
7238
7238
|
});
|
|
7239
7239
|
const LabeledInput = withLabel(Input);
|
|
7240
7240
|
|
|
@@ -13592,37 +13592,38 @@ const getCommonProps = (props) => {
|
|
|
13592
13592
|
});
|
|
13593
13593
|
};
|
|
13594
13594
|
|
|
13595
|
-
const
|
|
13596
|
-
|
|
13597
|
-
const
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
selected: selected,
|
|
13611
|
-
onSelect: onSelect,
|
|
13612
|
-
endMonth: endMonthDefault,
|
|
13613
|
-
},
|
|
13614
|
-
range: {
|
|
13615
|
-
mode: 'range',
|
|
13616
|
-
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
|
|
13617
|
-
selected: selected,
|
|
13618
|
-
onSelect: onSelect,
|
|
13619
|
-
endMonth: endMonthDefault,
|
|
13620
|
-
},
|
|
13595
|
+
const Form = (_a) => {
|
|
13596
|
+
var { children, onSubmit, action, method, target, autocomplete, noValidate, enctype, rel } = _a, rest = __rest(_a, ["children", "onSubmit", "action", "method", "target", "autocomplete", "noValidate", "enctype", "rel"]);
|
|
13597
|
+
const handleSubmit = (e) => {
|
|
13598
|
+
e.preventDefault(); // Prevent the default form submission
|
|
13599
|
+
// Create a FormData object, passing in the form (e.currentTarget)
|
|
13600
|
+
const formData = new FormData(e.currentTarget);
|
|
13601
|
+
// Convert FormData into a plain object
|
|
13602
|
+
const formObject = Array.from(formData.entries()).reduce((obj, [key, value]) => {
|
|
13603
|
+
obj[key] = value.toString();
|
|
13604
|
+
return obj;
|
|
13605
|
+
}, {});
|
|
13606
|
+
// Call the onSubmit prop, if provided, passing the form object instead of the event
|
|
13607
|
+
if (onSubmit) {
|
|
13608
|
+
onSubmit(formObject); // Modified to pass formObject instead of e
|
|
13609
|
+
}
|
|
13621
13610
|
};
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13611
|
+
return (jsxRuntime.jsx("form", Object.assign({ onSubmit: handleSubmit, action: action, method: method, target: target, autoComplete: autocomplete, noValidate: noValidate, encType: enctype, rel: rel }, rest, { children: children })));
|
|
13612
|
+
};
|
|
13613
|
+
|
|
13614
|
+
const Skeleton = (_a) => {
|
|
13615
|
+
var { className, height, width, isCircle, isFullHeight } = _a, rest = __rest(_a, ["className", "height", "width", "isCircle", "isFullHeight"]);
|
|
13616
|
+
const dynamicStyle = Object.assign(Object.assign({}, (height && { height: typeof height === 'number' ? `${height}px` : height })), (width && { width: typeof width === 'number' ? `${width}px` : width }));
|
|
13617
|
+
const circleClass = isCircle ? 'skeleton--circle' : '';
|
|
13618
|
+
const fullHeightClass = isFullHeight ? 'skeleton--full-height' : '';
|
|
13619
|
+
const combinedClassName = `skeleton ${circleClass} ${fullHeightClass} ${className || ''}`.trim();
|
|
13620
|
+
return jsxRuntime.jsx("div", Object.assign({ className: combinedClassName, style: dynamicStyle }, rest));
|
|
13621
|
+
};
|
|
13622
|
+
|
|
13623
|
+
const Card = (_a) => {
|
|
13624
|
+
var { className = '', children, title, subtitle, hasBoxShadow = false } = _a, rest = __rest(_a, ["className", "children", "title", "subtitle", "hasBoxShadow"]);
|
|
13625
|
+
const cardClasses = classNames('card', { 'card--box-shadow': hasBoxShadow }, className);
|
|
13626
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cardClasses }, rest, { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: "card__header", children: [title && jsxRuntime.jsx("h2", { children: title }), subtitle && jsxRuntime.jsx("p", { children: subtitle })] })), jsxRuntime.jsx("div", { className: "card__content", children: children })] })));
|
|
13626
13627
|
};
|
|
13627
13628
|
|
|
13628
13629
|
function getNodeName(node) {
|
|
@@ -15325,6 +15326,15 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
|
|
|
15325
15326
|
(isPortal ? (jsxRuntime.jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
|
|
15326
15327
|
}
|
|
15327
15328
|
|
|
15329
|
+
function Menu(_a) {
|
|
15330
|
+
var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
|
|
15331
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('menu', className) }, rest, { children: React__namespace.default.Children.map(children, (child) => React__namespace.default.isValidElement(child)
|
|
15332
|
+
? React__namespace.default.cloneElement(child, {
|
|
15333
|
+
className: classNames(child.props.className, 'menu-item'),
|
|
15334
|
+
})
|
|
15335
|
+
: child) })));
|
|
15336
|
+
}
|
|
15337
|
+
|
|
15328
15338
|
const IconTriggerDatePicker = (props) => {
|
|
15329
15339
|
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"]);
|
|
15330
15340
|
const [localMonth, setLocalMonth] = React.useState(initialMonth !== null && initialMonth !== void 0 ? initialMonth : new Date());
|
|
@@ -20772,66 +20782,6 @@ function SingleInputDatePicker(props) {
|
|
|
20772
20782
|
return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [jsxRuntime.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' }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
|
|
20773
20783
|
}
|
|
20774
20784
|
|
|
20775
|
-
const Form = (_a) => {
|
|
20776
|
-
var { children, onSubmit, action, method, target, autocomplete, noValidate, enctype, rel } = _a, rest = __rest(_a, ["children", "onSubmit", "action", "method", "target", "autocomplete", "noValidate", "enctype", "rel"]);
|
|
20777
|
-
const handleSubmit = (e) => {
|
|
20778
|
-
e.preventDefault(); // Prevent the default form submission
|
|
20779
|
-
// Create a FormData object, passing in the form (e.currentTarget)
|
|
20780
|
-
const formData = new FormData(e.currentTarget);
|
|
20781
|
-
// Convert FormData into a plain object
|
|
20782
|
-
const formObject = Array.from(formData.entries()).reduce((obj, [key, value]) => {
|
|
20783
|
-
obj[key] = value.toString();
|
|
20784
|
-
return obj;
|
|
20785
|
-
}, {});
|
|
20786
|
-
// Call the onSubmit prop, if provided, passing the form object instead of the event
|
|
20787
|
-
if (onSubmit) {
|
|
20788
|
-
onSubmit(formObject); // Modified to pass formObject instead of e
|
|
20789
|
-
}
|
|
20790
|
-
};
|
|
20791
|
-
return (jsxRuntime.jsx("form", Object.assign({ onSubmit: handleSubmit, action: action, method: method, target: target, autoComplete: autocomplete, noValidate: noValidate, encType: enctype, rel: rel }, rest, { children: children })));
|
|
20792
|
-
};
|
|
20793
|
-
|
|
20794
|
-
const Skeleton = (_a) => {
|
|
20795
|
-
var { className, height, width, isCircle, isFullHeight } = _a, rest = __rest(_a, ["className", "height", "width", "isCircle", "isFullHeight"]);
|
|
20796
|
-
const dynamicStyle = Object.assign(Object.assign({}, (height && { height: typeof height === 'number' ? `${height}px` : height })), (width && { width: typeof width === 'number' ? `${width}px` : width }));
|
|
20797
|
-
const circleClass = isCircle ? 'skeleton--circle' : '';
|
|
20798
|
-
const fullHeightClass = isFullHeight ? 'skeleton--full-height' : '';
|
|
20799
|
-
const combinedClassName = `skeleton ${circleClass} ${fullHeightClass} ${className || ''}`.trim();
|
|
20800
|
-
return jsxRuntime.jsx("div", Object.assign({ className: combinedClassName, style: dynamicStyle }, rest));
|
|
20801
|
-
};
|
|
20802
|
-
|
|
20803
|
-
const Card = (_a) => {
|
|
20804
|
-
var { className = '', children, title, subtitle, hasBoxShadow = false } = _a, rest = __rest(_a, ["className", "children", "title", "subtitle", "hasBoxShadow"]);
|
|
20805
|
-
const cardClasses = classNames('card', { 'card--box-shadow': hasBoxShadow }, className);
|
|
20806
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: cardClasses }, rest, { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: "card__header", children: [title && jsxRuntime.jsx("h2", { children: title }), subtitle && jsxRuntime.jsx("p", { children: subtitle })] })), jsxRuntime.jsx("div", { className: "card__content", children: children })] })));
|
|
20807
|
-
};
|
|
20808
|
-
|
|
20809
|
-
function Menu(_a) {
|
|
20810
|
-
var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
|
|
20811
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('menu', className) }, rest, { children: React__namespace.default.Children.map(children, (child) => React__namespace.default.isValidElement(child)
|
|
20812
|
-
? React__namespace.default.cloneElement(child, {
|
|
20813
|
-
className: classNames(child.props.className, 'menu-item'),
|
|
20814
|
-
})
|
|
20815
|
-
: child) })));
|
|
20816
|
-
}
|
|
20817
|
-
|
|
20818
|
-
const Pill = (_a) => {
|
|
20819
|
-
var { children, className, color = 'info', size = 'sm' } = _a, rest = __rest(_a, ["children", "className", "color", "size"]);
|
|
20820
|
-
const pillClasses = classNames('pill', className, {
|
|
20821
|
-
[`pill--${color}`]: color,
|
|
20822
|
-
[`pill--${size}`]: size,
|
|
20823
|
-
});
|
|
20824
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: pillClasses }, rest, { children: children })));
|
|
20825
|
-
};
|
|
20826
|
-
|
|
20827
|
-
const Badge = (_a) => {
|
|
20828
|
-
var { className = '', children, size = 'md', string } = _a, rest = __rest(_a, ["className", "children", "size", "string"]);
|
|
20829
|
-
const badgeClasses = classNames('badge', {
|
|
20830
|
-
[`badge--${size}`]: size,
|
|
20831
|
-
}, className);
|
|
20832
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: badgeClasses }, rest, { children: string ? jsxRuntime.jsx("p", { children: string }) : children })));
|
|
20833
|
-
};
|
|
20834
|
-
|
|
20835
20785
|
var lib = {exports: {}};
|
|
20836
20786
|
|
|
20837
20787
|
var Modal$2 = {};
|
|
@@ -22659,6 +22609,14 @@ const Modal = (_a) => {
|
|
|
22659
22609
|
return (jsxRuntime.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: jsxRuntime.jsxs("div", { className: "modal-content", children: [jsxRuntime.jsx(Button$1, { className: "modal-close-button", onClick: onRequestClose, variant: "link", size: "md", iconLeft: "x-close", ariaLabel: "Close" }), jsxRuntime.jsx("div", { className: "modal-body", children: children })] }) })));
|
|
22660
22610
|
};
|
|
22661
22611
|
|
|
22612
|
+
const Badge = (_a) => {
|
|
22613
|
+
var { className = '', children, size = 'md', string } = _a, rest = __rest(_a, ["className", "children", "size", "string"]);
|
|
22614
|
+
const badgeClasses = classNames('badge', {
|
|
22615
|
+
[`badge--${size}`]: size,
|
|
22616
|
+
}, className);
|
|
22617
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: badgeClasses }, rest, { children: string ? jsxRuntime.jsx("p", { children: string }) : children })));
|
|
22618
|
+
};
|
|
22619
|
+
|
|
22662
22620
|
/**
|
|
22663
22621
|
* table-core
|
|
22664
22622
|
*
|
|
@@ -43033,6 +42991,105 @@ function TanstackTable(_a) {
|
|
|
43033
42991
|
}), children: [jsxRuntime.jsx("thead", { className: "tanstack-table__thead", children: jsxRuntime.jsx(TableHeader, { table: table, ref: thRefs }) }), jsxRuntime.jsx("tbody", { className: "tanstack-table__tbody", children: renderBody() })] }), hasSelectedRows && (jsxRuntime.jsx(ActionBar, { table: table, TableActions: TableActions, className: actionBarClassName }))] }), shouldRenderPagination ? (jsxRuntime.jsx(TablePagination, { currentPage: currentPage, rowCount: rowCount, onChangePage: onChangePage, rowsPerPage: rowsPerPage, totalEntriesText: totalEntriesText !== null && totalEntriesText !== void 0 ? totalEntriesText : `${totalRowsOnPage} of ${rowCount} entries` })) : null] }));
|
|
43034
42992
|
}
|
|
43035
42993
|
|
|
42994
|
+
const hourOptions = Array.from({ length: 12 }, (_, i) => {
|
|
42995
|
+
const num = `${i + 1}`;
|
|
42996
|
+
return {
|
|
42997
|
+
label: num,
|
|
42998
|
+
value: num,
|
|
42999
|
+
};
|
|
43000
|
+
});
|
|
43001
|
+
const minuteOptions = Array.from({ length: 60 }, (_, i) => {
|
|
43002
|
+
const num = `${i}`.padStart(2, '0');
|
|
43003
|
+
return {
|
|
43004
|
+
label: num,
|
|
43005
|
+
value: num,
|
|
43006
|
+
};
|
|
43007
|
+
});
|
|
43008
|
+
const periodOptions = [
|
|
43009
|
+
{ label: 'AM', value: 'am' },
|
|
43010
|
+
{ label: 'PM', value: 'pm' },
|
|
43011
|
+
];
|
|
43012
|
+
|
|
43013
|
+
// Parse initial time value
|
|
43014
|
+
const parseTimeValue = (time) => {
|
|
43015
|
+
if (!time)
|
|
43016
|
+
return { hours: '12', minutes: '00', period: 'am' };
|
|
43017
|
+
const match = time.match(/(\d{1,2}):(\d{2})\s*(am|pm)/i);
|
|
43018
|
+
if (!match)
|
|
43019
|
+
return { hours: '12', minutes: '00', period: 'am' };
|
|
43020
|
+
const [, hours, minutes, period] = match;
|
|
43021
|
+
return {
|
|
43022
|
+
hours: hours,
|
|
43023
|
+
minutes: minutes,
|
|
43024
|
+
period: period.toLowerCase(),
|
|
43025
|
+
};
|
|
43026
|
+
};
|
|
43027
|
+
|
|
43028
|
+
const TimePicker = ({ timeValue = '', label = 'Time Picker', onTimeChange, }) => {
|
|
43029
|
+
const initialTime = parseTimeValue(timeValue);
|
|
43030
|
+
const [hours, setHours] = React.useState(initialTime.hours);
|
|
43031
|
+
const [minutes, setMinutes] = React.useState(initialTime.minutes);
|
|
43032
|
+
const [period, setPeriod] = React.useState(initialTime.period);
|
|
43033
|
+
const handleHourChange = (option) => {
|
|
43034
|
+
setHours((option === null || option === void 0 ? void 0 : option.value) || '12');
|
|
43035
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(`${(option === null || option === void 0 ? void 0 : option.value) || '12'}:${minutes} ${period.toUpperCase()}`);
|
|
43036
|
+
};
|
|
43037
|
+
const handleMinuteChange = (option) => {
|
|
43038
|
+
setMinutes((option === null || option === void 0 ? void 0 : option.value) || '00');
|
|
43039
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(`${hours}:${(option === null || option === void 0 ? void 0 : option.value) || '00'} ${period.toUpperCase()}`);
|
|
43040
|
+
};
|
|
43041
|
+
const handlePeriodChange = (option) => {
|
|
43042
|
+
setPeriod((option === null || option === void 0 ? void 0 : option.value) || 'am');
|
|
43043
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(`${hours}:${minutes} ${((option === null || option === void 0 ? void 0 : option.value) || 'am').toUpperCase()}`);
|
|
43044
|
+
};
|
|
43045
|
+
return (jsxRuntime.jsx("div", { className: "time-input-wrapper", children: jsxRuntime.jsxs(FloatUI, { ariaLabel: label, children: [jsxRuntime.jsx(LabeledInput, { "data-testid": "time-picker-input", name: "hours", label: label, hasHiddenLabel: true, value: `${hours}:${minutes} ${period.toUpperCase()}`, readonly: true, className: "time-picker-input" }), jsxRuntime.jsxs(Row, { gutterWidth: 0, className: "time-picker-row", children: [jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx(Select$1, { menuIsOpen: true, className: "hour-menu", components: { DropdownIndicator: () => null, IndicatorSeparator: () => null }, name: "hours", value: { label: hours, value: hours }, onChange: handleHourChange, options: hourOptions }) }), jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.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 }) }), jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.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 }) })] })] }) }));
|
|
43046
|
+
};
|
|
43047
|
+
|
|
43048
|
+
const DatePicker = (props) => {
|
|
43049
|
+
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"]);
|
|
43050
|
+
const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
|
|
43051
|
+
const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
|
|
43052
|
+
const modeMap = {
|
|
43053
|
+
single: {
|
|
43054
|
+
mode: 'single',
|
|
43055
|
+
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
|
|
43056
|
+
selected: selected,
|
|
43057
|
+
onSelect: onSelect,
|
|
43058
|
+
endMonth: endMonthDefault,
|
|
43059
|
+
},
|
|
43060
|
+
multiple: {
|
|
43061
|
+
mode: 'multiple',
|
|
43062
|
+
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
|
|
43063
|
+
selected: selected,
|
|
43064
|
+
onSelect: onSelect,
|
|
43065
|
+
endMonth: endMonthDefault,
|
|
43066
|
+
},
|
|
43067
|
+
range: {
|
|
43068
|
+
mode: 'range',
|
|
43069
|
+
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
|
|
43070
|
+
selected: selected,
|
|
43071
|
+
onSelect: onSelect,
|
|
43072
|
+
endMonth: endMonthDefault,
|
|
43073
|
+
},
|
|
43074
|
+
};
|
|
43075
|
+
const modeProps = modeMap[mode];
|
|
43076
|
+
const commonProps = getCommonProps(props);
|
|
43077
|
+
const handleTimeChange = (time) => {
|
|
43078
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
|
|
43079
|
+
};
|
|
43080
|
+
const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
|
|
43081
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasTimePicker && (jsxRuntime.jsx("div", { className: "time-picker-wrapper", children: jsxRuntime.jsxs(Row, { align: "center", children: [jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx("p", { className: "ma-0", children: "Select Time" }) }), jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(TimePicker, { timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange }) })] }) })), jsxRuntime.jsx(DayPicker, Object.assign({}, finalProps))] }));
|
|
43082
|
+
};
|
|
43083
|
+
|
|
43084
|
+
const Pill = (_a) => {
|
|
43085
|
+
var { children, className, color = 'info', size = 'sm' } = _a, rest = __rest(_a, ["children", "className", "color", "size"]);
|
|
43086
|
+
const pillClasses = classNames('pill', className, {
|
|
43087
|
+
[`pill--${color}`]: color,
|
|
43088
|
+
[`pill--${size}`]: size,
|
|
43089
|
+
});
|
|
43090
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: pillClasses }, rest, { children: children })));
|
|
43091
|
+
};
|
|
43092
|
+
|
|
43036
43093
|
exports.Badge = Badge;
|
|
43037
43094
|
exports.BarSpinner = BarSpinner;
|
|
43038
43095
|
exports.Button = Button$1;
|
|
@@ -43060,6 +43117,7 @@ exports.Skeleton = Skeleton;
|
|
|
43060
43117
|
exports.Table = Table;
|
|
43061
43118
|
exports.TanstackTable = TanstackTable;
|
|
43062
43119
|
exports.Textarea = LabeledTextarea;
|
|
43120
|
+
exports.TimePicker = TimePicker;
|
|
43063
43121
|
exports.ToggleInput = Toggle;
|
|
43064
43122
|
exports.Tooltip = Tooltip;
|
|
43065
43123
|
exports.arrow = arrow$2;
|