@dynamic-framework/ui-react 1.18.0 → 1.19.1
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 +1634 -1019
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +493 -29
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +2126 -1047
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +290 -318
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +288 -321
- package/dist/index.js.map +1 -1
- package/dist/types/components/DAvatar/DAvatar.d.ts +9 -0
- package/dist/types/components/DAvatar/index.d.ts +2 -0
- package/dist/types/components/DCarousel/DCarousel.d.ts +5 -4
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +5 -4
- package/dist/types/components/DDatePickerHeader/DDatePickerHeader.d.ts +5 -4
- package/dist/types/components/DDatePickerInput/DDatePickerInput.d.ts +1 -0
- package/dist/types/components/DToastContainer/DToastContainer.d.ts +9 -7
- package/dist/types/components/DToastContainer/index.d.ts +1 -1
- package/dist/types/components/DToastContainer/{useToast.d.ts → useDToast.d.ts} +7 -4
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/interface.d.ts +1 -0
- package/dist/types/contexts/DContext.d.ts +8 -7
- package/dist/types/contexts/DPortalContext.d.ts +29 -0
- package/dist/types/contexts/index.d.ts +1 -2
- package/dist/types/hooks/useStackState.d.ts +1 -1
- package/package.json +3 -3
- package/src/style/abstracts/_mixins.scss +110 -94
- package/src/style/abstracts/_utilities.scss +46 -1
- package/src/style/abstracts/variables/_+import.scss +2 -0
- package/src/style/abstracts/variables/_accordion.scss +2 -2
- package/src/style/abstracts/variables/_alerts.scss +1 -1
- package/src/style/abstracts/variables/_cards.scss +2 -0
- package/src/style/abstracts/variables/_collapse-icon-text.scss +2 -2
- package/src/style/abstracts/variables/_forms.scss +7 -8
- package/src/style/abstracts/variables/_navs.scss +2 -2
- package/src/style/abstracts/variables/_pagination.scss +4 -4
- package/src/style/abstracts/variables/_progress.scss +2 -2
- package/src/style/abstracts/variables/_quick-action-button.scss +4 -4
- package/src/style/abstracts/variables/_quick-action-check.scss +4 -4
- package/src/style/abstracts/variables/_quick-action-select.scss +3 -3
- package/src/style/abstracts/variables/_quick-action-switch.scss +2 -2
- package/src/style/abstracts/variables/_tooltip.scss +16 -0
- package/src/style/abstracts/variables/_typography.scss +76 -20
- package/src/style/abstracts/variables/_z-index.scss +11 -0
- package/src/style/base/_+import.scss +7 -2
- package/src/style/base/_avatar.scss +61 -0
- package/src/style/base/_backdrop.scss +9 -0
- package/src/style/base/_button-group.scss +13 -0
- package/src/style/base/{_button.scss → _buttons.scss} +14 -48
- package/src/style/base/_form-check.scss +2 -1
- package/src/style/base/_input-group.scss +11 -6
- package/src/style/base/_tooltip.scss +23 -0
- package/src/style/base/_type.scss +104 -0
- package/src/style/components/_+import.scss +0 -2
- package/src/style/components/_d-datepicker.scss +95 -45
- package/src/style/components/_d-icon.scss +1 -1
- package/src/style/components/_d-input-pin.scss +5 -0
- package/src/style/components/_d-quick-action-button.scss +8 -0
- package/src/style/components/_d-quick-action-select.scss +2 -0
- package/src/style/components/_d-quick-action-switch.scss +4 -4
- package/src/style/components/_d-select.scss +1 -1
- package/src/style/components/_d-stepper-mobile.scss +3 -3
- package/src/style/helpers/_+import.scss +3 -1
- package/src/style/helpers/_colored-links.scss +70 -0
- package/src/style/helpers/_text-truncate.scss +8 -0
- package/src/style/root/_root.scss +98 -21
- package/dist/types/components/DMonthPicker/DMonthPicker.d.ts +0 -12
- package/dist/types/components/DMonthPicker/index.d.ts +0 -2
- package/dist/types/contexts/DModalContext.d.ts +0 -31
- package/dist/types/contexts/DOffcanvasContext.d.ts +0 -31
- package/src/style/components/_d-monthpicker.scss +0 -98
- package/src/style/components/_d-tooltip.scss +0 -35
package/dist/index.esm.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useMemo,
|
|
2
|
+
import React, { useMemo, useEffect, useState, useCallback, createContext, useContext, Fragment as Fragment$1, forwardRef, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
5
6
|
import { useDropzone } from 'react-dropzone';
|
|
6
7
|
import { SplideSlide, Splide } from '@splidejs/react-splide';
|
|
7
8
|
import currency from 'currency.js';
|
|
8
9
|
import DatePicker from 'react-datepicker';
|
|
9
|
-
import {
|
|
10
|
-
import { InputMask } from '@react-input/mask';
|
|
10
|
+
import { getYear, format, getMonth, parseISO } from 'date-fns';
|
|
11
11
|
import Select, { components } from 'react-select';
|
|
12
|
+
import { InputMask } from '@react-input/mask';
|
|
12
13
|
import ResponsivePagination from 'react-responsive-pagination';
|
|
13
14
|
import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
14
15
|
import ContentLoader from 'react-content-loader';
|
|
15
|
-
import { ToastContainer, Slide, toast } from 'react-toastify';
|
|
16
|
+
import { ToastContainer, Bounce, Flip, Slide, Zoom, toast } from 'react-toastify';
|
|
16
17
|
import i18n from 'i18next';
|
|
17
18
|
import { initReactI18next } from 'react-i18next';
|
|
18
|
-
import { createPortal } from 'react-dom';
|
|
19
19
|
|
|
20
20
|
const PREFIX_BS = 'bs-';
|
|
21
21
|
|
|
@@ -61,71 +61,6 @@ function DIconBase({ icon, theme, style, className, size = '1.5rem', loading = f
|
|
|
61
61
|
return (jsx("i", { className: classNames(generateClasses), style: generateStyleVariables, children: materialStyle && icon }));
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const defaultState = {
|
|
65
|
-
language: 'en',
|
|
66
|
-
currency: {
|
|
67
|
-
symbol: '$',
|
|
68
|
-
precision: 2,
|
|
69
|
-
separator: ',',
|
|
70
|
-
decimal: '.',
|
|
71
|
-
},
|
|
72
|
-
icon: {
|
|
73
|
-
familyClass: 'bi',
|
|
74
|
-
familyPrefix: 'bi-',
|
|
75
|
-
materialStyle: false,
|
|
76
|
-
},
|
|
77
|
-
iconMap: {
|
|
78
|
-
x: 'x',
|
|
79
|
-
xLg: 'x-lg',
|
|
80
|
-
chevronUp: 'chevron-up',
|
|
81
|
-
chevronDown: 'chevron-down',
|
|
82
|
-
chevronLeft: 'chevron-left',
|
|
83
|
-
chevronRight: 'chevron-right',
|
|
84
|
-
upload: 'cloud-upload',
|
|
85
|
-
calendar: 'calendar',
|
|
86
|
-
check: 'check',
|
|
87
|
-
alert: {
|
|
88
|
-
warning: 'exclamation-circle',
|
|
89
|
-
danger: 'exclamation-triangle',
|
|
90
|
-
success: 'check-circle',
|
|
91
|
-
info: 'info-circle',
|
|
92
|
-
dark: 'info-circle',
|
|
93
|
-
light: 'info-circle',
|
|
94
|
-
primary: 'info-circle',
|
|
95
|
-
secondary: 'info-circle',
|
|
96
|
-
},
|
|
97
|
-
input: {
|
|
98
|
-
invalid: 'exclamation-circle',
|
|
99
|
-
valid: 'check',
|
|
100
|
-
search: 'search',
|
|
101
|
-
show: 'eye',
|
|
102
|
-
hide: 'eye-slash',
|
|
103
|
-
increase: 'plus-square',
|
|
104
|
-
decrease: 'dash-square',
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
setContext: () => { },
|
|
108
|
-
};
|
|
109
|
-
const DContext = createContext(defaultState);
|
|
110
|
-
function DContextProvider({ language = defaultState.language, currency = defaultState.currency, icon = defaultState.icon, iconMap = defaultState.iconMap, children, }) {
|
|
111
|
-
const [internalContext, setInternalContext,] = useState({
|
|
112
|
-
language,
|
|
113
|
-
currency,
|
|
114
|
-
icon,
|
|
115
|
-
iconMap,
|
|
116
|
-
});
|
|
117
|
-
const setContext = useCallback((newValue) => (setInternalContext((prevInternalContext) => (Object.assign(Object.assign({}, prevInternalContext), newValue)))), []);
|
|
118
|
-
const value = useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext })), [internalContext, setContext]);
|
|
119
|
-
return (jsx(DContext.Provider, { value: value, children: children }));
|
|
120
|
-
}
|
|
121
|
-
function useDContext() {
|
|
122
|
-
const context = useContext(DContext);
|
|
123
|
-
if (context === undefined) {
|
|
124
|
-
throw new Error('useDContext was used outside of DContextProvider');
|
|
125
|
-
}
|
|
126
|
-
return context;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
64
|
function useDisableBodyScrollEffect(disable) {
|
|
130
65
|
useEffect(() => {
|
|
131
66
|
if (disable) {
|
|
@@ -163,115 +98,136 @@ function usePortal(portalName) {
|
|
|
163
98
|
* @returns The list and controls to modify the stack
|
|
164
99
|
* @see https://react-hooks.org/docs/useStackState
|
|
165
100
|
*/
|
|
166
|
-
function useStackState(initialList) {
|
|
101
|
+
function useStackState(initialList = []) {
|
|
167
102
|
const [list, setList] = useState(initialList);
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
if (prevList.length === 0) {
|
|
178
|
-
return prevList;
|
|
179
|
-
}
|
|
180
|
-
const [, ...newList] = prevList;
|
|
181
|
-
return newList;
|
|
182
|
-
});
|
|
183
|
-
}, []);
|
|
184
|
-
const peek = useCallback(() => {
|
|
185
|
-
if (list.length > 0) {
|
|
186
|
-
return list[list.length - 1];
|
|
187
|
-
}
|
|
188
|
-
return undefined;
|
|
189
|
-
}, [list]);
|
|
190
|
-
const clear = () => setList([]);
|
|
191
|
-
const isEmpty = useCallback(() => list.length === 0, [list]);
|
|
192
|
-
const controls = {
|
|
103
|
+
const push = useCallback((item) => (setList((prevList) => [
|
|
104
|
+
...prevList,
|
|
105
|
+
item,
|
|
106
|
+
])), []);
|
|
107
|
+
const pop = useCallback(() => (setList((prevList) => (prevList.slice(0, prevList.length - 1)))), []);
|
|
108
|
+
const peek = useCallback(() => list.at(-1), [list]);
|
|
109
|
+
const clear = useCallback(() => setList([]), []);
|
|
110
|
+
const isEmpty = useCallback(() => list.length === 0, [list.length]);
|
|
111
|
+
const controls = useMemo(() => ({
|
|
193
112
|
clear,
|
|
194
113
|
isEmpty,
|
|
195
|
-
length,
|
|
114
|
+
length: list.length,
|
|
196
115
|
peek,
|
|
197
116
|
pop,
|
|
198
117
|
push,
|
|
199
|
-
}
|
|
118
|
+
}), [
|
|
119
|
+
clear,
|
|
120
|
+
isEmpty,
|
|
121
|
+
list.length,
|
|
122
|
+
peek,
|
|
123
|
+
pop,
|
|
124
|
+
push,
|
|
125
|
+
]);
|
|
200
126
|
return [list, controls];
|
|
201
127
|
}
|
|
202
128
|
|
|
203
|
-
const
|
|
204
|
-
function
|
|
129
|
+
const DPortalContext = createContext(undefined);
|
|
130
|
+
function DPortalContextProvider({ portalName, children, availablePortals, }) {
|
|
205
131
|
const { created } = usePortal(portalName);
|
|
206
|
-
const [stack, { push, pop,
|
|
132
|
+
const [stack, { push, pop, isEmpty }] = useStackState([]);
|
|
207
133
|
useDisableBodyScrollEffect(Boolean(stack.length));
|
|
208
|
-
const
|
|
209
|
-
|
|
134
|
+
const openPortal = useCallback((name, payload) => {
|
|
135
|
+
if (!availablePortals) {
|
|
136
|
+
throw new Error(`there is no component for portal ${name.toString()}`);
|
|
137
|
+
}
|
|
138
|
+
const Component = availablePortals[name];
|
|
210
139
|
if (!Component) {
|
|
211
|
-
throw new Error(`there is no component for
|
|
140
|
+
throw new Error(`there is no component for portal ${name.toString()}`);
|
|
212
141
|
}
|
|
213
142
|
push({
|
|
214
|
-
|
|
143
|
+
name,
|
|
215
144
|
Component,
|
|
216
145
|
payload,
|
|
217
146
|
});
|
|
218
|
-
}, [
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
if (!stackItem) {
|
|
147
|
+
}, [availablePortals, push]);
|
|
148
|
+
const closePortal = useCallback(() => {
|
|
149
|
+
if (isEmpty()) {
|
|
222
150
|
return;
|
|
223
151
|
}
|
|
224
152
|
pop();
|
|
225
|
-
}, [
|
|
153
|
+
}, [isEmpty, pop]);
|
|
226
154
|
const value = useMemo(() => ({
|
|
227
155
|
stack,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}), [stack,
|
|
231
|
-
return (jsxs(
|
|
156
|
+
openPortal,
|
|
157
|
+
closePortal,
|
|
158
|
+
}), [stack, openPortal, closePortal]);
|
|
159
|
+
return (jsxs(DPortalContext.Provider, { value: value, children: [children, created && createPortal(jsx(Fragment, { children: stack.map(({ Component, name, payload, }) => (jsxs(Fragment$1, { children: [jsx("div", { className: "backdrop fade show" }), jsx(Component, { name: name, payload: payload })] }, name))) }), document.getElementById(portalName))] }));
|
|
232
160
|
}
|
|
233
|
-
function
|
|
234
|
-
const context = useContext(
|
|
161
|
+
function useDPortalContext() {
|
|
162
|
+
const context = useContext(DPortalContext);
|
|
235
163
|
if (context === undefined) {
|
|
236
|
-
throw new Error('
|
|
164
|
+
throw new Error('usePortalContext was used outside of PortalContextProvider');
|
|
237
165
|
}
|
|
238
166
|
return context;
|
|
239
167
|
}
|
|
240
168
|
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
169
|
+
const defaultState = {
|
|
170
|
+
language: 'en',
|
|
171
|
+
currency: {
|
|
172
|
+
symbol: '$',
|
|
173
|
+
precision: 2,
|
|
174
|
+
separator: ',',
|
|
175
|
+
decimal: '.',
|
|
176
|
+
},
|
|
177
|
+
icon: {
|
|
178
|
+
familyClass: 'bi',
|
|
179
|
+
familyPrefix: 'bi-',
|
|
180
|
+
materialStyle: false,
|
|
181
|
+
},
|
|
182
|
+
iconMap: {
|
|
183
|
+
x: 'x',
|
|
184
|
+
xLg: 'x-lg',
|
|
185
|
+
chevronUp: 'chevron-up',
|
|
186
|
+
chevronDown: 'chevron-down',
|
|
187
|
+
chevronLeft: 'chevron-left',
|
|
188
|
+
chevronRight: 'chevron-right',
|
|
189
|
+
upload: 'cloud-upload',
|
|
190
|
+
calendar: 'calendar',
|
|
191
|
+
check: 'check',
|
|
192
|
+
alert: {
|
|
193
|
+
warning: 'exclamation-circle',
|
|
194
|
+
danger: 'exclamation-triangle',
|
|
195
|
+
success: 'check-circle',
|
|
196
|
+
info: 'info-circle',
|
|
197
|
+
dark: 'info-circle',
|
|
198
|
+
light: 'info-circle',
|
|
199
|
+
primary: 'info-circle',
|
|
200
|
+
secondary: 'info-circle',
|
|
201
|
+
},
|
|
202
|
+
input: {
|
|
203
|
+
invalid: 'exclamation-circle',
|
|
204
|
+
valid: 'check',
|
|
205
|
+
search: 'search',
|
|
206
|
+
show: 'eye',
|
|
207
|
+
hide: 'eye-slash',
|
|
208
|
+
increase: 'plus-square',
|
|
209
|
+
decrease: 'dash-square',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
setContext: () => { },
|
|
213
|
+
portalName: 'd-portal',
|
|
214
|
+
};
|
|
215
|
+
const DContext = createContext(defaultState);
|
|
216
|
+
function DContextProvider({ language = defaultState.language, currency = defaultState.currency, icon = defaultState.icon, iconMap = defaultState.iconMap, portalName = defaultState.portalName, availablePortals, children, }) {
|
|
217
|
+
const [internalContext, setInternalContext,] = useState({
|
|
218
|
+
language,
|
|
219
|
+
currency,
|
|
220
|
+
icon,
|
|
221
|
+
iconMap,
|
|
222
|
+
});
|
|
223
|
+
const setContext = useCallback((newValue) => (setInternalContext((prevInternalContext) => (Object.assign(Object.assign({}, prevInternalContext), newValue)))), []);
|
|
224
|
+
const value = useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext })), [internalContext, setContext]);
|
|
225
|
+
return (jsx(DContext.Provider, { value: value, children: jsx(DPortalContextProvider, { portalName: portalName, availablePortals: availablePortals, children: children }) }));
|
|
270
226
|
}
|
|
271
|
-
function
|
|
272
|
-
const context = useContext(
|
|
227
|
+
function useDContext() {
|
|
228
|
+
const context = useContext(DContext);
|
|
273
229
|
if (context === undefined) {
|
|
274
|
-
throw new Error('
|
|
230
|
+
throw new Error('useDContext was used outside of DContextProvider');
|
|
275
231
|
}
|
|
276
232
|
return context;
|
|
277
233
|
}
|
|
@@ -361,9 +317,9 @@ function DCarouselSlide(_a) {
|
|
|
361
317
|
return (jsx(SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
|
|
362
318
|
}
|
|
363
319
|
|
|
364
|
-
function DCarousel(_a) {
|
|
320
|
+
function DCarousel(_a, ref) {
|
|
365
321
|
var { children, className, style, options } = _a, props = __rest(_a, ["children", "className", "style", "options"]);
|
|
366
|
-
return (jsx(Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
|
|
322
|
+
return (jsx(Splide, Object.assign({ className: classNames('d-carousel', className), style: style, ref: ref, options: Object.assign(Object.assign({}, options), { classes: {
|
|
367
323
|
// Arrows
|
|
368
324
|
arrows: 'splide__arrows d-carousel-arrows',
|
|
369
325
|
arrow: 'splide__arrow d-carousel-arrow',
|
|
@@ -374,7 +330,9 @@ function DCarousel(_a) {
|
|
|
374
330
|
page: 'splide__pagination__page d-carousel-pagination-page',
|
|
375
331
|
} }) }, props, { children: children })));
|
|
376
332
|
}
|
|
377
|
-
|
|
333
|
+
const ForwardedDCarousel = forwardRef(DCarousel);
|
|
334
|
+
ForwardedDCarousel.displayName = 'DCarousel';
|
|
335
|
+
var DCarousel$1 = Object.assign(ForwardedDCarousel, {
|
|
378
336
|
Slide: DCarouselSlide,
|
|
379
337
|
});
|
|
380
338
|
|
|
@@ -405,7 +363,7 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
|
|
|
405
363
|
const generateStyles = useMemo(() => ({
|
|
406
364
|
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
407
365
|
}), [hasSeparator]);
|
|
408
|
-
return (jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}
|
|
366
|
+
return (jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}fs-small)`, icon: toggle ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), toggle && (jsx("div", { className: classNames({
|
|
409
367
|
'collapse-body': true,
|
|
410
368
|
}), style: generateStyles, children: children }))] }));
|
|
411
369
|
}
|
|
@@ -513,58 +471,187 @@ var DInput$1 = ForwardedDInput;
|
|
|
513
471
|
|
|
514
472
|
function DDatePickerTime(_a) {
|
|
515
473
|
var { value, onChange, id, label, className, style } = _a, props = __rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
|
|
516
|
-
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({}, onChange && {
|
|
474
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({ className: "w-100" }, onChange && {
|
|
517
475
|
onChange,
|
|
518
476
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
519
477
|
}
|
|
520
478
|
|
|
521
479
|
function DDatePickerInput(_a, ref) {
|
|
522
|
-
var { value, onClick, id, iconEnd, className, style } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
|
|
523
|
-
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)));
|
|
480
|
+
var { value, onClick, id, iconEnd, className, style, inputLabel } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel"]);
|
|
481
|
+
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style, label: inputLabel }, props)));
|
|
524
482
|
}
|
|
525
483
|
const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
526
484
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
527
485
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
528
486
|
|
|
529
|
-
function
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, iconPrevMonth, iconNextMonth, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
|
|
540
|
-
const onChangeDate = useCallback((value) => {
|
|
541
|
-
if (value) {
|
|
542
|
-
changeMonth(getMonth(value));
|
|
543
|
-
changeYear(getYear(value));
|
|
487
|
+
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
488
|
+
const innerRef = useRef(null);
|
|
489
|
+
const handleChange = useCallback((event) => {
|
|
490
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
491
|
+
}, [onChange]);
|
|
492
|
+
useEffect(() => {
|
|
493
|
+
if (innerRef.current) {
|
|
494
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
544
495
|
}
|
|
545
|
-
}, [
|
|
546
|
-
|
|
496
|
+
}, [indeterminate]);
|
|
497
|
+
useEffect(() => {
|
|
498
|
+
if (innerRef.current) {
|
|
499
|
+
innerRef.current.checked = checked;
|
|
500
|
+
}
|
|
501
|
+
}, [checked]);
|
|
502
|
+
if (!label) {
|
|
503
|
+
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
|
|
504
|
+
}
|
|
505
|
+
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function DSelectOptionCheck(_a) {
|
|
509
|
+
var { innerProps, children, isSelected } = _a, props = __rest(_a, ["innerProps", "children", "isSelected"]);
|
|
510
|
+
return (jsx(components.Option, Object.assign({ className: classNames({
|
|
511
|
+
'd-select__option': true,
|
|
512
|
+
'd-select__option--is-checkbox': true,
|
|
513
|
+
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function DSelectOptionIcon(_a) {
|
|
517
|
+
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
518
|
+
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
519
|
+
'd-select__option--has-icon': true,
|
|
520
|
+
}), data: data }, props, { children: [jsx(DIcon, { icon: data.icon }), children] })));
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function DSelectSingleValueIconText(_a) {
|
|
524
|
+
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
525
|
+
const [value] = getValue();
|
|
526
|
+
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
527
|
+
'd-select__control--has-icon': true,
|
|
528
|
+
}), getValue: getValue }, props, { children: [jsx(DIcon, { icon: value.icon }), children] })));
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function DSelectDropdownIndicator(props) {
|
|
532
|
+
const { iconMap: { chevronDown, }, } = useDContext();
|
|
533
|
+
return (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: chevronDown }) })));
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function DSelectClearIndicator(props) {
|
|
537
|
+
const { iconMap: { xLg, }, } = useDContext();
|
|
538
|
+
return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: xLg }) })));
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function DSelectMultiValueRemove(props) {
|
|
542
|
+
const { iconMap: { x, }, } = useDContext();
|
|
543
|
+
return (jsx(components.MultiValueRemove, Object.assign({}, props, { children: jsx(DIcon, { icon: x }) })));
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function DSelectLoadingIndicator({ innerProps, }) {
|
|
547
|
+
return (jsx("div", Object.assign({ className: classNames({
|
|
548
|
+
'd-select__indicator': true,
|
|
549
|
+
'd-select__loading-indicator': true,
|
|
550
|
+
}) }, innerProps, { children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function DSelectOptionEmoji(_a) {
|
|
554
|
+
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
555
|
+
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
556
|
+
'd-select__option--has-icon': true,
|
|
557
|
+
}), data: data }, props, { children: [jsx("span", { children: data.emoji }), jsx("span", { children: children })] })));
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function DSelectSingleValueEmoji(_a) {
|
|
561
|
+
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
562
|
+
const [value] = getValue();
|
|
563
|
+
return (jsx(components.SingleValue, Object.assign({ className: classNames({
|
|
564
|
+
'd-select__control--has-icon': true,
|
|
565
|
+
}), getValue: getValue }, props, { children: value.emoji })));
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function DSelectSingleValueEmojiText(_a) {
|
|
569
|
+
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
570
|
+
const [value] = getValue();
|
|
571
|
+
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
572
|
+
'd-select__control--has-icon': true,
|
|
573
|
+
}), getValue: getValue }, props, { children: [jsx("span", { children: value.emoji }), jsx("span", { children: children })] })));
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
function DSelect(_a) {
|
|
577
|
+
var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = __rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
|
|
578
|
+
const handleOnIconStartClick = useCallback(() => {
|
|
579
|
+
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
580
|
+
}, [onIconStartClick, defaultValue]);
|
|
581
|
+
const handleOnIconEndClick = useCallback(() => {
|
|
582
|
+
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
583
|
+
}, [onIconEndClick, defaultValue]);
|
|
584
|
+
return (jsxs("div", { className: classNames('d-select', className, {
|
|
585
|
+
disabled: disabled || loading,
|
|
586
|
+
}), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: classNames({
|
|
587
|
+
'input-group': true,
|
|
588
|
+
'has-validation': invalid,
|
|
589
|
+
disabled: disabled || loading,
|
|
590
|
+
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsx(Select, Object.assign({ styles: {
|
|
591
|
+
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
592
|
+
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
593
|
+
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
594
|
+
}, className: classNames('d-select-component', {
|
|
595
|
+
'is-invalid': invalid,
|
|
596
|
+
'is-valid': valid,
|
|
597
|
+
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
598
|
+
}
|
|
599
|
+
var DSelect$1 = Object.assign(DSelect, {
|
|
600
|
+
OptionCheck: DSelectOptionCheck,
|
|
601
|
+
OptionIcon: DSelectOptionIcon,
|
|
602
|
+
SingleValueIconText: DSelectSingleValueIconText,
|
|
603
|
+
DropdownIndicator: DSelectDropdownIndicator,
|
|
604
|
+
ClearIndicator: DSelectClearIndicator,
|
|
605
|
+
MultiValueRemove: DSelectMultiValueRemove,
|
|
606
|
+
LoadingIndicator: DSelectLoadingIndicator,
|
|
607
|
+
OptionEmoji: DSelectOptionEmoji,
|
|
608
|
+
SingleValueEmoji: DSelectSingleValueEmoji,
|
|
609
|
+
SingleValueEmojiText: DSelectSingleValueEmojiText,
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
function DDatePickerHeader({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, iconPrevMonth, iconNextMonth, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, minYearSelect, maxYearSelect, }) {
|
|
613
|
+
const arrayYears = useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
|
|
614
|
+
const years = useMemo(() => arrayYears.map((year) => ({
|
|
615
|
+
label: year.toString(),
|
|
616
|
+
value: year,
|
|
617
|
+
})), [arrayYears]);
|
|
618
|
+
const defaultYear = useMemo(() => years.find((year) => year.value === getYear(date)), [date, years]);
|
|
619
|
+
const arrayMonths = useMemo(() => Array.from({ length: 12 }, (_, i) => format(new Date(2000, i), 'LLLL', { locale })), [locale]);
|
|
620
|
+
const months = useMemo(() => arrayMonths.map((month, i) => ({
|
|
621
|
+
label: month,
|
|
622
|
+
value: i,
|
|
623
|
+
})), [arrayMonths]);
|
|
624
|
+
const defaultMonth = useMemo(() => ({
|
|
625
|
+
label: arrayMonths[getMonth(date)],
|
|
626
|
+
value: getMonth(date),
|
|
627
|
+
}), [arrayMonths, date]);
|
|
628
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center d-datepicker-header', className), style: style, children: [jsx(DButton, { iconStart: iconPrevMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button" }), jsxs("div", { className: "d-flex justify-content-center flex-grow-1", children: [jsx(DSelect$1, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false }), jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })] }), jsx(DButton, { iconStart: iconNextMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button" })] }));
|
|
547
629
|
}
|
|
548
630
|
|
|
549
631
|
function DDatePicker(_a) {
|
|
550
|
-
var { date, selectsRange = false,
|
|
632
|
+
var { date, selectsRange = false, inputLabel, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, iconInput: iconInputProp, iconHeaderPrevMonth: iconHeaderPrevMonthProp, iconHeaderNextMonth: iconHeaderNextMonthProp, iconMaterialStyle: iconMaterialStyleProp, iconFamilyClass, iconFamilyPrefix, minYearSelect = 1900, maxYearSelect = 2100, iconHeaderSize = 'sm', headerPrevMonthAriaLabel = 'decrease month', headerNextMonthAriaLabel = 'increase month', headerButtonVariant = 'link', headerButtonTheme = 'dark', locale, className, formatWeekDay: formatWeekDayProp, style } = _a, props = __rest(_a, ["date", "selectsRange", "inputLabel", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "locale", "className", "formatWeekDay", "style"]);
|
|
551
633
|
const { iconMap: { calendar, chevronLeft, chevronRight, }, } = useDContext();
|
|
552
634
|
const selected = useMemo(() => (date ? parseISO(date) : null), [date]);
|
|
553
635
|
const iconInput = useMemo(() => iconInputProp || calendar, [calendar, iconInputProp]);
|
|
636
|
+
const handleFormatWeekDay = useMemo(() => (formatWeekDayProp
|
|
637
|
+
? (day) => formatWeekDayProp(day)
|
|
638
|
+
: (day) => day.substring(0, 1)), [formatWeekDayProp]);
|
|
554
639
|
const iconPrevMonth = useMemo(() => iconHeaderPrevMonthProp || chevronLeft, [chevronLeft, iconHeaderPrevMonthProp]);
|
|
555
640
|
const iconNextMonth = useMemo(() => iconHeaderNextMonthProp || chevronRight, [chevronRight, iconHeaderNextMonthProp]);
|
|
556
|
-
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth, iconMaterialStyle: iconMaterialStyleProp, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize:
|
|
641
|
+
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth, iconMaterialStyle: iconMaterialStyleProp, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: iconHeaderSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, minYearSelect: minYearSelect, maxYearSelect: maxYearSelect }))), [
|
|
642
|
+
locale,
|
|
557
643
|
iconPrevMonth,
|
|
558
644
|
iconNextMonth,
|
|
559
645
|
iconMaterialStyleProp,
|
|
560
646
|
headerPrevMonthAriaLabel,
|
|
561
647
|
headerNextMonthAriaLabel,
|
|
562
|
-
|
|
648
|
+
iconHeaderSize,
|
|
563
649
|
headerButtonVariant,
|
|
564
650
|
headerButtonTheme,
|
|
565
|
-
|
|
651
|
+
minYearSelect,
|
|
652
|
+
maxYearSelect,
|
|
566
653
|
]);
|
|
567
|
-
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, className: className, style: style })), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel })
|
|
654
|
+
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style })), customTimeInput: (jsx(DDatePickerTime, { id: timeId, label: timeLabel })) }, locale && { locale }, props)));
|
|
568
655
|
}
|
|
569
656
|
|
|
570
657
|
function DInputMask(props, ref) {
|
|
@@ -733,27 +820,6 @@ const ForwardedDInputPassword = forwardRef(DInputPassword);
|
|
|
733
820
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
734
821
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
735
822
|
|
|
736
|
-
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
737
|
-
const innerRef = useRef(null);
|
|
738
|
-
const handleChange = useCallback((event) => {
|
|
739
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
740
|
-
}, [onChange]);
|
|
741
|
-
useEffect(() => {
|
|
742
|
-
if (innerRef.current) {
|
|
743
|
-
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
744
|
-
}
|
|
745
|
-
}, [indeterminate]);
|
|
746
|
-
useEffect(() => {
|
|
747
|
-
if (innerRef.current) {
|
|
748
|
-
innerRef.current.checked = checked;
|
|
749
|
-
}
|
|
750
|
-
}, [checked]);
|
|
751
|
-
if (!label) {
|
|
752
|
-
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
|
|
753
|
-
}
|
|
754
|
-
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
755
|
-
}
|
|
756
|
-
|
|
757
823
|
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, invalidIcon: invalidIconProp, validIcon: validIconProp, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
|
|
758
824
|
const [pattern, setPattern] = useState('');
|
|
759
825
|
useEffect(() => {
|
|
@@ -904,110 +970,6 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
|
|
|
904
970
|
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
905
971
|
}
|
|
906
972
|
|
|
907
|
-
function DSelectOptionCheck(_a) {
|
|
908
|
-
var { innerProps, children, isSelected } = _a, props = __rest(_a, ["innerProps", "children", "isSelected"]);
|
|
909
|
-
return (jsx(components.Option, Object.assign({ className: classNames({
|
|
910
|
-
'd-select__option': true,
|
|
911
|
-
'd-select__option--is-checkbox': true,
|
|
912
|
-
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
function DSelectOptionIcon(_a) {
|
|
916
|
-
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
917
|
-
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
918
|
-
'd-select__option--has-icon': true,
|
|
919
|
-
}), data: data }, props, { children: [jsx(DIcon, { icon: data.icon }), children] })));
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
function DSelectSingleValueIconText(_a) {
|
|
923
|
-
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
924
|
-
const [value] = getValue();
|
|
925
|
-
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
926
|
-
'd-select__control--has-icon': true,
|
|
927
|
-
}), getValue: getValue }, props, { children: [jsx(DIcon, { icon: value.icon }), children] })));
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
function DSelectDropdownIndicator(props) {
|
|
931
|
-
const { iconMap: { chevronDown, }, } = useDContext();
|
|
932
|
-
return (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: chevronDown }) })));
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
function DSelectClearIndicator(props) {
|
|
936
|
-
const { iconMap: { xLg, }, } = useDContext();
|
|
937
|
-
return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: xLg }) })));
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
function DSelectMultiValueRemove(props) {
|
|
941
|
-
const { iconMap: { x, }, } = useDContext();
|
|
942
|
-
return (jsx(components.MultiValueRemove, Object.assign({}, props, { children: jsx(DIcon, { icon: x }) })));
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
function DSelectLoadingIndicator({ innerProps, }) {
|
|
946
|
-
return (jsx("div", Object.assign({ className: classNames({
|
|
947
|
-
'd-select__indicator': true,
|
|
948
|
-
'd-select__loading-indicator': true,
|
|
949
|
-
}) }, innerProps, { children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
function DSelectOptionEmoji(_a) {
|
|
953
|
-
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
954
|
-
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
955
|
-
'd-select__option--has-icon': true,
|
|
956
|
-
}), data: data }, props, { children: [jsx("span", { children: data.emoji }), jsx("span", { children: children })] })));
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
function DSelectSingleValueEmoji(_a) {
|
|
960
|
-
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
961
|
-
const [value] = getValue();
|
|
962
|
-
return (jsx(components.SingleValue, Object.assign({ className: classNames({
|
|
963
|
-
'd-select__control--has-icon': true,
|
|
964
|
-
}), getValue: getValue }, props, { children: value.emoji })));
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
function DSelectSingleValueEmojiText(_a) {
|
|
968
|
-
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
969
|
-
const [value] = getValue();
|
|
970
|
-
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
971
|
-
'd-select__control--has-icon': true,
|
|
972
|
-
}), getValue: getValue }, props, { children: [jsx("span", { children: value.emoji }), jsx("span", { children: children })] })));
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
function DSelect(_a) {
|
|
976
|
-
var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = __rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
|
|
977
|
-
const handleOnIconStartClick = useCallback(() => {
|
|
978
|
-
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
979
|
-
}, [onIconStartClick, defaultValue]);
|
|
980
|
-
const handleOnIconEndClick = useCallback(() => {
|
|
981
|
-
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
982
|
-
}, [onIconEndClick, defaultValue]);
|
|
983
|
-
return (jsxs("div", { className: classNames('d-select', className, {
|
|
984
|
-
disabled: disabled || loading,
|
|
985
|
-
}), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: classNames({
|
|
986
|
-
'input-group': true,
|
|
987
|
-
'has-validation': invalid,
|
|
988
|
-
disabled: disabled || loading,
|
|
989
|
-
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsx(Select, Object.assign({ styles: {
|
|
990
|
-
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
991
|
-
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
992
|
-
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
993
|
-
}, className: classNames('d-select-component', {
|
|
994
|
-
'is-invalid': invalid,
|
|
995
|
-
'is-valid': valid,
|
|
996
|
-
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
997
|
-
}
|
|
998
|
-
var DSelect$1 = Object.assign(DSelect, {
|
|
999
|
-
OptionCheck: DSelectOptionCheck,
|
|
1000
|
-
OptionIcon: DSelectOptionIcon,
|
|
1001
|
-
SingleValueIconText: DSelectSingleValueIconText,
|
|
1002
|
-
DropdownIndicator: DSelectDropdownIndicator,
|
|
1003
|
-
ClearIndicator: DSelectClearIndicator,
|
|
1004
|
-
MultiValueRemove: DSelectMultiValueRemove,
|
|
1005
|
-
LoadingIndicator: DSelectLoadingIndicator,
|
|
1006
|
-
OptionEmoji: DSelectOptionEmoji,
|
|
1007
|
-
SingleValueEmoji: DSelectSingleValueEmoji,
|
|
1008
|
-
SingleValueEmojiText: DSelectSingleValueEmojiText,
|
|
1009
|
-
});
|
|
1010
|
-
|
|
1011
973
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
1012
974
|
const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1013
975
|
return (jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
@@ -1057,7 +1019,7 @@ function DModal({ name, className, style, staticBackdrop, scrollable, centered,
|
|
|
1057
1019
|
}
|
|
1058
1020
|
return '';
|
|
1059
1021
|
}, [fullScreenFrom, fullScreen]);
|
|
1060
|
-
const generateClasses = useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
|
|
1022
|
+
const generateClasses = useMemo(() => (Object.assign({ 'modal portal fade show': true }, className && { [className]: true })), [className]);
|
|
1061
1023
|
const generateModalDialogClasses = useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!centered, 'modal-dialog-scrollable': !!scrollable, [fullScreenClass]: !!fullScreen }, size && { [`modal-${size}`]: true })), [fullScreenClass, centered, fullScreen, scrollable, size]);
|
|
1062
1024
|
return (jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
|
|
1063
1025
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
@@ -1085,7 +1047,7 @@ function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className,
|
|
|
1085
1047
|
}
|
|
1086
1048
|
|
|
1087
1049
|
function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', children, }) {
|
|
1088
|
-
return (jsx("div", Object.assign({ className: classNames('offcanvas show', {
|
|
1050
|
+
return (jsx("div", Object.assign({ className: classNames('offcanvas portal show', {
|
|
1089
1051
|
[`offcanvas-${openFrom}`]: openFrom,
|
|
1090
1052
|
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, staticBackdrop && ({
|
|
1091
1053
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
@@ -1203,7 +1165,7 @@ function DQuickActionSwitch({ id, name, label, hint, checked, disabled, classNam
|
|
|
1203
1165
|
event.stopPropagation();
|
|
1204
1166
|
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
1205
1167
|
}, [checked, onClick]);
|
|
1206
|
-
return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [
|
|
1168
|
+
return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsx("div", { className: "d-quick-action-switch-content", children: jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true, label: label }) }), jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
|
|
1207
1169
|
}
|
|
1208
1170
|
|
|
1209
1171
|
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
@@ -1310,8 +1272,8 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
|
|
|
1310
1272
|
dismiss,
|
|
1311
1273
|
role,
|
|
1312
1274
|
]);
|
|
1313
|
-
const generateClasses = useMemo(() => (Object.assign({ '
|
|
1314
|
-
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: childrenClassName, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children: isOpen && (jsxs("div", Object.assign({ className: classNames(generateClasses), ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), style) }, getFloatingProps(), { children: [jsx(FloatingArrow, { ref: arrowRef, context: context, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
|
|
1275
|
+
const generateClasses = useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size, [`tooltip-${theme}`]: !!theme }, className && { [className]: true })), [size, theme, className]);
|
|
1276
|
+
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: childrenClassName, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children: isOpen && (jsxs("div", Object.assign({ className: classNames(generateClasses), ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), style) }, getFloatingProps(), { children: [jsx(FloatingArrow, { ref: arrowRef, context: context, width: ARROW_WIDTH, height: ARROW_HEIGHT }), jsx("div", { className: "tooltip-inner", children: children })] }))) })] }));
|
|
1315
1277
|
}
|
|
1316
1278
|
|
|
1317
1279
|
const TabContext = createContext(undefined);
|
|
@@ -1358,17 +1320,27 @@ var DTabs$1 = Object.assign(DTabs, {
|
|
|
1358
1320
|
Tab: DTabContent,
|
|
1359
1321
|
});
|
|
1360
1322
|
|
|
1361
|
-
|
|
1362
|
-
|
|
1323
|
+
const TOAST_TRANSITIONS$1 = {
|
|
1324
|
+
bounce: Bounce,
|
|
1325
|
+
flip: Flip,
|
|
1326
|
+
slide: Slide,
|
|
1327
|
+
zoom: Zoom,
|
|
1328
|
+
};
|
|
1329
|
+
function DToastContainer({ style, className, closeOnClick, position = 'bottom-center', autoClose = false, stacked = false, transition = 'slide', containerId, }) {
|
|
1330
|
+
const selectedTransition = useMemo(() => TOAST_TRANSITIONS$1[transition], [transition]);
|
|
1331
|
+
return (jsx(ToastContainer, { toastClassName: () => classNames('shadow-none p-0 cursor-default', className), position: position, autoClose: autoClose, closeOnClick: closeOnClick, transition: selectedTransition, closeButton: false, style: style, hideProgressBar: true, stacked: stacked, containerId: containerId }));
|
|
1363
1332
|
}
|
|
1364
1333
|
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1334
|
+
const TOAST_TRANSITIONS = {
|
|
1335
|
+
bounce: Bounce,
|
|
1336
|
+
flip: Flip,
|
|
1337
|
+
slide: Slide,
|
|
1338
|
+
zoom: Zoom,
|
|
1339
|
+
};
|
|
1340
|
+
function useDToast() {
|
|
1341
|
+
const toast$1 = useCallback((message, _a) => {
|
|
1342
|
+
var { icon, iconClose, type = 'info', showClose = true, transition } = _a, rest = __rest(_a, ["icon", "iconClose", "type", "showClose", "transition"]);
|
|
1343
|
+
toast(({ closeToast }) => (jsx(DAlert, { onClose: closeToast, id: "alertID", type: type, icon: icon, iconClose: iconClose, showClose: showClose, children: message })), Object.assign({ transition: transition && TOAST_TRANSITIONS[transition] }, rest));
|
|
1372
1344
|
}, []);
|
|
1373
1345
|
return {
|
|
1374
1346
|
toast: toast$1,
|
|
@@ -1389,5 +1361,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1389
1361
|
.then((t) => t);
|
|
1390
1362
|
}
|
|
1391
1363
|
|
|
1392
|
-
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody,
|
|
1364
|
+
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext };
|
|
1393
1365
|
//# sourceMappingURL=index.esm.js.map
|