@arbor-education/design-system.components 0.2.0 → 0.2.2

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 (110) hide show
  1. package/.github/workflows/release.yml +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/dist/components/modal/Modal.d.ts +25 -0
  4. package/dist/components/modal/Modal.d.ts.map +1 -0
  5. package/dist/components/modal/Modal.js +22 -0
  6. package/dist/components/modal/Modal.js.map +1 -0
  7. package/dist/components/modal/Modal.stories.d.ts +13 -0
  8. package/dist/components/modal/Modal.stories.d.ts.map +1 -0
  9. package/dist/components/modal/Modal.stories.js +23 -0
  10. package/dist/components/modal/Modal.stories.js.map +1 -0
  11. package/dist/components/modal/Modal.test.d.ts +2 -0
  12. package/dist/components/modal/Modal.test.d.ts.map +1 -0
  13. package/dist/components/modal/Modal.test.js +131 -0
  14. package/dist/components/modal/Modal.test.js.map +1 -0
  15. package/dist/components/modal/ModalBody.d.ts +7 -0
  16. package/dist/components/modal/ModalBody.d.ts.map +1 -0
  17. package/dist/components/modal/ModalBody.js +7 -0
  18. package/dist/components/modal/ModalBody.js.map +1 -0
  19. package/dist/components/modal/ModalCloseButton.d.ts +3 -0
  20. package/dist/components/modal/ModalCloseButton.d.ts.map +1 -0
  21. package/dist/components/modal/ModalCloseButton.js +25 -0
  22. package/dist/components/modal/ModalCloseButton.js.map +1 -0
  23. package/dist/components/modal/ModalFooter.d.ts +7 -0
  24. package/dist/components/modal/ModalFooter.d.ts.map +1 -0
  25. package/dist/components/modal/ModalFooter.js +7 -0
  26. package/dist/components/modal/ModalFooter.js.map +1 -0
  27. package/dist/components/modal/ModalHeader.d.ts +7 -0
  28. package/dist/components/modal/ModalHeader.d.ts.map +1 -0
  29. package/dist/components/modal/ModalHeader.js +8 -0
  30. package/dist/components/modal/ModalHeader.js.map +1 -0
  31. package/dist/components/modal/ModalTitle.d.ts +3 -0
  32. package/dist/components/modal/ModalTitle.d.ts.map +1 -0
  33. package/dist/components/modal/ModalTitle.js +8 -0
  34. package/dist/components/modal/ModalTitle.js.map +1 -0
  35. package/dist/components/modal/modalManager/ModalManager.d.ts +7 -0
  36. package/dist/components/modal/modalManager/ModalManager.d.ts.map +1 -0
  37. package/dist/components/modal/modalManager/ModalManager.js +22 -0
  38. package/dist/components/modal/modalManager/ModalManager.js.map +1 -0
  39. package/dist/components/modal/modalManager/ModalManager.stories.d.ts +13 -0
  40. package/dist/components/modal/modalManager/ModalManager.stories.d.ts.map +1 -0
  41. package/dist/components/modal/modalManager/ModalManager.stories.js +110 -0
  42. package/dist/components/modal/modalManager/ModalManager.stories.js.map +1 -0
  43. package/dist/components/modal/modalManager/ModalManager.test.d.ts +2 -0
  44. package/dist/components/modal/modalManager/ModalManager.test.d.ts.map +1 -0
  45. package/dist/components/modal/modalManager/ModalManager.test.js +191 -0
  46. package/dist/components/modal/modalManager/ModalManager.test.js.map +1 -0
  47. package/dist/components/table/Table.d.ts +10 -1
  48. package/dist/components/table/Table.d.ts.map +1 -1
  49. package/dist/components/table/Table.js +25 -7
  50. package/dist/components/table/Table.js.map +1 -1
  51. package/dist/components/table/Table.stories.d.ts.map +1 -1
  52. package/dist/components/table/Table.stories.js +6 -0
  53. package/dist/components/table/Table.stories.js.map +1 -1
  54. package/dist/components/table/Table.test.js +92 -31
  55. package/dist/components/table/Table.test.js.map +1 -1
  56. package/dist/components/table/pagination/TableSettingsDropdown.js +1 -1
  57. package/dist/components/table/pagination/TableSettingsDropdown.js.map +1 -1
  58. package/dist/components/table/toggleRowSelectionInCurrentRange.d.ts +3 -0
  59. package/dist/components/table/toggleRowSelectionInCurrentRange.d.ts.map +1 -0
  60. package/dist/components/table/toggleRowSelectionInCurrentRange.js +132 -0
  61. package/dist/components/table/toggleRowSelectionInCurrentRange.js.map +1 -0
  62. package/dist/components/table/useTableSettings.d.ts +4 -4
  63. package/dist/components/table/useTableSettings.d.ts.map +1 -1
  64. package/dist/components/table/useTableSettings.js +12 -4
  65. package/dist/components/table/useTableSettings.js.map +1 -1
  66. package/dist/index.css +74 -3
  67. package/dist/index.css.map +1 -1
  68. package/dist/index.d.ts +2 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +2 -0
  71. package/dist/index.js.map +1 -1
  72. package/dist/utils/Constants.d.ts +5 -0
  73. package/dist/utils/Constants.d.ts.map +1 -1
  74. package/dist/utils/Constants.js +5 -0
  75. package/dist/utils/Constants.js.map +1 -1
  76. package/dist/utils/ModalUtils.d.ts +7 -0
  77. package/dist/utils/ModalUtils.d.ts.map +1 -0
  78. package/dist/utils/ModalUtils.js +14 -0
  79. package/dist/utils/ModalUtils.js.map +1 -0
  80. package/dist/utils/setAgGridLicenseKey.d.ts +2 -0
  81. package/dist/utils/setAgGridLicenseKey.d.ts.map +1 -0
  82. package/dist/utils/setAgGridLicenseKey.js +11 -0
  83. package/dist/utils/setAgGridLicenseKey.js.map +1 -0
  84. package/package.json +1 -1
  85. package/src/components/modal/Modal.stories.tsx +37 -0
  86. package/src/components/modal/Modal.test.tsx +244 -0
  87. package/src/components/modal/Modal.tsx +65 -0
  88. package/src/components/modal/ModalBody.tsx +16 -0
  89. package/src/components/modal/ModalCloseButton.tsx +39 -0
  90. package/src/components/modal/ModalFooter.tsx +14 -0
  91. package/src/components/modal/ModalHeader.tsx +20 -0
  92. package/src/components/modal/ModalTitle.tsx +12 -0
  93. package/src/components/modal/modal.scss +74 -0
  94. package/src/components/modal/modalManager/ModalManager.stories.tsx +497 -0
  95. package/src/components/modal/modalManager/ModalManager.test.tsx +255 -0
  96. package/src/components/modal/modalManager/ModalManager.tsx +40 -0
  97. package/src/components/modal/modalManager/modalManager.scss +4 -0
  98. package/src/components/table/Table.stories.tsx +6 -0
  99. package/src/components/table/Table.test.tsx +148 -39
  100. package/src/components/table/Table.tsx +58 -7
  101. package/src/components/table/pagination/TableSettingsDropdown.tsx +2 -2
  102. package/src/components/table/table.scss +8 -6
  103. package/src/components/table/toggleRowSelectionInCurrentRange.ts +169 -0
  104. package/src/components/table/useTableSettings.ts +17 -5
  105. package/src/index.scss +2 -0
  106. package/src/index.ts +2 -0
  107. package/src/tokens.scss +1 -0
  108. package/src/utils/Constants.ts +6 -0
  109. package/src/utils/ModalUtils.ts +17 -0
  110. package/src/utils/setAgGridLicenseKey.ts +17 -0
