@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.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,9 +11,9 @@ 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
|
-
import {
|
|
16
|
+
import { Toaster, toast } from 'react-hot-toast';
|
|
17
17
|
import i18n from 'i18next';
|
|
18
18
|
import { initReactI18next } from 'react-i18next';
|
|
19
19
|
|
|
@@ -157,20 +157,26 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
|
|
|
157
157
|
closePortal,
|
|
158
158
|
}), [stack, openPortal, closePortal]);
|
|
159
159
|
const handleClose = useCallback((target) => {
|
|
160
|
-
if (target instanceof HTMLDivElement) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
if (!(target instanceof HTMLDivElement)) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (target.classList.contains('portal') && !('bsBackdrop' in target.dataset)) {
|
|
164
|
+
closePortal();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (target.classList.contains('backdrop')) {
|
|
168
|
+
const lastPortal = target.nextElementSibling;
|
|
169
|
+
if (lastPortal && lastPortal.classList.contains('portal') && !('bsBackdrop' in lastPortal.dataset)) {
|
|
170
|
+
closePortal();
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
173
|
}, [closePortal]);
|
|
168
174
|
useEffect(() => {
|
|
169
175
|
const keyEvent = (event) => {
|
|
170
176
|
if (event.key === 'Escape') {
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
handleClose(
|
|
177
|
+
const lastPortal = document.querySelector(`#${portalName} > div > div:last-child`);
|
|
178
|
+
if (lastPortal) {
|
|
179
|
+
handleClose(lastPortal);
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
182
|
};
|
|
@@ -319,6 +325,28 @@ function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel
|
|
|
319
325
|
return (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 && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), (text && !loading) && (jsx("span", { children: text })), loading && (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }))] })));
|
|
320
326
|
}
|
|
321
327
|
|
|
328
|
+
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, }) {
|
|
329
|
+
const generateClasses = useMemo(() => {
|
|
330
|
+
const variantClass = variant
|
|
331
|
+
? `btn-${variant}-${theme}`
|
|
332
|
+
: `btn-${theme}`;
|
|
333
|
+
return Object.assign(Object.assign(Object.assign({ 'btn d-button-icon': true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
334
|
+
}, [variant, theme, size, state, loading]);
|
|
335
|
+
const clickHandler = useCallback((event) => {
|
|
336
|
+
if (stopPropagationEnabled) {
|
|
337
|
+
event.stopPropagation();
|
|
338
|
+
}
|
|
339
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
340
|
+
}, [stopPropagationEnabled, onClick]);
|
|
341
|
+
const isDisabled = useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
342
|
+
const newAriaLabel = useMemo(() => (loading
|
|
343
|
+
? (loadingAriaLabel || ariaLabel)
|
|
344
|
+
: (ariaLabel)), [ariaLabel, loading, loadingAriaLabel]);
|
|
345
|
+
return (jsx("button", { className: classNames(generateClasses, className), style: style, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, id: id, children: loading
|
|
346
|
+
? (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
347
|
+
: (jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) }));
|
|
348
|
+
}
|
|
349
|
+
|
|
322
350
|
function DCardHeader({ className, style, children, }) {
|
|
323
351
|
return (jsx("div", { className: classNames('card-header', className), style: style, children: children }));
|
|
324
352
|
}
|
|
@@ -402,7 +430,7 @@ function formatCurrency(amount, options) {
|
|
|
402
430
|
|
|
403
431
|
function useFormatCurrency(...args) {
|
|
404
432
|
const { currency } = useDContext();
|
|
405
|
-
const format = useCallback((value) => formatCurrency(value, currency), [currency]);
|
|
433
|
+
const format = useCallback((value, currencyOptions) => formatCurrency(value, currencyOptions || currency), [currency]);
|
|
406
434
|
const values = (args || []).map((value) => (formatCurrency(value !== null && value !== void 0 ? value : 0, currency)));
|
|
407
435
|
return {
|
|
408
436
|
format,
|
|
@@ -436,8 +464,10 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
436
464
|
}
|
|
437
465
|
|
|
438
466
|
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"]);
|
|
467
|
+
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 = __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"]);
|
|
440
468
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
469
|
+
const innerId = useId();
|
|
470
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
441
471
|
const handleOnChange = useCallback((event) => {
|
|
442
472
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
443
473
|
}, [onChange]);
|
|
@@ -448,13 +478,28 @@ function DInput(_a, ref) {
|
|
|
448
478
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
449
479
|
}, [onIconEndClick, value]);
|
|
450
480
|
const ariaDescribedby = useMemo(() => ([
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
iconEnd && `${id}
|
|
481
|
+
!!inputStart && `${id}InputStart`,
|
|
482
|
+
!!iconStart && `${id}Start`,
|
|
483
|
+
(invalid || valid) && !iconEnd && !loading && `${id}State`,
|
|
484
|
+
(iconEnd && !loading) && `${id}End`,
|
|
485
|
+
loading && `${id}Loading`,
|
|
486
|
+
!!inputEnd && `${id}InputEnd`,
|
|
487
|
+
!!hint && `${id}Hint`,
|
|
454
488
|
]
|
|
455
489
|
.filter(Boolean)
|
|
456
|
-
.join(' ')), [
|
|
490
|
+
.join(' ')), [
|
|
491
|
+
id,
|
|
492
|
+
inputStart,
|
|
493
|
+
iconStart,
|
|
494
|
+
invalid,
|
|
495
|
+
valid,
|
|
496
|
+
iconEnd,
|
|
497
|
+
loading,
|
|
498
|
+
inputEnd,
|
|
499
|
+
hint,
|
|
500
|
+
]);
|
|
457
501
|
const inputComponent = useMemo(() => (jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
502
|
+
[`form-control-${size}`]: !!size,
|
|
458
503
|
'is-invalid': invalid,
|
|
459
504
|
'is-valid': valid,
|
|
460
505
|
}), disabled: disabled || loading, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
|
|
@@ -470,6 +515,7 @@ function DInput(_a, ref) {
|
|
|
470
515
|
floatingLabel,
|
|
471
516
|
valid,
|
|
472
517
|
value,
|
|
518
|
+
size,
|
|
473
519
|
]);
|
|
474
520
|
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, materialStyle: labelIconMaterialStyle }))] })), [
|
|
475
521
|
id,
|
|
@@ -491,7 +537,7 @@ function DInput(_a, ref) {
|
|
|
491
537
|
return (jsxs("div", { className: className, style: style, children: [label && !floatingLabel && labelComponent, jsxs("div", { className: classNames({
|
|
492
538
|
'input-group': true,
|
|
493
539
|
'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 }))] }));
|
|
540
|
+
}), 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
541
|
}
|
|
496
542
|
const ForwardedDInput = forwardRef(DInput);
|
|
497
543
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -512,8 +558,10 @@ const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
|
512
558
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
513
559
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
514
560
|
|
|
515
|
-
function DInputCheck({ type, name, label, ariaLabel, checked = false,
|
|
561
|
+
function DInputCheck({ id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, value, onChange, className, style, }) {
|
|
516
562
|
const innerRef = useRef(null);
|
|
563
|
+
const innerId = useId();
|
|
564
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
517
565
|
const handleChange = useCallback((event) => {
|
|
518
566
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
519
567
|
}, [onChange]);
|
|
@@ -527,10 +575,26 @@ function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabl
|
|
|
527
575
|
innerRef.current.checked = checked;
|
|
528
576
|
}
|
|
529
577
|
}, [checked]);
|
|
578
|
+
const inputComponent = useMemo(() => (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
579
|
+
'is-invalid': invalid,
|
|
580
|
+
'is-valid': valid,
|
|
581
|
+
}, className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel })), [
|
|
582
|
+
ariaLabel,
|
|
583
|
+
className,
|
|
584
|
+
disabled,
|
|
585
|
+
valid,
|
|
586
|
+
invalid,
|
|
587
|
+
handleChange,
|
|
588
|
+
id,
|
|
589
|
+
name,
|
|
590
|
+
style,
|
|
591
|
+
type,
|
|
592
|
+
value,
|
|
593
|
+
]);
|
|
530
594
|
if (!label) {
|
|
531
|
-
return
|
|
595
|
+
return inputComponent;
|
|
532
596
|
}
|
|
533
|
-
return (jsxs("div", { className: "form-check", children: [
|
|
597
|
+
return (jsxs("div", { className: "form-check", children: [inputComponent, jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
534
598
|
}
|
|
535
599
|
|
|
536
600
|
function DSelectOptionCheck(_a) {
|
|
@@ -602,13 +666,16 @@ function DSelectSingleValueEmojiText(_a) {
|
|
|
602
666
|
}
|
|
603
667
|
|
|
604
668
|
function DSelect(_a) {
|
|
605
|
-
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 = __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"]);
|
|
669
|
+
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 = __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"]);
|
|
606
670
|
const handleOnIconStartClick = useCallback(() => {
|
|
607
671
|
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
608
672
|
}, [onIconStartClick, defaultValue]);
|
|
609
673
|
const handleOnIconEndClick = useCallback(() => {
|
|
610
674
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
611
675
|
}, [onIconEndClick, defaultValue]);
|
|
676
|
+
const { iconMap: { input } } = useDContext();
|
|
677
|
+
const invalidIcon = useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
678
|
+
const validIcon = useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
612
679
|
return (jsxs("div", { className: classNames('d-select', className, {
|
|
613
680
|
disabled: disabled || loading,
|
|
614
681
|
}), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: classNames({
|
|
@@ -618,11 +685,11 @@ function DSelect(_a) {
|
|
|
618
685
|
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsx(Select, Object.assign({ styles: {
|
|
619
686
|
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
620
687
|
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
621
|
-
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
688
|
+
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%', zIndex: 1000 })),
|
|
622
689
|
}, className: classNames('d-select-component', {
|
|
623
690
|
'is-invalid': invalid,
|
|
624
691
|
'is-valid': valid,
|
|
625
|
-
}), 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) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ?
|
|
692
|
+
}), 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) && (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 }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
626
693
|
}
|
|
627
694
|
var DSelect$1 = Object.assign(DSelect, {
|
|
628
695
|
OptionCheck: DSelectOptionCheck,
|
|
@@ -848,7 +915,9 @@ const ForwardedDInputPassword = forwardRef(DInputPassword);
|
|
|
848
915
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
849
916
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
850
917
|
|
|
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, }) {
|
|
918
|
+
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, }) {
|
|
919
|
+
const innerId = useId();
|
|
920
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
852
921
|
const [pattern, setPattern] = useState('');
|
|
853
922
|
const [activeInput, setActiveInput] = useState(Array.from({ length: characters }).fill(''));
|
|
854
923
|
const isInputNum = useMemo(() => type === 'number' || type === 'tel', [type]);
|
|
@@ -923,7 +992,9 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
923
992
|
}), 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
993
|
}
|
|
925
994
|
|
|
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, }) {
|
|
995
|
+
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, }) {
|
|
996
|
+
const innerId = useId();
|
|
997
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
927
998
|
const internalValueExtractor = useCallback((option) => {
|
|
928
999
|
if (valueExtractor) {
|
|
929
1000
|
return valueExtractor(option);
|
|
@@ -958,6 +1029,9 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
958
1029
|
const iconEndClickHandler = useCallback((event) => {
|
|
959
1030
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
960
1031
|
}, [onIconEndClick]);
|
|
1032
|
+
const { iconMap: { input } } = useDContext();
|
|
1033
|
+
const invalidIcon = useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
1034
|
+
const validIcon = useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
961
1035
|
const ariaDescribedby = useMemo(() => ([
|
|
962
1036
|
iconStart && `${id}Start`,
|
|
963
1037
|
hint && `${id}Hint`,
|
|
@@ -967,7 +1041,10 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
967
1041
|
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
968
1042
|
const selectComponent = useMemo(() => (jsx("select", Object.assign({ id: id, name: name, className: classNames({
|
|
969
1043
|
'form-select': true,
|
|
1044
|
+
[`form-select-${size}`]: !!size,
|
|
970
1045
|
'floating-label': floatingLabel,
|
|
1046
|
+
'is-invalid': invalid,
|
|
1047
|
+
'is-valid': valid,
|
|
971
1048
|
}), "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
1049
|
ariaDescribedby,
|
|
973
1050
|
blurHandler,
|
|
@@ -982,6 +1059,9 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
982
1059
|
options,
|
|
983
1060
|
value,
|
|
984
1061
|
floatingLabel,
|
|
1062
|
+
invalid,
|
|
1063
|
+
valid,
|
|
1064
|
+
size,
|
|
985
1065
|
]);
|
|
986
1066
|
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
1067
|
id,
|
|
@@ -998,10 +1078,12 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
998
1078
|
}, [floatingLabel, labelComponent, selectComponent]);
|
|
999
1079
|
return (jsxs("div", { className: className, style: style, children: [label && !floatingLabel && (labelComponent), jsxs("div", { className: classNames({
|
|
1000
1080
|
'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 }))] }));
|
|
1081
|
+
}), 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
1082
|
}
|
|
1003
1083
|
|
|
1004
|
-
function DInputSwitch({ label, ariaLabel,
|
|
1084
|
+
function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, invalid = false, valid = false, readonly, className, style, onChange, }) {
|
|
1085
|
+
const innerId = useId();
|
|
1086
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1005
1087
|
const [internalIsChecked, setInternalIsChecked] = useState(checked);
|
|
1006
1088
|
useEffect(() => {
|
|
1007
1089
|
setInternalIsChecked(checked);
|
|
@@ -1011,9 +1093,50 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
|
|
|
1011
1093
|
setInternalIsChecked(value);
|
|
1012
1094
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
1013
1095
|
}, [onChange]);
|
|
1014
|
-
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input',
|
|
1096
|
+
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', {
|
|
1097
|
+
'is-invalid': invalid,
|
|
1098
|
+
'is-valid': valid,
|
|
1099
|
+
}, 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
1100
|
}
|
|
1016
1101
|
|
|
1102
|
+
function DInputRange(_a, ref) {
|
|
1103
|
+
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"]);
|
|
1104
|
+
const innerRef = useProvidedRefOrCreate(ref);
|
|
1105
|
+
const innerId = useId();
|
|
1106
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1107
|
+
const generateClasses = useMemo(() => ({
|
|
1108
|
+
'form-range': true,
|
|
1109
|
+
'form-range-value-indicator': filledValue,
|
|
1110
|
+
}), [filledValue]);
|
|
1111
|
+
const generateStyleVariables = useMemo(() => {
|
|
1112
|
+
const minNumber = parseFloat(min.toString());
|
|
1113
|
+
const maxNumber = parseFloat(max.toString());
|
|
1114
|
+
const valueNumber = parseFloat(value.toString());
|
|
1115
|
+
const percentage = ((valueNumber - minNumber) / (maxNumber - minNumber)) * 100;
|
|
1116
|
+
return Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}form-range-component-value`]: `${percentage}%` });
|
|
1117
|
+
}, [min, max, value, style]);
|
|
1118
|
+
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))), [
|
|
1119
|
+
ariaLabel,
|
|
1120
|
+
className,
|
|
1121
|
+
generateClasses,
|
|
1122
|
+
generateStyleVariables,
|
|
1123
|
+
id,
|
|
1124
|
+
innerRef,
|
|
1125
|
+
max,
|
|
1126
|
+
min,
|
|
1127
|
+
onChange,
|
|
1128
|
+
props,
|
|
1129
|
+
value,
|
|
1130
|
+
]);
|
|
1131
|
+
if (!label) {
|
|
1132
|
+
return inputComponent;
|
|
1133
|
+
}
|
|
1134
|
+
return (jsxs(Fragment$1, { children: [jsx("label", { className: "form-label", htmlFor: id, children: label }), inputComponent] }));
|
|
1135
|
+
}
|
|
1136
|
+
const ForwardedDInputRange = forwardRef(DInputRange);
|
|
1137
|
+
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1138
|
+
var DInputRange$1 = ForwardedDInputRange;
|
|
1139
|
+
|
|
1017
1140
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
1018
1141
|
const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1019
1142
|
return (jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
@@ -1042,7 +1165,7 @@ var DList$1 = Object.assign(DList, {
|
|
|
1042
1165
|
function DModalHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
|
|
1043
1166
|
const { iconMap: { xLg, }, } = useDContext();
|
|
1044
1167
|
const icon = useMemo(() => iconProp || xLg, [iconProp, xLg]);
|
|
1045
|
-
return (jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-
|
|
1168
|
+
return (jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
|
|
1046
1169
|
}
|
|
1047
1170
|
|
|
1048
1171
|
function DModalBody({ children, className, style, }) {
|
|
@@ -1079,7 +1202,7 @@ var DModal$1 = Object.assign(DModal, {
|
|
|
1079
1202
|
function DOffcanvasHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
|
|
1080
1203
|
const { iconMap: { xLg, }, } = useDContext();
|
|
1081
1204
|
const icon = useMemo(() => iconProp || xLg, [iconProp, xLg]);
|
|
1082
|
-
return (jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-
|
|
1205
|
+
return (jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
|
|
1083
1206
|
}
|
|
1084
1207
|
|
|
1085
1208
|
function DOffcanvasBody({ children, className, style, }) {
|
|
@@ -1141,7 +1264,7 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
1141
1264
|
dismiss,
|
|
1142
1265
|
role,
|
|
1143
1266
|
]);
|
|
1144
|
-
const headingId = useId();
|
|
1267
|
+
const headingId = useId$1();
|
|
1145
1268
|
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), adjustContentToRender && {
|
|
1146
1269
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
1147
1270
|
})), [style, adjustContentToRender]);
|
|
@@ -1182,7 +1305,9 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
|
|
|
1182
1305
|
: `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
1306
|
}
|
|
1184
1307
|
|
|
1185
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1308
|
+
function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1309
|
+
const innerId = useId();
|
|
1310
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1186
1311
|
const changeHandler = useCallback((event) => {
|
|
1187
1312
|
event.stopPropagation();
|
|
1188
1313
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1190,8 +1315,10 @@ function DQuickActionCheck({ id, name, value, line1, line2, line3, className, st
|
|
|
1190
1315
|
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
1316
|
}
|
|
1192
1317
|
|
|
1193
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1318
|
+
function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1194
1319
|
const innerRef = useRef(null);
|
|
1320
|
+
const innerId = useId();
|
|
1321
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1195
1322
|
const changeHandler = useCallback((event) => {
|
|
1196
1323
|
event.stopPropagation();
|
|
1197
1324
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
@@ -1204,7 +1331,9 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, style, s
|
|
|
1204
1331
|
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
1332
|
}
|
|
1206
1333
|
|
|
1207
|
-
function DQuickActionSwitch({ id, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1334
|
+
function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1335
|
+
const innerId = useId();
|
|
1336
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1208
1337
|
const clickHandler = useCallback((event) => {
|
|
1209
1338
|
event.stopPropagation();
|
|
1210
1339
|
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
@@ -1230,7 +1359,7 @@ function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, child
|
|
|
1230
1359
|
return (jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1231
1360
|
}
|
|
1232
1361
|
|
|
1233
|
-
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, className, style, }) {
|
|
1362
|
+
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, completed, className, style, }) {
|
|
1234
1363
|
const { iconMap: { check, }, } = useDContext();
|
|
1235
1364
|
const icon = useMemo(() => iconSuccessProp || check, [check, iconSuccessProp]);
|
|
1236
1365
|
if (currentStep < 1 || currentStep > options.length) {
|
|
@@ -1241,9 +1370,9 @@ function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSu
|
|
|
1241
1370
|
'is-vertical': vertical,
|
|
1242
1371
|
}, className), style: style, children: options.map(({ label, value }) => (jsxs("div", { className: "d-step", children: [jsx("div", { className: "d-step-value", children: jsx("div", { className: classNames({
|
|
1243
1372
|
'd-step-icon-container': true,
|
|
1244
|
-
'd-step-check': value < currentStep,
|
|
1245
|
-
'd-step-current': value === currentStep,
|
|
1246
|
-
}), children: value < currentStep
|
|
1373
|
+
'd-step-check': value < currentStep || completed,
|
|
1374
|
+
'd-step-current': value === currentStep && !completed,
|
|
1375
|
+
}), children: value < currentStep || completed
|
|
1247
1376
|
? (jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" }))
|
|
1248
1377
|
: value }) }), jsx("div", { className: "d-step-label", children: label })] }, value))) }));
|
|
1249
1378
|
}
|
|
@@ -1278,8 +1407,8 @@ function DStepper$1({ options, currentStep, className, style, }) {
|
|
|
1278
1407
|
return (jsxs("div", { className: classNames('d-stepper', className), style: style, children: [jsx("div", { className: "d-step-bar", style: { background: progressStyle }, children: jsx("p", { className: "d-step-number", children: `${currentStep}/${options.length}` }) }), jsx("div", { className: "d-step-info", children: Object.keys(currentOption).length > 0 && (jsxs(Fragment$1, { children: [jsx("div", { className: "d-step-label", children: currentOption.label }), jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
|
|
1279
1408
|
}
|
|
1280
1409
|
|
|
1281
|
-
function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, breakpoint = 'lg', className, style, }) {
|
|
1282
|
-
return (jsxs("div", { className: className, style: style, children: [jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsx(DStepper$2, { options: options, currentStep: currentStep, vertical: vertical, iconSuccess: iconSuccess, iconSuccessFamilyClass: iconSuccessFamilyClass, iconSuccessFamilyPrefix: iconSuccessFamilyPrefix, iconSuccessMaterialStyle: iconSuccessMaterialStyle }) })] }));
|
|
1410
|
+
function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, breakpoint = 'lg', className, completed = false, style, }) {
|
|
1411
|
+
return (jsxs("div", { className: className, style: style, children: [jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsx(DStepper$2, { options: options, currentStep: currentStep, vertical: vertical, iconSuccess: iconSuccess, iconSuccessFamilyClass: iconSuccessFamilyClass, iconSuccessFamilyPrefix: iconSuccessFamilyPrefix, iconSuccessMaterialStyle: iconSuccessMaterialStyle, completed: completed }) })] }));
|
|
1283
1412
|
}
|
|
1284
1413
|
|
|
1285
1414
|
const ARROW_WIDTH = 8;
|
|
@@ -1337,7 +1466,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1337
1466
|
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
1467
|
}
|
|
1339
1468
|
|
|
1340
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, variant = 'underline', }) {
|
|
1469
|
+
function DTabs({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', }) {
|
|
1341
1470
|
const [selected, setSelected] = useState(defaultSelected);
|
|
1342
1471
|
const onSelect = useCallback((option) => {
|
|
1343
1472
|
if (option.tab) {
|
|
@@ -1358,39 +1487,77 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1358
1487
|
'flex-column': !vertical || variant === 'tabs',
|
|
1359
1488
|
}), style: style, children: [jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1360
1489
|
active: option.tab === selected,
|
|
1361
|
-
},
|
|
1490
|
+
}, 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
1491
|
}
|
|
1363
1492
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1364
1493
|
Tab: DTabContent,
|
|
1365
1494
|
});
|
|
1366
1495
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
};
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1496
|
+
function DToastHeader({ children, className, style }) {
|
|
1497
|
+
return (jsx("div", { className: classNames('toast-header', className), style: style, children: children }));
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
function DToastBody({ children, className, style }) {
|
|
1501
|
+
return (jsx("div", { className: classNames('toast-body', className), style: style, children: children }));
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
function DToast({ children, className, style }) {
|
|
1505
|
+
return (jsx("div", { className: classNames('toast', className), role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: style, children: children }));
|
|
1506
|
+
}
|
|
1507
|
+
var DToast$1 = Object.assign(DToast, {
|
|
1508
|
+
Header: DToastHeader,
|
|
1509
|
+
Body: DToastBody,
|
|
1510
|
+
});
|
|
1511
|
+
|
|
1512
|
+
function DToastContainer({ containerClassName, position = 'bottom-center', reverseOrder = false, containerStyle, toastOptions, gutter, }) {
|
|
1513
|
+
return (jsx(Toaster, { containerClassName: containerClassName, position: position, reverseOrder: reverseOrder, containerStyle: containerStyle, gutter: gutter, toastOptions: toastOptions }));
|
|
1376
1514
|
}
|
|
1377
1515
|
|
|
1378
|
-
const TOAST_TRANSITIONS = {
|
|
1379
|
-
bounce: Bounce,
|
|
1380
|
-
flip: Flip,
|
|
1381
|
-
slide: Slide,
|
|
1382
|
-
zoom: Zoom,
|
|
1383
|
-
};
|
|
1384
1516
|
function useDToast() {
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1517
|
+
const { iconMap: { xLg, }, } = useDContext();
|
|
1518
|
+
const toast$1 = useCallback((data, toastProps) => {
|
|
1519
|
+
if (typeof data === 'function') {
|
|
1520
|
+
return toast.custom(data, toastProps);
|
|
1521
|
+
}
|
|
1522
|
+
const { title, description, icon, closeIcon, timestamp, theme, soft, } = data;
|
|
1523
|
+
return toast.custom(({ id, visible }) => {
|
|
1524
|
+
if (!visible) {
|
|
1525
|
+
return null;
|
|
1526
|
+
}
|
|
1527
|
+
return (jsxs(DToast$1, { className: classNames({
|
|
1528
|
+
[`bg-${theme}-soft`]: !!theme && soft,
|
|
1529
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1530
|
+
'border-0': !!theme,
|
|
1531
|
+
}, 'show'), children: [!description && (jsxs(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: [jsx("span", { className: "me-auto", children: title }), jsx("button", { type: "button", className: classNames({
|
|
1532
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1533
|
+
'd-close': true,
|
|
1534
|
+
}), "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] })), description && (jsxs(Fragment$1, { children: [jsxs(DToast$1.Header, { className: classNames({
|
|
1535
|
+
[`bg-${theme}-soft`]: !!theme && soft,
|
|
1536
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1537
|
+
}, 'show'), children: [icon && (jsx(DIcon, { icon: icon })), jsx("p", { className: "mb-0 me-auto", children: title }), timestamp && (jsx("small", { children: timestamp })), jsx("button", { type: "button", className: classNames({
|
|
1538
|
+
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1539
|
+
'd-close': true,
|
|
1540
|
+
}), "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsx(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: jsx("span", { children: description }) })] }))] }));
|
|
1541
|
+
}, toastProps);
|
|
1542
|
+
}, [xLg]);
|
|
1389
1543
|
return {
|
|
1390
1544
|
toast: toast$1,
|
|
1391
1545
|
};
|
|
1392
1546
|
}
|
|
1393
1547
|
|
|
1548
|
+
function DTableHead({ className, style, field, label, value = '', onChange, }) {
|
|
1549
|
+
const handleOnChange = useCallback(() => {
|
|
1550
|
+
if (value === field) {
|
|
1551
|
+
return onChange(`-${field}`);
|
|
1552
|
+
}
|
|
1553
|
+
if (value === `-${field}`) {
|
|
1554
|
+
return onChange('');
|
|
1555
|
+
}
|
|
1556
|
+
return onChange(field);
|
|
1557
|
+
}, [field, value, onChange]);
|
|
1558
|
+
return (jsx("th", { style: style, className: classNames('d-table-head', className), children: jsxs("button", { type: "button", onClick: handleOnChange, children: [label, value && value.includes(field) && (jsx(DIcon, { icon: value === field ? 'arrow-up' : 'arrow-down' }))] }) }));
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1394
1561
|
async function configureI8n(resources, _a = {}) {
|
|
1395
1562
|
var { lng = 'en', fallbackLng = 'en' } = _a, config = __rest(_a, ["lng", "fallbackLng"]);
|
|
1396
1563
|
return i18n
|
|
@@ -1405,5 +1572,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1405
1572
|
.then((t) => t);
|
|
1406
1573
|
}
|
|
1407
1574
|
|
|
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 };
|
|
1575
|
+
export { DAlert, DBadge, DBoxFile, DButton, DButtonIcon, 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, DTableHead, 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
1576
|
//# sourceMappingURL=index.esm.js.map
|