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