@@ -131,4 +131,4 @@ jobs:
131
131
  uses: coverallsapp/github-action@v2
132
132
  continue-on-error: true
133
133
  with:
134
- github-token: ${{ secrets.ARBOR_AUTOMATION_ORG_GHA_TOKEN }}
134
+ github-token: ${{ secrets.GITHUB_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## 0.1.4
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#98](https://github.com/arbor-education/design-system.components/pull/98) [`4c10758`](https://github.com/arbor-education/design-system.components/commit/4c10758ba2dd30679d87828b2dada1281c5471a6) Thanks [@angusmglfraser](https://github.com/angusmglfraser)! - MIS-64989 implement drag-select on table
8
+
9
+ - [#102](https://github.com/arbor-education/design-system.components/pull/102) [`6c67a72`](https://github.com/arbor-education/design-system.components/commit/6c67a727f79841d45e5aa599cc79495c6fbf440c) Thanks [@angusmglfraser](https://github.com/angusmglfraser)! - MIS-67025 add ag grid license key
10
+
11
+ ## 0.2.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#99](https://github.com/arbor-education/design-system.components/pull/99) [`59c971b`](https://github.com/arbor-education/design-system.components/commit/59c971beb95e40648915ee1a3025765e0fcd3d1a) Thanks [@angusmglfraser](https://github.com/angusmglfraser)! - MIS-64986 add granular listeners for table setting update events
16
+
3
17
  ## 0.2.0
4
18
 
5
19
  ### Minor Changes
@@ -0,0 +1,25 @@
1
+ import { Dialog } from 'radix-ui';
2
+ type ModalContextValue = {
3
+ closeHandler?: () => void;
4
+ };
5
+ export declare const ModalContext: import("react").Context<ModalContextValue>;
6
+ export type ModalProps = {
7
+ className?: string;
8
+ overlayClassName?: string;
9
+ open?: boolean;
10
+ portalTarget?: HTMLElement | null;
11
+ children?: React.ReactNode;
12
+ hideCloseButton?: boolean;
13
+ closeHandler?: ModalContextValue['closeHandler'];
14
+ title?: string;
15
+ };
16
+ export declare const Modal: {
17
+ (props: ModalProps): import("react/jsx-runtime").JSX.Element;
18
+ Header: (props: import("./ModalHeader").ModalHeaderProps) => import("react/jsx-runtime").JSX.Element;
19
+ Body: (props: import("./ModalBody").ModalBodyProps) => import("react/jsx-runtime").JSX.Element;
20
+ Footer: (props: import("./ModalFooter").ModalFooterProps) => import("react/jsx-runtime").JSX.Element;
21
+ CloseButton: (props: import("../button/Button").ButtonProps) => import("react/jsx-runtime").JSX.Element | null;
22
+ Title: (props: Dialog.DialogTitleProps) => import("react/jsx-runtime").JSX.Element;
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=Modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AASlC,KAAK,iBAAiB,GAAG;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,YAAY,4CAAuC,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,KAAK;YAAW,UAAU;;;;;;CA+BtC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { Dialog } from 'radix-ui';
4
+ import { ModalHeader } from './ModalHeader';
5
+ import { ModalFooter } from './ModalFooter';
6
+ import { ModalBody } from './ModalBody';
7
+ import { PopupParentContext } from '../../utils/PopupParentContext';
8
+ import { createContext, useRef } from 'react';
9
+ import { ModalCloseButon } from './ModalCloseButton';
10
+ import { ModalTitle } from './ModalTitle';
11
+ export const ModalContext = createContext({});
12
+ export const Modal = (props) => {
13
+ const { className, overlayClassName, open, portalTarget, children, closeHandler, hideCloseButton = false, title, } = props;
14
+ const overlayRef = useRef(null);
15
+ return (_jsx(PopupParentContext.Provider, { value: overlayRef, children: _jsx(ModalContext.Provider, { value: { closeHandler }, children: _jsx(Dialog.Root, { open: open, children: _jsx(Dialog.Portal, { container: portalTarget, children: _jsx(Dialog.Overlay, { ref: overlayRef, className: classNames('ds-modal__overlay', overlayClassName), children: _jsxs(Dialog.Content, { className: classNames('ds-modal__container', className), children: [title && _jsx(ModalHeader, { children: _jsx(ModalTitle, { children: title }) }), children, !hideCloseButton && _jsx(ModalCloseButon, { className: "ds-modal__close-button--top-right" })] }) }) }) }) }) }));
16
+ };
17
+ Modal.Header = ModalHeader;
18
+ Modal.Body = ModalBody;
19
+ Modal.Footer = ModalFooter;
20
+ Modal.CloseButton = ModalCloseButon;
21
+ Modal.Title = ModalTitle;
22
+ //# sourceMappingURL=Modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,E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AAEF,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;AAC3B,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;AACvB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;AAC3B,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;AACpC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Meta } from '@storybook/react-vite';
2
+ import { Modal, type ModalProps } from './Modal';
3
+ declare const meta: Meta<typeof Modal>;
4
+ export declare const Default: {
5
+ args: {
6
+ open: boolean;
7
+ closeHandler: import("@vitest/spy").Mock<(...args: any[]) => any>;
8
+ title: string;
9
+ };
10
+ render: (args: ModalProps) => import("react/jsx-runtime").JSX.Element;
11
+ };
12
+ export default meta;
13
+ //# sourceMappingURL=Modal.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAIjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAI5B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;mBAMH,UAAU;CAgB1B,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { fn } from 'storybook/test';
3
+ import { Modal } from './Modal';
4
+ import { Button } from '../button/Button';
5
+ import { useState } from 'react';
6
+ const meta = {
7
+ title: 'Components/Modals/Modal',
8
+ component: Modal,
9
+ tags: ['autodocs'],
10
+ };
11
+ export const Default = {
12
+ args: {
13
+ open: false,
14
+ closeHandler: fn(),
15
+ title: 'Modal Title',
16
+ },
17
+ render: (args) => {
18
+ const [showModal, setShowModal] = useState(args.open);
19
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "primary", onClick: () => setShowModal(true), children: "Open Modal" }), _jsxs(Modal, { ...args, open: showModal, closeHandler: () => setShowModal(false), children: [_jsx(Modal.Body, { children: "Cheddar and Pickle were Norwich terriers who lived next door. Cheddar, the older, was cautious and methodical; Pickle, the younger, was bold and impulsive. One morning, Pickle spotted a squirrel in the garden and gave chase, while Cheddar watched from the porch. When Pickle got stuck under the neighbor\u2019s fence, Cheddar squeezed through a gap and nudged him free. From then on, they worked as a team: Pickle scouted, and Cheddar planned. They became inseparable, exploring the neighborhood together and always looking out for each other." }), _jsxs(Modal.Footer, { children: [_jsx(Button, { variant: "tertiary", onClick: () => setShowModal(false), children: "Close" }), _jsx(Button, { variant: "primary", onClick: () => setShowModal(false), children: "Primary Action" })] })] })] }));
20
+ },
21
+ };
22
+ export default meta;
23
+ //# sourceMappingURL=Modal.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.stories.js","sourceRoot":"","sources":["../../../src/components/modal/Modal.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,KAAK,EAAmB,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,YAAY,EAAE,EAAE,EAAE;QAClB,KAAK,EAAE,aAAa;KACrB;IACD,MAAM,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC3B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO,CACL,8BACE,KAAC,MAAM,IAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,2BAAqB,EAC7E,MAAC,KAAK,OAAK,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,aACvE,KAAC,KAAK,CAAC,IAAI,kjBAAwiB,EACnjB,MAAC,KAAK,CAAC,MAAM,eACX,KAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,sBAAgB,EAC7E,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,+BAAyB,IACxE,IACT,IACP,CAEJ,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom/vitest';
2
+ //# sourceMappingURL=Modal.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.test.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.test.tsx"],"names":[],"mappings":"AAIA,OAAO,kCAAkC,CAAC"}
@@ -0,0 +1,131 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describe, expect, test, vi } from 'vitest';
3
+ import { render, screen } from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
5
+ import { Modal } from './Modal';
6
+ import '@testing-library/jest-dom/vitest';
7
+ describe('Modal', () => {
8
+ test('renders when open prop is true', () => {
9
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Body, { children: "Modal content" }) }));
10
+ expect(screen.getByText('Modal content')).toBeInTheDocument();
11
+ });
12
+ test('does not render when open prop is false', () => {
13
+ render(_jsx(Modal, { open: false, children: _jsx(Modal.Body, { children: "Modal content" }) }));
14
+ expect(screen.queryByText('Modal content')).not.toBeInTheDocument();
15
+ });
16
+ test('renders with custom className', () => {
17
+ render(_jsx(Modal, { open: true, className: "custom-modal", children: _jsx(Modal.Body, { children: "Content" }) }));
18
+ const modalContainer = document.querySelector('.custom-modal');
19
+ expect(modalContainer).toBeInTheDocument();
20
+ });
21
+ test('renders with custom overlayClassName', () => {
22
+ render(_jsx(Modal, { open: true, overlayClassName: "custom-overlay", children: _jsx(Modal.Body, { children: "Content" }) }));
23
+ const overlay = document.querySelector('.custom-overlay');
24
+ expect(overlay).toBeInTheDocument();
25
+ });
26
+ test('renders with title prop', () => {
27
+ render(_jsx(Modal, { open: true, title: "Test Modal Title", children: _jsx(Modal.Body, { children: "Content" }) }));
28
+ expect(screen.getByText('Test Modal Title')).toBeInTheDocument();
29
+ });
30
+ test('renders close button by default', () => {
31
+ const closeHandler = vi.fn();
32
+ render(_jsx(Modal, { open: true, closeHandler: closeHandler, children: _jsx(Modal.Body, { children: "Content" }) }));
33
+ const closeButton = screen.getByRole('button');
34
+ expect(closeButton).toBeInTheDocument();
35
+ });
36
+ test('hides close button when hideCloseButton is true', () => {
37
+ const closeHandler = vi.fn();
38
+ render(_jsx(Modal, { open: true, hideCloseButton: true, closeHandler: closeHandler, children: _jsx(Modal.Body, { children: "Content" }) }));
39
+ expect(screen.queryByRole('button')).not.toBeInTheDocument();
40
+ });
41
+ test('calls closeHandler when close button is clicked', async () => {
42
+ const user = userEvent.setup();
43
+ const closeHandler = vi.fn();
44
+ render(_jsx(Modal, { open: true, closeHandler: closeHandler, children: _jsx(Modal.Body, { children: "Content" }) }));
45
+ const closeButton = screen.getByRole('button');
46
+ await user.click(closeButton);
47
+ expect(closeHandler).toHaveBeenCalledTimes(1);
48
+ });
49
+ test('calls closeHandler when Escape key is pressed', async () => {
50
+ const user = userEvent.setup();
51
+ const closeHandler = vi.fn();
52
+ render(_jsx(Modal, { open: true, closeHandler: closeHandler, children: _jsx(Modal.Body, { children: "Content" }) }));
53
+ await user.keyboard('{Escape}');
54
+ expect(closeHandler).toHaveBeenCalledTimes(1);
55
+ });
56
+ test('renders Modal.Header component', () => {
57
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Header, { children: "Header content" }) }));
58
+ expect(screen.getByText('Header content')).toBeInTheDocument();
59
+ const header = document.querySelector('.ds-modal__header');
60
+ expect(header).toBeInTheDocument();
61
+ });
62
+ test('renders Modal.Body component', () => {
63
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Body, { children: "Body content" }) }));
64
+ expect(screen.getByText('Body content')).toBeInTheDocument();
65
+ const body = document.querySelector('.ds-modal__body');
66
+ expect(body).toBeInTheDocument();
67
+ });
68
+ test('renders Modal.Footer component', () => {
69
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Footer, { children: "Footer content" }) }));
70
+ expect(screen.getByText('Footer content')).toBeInTheDocument();
71
+ const footer = document.querySelector('.ds-modal__footer');
72
+ expect(footer).toBeInTheDocument();
73
+ });
74
+ test('renders Modal.Title component', () => {
75
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Header, { children: _jsx(Modal.Title, { children: "Title content" }) }) }));
76
+ expect(screen.getByText('Title content')).toBeInTheDocument();
77
+ const title = document.querySelector('.ds-modal__title');
78
+ expect(title).toBeInTheDocument();
79
+ });
80
+ test('renders complete modal structure with all components', () => {
81
+ const closeHandler = vi.fn();
82
+ render(_jsxs(Modal, { open: true, closeHandler: closeHandler, children: [_jsx(Modal.Header, { children: _jsx(Modal.Title, { children: "Complete Modal" }) }), _jsx(Modal.Body, { children: "This is the modal body" }), _jsx(Modal.Footer, { children: _jsx("button", { children: "Action" }) })] }));
83
+ expect(screen.getByText('Complete Modal')).toBeInTheDocument();
84
+ expect(screen.getByText('This is the modal body')).toBeInTheDocument();
85
+ expect(screen.getByText('Action')).toBeInTheDocument();
86
+ });
87
+ test('applies custom className to Modal.Header', () => {
88
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Header, { className: "custom-header", children: "Header" }) }));
89
+ const header = document.querySelector('.custom-header');
90
+ expect(header).toBeInTheDocument();
91
+ expect(header).toHaveClass('ds-modal__header');
92
+ });
93
+ test('applies custom className to Modal.Body', () => {
94
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Body, { className: "custom-body", children: "Body" }) }));
95
+ const body = document.querySelector('.custom-body');
96
+ expect(body).toBeInTheDocument();
97
+ expect(body).toHaveClass('ds-modal__body');
98
+ });
99
+ test('applies custom className to Modal.Footer', () => {
100
+ render(_jsx(Modal, { open: true, children: _jsx(Modal.Footer, { className: "custom-footer", children: "Footer" }) }));
101
+ const footer = document.querySelector('.custom-footer');
102
+ expect(footer).toBeInTheDocument();
103
+ expect(footer).toHaveClass('ds-modal__footer');
104
+ });
105
+ test('renders to custom portal target', () => {
106
+ const container = document.createElement('div');
107
+ container.id = 'custom-portal';
108
+ document.body.appendChild(container);
109
+ render(_jsx(Modal, { open: true, portalTarget: container, children: _jsx(Modal.Body, { children: "Portal content" }) }));
110
+ expect(container.querySelector('.ds-modal__overlay')).toBeInTheDocument();
111
+ document.body.removeChild(container);
112
+ });
113
+ test('Modal.CloseButton does not render without closeHandler', () => {
114
+ render(_jsxs(Modal, { open: true, children: [_jsx(Modal.Body, { children: "Content" }), _jsx(Modal.CloseButton, {})] }));
115
+ // Only the default close button should be present
116
+ const buttons = screen.queryAllByRole('button');
117
+ expect(buttons).toHaveLength(0);
118
+ });
119
+ test('Modal.CloseButton renders with closeHandler in context', async () => {
120
+ const user = userEvent.setup();
121
+ const closeHandler = vi.fn();
122
+ render(_jsxs(Modal, { open: true, closeHandler: closeHandler, children: [_jsx(Modal.Body, { children: "Content" }), _jsx(Modal.CloseButton, { className: "custom-close" })] }));
123
+ const closeButtons = screen.getAllByRole('button');
124
+ expect(closeButtons.length).toBeGreaterThan(0);
125
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
126
+ // @ts-ignore
127
+ await user.click(closeButtons[0]);
128
+ expect(closeHandler).toHaveBeenCalled();
129
+ });
130
+ });
131
+ //# sourceMappingURL=Modal.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.test.js","sourceRoot":"","sources":["../../../src/components/modal/Modal.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,CAAC,gCAAgC,EAAE,GAAG,EAAE;QAC1C,MAAM,CACJ,KAAC,KAAK,IAAC,IAAI,EAAE,IAAI,YACf,KAAC,KAAK,CAAC,IAAI,gCAA2B,GAChC,CACT,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACnD,MAAM,CACJ,KAAC,KAAK,IAAC,IAAI,EAAE,KAAK,YAChB,KAAC,KAAK,CAAC,IAAI,gCAA2B,GAChC,CACT,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACzC,MAAM,CACJ,KAAC,KAAK,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,cAAc,YACzC,KAAC,KAAK,CAAC,IAAI,0BAAqB,GAC1B,CACT,CAAC;QACF,MAA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AC,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,YAAY,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ export type ModalBodyProps = {
3
+ className?: string;
4
+ children?: ReactNode;
5
+ };
6
+ export declare const ModalBody: (props: ModalBodyProps) => import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=ModalBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalBody.d.ts","sourceRoot":"","sources":["../../../src/components/modal/ModalBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,4CAO9C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ export const ModalBody = (props) => {
4
+ const { className, children } = props;
5
+ return (_jsx("div", { className: classNames('ds-modal__body', className), children: children }));
6
+ };
7
+ //# sourceMappingURL=ModalBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalBody.js","sourceRoot":"","sources":["../../../src/components/modal/ModalBody.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtC,OAAO,CACL,cAAK,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,YACpD,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ButtonProps } from '../button/Button';
2
+ export declare const ModalCloseButon: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ //# sourceMappingURL=ModalCloseButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalCloseButton.d.ts","sourceRoot":"","sources":["../../../src/components/modal/ModalCloseButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGpE,eAAO,MAAM,eAAe,GAAI,OAAO,WAAW,mDAiCjD,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext, useEffect } from 'react';
3
+ import { ModalContext } from './Modal';
4
+ import { Button } from '../button/Button';
5
+ import classNames from 'classnames';
6
+ export const ModalCloseButon = (props) => {
7
+ const { className, ...rest } = props;
8
+ const { closeHandler } = useContext(ModalContext);
9
+ const handleKeyDown = (event) => {
10
+ if (event.key === 'Escape' && closeHandler) {
11
+ closeHandler();
12
+ }
13
+ };
14
+ useEffect(() => {
15
+ document.addEventListener('keydown', handleKeyDown);
16
+ return () => {
17
+ document.removeEventListener('keydown', handleKeyDown);
18
+ };
19
+ }, [closeHandler]);
20
+ if (!closeHandler) {
21
+ return null;
22
+ }
23
+ return (_jsx(Button, { size: "S", onClick: closeHandler, variant: "secondary", iconRightName: "x", iconRightScreenReaderText: "Close", borderless: true, className: classNames('ds-modal__close-button', className), ...rest }));
24
+ };
25
+ //# sourceMappingURL=ModalCloseButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalCloseButton.js","sourceRoot":"","sources":["../../../src/components/modal/ModalCloseButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAoB,MAAM,0BAA0B,CAAC;AACpE,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAkB,EAAE,EAAE;IACpD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAElD,MAAM,aAAa,GAAG,CAAC,KAAoB,EAAE,EAAE;QAC7C,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,YAAY,EAAE,CAAC;YAC3C,YAAY,EAAE,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACpD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAC,GAAG,EACR,OAAO,EAAE,YAAY,EACrB,OAAO,EAAC,WAAW,EACnB,aAAa,EAAC,GAAG,EACjB,yBAAyB,EAAC,OAAO,EACjC,UAAU,QACV,SAAS,EAAE,UAAU,CAAC,wBAAwB,EAAE,SAAS,CAAC,KACtD,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ export type ModalFooterProps = {
3
+ className?: string;
4
+ children?: ReactNode;
5
+ };
6
+ export declare const ModalFooter: (props: ModalFooterProps) => import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=ModalFooter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalFooter.d.ts","sourceRoot":"","sources":["../../../src/components/modal/ModalFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAKlD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ export const ModalFooter = (props) => {
4
+ const { className, children } = props;
5
+ return (_jsx("footer", { className: classNames('ds-modal__footer', className), children: children }));
6
+ };
7
+ //# sourceMappingURL=ModalFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalFooter.js","sourceRoot":"","sources":["../../../src/components/modal/ModalFooter.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IACrD,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtC,OAAO,CACL,iBAAQ,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,SAAS,CAAC,YAAG,QAAQ,GAAU,CAClF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from 'react';
2
+ export type ModalHeaderProps = {
3
+ className?: string;
4
+ children?: ReactNode;
5
+ };
6
+ export declare const ModalHeader: (props: ModalHeaderProps) => import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=ModalHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalHeader.d.ts","sourceRoot":"","sources":["../../../src/components/modal/ModalHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAWlD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import {} from 'react';
3
+ import classNames from 'classnames';
4
+ export const ModalHeader = (props) => {
5
+ const { className, children, } = props;
6
+ return (_jsx("header", { className: classNames('ds-modal__header', className), children: children }));
7
+ };
8
+ //# sourceMappingURL=ModalHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalHeader.js","sourceRoot":"","sources":["../../../src/components/modal/ModalHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IACrD,MAAM,EACJ,SAAS,EACT,QAAQ,GACT,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,iBAAQ,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,SAAS,CAAC,YACzD,QAAQ,GACF,CACV,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Dialog } from 'radix-ui';
2
+ export declare const ModalTitle: (props: Dialog.DialogTitleProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=ModalTitle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalTitle.d.ts","sourceRoot":"","sources":["../../../src/components/modal/ModalTitle.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,CAAC,gBAAgB,4CAQxD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { Dialog } from 'radix-ui';
4
+ export const ModalTitle = (props) => {
5
+ const { children, className, ...rest } = props;
6
+ return (_jsx(Dialog.Title, { className: classNames('ds-modal__title', className), ...rest, children: children }));
7
+ };
8
+ //# sourceMappingURL=ModalTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalTitle.js","sourceRoot":"","sources":["../../../src/components/modal/ModalTitle.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAE,EAAE;IAC3D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAE/C,OAAO,CACL,KAAC,MAAM,CAAC,KAAK,IAAC,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,KAAM,IAAI,YACxE,QAAQ,GACI,CAChB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type ModalProps } from '../../modal/Modal';
2
+ type ModalManagerProps = {
3
+ modal?: ModalProps;
4
+ };
5
+ export declare const ModalManager: (props: ModalManagerProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=ModalManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["../../../../src/components/modal/modalManager/ModalManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKhE,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CA8BpD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Modal } from '../../modal/Modal';
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { MODAL } from '../../../utils/Constants';
5
+ import { usePubSub } from '../../../utils/hooks/usePubSub';
6
+ export const ModalManager = (props) => {
7
+ const { modal: initialModal } = props;
8
+ const [modal, setModal] = useState(() => initialModal);
9
+ const modalManagerContainerRef = useRef(null);
10
+ useEffect(() => {
11
+ setModal(initialModal);
12
+ }, [initialModal]);
13
+ const hasModal = !!modal;
14
+ usePubSub(MODAL.ADD_MODAL, (newModal) => {
15
+ setModal(newModal);
16
+ });
17
+ usePubSub(MODAL.REMOVE_MODAL, () => {
18
+ setModal(undefined);
19
+ });
20
+ return (_jsx("div", { ref: modalManagerContainerRef, className: "ds-modal-manager", children: _jsx(Modal, { ...modal, open: hasModal, portalTarget: modalManagerContainerRef.current, closeHandler: () => setModal(undefined) }) }));
21
+ };
22
+ //# sourceMappingURL=ModalManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalManager.js","sourceRoot":"","sources":["../../../../src/components/modal/modalManager/ModalManager.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMlD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;IACvD,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAyB,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;IAE/E,MAAM,wBAAwB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,YAAY,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC;IAEzB,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,QAAoB,EAAE,EAAE;QAClD,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,EAAE;QACjC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,cAAK,GAAG,EAAE,wBAAwB,EAAE,SAAS,EAAC,kBAAkB,YAC9D,KAAC,KAAK,OACA,KAAK,EACT,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,wBAAwB,CAAC,OAAO,EAC9C,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,GACvC,GACE,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ type Story = StoryObj;
5
+ export declare const Default: Story;
6
+ export declare const WithHeaderAndFooter: Story;
7
+ export declare const WithSections: Story;
8
+ export declare const WithFormFields: Story;
9
+ export declare const WithScrollableContent: Story;
10
+ export declare const DestructiveAction: Story;
11
+ export declare const SimpleConfirmation: Story;
12
+ export declare const ExampleErrorModal: Story;
13
+ //# sourceMappingURL=ModalManager.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalManager.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/modal/modalManager/ModalManager.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAWvD,QAAA,MAAM,IAAI,EAAE,IAYX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAkBtB,eAAO,MAAM,OAAO,EAAE,KAuBrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KA4CjC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KA2C1B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAoE5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KA4GnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KA+C/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KA4ChC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KA4D/B,CAAC"}