@dynamic-framework/ui-react 1.15.1 → 1.16.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.
Files changed (38) hide show
  1. package/dist/css/dynamic-ui-non-root.css +1879 -1893
  2. package/dist/css/dynamic-ui-non-root.min.css +4 -1
  3. package/dist/css/dynamic-ui-root.css +3 -0
  4. package/dist/css/dynamic-ui-root.min.css +3 -0
  5. package/dist/css/dynamic-ui.css +1879 -1893
  6. package/dist/css/dynamic-ui.min.css +4 -1
  7. package/dist/index.esm.js +29 -38
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +27 -39
  10. package/dist/index.js.map +1 -1
  11. package/dist/types/components/DBadge/DBadge.d.ts +2 -1
  12. package/dist/types/components/index.d.ts +0 -1
  13. package/dist/types/contexts/DContext.d.ts +2 -2
  14. package/package.json +4 -3
  15. package/src/style/abstracts/variables/_accordion.scss +14 -6
  16. package/src/style/abstracts/variables/_buttons.scss +3 -3
  17. package/src/style/abstracts/variables/_close.scss +2 -2
  18. package/src/style/abstracts/variables/_modals.scss +2 -2
  19. package/src/style/base/_+import.scss +34 -1
  20. package/src/style/base/_accordion.scss +18 -0
  21. package/src/style/base/_breadcrumb.scss +10 -0
  22. package/src/style/{components/_d-button.scss → base/_button.scss} +15 -1
  23. package/src/style/components/_+import.scss +0 -36
  24. package/src/style/components/_d-modal.scss +1 -1
  25. package/src/style/helpers/_color-bg.scss +12 -0
  26. package/dist/types/components/banking/DPermissionGroup.d.ts +0 -11
  27. package/dist/types/components/banking/DPermissionItem.d.ts +0 -9
  28. package/dist/types/components/banking/DSummaryCard.d.ts +0 -12
  29. package/dist/types/components/banking/index.d.ts +0 -3
  30. package/dist/types/components/banking/interface.d.ts +0 -7
  31. package/src/style/components/_d-badge.scss +0 -26
  32. package/src/style/components/_d-permission-group.scss +0 -39
  33. /package/src/style/{components/_d-alert.scss → base/_alert.scss} +0 -0
  34. /package/src/style/{components/_d-collapse.scss → base/_collapse.scss} +0 -0
  35. /package/src/style/{components/_d-input-check.scss → base/_form-check.scss} +0 -0
  36. /package/src/style/{components/_d-input-switch.scss → base/_form-switch.scss} +0 -0
  37. /package/src/style/{components/_d-paginator.scss → base/_pagination.scss} +0 -0
  38. /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({
@@ -1050,7 +1040,8 @@ function DModalHeader({ showCloseButton, onClose, children, className, style, ic
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
+ const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}modal-component-body-padding`]: 0 })), [style]);
1044
+ return (jsx("div", { className: classNames('d-modal-slot modal-body', className), style: generateStyleVariables, children: children }));
1054
1045
  }
1055
1046
 
1056
1047
  function DModalFooter({ className, style, actionPlacement = 'fill', children, }) {
@@ -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