xmlui 0.10.7 → 0.10.10
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/lib/{index-CTri_fRG.mjs → index-C71PAj7E.mjs} +16456 -16219
- package/dist/lib/index.css +1 -1
- package/dist/{metadata/initMock-DzaOI8sC.mjs → lib/initMock-Bvbl2Pa3.mjs} +119 -113
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-DrEexTX9.mjs → metadata-utils-gIOZMGG7.mjs} +51 -46
- package/dist/lib/{server-common-ddmPKhK6.mjs → server-common-BfCSNpXG.mjs} +4467 -4437
- package/dist/lib/xmlui-parser.d.ts +3 -3
- package/dist/lib/xmlui.d.ts +14 -10
- package/dist/lib/xmlui.mjs +26 -26
- package/dist/metadata/{collectedComponentMetadata-Oj8WR8B1.mjs → collectedComponentMetadata-Dn91__HO.mjs} +18722 -18481
- package/dist/{lib/initMock-abcNyaP8.mjs → metadata/initMock-ghNfStAu.mjs} +119 -113
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +99 -99
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Accordion/AccordionItemNative.js +2 -2
- package/dist/scripts/src/components/App/AppNative.js +6 -7
- package/dist/scripts/src/components/Breakout/BreakoutNative.js +2 -2
- package/dist/scripts/src/components/Button/ButtonNative.js +4 -0
- package/dist/scripts/src/components/Carousel/Carousel.js +13 -20
- package/dist/scripts/src/components/Carousel/CarouselContext.js +11 -2
- package/dist/scripts/src/components/Carousel/CarouselItemNative.js +2 -2
- package/dist/scripts/src/components/Carousel/CarouselNative.js +2 -2
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +4 -4
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +5 -1
- package/dist/scripts/src/components/Charts/LineChart/LineChart.js +3 -3
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +5 -1
- package/dist/scripts/src/components/ComponentProvider.js +2 -0
- package/dist/scripts/src/components/DateInput/DateInput.js +7 -9
- package/dist/scripts/src/components/DateInput/DateInputNative.js +101 -38
- package/dist/scripts/src/components/ExpandableItem/ExpandableItemNative.js +18 -12
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/Input/PartialInput.js +28 -3
- package/dist/scripts/src/components/List/ListNative.js +6 -5
- package/dist/scripts/src/components/NavPanel/NavPanelNative.js +3 -8
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
- package/dist/scripts/src/components/Pagination/Pagination.js +2 -1
- package/dist/scripts/src/components/Slider/Slider.js +10 -8
- package/dist/scripts/src/components/Slider/SliderNative.js +24 -21
- package/dist/scripts/src/components/Table/Table.js +9 -6
- package/dist/scripts/src/components/Table/TableNative.js +18 -13
- package/dist/scripts/src/components/TextArea/TextAreaNative.js +3 -3
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/TimeInput/TimeInput.js +10 -10
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +87 -38
- package/dist/scripts/src/components/Timer/Timer.js +62 -0
- package/dist/scripts/src/components/Timer/TimerNative.js +179 -0
- package/dist/scripts/src/components/Toggle/Toggle.js +1 -1
- package/dist/scripts/src/components/Tooltip/Tooltip.js +9 -9
- package/dist/scripts/src/components/Tooltip/TooltipNative.js +4 -4
- package/dist/scripts/src/components/abstractions.js +6 -3
- package/dist/scripts/src/components-core/ComponentDecorator.js +3 -2
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +4 -1
- package/dist/scripts/src/components-core/interception/Backend.js +14 -1
- package/dist/scripts/src/components-core/parts.js +0 -4
- package/dist/standalone/xmlui-standalone.es.d.ts +20 -14
- package/dist/standalone/xmlui-standalone.umd.js +265 -265
- package/package.json +1 -1
- package/dist/scripts/src/components-core/ScrollContext.js +0 -11
- package/dist/scripts/src/components-core/utils/audio-utils.js +0 -83
|
@@ -57,6 +57,7 @@ const constants_1 = require("../../components-core/constants");
|
|
|
57
57
|
const misc_1 = require("../../components-core/utils/misc");
|
|
58
58
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
59
59
|
const classnames_1 = __importDefault(require("classnames"));
|
|
60
|
+
const TooltipNative_1 = require("../Tooltip/TooltipNative");
|
|
60
61
|
exports.defaultProps = {
|
|
61
62
|
step: 1,
|
|
62
63
|
min: 0,
|
|
@@ -86,8 +87,13 @@ exports.Slider = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
|
86
87
|
const _id = (0, react_1.useId)();
|
|
87
88
|
id = id || _id;
|
|
88
89
|
const inputRef = (0, react_1.useRef)(null);
|
|
90
|
+
const tooltipRef = (0, react_1.useRef)(null);
|
|
91
|
+
const thumbRef = (0, react_1.useRef)(null);
|
|
89
92
|
// Initialize localValue properly
|
|
90
93
|
const [localValue, setLocalValue] = react_1.default.useState([]);
|
|
94
|
+
const [showTooltip, setShowTooltip] = react_1.default.useState(false);
|
|
95
|
+
const onShowTooltip = (0, react_1.useCallback)(() => setShowTooltip(true), []);
|
|
96
|
+
const onHideTooltip = (0, react_1.useCallback)(() => setShowTooltip(false), []);
|
|
91
97
|
// Process initialValue on mount
|
|
92
98
|
(0, react_1.useEffect)(() => {
|
|
93
99
|
let initialVal = min;
|
|
@@ -104,8 +110,13 @@ exports.Slider = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
}
|
|
113
|
+
else if (typeof initialValue === "number") {
|
|
114
|
+
if (initialValue >= min && initialValue <= max) {
|
|
115
|
+
initialVal = initialValue;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
107
118
|
else {
|
|
108
|
-
initialVal = initialValue;
|
|
119
|
+
initialVal = formatValue(initialValue, min);
|
|
109
120
|
}
|
|
110
121
|
// Format the value properly
|
|
111
122
|
const formattedValue = formatValue(initialVal, min);
|
|
@@ -113,10 +124,10 @@ exports.Slider = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
|
113
124
|
// Notify parent component
|
|
114
125
|
if (updateState) {
|
|
115
126
|
updateState({
|
|
116
|
-
value: formattedValue.length === 1 ? formattedValue[0] : formattedValue
|
|
127
|
+
value: formattedValue.length === 1 ? formattedValue[0] : formattedValue,
|
|
117
128
|
}, { initial: true });
|
|
118
129
|
}
|
|
119
|
-
}, [initialValue, min, updateState]);
|
|
130
|
+
}, [initialValue, min, max, updateState]);
|
|
120
131
|
// Sync with external value changes
|
|
121
132
|
(0, react_1.useEffect)(() => {
|
|
122
133
|
if (value !== undefined) {
|
|
@@ -145,12 +156,8 @@ exports.Slider = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
|
145
156
|
}
|
|
146
157
|
}, [updateValue]);
|
|
147
158
|
// Component APIs
|
|
148
|
-
const handleOnFocus = (0, react_1.useCallback)((ev) =>
|
|
149
|
-
|
|
150
|
-
}, [onFocus]);
|
|
151
|
-
const handleOnBlur = (0, react_1.useCallback)((ev) => {
|
|
152
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev);
|
|
153
|
-
}, [onBlur]);
|
|
159
|
+
const handleOnFocus = (0, react_1.useCallback)((ev) => onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev), [onFocus]);
|
|
160
|
+
const handleOnBlur = (0, react_1.useCallback)((ev) => onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev), [onBlur]);
|
|
154
161
|
const focus = (0, react_1.useCallback)(() => {
|
|
155
162
|
var _a;
|
|
156
163
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -166,23 +173,19 @@ exports.Slider = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
|
166
173
|
}, [focus, registerComponentApi, setValue]);
|
|
167
174
|
// Ensure we always have at least one thumb
|
|
168
175
|
const displayValue = localValue.length > 0 ? localValue : [min];
|
|
169
|
-
|
|
170
|
-
const valuesText = displayValue.map(v => valueFormat(v)).join(', ');
|
|
171
|
-
// Create a custom label that includes the current values
|
|
172
|
-
const displayLabel = label ? (showValues ? `${label} ${valuesText}` : label) : (showValues ? valuesText : '');
|
|
173
|
-
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { labelPosition: labelPosition, label: displayLabel, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, ref: forwardedRef, id: id, isInputTemplateUsed: true, children: (0, jsx_runtime_1.jsx)("div", { className: Slider_module_scss_1.default.sliderContainer, children: (0, jsx_runtime_1.jsxs)(react_slider_1.Root, { minStepsBetweenThumbs: minStepsBetweenThumbs, ref: inputRef, tabIndex: tabIndex, "aria-readonly": readOnly, className: (0, classnames_1.default)(className, Slider_module_scss_1.default.sliderRoot, {
|
|
176
|
+
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, ref: forwardedRef, id: id, isInputTemplateUsed: true, children: (0, jsx_runtime_1.jsx)("div", { className: Slider_module_scss_1.default.sliderContainer, "data-slider-container": true, children: (0, jsx_runtime_1.jsxs)(react_slider_1.Root, { minStepsBetweenThumbs: minStepsBetweenThumbs, ref: inputRef, tabIndex: tabIndex, "aria-readonly": readOnly, className: (0, classnames_1.default)(className, Slider_module_scss_1.default.sliderRoot, {
|
|
174
177
|
[Slider_module_scss_1.default.disabled]: !enabled,
|
|
175
|
-
[Slider_module_scss_1.default.readOnly]: readOnly
|
|
176
|
-
}), style: style, max: max, min: min, inverted: inverted, step: step, disabled: !enabled, onFocus: handleOnFocus, onBlur: handleOnBlur, onValueChange: onInputChange, "aria-required": required, value: displayValue, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)(react_slider_1.Track, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderTrack, {
|
|
178
|
+
[Slider_module_scss_1.default.readOnly]: readOnly,
|
|
179
|
+
}), style: style, max: max, min: min, inverted: inverted, step: step, disabled: !enabled, onFocus: handleOnFocus, onBlur: handleOnBlur, onValueChange: onInputChange, onMouseOver: onShowTooltip, onMouseLeave: onHideTooltip, onPointerDown: onShowTooltip, "aria-required": required, value: displayValue, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)(react_slider_1.Track, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderTrack, {
|
|
177
180
|
[Slider_module_scss_1.default.disabled]: !enabled,
|
|
178
181
|
[Slider_module_scss_1.default.readOnly]: readOnly,
|
|
179
182
|
[Slider_module_scss_1.default.error]: validationStatus === "error",
|
|
180
183
|
[Slider_module_scss_1.default.warning]: validationStatus === "warning",
|
|
181
184
|
[Slider_module_scss_1.default.valid]: validationStatus === "valid",
|
|
182
185
|
}), style: rangeStyle ? Object.assign({}, rangeStyle) : undefined, children: (0, jsx_runtime_1.jsx)(react_slider_1.Range, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderRange, {
|
|
183
|
-
[Slider_module_scss_1.default.disabled]: !enabled
|
|
184
|
-
}) }) }), displayValue.map((_, index) => ((0, jsx_runtime_1.jsx)(react_slider_1.Thumb, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderThumb, {
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
[Slider_module_scss_1.default.disabled]: !enabled,
|
|
187
|
+
}) }) }), displayValue.map((_, index) => ((0, jsx_runtime_1.jsx)(TooltipNative_1.Tooltip, { ref: tooltipRef, text: valueFormat(displayValue[index]), delayDuration: 100, open: showValues && showTooltip, children: (0, jsx_runtime_1.jsx)(react_slider_1.Thumb, { ref: index === 0 ? thumbRef : null, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderThumb, {
|
|
188
|
+
[Slider_module_scss_1.default.disabled]: !enabled,
|
|
189
|
+
}), style: thumbStyle ? Object.assign({}, thumbStyle) : undefined, id: id, "data-thumb-index": index }) }, index)))] }) }) })));
|
|
187
190
|
});
|
|
188
|
-
exports.Slider.displayName =
|
|
191
|
+
exports.Slider.displayName = "Slider";
|
|
@@ -42,22 +42,25 @@ exports.TableMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
42
42
|
description: "This property holds an array of page sizes (numbers) the user can select for " +
|
|
43
43
|
"pagination. If this property is not defined, the component allows only a page size of 10 items.",
|
|
44
44
|
},
|
|
45
|
-
showPageInfo: (0, metadata_helpers_1.d)("Whether to show page information", undefined, "boolean", TableNative_1.defaultProps.showPageInfo),
|
|
46
|
-
showPageSizeSelector: (0, metadata_helpers_1.d)("Whether to show the page size selector", undefined, "boolean", TableNative_1.defaultProps.showPageSizeSelector),
|
|
47
|
-
showCurrentPage: (0, metadata_helpers_1.d)("Whether to show the current page indicator", undefined, "boolean", TableNative_1.defaultProps.showCurrentPage),
|
|
45
|
+
showPageInfo: (0, metadata_helpers_1.d)("Whether to show page information. It works the same as the [Pagination component property](./Pagination#showpageinfo).", undefined, "boolean", TableNative_1.defaultProps.showPageInfo),
|
|
46
|
+
showPageSizeSelector: (0, metadata_helpers_1.d)("Whether to show the page size selector. It works the same as the [Pagination component property](./Pagination#showpagesizeselector).", undefined, "boolean", TableNative_1.defaultProps.showPageSizeSelector),
|
|
47
|
+
showCurrentPage: (0, metadata_helpers_1.d)("Whether to show the current page indicator. It works the same as the [Pagination component property](./Pagination#showcurrentpage).", undefined, "boolean", TableNative_1.defaultProps.showCurrentPage),
|
|
48
48
|
pageSizeSelectorPosition: {
|
|
49
|
-
description: "Determines where to place the page size selector in the layout."
|
|
49
|
+
description: "Determines where to place the page size selector in the layout. " +
|
|
50
|
+
"It works the same as the [Pagination component property](./Pagination#pagesizeselectorposition).",
|
|
50
51
|
options: PaginationNative_1.PositionValues,
|
|
51
52
|
type: "string",
|
|
52
53
|
default: TableNative_1.defaultProps.pageSizeSelectorPosition,
|
|
53
54
|
},
|
|
54
55
|
pageInfoPosition: {
|
|
55
|
-
description: "Determines where to place the page information in the layout."
|
|
56
|
+
description: "Determines where to place the page information in the layout. " +
|
|
57
|
+
"It works the same as the [Pagination component property](./Pagination#pageinfoposition).",
|
|
56
58
|
options: PaginationNative_1.PositionValues,
|
|
57
59
|
type: "string",
|
|
58
60
|
default: TableNative_1.defaultProps.pageInfoPosition,
|
|
59
61
|
},
|
|
60
|
-
buttonRowPosition: (0, metadata_helpers_1.d)("Determines where to place the pagination button row in the layout.
|
|
62
|
+
buttonRowPosition: (0, metadata_helpers_1.d)("Determines where to place the pagination button row in the layout. " +
|
|
63
|
+
"It works the same as the [Pagination component property](./Pagination#buttonrowposition).", PaginationNative_1.PositionValues, "string", TableNative_1.defaultProps.buttonRowPosition),
|
|
61
64
|
rowDisabledPredicate: (0, metadata_helpers_1.d)(`This property defines a predicate function with a return value that determines if the ` +
|
|
62
65
|
`row should be disabled. The function retrieves the item to display and should return ` +
|
|
63
66
|
`a Boolean-like value.`),
|
|
@@ -35,7 +35,6 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
35
35
|
const Table_module_scss_1 = __importDefault(require("./Table.module.scss"));
|
|
36
36
|
require("./react-table-config.d.ts");
|
|
37
37
|
const constants_1 = require("../../components-core/constants");
|
|
38
|
-
const ScrollContext_1 = require("../../components-core/ScrollContext");
|
|
39
38
|
const misc_1 = require("../../components-core/utils/misc");
|
|
40
39
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
41
40
|
const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
@@ -74,7 +73,7 @@ const getCommonPinningStyles = (column) => {
|
|
|
74
73
|
};
|
|
75
74
|
// eslint-disable-next-line react/display-name
|
|
76
75
|
exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
77
|
-
var _b, _c, _d, _e;
|
|
76
|
+
var _b, _c, _d, _e, _f;
|
|
78
77
|
var { data = exports.defaultProps.data, columns = exports.defaultProps.columns, isPaginated = exports.defaultProps.isPaginated, loading = exports.defaultProps.loading, headerHeight, rowsSelectable = exports.defaultProps.rowsSelectable, enableMultiRowSelection = exports.defaultProps.enableMultiRowSelection, pageSizeOptions = exports.defaultProps.pageSizeOptions, pageSize = (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) || DEFAULT_PAGE_SIZES[0], currentPageIndex = 0, rowDisabledPredicate = defaultIsRowDisabled, sortBy, sortingDirection = exports.defaultProps.sortingDirection, iconSortAsc, iconSortDesc, iconNoSort, sortingDidChange, willSort, style, className, noDataRenderer, autoFocus = exports.defaultProps.autoFocus, hideHeader = exports.defaultProps.hideHeader, hideNoDataView = exports.defaultProps.hideNoDataView, alwaysShowSelectionHeader = exports.defaultProps.alwaysShowSelectionHeader, registerComponentApi, onSelectionDidChange, noBottomBorder = exports.defaultProps.noBottomBorder, paginationControlsLocation = exports.defaultProps.paginationControlsLocation, cellVerticalAlign = exports.defaultProps.cellVerticalAlign, buttonRowPosition = exports.defaultProps.buttonRowPosition, pageSizeSelectorPosition = exports.defaultProps.pageSizeSelectorPosition, pageInfoPosition = exports.defaultProps.pageInfoPosition, showCurrentPage = exports.defaultProps.showCurrentPage, showPageInfo = exports.defaultProps.showPageInfo, showPageSizeSelector = exports.defaultProps.showPageSizeSelector } = _a, rest = __rest(_a, ["data", "columns", "isPaginated", "loading", "headerHeight", "rowsSelectable", "enableMultiRowSelection", "pageSizeOptions", "pageSize", "currentPageIndex", "rowDisabledPredicate", "sortBy", "sortingDirection", "iconSortAsc", "iconSortDesc", "iconNoSort", "sortingDidChange", "willSort", "style", "className", "noDataRenderer", "autoFocus", "hideHeader", "hideNoDataView", "alwaysShowSelectionHeader", "registerComponentApi", "onSelectionDidChange", "noBottomBorder", "paginationControlsLocation", "cellVerticalAlign", "buttonRowPosition", "pageSizeSelectorPosition", "pageInfoPosition", "showCurrentPage", "showPageInfo", "showPageSizeSelector"])
|
|
79
78
|
// cols
|
|
80
79
|
;
|
|
@@ -312,9 +311,11 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
312
311
|
(0, react_1.useEffect)(() => {
|
|
313
312
|
setVisibleItems(rows.map((row) => row.original));
|
|
314
313
|
}, [rows]);
|
|
315
|
-
const
|
|
314
|
+
const scrollParent = (0, hooks_1.useScrollParent)((_b = wrapperRef.current) === null || _b === void 0 ? void 0 : _b.parentElement);
|
|
315
|
+
const scrollRef = (0, react_1.useRef)(scrollParent);
|
|
316
|
+
scrollRef.current = scrollParent;
|
|
316
317
|
const hasHeight = (0, hooks_1.useHasExplicitHeight)(wrapperRef);
|
|
317
|
-
const hasOutsideScroll = scrollRef && !hasHeight;
|
|
318
|
+
const hasOutsideScroll = scrollRef.current && !hasHeight;
|
|
318
319
|
const startMargin = (0, hooks_1.useStartMargin)(hasOutsideScroll, wrapperRef, scrollRef);
|
|
319
320
|
const rowVirtualizer = (0, react_virtual_1.useVirtualizer)({
|
|
320
321
|
count: rows.length,
|
|
@@ -328,11 +329,11 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
328
329
|
overscan: 5,
|
|
329
330
|
});
|
|
330
331
|
const paddingTop = rowVirtualizer.getVirtualItems().length > 0
|
|
331
|
-
? ((
|
|
332
|
+
? ((_d = (_c = rowVirtualizer.getVirtualItems()) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.start) - startMargin || 0
|
|
332
333
|
: 0;
|
|
333
334
|
const paddingBottom = rowVirtualizer.getVirtualItems().length > 0
|
|
334
335
|
? rowVirtualizer.getTotalSize() -
|
|
335
|
-
(((
|
|
336
|
+
(((_f = (_e = rowVirtualizer.getVirtualItems()) === null || _e === void 0 ? void 0 : _e[rowVirtualizer.getVirtualItems().length - 1]) === null || _f === void 0 ? void 0 : _f.end) -
|
|
336
337
|
startMargin || 0)
|
|
337
338
|
: 0;
|
|
338
339
|
const hasData = safeData.length !== 0;
|
|
@@ -397,9 +398,11 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
397
398
|
var _a, _b, _c;
|
|
398
399
|
const _d = ((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.style) || {}, { width } = _d, style = __rest(_d, ["width"]);
|
|
399
400
|
const size = header.getSize();
|
|
400
|
-
const alignmentClass = cellVerticalAlign === "top"
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
const alignmentClass = cellVerticalAlign === "top"
|
|
402
|
+
? Table_module_scss_1.default.alignTop
|
|
403
|
+
: cellVerticalAlign === "bottom"
|
|
404
|
+
? Table_module_scss_1.default.alignBottom
|
|
405
|
+
: Table_module_scss_1.default.alignCenter;
|
|
403
406
|
return ((0, jsx_runtime_1.jsxs)("th", { className: (0, classnames_1.default)(Table_module_scss_1.default.columnCell, alignmentClass), colSpan: header.colSpan, style: Object.assign({ position: "relative", width: size }, getCommonPinningStyles(header.column)), children: [(0, jsx_runtime_1.jsx)(ClickableHeader, { hasSorting: header.column.columnDef.enableSorting &&
|
|
404
407
|
!!((_b = header.column.columnDef.meta) === null || _b === void 0 ? void 0 : _b.accessorKey), updateSorting: () => { var _a; return _updateSorting((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.accessorKey); }, children: (0, jsx_runtime_1.jsxs)("div", { className: Table_module_scss_1.default.headerContent, style: style, children: [(0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()), header.column.columnDef.enableSorting && ((0, jsx_runtime_1.jsx)("span", { style: { display: "inline-flex", maxWidth: 16 }, children: (0, jsx_runtime_1.jsx)(ColumnOrderingIndicator, { iconSortAsc: iconSortAsc, iconSortDesc: iconSortDesc, iconNoSort: iconNoSort, direction: ((_c = header.column.columnDef.meta) === null || _c === void 0 ? void 0 : _c.accessorKey) === _sortBy
|
|
405
408
|
? _sortingDirection
|
|
@@ -449,9 +452,11 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
449
452
|
var _a, _b;
|
|
450
453
|
const cellRenderer = (_b = (_a = cell.column.columnDef) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.cellRenderer;
|
|
451
454
|
const size = cell.column.getSize();
|
|
452
|
-
const alignmentClass = cellVerticalAlign === "top"
|
|
453
|
-
|
|
454
|
-
|
|
455
|
+
const alignmentClass = cellVerticalAlign === "top"
|
|
456
|
+
? Table_module_scss_1.default.alignTop
|
|
457
|
+
: cellVerticalAlign === "bottom"
|
|
458
|
+
? Table_module_scss_1.default.alignBottom
|
|
459
|
+
: Table_module_scss_1.default.alignCenter;
|
|
455
460
|
return ((0, jsx_runtime_1.jsx)("td", { className: (0, classnames_1.default)(Table_module_scss_1.default.cell, alignmentClass), style: Object.assign({
|
|
456
461
|
// width: size,
|
|
457
462
|
width: size }, getCommonPinningStyles(cell.column)), children: (0, jsx_runtime_1.jsx)("div", { className: Table_module_scss_1.default.cellContent, children: cellRenderer
|
|
@@ -469,7 +474,7 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
469
474
|
paginationControls] })));
|
|
470
475
|
});
|
|
471
476
|
function ClickableHeader({ hasSorting, updateSorting, children }) {
|
|
472
|
-
return hasSorting ? ((0, jsx_runtime_1.jsx)("button", { className: Table_module_scss_1.default.clickableHeader, onClick: updateSorting, children: children })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
477
|
+
return hasSorting ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: Table_module_scss_1.default.clickableHeader, onClick: updateSorting, children: children })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
473
478
|
}
|
|
474
479
|
function ColumnOrderingIndicator({ direction, iconSortAsc = "sortasc:Table", iconSortDesc = "sortdesc:Table", iconNoSort = "nosort:Table", }) {
|
|
475
480
|
if (direction === "ascending") {
|
|
@@ -201,10 +201,10 @@ exports.TextArea = (0, react_1.forwardRef)(function TextArea(_a, forwardedRef) {
|
|
|
201
201
|
autoComplete: "off",
|
|
202
202
|
};
|
|
203
203
|
if (resize === "both" || resize === "horizontal" || resize === "vertical") {
|
|
204
|
-
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(TextAreaResizable_1.default, Object.assign({}, textareaProps, { ref: inputRef, style: style, className: (0, classnames_1.default)(
|
|
204
|
+
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(TextAreaResizable_1.default, Object.assign({}, textareaProps, { "data-part-id": parts_1.PART_INPUT, ref: inputRef, style: style, className: (0, classnames_1.default)(classes), maxRows: maxRows, minRows: minRows, rows: rows })) })));
|
|
205
205
|
}
|
|
206
206
|
if (autoSize || !(0, lodash_es_1.isNil)(maxRows) || !(0, lodash_es_1.isNil)(minRows)) {
|
|
207
|
-
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(react_textarea_autosize_1.default, Object.assign({}, textareaProps, { ref: inputRef, style: style, className: (0, classnames_1.default)(
|
|
207
|
+
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(react_textarea_autosize_1.default, Object.assign({}, textareaProps, { "data-part-id": parts_1.PART_INPUT, ref: inputRef, style: style, className: (0, classnames_1.default)(classes), maxRows: maxRows, minRows: minRows, rows: rows })) })));
|
|
208
208
|
}
|
|
209
|
-
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)("textarea", Object.assign({}, textareaProps, { ref: inputRef, rows: rows, className: (0, classnames_1.default)(
|
|
209
|
+
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)("textarea", Object.assign({}, textareaProps, { "data-part-id": parts_1.PART_INPUT, ref: inputRef, rows: rows, className: (0, classnames_1.default)(classes) })) })));
|
|
210
210
|
});
|
|
@@ -141,7 +141,7 @@ exports.TextBox = (0, react_1.forwardRef)(function TextBox(_a, ref) {
|
|
|
141
141
|
[TextBox_module_scss_1.default.error]: validationStatus === "error",
|
|
142
142
|
[TextBox_module_scss_1.default.warning]: validationStatus === "warning",
|
|
143
143
|
[TextBox_module_scss_1.default.valid]: validationStatus === "valid",
|
|
144
|
-
}), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: (0, classnames_1.default)(
|
|
144
|
+
}), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_START_ADORNMENT, text: startText, iconName: startIcon, className: (0, classnames_1.default)(TextBox_module_scss_1.default.adornment) }), (0, jsx_runtime_1.jsx)("input", { id: id, "data-part-id": parts_1.PART_INPUT, type: actualType, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, {
|
|
145
145
|
[TextBox_module_scss_1.default.readOnly]: readOnly,
|
|
146
|
-
}), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: onKeyDown, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), type === "password" && showPasswordToggle ? ((0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { iconName: showPassword ? passwordVisibleIcon : passwordHiddenIcon, className: (0, classnames_1.default)(
|
|
146
|
+
}), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: onKeyDown, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), type === "password" && showPasswordToggle ? ((0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_END_ADORNMENT, iconName: showPassword ? passwordVisibleIcon : passwordHiddenIcon, className: (0, classnames_1.default)(TextBox_module_scss_1.default.adornment, TextBox_module_scss_1.default.passwordToggle), onClick: togglePasswordVisibility })) : ((0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_END_ADORNMENT, text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment }))] }) })));
|
|
147
147
|
});
|
|
@@ -88,11 +88,6 @@ exports.TimeInputMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
88
88
|
"set, the gap declared by the current theme is used.",
|
|
89
89
|
valueType: "string",
|
|
90
90
|
},
|
|
91
|
-
mute: {
|
|
92
|
-
description: "Whether to mute the beep sound while still firing the beep event",
|
|
93
|
-
valueType: "boolean",
|
|
94
|
-
defaultValue: TimeInputNative_1.defaultProps.mute,
|
|
95
|
-
},
|
|
96
91
|
emptyCharacter: {
|
|
97
92
|
description: "Character to use as placeholder for empty time values. If longer than 1 character, uses the first character. Defaults to '-'",
|
|
98
93
|
valueType: "string",
|
|
@@ -104,7 +99,6 @@ exports.TimeInputMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
104
99
|
gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
|
|
105
100
|
lostFocus: (0, metadata_helpers_1.dLostFocus)(COMP),
|
|
106
101
|
invalidTime: (0, metadata_helpers_1.d)("Fired when the user enters an invalid time"),
|
|
107
|
-
beep: (0, metadata_helpers_1.d)("Fired when a beep sound is played due to invalid input, allowing custom feedback implementations"),
|
|
108
102
|
},
|
|
109
103
|
apis: {
|
|
110
104
|
focus: {
|
|
@@ -122,10 +116,16 @@ exports.TimeInputMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
122
116
|
value: "The new time value to set for the time picker.",
|
|
123
117
|
},
|
|
124
118
|
},
|
|
119
|
+
isoValue: {
|
|
120
|
+
description: `Get the current time value formatted in ISO standard (HH:MM:SS) using 24-hour format, suitable for JSON serialization.`,
|
|
121
|
+
signature: "isoValue(): string | null",
|
|
122
|
+
},
|
|
125
123
|
},
|
|
126
124
|
themeVars: (0, themeVars_1.parseScssVar)(TimeInput_module_scss_1.default.themeVars),
|
|
127
125
|
defaultThemeVars: {
|
|
128
126
|
// TimeInput specific theme variables
|
|
127
|
+
[`paddingHorizontal-${COMP}`]: "$space-2",
|
|
128
|
+
[`paddingVertical-${COMP}`]: "$space-2",
|
|
129
129
|
[`color-divider-${COMP}`]: "$textColor-secondary",
|
|
130
130
|
[`spacing-divider-${COMP}`]: "1px 0",
|
|
131
131
|
[`width-input-${COMP}`]: "1.8em",
|
|
@@ -135,19 +135,19 @@ exports.TimeInputMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
135
135
|
[`fontSize-input-${COMP}`]: "inherit",
|
|
136
136
|
[`borderRadius-input-${COMP}`]: "$borderRadius",
|
|
137
137
|
[`backgroundColor-input-${COMP}-invalid`]: "rgba(220, 53, 69, 0.15)",
|
|
138
|
-
[`padding-button-${COMP}`]: "4px
|
|
138
|
+
[`padding-button-${COMP}`]: "4px 4px",
|
|
139
139
|
[`borderRadius-button-${COMP}`]: "$borderRadius",
|
|
140
140
|
[`hoverColor-button-${COMP}`]: "$color-surface-800",
|
|
141
141
|
[`disabledColor-button-${COMP}`]: "$textColor-disabled",
|
|
142
142
|
[`outlineColor-button-${COMP}--focused`]: "$color-accent-500",
|
|
143
143
|
[`outlineWidth-button-${COMP}--focused`]: "2px",
|
|
144
|
-
[`outlineOffset-button-${COMP}--focused`]: "
|
|
145
|
-
[`minWidth-ampm-${COMP}`]: "2em",
|
|
144
|
+
[`outlineOffset-button-${COMP}--focused`]: "0",
|
|
145
|
+
[`minWidth-ampm-${COMP}`]: "2.2em",
|
|
146
146
|
[`fontSize-ampm-${COMP}`]: "inherit",
|
|
147
147
|
},
|
|
148
148
|
});
|
|
149
149
|
exports.timeInputComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TimeInputMd, ({ node, state, updateState, extractValue, className, lookupEventHandler, registerComponentApi, }) => {
|
|
150
150
|
const extractedInitialValue = extractValue(node.props.initialValue);
|
|
151
151
|
const stateValue = state === null || state === void 0 ? void 0 : state.value;
|
|
152
|
-
return ((0, jsx_runtime_1.jsx)(TimeInputNative_1.TimeInputNative, { className: className, initialValue: extractedInitialValue, value: stateValue, updateState: updateState, registerComponentApi: registerComponentApi, enabled: extractValue.asOptionalBoolean(node.props.enabled, TimeInputNative_1.defaultProps.enabled), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus, TimeInputNative_1.defaultProps.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly, TimeInputNative_1.defaultProps.readOnly), validationStatus: extractValue(node.props.validationStatus), hour24: extractValue.asOptionalBoolean(node.props.hour24, TimeInputNative_1.defaultProps.hour24), seconds: extractValue.asOptionalBoolean(node.props.seconds, TimeInputNative_1.defaultProps.seconds), minTime: extractValue(node.props.minTime), maxTime: extractValue(node.props.maxTime), clearable: extractValue.asOptionalBoolean(node.props.clearable, TimeInputNative_1.defaultProps.clearable), clearIcon: extractValue(node.props.clearIcon), clearToInitialValue: extractValue.asOptionalBoolean(node.props.clearToInitialValue, TimeInputNative_1.defaultProps.clearToInitialValue), required: extractValue.asOptionalBoolean(node.props.required, TimeInputNative_1.defaultProps.required), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak, TimeInputNative_1.defaultProps.labelBreak), startText: extractValue(node.props.startText), startIcon: extractValue(node.props.startIcon), endText: extractValue(node.props.endText), endIcon: extractValue(node.props.endIcon), gap: extractValue.asOptionalString(node.props.gap),
|
|
152
|
+
return ((0, jsx_runtime_1.jsx)(TimeInputNative_1.TimeInputNative, { className: className, initialValue: extractedInitialValue, value: stateValue, updateState: updateState, registerComponentApi: registerComponentApi, enabled: extractValue.asOptionalBoolean(node.props.enabled, TimeInputNative_1.defaultProps.enabled), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus, TimeInputNative_1.defaultProps.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly, TimeInputNative_1.defaultProps.readOnly), validationStatus: extractValue(node.props.validationStatus), hour24: extractValue.asOptionalBoolean(node.props.hour24, TimeInputNative_1.defaultProps.hour24), seconds: extractValue.asOptionalBoolean(node.props.seconds, TimeInputNative_1.defaultProps.seconds), minTime: extractValue(node.props.minTime), maxTime: extractValue(node.props.maxTime), clearable: extractValue.asOptionalBoolean(node.props.clearable, TimeInputNative_1.defaultProps.clearable), clearIcon: extractValue(node.props.clearIcon), clearToInitialValue: extractValue.asOptionalBoolean(node.props.clearToInitialValue, TimeInputNative_1.defaultProps.clearToInitialValue), required: extractValue.asOptionalBoolean(node.props.required, TimeInputNative_1.defaultProps.required), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak, TimeInputNative_1.defaultProps.labelBreak), startText: extractValue(node.props.startText), startIcon: extractValue(node.props.startIcon), endText: extractValue(node.props.endText), endIcon: extractValue(node.props.endIcon), gap: extractValue.asOptionalString(node.props.gap), emptyCharacter: extractValue.asOptionalString(node.props.emptyCharacter, TimeInputNative_1.defaultProps.emptyCharacter), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), onInvalidChange: lookupEventHandler("invalidTime") }));
|
|
153
153
|
});
|
|
@@ -22,13 +22,11 @@ const TimeInput_module_scss_1 = __importDefault(require("./TimeInput.module.scss
|
|
|
22
22
|
const PartialInput_1 = require("../Input/PartialInput");
|
|
23
23
|
const InputDivider_1 = require("../Input/InputDivider");
|
|
24
24
|
const misc_1 = require("../../components-core/utils/misc");
|
|
25
|
-
const audio_utils_1 = require("../../components-core/utils/audio-utils");
|
|
26
25
|
const InputAdornment_1 = require("../Input/InputAdornment");
|
|
27
26
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
28
27
|
const IconNative_1 = __importDefault(require("../Icon/IconNative"));
|
|
29
28
|
// Import utilities and types from merged utils file
|
|
30
29
|
const utils_1 = require("./utils");
|
|
31
|
-
const parts_1 = require("../../components-core/parts");
|
|
32
30
|
// Component part names
|
|
33
31
|
const PART_HOUR = "hour";
|
|
34
32
|
const PART_MINUTE = "minute";
|
|
@@ -47,11 +45,10 @@ exports.defaultProps = {
|
|
|
47
45
|
readOnly: false,
|
|
48
46
|
autoFocus: false,
|
|
49
47
|
labelBreak: false,
|
|
50
|
-
mute: false,
|
|
51
48
|
emptyCharacter: "-",
|
|
52
49
|
};
|
|
53
50
|
exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, ref) {
|
|
54
|
-
var { id, initialValue, value: controlledValue, enabled = exports.defaultProps.enabled, updateState, style, className, onDidChange, onFocus, onBlur, onInvalidChange,
|
|
51
|
+
var { id, initialValue, value: controlledValue, enabled = exports.defaultProps.enabled, updateState, style, className, onDidChange, onFocus, onBlur, onInvalidChange, validationStatus = exports.defaultProps.validationStatus, registerComponentApi, hour24 = exports.defaultProps.hour24, seconds = exports.defaultProps.seconds, minTime, maxTime, clearable = exports.defaultProps.clearable, clearIcon, clearToInitialValue = exports.defaultProps.clearToInitialValue, required = exports.defaultProps.required, startText, startIcon, endText, endIcon, gap, label, labelPosition = exports.defaultProps.labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, readOnly = exports.defaultProps.readOnly, autoFocus = exports.defaultProps.autoFocus, emptyCharacter = exports.defaultProps.emptyCharacter } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "updateState", "style", "className", "onDidChange", "onFocus", "onBlur", "onInvalidChange", "validationStatus", "registerComponentApi", "hour24", "seconds", "minTime", "maxTime", "clearable", "clearIcon", "clearToInitialValue", "required", "startText", "startIcon", "endText", "endIcon", "gap", "label", "labelPosition", "labelWidth", "labelBreak", "readOnly", "autoFocus", "emptyCharacter"]);
|
|
55
52
|
const timeInputRef = (0, react_1.useRef)(null);
|
|
56
53
|
// Refs for auto-tabbing between inputs
|
|
57
54
|
const hourInputRef = (0, react_1.useRef)(null);
|
|
@@ -105,7 +102,7 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
105
102
|
// Parse value into individual components
|
|
106
103
|
(0, react_1.useEffect)(() => {
|
|
107
104
|
if (localValue) {
|
|
108
|
-
const { amPm: parsedAmPm, hour: hourStr, minute: minuteStr, second: secondStr, } = parseTimeString(
|
|
105
|
+
const { amPm: parsedAmPm, hour: hourStr, minute: minuteStr, second: secondStr, } = parseTimeString(localValue, is12HourFormat);
|
|
109
106
|
setAmPm(parsedAmPm);
|
|
110
107
|
setHour(hourStr);
|
|
111
108
|
setMinute(minuteStr);
|
|
@@ -128,15 +125,6 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
128
125
|
}
|
|
129
126
|
onDidChange === null || onDidChange === void 0 ? void 0 : onDidChange(newValue);
|
|
130
127
|
});
|
|
131
|
-
// Method to handle beeping - both sound and event
|
|
132
|
-
const handleBeep = (0, react_1.useCallback)(() => {
|
|
133
|
-
// Play the beep sound only if not muted
|
|
134
|
-
if (!mute) {
|
|
135
|
-
(0, audio_utils_1.beep)(440, 50);
|
|
136
|
-
}
|
|
137
|
-
// Always fire the beep event for alternative implementations
|
|
138
|
-
onBeep === null || onBeep === void 0 ? void 0 : onBeep();
|
|
139
|
-
}, [onBeep, mute]);
|
|
140
128
|
// Helper function to format the complete time value
|
|
141
129
|
const formatTimeValue = (0, react_1.useCallback)((h, m, s, ap, is12Hour) => {
|
|
142
130
|
if (!h || !m) {
|
|
@@ -184,10 +172,6 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
184
172
|
const normalizedValue = normalizeFn(currentValue);
|
|
185
173
|
// Check if the current value was invalid (needed normalization or couldn't be normalized)
|
|
186
174
|
const wasInvalid = currentValue !== "" && (normalizedValue === null || normalizedValue !== currentValue);
|
|
187
|
-
if (wasInvalid) {
|
|
188
|
-
// Play beep sound and fire beep event when manually tabbing out of invalid input
|
|
189
|
-
handleBeep();
|
|
190
|
-
}
|
|
191
175
|
if (normalizedValue !== null && normalizedValue !== currentValue) {
|
|
192
176
|
setValue(normalizedValue);
|
|
193
177
|
setInvalid(false); // Clear invalid state after normalization
|
|
@@ -214,7 +198,7 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
214
198
|
const timeString = formatTimeValue(timeValues.hour, timeValues.minute, timeValues.second, amPm, is12HourFormat);
|
|
215
199
|
handleChange(timeString);
|
|
216
200
|
}
|
|
217
|
-
}, [hour, minute, second, amPm, is12HourFormat, handleChange
|
|
201
|
+
}, [hour, minute, second, amPm, is12HourFormat, handleChange]);
|
|
218
202
|
// Handle changes from individual inputs
|
|
219
203
|
const handleHourChange = (0, react_1.useMemo)(() => createInputChangeHandler("hour", setHour, setIsHourCurrentlyInvalid, (value) => isHourInvalid(value, !is12HourFormat)), [createInputChangeHandler, is12HourFormat]);
|
|
220
204
|
const handleHourBlur = (0, react_1.useMemo)(() => createInputBlurHandler("hour", setHour, setIsHourCurrentlyInvalid, (value) => normalizeHour(value, !is12HourFormat)), [createInputBlurHandler, is12HourFormat]);
|
|
@@ -283,7 +267,9 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
283
267
|
amPmButtonRef.current.focus();
|
|
284
268
|
}
|
|
285
269
|
}
|
|
286
|
-
else if (currentTarget === secondInputRef.current &&
|
|
270
|
+
else if (currentTarget === secondInputRef.current &&
|
|
271
|
+
is12HourFormat &&
|
|
272
|
+
amPmButtonRef.current) {
|
|
287
273
|
amPmButtonRef.current.focus();
|
|
288
274
|
}
|
|
289
275
|
}
|
|
@@ -361,6 +347,32 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
361
347
|
const setValue = (0, misc_1.useEvent)((newValue) => {
|
|
362
348
|
handleChange(newValue);
|
|
363
349
|
});
|
|
350
|
+
// Function to get ISO formatted time value (HH:MM:SS in 24-hour format)
|
|
351
|
+
const getIsoValue = (0, react_1.useCallback)(() => {
|
|
352
|
+
if (!hour || !minute) {
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
// Convert to 24-hour format if currently in 12-hour format
|
|
356
|
+
let hour24;
|
|
357
|
+
if (is12HourFormat && amPm) {
|
|
358
|
+
const hourInt = parseInt(hour, 10);
|
|
359
|
+
if (amPm === "am") {
|
|
360
|
+
hour24 = hourInt === 12 ? 0 : hourInt;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
// pm
|
|
364
|
+
hour24 = hourInt === 12 ? 12 : hourInt + 12;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
hour24 = parseInt(hour, 10);
|
|
369
|
+
}
|
|
370
|
+
// Format as ISO time string (HH:MM:SS)
|
|
371
|
+
const h24 = hour24.toString().padStart(2, "0");
|
|
372
|
+
const m24 = minute.padStart(2, "0");
|
|
373
|
+
const s24 = (second || "00").padStart(2, "0");
|
|
374
|
+
return `${h24}:${m24}:${s24}`;
|
|
375
|
+
}, [hour, minute, second, amPm, is12HourFormat]);
|
|
364
376
|
// Component API registration
|
|
365
377
|
(0, react_1.useImperativeHandle)(ref, () => timeInputRef.current);
|
|
366
378
|
(0, react_1.useEffect)(() => {
|
|
@@ -368,9 +380,10 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
368
380
|
registerComponentApi({
|
|
369
381
|
focus,
|
|
370
382
|
setValue,
|
|
383
|
+
isoValue: getIsoValue,
|
|
371
384
|
});
|
|
372
385
|
}
|
|
373
|
-
}, [registerComponentApi, focus, setValue]);
|
|
386
|
+
}, [registerComponentApi, focus, setValue, getIsoValue]);
|
|
374
387
|
// Custom clear icon
|
|
375
388
|
const clearIconElement = (0, react_1.useMemo)(() => {
|
|
376
389
|
if (clearIcon === null || clearIcon === "null")
|
|
@@ -393,15 +406,13 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
393
406
|
}
|
|
394
407
|
return null;
|
|
395
408
|
}, [endIcon, endText]);
|
|
396
|
-
// Create placeholder using processed empty character
|
|
397
|
-
const placeholder = processedEmptyCharacter.repeat(2);
|
|
398
409
|
const timeInputComponent = ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: timeInputRef, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.timeInputWrapper, {
|
|
399
410
|
[TimeInput_module_scss_1.default.error]: validationStatus === "error",
|
|
400
411
|
[TimeInput_module_scss_1.default.warning]: validationStatus === "warning",
|
|
401
412
|
[TimeInput_module_scss_1.default.valid]: validationStatus === "valid",
|
|
402
413
|
[TimeInput_module_scss_1.default.disabled]: !enabled,
|
|
403
414
|
[TimeInput_module_scss_1.default.readOnly]: readOnly,
|
|
404
|
-
}, className), style: Object.assign(Object.assign({}, style), { gap }), onFocusCapture: handleComponentFocus, onBlur: handleComponentBlur, "data-validation-status": validationStatus }, rest, { children: [startAdornment, (0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.inputGroup, children: [(0, jsx_runtime_1.jsx)(HourInput, { amPm: amPm, autoFocus: autoFocus, disabled: !enabled, inputRef: hourInputRef, nextInputRef: minuteInputRef, maxTime: maxTime, minTime: minTime, onChange: handleHourChange, onBlur: handleHourBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: hour, isInvalid: isHourCurrentlyInvalid, is24Hour: !is12HourFormat, emptyCharacter: processedEmptyCharacter
|
|
415
|
+
}, className), style: Object.assign(Object.assign({}, style), { gap }), onFocusCapture: handleComponentFocus, onBlur: handleComponentBlur, "data-validation-status": validationStatus }, rest, { children: [startAdornment, (0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.inputGroup, children: [(0, jsx_runtime_1.jsx)(HourInput, { amPm: amPm, autoFocus: autoFocus, disabled: !enabled, inputRef: hourInputRef, nextInputRef: minuteInputRef, maxTime: maxTime, minTime: minTime, onChange: handleHourChange, onBlur: handleHourBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: hour, isInvalid: isHourCurrentlyInvalid, is24Hour: !is12HourFormat, emptyCharacter: processedEmptyCharacter }), (0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: ":" }), (0, jsx_runtime_1.jsx)(MinuteInput, { disabled: !enabled, hour: hour, inputRef: minuteInputRef, nextInputRef: showSeconds ? secondInputRef : undefined, nextButtonRef: showSeconds ? undefined : is12HourFormat ? amPmButtonRef : undefined, maxTime: maxTime, minTime: minTime, onChange: handleMinuteChange, onBlur: handleMinuteBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, showLeadingZeros: showLeadingZeros, value: minute, isInvalid: isMinuteCurrentlyInvalid, emptyCharacter: processedEmptyCharacter }), showSeconds && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: ":", className: TimeInput_module_scss_1.default.divider }), (0, jsx_runtime_1.jsx)(SecondInput, { disabled: !enabled, hour: hour, inputRef: secondInputRef, nextButtonRef: is12HourFormat ? amPmButtonRef : undefined, maxTime: maxTime, minTime: minTime, minute: minute, onChange: handleSecondChange, onBlur: handleSecondBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, showLeadingZeros: showLeadingZeros, value: second, isInvalid: isSecondCurrentlyInvalid, emptyCharacter: processedEmptyCharacter })] })), is12HourFormat && ((0, jsx_runtime_1.jsx)(AmPmButton, { className: "timeinput", disabled: !enabled, buttonRef: amPmButtonRef, maxTime: maxTime, minTime: minTime, onClick: handleAmPmToggle, onAmPmSet: handleAmPmSet, onKeyDown: handleArrowKeys, value: amPm }))] }), clearable && ((0, jsx_runtime_1.jsx)("button", { "data-part-id": PART_CLEAR_BUTTON, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.clearButton, TimeInput_module_scss_1.default.button), disabled: !enabled, onClick: clear, onFocus: stopPropagation, type: "button", children: clearIconElement }))] }), endAdornment] })));
|
|
405
416
|
// Wrap with label if needed
|
|
406
417
|
if (label) {
|
|
407
418
|
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { label: label, labelPosition: labelPosition, labelWidth: labelWidth, labelBreak: labelBreak, required: required, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [startAdornment, timeInputComponent, endAdornment] }) }));
|
|
@@ -434,10 +445,10 @@ function AmPmButton({ ariaLabel, autoFocus, className, disabled, locale, maxTime
|
|
|
434
445
|
onAmPmSet("pm");
|
|
435
446
|
}
|
|
436
447
|
}, [onKeyDown, disabled, onAmPmSet, value, amDisabled, pmDisabled]);
|
|
437
|
-
return ((0, jsx_runtime_1.jsx)("button", { type: "button", "aria-label": ariaLabel || "Toggle AM/PM (Press A for AM, P for PM)", autoFocus: autoFocus, className: (0, classnames_1.default)(
|
|
448
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", "data-part-id": PART_AMPM, "aria-label": ariaLabel || "Toggle AM/PM (Press A for AM, P for PM)", autoFocus: autoFocus, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.amPmButton, TimeInput_module_scss_1.default.button, className), disabled: isDisabled, onClick: onClick, onKeyDown: handleKeyDown, ref: buttonRef, children: (0, jsx_runtime_1.jsx)("span", { className: TimeInput_module_scss_1.default.amPmValue, children: value ? (value === "am" ? amLabel : pmLabel) : "--" }) }));
|
|
438
449
|
}
|
|
439
450
|
function HourInput(_a) {
|
|
440
|
-
var { amPm, maxTime, minTime, value, isInvalid = false, is24Hour = false, emptyCharacter = "-"
|
|
451
|
+
var { amPm, maxTime, minTime, value, isInvalid = false, is24Hour = false, emptyCharacter = "-" } = _a, otherProps = __rest(_a, ["amPm", "maxTime", "minTime", "value", "isInvalid", "is24Hour", "emptyCharacter"]);
|
|
441
452
|
// Calculate min/max based on format
|
|
442
453
|
const { minHour, maxHour } = (() => {
|
|
443
454
|
if (is24Hour) {
|
|
@@ -476,52 +487,90 @@ function HourInput(_a) {
|
|
|
476
487
|
// Always show the raw value during typing, no conversion
|
|
477
488
|
// This allows users to see invalid input like "23" before it gets normalized on blur
|
|
478
489
|
const displayValue = value || "";
|
|
479
|
-
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { value: displayValue, emptyCharacter: emptyCharacter, placeholderLength: 2, max: maxHour, min: minHour, maxLength: 2, validateFn: (val) => isHourInvalid(val, is24Hour),
|
|
490
|
+
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { "data-part-id": PART_HOUR, value: displayValue, emptyCharacter: emptyCharacter, placeholderLength: 2, max: maxHour, min: minHour, maxLength: 2, validateFn: (val) => isHourInvalid(val, is24Hour), onChange: otherProps.onChange, onBlur: (direction, event) => {
|
|
480
491
|
// PartialInput provides direction, but the current onBlur expects just the event
|
|
481
492
|
if (otherProps.onBlur) {
|
|
482
493
|
otherProps.onBlur(event);
|
|
483
494
|
}
|
|
484
|
-
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(
|
|
495
|
+
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.input, TimeInput_module_scss_1.default.hour), invalidClassName: TimeInput_module_scss_1.default.invalid, disabled: otherProps.disabled, readOnly: otherProps.readOnly, required: otherProps.required, autoFocus: otherProps.autoFocus, inputRef: otherProps.inputRef, nextInputRef: otherProps.nextInputRef, nextButtonRef: otherProps.nextButtonRef, name: is24Hour ? "hour24" : "hour12", ariaLabel: otherProps.ariaLabel, isInvalid: isInvalid }));
|
|
485
496
|
}
|
|
486
497
|
function MinuteInput(_a) {
|
|
487
|
-
var { hour, maxTime, minTime, showLeadingZeros = true, value, isInvalid = false, emptyCharacter = "-"
|
|
498
|
+
var { hour, maxTime, minTime, showLeadingZeros = true, value, isInvalid = false, emptyCharacter = "-" } = _a, otherProps = __rest(_a, ["hour", "maxTime", "minTime", "showLeadingZeros", "value", "isInvalid", "emptyCharacter"]);
|
|
488
499
|
function isSameHour(date) {
|
|
489
500
|
return hour === (0, utils_1.getHours)(date).toString();
|
|
490
501
|
}
|
|
491
502
|
const maxMinute = (0, utils_1.safeMin)(59, maxTime && isSameHour(maxTime) && (0, utils_1.getMinutes)(maxTime));
|
|
492
503
|
const minMinute = (0, utils_1.safeMax)(0, minTime && isSameHour(minTime) && (0, utils_1.getMinutes)(minTime));
|
|
493
|
-
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { max: maxMinute, min: minMinute, name: "minute", value: value, validateFn: isMinuteOrSecondInvalid,
|
|
504
|
+
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { "data-part-id": PART_MINUTE, max: maxMinute, min: minMinute, name: "minute", value: value, validateFn: isMinuteOrSecondInvalid, emptyCharacter: emptyCharacter, placeholderLength: 2, maxLength: 2, onChange: otherProps.onChange, onBlur: (direction, event) => {
|
|
494
505
|
// PartialInput provides direction, but the current onBlur expects just the event
|
|
495
506
|
if (otherProps.onBlur) {
|
|
496
507
|
otherProps.onBlur(event);
|
|
497
508
|
}
|
|
498
|
-
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(
|
|
509
|
+
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.input, TimeInput_module_scss_1.default.minute), invalidClassName: TimeInput_module_scss_1.default.invalid, disabled: otherProps.disabled, readOnly: otherProps.readOnly, required: otherProps.required, autoFocus: otherProps.autoFocus, inputRef: otherProps.inputRef, nextInputRef: otherProps.nextInputRef, nextButtonRef: otherProps.nextButtonRef, ariaLabel: otherProps.ariaLabel, isInvalid: isInvalid }));
|
|
499
510
|
}
|
|
500
511
|
function SecondInput(_a) {
|
|
501
|
-
var { hour, maxTime, minTime, minute, showLeadingZeros = true, value, isInvalid = false, emptyCharacter = "-"
|
|
512
|
+
var { hour, maxTime, minTime, minute, showLeadingZeros = true, value, isInvalid = false, emptyCharacter = "-" } = _a, otherProps = __rest(_a, ["hour", "maxTime", "minTime", "minute", "showLeadingZeros", "value", "isInvalid", "emptyCharacter"]);
|
|
502
513
|
function isSameMinute(date) {
|
|
503
514
|
return hour === (0, utils_1.getHours)(date).toString() && minute === (0, utils_1.getMinutes)(date).toString();
|
|
504
515
|
}
|
|
505
516
|
const maxSecond = (0, utils_1.safeMin)(59, maxTime && isSameMinute(maxTime) && (0, utils_1.getSeconds)(maxTime));
|
|
506
517
|
const minSecond = (0, utils_1.safeMax)(0, minTime && isSameMinute(minTime) && (0, utils_1.getSeconds)(minTime));
|
|
507
|
-
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { max: maxSecond, min: minSecond, name: "second", value: value, validateFn: isMinuteOrSecondInvalid,
|
|
518
|
+
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { "data-part-id": PART_SECOND, max: maxSecond, min: minSecond, name: "second", value: value, validateFn: isMinuteOrSecondInvalid, emptyCharacter: emptyCharacter, placeholderLength: 2, maxLength: 2, onChange: otherProps.onChange, onBlur: (direction, event) => {
|
|
508
519
|
// PartialInput provides direction, but the current onBlur expects just the event
|
|
509
520
|
if (otherProps.onBlur) {
|
|
510
521
|
otherProps.onBlur(event);
|
|
511
522
|
}
|
|
512
|
-
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(
|
|
523
|
+
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.input, TimeInput_module_scss_1.default.second), invalidClassName: TimeInput_module_scss_1.default.invalid, disabled: otherProps.disabled, readOnly: otherProps.readOnly, required: otherProps.required, autoFocus: otherProps.autoFocus, inputRef: otherProps.inputRef, nextInputRef: otherProps.nextInputRef, nextButtonRef: otherProps.nextButtonRef, ariaLabel: otherProps.ariaLabel, isInvalid: isInvalid }));
|
|
513
524
|
}
|
|
514
525
|
// Utility function to parse time string into components
|
|
515
|
-
function parseTimeString(
|
|
526
|
+
function parseTimeString(timeValue, targetIs12Hour = false) {
|
|
527
|
+
// Handle non-string values gracefully
|
|
528
|
+
if (timeValue == null || timeValue === undefined) {
|
|
529
|
+
return {
|
|
530
|
+
amPm: null,
|
|
531
|
+
hour: "",
|
|
532
|
+
minute: "",
|
|
533
|
+
second: "",
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
// If not a string, return empty values for type safety
|
|
537
|
+
if (typeof timeValue !== "string") {
|
|
538
|
+
return {
|
|
539
|
+
amPm: null,
|
|
540
|
+
hour: "",
|
|
541
|
+
minute: "",
|
|
542
|
+
second: "",
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
const timeString = timeValue;
|
|
516
546
|
const normalizedTimeString = timeString.toLowerCase();
|
|
517
547
|
// Check if the time string contains AM/PM
|
|
518
548
|
const hasAmPm = normalizedTimeString.includes("am") || normalizedTimeString.includes("pm");
|
|
519
549
|
const isAmPmPm = normalizedTimeString.includes("pm");
|
|
520
550
|
// Extract just the time part (remove AM/PM suffix)
|
|
521
551
|
const timePart = normalizedTimeString.replace(/\s*(am|pm)\s*$/i, "").trim();
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
552
|
+
let parsedHour = (0, utils_1.getHours)(timePart);
|
|
553
|
+
let parsedMinute = (0, utils_1.getMinutes)(timePart);
|
|
554
|
+
let parsedSecond = (0, utils_1.getSeconds)(timePart);
|
|
555
|
+
// If parsing with the current format fails (all zeros), try ISO time format
|
|
556
|
+
if (parsedHour === 0 &&
|
|
557
|
+
parsedMinute === 0 &&
|
|
558
|
+
parsedSecond === 0 &&
|
|
559
|
+
timePart !== "00:00:00" &&
|
|
560
|
+
timePart !== "00:00") {
|
|
561
|
+
try {
|
|
562
|
+
// Try parsing as ISO time format using Date constructor
|
|
563
|
+
const isoDate = new Date(`1970-01-01T${timePart}`);
|
|
564
|
+
if (!isNaN(isoDate.getTime())) {
|
|
565
|
+
parsedHour = isoDate.getHours();
|
|
566
|
+
parsedMinute = isoDate.getMinutes();
|
|
567
|
+
parsedSecond = isoDate.getSeconds();
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
catch (_a) {
|
|
571
|
+
// If ISO parsing fails, keep the original parsed values (zeros)
|
|
572
|
+
}
|
|
573
|
+
}
|
|
525
574
|
// Set AM/PM based on the actual string content or convert from 24-hour
|
|
526
575
|
let amPmValue = null;
|
|
527
576
|
let displayHour = parsedHour;
|