@dynamic-framework/ui-react 1.9.1 → 1.10.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 +315 -345
- package/dist/css/dynamic-ui-non-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +315 -345
- package/dist/css/dynamic-ui.min.css +1 -1
- package/dist/index.esm.js +141 -120
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +141 -119
- 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 -2
- 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/DInputCheck/DInputCheck.d.ts +5 -4
- package/dist/types/components/DInputPin/DInputPin.d.ts +7 -7
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +3 -3
- 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-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,9 @@ const ALERT_TYPE_ICON = {
|
|
|
53
53
|
danger: 'exclamation-triangle',
|
|
54
54
|
success: 'check-circle',
|
|
55
55
|
info: 'info-circle',
|
|
56
|
-
light: 'info-circle',
|
|
57
|
-
dark: 'info-circle',
|
|
58
56
|
};
|
|
59
57
|
|
|
60
|
-
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-', }) {
|
|
61
59
|
const colorStyle = React.useMemo(() => {
|
|
62
60
|
if (color) {
|
|
63
61
|
return { [`--${PREFIX_BS}component-color`]: color };
|
|
@@ -86,7 +84,7 @@ function DIcon({ icon, theme, style, className, size = '1.5rem', isLoading = fal
|
|
|
86
84
|
return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
|
|
87
85
|
}, [circleSize, hasCircle]);
|
|
88
86
|
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':
|
|
87
|
+
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
88
|
return (jsxRuntime.jsx("i", { className: classNames(generateClasses), style: generateStyleVariables }));
|
|
91
89
|
}
|
|
92
90
|
|
|
@@ -94,36 +92,39 @@ function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
|
|
|
94
92
|
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
93
|
}
|
|
96
94
|
|
|
97
|
-
function
|
|
95
|
+
function DToast({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = false, showClose, onClose, children, id, className, style, }) {
|
|
98
96
|
const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [type, showClose, className]);
|
|
99
97
|
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]);
|
|
98
|
+
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
|
|
103
99
|
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
100
|
}
|
|
105
101
|
|
|
102
|
+
function DAlertBox({ theme = 'box-secondary', icon = 'info-circle', iconFamilyClass, iconFamilyPrefix, children, id, className, style, }) {
|
|
103
|
+
const generateClasses = React.useMemo(() => (Object.assign({ 'alert alert-box': true, [`alert-${theme}`]: true }, className && { [className]: true })), [theme, className]);
|
|
104
|
+
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 })] }));
|
|
105
|
+
}
|
|
106
|
+
|
|
106
107
|
function DBoxFile(_a) {
|
|
107
|
-
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix,
|
|
108
|
-
const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled
|
|
108
|
+
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, disabled = false, children, className, style } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "disabled", "children", "className", "style"]);
|
|
109
|
+
const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled }, dropzoneOptions));
|
|
109
110
|
return (jsxRuntime.jsxs("section", { className: classNames('d-box-file', {
|
|
110
111
|
'd-box-file-selected': !!acceptedFiles.length,
|
|
111
112
|
}, className), style: style, children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
|
|
112
113
|
className: classNames('d-box-file-dropzone', {
|
|
113
|
-
disabled
|
|
114
|
+
disabled,
|
|
114
115
|
}),
|
|
115
116
|
}), { 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
117
|
}
|
|
117
118
|
|
|
118
|
-
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, }) {
|
|
119
120
|
const generateClasses = React.useMemo(() => {
|
|
120
121
|
const variantClass = variant
|
|
121
122
|
? `btn-${variant}-${theme}`
|
|
122
123
|
: `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,
|
|
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]);
|
|
125
126
|
const generateStyleVariables = React.useMemo(() => {
|
|
126
|
-
if (
|
|
127
|
+
if (pill) {
|
|
127
128
|
return {
|
|
128
129
|
[`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
129
130
|
[`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
@@ -131,14 +132,18 @@ function DButton({ theme = 'primary', size, variant, state, text = '', iconStart
|
|
|
131
132
|
};
|
|
132
133
|
}
|
|
133
134
|
return {};
|
|
134
|
-
}, [
|
|
135
|
+
}, [pill]);
|
|
135
136
|
const clickHandler = React.useCallback((event) => {
|
|
136
|
-
if (
|
|
137
|
+
if (stopPropagationEnabled) {
|
|
137
138
|
event.stopPropagation();
|
|
138
139
|
}
|
|
139
140
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
140
|
-
}, [
|
|
141
|
-
|
|
141
|
+
}, [stopPropagationEnabled, onClick]);
|
|
142
|
+
const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
143
|
+
const newAriaLabel = React.useMemo(() => (loading
|
|
144
|
+
? (loadingAriaLabel || ariaLabel || text)
|
|
145
|
+
: (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
|
|
146
|
+
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
147
|
}
|
|
143
148
|
|
|
144
149
|
function DCardHeader({ className, style, children, }) {
|
|
@@ -188,12 +193,12 @@ var DCarousel$1 = Object.assign(DCarousel, {
|
|
|
188
193
|
Slide: DCarouselSlide,
|
|
189
194
|
});
|
|
190
195
|
|
|
191
|
-
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, }) {
|
|
192
197
|
const generateClasses = React.useMemo(() => ({
|
|
193
198
|
'd-chip': true,
|
|
194
199
|
[`d-chip-${theme}`]: !!theme,
|
|
195
200
|
}), [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" }) }))] }));
|
|
201
|
+
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
202
|
}
|
|
198
203
|
|
|
199
204
|
function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
|
|
@@ -503,7 +508,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
503
508
|
}
|
|
504
509
|
|
|
505
510
|
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"]);
|
|
511
|
+
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, hint, invalid = false, valid = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "hint", "invalid", "valid", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
507
512
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
508
513
|
const handleOnChange = React.useCallback((event) => {
|
|
509
514
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
@@ -514,6 +519,13 @@ function DInput(_a, ref) {
|
|
|
514
519
|
const handleOnIconEndClick = React.useCallback(() => {
|
|
515
520
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
516
521
|
}, [onIconEndClick, value]);
|
|
522
|
+
const ariaDescribedby = React.useMemo(() => ([
|
|
523
|
+
iconStart && `${id}Start`,
|
|
524
|
+
hint && `${id}Hint`,
|
|
525
|
+
iconEnd && `${id}End`,
|
|
526
|
+
]
|
|
527
|
+
.filter(Boolean)
|
|
528
|
+
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
517
529
|
return (jsxRuntime.jsxs("div", { className: classNames({
|
|
518
530
|
'd-input': true,
|
|
519
531
|
className: !!className,
|
|
@@ -521,10 +533,10 @@ function DInput(_a, ref) {
|
|
|
521
533
|
'input-group': true,
|
|
522
534
|
'has-validation': invalid,
|
|
523
535
|
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", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
536
|
+
}), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
525
537
|
'is-invalid': invalid,
|
|
526
538
|
'is-valid': valid,
|
|
527
|
-
}),
|
|
539
|
+
}), disabled: disabled || loading, readOnly: readOnly, value: value, onChange: handleOnChange }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps)), ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-icon", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
|
|
528
540
|
}
|
|
529
541
|
const ForwardedDInput = React.forwardRef(DInput);
|
|
530
542
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -532,53 +544,55 @@ var DInput$1 = ForwardedDInput;
|
|
|
532
544
|
|
|
533
545
|
function DDatePickerTime(_a) {
|
|
534
546
|
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("
|
|
547
|
+
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
548
|
onChange,
|
|
537
549
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
538
550
|
}
|
|
539
551
|
|
|
540
552
|
function DDatePickerInput(_a, ref) {
|
|
541
553
|
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)) }));
|
|
554
|
+
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
555
|
}
|
|
545
556
|
const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
546
557
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
547
558
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
548
559
|
|
|
549
560
|
function DMonthPicker(_a) {
|
|
550
|
-
var { onChangeDate, date, locale, className } = _a, props = tslib.__rest(_a, ["onChangeDate", "date", "locale", "className"]);
|
|
561
|
+
var { onChangeDate, date, locale, className, headerPrevYearAriaLabel = 'decrease year', headerNextYearAriaLabel = 'increase year' } = _a, props = tslib.__rest(_a, ["onChangeDate", "date", "locale", "className", "headerPrevYearAriaLabel", "headerNextYearAriaLabel"]);
|
|
551
562
|
const selected = React.useMemo(() => dateFns.parseISO(date), [date]);
|
|
552
563
|
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,
|
|
564
|
+
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
565
|
}
|
|
555
566
|
|
|
556
|
-
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector,
|
|
567
|
+
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
568
|
const onChangeDate = React.useCallback((value) => {
|
|
558
569
|
if (value) {
|
|
559
570
|
changeMonth(dateFns.getMonth(value));
|
|
560
571
|
changeYear(dateFns.getYear(value));
|
|
561
572
|
}
|
|
562
573
|
}, [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:
|
|
574
|
+
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
575
|
}
|
|
565
576
|
|
|
566
577
|
function DDatePicker(_a) {
|
|
567
|
-
var { date, selectsRange = false, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel,
|
|
578
|
+
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
579
|
const selected = React.useMemo(() => (date ? dateFns.parseISO(date) : null), [date]);
|
|
569
|
-
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, {
|
|
580
|
+
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 }))), [
|
|
581
|
+
headerButtonTheme,
|
|
570
582
|
headerButtonVariant,
|
|
571
|
-
|
|
583
|
+
headerPrevMonthIcon,
|
|
584
|
+
headerPrevMonthAriaLabel,
|
|
572
585
|
headerIconSize,
|
|
573
|
-
|
|
586
|
+
headerNextMonthIcon,
|
|
587
|
+
headerNextMonthAriaLabel,
|
|
574
588
|
withMonthSelector,
|
|
575
589
|
locale,
|
|
576
590
|
]);
|
|
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)));
|
|
591
|
+
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
592
|
}
|
|
579
593
|
|
|
580
594
|
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"]);
|
|
595
|
+
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
596
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
583
597
|
const [internalIsInvalid, setInternalIsInvalid] = React.useState(false);
|
|
584
598
|
const [internalValue, setInternalValue] = React.useState(value);
|
|
@@ -602,7 +616,7 @@ function DInputCounter(_a, ref) {
|
|
|
602
616
|
React.useEffect(() => {
|
|
603
617
|
setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
|
|
604
618
|
}, [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)));
|
|
619
|
+
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
620
|
}
|
|
607
621
|
const ForwardedDInputCounter = React.forwardRef(DInputCounter);
|
|
608
622
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
@@ -696,50 +710,50 @@ ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
|
|
|
696
710
|
var DInputCurrency$1 = ForwardedDInputCurrencyBase;
|
|
697
711
|
|
|
698
712
|
function DInputSearch(_a, ref) {
|
|
699
|
-
var { onClick, type } = _a, props = tslib.__rest(_a, ["onClick", "type"]);
|
|
713
|
+
var { onClick, type, iconEndAriaLabel = 'search' } = _a, props = tslib.__rest(_a, ["onClick", "type", "iconEndAriaLabel"]);
|
|
700
714
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
701
|
-
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", onIconEndClick: onClick }, props)));
|
|
715
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel, onIconEndClick: onClick }, props)));
|
|
702
716
|
}
|
|
703
717
|
const ForwardedDInputSearch = React.forwardRef(DInputSearch);
|
|
704
718
|
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
705
719
|
var DInputSearch$1 = ForwardedDInputSearch;
|
|
706
720
|
|
|
707
721
|
function DInputPassword(_a, ref) {
|
|
708
|
-
var { onIconEndClick } = _a, props = tslib.__rest(_a, ["onIconEndClick"]);
|
|
722
|
+
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = tslib.__rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
709
723
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
710
724
|
const [visible, setVisible] = React.useState(false);
|
|
711
725
|
const handleOnIconEndClick = React.useCallback(() => {
|
|
712
726
|
setVisible((prevVisible) => !prevVisible);
|
|
713
727
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick();
|
|
714
728
|
}, [onIconEndClick]);
|
|
715
|
-
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick }, props)));
|
|
729
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick, iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
716
730
|
}
|
|
717
731
|
const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
718
732
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
719
733
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
720
734
|
|
|
721
|
-
function DInputCheck({ type, name, label,
|
|
735
|
+
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
722
736
|
const innerRef = React.useRef(null);
|
|
723
737
|
const handleChange = React.useCallback((event) => {
|
|
724
738
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
725
739
|
}, [onChange]);
|
|
726
740
|
React.useEffect(() => {
|
|
727
741
|
if (innerRef.current) {
|
|
728
|
-
innerRef.current.indeterminate = Boolean(
|
|
742
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
729
743
|
}
|
|
730
|
-
}, [
|
|
744
|
+
}, [indeterminate]);
|
|
731
745
|
React.useEffect(() => {
|
|
732
746
|
if (innerRef.current) {
|
|
733
|
-
innerRef.current.checked =
|
|
747
|
+
innerRef.current.checked = checked;
|
|
734
748
|
}
|
|
735
|
-
}, [
|
|
749
|
+
}, [checked]);
|
|
736
750
|
if (!label) {
|
|
737
|
-
return (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled:
|
|
751
|
+
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
752
|
}
|
|
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:
|
|
753
|
+
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
754
|
}
|
|
741
755
|
|
|
742
|
-
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder = '•', type = 'text',
|
|
756
|
+
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
757
|
const [pattern, setPattern] = React.useState('');
|
|
744
758
|
React.useEffect(() => {
|
|
745
759
|
setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
|
|
@@ -790,12 +804,12 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
790
804
|
}, []);
|
|
791
805
|
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
806
|
'form-control': true,
|
|
793
|
-
'is-invalid':
|
|
794
|
-
'is-valid':
|
|
795
|
-
}), type:
|
|
807
|
+
'is-invalid': invalid,
|
|
808
|
+
'is-valid': valid,
|
|
809
|
+
}), 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
810
|
}
|
|
797
811
|
|
|
798
|
-
function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix,
|
|
812
|
+
function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, selectedOption, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
799
813
|
const internalValueExtractor = React.useCallback((option) => {
|
|
800
814
|
if (valueExtractor) {
|
|
801
815
|
return valueExtractor(option);
|
|
@@ -828,32 +842,39 @@ function DInputSelect({ id, name, label = '', className, style, options, labelIc
|
|
|
828
842
|
const iconEndClickHandler = React.useCallback((event) => {
|
|
829
843
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
830
844
|
}, [onIconEndClick]);
|
|
845
|
+
const ariaDescribedby = React.useMemo(() => ([
|
|
846
|
+
iconStart && `${id}Start`,
|
|
847
|
+
hint && `${id}Hint`,
|
|
848
|
+
iconEnd && `${id}End`,
|
|
849
|
+
]
|
|
850
|
+
.filter(Boolean)
|
|
851
|
+
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
831
852
|
return (jsxRuntime.jsxs("div", { className: classNames('d-input', className), style: style, children: [label && (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 }))] })), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames({
|
|
832
853
|
'input-group': true,
|
|
833
|
-
disabled:
|
|
834
|
-
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled:
|
|
854
|
+
disabled: disabled || loading,
|
|
855
|
+
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("select", Object.assign({ id: id, name: name, className: "form-select", "aria-label": label, disabled: disabled || loading, onChange: changeHandler, onBlur: blurHandler }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, selectedOption && { value: internalValueExtractor(selectedOption) }, { children: options.map((option) => (jsxRuntime.jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) })), 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
856
|
}
|
|
836
857
|
|
|
837
|
-
function DListItem({ children, className, style,
|
|
858
|
+
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
838
859
|
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
839
860
|
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
840
861
|
onClick,
|
|
841
862
|
type: 'button',
|
|
842
863
|
}, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
843
|
-
active
|
|
844
|
-
disabled
|
|
845
|
-
}), style: style },
|
|
864
|
+
active,
|
|
865
|
+
disabled,
|
|
866
|
+
}), style: style }, active && { 'aria-current': true }, { children: children })));
|
|
846
867
|
}
|
|
847
868
|
|
|
848
|
-
function DList({ children, className, style,
|
|
849
|
-
if (
|
|
869
|
+
function DList({ children, className, style, flush = false, numbered = false, horizontal = false, horizontalBreakpoint, }) {
|
|
870
|
+
if (flush && horizontal) {
|
|
850
871
|
throw new Error("Horizontal and Flush props don't work together");
|
|
851
872
|
}
|
|
852
873
|
return (jsxRuntime.jsx("div", { className: classNames('list-group', {
|
|
853
|
-
'list-group-flush':
|
|
854
|
-
'list-group-numbered':
|
|
855
|
-
'list-group-horizontal':
|
|
856
|
-
}, (
|
|
874
|
+
'list-group-flush': flush && !horizontal,
|
|
875
|
+
'list-group-numbered': numbered,
|
|
876
|
+
'list-group-horizontal': horizontal && !horizontalBreakpoint,
|
|
877
|
+
}, (horizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style, children: children }));
|
|
857
878
|
}
|
|
858
879
|
var DList$1 = Object.assign(DList, {
|
|
859
880
|
Item: DListItem,
|
|
@@ -890,19 +911,19 @@ function DModalFooter({ className, style, actionPlacement = 'fill', children, })
|
|
|
890
911
|
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
912
|
}
|
|
892
913
|
|
|
893
|
-
function DModal({ name, className, style,
|
|
914
|
+
function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, modalSize, children, }) {
|
|
894
915
|
const fullScreenClass = React.useMemo(() => {
|
|
895
|
-
if (
|
|
916
|
+
if (fullScreen) {
|
|
896
917
|
if (fullScreenFrom) {
|
|
897
918
|
return `modal-fullscreen-${fullScreenFrom}-down`;
|
|
898
919
|
}
|
|
899
920
|
return 'modal-fullscreen';
|
|
900
921
|
}
|
|
901
922
|
return '';
|
|
902
|
-
}, [fullScreenFrom,
|
|
923
|
+
}, [fullScreenFrom, fullScreen]);
|
|
903
924
|
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 },
|
|
925
|
+
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]);
|
|
926
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
|
|
906
927
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
907
928
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
908
929
|
}), { children: jsxRuntime.jsx("div", { className: classNames(generateModalDialogClasses), children: jsxRuntime.jsx("div", { className: "modal-content", children: children }) }) })));
|
|
@@ -925,13 +946,13 @@ function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className,
|
|
|
925
946
|
return (jsxRuntime.jsx("div", { className: classNames(`d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, className), style: style, children: children }));
|
|
926
947
|
}
|
|
927
948
|
|
|
928
|
-
function DOffcanvas({ name, className, style,
|
|
949
|
+
function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', children, }) {
|
|
929
950
|
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('offcanvas show', {
|
|
930
951
|
[`offcanvas-${openFrom}`]: openFrom,
|
|
931
|
-
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" },
|
|
952
|
+
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, staticBackdrop && ({
|
|
932
953
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
933
954
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
934
|
-
}),
|
|
955
|
+
}), scrollable && ({
|
|
935
956
|
[`data-${PREFIX_BS}scroll`]: 'true',
|
|
936
957
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
937
958
|
}), { children: children })));
|
|
@@ -947,19 +968,19 @@ function DPaginator(_a) {
|
|
|
947
968
|
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
969
|
}
|
|
949
970
|
|
|
950
|
-
function DPopover({ children, renderComponent,
|
|
951
|
-
const [
|
|
971
|
+
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, }) {
|
|
972
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
952
973
|
React.useEffect(() => {
|
|
953
|
-
|
|
954
|
-
}, [
|
|
974
|
+
setIsOpen(open);
|
|
975
|
+
}, [open]);
|
|
955
976
|
const onOpenChange = React.useCallback((value) => {
|
|
956
|
-
|
|
957
|
-
if (
|
|
958
|
-
|
|
977
|
+
setIsOpen(value);
|
|
978
|
+
if (setOpen) {
|
|
979
|
+
setOpen(value);
|
|
959
980
|
}
|
|
960
|
-
}, [
|
|
981
|
+
}, [setOpen]);
|
|
961
982
|
const { refs, floatingStyles, context, } = react.useFloating({
|
|
962
|
-
open:
|
|
983
|
+
open: isOpen,
|
|
963
984
|
onOpenChange,
|
|
964
985
|
middleware: [
|
|
965
986
|
react.offset(0),
|
|
@@ -980,7 +1001,7 @@ function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustCon
|
|
|
980
1001
|
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), adjustContentToRender && {
|
|
981
1002
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
982
1003
|
})), [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(
|
|
1004
|
+
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
1005
|
'w-100': adjustContentToRender,
|
|
985
1006
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] }));
|
|
986
1007
|
}
|
|
@@ -994,7 +1015,7 @@ function DProgress({ className, style, currentValue, minValue = 0, maxValue = 10
|
|
|
994
1015
|
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
1016
|
}
|
|
996
1017
|
|
|
997
|
-
function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
|
|
1018
|
+
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
1019
|
const globalClickHandler = React.useCallback(() => {
|
|
999
1020
|
if (actionLinkText) {
|
|
1000
1021
|
return;
|
|
@@ -1013,18 +1034,18 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
|
|
|
1013
1034
|
const Tag = React.useMemo(() => (actionLinkText ? 'div' : 'button'), [actionLinkText]);
|
|
1014
1035
|
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
1036
|
? `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,
|
|
1037
|
+
: `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
1038
|
}
|
|
1018
1039
|
|
|
1019
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style,
|
|
1040
|
+
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1020
1041
|
const changeHandler = React.useCallback((event) => {
|
|
1021
1042
|
event.stopPropagation();
|
|
1022
1043
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1023
1044
|
}, [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,
|
|
1045
|
+
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
1046
|
}
|
|
1026
1047
|
|
|
1027
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, style,
|
|
1048
|
+
function DQuickActionSelect({ id, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1028
1049
|
const innerRef = React.useRef(null);
|
|
1029
1050
|
const changeHandler = React.useCallback((event) => {
|
|
1030
1051
|
event.stopPropagation();
|
|
@@ -1032,18 +1053,18 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, style, i
|
|
|
1032
1053
|
}, [onChange]);
|
|
1033
1054
|
React.useEffect(() => {
|
|
1034
1055
|
if (innerRef.current) {
|
|
1035
|
-
innerRef.current.checked =
|
|
1056
|
+
innerRef.current.checked = selected;
|
|
1036
1057
|
}
|
|
1037
|
-
}, [
|
|
1058
|
+
}, [selected]);
|
|
1038
1059
|
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
1060
|
}
|
|
1040
1061
|
|
|
1041
|
-
function DQuickActionSwitch({ id, name, label, hint,
|
|
1062
|
+
function DQuickActionSwitch({ id, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1042
1063
|
const clickHandler = React.useCallback((event) => {
|
|
1043
1064
|
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,
|
|
1065
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
1066
|
+
}, [checked, onClick]);
|
|
1067
|
+
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
1068
|
}
|
|
1048
1069
|
|
|
1049
1070
|
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
@@ -1064,13 +1085,13 @@ function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, child
|
|
|
1064
1085
|
return (jsxRuntime.jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1065
1086
|
}
|
|
1066
1087
|
|
|
1067
|
-
function DStepper$2({ options, currentStep, successIcon = 'check',
|
|
1088
|
+
function DStepper$2({ options, currentStep, successIcon = 'check', vertical = false, className, style, }) {
|
|
1068
1089
|
if (currentStep < 1 || currentStep > options.length) {
|
|
1069
1090
|
throw new Error('Current step should be in the range from 1 to options length');
|
|
1070
1091
|
}
|
|
1071
1092
|
return (jsxRuntime.jsx("div", { className: classNames({
|
|
1072
1093
|
'd-stepper-desktop': true,
|
|
1073
|
-
'is-vertical':
|
|
1094
|
+
'is-vertical': vertical,
|
|
1074
1095
|
}, 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
1096
|
'd-step-icon-container': true,
|
|
1076
1097
|
'd-step-check': value < currentStep,
|
|
@@ -1110,8 +1131,8 @@ function DStepper$1({ options, currentStep, className, style, }) {
|
|
|
1110
1131
|
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
1132
|
}
|
|
1112
1133
|
|
|
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,
|
|
1134
|
+
function DStepper({ options, currentStep, successIcon = 'check', vertical = false, breakpoint = 'lg', className, style, }) {
|
|
1135
|
+
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
1136
|
}
|
|
1116
1137
|
|
|
1117
1138
|
const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
@@ -1122,8 +1143,8 @@ const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
|
1122
1143
|
const ARROW_WIDTH = 8;
|
|
1123
1144
|
const ARROW_HEIGHT = 4;
|
|
1124
1145
|
const GAP = 2;
|
|
1125
|
-
function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true,
|
|
1126
|
-
const [
|
|
1146
|
+
function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
|
|
1147
|
+
const [isOpen, setIsOpen] = React.useState(open);
|
|
1127
1148
|
const styleVariables = React.useMemo(() => {
|
|
1128
1149
|
const defaultFontSize = size
|
|
1129
1150
|
? TOOLTIP_FONT_SIZE_BY_SIZE[size]
|
|
@@ -1132,8 +1153,8 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
|
|
|
1132
1153
|
}, [size, style]);
|
|
1133
1154
|
const arrowRef = React.useRef(null);
|
|
1134
1155
|
const { refs, context, floatingStyles, } = react.useFloating({
|
|
1135
|
-
open,
|
|
1136
|
-
onOpenChange:
|
|
1156
|
+
open: isOpen,
|
|
1157
|
+
onOpenChange: setIsOpen,
|
|
1137
1158
|
placement,
|
|
1138
1159
|
whileElementsMounted: react.autoUpdate,
|
|
1139
1160
|
middleware: [
|
|
@@ -1159,7 +1180,7 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
|
|
|
1159
1180
|
dismiss,
|
|
1160
1181
|
role,
|
|
1161
1182
|
]);
|
|
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:
|
|
1183
|
+
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
1184
|
fill: styleVariables.background,
|
|
1164
1185
|
}, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
|
|
1165
1186
|
}
|
|
@@ -1181,7 +1202,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1181
1202
|
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
1203
|
}
|
|
1183
1204
|
|
|
1184
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
1205
|
+
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, }) {
|
|
1185
1206
|
const [selected, setSelected] = React.useState(defaultSelected);
|
|
1186
1207
|
const onSelect = React.useCallback((option) => {
|
|
1187
1208
|
if (option.tab) {
|
|
@@ -1198,10 +1219,10 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1198
1219
|
}), [isSelected]);
|
|
1199
1220
|
return (jsxRuntime.jsx(TabContext.Provider, { value: value, children: jsxRuntime.jsxs("div", { className: classNames({
|
|
1200
1221
|
'd-tabs': true,
|
|
1201
|
-
'd-tabs-vertical':
|
|
1222
|
+
'd-tabs-vertical': vertical,
|
|
1202
1223
|
}, 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
1224
|
active: option.tab === selected,
|
|
1204
|
-
}, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.
|
|
1225
|
+
}, 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
1226
|
}
|
|
1206
1227
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1207
1228
|
Tab: DTabContent,
|
|
@@ -1213,7 +1234,7 @@ function DToastContainer({ style, position = 'top-right', className, }) {
|
|
|
1213
1234
|
|
|
1214
1235
|
function useToast() {
|
|
1215
1236
|
const toast = React.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
|
|
1216
|
-
reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(
|
|
1237
|
+
reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DToast, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
|
|
1217
1238
|
transition: reactToastify.Slide,
|
|
1218
1239
|
position,
|
|
1219
1240
|
autoClose,
|
|
@@ -1238,7 +1259,7 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1238
1259
|
.then((t) => t);
|
|
1239
1260
|
}
|
|
1240
1261
|
|
|
1241
|
-
exports.
|
|
1262
|
+
exports.DAlertBox = DAlertBox;
|
|
1242
1263
|
exports.DBadge = DBadge;
|
|
1243
1264
|
exports.DBoxFile = DBoxFile;
|
|
1244
1265
|
exports.DButton = DButton;
|
|
@@ -1294,6 +1315,7 @@ exports.DStepperMobile = DStepper$1;
|
|
|
1294
1315
|
exports.DSummaryCard = DSummaryCard;
|
|
1295
1316
|
exports.DTabContent = DTabContent;
|
|
1296
1317
|
exports.DTabs = DTabs$1;
|
|
1318
|
+
exports.DToast = DToast;
|
|
1297
1319
|
exports.DToastContainer = DToastContainer;
|
|
1298
1320
|
exports.DTooltip = DTooltip;
|
|
1299
1321
|
exports.ModalContext = ModalContext;
|