@dynamic-framework/ui-react 1.24.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/dynamic-ui-non-root.css +46 -31
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +1 -1
- package/dist/css/dynamic-ui-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +46 -31
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +157 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +151 -19
- package/dist/index.js.map +1 -1
- package/dist/types/components/DInputCheck/DInputCheck.d.ts +2 -2
- package/dist/types/components/DInputPin/DInputPin.d.ts +2 -2
- package/dist/types/components/DInputRange/DInputRange.d.ts +8 -0
- package/dist/types/components/DInputRange/index.d.ts +2 -0
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +5 -3
- package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +2 -2
- package/dist/types/components/DQuickActionCheck/DQuickActionCheck.d.ts +2 -2
- package/dist/types/components/DQuickActionSelect/DQuickActionSelect.d.ts +2 -2
- package/dist/types/components/DQuickActionSwitch/DQuickActionSwitch.d.ts +2 -2
- package/dist/types/components/DTabs/DTabs.d.ts +2 -1
- package/dist/types/components/DToast/DToast.d.ts +11 -0
- package/dist/types/components/DToast/components/DToastBody.d.ts +5 -0
- package/dist/types/components/DToast/components/DToastHeader.d.ts +5 -0
- package/dist/types/components/DToast/index.d.ts +4 -0
- package/dist/types/components/index.d.ts +2 -0
- package/package.json +2 -3
- package/src/style/abstracts/variables/_+import.scss +2 -1
- package/src/style/abstracts/variables/_forms.scss +5 -1
- package/src/style/base/_+import.scss +1 -0
- package/src/style/base/_form-range.scss +52 -0
- package/src/style/base/_input-group.scss +1 -1
- package/src/style/components/_d-select.scss +2 -0
package/dist/index.js
CHANGED
|
@@ -158,7 +158,35 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
|
|
|
158
158
|
openPortal,
|
|
159
159
|
closePortal,
|
|
160
160
|
}), [stack, openPortal, closePortal]);
|
|
161
|
-
|
|
161
|
+
const handleClose = React.useCallback((target) => {
|
|
162
|
+
if (target instanceof HTMLDivElement) {
|
|
163
|
+
if (target.classList.contains('portal')) {
|
|
164
|
+
if (!('bsBackdrop' in target.dataset)) {
|
|
165
|
+
closePortal();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, [closePortal]);
|
|
170
|
+
React.useEffect(() => {
|
|
171
|
+
const keyEvent = (event) => {
|
|
172
|
+
if (event.key === 'Escape') {
|
|
173
|
+
const lastModal = document.querySelector(`#${portalName} > div > div:last-child`);
|
|
174
|
+
if (lastModal) {
|
|
175
|
+
handleClose(lastModal);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
if (stack.length !== 0) {
|
|
180
|
+
window.addEventListener('keydown', keyEvent);
|
|
181
|
+
}
|
|
182
|
+
return () => {
|
|
183
|
+
window.removeEventListener('keydown', keyEvent);
|
|
184
|
+
};
|
|
185
|
+
}, [handleClose, portalName, stack.length]);
|
|
186
|
+
return (jsxRuntime.jsxs(DPortalContext.Provider, { value: value, children: [children, created && reactDom.createPortal(
|
|
187
|
+
// eslint-disable-next-line max-len
|
|
188
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
189
|
+
jsxRuntime.jsx("div", { onClick: ({ target }) => handleClose(target), onKeyDown: () => { }, children: stack.map(({ Component, name, payload, }) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { className: "backdrop fade show" }), jsxRuntime.jsx(Component, { name: name, payload: payload })] }, name))) }), document.getElementById(portalName))] }));
|
|
162
190
|
}
|
|
163
191
|
function useDPortalContext() {
|
|
164
192
|
const context = React.useContext(DPortalContext);
|
|
@@ -410,8 +438,10 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
410
438
|
}
|
|
411
439
|
|
|
412
440
|
function DInput(_a, ref) {
|
|
413
|
-
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, labelIconMaterialStyle, disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconStart, iconStartDisabled, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconStartMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, invalidIcon: invalidIconProp, validIcon: validIconProp, hint, invalid = false, valid = false, floatingLabel = false, inputStart, inputEnd, value, placeholder = '', onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "labelIconMaterialStyle", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconStart", "iconStartDisabled", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconStartMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "invalidIcon", "validIcon", "hint", "invalid", "valid", "floatingLabel", "inputStart", "inputEnd", "value", "placeholder", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
441
|
+
var { id: idProp, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, labelIconMaterialStyle, disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconStart, iconStartDisabled, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconStartMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, invalidIcon: invalidIconProp, validIcon: validIconProp, hint, invalid = false, valid = false, floatingLabel = false, inputStart, inputEnd, value, placeholder = '', onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "labelIconMaterialStyle", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconStart", "iconStartDisabled", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconStartMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "invalidIcon", "validIcon", "hint", "invalid", "valid", "floatingLabel", "inputStart", "inputEnd", "value", "placeholder", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
414
442
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
443
|
+
const innerId = React.useId();
|
|
444
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
415
445
|
const handleOnChange = React.useCallback((event) => {
|
|
416
446
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
417
447
|
}, [onChange]);
|
|
@@ -422,12 +452,26 @@ function DInput(_a, ref) {
|
|
|
422
452
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
423
453
|
}, [onIconEndClick, value]);
|
|
424
454
|
const ariaDescribedby = React.useMemo(() => ([
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
iconEnd && `${id}
|
|
455
|
+
!!inputStart && `${id}InputStart`,
|
|
456
|
+
!!iconStart && `${id}Start`,
|
|
457
|
+
(invalid || valid) && !iconEnd && !loading && `${id}State`,
|
|
458
|
+
(iconEnd && !loading) && `${id}End`,
|
|
459
|
+
loading && `${id}Loading`,
|
|
460
|
+
!!inputEnd && `${id}InputEnd`,
|
|
461
|
+
!!hint && `${id}Hint`,
|
|
428
462
|
]
|
|
429
463
|
.filter(Boolean)
|
|
430
|
-
.join(' ')), [
|
|
464
|
+
.join(' ')), [
|
|
465
|
+
id,
|
|
466
|
+
inputStart,
|
|
467
|
+
iconStart,
|
|
468
|
+
invalid,
|
|
469
|
+
valid,
|
|
470
|
+
iconEnd,
|
|
471
|
+
loading,
|
|
472
|
+
inputEnd,
|
|
473
|
+
hint,
|
|
474
|
+
]);
|
|
431
475
|
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
432
476
|
'is-invalid': invalid,
|
|
433
477
|
'is-valid': valid,
|
|
@@ -465,7 +509,7 @@ function DInput(_a, ref) {
|
|
|
465
509
|
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [label && !floatingLabel && labelComponent, jsxRuntime.jsxs("div", { className: classNames({
|
|
466
510
|
'input-group': true,
|
|
467
511
|
'has-validation': invalid || valid,
|
|
468
|
-
}), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex: onIconStartClick ? iconStartTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel, tabIndex: onIconEndClick ? iconEndTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsxRuntime.jsx("div", { className: "input-group-text", children: inputEnd }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
512
|
+
}), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex: onIconStartClick ? iconStartTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel, tabIndex: onIconEndClick ? iconEndTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
469
513
|
}
|
|
470
514
|
const ForwardedDInput = React.forwardRef(DInput);
|
|
471
515
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -486,8 +530,10 @@ const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
|
486
530
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
487
531
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
488
532
|
|
|
489
|
-
function DInputCheck({ type, name, label, ariaLabel, checked = false,
|
|
533
|
+
function DInputCheck({ id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
490
534
|
const innerRef = React.useRef(null);
|
|
535
|
+
const innerId = React.useId();
|
|
536
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
491
537
|
const handleChange = React.useCallback((event) => {
|
|
492
538
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
493
539
|
}, [onChange]);
|
|
@@ -501,10 +547,21 @@ function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabl
|
|
|
501
547
|
innerRef.current.checked = checked;
|
|
502
548
|
}
|
|
503
549
|
}, [checked]);
|
|
550
|
+
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel })), [
|
|
551
|
+
ariaLabel,
|
|
552
|
+
className,
|
|
553
|
+
disabled,
|
|
554
|
+
handleChange,
|
|
555
|
+
id,
|
|
556
|
+
name,
|
|
557
|
+
style,
|
|
558
|
+
type,
|
|
559
|
+
value,
|
|
560
|
+
]);
|
|
504
561
|
if (!label) {
|
|
505
|
-
return
|
|
562
|
+
return inputComponent;
|
|
506
563
|
}
|
|
507
|
-
return (jsxRuntime.jsxs("div", { className: "form-check", children: [
|
|
564
|
+
return (jsxRuntime.jsxs("div", { className: "form-check", children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
508
565
|
}
|
|
509
566
|
|
|
510
567
|
function DSelectOptionCheck(_a) {
|
|
@@ -822,7 +879,9 @@ const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
|
822
879
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
823
880
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
824
881
|
|
|
825
|
-
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, invalidIcon: invalidIconProp, validIcon: validIconProp, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
|
|
882
|
+
function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, invalidIcon: invalidIconProp, validIcon: validIconProp, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
|
|
883
|
+
const innerId = React.useId();
|
|
884
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
826
885
|
const [pattern, setPattern] = React.useState('');
|
|
827
886
|
const [activeInput, setActiveInput] = React.useState(Array.from({ length: characters }).fill(''));
|
|
828
887
|
const isInputNum = React.useMemo(() => type === 'number' || type === 'tel', [type]);
|
|
@@ -897,7 +956,9 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
897
956
|
}), value: activeInput[index], type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onInput: (event) => nextInput(event, index), onKeyDown: (event) => prevInput(event, index), onFocus: () => focusInput(index), onWheel: wheelInput, onClick: (event) => event.preventDefault(), onPaste: (event) => handlePaste(event), autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (invalid || valid) && !loading && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
898
957
|
}
|
|
899
958
|
|
|
900
|
-
function DInputSelect({ id, name, label = '', className, style, options = [], labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, floatingLabel = false, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
959
|
+
function DInputSelect({ id: idProp, name, label = '', className, style, options = [], labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, invalidIcon: invalidIconProp, validIcon: validIconProp, hint, value, floatingLabel = false, invalid = false, valid = false, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
960
|
+
const innerId = React.useId();
|
|
961
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
901
962
|
const internalValueExtractor = React.useCallback((option) => {
|
|
902
963
|
if (valueExtractor) {
|
|
903
964
|
return valueExtractor(option);
|
|
@@ -932,6 +993,9 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
932
993
|
const iconEndClickHandler = React.useCallback((event) => {
|
|
933
994
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
934
995
|
}, [onIconEndClick]);
|
|
996
|
+
const { iconMap: { input } } = useDContext();
|
|
997
|
+
const invalidIcon = React.useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
998
|
+
const validIcon = React.useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
935
999
|
const ariaDescribedby = React.useMemo(() => ([
|
|
936
1000
|
iconStart && `${id}Start`,
|
|
937
1001
|
hint && `${id}Hint`,
|
|
@@ -942,6 +1006,8 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
942
1006
|
const selectComponent = React.useMemo(() => (jsxRuntime.jsx("select", Object.assign({ id: id, name: name, className: classNames({
|
|
943
1007
|
'form-select': true,
|
|
944
1008
|
'floating-label': floatingLabel,
|
|
1009
|
+
'is-invalid': invalid,
|
|
1010
|
+
'is-valid': valid,
|
|
945
1011
|
}), "aria-label": label, disabled: disabled || loading, onChange: changeHandler, onBlur: blurHandler }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, value && { value }, { children: options.map((option) => (jsxRuntime.jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) }))), [
|
|
946
1012
|
ariaDescribedby,
|
|
947
1013
|
blurHandler,
|
|
@@ -956,6 +1022,8 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
956
1022
|
options,
|
|
957
1023
|
value,
|
|
958
1024
|
floatingLabel,
|
|
1025
|
+
invalid,
|
|
1026
|
+
valid,
|
|
959
1027
|
]);
|
|
960
1028
|
const labelComponent = React.useMemo(() => (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
|
|
961
1029
|
id,
|
|
@@ -972,10 +1040,12 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
972
1040
|
}, [floatingLabel, labelComponent, selectComponent]);
|
|
973
1041
|
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [label && !floatingLabel && (labelComponent), jsxRuntime.jsxs("div", { className: classNames({
|
|
974
1042
|
'input-group': true,
|
|
975
|
-
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, iconEnd && !loading && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text form-control-icon loading", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
1043
|
+
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), iconEnd && !loading && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text form-control-icon loading", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
976
1044
|
}
|
|
977
1045
|
|
|
978
|
-
function DInputSwitch({ label, ariaLabel,
|
|
1046
|
+
function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, readonly, className, style, onChange, }) {
|
|
1047
|
+
const innerId = React.useId();
|
|
1048
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
979
1049
|
const [internalIsChecked, setInternalIsChecked] = React.useState(checked);
|
|
980
1050
|
React.useEffect(() => {
|
|
981
1051
|
setInternalIsChecked(checked);
|
|
@@ -988,6 +1058,44 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
|
|
|
988
1058
|
return (jsxRuntime.jsxs("div", { className: "form-check form-switch", children: [jsxRuntime.jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
989
1059
|
}
|
|
990
1060
|
|
|
1061
|
+
function DInputRange(_a, ref) {
|
|
1062
|
+
var { id: idProp, label, ariaLabel, className, style, value = '0', min = '0', max = '100', filledValue = true, onChange } = _a, props = tslib.__rest(_a, ["id", "label", "ariaLabel", "className", "style", "value", "min", "max", "filledValue", "onChange"]);
|
|
1063
|
+
const innerRef = useProvidedRefOrCreate(ref);
|
|
1064
|
+
const innerId = React.useId();
|
|
1065
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1066
|
+
const generateClasses = React.useMemo(() => ({
|
|
1067
|
+
'form-range': true,
|
|
1068
|
+
'form-range-value-indicator': filledValue,
|
|
1069
|
+
}), [filledValue]);
|
|
1070
|
+
const generateStyleVariables = React.useMemo(() => {
|
|
1071
|
+
const minNumber = parseFloat(min.toString());
|
|
1072
|
+
const maxNumber = parseFloat(max.toString());
|
|
1073
|
+
const valueNumber = parseFloat(value.toString());
|
|
1074
|
+
const percentage = ((valueNumber - minNumber) / (maxNumber - minNumber)) * 100;
|
|
1075
|
+
return Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}form-range-component-value`]: `${percentage}%` });
|
|
1076
|
+
}, [min, max, value, style]);
|
|
1077
|
+
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ id: id, ref: innerRef, className: classNames(generateClasses, className), "aria-label": ariaLabel, type: "range", value: value, min: min, max: max, style: generateStyleVariables, onChange: onChange }, props))), [
|
|
1078
|
+
ariaLabel,
|
|
1079
|
+
className,
|
|
1080
|
+
generateClasses,
|
|
1081
|
+
generateStyleVariables,
|
|
1082
|
+
id,
|
|
1083
|
+
innerRef,
|
|
1084
|
+
max,
|
|
1085
|
+
min,
|
|
1086
|
+
onChange,
|
|
1087
|
+
props,
|
|
1088
|
+
value,
|
|
1089
|
+
]);
|
|
1090
|
+
if (!label) {
|
|
1091
|
+
return inputComponent;
|
|
1092
|
+
}
|
|
1093
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("label", { className: "form-label", htmlFor: id, children: label }), inputComponent] }));
|
|
1094
|
+
}
|
|
1095
|
+
const ForwardedDInputRange = React.forwardRef(DInputRange);
|
|
1096
|
+
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1097
|
+
var DInputRange$1 = ForwardedDInputRange;
|
|
1098
|
+
|
|
991
1099
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
992
1100
|
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
993
1101
|
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
@@ -1156,7 +1264,9 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
|
|
|
1156
1264
|
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-secondary-action-link", type: "button", variant: "link", iconStart: secondaryActionIcon, ariaLabel: secondaryActionAriaLabel, iconStartFamilyClass: actionIconFamilyClass, iconStartFamilyPrefix: actionIconFamilyPrefix, theme: actionLinkTheme, onClick: secondaryActionLinkClickHandler, stopPropagationEnabled: true })), actionLinkText && !actionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-action-link", type: "button", variant: "link", theme: actionLinkTheme, text: actionLinkText, onClick: actionLinkClickHandler, stopPropagationEnabled: true })), actionIcon && !actionLinkText && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] }));
|
|
1157
1265
|
}
|
|
1158
1266
|
|
|
1159
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1267
|
+
function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1268
|
+
const innerId = React.useId();
|
|
1269
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1160
1270
|
const changeHandler = React.useCallback((event) => {
|
|
1161
1271
|
event.stopPropagation();
|
|
1162
1272
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1164,8 +1274,10 @@ function DQuickActionCheck({ id, name, value, line1, line2, line3, className, st
|
|
|
1164
1274
|
return (jsxRuntime.jsxs("label", { className: classNames('d-quick-action-check', className), htmlFor: id, style: style, children: [jsxRuntime.jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, checked: checked, onChange: changeHandler }), jsxRuntime.jsxs("div", { className: "d-quick-action-check-detail", children: [jsxRuntime.jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line3", children: line3 })] }));
|
|
1165
1275
|
}
|
|
1166
1276
|
|
|
1167
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1277
|
+
function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1168
1278
|
const innerRef = React.useRef(null);
|
|
1279
|
+
const innerId = React.useId();
|
|
1280
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1169
1281
|
const changeHandler = React.useCallback((event) => {
|
|
1170
1282
|
event.stopPropagation();
|
|
1171
1283
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1178,7 +1290,9 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, style, s
|
|
|
1178
1290
|
return (jsxRuntime.jsxs("label", { className: classNames('d-quick-action-select', className), htmlFor: id, style: style, children: [jsxRuntime.jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line2", children: line2 })] }));
|
|
1179
1291
|
}
|
|
1180
1292
|
|
|
1181
|
-
function DQuickActionSwitch({ id, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1293
|
+
function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1294
|
+
const innerId = React.useId();
|
|
1295
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1182
1296
|
const clickHandler = React.useCallback((event) => {
|
|
1183
1297
|
event.stopPropagation();
|
|
1184
1298
|
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
@@ -1311,7 +1425,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1311
1425
|
return (jsxRuntime.jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
|
|
1312
1426
|
}
|
|
1313
1427
|
|
|
1314
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, variant = 'underline', }) {
|
|
1428
|
+
function DTabs({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', }) {
|
|
1315
1429
|
const [selected, setSelected] = React.useState(defaultSelected);
|
|
1316
1430
|
const onSelect = React.useCallback((option) => {
|
|
1317
1431
|
if (option.tab) {
|
|
@@ -1332,12 +1446,28 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1332
1446
|
'flex-column': !vertical || variant === 'tabs',
|
|
1333
1447
|
}), style: style, children: [jsxRuntime.jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1334
1448
|
active: option.tab === selected,
|
|
1335
|
-
},
|
|
1449
|
+
}, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.label))) }), jsxRuntime.jsx("div", { className: "tab-content w-100", children: children })] }) }));
|
|
1336
1450
|
}
|
|
1337
1451
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1338
1452
|
Tab: DTabContent,
|
|
1339
1453
|
});
|
|
1340
1454
|
|
|
1455
|
+
function DToastHeader({ children, className, style }) {
|
|
1456
|
+
return (jsxRuntime.jsx("div", { className: classNames('toast-header', className), style: style, children: children }));
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
function DToastBody({ children, className, style }) {
|
|
1460
|
+
return (jsxRuntime.jsx("div", { className: classNames('toast-body', className), style: style, children: children }));
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
function DToast({ children, className, style }) {
|
|
1464
|
+
return (jsxRuntime.jsx("div", { className: classNames('toast', className), role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: style, children: children }));
|
|
1465
|
+
}
|
|
1466
|
+
var DToast$1 = Object.assign(DToast, {
|
|
1467
|
+
Header: DToastHeader,
|
|
1468
|
+
Body: DToastBody,
|
|
1469
|
+
});
|
|
1470
|
+
|
|
1341
1471
|
const TOAST_TRANSITIONS$1 = {
|
|
1342
1472
|
bounce: reactToastify.Bounce,
|
|
1343
1473
|
flip: reactToastify.Flip,
|
|
@@ -1405,6 +1535,7 @@ exports.DInputCurrencyBase = DInputCurrencyBase$1;
|
|
|
1405
1535
|
exports.DInputMask = DInputMask$1;
|
|
1406
1536
|
exports.DInputPassword = DInputPassword$1;
|
|
1407
1537
|
exports.DInputPin = DInputPin;
|
|
1538
|
+
exports.DInputRange = DInputRange$1;
|
|
1408
1539
|
exports.DInputSearch = DInputSearch$1;
|
|
1409
1540
|
exports.DInputSelect = DInputSelect;
|
|
1410
1541
|
exports.DInputSwitch = DInputSwitch;
|
|
@@ -1432,6 +1563,7 @@ exports.DStepperDesktop = DStepper$2;
|
|
|
1432
1563
|
exports.DStepperMobile = DStepper$1;
|
|
1433
1564
|
exports.DTabContent = DTabContent;
|
|
1434
1565
|
exports.DTabs = DTabs$1;
|
|
1566
|
+
exports.DToast = DToast$1;
|
|
1435
1567
|
exports.DToastContainer = DToastContainer;
|
|
1436
1568
|
exports.DTooltip = DTooltip;
|
|
1437
1569
|
exports.configureI18n = configureI8n;
|