@dynamic-framework/ui-react 1.15.1 → 1.16.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.
Files changed (54) hide show
  1. package/{LICENSE → LICENSE.md} +2 -2
  2. package/dist/css/dynamic-ui-non-root.css +1993 -2026
  3. package/dist/css/dynamic-ui-non-root.min.css +6 -1
  4. package/dist/css/dynamic-ui-root.css +6 -1
  5. package/dist/css/dynamic-ui-root.min.css +6 -1
  6. package/dist/css/dynamic-ui.css +1994 -2027
  7. package/dist/css/dynamic-ui.min.css +6 -1
  8. package/dist/index.esm.js +38 -47
  9. package/dist/index.esm.js.map +1 -1
  10. package/dist/index.js +36 -48
  11. package/dist/index.js.map +1 -1
  12. package/dist/js/bootstrap.bundle.js +8 -8
  13. package/dist/js/bootstrap.bundle.min.js +3 -3
  14. package/dist/js/bootstrap.esm.js +8 -8
  15. package/dist/js/bootstrap.esm.min.js +3 -3
  16. package/dist/js/bootstrap.js +8 -8
  17. package/dist/js/bootstrap.min.js +3 -3
  18. package/dist/types/components/DBadge/DBadge.d.ts +2 -1
  19. package/dist/types/components/DTabs/DTabs.d.ts +2 -1
  20. package/dist/types/components/index.d.ts +0 -1
  21. package/dist/types/contexts/DContext.d.ts +2 -2
  22. package/package.json +8 -6
  23. package/src/style/abstracts/variables/_+import.scss +1 -1
  24. package/src/style/abstracts/variables/_accordion.scss +14 -6
  25. package/src/style/abstracts/variables/_box-shadow.scss +1 -1
  26. package/src/style/abstracts/variables/_buttons.scss +3 -3
  27. package/src/style/abstracts/variables/_cards.scss +2 -2
  28. package/src/style/abstracts/variables/_close.scss +2 -2
  29. package/src/style/abstracts/variables/_dropdowns.scss +11 -7
  30. package/src/style/abstracts/variables/_forms.scss +23 -19
  31. package/src/style/abstracts/variables/_modals.scss +1 -5
  32. package/src/style/abstracts/variables/_navs.scss +2 -2
  33. package/src/style/base/_+import.scss +35 -1
  34. package/src/style/base/_accordion.scss +19 -0
  35. package/src/style/base/_breadcrumb.scss +10 -0
  36. package/src/style/{components/_d-button.scss → base/_button.scss} +15 -1
  37. package/src/style/base/_dropdown.scss +3 -0
  38. package/src/style/components/_+import.scss +0 -36
  39. package/src/style/components/_d-modal.scss +0 -5
  40. package/src/style/components/_d-tabs.scss +10 -19
  41. package/src/style/helpers/_color-bg.scss +12 -0
  42. package/dist/types/components/banking/DPermissionGroup.d.ts +0 -11
  43. package/dist/types/components/banking/DPermissionItem.d.ts +0 -9
  44. package/dist/types/components/banking/DSummaryCard.d.ts +0 -12
  45. package/dist/types/components/banking/index.d.ts +0 -3
  46. package/dist/types/components/banking/interface.d.ts +0 -7
  47. package/src/style/components/_d-badge.scss +0 -26
  48. package/src/style/components/_d-permission-group.scss +0 -39
  49. /package/src/style/{components/_d-alert.scss → base/_alert.scss} +0 -0
  50. /package/src/style/{components/_d-collapse.scss → base/_collapse.scss} +0 -0
  51. /package/src/style/{components/_d-input-check.scss → base/_form-check.scss} +0 -0
  52. /package/src/style/{components/_d-input-switch.scss → base/_form-switch.scss} +0 -0
  53. /package/src/style/{components/_d-paginator.scss → base/_pagination.scss} +0 -0
  54. /package/src/style/{components/_d-progress.scss → base/_progress.scss} +0 -0
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import React, { useMemo, useState, useEffect, useCallback, createContext, useContext, forwardRef, useRef } from 'react';
2
+ import React, { useMemo, createContext, useState, useCallback, useContext, useEffect, forwardRef, useRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { __rest } from 'tslib';
5
5
  import { useDropzone } from 'react-dropzone';
@@ -17,36 +17,6 @@ import i18n from 'i18next';
17
17
  import { initReactI18next } from 'react-i18next';
18
18
  import { createPortal } from 'react-dom';
19
19
 
20
- function DBadge({ text, dot = false, theme = 'primary', id, className, style, }) {
21
- const generateClasses = useMemo(() => ({
22
- badge: true,
23
- 'badge-dot': dot,
24
- [`badge-${theme}`]: !!theme,
25
- }), [dot, theme]);
26
- return (jsx("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, { children: jsx("span", { children: text }) })));
27
- }
28
-
29
- function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly, className, style, onChange, }) {
30
- const [internalIsChecked, setInternalIsChecked] = useState(checked);
31
- useEffect(() => {
32
- setInternalIsChecked(checked);
33
- }, [checked]);
34
- const changeHandler = useCallback((event) => {
35
- const value = event.currentTarget.checked;
36
- setInternalIsChecked(value);
37
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
38
- }, [onChange]);
39
- 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 }))] }));
40
- }
41
-
42
- function DPermissionItem({ permission, permissionState, onChange, onAction = () => { }, }) {
43
- return (jsxs("div", { role: "button", tabIndex: 0, onKeyDown: () => { }, className: "d-flex permission-item align-items-center", onClick: onAction, children: [jsx("span", { className: "flex-grow-1 label", children: permission.label }), permission.type === 'custom' && (jsx(DBadge, { theme: "tertiary", text: permissionState })), jsx(DInputSwitch, { id: permission.id, checked: !!permission.value, disabled: !permission.enabled, onChange: (isChecked) => onChange(isChecked) })] }));
44
- }
45
-
46
- function DPermissionGroup({ title, description, permissionState, permissionList, onChangePermission, onCustomAction = () => { }, }) {
47
- return (jsxs("div", { className: "row operation-group g-0 mb-3 mb-lg-0", children: [jsxs("div", { className: "col-12 col-lg-4 d-flex flex-column justify-content-center", children: [jsx("h6", { className: "fw-bold mb-3 mb-lg-2", children: title }), jsx("p", { className: "fs-8 d-none d-lg-block m-0", children: description })] }), jsx("div", { className: "col-12 offset-lg-1 col-lg-7", children: permissionList.map((permission) => (jsx(DPermissionItem, { permission: permission, permissionState: permissionState, onChange: (checked) => onChangePermission(permission, checked), onAction: () => onCustomAction(permission) }, permission.id))) })] }));
48
- }
49
-
50
20
  const PREFIX_BS = 'bs-';
