@dynamic-framework/ui-react 1.13.0 → 1.14.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/index.js CHANGED
@@ -60,10 +60,10 @@ const ALERT_TYPE_ICON = {
60
60
  secondary: 'info-circle',
61
61
  };
62
62
 
63
- 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-', }) {
63
+ function DIconBase({ 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, materialStyle = false, familyClass = 'bi', familyPrefix = 'bi-', }) {
64
64
  const colorStyle = React.useMemo(() => {
65
65
  if (color) {
66
- return { [`--${PREFIX_BS}component-color`]: color };
66
+ return { [`--${PREFIX_BS}icon-component-color`]: color };
67
67
  }
68
68
  if (theme) {
69
69
  return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${theme})` };
@@ -89,139 +89,17 @@ function DIcon({ icon, theme, style, className, size = '1.5rem', loading = false
89
89
  return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
90
90
  }, [circleSize, hasCircle]);
91
91
  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]);
92
- 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]);
93
- return (jsxRuntime.jsx("i", { className: classNames(generateClasses), style: generateStyleVariables }));
94
- }
95
-
96
- function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary, }) {
97
- 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] })] }));
98
- }
99
-
100
- function DAlert({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = true, soft = false, showClose, onClose, children, id, className, style, }) {
101
- const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose, 'alert-soft': soft }, className && { [className]: true })), [type, showClose, soft, className]);
102
- const getIcon = React.useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
103
- const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
104
- 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 }) }))] }));
105
- }
106
-
107
- function DBoxFile(_a) {
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));
110
- return (jsxRuntime.jsxs("section", { className: classNames('d-box-file', {
111
- 'd-box-file-selected': !!acceptedFiles.length,
112
- }, className), style: style, children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
113
- className: classNames('d-box-file-dropzone', {
114
- disabled,
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))) }))] }));
117
- }
118
-
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, form, onClick, }) {
120
- const generateClasses = React.useMemo(() => {
121
- const variantClass = variant
122
- ? `btn-${variant}-${theme}`
123
- : `btn-${theme}`;
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]);
126
- const generateStyleVariables = React.useMemo(() => {
127
- if (pill) {
128
- return {
129
- [`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
130
- [`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
131
- [`--${PREFIX_BS}btn-component-sm-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
132
- };
133
- }
134
- return {};
135
- }, [pill]);
136
- const clickHandler = React.useCallback((event) => {
137
- if (stopPropagationEnabled) {
138
- event.stopPropagation();
139
- }
140
- onClick === null || onClick === void 0 ? void 0 : onClick(event);
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, form: form }, 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 }))] })));
147
- }
148
-
149
- function DCardHeader({ className, style, children, }) {
150
- return (jsxRuntime.jsx("div", { className: classNames('card-header', className), style: style, children: children }));
151
- }
152
-
153
- function DCardBody({ className, style, children, }) {
154
- return (jsxRuntime.jsx("div", { className: classNames('card-body', className), style: style, children: children }));
155
- }
156
-
157
- function DCardFooter({ className, style, children, }) {
158
- return (jsxRuntime.jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
159
- }
160
-
161
- function DCard({ className, style, children, }) {
162
- return (jsxRuntime.jsx("div", { style: style, className: classNames('card', className), children: children }));
163
- }
164
- var DCard$1 = Object.assign(DCard, {
165
- Header: DCardHeader,
166
- Body: DCardBody,
167
- Footer: DCardFooter,
168
- });
169
-
170
- function DCardAccount({ className, style, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
171
- return (jsxRuntime.jsx(DCard$1, { className: classNames('d-card-account', className), style: style, children: jsxRuntime.jsxs(DCard$1.Body, { children: [jsxRuntime.jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsxRuntime.jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxRuntime.jsxs("div", { className: "d-block flex-grow-1", children: [jsxRuntime.jsx("p", { className: "text-gray-700", children: name }), jsxRuntime.jsx("small", { className: "text-gray-500", children: number })] })] }), jsxRuntime.jsxs("div", { className: "d-block", children: [jsxRuntime.jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsxRuntime.jsx("small", { className: "text-gray-700", children: balanceText })] }), jsxRuntime.jsx("div", { className: "d-flex justify-content-end", children: jsxRuntime.jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
172
- }
173
-
174
- function DCarouselSlide(_a) {
175
- var { className } = _a, props = tslib.__rest(_a, ["className"]);
176
- return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
177
- }
178
-
179
- function DCarousel(_a) {
180
- var { children, className, style, options } = _a, props = tslib.__rest(_a, ["children", "className", "style", "options"]);
181
- return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
182
- // Arrows
183
- arrows: 'splide__arrows d-carousel-arrows',
184
- arrow: 'splide__arrow d-carousel-arrow',
185
- prev: 'splide__arrow--prev d-carousel-arrow-prev',
186
- next: 'splide__arrow--next d-carousel-arrow-next',
187
- // Paginator
188
- pagination: 'splide__pagination d-carousel-pagination',
189
- page: 'splide__pagination__page d-carousel-pagination-page',
190
- } }) }, props, { children: children })));
191
- }
192
- var DCarousel$1 = Object.assign(DCarousel, {
193
- Slide: DCarouselSlide,
194
- });
195
-
196
- function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, closeAriaLabel = 'close', className, style, onClose, }) {
197
- const generateClasses = React.useMemo(() => ({
198
- 'd-chip': true,
199
- [`d-chip-${theme}`]: !!theme,
200
- }), [theme]);
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" }) }))] }));
202
- }
203
-
204
- function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
205
- const [toggle, setToggle] = React.useState(defaultCollapsed);
206
- const onChangeCollapse = () => setToggle((prev) => !prev);
207
- React.useEffect(() => {
208
- if (onChange) {
209
- onChange(toggle);
210
- }
211
- }, [toggle, onChange]);
212
- React.useEffect(() => {
213
- setToggle(defaultCollapsed);
214
- }, [defaultCollapsed]);
215
- const generateStyles = React.useMemo(() => ({
216
- [`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
217
- }), [hasSeparator]);
218
- return (jsxRuntime.jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsxRuntime.jsx("div", { className: classNames({
219
- 'collapse-body': true,
220
- }), style: generateStyles, children: children }))] }));
221
- }
222
-
223
- function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, className, style, }) {
224
- return (jsxRuntime.jsx(DCollapse, { defaultCollapsed: true, className: classNames('d-collapse-icon-text', className), style: style, Component: (jsxRuntime.jsxs("div", { className: "d-collapse-icon-text-header", children: [jsxRuntime.jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsxRuntime.jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
92
+ const generateClasses = React.useMemo(() => (Object.assign(Object.assign({ 'd-icon': true, [familyClass]: true, 'd-icon-loading': loading }, !materialStyle && {
93
+ [`${familyPrefix}${icon}`]: true,
94
+ }), className && { [className]: true })), [
95
+ familyClass,
96
+ loading,
97
+ className,
98
+ materialStyle,
99
+ familyPrefix,
100
+ icon,
101
+ ]);
102
+ return (jsxRuntime.jsx("i", { className: classNames(generateClasses), style: generateStyleVariables, children: materialStyle && icon }));
225
103
  }
226
104
 
227
105
  const defaultState = {
@@ -232,13 +110,19 @@ const defaultState = {
232
110
  separator: ',',
233
111
  decimal: '.',
234
112
  },
113
+ icon: {
114
+ familyClass: 'bi',
115
+ familyPrefix: 'bi-',
116
+ materialStyle: false,
117
+ },
235
118
  setContext: () => { },
236
119
  };
237
120
  const DContext = React.createContext(defaultState);
238
- function DContextProvider({ language = defaultState.language, currency = defaultState.currency, children, }) {
121
+ function DContextProvider({ language = defaultState.language, currency = defaultState.currency, icon = defaultState.icon, children, }) {
239
122
  const [internalContext, setInternalContext,] = React.useState({
240
123
  language,
241
124
  currency,
125
+ icon,
242
126
  });
243
127
  const value = React.useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext: (newValue) => setInternalContext(newValue) })), [internalContext]);
244
128
  return (jsxRuntime.jsx(DContext.Provider, { value: value, children: children }));
@@ -401,6 +285,143 @@ function useDOffcanvasContext() {
401
285
  return context;
402
286
  }
403
287
 
288
+ function DIcon(_a) {
289
+ var { familyClass: propFamilyClass, familyPrefix: propFamilyPrefix, materialStyle: propMaterialStyle } = _a, props = tslib.__rest(_a, ["familyClass", "familyPrefix", "materialStyle"]);
290
+ const { icon: { familyClass, familyPrefix, materialStyle, }, } = useDContext();
291
+ return (jsxRuntime.jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
292
+ }
293
+
294
+ function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary, }) {
295
+ 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] })] }));
296
+ }
297
+
298
+ function DAlert({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = true, soft = false, showClose, onClose, children, id, className, style, }) {
299
+ const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose, 'alert-soft': soft }, className && { [className]: true })), [type, showClose, soft, className]);
300
+ const getIcon = React.useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
301
+ const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
302
+ 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 }) }))] }));
303
+ }
304
+
305
+ function DBoxFile(_a) {
306
+ var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, disabled = false, children, className, style } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "disabled", "children", "className", "style"]);
307
+ const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled }, dropzoneOptions));
308
+ return (jsxRuntime.jsxs("section", { className: classNames('d-box-file', {
309
+ 'd-box-file-selected': !!acceptedFiles.length,
310
+ }, className), style: style, children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
311
+ className: classNames('d-box-file-dropzone', {
312
+ disabled,
313
+ }),
314
+ }), { 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))) }))] }));
315
+ }
316
+
317
+ 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, form, onClick, }) {
318
+ const generateClasses = React.useMemo(() => {
319
+ const variantClass = variant
320
+ ? `btn-${variant}-${theme}`
321
+ : `btn-${theme}`;
322
+ return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
323
+ }, [variant, theme, size, state, loading]);
324
+ const generateStyleVariables = React.useMemo(() => {
325
+ if (pill) {
326
+ return {
327
+ [`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
328
+ [`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
329
+ [`--${PREFIX_BS}btn-component-sm-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
330
+ };
331
+ }
332
+ return {};
333
+ }, [pill]);
334
+ const clickHandler = React.useCallback((event) => {
335
+ if (stopPropagationEnabled) {
336
+ event.stopPropagation();
337
+ }
338
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
339
+ }, [stopPropagationEnabled, onClick]);
340
+ const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
341
+ const newAriaLabel = React.useMemo(() => (loading
342
+ ? (loadingAriaLabel || ariaLabel || text)
343
+ : (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
344
+ return (jsxRuntime.jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, 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 }))] })));
345
+ }
346
+
347
+ function DCardHeader({ className, style, children, }) {
348
+ return (jsxRuntime.jsx("div", { className: classNames('card-header', className), style: style, children: children }));
349
+ }
350
+
351
+ function DCardBody({ className, style, children, }) {
352
+ return (jsxRuntime.jsx("div", { className: classNames('card-body', className), style: style, children: children }));
353
+ }
354
+
355
+ function DCardFooter({ className, style, children, }) {
356
+ return (jsxRuntime.jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
357
+ }
358
+
359
+ function DCard({ className, style, children, }) {
360
+ return (jsxRuntime.jsx("div", { style: style, className: classNames('card', className), children: children }));
361
+ }
362
+ var DCard$1 = Object.assign(DCard, {
363
+ Header: DCardHeader,
364
+ Body: DCardBody,
365
+ Footer: DCardFooter,
366
+ });
367
+
368
+ function DCardAccount({ className, style, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
369
+ return (jsxRuntime.jsx(DCard$1, { className: classNames('d-card-account', className), style: style, children: jsxRuntime.jsxs(DCard$1.Body, { children: [jsxRuntime.jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsxRuntime.jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxRuntime.jsxs("div", { className: "d-block flex-grow-1", children: [jsxRuntime.jsx("p", { className: "text-gray-700", children: name }), jsxRuntime.jsx("small", { className: "text-gray-500", children: number })] })] }), jsxRuntime.jsxs("div", { className: "d-block", children: [jsxRuntime.jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsxRuntime.jsx("small", { className: "text-gray-700", children: balanceText })] }), jsxRuntime.jsx("div", { className: "d-flex justify-content-end", children: jsxRuntime.jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
370
+ }
371
+
372
+ function DCarouselSlide(_a) {
373
+ var { className } = _a, props = tslib.__rest(_a, ["className"]);
374
+ return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
375
+ }
376
+
377
+ function DCarousel(_a) {
378
+ var { children, className, style, options } = _a, props = tslib.__rest(_a, ["children", "className", "style", "options"]);
379
+ return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
380
+ // Arrows
381
+ arrows: 'splide__arrows d-carousel-arrows',
382
+ arrow: 'splide__arrow d-carousel-arrow',
383
+ prev: 'splide__arrow--prev d-carousel-arrow-prev',
384
+ next: 'splide__arrow--next d-carousel-arrow-next',
385
+ // Paginator
386
+ pagination: 'splide__pagination d-carousel-pagination',
387
+ page: 'splide__pagination__page d-carousel-pagination-page',
388
+ } }) }, props, { children: children })));
389
+ }
390
+ var DCarousel$1 = Object.assign(DCarousel, {
391
+ Slide: DCarouselSlide,
392
+ });
393
+
394
+ function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, closeAriaLabel = 'close', className, style, onClose, }) {
395
+ const generateClasses = React.useMemo(() => ({
396
+ 'd-chip': true,
397
+ [`d-chip-${theme}`]: !!theme,
398
+ }), [theme]);
399
+ 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" }) }))] }));
400
+ }
401
+
402
+ function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
403
+ const [toggle, setToggle] = React.useState(defaultCollapsed);
404
+ const onChangeCollapse = () => setToggle((prev) => !prev);
405
+ React.useEffect(() => {
406
+ if (onChange) {
407
+ onChange(toggle);
408
+ }
409
+ }, [toggle, onChange]);
410
+ React.useEffect(() => {
411
+ setToggle(defaultCollapsed);
412
+ }, [defaultCollapsed]);
413
+ const generateStyles = React.useMemo(() => ({
414
+ [`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
415
+ }), [hasSeparator]);
416
+ return (jsxRuntime.jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsxRuntime.jsx("div", { className: classNames({
417
+ 'collapse-body': true,
418
+ }), style: generateStyles, children: children }))] }));
419
+ }
420
+
421
+ function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, className, style, }) {
422
+ return (jsxRuntime.jsx(DCollapse, { defaultCollapsed: true, className: classNames('d-collapse-icon-text', className), style: style, Component: (jsxRuntime.jsxs("div", { className: "d-collapse-icon-text-header", children: [jsxRuntime.jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsxRuntime.jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
423
+ }
424
+
404
425
  function formatCurrency(amount, options) {
405
426
  return currency(amount, options).format();
406
427
  }
@@ -1250,6 +1271,7 @@ exports.DContextProvider = DContextProvider;
1250
1271
  exports.DCurrencyText = DCurrencyText;
1251
1272
  exports.DDatePicker = DDatePicker;
1252
1273
  exports.DIcon = DIcon;
1274
+ exports.DIconBase = DIconBase;
1253
1275
  exports.DInput = DInput$1;
1254
1276
  exports.DInputCheck = DInputCheck;
1255
1277
  exports.DInputCounter = DInputCounter$1;