@dynamic-framework/ui-react 1.10.0 → 1.11.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 +8 -4
- package/dist/css/dynamic-ui-non-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +8 -4
- package/dist/css/dynamic-ui.min.css +1 -1
- package/dist/index.esm.js +72 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +72 -11
- package/dist/index.js.map +1 -1
- package/dist/types/components/DBoxFile/DBoxFile.d.ts +1 -2
- package/dist/types/components/DInput/DInput.d.ts +3 -2
- package/dist/types/components/DInputCounter/DInputCounter.d.ts +3 -2
- package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +3 -2
- package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +3 -2
- package/dist/types/components/DInputSearch/DInputSearch.d.ts +3 -2
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +5 -4
- package/dist/types/components/interface.d.ts +1 -1
- package/package.json +2 -2
- package/src/style/components/_d-input-pin.scss +2 -6
- package/src/style/components/_d-input-select.scss +8 -1
package/dist/index.js
CHANGED
|
@@ -53,6 +53,8 @@ const ALERT_TYPE_ICON = {
|
|
|
53
53
|
danger: 'exclamation-triangle',
|
|
54
54
|
success: 'check-circle',
|
|
55
55
|
info: 'info-circle',
|
|
56
|
+
dark: 'info-circle',
|
|
57
|
+
light: 'info-circle',
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
function DIcon({ icon, theme, style, className, size = '1.5rem', loading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-component-size) * 1)`, color, backgroundColor, familyClass = 'bi', familyPrefix = 'bi-', }) {
|
|
@@ -508,7 +510,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
508
510
|
}
|
|
509
511
|
|
|
510
512
|
function DInput(_a, ref) {
|
|
511
|
-
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, hint, invalid = false, valid = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "hint", "invalid", "valid", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
513
|
+
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, hint, invalid = false, valid = false, floatingLabel = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "hint", "invalid", "valid", "floatingLabel", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
512
514
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
513
515
|
const handleOnChange = React.useCallback((event) => {
|
|
514
516
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
@@ -526,17 +528,43 @@ function DInput(_a, ref) {
|
|
|
526
528
|
]
|
|
527
529
|
.filter(Boolean)
|
|
528
530
|
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
531
|
+
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
532
|
+
'is-invalid': invalid,
|
|
533
|
+
'is-valid': valid,
|
|
534
|
+
}), disabled: disabled || loading, readOnly: readOnly, value: value, onChange: handleOnChange }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
|
|
535
|
+
ariaDescribedby,
|
|
536
|
+
disabled,
|
|
537
|
+
handleOnChange,
|
|
538
|
+
id,
|
|
539
|
+
inputProps,
|
|
540
|
+
inputRef,
|
|
541
|
+
invalid,
|
|
542
|
+
loading,
|
|
543
|
+
readOnly,
|
|
544
|
+
valid,
|
|
545
|
+
value,
|
|
546
|
+
]);
|
|
547
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
|
|
548
|
+
id,
|
|
549
|
+
label,
|
|
550
|
+
labelIcon,
|
|
551
|
+
labelIconFamilyClass,
|
|
552
|
+
labelIconFamilyPrefix,
|
|
553
|
+
]);
|
|
554
|
+
const dynamicComponent = React.useMemo(() => {
|
|
555
|
+
if (floatingLabel) {
|
|
556
|
+
return (jsxRuntime.jsxs("div", { className: "form-floating", children: [inputComponent, labelComponent] }));
|
|
557
|
+
}
|
|
558
|
+
return inputComponent;
|
|
559
|
+
}, [floatingLabel, inputComponent, labelComponent]);
|
|
529
560
|
return (jsxRuntime.jsxs("div", { className: classNames({
|
|
530
561
|
'd-input': true,
|
|
531
562
|
className: !!className,
|
|
532
|
-
}), style: style, children: [label &&
|
|
563
|
+
}), style: style, children: [label && !floatingLabel && (labelComponent), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames({
|
|
533
564
|
'input-group': true,
|
|
534
565
|
'has-validation': invalid,
|
|
535
566
|
disabled: disabled || loading,
|
|
536
|
-
}), 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, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("input",
|
|
537
|
-
'is-invalid': invalid,
|
|
538
|
-
'is-valid': valid,
|
|
539
|
-
}), disabled: disabled || loading, readOnly: readOnly, value: value, onChange: handleOnChange }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps)), ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-icon", 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 }))] })] }));
|
|
567
|
+
}), 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, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", 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: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-icon", 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 }))] })] }));
|
|
540
568
|
}
|
|
541
569
|
const ForwardedDInput = React.forwardRef(DInput);
|
|
542
570
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -753,7 +781,7 @@ function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabl
|
|
|
753
781
|
return (jsxRuntime.jsxs("div", { className: "form-check", children: [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 }), jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
754
782
|
}
|
|
755
783
|
|
|
756
|
-
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder
|
|
784
|
+
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
|
|
757
785
|
const [pattern, setPattern] = React.useState('');
|
|
758
786
|
React.useEffect(() => {
|
|
759
787
|
setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
|
|
@@ -809,7 +837,7 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
809
837
|
}), type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onChange: nextInput, onKeyDown: prevInput, onFocus: focusInput, onWheel: wheelInput, onClick: preventDefaultEvent, 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: "d-input-pin-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-pin-icon", 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 }))] }));
|
|
810
838
|
}
|
|
811
839
|
|
|
812
|
-
function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint,
|
|
840
|
+
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, }) {
|
|
813
841
|
const internalValueExtractor = React.useCallback((option) => {
|
|
814
842
|
if (valueExtractor) {
|
|
815
843
|
return valueExtractor(option);
|
|
@@ -831,7 +859,9 @@ function DInputSelect({ id, name, label = '', className, style, options, labelIc
|
|
|
831
859
|
const changeHandler = React.useCallback((event) => {
|
|
832
860
|
const selected = options
|
|
833
861
|
.find((option) => internalValueExtractor(option).toString() === event.currentTarget.value);
|
|
834
|
-
|
|
862
|
+
if (selected) {
|
|
863
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selected);
|
|
864
|
+
}
|
|
835
865
|
}, [onChange, options, internalValueExtractor]);
|
|
836
866
|
const blurHandler = React.useCallback((event) => {
|
|
837
867
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
@@ -849,10 +879,41 @@ function DInputSelect({ id, name, label = '', className, style, options, labelIc
|
|
|
849
879
|
]
|
|
850
880
|
.filter(Boolean)
|
|
851
881
|
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
852
|
-
|
|
882
|
+
const selectComponent = React.useMemo(() => (jsxRuntime.jsx("select", Object.assign({ id: id, name: name, className: classNames({
|
|
883
|
+
'form-select': true,
|
|
884
|
+
'floating-label': floatingLabel,
|
|
885
|
+
}), "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)))) }))), [
|
|
886
|
+
ariaDescribedby,
|
|
887
|
+
blurHandler,
|
|
888
|
+
changeHandler,
|
|
889
|
+
disabled,
|
|
890
|
+
id,
|
|
891
|
+
internalLabelExtractor,
|
|
892
|
+
internalValueExtractor,
|
|
893
|
+
label,
|
|
894
|
+
loading,
|
|
895
|
+
name,
|
|
896
|
+
options,
|
|
897
|
+
value,
|
|
898
|
+
floatingLabel,
|
|
899
|
+
]);
|
|
900
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
|
|
901
|
+
id,
|
|
902
|
+
label,
|
|
903
|
+
labelIcon,
|
|
904
|
+
labelIconFamilyClass,
|
|
905
|
+
labelIconFamilyPrefix,
|
|
906
|
+
]);
|
|
907
|
+
const dynamicComponent = React.useMemo(() => {
|
|
908
|
+
if (floatingLabel) {
|
|
909
|
+
return (jsxRuntime.jsxs("div", { className: "form-floating", children: [selectComponent, labelComponent] }));
|
|
910
|
+
}
|
|
911
|
+
return selectComponent;
|
|
912
|
+
}, [floatingLabel, labelComponent, selectComponent]);
|
|
913
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-input', className), style: style, children: [label && !floatingLabel && (labelComponent), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames({
|
|
853
914
|
'input-group': true,
|
|
854
915
|
disabled: disabled || loading,
|
|
855
|
-
}), 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, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })),
|
|
916
|
+
}), 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, { className: "d-input-icon", 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, { className: "d-input-icon", 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 }))] })] }));
|
|
856
917
|
}
|
|
857
918
|
|
|
858
919
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|