@dynamic-framework/ui-react 1.25.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 +124 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +122 -18
- 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.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useMemo, useEffect, useState, useCallback, createContext, useContext, Fragment, forwardRef, useRef } from 'react';
|
|
2
|
+
import React, { useMemo, useEffect, useState, useCallback, createContext, useContext, Fragment, forwardRef, useId, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
@@ -11,7 +11,7 @@ import { getYear, format, getMonth, parseISO } from 'date-fns';
|
|
|
11
11
|
import Select, { components } from 'react-select';
|
|
12
12
|
import { InputMask } from '@react-input/mask';
|
|
13
13
|
import ResponsivePagination from 'react-responsive-pagination';
|
|
14
|
-
import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
14
|
+
import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId as useId$1, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
15
15
|
import ContentLoader from 'react-content-loader';
|
|
16
16
|
import { ToastContainer, Bounce, Flip, Slide, Zoom, toast } from 'react-toastify';
|
|
17
17
|
import i18n from 'i18next';
|
|
@@ -436,8 +436,10 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
function DInput(_a, ref) {
|
|
439
|
-
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 = __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"]);
|
|
439
|
+
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 = __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"]);
|
|
440
440
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
441
|
+
const innerId = useId();
|
|
442
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
441
443
|
const handleOnChange = useCallback((event) => {
|
|
442
444
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
443
445
|
}, [onChange]);
|
|
@@ -448,12 +450,26 @@ function DInput(_a, ref) {
|
|
|
448
450
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
449
451
|
}, [onIconEndClick, value]);
|
|
450
452
|
const ariaDescribedby = useMemo(() => ([
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
iconEnd && `${id}
|
|
453
|
+
!!inputStart && `${id}InputStart`,
|
|
454
|
+
!!iconStart && `${id}Start`,
|
|
455
|
+
(invalid || valid) && !iconEnd && !loading && `${id}State`,
|
|
456
|
+
(iconEnd && !loading) && `${id}End`,
|
|
457
|
+
loading && `${id}Loading`,
|
|
458
|
+
!!inputEnd && `${id}InputEnd`,
|
|
459
|
+
!!hint && `${id}Hint`,
|
|
454
460
|
]
|
|
455
461
|
.filter(Boolean)
|
|
456
|
-
.join(' ')), [
|
|
462
|
+
.join(' ')), [
|
|
463
|
+
id,
|
|
464
|
+
inputStart,
|
|
465
|
+
iconStart,
|
|
466
|
+
invalid,
|
|
467
|
+
valid,
|
|
468
|
+
iconEnd,
|
|
469
|
+
loading,
|
|
470
|
+
inputEnd,
|
|
471
|
+
hint,
|
|
472
|
+
]);
|
|
457
473
|
const inputComponent = useMemo(() => (jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
458
474
|
'is-invalid': invalid,
|
|
459
475
|
'is-valid': valid,
|
|
@@ -491,7 +507,7 @@ function DInput(_a, ref) {
|
|
|
491
507
|
return (jsxs("div", { className: className, style: style, children: [label && !floatingLabel && labelComponent, jsxs("div", { className: classNames({
|
|
492
508
|
'input-group': true,
|
|
493
509
|
'has-validation': invalid || valid,
|
|
494
|
-
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (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: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), (iconEnd && !loading) && (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: jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsx("div", { className: "input-group-text", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsx("div", { className: "input-group-text", children: inputEnd }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
510
|
+
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (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: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), (iconEnd && !loading) && (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: jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
495
511
|
}
|
|
496
512
|
const ForwardedDInput = forwardRef(DInput);
|
|
497
513
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -512,8 +528,10 @@ const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
|
512
528
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
513
529
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
514
530
|
|
|
515
|
-
function DInputCheck({ type, name, label, ariaLabel, checked = false,
|
|
531
|
+
function DInputCheck({ id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
516
532
|
const innerRef = useRef(null);
|
|
533
|
+
const innerId = useId();
|
|
534
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
517
535
|
const handleChange = useCallback((event) => {
|
|
518
536
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
519
537
|
}, [onChange]);
|
|
@@ -527,10 +545,21 @@ function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabl
|
|
|
527
545
|
innerRef.current.checked = checked;
|
|
528
546
|
}
|
|
529
547
|
}, [checked]);
|
|
548
|
+
const inputComponent = useMemo(() => (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 })), [
|
|
549
|
+
ariaLabel,
|
|
550
|
+
className,
|
|
551
|
+
disabled,
|
|
552
|
+
handleChange,
|
|
553
|
+
id,
|
|
554
|
+
name,
|
|
555
|
+
style,
|
|
556
|
+
type,
|
|
557
|
+
value,
|
|
558
|
+
]);
|
|
530
559
|
if (!label) {
|
|
531
|
-
return
|
|
560
|
+
return inputComponent;
|
|
532
561
|
}
|
|
533
|
-
return (jsxs("div", { className: "form-check", children: [
|
|
562
|
+
return (jsxs("div", { className: "form-check", children: [inputComponent, jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
534
563
|
}
|
|
535
564
|
|
|
536
565
|
function DSelectOptionCheck(_a) {
|
|
@@ -848,7 +877,9 @@ const ForwardedDInputPassword = forwardRef(DInputPassword);
|
|
|
848
877
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
849
878
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
850
879
|
|
|
851
|
-
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, }) {
|
|
880
|
+
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, }) {
|
|
881
|
+
const innerId = useId();
|
|
882
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
852
883
|
const [pattern, setPattern] = useState('');
|
|
853
884
|
const [activeInput, setActiveInput] = useState(Array.from({ length: characters }).fill(''));
|
|
854
885
|
const isInputNum = useMemo(() => type === 'number' || type === 'tel', [type]);
|
|
@@ -923,7 +954,9 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
923
954
|
}), 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 && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsx("div", { className: "input-group-text", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
924
955
|
}
|
|
925
956
|
|
|
926
|
-
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, }) {
|
|
957
|
+
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, }) {
|
|
958
|
+
const innerId = useId();
|
|
959
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
927
960
|
const internalValueExtractor = useCallback((option) => {
|
|
928
961
|
if (valueExtractor) {
|
|
929
962
|
return valueExtractor(option);
|
|
@@ -958,6 +991,9 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
958
991
|
const iconEndClickHandler = useCallback((event) => {
|
|
959
992
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
960
993
|
}, [onIconEndClick]);
|
|
994
|
+
const { iconMap: { input } } = useDContext();
|
|
995
|
+
const invalidIcon = useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
996
|
+
const validIcon = useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
961
997
|
const ariaDescribedby = useMemo(() => ([
|
|
962
998
|
iconStart && `${id}Start`,
|
|
963
999
|
hint && `${id}Hint`,
|
|
@@ -968,6 +1004,8 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
968
1004
|
const selectComponent = useMemo(() => (jsx("select", Object.assign({ id: id, name: name, className: classNames({
|
|
969
1005
|
'form-select': true,
|
|
970
1006
|
'floating-label': floatingLabel,
|
|
1007
|
+
'is-invalid': invalid,
|
|
1008
|
+
'is-valid': valid,
|
|
971
1009
|
}), "aria-label": label, disabled: disabled || loading, onChange: changeHandler, onBlur: blurHandler }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, value && { value }, { children: options.map((option) => (jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) }))), [
|
|
972
1010
|
ariaDescribedby,
|
|
973
1011
|
blurHandler,
|
|
@@ -982,6 +1020,8 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
982
1020
|
options,
|
|
983
1021
|
value,
|
|
984
1022
|
floatingLabel,
|
|
1023
|
+
invalid,
|
|
1024
|
+
valid,
|
|
985
1025
|
]);
|
|
986
1026
|
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
|
|
987
1027
|
id,
|
|
@@ -998,10 +1038,12 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
998
1038
|
}, [floatingLabel, labelComponent, selectComponent]);
|
|
999
1039
|
return (jsxs("div", { className: className, style: style, children: [label && !floatingLabel && (labelComponent), jsxs("div", { className: classNames({
|
|
1000
1040
|
'input-group': true,
|
|
1001
|
-
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, iconEnd && !loading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text form-control-icon loading", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
1041
|
+
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), iconEnd && !loading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text form-control-icon loading", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
1002
1042
|
}
|
|
1003
1043
|
|
|
1004
|
-
function DInputSwitch({ label, ariaLabel,
|
|
1044
|
+
function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, readonly, className, style, onChange, }) {
|
|
1045
|
+
const innerId = useId();
|
|
1046
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1005
1047
|
const [internalIsChecked, setInternalIsChecked] = useState(checked);
|
|
1006
1048
|
useEffect(() => {
|
|
1007
1049
|
setInternalIsChecked(checked);
|
|
@@ -1014,6 +1056,44 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
|
|
|
1014
1056
|
return (jsxs("div", { className: "form-check form-switch", children: [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 && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
1015
1057
|
}
|
|
1016
1058
|
|
|
1059
|
+
function DInputRange(_a, ref) {
|
|
1060
|
+
var { id: idProp, label, ariaLabel, className, style, value = '0', min = '0', max = '100', filledValue = true, onChange } = _a, props = __rest(_a, ["id", "label", "ariaLabel", "className", "style", "value", "min", "max", "filledValue", "onChange"]);
|
|
1061
|
+
const innerRef = useProvidedRefOrCreate(ref);
|
|
1062
|
+
const innerId = useId();
|
|
1063
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1064
|
+
const generateClasses = useMemo(() => ({
|
|
1065
|
+
'form-range': true,
|
|
1066
|
+
'form-range-value-indicator': filledValue,
|
|
1067
|
+
}), [filledValue]);
|
|
1068
|
+
const generateStyleVariables = useMemo(() => {
|
|
1069
|
+
const minNumber = parseFloat(min.toString());
|
|
1070
|
+
const maxNumber = parseFloat(max.toString());
|
|
1071
|
+
const valueNumber = parseFloat(value.toString());
|
|
1072
|
+
const percentage = ((valueNumber - minNumber) / (maxNumber - minNumber)) * 100;
|
|
1073
|
+
return Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}form-range-component-value`]: `${percentage}%` });
|
|
1074
|
+
}, [min, max, value, style]);
|
|
1075
|
+
const inputComponent = useMemo(() => (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))), [
|
|
1076
|
+
ariaLabel,
|
|
1077
|
+
className,
|
|
1078
|
+
generateClasses,
|
|
1079
|
+
generateStyleVariables,
|
|
1080
|
+
id,
|
|
1081
|
+
innerRef,
|
|
1082
|
+
max,
|
|
1083
|
+
min,
|
|
1084
|
+
onChange,
|
|
1085
|
+
props,
|
|
1086
|
+
value,
|
|
1087
|
+
]);
|
|
1088
|
+
if (!label) {
|
|
1089
|
+
return inputComponent;
|
|
1090
|
+
}
|
|
1091
|
+
return (jsxs(Fragment$1, { children: [jsx("label", { className: "form-label", htmlFor: id, children: label }), inputComponent] }));
|
|
1092
|
+
}
|
|
1093
|
+
const ForwardedDInputRange = forwardRef(DInputRange);
|
|
1094
|
+
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1095
|
+
var DInputRange$1 = ForwardedDInputRange;
|
|
1096
|
+
|
|
1017
1097
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
1018
1098
|
const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1019
1099
|
return (jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
@@ -1141,7 +1221,7 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
1141
1221
|
dismiss,
|
|
1142
1222
|
role,
|
|
1143
1223
|
]);
|
|
1144
|
-
const headingId = useId();
|
|
1224
|
+
const headingId = useId$1();
|
|
1145
1225
|
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), adjustContentToRender && {
|
|
1146
1226
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
1147
1227
|
})), [style, adjustContentToRender]);
|
|
@@ -1182,7 +1262,9 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
|
|
|
1182
1262
|
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsx("div", { className: "d-quick-action-button-content", children: jsxs("div", { className: "d-quick-action-button-text", children: [jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (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 && (jsx(DButton, { className: "d-quick-action-button-action-link", type: "button", variant: "link", theme: actionLinkTheme, text: actionLinkText, onClick: actionLinkClickHandler, stopPropagationEnabled: true })), actionIcon && !actionLinkText && (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 }))] }));
|
|
1183
1263
|
}
|
|
1184
1264
|
|
|
1185
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1265
|
+
function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1266
|
+
const innerId = useId();
|
|
1267
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1186
1268
|
const changeHandler = useCallback((event) => {
|
|
1187
1269
|
event.stopPropagation();
|
|
1188
1270
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1190,8 +1272,10 @@ function DQuickActionCheck({ id, name, value, line1, line2, line3, className, st
|
|
|
1190
1272
|
return (jsxs("label", { className: classNames('d-quick-action-check', className), htmlFor: id, style: style, children: [jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, checked: checked, onChange: changeHandler }), jsxs("div", { className: "d-quick-action-check-detail", children: [jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsx("span", { className: "d-quick-action-check-line3", children: line3 })] }));
|
|
1191
1273
|
}
|
|
1192
1274
|
|
|
1193
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1275
|
+
function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1194
1276
|
const innerRef = useRef(null);
|
|
1277
|
+
const innerId = useId();
|
|
1278
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1195
1279
|
const changeHandler = useCallback((event) => {
|
|
1196
1280
|
event.stopPropagation();
|
|
1197
1281
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1204,7 +1288,9 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, style, s
|
|
|
1204
1288
|
return (jsxs("label", { className: classNames('d-quick-action-select', className), htmlFor: id, style: style, children: [jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsx("span", { className: "d-quick-action-select-line2", children: line2 })] }));
|
|
1205
1289
|
}
|
|
1206
1290
|
|
|
1207
|
-
function DQuickActionSwitch({ id, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1291
|
+
function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1292
|
+
const innerId = useId();
|
|
1293
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1208
1294
|
const clickHandler = useCallback((event) => {
|
|
1209
1295
|
event.stopPropagation();
|
|
1210
1296
|
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
@@ -1337,7 +1423,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1337
1423
|
return (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 }));
|
|
1338
1424
|
}
|
|
1339
1425
|
|
|
1340
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, variant = 'underline', }) {
|
|
1426
|
+
function DTabs({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', }) {
|
|
1341
1427
|
const [selected, setSelected] = useState(defaultSelected);
|
|
1342
1428
|
const onSelect = useCallback((option) => {
|
|
1343
1429
|
if (option.tab) {
|
|
@@ -1358,12 +1444,28 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1358
1444
|
'flex-column': !vertical || variant === 'tabs',
|
|
1359
1445
|
}), style: style, children: [jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1360
1446
|
active: option.tab === selected,
|
|
1361
|
-
},
|
|
1447
|
+
}, 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))) }), jsx("div", { className: "tab-content w-100", children: children })] }) }));
|
|
1362
1448
|
}
|
|
1363
1449
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1364
1450
|
Tab: DTabContent,
|
|
1365
1451
|
});
|
|
1366
1452
|
|
|
1453
|
+
function DToastHeader({ children, className, style }) {
|
|
1454
|
+
return (jsx("div", { className: classNames('toast-header', className), style: style, children: children }));
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
function DToastBody({ children, className, style }) {
|
|
1458
|
+
return (jsx("div", { className: classNames('toast-body', className), style: style, children: children }));
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
function DToast({ children, className, style }) {
|
|
1462
|
+
return (jsx("div", { className: classNames('toast', className), role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: style, children: children }));
|
|
1463
|
+
}
|
|
1464
|
+
var DToast$1 = Object.assign(DToast, {
|
|
1465
|
+
Header: DToastHeader,
|
|
1466
|
+
Body: DToastBody,
|
|
1467
|
+
});
|
|
1468
|
+
|
|
1367
1469
|
const TOAST_TRANSITIONS$1 = {
|
|
1368
1470
|
bounce: Bounce,
|
|
1369
1471
|
flip: Flip,
|
|
@@ -1405,5 +1507,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1405
1507
|
.then((t) => t);
|
|
1406
1508
|
}
|
|
1407
1509
|
|
|
1408
|
-
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext };
|
|
1510
|
+
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputRange$1 as DInputRange, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DToast$1 as DToast, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext };
|
|
1409
1511
|
//# sourceMappingURL=index.esm.js.map
|