51
21
 
52
22
  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-', }) {
@@ -144,7 +114,8 @@ function DContextProvider({ language = defaultState.language, currency = default
144
114
  icon,
145
115
  iconMap,
146
116
  });
147
- const value = useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext: (newValue) => setInternalContext(newValue) })), [internalContext]);
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]);
148
119
  return (jsx(DContext.Provider, { value: value, children: children }));
149
120
  }
150
121
  function useDContext() {
@@ -311,10 +282,6 @@ function DIcon(_a) {
311
282
  return (jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
312
283
  }
313
284
 
314
- function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary, }) {
315
- return (jsxs("div", { children: [jsx("h6", { className: "fw-bold fs-6", children: title }), jsx("p", { className: "fs-8", children: description }), jsxs("div", { className: "bg-white rounded p-4 d-flex gap-3 shadow-sm text-gray-700 fs-8", children: [jsx(DIcon, { icon: icon, theme: iconTheme, size: iconSize }), Summary] })] }));
316
- }
317
-
318
285
  function DAlert({ type = 'success', icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle = false, showIcon = true, soft = false, showClose, onClose, children, id, className, style, }) {
319
286
  const { iconMap: { alert, xLg, }, } = useDContext();
320
287
  const icon = useMemo(() => iconProp || alert[type], [alert, iconProp, type]);
@@ -324,6 +291,16 @@ function DAlert({ type = 'success', icon: iconProp, iconFamilyClass, iconFamilyP
324
291
  return (jsxs("div", { className: classNames(generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsx(DIcon, { className: "alert-icon", icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsx("div", { className: "alert-text", children: children }), showClose && (jsx("div", { className: "alert-separator" })), showClose && (jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { className: "alert-close-icon", icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] }));
325
292
  }
326
293
 
294
+ function DBadge({ text, dot = false, soft = false, theme = 'primary', id, className, style, }) {
295
+ const generateClasses = useMemo(() => ({
296
+ badge: true,
297
+ 'rounded-circle p-2': dot,
298
+ [`text-bg-${theme}`]: !!theme && !soft,
299
+ [`text-bg-soft-${theme}`]: !!theme && soft,
300
+ }), [dot, soft, theme]);
301
+ return (jsx("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, { children: jsx("span", { children: text }) })));
302
+ }
303
+
327
304
  function DBoxFile(_a) {
328
305
  var { icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, disabled = false, children, className, style } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "disabled", "children", "className", "style"]);
329
306
  const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled }, dropzoneOptions));
@@ -917,6 +894,19 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
917
894
  }), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, iconEnd && !loading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text form-control-icon loading", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
918
895
  }
919
896
 
897
+ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly, className, style, onChange, }) {
898
+ const [internalIsChecked, setInternalIsChecked] = useState(checked);
899
+ useEffect(() => {
900
+ setInternalIsChecked(checked);
901
+ }, [checked]);
902
+ const changeHandler = useCallback((event) => {
903
+ const value = event.currentTarget.checked;
904
+ setInternalIsChecked(value);
905
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
906
+ }, [onChange]);
907
+ 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 }))] }));
908
+ }
909
+
920
910
  function DSelectOptionCheck(_a) {
921
911
  var { innerProps, children, isSelected } = _a, props = __rest(_a, ["innerProps", "children", "isSelected"]);
922
912
  return (jsx(components.Option, Object.assign({ className: classNames({
@@ -1046,15 +1036,15 @@ var DList$1 = Object.assign(DList, {
1046
1036
  function DModalHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
1047
1037
  const { iconMap: { xLg, }, } = useDContext();
1048
1038
  const icon = useMemo(() => iconProp || xLg, [iconProp, xLg]);
1049
- return (jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsx("div", { className: "d-modal-slot", children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
1039
+ return (jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
1050
1040
  }
1051
1041
 
1052
1042
  function DModalBody({ children, className, style, }) {
1053
- return (jsx("div", { className: classNames('d-modal-slot modal-body', className), style: style, children: children }));
1043
+ return (jsx("div", { className: classNames('modal-body', className), style: style, children: children }));
1054
1044
  }
1055
1045
 
1056
1046
  function DModalFooter({ className, style, actionPlacement = 'fill', children, }) {
1057
- return (jsxs(Fragment, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: classNames(`d-modal-slot modal-footer d-modal-action-${actionPlacement}`, className), style: style, children: children })] }));
1047
+ return (jsxs(Fragment, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: classNames(`modal-footer d-modal-action-${actionPlacement}`, className), style: style, children: children })] }));
1058
1048
  }
1059
1049
 
1060
1050
  function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, size, children, }) {
@@ -1083,15 +1073,15 @@ var DModal$1 = Object.assign(DModal, {
1083
1073
  function DOffcanvasHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
1084
1074
  const { iconMap: { xLg, }, } = useDContext();
1085
1075
  const icon = useMemo(() => iconProp || xLg, [iconProp, xLg]);
1086
- return (jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsx("div", { className: "d-offcanvas-slot", children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-offcanvas-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
1076
+ return (jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-offcanvas-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }));
1087
1077
  }
1088
1078
 
1089
1079
  function DOffcanvasBody({ children, className, style, }) {
1090
- return (jsx("div", { className: classNames('d-offcanvas-slot offcanvas-body', className), style: style, children: children }));
1080
+ return (jsx("div", { className: classNames('offcanvas-body', className), style: style, children: children }));
1091
1081
  }
1092
1082
 
1093
1083
  function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className, style, }) {
1094
- return (jsx("div", { className: classNames(`d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, className), style: style, children: children }));
1084
+ return (jsx("div", { className: classNames(`d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, className), style: style, children: children }));
1095
1085
  }
1096
1086
 
1097
1087
  function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', children, }) {
@@ -1341,7 +1331,7 @@ function DTabContent({ tab, children, className, style, }) {
1341
1331
  return (jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
1342
1332
  }
1343
1333
 
1344
- function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, }) {
1334
+ function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, pill, }) {
1345
1335
  const [selected, setSelected] = useState(defaultSelected);
1346
1336
  const onSelect = useCallback((option) => {
1347
1337
  if (option.tab) {
@@ -1356,10 +1346,11 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
1356
1346
  const value = useMemo(() => ({
1357
1347
  isSelected,
1358
1348
  }), [isSelected]);
1349
+ const generateClasses = useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical, 'nav-pills': pill, 'nav-tabs': !pill }, className && { [className]: true })), [vertical, pill, className]);
1359
1350
  return (jsx(TabContext.Provider, { value: value, children: jsxs("div", { className: classNames({
1360
- 'd-tabs': true,
1361
- 'd-tabs-vertical': vertical,
1362
- }, className), style: style, children: [jsx("nav", { className: "nav", children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
1351
+ 'd-flex': true,
1352
+ 'flex-column': !vertical,
1353
+ }, className), style: style, children: [jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
1363
1354
  active: option.tab === selected,
1364
1355
  }, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.label))) }), jsx("div", { className: "tab-content", children: children })] }) }));
1365
1356
  }
@@ -1398,5 +1389,5 @@ async function configureI8n(resources, _a = {}) {
1398
1389
  .then((t) => t);
1399
1390
  }
1400
1391
 
1401
- 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, DModalContext, DModalContextProvider, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasContext, DOffcanvasContextProvider, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPermissionGroup, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DSummaryCard, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDModalContext, useDOffcanvasContext, useDisableBodyScrollEffect, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
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, DModalContext, DModalContextProvider, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasContext, DOffcanvasContextProvider, 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, useDModalContext, useDOffcanvasContext, useDisableBodyScrollEffect, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
1402
1393
  //# sourceMappingURL=index.esm.js.map