@delightui/components 0.1.105 → 0.1.107

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 (102) hide show
  1. package/README.md +104 -1
  2. package/dist/cjs/components/molecules/Modal/DemoModal.d.ts +8 -0
  3. package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
  4. package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
  5. package/dist/cjs/components/molecules/Modal/ModalContext/index.d.ts +3 -0
  6. package/dist/cjs/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
  7. package/dist/cjs/components/molecules/Modal/index.d.ts +2 -0
  8. package/dist/cjs/components/molecules/index.d.ts +2 -0
  9. package/dist/cjs/library.css +19 -6
  10. package/dist/cjs/library.js +3 -3
  11. package/dist/cjs/library.js.map +1 -1
  12. package/dist/esm/components/molecules/Modal/DemoModal.d.ts +8 -0
  13. package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
  14. package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
  15. package/dist/esm/components/molecules/Modal/ModalContext/index.d.ts +3 -0
  16. package/dist/esm/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
  17. package/dist/esm/components/molecules/Modal/index.d.ts +2 -0
  18. package/dist/esm/components/molecules/index.d.ts +2 -0
  19. package/dist/esm/library.css +19 -6
  20. package/dist/esm/library.js +3 -3
  21. package/dist/esm/library.js.map +1 -1
  22. package/dist/index.d.ts +108 -2
  23. package/docs/README.md +264 -0
  24. package/docs/components/atoms/ActionImage.md +119 -0
  25. package/docs/components/atoms/Button.md +197 -0
  26. package/docs/components/atoms/Checkbox.md +299 -0
  27. package/docs/components/atoms/CheckboxItem.md +314 -0
  28. package/docs/components/atoms/Chip.md +380 -0
  29. package/docs/components/atoms/CustomToggle.md +270 -0
  30. package/docs/components/atoms/Icon.md +365 -0
  31. package/docs/components/atoms/IconButton.md +407 -0
  32. package/docs/components/atoms/Image.md +448 -0
  33. package/docs/components/atoms/Input.md +430 -0
  34. package/docs/components/atoms/ListItem.md +502 -0
  35. package/docs/components/atoms/Password.md +472 -0
  36. package/docs/components/atoms/RadioButton.md +614 -0
  37. package/docs/components/atoms/RadioButtonItem.md +588 -0
  38. package/docs/components/atoms/ResponsiveComponent.md +612 -0
  39. package/docs/components/atoms/SelectListItem.md +609 -0
  40. package/docs/components/atoms/Slider.md +605 -0
  41. package/docs/components/atoms/Spinner.md +605 -0
  42. package/docs/components/atoms/Text.md +463 -0
  43. package/docs/components/atoms/TextArea.md +670 -0
  44. package/docs/components/atoms/ToastNotification.md +668 -0
  45. package/docs/components/atoms/Toggle.md +737 -0
  46. package/docs/components/atoms/ToggleButton.md +751 -0
  47. package/docs/components/atoms/Tooltip.md +391 -0
  48. package/docs/components/molecules/Accordion.md +440 -0
  49. package/docs/components/molecules/AccordionGroup.md +547 -0
  50. package/docs/components/molecules/ActionCard.md +546 -0
  51. package/docs/components/molecules/Breadcrumb.md +403 -0
  52. package/docs/components/molecules/Breadcrumbs.md +485 -0
  53. package/docs/components/molecules/ButtonGroup.md +383 -0
  54. package/docs/components/molecules/Card.md +298 -0
  55. package/docs/components/molecules/ChipInput.md +646 -0
  56. package/docs/components/molecules/ContextMenu.md +768 -0
  57. package/docs/components/molecules/CustomTimeSelector.md +116 -0
  58. package/docs/components/molecules/DatePicker.md +516 -0
  59. package/docs/components/molecules/DateTimeSelector.md +166 -0
  60. package/docs/components/molecules/FormField.md +312 -0
  61. package/docs/components/molecules/Grid.md +577 -0
  62. package/docs/components/molecules/GridItem.md +834 -0
  63. package/docs/components/molecules/GridList.md +244 -0
  64. package/docs/components/molecules/List.md +485 -0
  65. package/docs/components/molecules/Modal.md +470 -0
  66. package/docs/components/molecules/ModalFooter.md +702 -0
  67. package/docs/components/molecules/ModalHeader.md +756 -0
  68. package/docs/components/molecules/ModalProvider.md +205 -0
  69. package/docs/components/molecules/Nav.md +530 -0
  70. package/docs/components/molecules/NavItem.md +572 -0
  71. package/docs/components/molecules/NavLink.md +499 -0
  72. package/docs/components/molecules/Option.md +521 -0
  73. package/docs/components/molecules/Pagination.md +592 -0
  74. package/docs/components/molecules/PaginationNumberField.md +722 -0
  75. package/docs/components/molecules/Popover.md +516 -0
  76. package/docs/components/molecules/ProgressBar.md +624 -0
  77. package/docs/components/molecules/RadioGroup.md +831 -0
  78. package/docs/components/molecules/RepeaterList.md +185 -0
  79. package/docs/components/molecules/Select.md +402 -0
  80. package/docs/components/molecules/SortableTrigger.md +82 -0
  81. package/docs/components/molecules/useModal.md +379 -0
  82. package/docs/components/organisms/Dropzone.md +346 -0
  83. package/docs/components/organisms/DropzoneClear.md +135 -0
  84. package/docs/components/organisms/DropzoneContent.md +216 -0
  85. package/docs/components/organisms/DropzoneFilename.md +191 -0
  86. package/docs/components/organisms/DropzoneSupportedFormats.md +184 -0
  87. package/docs/components/organisms/DropzoneTrigger.md +209 -0
  88. package/docs/components/organisms/Form.md +533 -0
  89. package/docs/components/organisms/SlideOutPanel.md +662 -0
  90. package/docs/components/organisms/TabContent.md +902 -0
  91. package/docs/components/organisms/TabItem.md +1091 -0
  92. package/docs/components/organisms/Table.md +611 -0
  93. package/docs/components/organisms/TableBody.md +679 -0
  94. package/docs/components/organisms/TableCell.md +482 -0
  95. package/docs/components/organisms/TableHeader.md +513 -0
  96. package/docs/components/organisms/TableHeaderCell.md +661 -0
  97. package/docs/components/organisms/TableRow.md +715 -0
  98. package/docs/components/organisms/Tabs.md +1330 -0
  99. package/docs/components/utils/ConditionalView.md +568 -0
  100. package/docs/components/utils/RenderStateView.md +726 -0
  101. package/docs/components/utils/WrapTextNodes.md +614 -0
  102. package/package.json +3 -2
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ModalComponentProps } from './ModalContext';
3
+ interface DemoModalProps extends ModalComponentProps {
4
+ title?: string;
5
+ message?: string;
6
+ }
7
+ declare const DemoModal: React.FC<DemoModalProps>;
8
+ export default DemoModal;
@@ -0,0 +1,41 @@
1
+ import type { ModalContextType, ModalProviderProps } from './ModalContext.types';
2
+ /**
3
+ * Hook to access the modal context.
4
+ * Must be used within a ModalProvider component.
5
+ *
6
+ * @returns The modal context containing openModal and closeModal functions
7
+ * @throws Error if used outside of a ModalProvider
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function MyComponent() {
12
+ * const { openModal, closeModal } = useModalContext();
13
+ *
14
+ * const handleOpenModal = () => {
15
+ * openModal('my-modal', MyModalComponent, { title: 'Hello' });
16
+ * };
17
+ *
18
+ * return <button onClick={handleOpenModal}>Open Modal</button>;
19
+ * }
20
+ * ```
21
+ */
22
+ export declare const useModalContext: () => ModalContextType;
23
+ /**
24
+ * Provider component that manages modal state and renders modal instances.
25
+ * Wraps child components with modal context and renders all active modals.
26
+ *
27
+ * @param props - The provider props
28
+ * @param props.children - Child components that will have access to modal context
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * function App() {
33
+ * return (
34
+ * <ModalProvider>
35
+ * <MyApplication />
36
+ * </ModalProvider>
37
+ * );
38
+ * }
39
+ * ```
40
+ */
41
+ export declare const ModalProvider: ({ children }: ModalProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,87 @@
1
+ import type { ReactNode, ComponentType } from 'react';
2
+ /**
3
+ * Base props that all modal components must implement.
4
+ */
5
+ export type ModalComponentProps = {
6
+ /** Controls whether the modal is visible */
7
+ show?: boolean;
8
+ /** Callback function to handle modal cancellation/dismissal */
9
+ onCancel?: () => void;
10
+ };
11
+ /**
12
+ * Represents a modal instance stored in the modal context state.
13
+ */
14
+ export type ModalInstance = {
15
+ /** Unique identifier for the modal instance */
16
+ id: string;
17
+ /** The rendered React component for the modal */
18
+ component: ReactNode;
19
+ };
20
+ /**
21
+ * The context type that provides modal management functionality.
22
+ */
23
+ export type ModalContextType = {
24
+ /**
25
+ * Opens a new modal with the specified component and props.
26
+ *
27
+ * @template T - The props type for the modal component (must extend ModalComponentProps)
28
+ * @param id - Unique identifier for the modal instance
29
+ * @param Component - React component to render as the modal
30
+ * @param props - Props to pass to the modal component
31
+ * @returns void
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * const { openModal } = useModalContext();
36
+ *
37
+ * openModal('confirmation', ConfirmationModal, {
38
+ * title: 'Are you sure?',
39
+ * show: true,
40
+ * onCancel: () => console.log('cancelled'),
41
+ * onConfirm: () => console.log('confirmed')
42
+ * });
43
+ * ```
44
+ */
45
+ openModal: <T extends ModalComponentProps>(id: string, Component: ComponentType<T>, props: T) => void;
46
+ /**
47
+ * Closes and removes a modal by its unique identifier.
48
+ *
49
+ * @param id - The unique identifier of the modal to close
50
+ * @returns void
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * const { closeModal } = useModalContext();
55
+ * closeModal('confirmation');
56
+ * ```
57
+ */
58
+ closeModal: (id: string) => void;
59
+ };
60
+ /**
61
+ * Props for the ModalProvider component.
62
+ */
63
+ export type ModalProviderProps = {
64
+ /** Child components that will have access to the modal context */
65
+ children: ReactNode;
66
+ };
67
+ /**
68
+ * Return type for the useModal hook when a component type is provided.
69
+ */
70
+ export type UseModalReturn<T extends ModalComponentProps> = {
71
+ /**
72
+ * Opens the modal with the specified props.
73
+ * Uses the component type provided to the hook.
74
+ *
75
+ * @param props - Props to pass to the modal component
76
+ * @returns void
77
+ */
78
+ openModal: (props: T) => void;
79
+ /**
80
+ * Closes the modal instance managed by this hook.
81
+ *
82
+ * @returns void
83
+ */
84
+ closeModal: () => void;
85
+ /** The unique identifier for this modal instance */
86
+ modalId: string;
87
+ };
@@ -0,0 +1,3 @@
1
+ export { ModalProvider } from './ModalContext';
2
+ export { useModal } from './useModal';
3
+ export type { ModalProviderProps, ModalComponentProps, UseModalReturn } from './ModalContext.types';
@@ -0,0 +1,34 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { ModalComponentProps, UseModalReturn } from './ModalContext.types';
3
+ /**
4
+ * Custom hook that provides an abstraction layer over the modal context.
5
+ * Takes a component type and returns functions to open/close that specific modal.
6
+ * Uses React's useId hook to generate a unique identifier for the modal instance.
7
+ *
8
+ * @template T - The props type for the modal component (must extend ModalComponentProps)
9
+ * @param Component - React component to use for the modal
10
+ * @returns An object containing openModal, closeModal functions and the modalId
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * function MyComponent() {
15
+ * const confirmationModal = useModal(ConfirmationModal);
16
+ *
17
+ * const handleDelete = () => {
18
+ * confirmationModal.openModal({
19
+ * title: 'Delete Item',
20
+ * message: 'Are you sure you want to delete this item?',
21
+ * show: true,
22
+ * onConfirm: () => {
23
+ * // perform delete
24
+ * confirmationModal.closeModal();
25
+ * },
26
+ * onCancel: confirmationModal.closeModal
27
+ * });
28
+ * };
29
+ *
30
+ * return <button onClick={handleDelete}>Delete</button>;
31
+ * }
32
+ * ```
33
+ */
34
+ export declare const useModal: <T extends ModalComponentProps>(Component: ComponentType<T>) => UseModalReturn<T>;
@@ -2,3 +2,5 @@ import Modal from './Modal';
2
2
  import type { ModalProps } from './Modal.types';
3
3
  export type { ModalProps };
4
4
  export default Modal;
5
+ export { ModalProvider, useModal } from './ModalContext';
6
+ export type { ModalProviderProps, ModalComponentProps, UseModalReturn } from './ModalContext';
@@ -17,6 +17,7 @@ export { default as Pagination } from './Pagination';
17
17
  export { default as PaginationNumberField } from './PaginationNumberField';
18
18
  export { default as Popover } from './Popover';
19
19
  export { default as ProgressBar } from './ProgressBar';
20
+ export { default as RadioGroup } from './RadioGroup';
20
21
  export { Option, default as Select } from './Select';
21
22
  export { default as ChipInput } from './ChipInput';
22
23
  export * from './Accordion';
@@ -38,5 +39,6 @@ export * from './Pagination';
38
39
  export * from './PaginationNumberField';
39
40
  export * from './Popover';
40
41
  export * from './ProgressBar';
42
+ export * from './RadioGroup';
41
43
  export * from './Select';
42
44
  export * from './ChipInput';
@@ -3555,6 +3555,19 @@ span.flatpickr-weekday {
3555
3555
  .ProgressBar-module_progressBar__FcALd.ProgressBar-module_Horizontal__K0u1- {
3556
3556
  flex-direction: row;
3557
3557
  }
3558
+ .RadioGroup-module_radioGroup__zODB0 {
3559
+ display: flex;
3560
+ gap: 4px;
3561
+ gap: var(--radio-group-gap, 4px);
3562
+ }
3563
+ .RadioGroup-module_radioGroup__zODB0.RadioGroup-module_vertical__Y3hNS {
3564
+ flex-direction: column;
3565
+ }
3566
+ .RadioGroup-module_radioGroup__zODB0.RadioGroup-module_horizontal__gypXB {
3567
+ flex-direction: row;
3568
+ width: 100%;
3569
+ width: var(--radio-group-width, 100%);
3570
+ }
3558
3571
  .Option-module_option__EOKym {
3559
3572
  display: flex;
3560
3573
  width: 100%;
@@ -4601,20 +4614,20 @@ span.flatpickr-weekday {
4601
4614
  }
4602
4615
  [data-theme='dark'] [component-variant="text-bodysmall-regular"], [data-theme='light'] [component-variant="text-bodysmall-regular"] {
4603
4616
  --text-font-family: var(--font-family-body);
4604
- --text-font-size: 13px;
4605
- --text-font-weight: 400;
4606
- --text-line-height: 16px
4617
+ --text-font-size: var(--font-size-body-small);
4618
+ --text-font-weight: var(--font-weight-regular);
4619
+ --text-line-height: var(--line-height-body-small)
4607
4620
  }
4608
4621
  [data-theme='dark'] [component-variant="text-bodymedium-regular"], [data-theme='light'] [component-variant="text-bodymedium-regular"] {
4609
4622
  --text-font-family: var(--font-family-body);
4610
4623
  --text-font-size: var(--font-size-body-medium);
4611
- --text-font-weight: 400;
4612
- --text-line-height: var(--font-size-body-medium)
4624
+ --text-font-weight: var(--font-weight-regular);
4625
+ --text-line-height: var(--line-height-body-medium)
4613
4626
  }
4614
4627
  [data-theme='dark'] [component-variant="text-bodylarge-regular"], [data-theme='light'] [component-variant="text-bodylarge-regular"] {
4615
4628
  --text-font-family: var(--font-family-body);
4616
4629
  --text-font-size: var(--font-size-body-large);
4617
- --text-font-weight: 400;
4630
+ --text-font-weight: var(--font-weight-regular);
4618
4631
  --text-line-height: var(--line-height-body-large)
4619
4632
  }
4620
4633
  [data-theme='dark'] [component-variant="text-bodysmall-medium"], [data-theme='light'] [component-variant="text-bodysmall-medium"] {