@dynamic-framework/ui-react 1.25.0 → 1.27.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 +313 -934
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +228 -152
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +540 -1085
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +230 -63
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +230 -59
- package/dist/index.js.map +1 -1
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +19 -0
- package/dist/types/components/DButtonIcon/index.d.ts +2 -0
- package/dist/types/components/DInput/DInput.d.ts +3 -2
- package/dist/types/components/DInputCheck/DInputCheck.d.ts +4 -2
- package/dist/types/components/DInputCounter/DInputCounter.d.ts +2 -1
- package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +2 -1
- package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +2 -1
- package/dist/types/components/DInputMask/DInputMask.d.ts +2 -1
- 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/DInputSearch/DInputSearch.d.ts +2 -1
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +6 -3
- package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +4 -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/DSelect/DSelect.d.ts +3 -3
- package/dist/types/components/DStepper/DStepper.d.ts +2 -1
- package/dist/types/components/DStepperDesktop/DStepperDesktop.d.ts +2 -1
- package/dist/types/components/DTableHead/DTableHead.d.ts +9 -0
- package/dist/types/components/DTableHead/index.d.ts +2 -0
- 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/DToastContainer/DToastContainer.d.ts +2 -14
- package/dist/types/components/DToastContainer/useDToast.d.ts +11 -12
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/contexts/DContext.d.ts +1 -1
- package/dist/types/hooks/useFormatCurrency.d.ts +2 -1
- package/package.json +4 -5
- package/src/style/abstracts/_mixins.scss +41 -21
- package/src/style/abstracts/variables/_+import.scss +12 -3
- package/src/style/abstracts/variables/_border.scss +1 -1
- package/src/style/abstracts/variables/_buttons.scss +3 -5
- package/src/style/abstracts/variables/_colors.scss +10 -10
- package/src/style/abstracts/variables/_forms.scss +28 -50
- package/src/style/abstracts/variables/_quick-action-switch.scss +0 -2
- package/src/style/base/_+import.scss +1 -0
- package/src/style/base/_alert.scss +1 -1
- package/src/style/base/_buttons.scss +41 -16
- package/src/style/base/_form-check.scss +2 -19
- package/src/style/base/_form-range.scss +52 -0
- package/src/style/base/_form-switch.scss +4 -53
- package/src/style/base/_input-group.scss +1 -1
- package/src/style/components/_+import.scss +3 -2
- package/src/style/components/_d-button-icon.scss +26 -0
- package/src/style/components/_d-close.scss +11 -0
- package/src/style/components/_d-modal.scss +0 -11
- package/src/style/components/_d-offcanvas.scss +0 -11
- package/src/style/components/_d-quick-action-switch.scss +0 -7
- package/src/style/components/_d-select.scss +2 -0
- package/src/style/components/_d-table-head.scss +18 -0
- package/src/style/root/_root.scss +42 -36
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var mask = require('@react-input/mask');
|
|
|
15
15
|
var ResponsivePagination = require('react-responsive-pagination');
|
|
16
16
|
var react = require('@floating-ui/react');
|
|
17
17
|
var ContentLoader = require('react-content-loader');
|
|
18
|
-
var
|
|
18
|
+
var reactHotToast = require('react-hot-toast');
|
|
19
19
|
var i18n = require('i18next');
|
|
20
20
|
var reactI18next = require('react-i18next');
|
|
21
21
|
|
|
@@ -159,20 +159,26 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
|
|
|
159
159
|
closePortal,
|
|
160
160
|
}), [stack, openPortal, closePortal]);
|
|
161
161
|
const handleClose = React.useCallback((target) => {
|
|
162
|
-
if (target instanceof HTMLDivElement) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
if (!(target instanceof HTMLDivElement)) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (target.classList.contains('portal') && !('bsBackdrop' in target.dataset)) {
|
|
166
|
+
closePortal();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (target.classList.contains('backdrop')) {
|
|
170
|
+
const lastPortal = target.nextElementSibling;
|
|
171
|
+
if (lastPortal && lastPortal.classList.contains('portal') && !('bsBackdrop' in lastPortal.dataset)) {
|
|
172
|
+
closePortal();
|
|
167
173
|
}
|
|
168
174
|
}
|
|
169
175
|
}, [closePortal]);
|
|
170
176
|
React.useEffect(() => {
|
|
171
177
|
const keyEvent = (event) => {
|
|
172
178
|
if (event.key === 'Escape') {
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
175
|
-
handleClose(
|
|
179
|
+
const lastPortal = document.querySelector(`#${portalName} > div > div:last-child`);
|
|
180
|
+
if (lastPortal) {
|
|
181
|
+
handleClose(lastPortal);
|
|
176
182
|
}
|
|
177
183
|
}
|
|
178
184
|
};
|
|
@@ -321,6 +327,28 @@ function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel
|
|
|
321
327
|
return (jsxRuntime.jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: style, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, value && { value }, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), (text && !loading) && (jsxRuntime.jsx("span", { children: text })), loading && (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }))] })));
|
|
322
328
|
}
|
|
323
329
|
|
|
330
|
+
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, theme = 'primary', type = 'button', loading = false, disabled = false, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, onClick, }) {
|
|
331
|
+
const generateClasses = React.useMemo(() => {
|
|
332
|
+
const variantClass = variant
|
|
333
|
+
? `btn-${variant}-${theme}`
|
|
334
|
+
: `btn-${theme}`;
|
|
335
|
+
return Object.assign(Object.assign(Object.assign({ 'btn d-button-icon': true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
336
|
+
}, [variant, theme, size, state, loading]);
|
|
337
|
+
const clickHandler = React.useCallback((event) => {
|
|
338
|
+
if (stopPropagationEnabled) {
|
|
339
|
+
event.stopPropagation();
|
|
340
|
+
}
|
|
341
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
342
|
+
}, [stopPropagationEnabled, onClick]);
|
|
343
|
+
const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
344
|
+
const newAriaLabel = React.useMemo(() => (loading
|
|
345
|
+
? (loadingAriaLabel || ariaLabel)
|
|
346
|
+
: (ariaLabel)), [ariaLabel, loading, loadingAriaLabel]);
|
|
347
|
+
return (jsxRuntime.jsx("button", { className: classNames(generateClasses, className), style: style, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, id: id, children: loading
|
|
348
|
+
? (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
349
|
+
: (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) }));
|
|
350
|
+
}
|
|
351
|
+
|
|
324
352
|
function DCardHeader({ className, style, children, }) {
|
|
325
353
|
return (jsxRuntime.jsx("div", { className: classNames('card-header', className), style: style, children: children }));
|
|
326
354
|
}
|
|
@@ -404,7 +432,7 @@ function formatCurrency(amount, options) {
|
|
|
404
432
|
|
|
405
433
|
function useFormatCurrency(...args) {
|
|
406
434
|
const { currency } = useDContext();
|
|
407
|
-
const format = React.useCallback((value) => formatCurrency(value, currency), [currency]);
|
|
435
|
+
const format = React.useCallback((value, currencyOptions) => formatCurrency(value, currencyOptions || currency), [currency]);
|
|
408
436
|
const values = (args || []).map((value) => (formatCurrency(value !== null && value !== void 0 ? value : 0, currency)));
|
|
409
437
|
return {
|
|
410
438
|
format,
|
|
@@ -438,8 +466,10 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
438
466
|
}
|
|
439
467
|
|
|
440
468
|
function DInput(_a, ref) {
|
|
441
|
-
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"]);
|
|
469
|
+
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, size, 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", "size", "invalid", "valid", "floatingLabel", "inputStart", "inputEnd", "value", "placeholder", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
442
470
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
471
|
+
const innerId = React.useId();
|
|
472
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
443
473
|
const handleOnChange = React.useCallback((event) => {
|
|
444
474
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
445
475
|
}, [onChange]);
|
|
@@ -450,13 +480,28 @@ function DInput(_a, ref) {
|
|
|
450
480
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
451
481
|
}, [onIconEndClick, value]);
|
|
452
482
|
const ariaDescribedby = React.useMemo(() => ([
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
iconEnd && `${id}
|
|
483
|
+
!!inputStart && `${id}InputStart`,
|
|
484
|
+
!!iconStart && `${id}Start`,
|
|
485
|
+
(invalid || valid) && !iconEnd && !loading && `${id}State`,
|
|
486
|
+
(iconEnd && !loading) && `${id}End`,
|
|
487
|
+
loading && `${id}Loading`,
|
|
488
|
+
!!inputEnd && `${id}InputEnd`,
|
|
489
|
+
!!hint && `${id}Hint`,
|
|
456
490
|
]
|
|
457
491
|
.filter(Boolean)
|
|
458
|
-
.join(' ')), [
|
|
492
|
+
.join(' ')), [
|
|
493
|
+
id,
|
|
494
|
+
inputStart,
|
|
495
|
+
iconStart,
|
|
496
|
+
invalid,
|
|
497
|
+
valid,
|
|
498
|
+
iconEnd,
|
|
499
|
+
loading,
|
|
500
|
+
inputEnd,
|
|
501
|
+
hint,
|
|
502
|
+
]);
|
|
459
503
|
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
504
|
+
[`form-control-${size}`]: !!size,
|
|
460
505
|
'is-invalid': invalid,
|
|
461
506
|
'is-valid': valid,
|
|
462
507
|
}), disabled: disabled || loading, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
|
|
@@ -472,6 +517,7 @@ function DInput(_a, ref) {
|
|
|
472
517
|
floatingLabel,
|
|
473
518
|
valid,
|
|
474
519
|
value,
|
|
520
|
+
size,
|
|
475
521
|
]);
|
|
476
522
|
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, materialStyle: labelIconMaterialStyle }))] })), [
|
|
477
523
|
id,
|
|
@@ -493,7 +539,7 @@ function DInput(_a, ref) {
|
|
|
493
539
|
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [label && !floatingLabel && labelComponent, jsxRuntime.jsxs("div", { className: classNames({
|
|
494
540
|
'input-group': true,
|
|
495
541
|
'has-validation': invalid || valid,
|
|
496
|
-
}), 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 }))] }));
|
|
542
|
+
}), 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 }))] }));
|
|
497
543
|
}
|
|
498
544
|
const ForwardedDInput = React.forwardRef(DInput);
|
|
499
545
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -514,8 +560,10 @@ const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
|
514
560
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
515
561
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
516
562
|
|
|
517
|
-
function DInputCheck({ type, name, label, ariaLabel, checked = false,
|
|
563
|
+
function DInputCheck({ id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, value, onChange, className, style, }) {
|
|
518
564
|
const innerRef = React.useRef(null);
|
|
565
|
+
const innerId = React.useId();
|
|
566
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
519
567
|
const handleChange = React.useCallback((event) => {
|
|
520
568
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
521
569
|
}, [onChange]);
|
|
@@ -529,10 +577,26 @@ function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabl
|
|
|
529
577
|
innerRef.current.checked = checked;
|
|
530
578
|
}
|
|
531
579
|
}, [checked]);
|
|
580
|
+
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
581
|
+
'is-invalid': invalid,
|
|
582
|
+
'is-valid': valid,
|
|
583
|
+
}, className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel })), [
|
|
584
|
+
ariaLabel,
|
|
585
|
+
className,
|
|
586
|
+
disabled,
|
|
587
|
+
valid,
|
|
588
|
+
invalid,
|
|
589
|
+
handleChange,
|
|
590
|
+
id,
|
|
591
|
+
name,
|
|
592
|
+
style,
|
|
593
|
+
type,
|
|
594
|
+
value,
|
|
595
|
+
]);
|
|
532
596
|
if (!label) {
|
|
533
|
-
return
|
|
597
|
+
return inputComponent;
|
|
534
598
|
}
|
|
535
|
-
return (jsxRuntime.jsxs("div", { className: "form-check", children: [
|
|
599
|
+
return (jsxRuntime.jsxs("div", { className: "form-check", children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
536
600
|
}
|
|
537
601
|
|
|
538
602
|
function DSelectOptionCheck(_a) {
|
|
@@ -604,13 +668,16 @@ function DSelectSingleValueEmojiText(_a) {
|
|
|
604
668
|
}
|
|
605
669
|
|
|
606
670
|
function DSelect(_a) {
|
|
607
|
-
var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
|
|
671
|
+
var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, invalidIcon: invalidIconProp, validIcon: validIconProp, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "invalidIcon", "validIcon", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
|
|
608
672
|
const handleOnIconStartClick = React.useCallback(() => {
|
|
609
673
|
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
610
674
|
}, [onIconStartClick, defaultValue]);
|
|
611
675
|
const handleOnIconEndClick = React.useCallback(() => {
|
|
612
676
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
613
677
|
}, [onIconEndClick, defaultValue]);
|
|
678
|
+
const { iconMap: { input } } = useDContext();
|
|
679
|
+
const invalidIcon = React.useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
680
|
+
const validIcon = React.useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
614
681
|
return (jsxRuntime.jsxs("div", { className: classNames('d-select', className, {
|
|
615
682
|
disabled: disabled || loading,
|
|
616
683
|
}), style: style, children: [label && (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 }))] })), jsxRuntime.jsxs("div", { className: classNames({
|
|
@@ -620,11 +687,11 @@ function DSelect(_a) {
|
|
|
620
687
|
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ styles: {
|
|
621
688
|
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
622
689
|
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
623
|
-
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
690
|
+
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%', zIndex: 1000 })),
|
|
624
691
|
}, className: classNames('d-select-component', {
|
|
625
692
|
'is-invalid': invalid,
|
|
626
693
|
'is-valid': valid,
|
|
627
|
-
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((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 ?
|
|
694
|
+
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((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 }) })), (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, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
628
695
|
}
|
|
629
696
|
var DSelect$1 = Object.assign(DSelect, {
|
|
630
697
|
OptionCheck: DSelectOptionCheck,
|
|
@@ -850,7 +917,9 @@ const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
|
850
917
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
851
918
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
852
919
|
|
|
853
|
-
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, }) {
|
|
920
|
+
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, }) {
|
|
921
|
+
const innerId = React.useId();
|
|
922
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
854
923
|
const [pattern, setPattern] = React.useState('');
|
|
855
924
|
const [activeInput, setActiveInput] = React.useState(Array.from({ length: characters }).fill(''));
|
|
856
925
|
const isInputNum = React.useMemo(() => type === 'number' || type === 'tel', [type]);
|
|
@@ -925,7 +994,9 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
925
994
|
}), 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 }))] }));
|
|
926
995
|
}
|
|
927
996
|
|
|
928
|
-
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, }) {
|
|
997
|
+
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, size, floatingLabel = false, invalid = false, valid = false, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
998
|
+
const innerId = React.useId();
|
|
999
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
929
1000
|
const internalValueExtractor = React.useCallback((option) => {
|
|
930
1001
|
if (valueExtractor) {
|
|
931
1002
|
return valueExtractor(option);
|
|
@@ -960,6 +1031,9 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
960
1031
|
const iconEndClickHandler = React.useCallback((event) => {
|
|
961
1032
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
962
1033
|
}, [onIconEndClick]);
|
|
1034
|
+
const { iconMap: { input } } = useDContext();
|
|
1035
|
+
const invalidIcon = React.useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
1036
|
+
const validIcon = React.useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
963
1037
|
const ariaDescribedby = React.useMemo(() => ([
|
|
964
1038
|
iconStart && `${id}Start`,
|
|
965
1039
|
hint && `${id}Hint`,
|
|
@@ -969,7 +1043,10 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
969
1043
|
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
970
1044
|
const selectComponent = React.useMemo(() => (jsxRuntime.jsx("select", Object.assign({ id: id, name: name, className: classNames({
|
|
971
1045
|
'form-select': true,
|
|
1046
|
+
[`form-select-${size}`]: !!size,
|
|
972
1047
|
'floating-label': floatingLabel,
|
|
1048
|
+
'is-invalid': invalid,
|
|
1049
|
+
'is-valid': valid,
|
|
973
1050
|
}), "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)))) }))), [
|
|
974
1051
|
ariaDescribedby,
|
|
975
1052
|
blurHandler,
|
|
@@ -984,6 +1061,9 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
984
1061
|
options,
|
|
985
1062
|
value,
|
|
986
1063
|
floatingLabel,
|
|
1064
|
+
invalid,
|
|
1065
|
+
valid,
|
|
1066
|
+
size,
|
|
987
1067
|
]);
|
|
988
1068
|
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 }))] })), [
|
|
989
1069
|
id,
|
|
@@ -1000,10 +1080,12 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
1000
1080
|
}, [floatingLabel, labelComponent, selectComponent]);
|
|
1001
1081
|
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [label && !floatingLabel && (labelComponent), jsxRuntime.jsxs("div", { className: classNames({
|
|
1002
1082
|
'input-group': true,
|
|
1003
|
-
}), 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 }))] }));
|
|
1083
|
+
}), 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 }))] }));
|
|
1004
1084
|
}
|
|
1005
1085
|
|
|
1006
|
-
function DInputSwitch({ label, ariaLabel,
|
|
1086
|
+
function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, invalid = false, valid = false, readonly, className, style, onChange, }) {
|
|
1087
|
+
const innerId = React.useId();
|
|
1088
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1007
1089
|
const [internalIsChecked, setInternalIsChecked] = React.useState(checked);
|
|
1008
1090
|
React.useEffect(() => {
|
|
1009
1091
|
setInternalIsChecked(checked);
|
|
@@ -1013,9 +1095,50 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
|
|
|
1013
1095
|
setInternalIsChecked(value);
|
|
1014
1096
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
1015
1097
|
}, [onChange]);
|
|
1016
|
-
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',
|
|
1098
|
+
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', {
|
|
1099
|
+
'is-invalid': invalid,
|
|
1100
|
+
'is-valid': valid,
|
|
1101
|
+
}, 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 }))] }));
|
|
1017
1102
|
}
|
|
1018
1103
|
|
|
1104
|
+
function DInputRange(_a, ref) {
|
|
1105
|
+
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"]);
|
|
1106
|
+
const innerRef = useProvidedRefOrCreate(ref);
|
|
1107
|
+
const innerId = React.useId();
|
|
1108
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1109
|
+
const generateClasses = React.useMemo(() => ({
|
|
1110
|
+
'form-range': true,
|
|
1111
|
+
'form-range-value-indicator': filledValue,
|
|
1112
|
+
}), [filledValue]);
|
|
1113
|
+
const generateStyleVariables = React.useMemo(() => {
|
|
1114
|
+
const minNumber = parseFloat(min.toString());
|
|
1115
|
+
const maxNumber = parseFloat(max.toString());
|
|
1116
|
+
const valueNumber = parseFloat(value.toString());
|
|
1117
|
+
const percentage = ((valueNumber - minNumber) / (maxNumber - minNumber)) * 100;
|
|
1118
|
+
return Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}form-range-component-value`]: `${percentage}%` });
|
|
1119
|
+
}, [min, max, value, style]);
|
|
1120
|
+
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))), [
|
|
1121
|
+
ariaLabel,
|
|
1122
|
+
className,
|
|
1123
|
+
generateClasses,
|
|
1124
|
+
generateStyleVariables,
|
|
1125
|
+
id,
|
|
1126
|
+
innerRef,
|
|
1127
|
+
max,
|
|
1128
|
+
min,
|
|
1129
|
+
onChange,
|
|
1130
|
+
props,
|
|
1131
|
+
value,
|
|
1132
|
+
]);
|
|
1133
|
+
if (!label) {
|
|
1134
|
+
return inputComponent;
|
|
1135
|
+
}
|
|
1136
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("label", { className: "form-label", htmlFor: id, children: label }), inputComponent] }));
|
|
1137
|
+
}
|
|
1138
|
+
const ForwardedDInputRange = React.forwardRef(DInputRange);
|
|
1139
|
+
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1140
|
+
var DInputRange$1 = ForwardedDInputRange;
|
|
1141
|
+
|
|
1019
1142
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
1020
1143
|
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1021
1144
|
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
@@ -1044,7 +1167,7 @@ var DList$1 = Object.assign(DList, {
|
|
|
1044
1167
|
function DModalHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
|
|
1045
1168
|
const { iconMap: { xLg, }, } = useDContext();
|
|
1046
1169
|
const icon = React.useMemo(() => iconProp || xLg, [iconProp, xLg]);
|
|
1047
|
-
return (jsxRuntime.jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsxRuntime.jsx("div", { children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-
|
|
1170
|
+
return (jsxRuntime.jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsxRuntime.jsx("div", { children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
|
|
1048
1171
|
}
|
|
1049
1172
|
|
|
1050
1173
|
function DModalBody({ children, className, style, }) {
|
|
@@ -1081,7 +1204,7 @@ var DModal$1 = Object.assign(DModal, {
|
|
|
1081
1204
|
function DOffcanvasHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
|
|
1082
1205
|
const { iconMap: { xLg, }, } = useDContext();
|
|
1083
1206
|
const icon = React.useMemo(() => iconProp || xLg, [iconProp, xLg]);
|
|
1084
|
-
return (jsxRuntime.jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsxRuntime.jsx("div", { children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-
|
|
1207
|
+
return (jsxRuntime.jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsxRuntime.jsx("div", { children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
|
|
1085
1208
|
}
|
|
1086
1209
|
|
|
1087
1210
|
function DOffcanvasBody({ children, className, style, }) {
|
|
@@ -1184,7 +1307,9 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
|
|
|
1184
1307
|
: `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 }))] }));
|
|
1185
1308
|
}
|
|
1186
1309
|
|
|
1187
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1310
|
+
function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1311
|
+
const innerId = React.useId();
|
|
1312
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1188
1313
|
const changeHandler = React.useCallback((event) => {
|
|
1189
1314
|
event.stopPropagation();
|
|
1190
1315
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1192,8 +1317,10 @@ function DQuickActionCheck({ id, name, value, line1, line2, line3, className, st
|
|
|
1192
1317
|
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 })] }));
|
|
1193
1318
|
}
|
|
1194
1319
|
|
|
1195
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1320
|
+
function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1196
1321
|
const innerRef = React.useRef(null);
|
|
1322
|
+
const innerId = React.useId();
|
|
1323
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1197
1324
|
const changeHandler = React.useCallback((event) => {
|
|
1198
1325
|
event.stopPropagation();
|
|
1199
1326
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1206,7 +1333,9 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, style, s
|
|
|
1206
1333
|
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 })] }));
|
|
1207
1334
|
}
|
|
1208
1335
|
|
|
1209
|
-
function DQuickActionSwitch({ id, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1336
|
+
function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1337
|
+
const innerId = React.useId();
|
|
1338
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1210
1339
|
const clickHandler = React.useCallback((event) => {
|
|
1211
1340
|
event.stopPropagation();
|
|
1212
1341
|
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
@@ -1232,7 +1361,7 @@ function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, child
|
|
|
1232
1361
|
return (jsxRuntime.jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1233
1362
|
}
|
|
1234
1363
|
|
|
1235
|
-
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, className, style, }) {
|
|
1364
|
+
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, completed, className, style, }) {
|
|
1236
1365
|
const { iconMap: { check, }, } = useDContext();
|
|
1237
1366
|
const icon = React.useMemo(() => iconSuccessProp || check, [check, iconSuccessProp]);
|
|
1238
1367
|
if (currentStep < 1 || currentStep > options.length) {
|
|
@@ -1243,9 +1372,9 @@ function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSu
|
|
|
1243
1372
|
'is-vertical': vertical,
|
|
1244
1373
|
}, className), style: style, children: options.map(({ label, value }) => (jsxRuntime.jsxs("div", { className: "d-step", children: [jsxRuntime.jsx("div", { className: "d-step-value", children: jsxRuntime.jsx("div", { className: classNames({
|
|
1245
1374
|
'd-step-icon-container': true,
|
|
1246
|
-
'd-step-check': value < currentStep,
|
|
1247
|
-
'd-step-current': value === currentStep,
|
|
1248
|
-
}), children: value < currentStep
|
|
1375
|
+
'd-step-check': value < currentStep || completed,
|
|
1376
|
+
'd-step-current': value === currentStep && !completed,
|
|
1377
|
+
}), children: value < currentStep || completed
|
|
1249
1378
|
? (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" }))
|
|
1250
1379
|
: value }) }), jsxRuntime.jsx("div", { className: "d-step-label", children: label })] }, value))) }));
|
|
1251
1380
|
}
|
|
@@ -1280,8 +1409,8 @@ function DStepper$1({ options, currentStep, className, style, }) {
|
|
|
1280
1409
|
return (jsxRuntime.jsxs("div", { className: classNames('d-stepper', className), style: style, children: [jsxRuntime.jsx("div", { className: "d-step-bar", style: { background: progressStyle }, children: jsxRuntime.jsx("p", { className: "d-step-number", children: `${currentStep}/${options.length}` }) }), jsxRuntime.jsx("div", { className: "d-step-info", children: Object.keys(currentOption).length > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-step-label", children: currentOption.label }), jsxRuntime.jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
|
|
1281
1410
|
}
|
|
1282
1411
|
|
|
1283
|
-
function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, breakpoint = 'lg', className, style, }) {
|
|
1284
|
-
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [jsxRuntime.jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsxRuntime.jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsxRuntime.jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsxRuntime.jsx(DStepper$2, { options: options, currentStep: currentStep, vertical: vertical, iconSuccess: iconSuccess, iconSuccessFamilyClass: iconSuccessFamilyClass, iconSuccessFamilyPrefix: iconSuccessFamilyPrefix, iconSuccessMaterialStyle: iconSuccessMaterialStyle }) })] }));
|
|
1412
|
+
function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, breakpoint = 'lg', className, completed = false, style, }) {
|
|
1413
|
+
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [jsxRuntime.jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsxRuntime.jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsxRuntime.jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsxRuntime.jsx(DStepper$2, { options: options, currentStep: currentStep, vertical: vertical, iconSuccess: iconSuccess, iconSuccessFamilyClass: iconSuccessFamilyClass, iconSuccessFamilyPrefix: iconSuccessFamilyPrefix, iconSuccessMaterialStyle: iconSuccessMaterialStyle, completed: completed }) })] }));
|
|
1285
1414
|
}
|
|
1286
1415
|
|
|
1287
1416
|
const ARROW_WIDTH = 8;
|
|
@@ -1339,7 +1468,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1339
1468
|
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 }));
|
|
1340
1469
|
}
|
|
1341
1470
|
|
|
1342
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, variant = 'underline', }) {
|
|
1471
|
+
function DTabs({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', }) {
|
|
1343
1472
|
const [selected, setSelected] = React.useState(defaultSelected);
|
|
1344
1473
|
const onSelect = React.useCallback((option) => {
|
|
1345
1474
|
if (option.tab) {
|
|
@@ -1360,39 +1489,77 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1360
1489
|
'flex-column': !vertical || variant === 'tabs',
|
|
1361
1490
|
}), style: style, children: [jsxRuntime.jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1362
1491
|
active: option.tab === selected,
|
|
1363
|
-
},
|
|
1492
|
+
}, 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 })] }) }));
|
|
1364
1493
|
}
|
|
1365
1494
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1366
1495
|
Tab: DTabContent,
|
|
1367
1496
|
});
|
|
1368
1497
|
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1498
|
+
function DToastHeader({ children, className, style }) {
|
|
1499
|
+
return (jsxRuntime.jsx("div", { className: classNames('toast-header', className), style: style, children: children }));
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
function DToastBody({ children, className, style }) {
|
|
1503
|
+
return (jsxRuntime.jsx("div", { className: classNames('toast-body', className), style: style, children: children }));
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
function DToast({ children, className, style }) {
|
|
1507
|
+
return (jsxRuntime.jsx("div", { className: classNames('toast', className), role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: style, children: children }));
|
|
1508
|
+
}
|
|
1509
|
+
var DToast$1 = Object.assign(DToast, {
|
|
1510
|
+
Header: DToastHeader,
|
|
1511
|
+
Body: DToastBody,
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1514
|
+
function DToastContainer({ containerClassName, position = 'bottom-center', reverseOrder = false, containerStyle, toastOptions, gutter, }) {
|
|
1515
|
+
return (jsxRuntime.jsx(reactHotToast.Toaster, { containerClassName: containerClassName, position: position, reverseOrder: reverseOrder, containerStyle: containerStyle, gutter: gutter, toastOptions: toastOptions }));
|
|
1378
1516
|
}
|
|
1379
1517
|
|
|
1380
|
-
const TOAST_TRANSITIONS = {
|
|
1381
|
-
bounce: reactToastify.Bounce,
|
|
1382
|
-
flip: reactToastify.Flip,
|
|
1383
|
-
slide: reactToastify.Slide,
|
|
1384
|
-
zoom: reactToastify.Zoom,
|
|
1385
|
-
};
|
|
1386
1518
|
function useDToast() {
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1519
|
+
const { iconMap: { xLg, }, } = useDContext();
|
|
1520
|
+
const toast = React.useCallback((data, toastProps) => {
|
|
1521
|
+
if (typeof data === 'function') {
|
|
1522
|
+
return reactHotToast.toast.custom(data, toastProps);
|
|
1523
|
+
}
|
|
1524
|
+
const { title, description, icon, closeIcon, timestamp, theme, soft, } = data;
|
|
1525
|
+
return reactHotToast.toast.custom(({ id, visible }) => {
|
|
1526
|
+
if (!visible) {
|
|
1527
|
+
return null;
|
|
1528
|
+
}
|
|
1529
|
+
return (jsxRuntime.jsxs(DToast$1, { className: classNames({
|
|
1530
|
+
[`bg-${theme}-soft`]: !!theme && soft,
|
|
1531
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1532
|
+
'border-0': !!theme,
|
|
1533
|
+
}, 'show'), children: [!description && (jsxRuntime.jsxs(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: [jsxRuntime.jsx("span", { className: "me-auto", children: title }), jsxRuntime.jsx("button", { type: "button", className: classNames({
|
|
1534
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1535
|
+
'd-close': true,
|
|
1536
|
+
}), "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] })), description && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(DToast$1.Header, { className: classNames({
|
|
1537
|
+
[`bg-${theme}-soft`]: !!theme && soft,
|
|
1538
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1539
|
+
}, 'show'), children: [icon && (jsxRuntime.jsx(DIcon, { icon: icon })), jsxRuntime.jsx("p", { className: "mb-0 me-auto", children: title }), timestamp && (jsxRuntime.jsx("small", { children: timestamp })), jsxRuntime.jsx("button", { type: "button", className: classNames({
|
|
1540
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1541
|
+
'd-close': true,
|
|
1542
|
+
}), "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsxRuntime.jsx(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: jsxRuntime.jsx("span", { children: description }) })] }))] }));
|
|
1543
|
+
}, toastProps);
|
|
1544
|
+
}, [xLg]);
|
|
1391
1545
|
return {
|
|
1392
1546
|
toast,
|
|
1393
1547
|
};
|
|
1394
1548
|
}
|
|
1395
1549
|
|
|
1550
|
+
function DTableHead({ className, style, field, label, value = '', onChange, }) {
|
|
1551
|
+
const handleOnChange = React.useCallback(() => {
|
|
1552
|
+
if (value === field) {
|
|
1553
|
+
return onChange(`-${field}`);
|
|
1554
|
+
}
|
|
1555
|
+
if (value === `-${field}`) {
|
|
1556
|
+
return onChange('');
|
|
1557
|
+
}
|
|
1558
|
+
return onChange(field);
|
|
1559
|
+
}, [field, value, onChange]);
|
|
1560
|
+
return (jsxRuntime.jsx("th", { style: style, className: classNames('d-table-head', className), children: jsxRuntime.jsxs("button", { type: "button", onClick: handleOnChange, children: [label, value && value.includes(field) && (jsxRuntime.jsx(DIcon, { icon: value === field ? 'arrow-up' : 'arrow-down' }))] }) }));
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1396
1563
|
async function configureI8n(resources, _a = {}) {
|
|
1397
1564
|
var { lng = 'en', fallbackLng = 'en' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
|
|
1398
1565
|
return i18n
|
|
@@ -1411,6 +1578,7 @@ exports.DAlert = DAlert;
|
|
|
1411
1578
|
exports.DBadge = DBadge;
|
|
1412
1579
|
exports.DBoxFile = DBoxFile;
|
|
1413
1580
|
exports.DButton = DButton;
|
|
1581
|
+
exports.DButtonIcon = DButtonIcon;
|
|
1414
1582
|
exports.DCard = DCard$1;
|
|
1415
1583
|
exports.DCardBody = DCardBody;
|
|
1416
1584
|
exports.DCardFooter = DCardFooter;
|
|
@@ -1433,6 +1601,7 @@ exports.DInputCurrencyBase = DInputCurrencyBase$1;
|
|
|
1433
1601
|
exports.DInputMask = DInputMask$1;
|
|
1434
1602
|
exports.DInputPassword = DInputPassword$1;
|
|
1435
1603
|
exports.DInputPin = DInputPin;
|
|
1604
|
+
exports.DInputRange = DInputRange$1;
|
|
1436
1605
|
exports.DInputSearch = DInputSearch$1;
|
|
1437
1606
|
exports.DInputSelect = DInputSelect;
|
|
1438
1607
|
exports.DInputSwitch = DInputSwitch;
|
|
@@ -1459,7 +1628,9 @@ exports.DStepper = DStepper;
|
|
|
1459
1628
|
exports.DStepperDesktop = DStepper$2;
|
|
1460
1629
|
exports.DStepperMobile = DStepper$1;
|
|
1461
1630
|
exports.DTabContent = DTabContent;
|
|
1631
|
+
exports.DTableHead = DTableHead;
|
|
1462
1632
|
exports.DTabs = DTabs$1;
|
|
1633
|
+
exports.DToast = DToast$1;
|
|
1463
1634
|
exports.DToastContainer = DToastContainer;
|
|
1464
1635
|
exports.DTooltip = DTooltip;
|
|
1465
1636
|
exports.configureI18n = configureI8n;
|