@dynamic-framework/ui-react 1.9.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/dynamic-ui-non-root.css +323 -349
- package/dist/css/dynamic-ui-non-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +323 -349
- package/dist/css/dynamic-ui.min.css +1 -1
- package/dist/index.esm.js +206 -124
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +206 -123
- package/dist/index.js.map +1 -1
- package/dist/types/components/DAlertBox/DAlertBox.d.ts +9 -0
- package/dist/types/components/DAlertBox/index.d.ts +2 -0
- package/dist/types/components/DBadge/DBadge.d.ts +2 -2
- package/dist/types/components/DBoxFile/DBoxFile.d.ts +2 -3
- package/dist/types/components/DButton/DButton.d.ts +7 -5
- package/dist/types/components/DChip/DChip.d.ts +2 -1
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +7 -3
- package/dist/types/components/DDatePickerHeader/DDatePickerHeader.d.ts +5 -3
- package/dist/types/components/DDatePickerInput/DDatePickerInput.d.ts +1 -1
- package/dist/types/components/DIcon/DIcon.d.ts +2 -2
- package/dist/types/components/DInput/DInput.d.ts +3 -2
- package/dist/types/components/DInputCheck/DInputCheck.d.ts +5 -4
- package/dist/types/components/DInputCounter/DInputCounter.d.ts +3 -2
- package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +3 -2
- package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +3 -2
- package/dist/types/components/DInputPin/DInputPin.d.ts +7 -7
- package/dist/types/components/DInputSearch/DInputSearch.d.ts +3 -2
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +7 -6
- package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +5 -4
- package/dist/types/components/DList/DList.d.ts +4 -4
- package/dist/types/components/DList/components/DListItem.d.ts +3 -3
- package/dist/types/components/DModal/DModal.d.ts +5 -5
- package/dist/types/components/DMonthPicker/DMonthPicker.d.ts +3 -1
- package/dist/types/components/DOffcanvas/DOffcanvas.d.ts +3 -3
- package/dist/types/components/DPopover/DPopover.d.ts +4 -4
- package/dist/types/components/DQuickActionButton/DQuickActionButton.d.ts +2 -1
- 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 +3 -3
- package/dist/types/components/DStepper/DStepper.d.ts +2 -2
- package/dist/types/components/DStepperDesktop/DStepperDesktop.d.ts +2 -2
- package/dist/types/components/DTabs/DTabs.d.ts +3 -3
- package/dist/types/components/{DAlert/DAlert.d.ts → DToast/DToast.d.ts} +3 -3
- package/dist/types/components/DToast/index.d.ts +2 -0
- package/dist/types/components/DToastContainer/useToast.d.ts +2 -2
- package/dist/types/components/DTooltip/DTooltip.d.ts +2 -2
- package/dist/types/components/banking/DPermissionGroup.d.ts +1 -1
- package/dist/types/components/config.d.ts +2 -2
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/interface.d.ts +8 -3
- package/package.json +7 -2
- package/src/style/abstracts/_maps.scss +6 -0
- package/src/style/abstracts/_mixins.scss +53 -42
- package/src/style/abstracts/variables/_alerts.scss +1 -0
- package/src/style/abstracts/variables/_buttons.scss +7 -13
- package/src/style/abstracts/variables/_colors.scss +1 -1
- package/src/style/components/_+import.scss +1 -1
- package/src/style/components/_d-button.scss +12 -41
- package/src/style/components/_d-chip.scss +1 -1
- package/src/style/components/_d-datepicker.scss +9 -0
- package/src/style/components/_d-input-pin.scss +2 -6
- package/src/style/components/_d-input-select.scss +8 -1
- package/src/style/components/{_d-alert.scss → _d-toast.scss} +21 -1
- package/dist/types/components/DAlert/index.d.ts +0 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useMemo, useState, useEffect, useCallback, createContext, useContext, forwardRef,
|
|
2
|
+
import React, { useMemo, useState, useEffect, useCallback, createContext, useContext, forwardRef, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
5
|
import { useDropzone } from 'react-dropzone';
|
|
@@ -15,34 +15,34 @@ import i18n from 'i18next';
|
|
|
15
15
|
import { initReactI18next } from 'react-i18next';
|
|
16
16
|
import { createPortal } from 'react-dom';
|
|
17
17
|
|
|
18
|
-
function DBadge({ text,
|
|
18
|
+
function DBadge({ text, dot = false, theme = 'primary', id, className, style, }) {
|
|
19
19
|
const generateClasses = useMemo(() => ({
|
|
20
20
|
badge: true,
|
|
21
|
-
'badge-dot':
|
|
21
|
+
'badge-dot': dot,
|
|
22
22
|
[`badge-${theme}`]: !!theme,
|
|
23
|
-
}), [
|
|
23
|
+
}), [dot, theme]);
|
|
24
24
|
return (jsx("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, { children: jsx("span", { children: text }) })));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function DInputSwitch({ label, id, name,
|
|
28
|
-
const [internalIsChecked, setInternalIsChecked] = useState(
|
|
27
|
+
function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly, className, style, onChange, }) {
|
|
28
|
+
const [internalIsChecked, setInternalIsChecked] = useState(checked);
|
|
29
29
|
useEffect(() => {
|
|
30
|
-
setInternalIsChecked(
|
|
31
|
-
}, [
|
|
30
|
+
setInternalIsChecked(checked);
|
|
31
|
+
}, [checked]);
|
|
32
32
|
const changeHandler = useCallback((event) => {
|
|
33
33
|
const value = event.currentTarget.checked;
|
|
34
34
|
setInternalIsChecked(value);
|
|
35
35
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
36
36
|
}, [onChange]);
|
|
37
|
-
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange:
|
|
37
|
+
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function DPermissionItem({ permission, permissionState, onChange, onAction = () => { }, }) {
|
|
41
|
-
return (jsxs("div", { role: "button", tabIndex: 0, onKeyDown: () => { }, className: "d-flex permission-item align-items-center", onClick: onAction, children: [jsx("span", { className: "flex-grow-1 label", children: permission.label }), permission.type === 'custom' && (jsx(DBadge, { theme: "tertiary", text: permissionState })), jsx(DInputSwitch, { id: permission.id,
|
|
41
|
+
return (jsxs("div", { role: "button", tabIndex: 0, onKeyDown: () => { }, className: "d-flex permission-item align-items-center", onClick: onAction, children: [jsx("span", { className: "flex-grow-1 label", children: permission.label }), permission.type === 'custom' && (jsx(DBadge, { theme: "tertiary", text: permissionState })), jsx(DInputSwitch, { id: permission.id, checked: !!permission.value, disabled: !permission.enabled, onChange: (isChecked) => onChange(isChecked) })] }));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function DPermissionGroup({ title, description, permissionState, permissionList, onChangePermission, onCustomAction = () => { }, }) {
|
|
45
|
-
return (jsxs("div", { className: "row operation-group g-0 mb-3 mb-lg-0", children: [jsxs("div", { className: "col-12 col-lg-4 d-flex flex-column justify-content-center", children: [jsx("h6", { className: "fw-bold mb-3 mb-lg-2", children: title }), jsx("p", { className: "fs-8 d-none d-lg-block m-0", children: description })] }), jsx("div", { className: "col-12 offset-lg-1 col-lg-7", children: permissionList.map((permission) => (jsx(DPermissionItem, { permission: permission, permissionState: permissionState, onChange: (
|
|
45
|
+
return (jsxs("div", { className: "row operation-group g-0 mb-3 mb-lg-0", children: [jsxs("div", { className: "col-12 col-lg-4 d-flex flex-column justify-content-center", children: [jsx("h6", { className: "fw-bold mb-3 mb-lg-2", children: title }), jsx("p", { className: "fs-8 d-none d-lg-block m-0", children: description })] }), jsx("div", { className: "col-12 offset-lg-1 col-lg-7", children: permissionList.map((permission) => (jsx(DPermissionItem, { permission: permission, permissionState: permissionState, onChange: (checked) => onChangePermission(permission, checked), onAction: () => onCustomAction(permission) }, permission.id))) })] }));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const PREFIX_BS = 'bs-';
|
|
@@ -51,11 +51,11 @@ const ALERT_TYPE_ICON = {
|
|
|
51
51
|
danger: 'exclamation-triangle',
|
|
52
52
|
success: 'check-circle',
|
|
53
53
|
info: 'info-circle',
|
|
54
|
-
light: 'info-circle',
|
|
55
54
|
dark: 'info-circle',
|
|
55
|
+
light: 'info-circle',
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
function DIcon({ icon, theme, style, className, size = '1.5rem',
|
|
58
|
+
function DIcon({ icon, theme, style, className, size = '1.5rem', loading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-component-size) * 1)`, color, backgroundColor, familyClass = 'bi', familyPrefix = 'bi-', }) {
|
|
59
59
|
const colorStyle = useMemo(() => {
|
|
60
60
|
if (color) {
|
|
61
61
|
return { [`--${PREFIX_BS}component-color`]: color };
|
|
@@ -84,7 +84,7 @@ function DIcon({ icon, theme, style, className, size = '1.5rem', isLoading = fal
|
|
|
84
84
|
return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
|
|
85
85
|
}, [circleSize, hasCircle]);
|
|
86
86
|
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-size`]: size, [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, colorStyle), backgroundStyle), circleSizeStyle), style)), [size, loadingDuration, colorStyle, backgroundStyle, circleSizeStyle, style]);
|
|
87
|
-
const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true, [familyClass]: true, [`${familyPrefix}${icon}`]: true, 'd-icon-loading':
|
|
87
|
+
const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true, [familyClass]: true, [`${familyPrefix}${icon}`]: true, 'd-icon-loading': loading }, className && { [className]: true })), [familyClass, familyPrefix, icon, className, loading]);
|
|
88
88
|
return (jsx("i", { className: classNames(generateClasses), style: generateStyleVariables }));
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -92,36 +92,39 @@ function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
|
|
|
92
92
|
return (jsxs("div", { children: [jsx("h6", { className: "fw-bold fs-6", children: title }), jsx("p", { className: "fs-8", children: description }), jsxs("div", { className: "bg-white rounded p-4 d-flex gap-3 shadow-sm text-gray-700 fs-8", children: [jsx(DIcon, { icon: icon, theme: iconTheme, size: iconSize }), Summary] })] }));
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
function
|
|
95
|
+
function DToast({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = false, showClose, onClose, children, id, className, style, }) {
|
|
96
96
|
const generateClasses = useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [type, showClose, className]);
|
|
97
97
|
const getIcon = useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
|
|
98
|
-
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(
|
|
99
|
-
[`--${PREFIX_BS}alert-component-icon-color`]: `var(--${PREFIX_BS}secondary)`,
|
|
100
|
-
})), [style, type]);
|
|
98
|
+
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
|
|
101
99
|
return (jsxs("div", { className: classNames(generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsx(DIcon, Object.assign({ className: "alert-icon", icon: getIcon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix }))), jsx("div", { className: "alert-text", children: children }), showClose && (jsx("div", { className: "alert-separator" })), showClose && (jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { className: "alert-close-icon", icon: "x-lg", familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) }))] }));
|
|
102
100
|
}
|
|
103
101
|
|
|
102
|
+
function DAlertBox({ theme = 'box-secondary', icon = 'info-circle', iconFamilyClass, iconFamilyPrefix, children, id, className, style, }) {
|
|
103
|
+
const generateClasses = useMemo(() => (Object.assign({ 'alert alert-box': true, [`alert-${theme}`]: true }, className && { [className]: true })), [theme, className]);
|
|
104
|
+
return (jsxs("div", { className: classNames(generateClasses), style: style, role: "alert", id: id, children: [jsx(DIcon, Object.assign({ className: "alert-icon", icon: icon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix })), jsx("div", { className: "alert-text", children: children })] }));
|
|
105
|
+
}
|
|
106
|
+
|
|
104
107
|
function DBoxFile(_a) {
|
|
105
|
-
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix,
|
|
106
|
-
const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled
|
|
108
|
+
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, disabled = false, children, className, style } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "disabled", "children", "className", "style"]);
|
|
109
|
+
const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled }, dropzoneOptions));
|
|
107
110
|
return (jsxs("section", { className: classNames('d-box-file', {
|
|
108
111
|
'd-box-file-selected': !!acceptedFiles.length,
|
|
109
112
|
}, className), style: style, children: [jsxs("div", Object.assign({}, getRootProps({
|
|
110
113
|
className: classNames('d-box-file-dropzone', {
|
|
111
|
-
disabled
|
|
114
|
+
disabled,
|
|
112
115
|
}),
|
|
113
116
|
}), { children: [jsx("input", Object.assign({}, getInputProps())), jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] }));
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
function DButton({ theme = 'primary', size, variant, state, text = '', iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button',
|
|
119
|
+
function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', pill = false, loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, onClick, }) {
|
|
117
120
|
const generateClasses = useMemo(() => {
|
|
118
121
|
const variantClass = variant
|
|
119
122
|
? `btn-${variant}-${theme}`
|
|
120
123
|
: `btn-${theme}`;
|
|
121
|
-
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading
|
|
122
|
-
}, [variant, theme, size, state,
|
|
124
|
+
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
125
|
+
}, [variant, theme, size, state, loading]);
|
|
123
126
|
const generateStyleVariables = useMemo(() => {
|
|
124
|
-
if (
|
|
127
|
+
if (pill) {
|
|
125
128
|
return {
|
|
126
129
|
[`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
127
130
|
[`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
@@ -129,14 +132,18 @@ function DButton({ theme = 'primary', size, variant, state, text = '', iconStart
|
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
134
|
return {};
|
|
132
|
-
}, [
|
|
135
|
+
}, [pill]);
|
|
133
136
|
const clickHandler = useCallback((event) => {
|
|
134
|
-
if (
|
|
137
|
+
if (stopPropagationEnabled) {
|
|
135
138
|
event.stopPropagation();
|
|
136
139
|
}
|
|
137
140
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
138
|
-
}, [
|
|
139
|
-
|
|
141
|
+
}, [stopPropagationEnabled, onClick]);
|
|
142
|
+
const isDisabled = useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
143
|
+
const newAriaLabel = useMemo(() => (loading
|
|
144
|
+
? (loadingAriaLabel || ariaLabel || text)
|
|
145
|
+
: (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
|
|
146
|
+
return (jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel }, value && { value }, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (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 }))] })));
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
function DCardHeader({ className, style, children, }) {
|
|
@@ -186,12 +193,12 @@ var DCarousel$1 = Object.assign(DCarousel, {
|
|
|
186
193
|
Slide: DCarouselSlide,
|
|
187
194
|
});
|
|
188
195
|
|
|
189
|
-
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, className, style, onClose, }) {
|
|
196
|
+
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, closeAriaLabel = 'close', className, style, onClose, }) {
|
|
190
197
|
const generateClasses = useMemo(() => ({
|
|
191
198
|
'd-chip': true,
|
|
192
199
|
[`d-chip-${theme}`]: !!theme,
|
|
193
200
|
}), [theme]);
|
|
194
|
-
return (jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
201
|
+
return (jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
195
202
|
}
|
|
196
203
|
|
|
197
204
|
function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
|
|
@@ -501,7 +508,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
501
508
|
}
|
|
502
509
|
|
|
503
510
|
function DInput(_a, ref) {
|
|
504
|
-
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, hint, invalid = false, valid = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "hint", "invalid", "valid", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
511
|
+
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, hint, invalid = false, valid = false, floatingLabel = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "hint", "invalid", "valid", "floatingLabel", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
505
512
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
506
513
|
const handleOnChange = useCallback((event) => {
|
|
507
514
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
@@ -512,17 +519,50 @@ function DInput(_a, ref) {
|
|
|
512
519
|
const handleOnIconEndClick = useCallback(() => {
|
|
513
520
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
514
521
|
}, [onIconEndClick, value]);
|
|
522
|
+
const ariaDescribedby = useMemo(() => ([
|
|
523
|
+
iconStart && `${id}Start`,
|
|
524
|
+
hint && `${id}Hint`,
|
|
525
|
+
iconEnd && `${id}End`,
|
|
526
|
+
]
|
|
527
|
+
.filter(Boolean)
|
|
528
|
+
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
529
|
+
const inputComponent = useMemo(() => (jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
530
|
+
'is-invalid': invalid,
|
|
531
|
+
'is-valid': valid,
|
|
532
|
+
}), disabled: disabled || loading, readOnly: readOnly, value: value, onChange: handleOnChange }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
|
|
533
|
+
ariaDescribedby,
|
|
534
|
+
disabled,
|
|
535
|
+
handleOnChange,
|
|
536
|
+
id,
|
|
537
|
+
inputProps,
|
|
538
|
+
inputRef,
|
|
539
|
+
invalid,
|
|
540
|
+
loading,
|
|
541
|
+
readOnly,
|
|
542
|
+
valid,
|
|
543
|
+
value,
|
|
544
|
+
]);
|
|
545
|
+
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { className: "d-input-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
|
|
546
|
+
id,
|
|
547
|
+
label,
|
|
548
|
+
labelIcon,
|
|
549
|
+
labelIconFamilyClass,
|
|
550
|
+
labelIconFamilyPrefix,
|
|
551
|
+
]);
|
|
552
|
+
const dynamicComponent = useMemo(() => {
|
|
553
|
+
if (floatingLabel) {
|
|
554
|
+
return (jsxs("div", { className: "form-floating", children: [inputComponent, labelComponent] }));
|
|
555
|
+
}
|
|
556
|
+
return inputComponent;
|
|
557
|
+
}, [floatingLabel, inputComponent, labelComponent]);
|
|
515
558
|
return (jsxs("div", { className: classNames({
|
|
516
559
|
'd-input': true,
|
|
517
560
|
className: !!className,
|
|
518
|
-
}), style: style, children: [label &&
|
|
561
|
+
}), style: style, children: [label && !floatingLabel && (labelComponent), jsxs("div", { className: "d-input-control", children: [jsxs("div", { className: classNames({
|
|
519
562
|
'input-group': true,
|
|
520
563
|
'has-validation': invalid,
|
|
521
564
|
disabled: disabled || loading,
|
|
522
|
-
}), 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, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsx("input",
|
|
523
|
-
'is-invalid': invalid,
|
|
524
|
-
'is-valid': valid,
|
|
525
|
-
}), "aria-label": label, disabled: disabled || loading, readOnly: readOnly, "aria-describedby": `${id}Add ${id}Hint`, value: value, onChange: handleOnChange }, inputProps)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text d-input-icon", 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 }))] })] }));
|
|
565
|
+
}), 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, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', 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, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text d-input-icon", 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 }))] })] }));
|
|
526
566
|
}
|
|
527
567
|
const ForwardedDInput = forwardRef(DInput);
|
|
528
568
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -530,53 +570,55 @@ var DInput$1 = ForwardedDInput;
|
|
|
530
570
|
|
|
531
571
|
function DDatePickerTime(_a) {
|
|
532
572
|
var { value, onChange, id, label, className, style } = _a, props = __rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
|
|
533
|
-
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("
|
|
573
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({}, onChange && {
|
|
534
574
|
onChange,
|
|
535
575
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
536
576
|
}
|
|
537
577
|
|
|
538
578
|
function DDatePickerInput(_a, ref) {
|
|
539
579
|
var { value, onClick, id, iconEnd, className, style } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
|
|
540
|
-
|
|
541
|
-
return (jsx("div", { role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1, children: jsx(DInput$1, Object.assign({ readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)) }));
|
|
580
|
+
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)));
|
|
542
581
|
}
|
|
543
582
|
const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
544
583
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
545
584
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
546
585
|
|
|
547
586
|
function DMonthPicker(_a) {
|
|
548
|
-
var { onChangeDate, date, locale, className } = _a, props = __rest(_a, ["onChangeDate", "date", "locale", "className"]);
|
|
587
|
+
var { onChangeDate, date, locale, className, headerPrevYearAriaLabel = 'decrease year', headerNextYearAriaLabel = 'increase year' } = _a, props = __rest(_a, ["onChangeDate", "date", "locale", "className", "headerPrevYearAriaLabel", "headerNextYearAriaLabel"]);
|
|
549
588
|
const selected = useMemo(() => parseISO(date), [date]);
|
|
550
589
|
const dateFormatted = useMemo(() => (format(new Date(date), 'MMMM yyyy', { locale })), [date, locale]);
|
|
551
|
-
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: classNames('d-month-picker', className), onChange: onChangeDate }, locale && { locale }, { customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear,
|
|
590
|
+
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: classNames('d-month-picker', className), onChange: onChangeDate }, locale && { locale }, { customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: headerPrevYearAriaLabel }), jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsx(DButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: headerNextYearAriaLabel })] })) }, props)));
|
|
552
591
|
}
|
|
553
592
|
|
|
554
|
-
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector,
|
|
593
|
+
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, prevMonthIcon, nextMonthIcon, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
|
|
555
594
|
const onChangeDate = useCallback((value) => {
|
|
556
595
|
if (value) {
|
|
557
596
|
changeMonth(getMonth(value));
|
|
558
597
|
changeYear(getYear(value));
|
|
559
598
|
}
|
|
560
599
|
}, [changeMonth, changeYear]);
|
|
561
|
-
return (jsxs("div", { className: classNames('d-flex align-items-center justify-content-between d-datepicker-header', className), style: style, children: [jsx(DButton, { iconStart:
|
|
600
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center justify-content-between d-datepicker-header', className), style: style, children: [jsx(DButton, { iconStart: prevMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel }), jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), onChangeDate: onChangeDate }, locale && { locale })), jsx(DButton, { iconStart: nextMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel })] }));
|
|
562
601
|
}
|
|
563
602
|
|
|
564
603
|
function DDatePicker(_a) {
|
|
565
|
-
var { date, selectsRange = false, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel,
|
|
604
|
+
var { date, selectsRange = false, withMonthSelector, inputLabel, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, headerPrevMonthIcon = 'chevron-left', headerPrevMonthAriaLabel = 'decrease month', headerNextMonthIcon = 'chevron-right', headerNextMonthAriaLabel = 'increase month', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark', locale, className, style } = _a, props = __rest(_a, ["date", "selectsRange", "withMonthSelector", "inputLabel", "inputAriaLabel", "inputActionAriaLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerPrevMonthIcon", "headerPrevMonthAriaLabel", "headerNextMonthIcon", "headerNextMonthAriaLabel", "headerIconSize", "headerButtonVariant", "headerButtonTheme", "locale", "className", "style"]);
|
|
566
605
|
const selected = useMemo(() => (date ? parseISO(date) : null), [date]);
|
|
567
|
-
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, {
|
|
606
|
+
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { prevMonthIcon: headerPrevMonthIcon, nextMonthIcon: headerNextMonthIcon, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [
|
|
607
|
+
headerButtonTheme,
|
|
568
608
|
headerButtonVariant,
|
|
569
|
-
|
|
609
|
+
headerPrevMonthIcon,
|
|
610
|
+
headerPrevMonthAriaLabel,
|
|
570
611
|
headerIconSize,
|
|
571
|
-
|
|
612
|
+
headerNextMonthIcon,
|
|
613
|
+
headerNextMonthAriaLabel,
|
|
572
614
|
withMonthSelector,
|
|
573
615
|
locale,
|
|
574
616
|
]);
|
|
575
|
-
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsx(DDatePickerInput$1, { id: inputId, iconEnd: inputIcon, className: className, style: style })), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
|
|
617
|
+
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconEnd: inputIcon, className: className, style: style })), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
|
|
576
618
|
}
|
|
577
619
|
|
|
578
620
|
function DInputCounter(_a, ref) {
|
|
579
|
-
var { minValue, maxValue, value = minValue, invalid, iconStart = 'dash-square', iconEnd = 'plus-square', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "style", "onChange"]);
|
|
621
|
+
var { minValue, maxValue, value = minValue, invalid, iconStart = 'dash-square', iconEnd = 'plus-square', iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
|
|
580
622
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
581
623
|
const [internalIsInvalid, setInternalIsInvalid] = useState(false);
|
|
582
624
|
const [internalValue, setInternalValue] = useState(value);
|
|
@@ -600,7 +642,7 @@ function DInputCounter(_a, ref) {
|
|
|
600
642
|
useEffect(() => {
|
|
601
643
|
setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
|
|
602
644
|
}, [internalValue, minValue, maxValue]);
|
|
603
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: valueString, style: generateStyleVariables, iconStart: iconStart, iconEnd: iconEnd, invalid: internalIsInvalid || invalid, type: "number", onChange: handleOnChange, onIconStartClick: handleOnIconStartClick, onIconEndClick: handleOnIconEndClick }, props)));
|
|
645
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: valueString, style: generateStyleVariables, iconStart: iconStart, iconEnd: iconEnd, invalid: internalIsInvalid || invalid, type: "number", onChange: handleOnChange, onIconStartClick: handleOnIconStartClick, onIconEndClick: handleOnIconEndClick, iconStartAriaLabel: iconStartAriaLabel, iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
604
646
|
}
|
|
605
647
|
const ForwardedDInputCounter = forwardRef(DInputCounter);
|
|
606
648
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
@@ -694,50 +736,50 @@ ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
|
|
|
694
736
|
var DInputCurrency$1 = ForwardedDInputCurrencyBase;
|
|
695
737
|
|
|
696
738
|
function DInputSearch(_a, ref) {
|
|
697
|
-
var { onClick, type } = _a, props = __rest(_a, ["onClick", "type"]);
|
|
739
|
+
var { onClick, type, iconEndAriaLabel = 'search' } = _a, props = __rest(_a, ["onClick", "type", "iconEndAriaLabel"]);
|
|
698
740
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
699
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", onIconEndClick: onClick }, props)));
|
|
741
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel, onIconEndClick: onClick }, props)));
|
|
700
742
|
}
|
|
701
743
|
const ForwardedDInputSearch = forwardRef(DInputSearch);
|
|
702
744
|
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
703
745
|
var DInputSearch$1 = ForwardedDInputSearch;
|
|
704
746
|
|
|
705
747
|
function DInputPassword(_a, ref) {
|
|
706
|
-
var { onIconEndClick } = _a, props = __rest(_a, ["onIconEndClick"]);
|
|
748
|
+
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = __rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
707
749
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
708
750
|
const [visible, setVisible] = useState(false);
|
|
709
751
|
const handleOnIconEndClick = useCallback(() => {
|
|
710
752
|
setVisible((prevVisible) => !prevVisible);
|
|
711
753
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick();
|
|
712
754
|
}, [onIconEndClick]);
|
|
713
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick }, props)));
|
|
755
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick, iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
714
756
|
}
|
|
715
757
|
const ForwardedDInputPassword = forwardRef(DInputPassword);
|
|
716
758
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
717
759
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
718
760
|
|
|
719
|
-
function DInputCheck({ type, name, label,
|
|
761
|
+
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
720
762
|
const innerRef = useRef(null);
|
|
721
763
|
const handleChange = useCallback((event) => {
|
|
722
764
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
723
765
|
}, [onChange]);
|
|
724
766
|
useEffect(() => {
|
|
725
767
|
if (innerRef.current) {
|
|
726
|
-
innerRef.current.indeterminate = Boolean(
|
|
768
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
727
769
|
}
|
|
728
|
-
}, [
|
|
770
|
+
}, [indeterminate]);
|
|
729
771
|
useEffect(() => {
|
|
730
772
|
if (innerRef.current) {
|
|
731
|
-
innerRef.current.checked =
|
|
773
|
+
innerRef.current.checked = checked;
|
|
732
774
|
}
|
|
733
|
-
}, [
|
|
775
|
+
}, [checked]);
|
|
734
776
|
if (!label) {
|
|
735
|
-
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled:
|
|
777
|
+
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
|
|
736
778
|
}
|
|
737
|
-
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled:
|
|
779
|
+
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
738
780
|
}
|
|
739
781
|
|
|
740
|
-
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder
|
|
782
|
+
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
|
|
741
783
|
const [pattern, setPattern] = useState('');
|
|
742
784
|
useEffect(() => {
|
|
743
785
|
setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
|
|
@@ -788,12 +830,12 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
788
830
|
}, []);
|
|
789
831
|
return (jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { className: "d-input-pin-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("form", { id: id, className: "d-input-pin-controls", onInput: formChange, onSubmit: preventDefaultEvent, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
|
|
790
832
|
'form-control': true,
|
|
791
|
-
'is-invalid':
|
|
792
|
-
'is-valid':
|
|
793
|
-
}), type:
|
|
833
|
+
'is-invalid': invalid,
|
|
834
|
+
'is-valid': valid,
|
|
835
|
+
}), type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onChange: nextInput, onKeyDown: prevInput, onFocus: focusInput, onWheel: wheelInput, onClick: preventDefaultEvent, autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (invalid || valid) && !loading && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-pin-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsx("div", { className: "input-group-text d-input-pin-icon", 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 }))] }));
|
|
794
836
|
}
|
|
795
837
|
|
|
796
|
-
function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix,
|
|
838
|
+
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, }) {
|
|
797
839
|
const internalValueExtractor = useCallback((option) => {
|
|
798
840
|
if (valueExtractor) {
|
|
799
841
|
return valueExtractor(option);
|
|
@@ -815,7 +857,9 @@ function DInputSelect({ id, name, label = '', className, style, options, labelIc
|
|
|
815
857
|
const changeHandler = useCallback((event) => {
|
|
816
858
|
const selected = options
|
|
817
859
|
.find((option) => internalValueExtractor(option).toString() === event.currentTarget.value);
|
|
818
|
-
|
|
860
|
+
if (selected) {
|
|
861
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selected);
|
|
862
|
+
}
|
|
819
863
|
}, [onChange, options, internalValueExtractor]);
|
|
820
864
|
const blurHandler = useCallback((event) => {
|
|
821
865
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
@@ -826,32 +870,70 @@ function DInputSelect({ id, name, label = '', className, style, options, labelIc
|
|
|
826
870
|
const iconEndClickHandler = useCallback((event) => {
|
|
827
871
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
828
872
|
}, [onIconEndClick]);
|
|
829
|
-
|
|
873
|
+
const ariaDescribedby = useMemo(() => ([
|
|
874
|
+
iconStart && `${id}Start`,
|
|
875
|
+
hint && `${id}Hint`,
|
|
876
|
+
iconEnd && `${id}End`,
|
|
877
|
+
]
|
|
878
|
+
.filter(Boolean)
|
|
879
|
+
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
880
|
+
const selectComponent = useMemo(() => (jsx("select", Object.assign({ id: id, name: name, className: classNames({
|
|
881
|
+
'form-select': true,
|
|
882
|
+
'floating-label': floatingLabel,
|
|
883
|
+
}), "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)))) }))), [
|
|
884
|
+
ariaDescribedby,
|
|
885
|
+
blurHandler,
|
|
886
|
+
changeHandler,
|
|
887
|
+
disabled,
|
|
888
|
+
id,
|
|
889
|
+
internalLabelExtractor,
|
|
890
|
+
internalValueExtractor,
|
|
891
|
+
label,
|
|
892
|
+
loading,
|
|
893
|
+
name,
|
|
894
|
+
options,
|
|
895
|
+
value,
|
|
896
|
+
floatingLabel,
|
|
897
|
+
]);
|
|
898
|
+
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
|
|
899
|
+
id,
|
|
900
|
+
label,
|
|
901
|
+
labelIcon,
|
|
902
|
+
labelIconFamilyClass,
|
|
903
|
+
labelIconFamilyPrefix,
|
|
904
|
+
]);
|
|
905
|
+
const dynamicComponent = useMemo(() => {
|
|
906
|
+
if (floatingLabel) {
|
|
907
|
+
return (jsxs("div", { className: "form-floating", children: [selectComponent, labelComponent] }));
|
|
908
|
+
}
|
|
909
|
+
return selectComponent;
|
|
910
|
+
}, [floatingLabel, labelComponent, selectComponent]);
|
|
911
|
+
return (jsxs("div", { className: classNames('d-input', className), style: style, children: [label && !floatingLabel && (labelComponent), jsxs("div", { className: "d-input-control", children: [jsxs("div", { className: classNames({
|
|
830
912
|
'input-group': true,
|
|
831
|
-
disabled:
|
|
832
|
-
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled:
|
|
913
|
+
disabled: disabled || loading,
|
|
914
|
+
}), 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, { className: "d-input-icon", 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, { className: "d-input-icon", 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 }))] })] }));
|
|
833
915
|
}
|
|
834
916
|
|
|
835
|
-
function DListItem({ children, className, style,
|
|
917
|
+
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
836
918
|
const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
837
919
|
return (jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
838
920
|
onClick,
|
|
839
921
|
type: 'button',
|
|
840
922
|
}, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
841
|
-
active
|
|
842
|
-
disabled
|
|
843
|
-
}), style: style },
|
|
923
|
+
active,
|
|
924
|
+
disabled,
|
|
925
|
+
}), style: style }, active && { 'aria-current': true }, { children: children })));
|
|
844
926
|
}
|
|
845
927
|
|
|
846
|
-
function DList({ children, className, style,
|
|
847
|
-
if (
|
|
928
|
+
function DList({ children, className, style, flush = false, numbered = false, horizontal = false, horizontalBreakpoint, }) {
|
|
929
|
+
if (flush && horizontal) {
|
|
848
930
|
throw new Error("Horizontal and Flush props don't work together");
|
|
849
931
|
}
|
|
850
932
|
return (jsx("div", { className: classNames('list-group', {
|
|
851
|
-
'list-group-flush':
|
|
852
|
-
'list-group-numbered':
|
|
853
|
-
'list-group-horizontal':
|
|
854
|
-
}, (
|
|
933
|
+
'list-group-flush': flush && !horizontal,
|
|
934
|
+
'list-group-numbered': numbered,
|
|
935
|
+
'list-group-horizontal': horizontal && !horizontalBreakpoint,
|
|
936
|
+
}, (horizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style, children: children }));
|
|
855
937
|
}
|
|
856
938
|
var DList$1 = Object.assign(DList, {
|
|
857
939
|
Item: DListItem,
|
|
@@ -888,19 +970,19 @@ function DModalFooter({ className, style, actionPlacement = 'fill', children, })
|
|
|
888
970
|
return (jsxs(Fragment, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: classNames(`d-modal-slot modal-footer d-modal-action-${actionPlacement}`, className), style: style, children: children })] }));
|
|
889
971
|
}
|
|
890
972
|
|
|
891
|
-
function DModal({ name, className, style,
|
|
973
|
+
function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, modalSize, children, }) {
|
|
892
974
|
const fullScreenClass = useMemo(() => {
|
|
893
|
-
if (
|
|
975
|
+
if (fullScreen) {
|
|
894
976
|
if (fullScreenFrom) {
|
|
895
977
|
return `modal-fullscreen-${fullScreenFrom}-down`;
|
|
896
978
|
}
|
|
897
979
|
return 'modal-fullscreen';
|
|
898
980
|
}
|
|
899
981
|
return '';
|
|
900
|
-
}, [fullScreenFrom,
|
|
982
|
+
}, [fullScreenFrom, fullScreen]);
|
|
901
983
|
const generateClasses = useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
|
|
902
|
-
const generateModalDialogClasses = useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!
|
|
903
|
-
return (jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style },
|
|
984
|
+
const generateModalDialogClasses = useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!centered, 'modal-dialog-scrollable': !!scrollable, [fullScreenClass]: !!fullScreen }, modalSize && { [`modal-${modalSize}`]: true })), [fullScreenClass, centered, fullScreen, scrollable, modalSize]);
|
|
985
|
+
return (jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
|
|
904
986
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
905
987
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
906
988
|
}), { children: jsx("div", { className: classNames(generateModalDialogClasses), children: jsx("div", { className: "modal-content", children: children }) }) })));
|
|
@@ -923,13 +1005,13 @@ function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className,
|
|
|
923
1005
|
return (jsx("div", { className: classNames(`d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, className), style: style, children: children }));
|
|
924
1006
|
}
|
|
925
1007
|
|
|
926
|
-
function DOffcanvas({ name, className, style,
|
|
1008
|
+
function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', children, }) {
|
|
927
1009
|
return (jsx("div", Object.assign({ className: classNames('offcanvas show', {
|
|
928
1010
|
[`offcanvas-${openFrom}`]: openFrom,
|
|
929
|
-
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" },
|
|
1011
|
+
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, staticBackdrop && ({
|
|
930
1012
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
931
1013
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
932
|
-
}),
|
|
1014
|
+
}), scrollable && ({
|
|
933
1015
|
[`data-${PREFIX_BS}scroll`]: 'true',
|
|
934
1016
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
935
1017
|
}), { children: children })));
|
|
@@ -945,19 +1027,19 @@ function DPaginator(_a) {
|
|
|
945
1027
|
return (jsx(ResponsivePagination, Object.assign({ extraClassName: classNames('pagination', className), nextClassName: classNames('arrow arrow-next', !nextLabel && 'no-label'), nextLabel: nextLabel, previousClassName: classNames('arrow arrow-prev', !previousLabel && 'no-label'), previousLabel: previousLabel, renderNav: showArrows, current: page, onPageChange: onPageChange }, props)));
|
|
946
1028
|
}
|
|
947
1029
|
|
|
948
|
-
function DPopover({ children, renderComponent,
|
|
949
|
-
const [
|
|
1030
|
+
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, }) {
|
|
1031
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
950
1032
|
useEffect(() => {
|
|
951
|
-
|
|
952
|
-
}, [
|
|
1033
|
+
setIsOpen(open);
|
|
1034
|
+
}, [open]);
|
|
953
1035
|
const onOpenChange = useCallback((value) => {
|
|
954
|
-
|
|
955
|
-
if (
|
|
956
|
-
|
|
1036
|
+
setIsOpen(value);
|
|
1037
|
+
if (setOpen) {
|
|
1038
|
+
setOpen(value);
|
|
957
1039
|
}
|
|
958
|
-
}, [
|
|
1040
|
+
}, [setOpen]);
|
|
959
1041
|
const { refs, floatingStyles, context, } = useFloating({
|
|
960
|
-
open:
|
|
1042
|
+
open: isOpen,
|
|
961
1043
|
onOpenChange,
|
|
962
1044
|
middleware: [
|
|
963
1045
|
offset(0),
|
|
@@ -978,7 +1060,7 @@ function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustCon
|
|
|
978
1060
|
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), adjustContentToRender && {
|
|
979
1061
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
980
1062
|
})), [style, adjustContentToRender]);
|
|
981
|
-
return (jsxs("div", { className: classNames('d-popover', className), style: generateStyleVariables, children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(
|
|
1063
|
+
return (jsxs("div", { className: classNames('d-popover', className), style: generateStyleVariables, children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(isOpen) })), isOpen && (jsx(FloatingFocusManager, { context: context, modal: false, children: jsx("div", Object.assign({ className: classNames('d-popover-content', {
|
|
982
1064
|
'w-100': adjustContentToRender,
|
|
983
1065
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] }));
|
|
984
1066
|
}
|
|
@@ -992,7 +1074,7 @@ function DProgress({ className, style, currentValue, minValue = 0, maxValue = 10
|
|
|
992
1074
|
return (jsx("div", { className: "progress", children: jsx("div", { className: classNames(generateClasses, className), role: "progressbar", "aria-label": "Progress bar", style: Object.assign({ width: `${currentValue}%` }, style), "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) }));
|
|
993
1075
|
}
|
|
994
1076
|
|
|
995
|
-
function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
|
|
1077
|
+
function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, secondaryActionAriaLabel, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
|
|
996
1078
|
const globalClickHandler = useCallback(() => {
|
|
997
1079
|
if (actionLinkText) {
|
|
998
1080
|
return;
|
|
@@ -1011,18 +1093,18 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
|
|
|
1011
1093
|
const Tag = useMemo(() => (actionLinkText ? 'div' : 'button'), [actionLinkText]);
|
|
1012
1094
|
return (jsxs(Tag, { className: classNames('d-quick-action-button', className), onClick: !actionLinkText ? globalClickHandler : undefined, style: style, children: [representativeIcon && (jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
|
|
1013
1095
|
? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
|
|
1014
|
-
: `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, iconStartFamilyClass: actionIconFamilyClass, iconStartFamilyPrefix: actionIconFamilyPrefix, theme: actionLinkTheme, onClick: secondaryActionLinkClickHandler,
|
|
1096
|
+
: `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 }))] }));
|
|
1015
1097
|
}
|
|
1016
1098
|
|
|
1017
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style,
|
|
1099
|
+
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1018
1100
|
const changeHandler = useCallback((event) => {
|
|
1019
1101
|
event.stopPropagation();
|
|
1020
1102
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1021
1103
|
}, [onChange]);
|
|
1022
|
-
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,
|
|
1104
|
+
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 })] }));
|
|
1023
1105
|
}
|
|
1024
1106
|
|
|
1025
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, style,
|
|
1107
|
+
function DQuickActionSelect({ id, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1026
1108
|
const innerRef = useRef(null);
|
|
1027
1109
|
const changeHandler = useCallback((event) => {
|
|
1028
1110
|
event.stopPropagation();
|
|
@@ -1030,18 +1112,18 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, style, i
|
|
|
1030
1112
|
}, [onChange]);
|
|
1031
1113
|
useEffect(() => {
|
|
1032
1114
|
if (innerRef.current) {
|
|
1033
|
-
innerRef.current.checked =
|
|
1115
|
+
innerRef.current.checked = selected;
|
|
1034
1116
|
}
|
|
1035
|
-
}, [
|
|
1117
|
+
}, [selected]);
|
|
1036
1118
|
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 })] }));
|
|
1037
1119
|
}
|
|
1038
1120
|
|
|
1039
|
-
function DQuickActionSwitch({ id, name, label, hint,
|
|
1121
|
+
function DQuickActionSwitch({ id, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1040
1122
|
const clickHandler = useCallback((event) => {
|
|
1041
1123
|
event.stopPropagation();
|
|
1042
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(
|
|
1043
|
-
}, [
|
|
1044
|
-
return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxs("div", { className: "d-quick-action-switch-content", children: [jsx(DInputSwitch, { id: id, name: name,
|
|
1124
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
1125
|
+
}, [checked, onClick]);
|
|
1126
|
+
return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxs("div", { className: "d-quick-action-switch-content", children: [jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true }), jsx("label", { className: "d-quick-action-switch-label", htmlFor: id, children: label })] }), jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
|
|
1045
1127
|
}
|
|
1046
1128
|
|
|
1047
1129
|
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
@@ -1062,13 +1144,13 @@ function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, child
|
|
|
1062
1144
|
return (jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1063
1145
|
}
|
|
1064
1146
|
|
|
1065
|
-
function DStepper$2({ options, currentStep, successIcon = 'check',
|
|
1147
|
+
function DStepper$2({ options, currentStep, successIcon = 'check', vertical = false, className, style, }) {
|
|
1066
1148
|
if (currentStep < 1 || currentStep > options.length) {
|
|
1067
1149
|
throw new Error('Current step should be in the range from 1 to options length');
|
|
1068
1150
|
}
|
|
1069
1151
|
return (jsx("div", { className: classNames({
|
|
1070
1152
|
'd-stepper-desktop': true,
|
|
1071
|
-
'is-vertical':
|
|
1153
|
+
'is-vertical': vertical,
|
|
1072
1154
|
}, 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({
|
|
1073
1155
|
'd-step-icon-container': true,
|
|
1074
1156
|
'd-step-check': value < currentStep,
|
|
@@ -1108,8 +1190,8 @@ function DStepper$1({ options, currentStep, className, style, }) {
|
|
|
1108
1190
|
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, { children: [jsx("div", { className: "d-step-label", children: currentOption.label }), jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
|
|
1109
1191
|
}
|
|
1110
1192
|
|
|
1111
|
-
function DStepper({ options, currentStep, successIcon = 'check',
|
|
1112
|
-
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, successIcon: successIcon,
|
|
1193
|
+
function DStepper({ options, currentStep, successIcon = 'check', vertical = false, breakpoint = 'lg', className, style, }) {
|
|
1194
|
+
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, successIcon: successIcon, vertical: vertical }) })] }));
|
|
1113
1195
|
}
|
|
1114
1196
|
|
|
1115
1197
|
const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
@@ -1120,8 +1202,8 @@ const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
|
1120
1202
|
const ARROW_WIDTH = 8;
|
|
1121
1203
|
const ARROW_HEIGHT = 4;
|
|
1122
1204
|
const GAP = 2;
|
|
1123
|
-
function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true,
|
|
1124
|
-
const [
|
|
1205
|
+
function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
|
|
1206
|
+
const [isOpen, setIsOpen] = useState(open);
|
|
1125
1207
|
const styleVariables = useMemo(() => {
|
|
1126
1208
|
const defaultFontSize = size
|
|
1127
1209
|
? TOOLTIP_FONT_SIZE_BY_SIZE[size]
|
|
@@ -1130,8 +1212,8 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
|
|
|
1130
1212
|
}, [size, style]);
|
|
1131
1213
|
const arrowRef = useRef(null);
|
|
1132
1214
|
const { refs, context, floatingStyles, } = useFloating({
|
|
1133
|
-
open,
|
|
1134
|
-
onOpenChange:
|
|
1215
|
+
open: isOpen,
|
|
1216
|
+
onOpenChange: setIsOpen,
|
|
1135
1217
|
placement,
|
|
1136
1218
|
whileElementsMounted: autoUpdate,
|
|
1137
1219
|
middleware: [
|
|
@@ -1157,7 +1239,7 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
|
|
|
1157
1239
|
dismiss,
|
|
1158
1240
|
role,
|
|
1159
1241
|
]);
|
|
1160
|
-
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children:
|
|
1242
|
+
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children: isOpen && (jsxs("div", Object.assign({ className: classNameContainer, ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), styleVariables) }, getFloatingProps(), { children: [jsx(FloatingArrow, { ref: arrowRef, context: context, style: {
|
|
1161
1243
|
fill: styleVariables.background,
|
|
1162
1244
|
}, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
|
|
1163
1245
|
}
|
|
@@ -1179,7 +1261,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1179
1261
|
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 }));
|
|
1180
1262
|
}
|
|
1181
1263
|
|
|
1182
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
1264
|
+
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, }) {
|
|
1183
1265
|
const [selected, setSelected] = useState(defaultSelected);
|
|
1184
1266
|
const onSelect = useCallback((option) => {
|
|
1185
1267
|
if (option.tab) {
|
|
@@ -1196,10 +1278,10 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1196
1278
|
}), [isSelected]);
|
|
1197
1279
|
return (jsx(TabContext.Provider, { value: value, children: jsxs("div", { className: classNames({
|
|
1198
1280
|
'd-tabs': true,
|
|
1199
|
-
'd-tabs-vertical':
|
|
1281
|
+
'd-tabs-vertical': vertical,
|
|
1200
1282
|
}, className), style: style, children: [jsx("nav", { className: "nav", children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1201
1283
|
active: option.tab === selected,
|
|
1202
|
-
}, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.
|
|
1284
|
+
}, className), 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", children: children })] }) }));
|
|
1203
1285
|
}
|
|
1204
1286
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1205
1287
|
Tab: DTabContent,
|
|
@@ -1211,7 +1293,7 @@ function DToastContainer({ style, position = 'top-right', className, }) {
|
|
|
1211
1293
|
|
|
1212
1294
|
function useToast() {
|
|
1213
1295
|
const toast$1 = useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
|
|
1214
|
-
toast(({ closeToast }) => (jsx(
|
|
1296
|
+
toast(({ closeToast }) => (jsx(DToast, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
|
|
1215
1297
|
transition: Slide,
|
|
1216
1298
|
position,
|
|
1217
1299
|
autoClose,
|
|
@@ -1236,5 +1318,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1236
1318
|
.then((t) => t);
|
|
1237
1319
|
}
|
|
1238
1320
|
|
|
1239
|
-
export {
|
|
1321
|
+
export { DAlertBox, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DListItemMovement, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPermissionGroup, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DSummaryCard, DTabContent, DTabs$1 as DTabs, DToast, DToastContainer, DTooltip, ModalContext, ModalContextProvider, OffcanvasContext, OffcanvasContextProvider, configureI8n as configureI18n, formatCurrency, useDContext, useFormatCurrency, useInputCurrency, useModalContext, useOffcanvasContext, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
|
|
1240
1322
|
//# sourceMappingURL=index.esm.js.map
|