@digdir/designsystemet-react 1.0.0-next.48 → 1.0.0-next.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Badge/Badge.js +2 -2
- package/dist/cjs/components/Button/Button.js +1 -1
- package/dist/cjs/components/Card/Card.js +2 -2
- package/dist/cjs/components/Combobox/Combobox.js +0 -2
- package/dist/cjs/components/Details/Details.js +2 -2
- package/dist/cjs/components/Dialog/Dialog.js +74 -0
- package/dist/cjs/components/Dialog/DialogBlock.js +30 -0
- package/dist/cjs/components/Dialog/DialogTrigger.js +27 -0
- package/dist/cjs/components/Dialog/DialogTriggerContext.js +28 -0
- package/dist/cjs/components/Dialog/index.js +34 -0
- package/dist/cjs/components/Popover/Popover.js +2 -2
- package/dist/cjs/index.js +10 -10
- package/dist/cjs/{components/Pagination → utilities/hooks/usePagination}/usePagination.js +10 -1
- package/dist/esm/components/Badge/Badge.js +2 -2
- package/dist/esm/components/Button/Button.js +2 -2
- package/dist/esm/components/Card/Card.js +2 -2
- package/dist/esm/components/Chip/Chips.js +1 -1
- package/dist/esm/components/Chip/index.js +1 -1
- package/dist/esm/components/Combobox/Combobox.js +1 -3
- package/dist/esm/components/Combobox/ComboboxIdContext.js +1 -1
- package/dist/esm/components/Combobox/useFloatingCombobox.js +1 -1
- package/dist/esm/components/Details/Details.js +2 -2
- package/dist/esm/components/Dialog/Dialog.js +72 -0
- package/dist/esm/components/Dialog/DialogBlock.js +28 -0
- package/dist/esm/components/{Modal/ModalTrigger.js → Dialog/DialogTrigger.js} +9 -9
- package/dist/esm/components/Dialog/DialogTriggerContext.js +25 -0
- package/dist/esm/components/Dialog/index.js +29 -0
- package/dist/esm/components/ErrorSummary/ErrorSummary.js +1 -1
- package/dist/esm/components/Field/index.js +1 -1
- package/dist/esm/components/List/index.js +1 -1
- package/dist/esm/components/Popover/Popover.js +2 -2
- package/dist/esm/components/Suggestion/Suggestion.js +1 -1
- package/dist/esm/components/Tabs/Tabs.js +1 -1
- package/dist/esm/components/ToggleGroup/ToggleGroup.js +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/utilities/RovingFocus/RovingFocusRoot.js +1 -1
- package/dist/esm/{components/Pagination → utilities/hooks/usePagination}/usePagination.js +10 -1
- package/dist/types/colors.d.ts +12 -2
- package/dist/types/colors.d.ts.map +1 -1
- package/dist/types/components/Badge/Badge.d.ts +13 -1
- package/dist/types/components/Badge/Badge.d.ts.map +1 -1
- package/dist/types/components/Badge/index.d.ts +2 -1
- package/dist/types/components/Badge/index.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts +10 -6
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Card/Card.d.ts +9 -7
- package/dist/types/components/Card/Card.d.ts.map +1 -1
- package/dist/types/components/Card/index.d.ts +2 -2
- package/dist/types/components/Details/Details.d.ts +4 -4
- package/dist/types/components/Details/Details.d.ts.map +1 -1
- package/dist/types/components/{Modal/Modal.d.ts → Dialog/Dialog.d.ts} +17 -17
- package/dist/types/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/components/{Modal/ModalBlock.d.ts → Dialog/DialogBlock.d.ts} +12 -12
- package/dist/types/components/Dialog/DialogBlock.d.ts.map +1 -0
- package/dist/types/components/Dialog/DialogTrigger.d.ts +22 -0
- package/dist/types/components/Dialog/DialogTrigger.d.ts.map +1 -0
- package/dist/types/components/Dialog/DialogTriggerContext.d.ts +21 -0
- package/dist/types/components/Dialog/DialogTriggerContext.d.ts.map +1 -0
- package/dist/types/components/Dialog/index.d.ts +43 -0
- package/dist/types/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/components/Dropdown/DropdownHeading.d.ts +1 -1
- package/dist/types/components/Dropdown/index.d.ts +1 -1
- package/dist/types/components/ErrorSummary/ErrorSummaryHeading.d.ts +1 -1
- package/dist/types/components/ErrorSummary/index.d.ts +1 -1
- package/dist/types/components/Fieldset/FieldsetDescription.d.ts +1 -1
- package/dist/types/components/Fieldset/index.d.ts +1 -1
- package/dist/types/components/Heading/Heading.d.ts +2 -2
- package/dist/types/components/Heading/Heading.d.ts.map +1 -1
- package/dist/types/components/Pagination/index.d.ts +0 -2
- package/dist/types/components/Pagination/index.d.ts.map +1 -1
- package/dist/types/components/Paragraph/Paragraph.d.ts +2 -2
- package/dist/types/components/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/types/components/Popover/Popover.d.ts +13 -1
- package/dist/types/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/Popover/index.d.ts +2 -1
- package/dist/types/components/Popover/index.d.ts.map +1 -1
- package/dist/types/components/Search/SearchButton.d.ts +2 -2
- package/dist/types/components/Search/index.d.ts +2 -2
- package/dist/types/components/Spinner/Spinner.d.ts +1 -1
- package/dist/types/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utilities/hooks/index.d.ts +2 -0
- package/dist/types/utilities/hooks/index.d.ts.map +1 -1
- package/dist/types/utilities/hooks/useCheckboxGroup/useCheckboxGroup.d.ts +2 -1
- package/dist/types/utilities/hooks/useCheckboxGroup/useCheckboxGroup.d.ts.map +1 -1
- package/dist/types/{components/Pagination → utilities/hooks/usePagination}/usePagination.d.ts +19 -11
- package/dist/types/utilities/hooks/usePagination/usePagination.d.ts.map +1 -0
- package/dist/types/utilities/hooks/useRadioGroup/useRadioGroup.d.ts +1 -1
- package/dist/types/utilities/hooks/useRadioGroup/useRadioGroup.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/cjs/components/Modal/Modal.js +0 -74
- package/dist/cjs/components/Modal/ModalBlock.js +0 -30
- package/dist/cjs/components/Modal/ModalTrigger.js +0 -27
- package/dist/cjs/components/Modal/ModalTriggerContext.js +0 -28
- package/dist/cjs/components/Modal/index.js +0 -34
- package/dist/esm/components/Modal/Modal.js +0 -72
- package/dist/esm/components/Modal/ModalBlock.js +0 -28
- package/dist/esm/components/Modal/ModalTriggerContext.js +0 -25
- package/dist/esm/components/Modal/index.js +0 -29
- package/dist/types/components/Modal/Modal.d.ts.map +0 -1
- package/dist/types/components/Modal/ModalBlock.d.ts.map +0 -1
- package/dist/types/components/Modal/ModalTrigger.d.ts +0 -22
- package/dist/types/components/Modal/ModalTrigger.d.ts.map +0 -1
- package/dist/types/components/Modal/ModalTriggerContext.d.ts +0 -21
- package/dist/types/components/Modal/ModalTriggerContext.d.ts.map +0 -1
- package/dist/types/components/Modal/index.d.ts +0 -43
- package/dist/types/components/Modal/index.d.ts.map +0 -1
- package/dist/types/components/Pagination/usePagination.d.ts.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DialogBlock } from './DialogBlock';
|
|
2
|
+
import { DialogTrigger } from './DialogTrigger';
|
|
3
|
+
import { DialogTriggerContext } from './DialogTriggerContext';
|
|
4
|
+
/**
|
|
5
|
+
* Dialog component, used to display a Dialog dialog.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Dialog.TriggerContext>
|
|
9
|
+
* <Dialog.Trigger>Open Dialog</Dialog.Trigger>
|
|
10
|
+
* <Dialog>
|
|
11
|
+
* <Dialog.Block>
|
|
12
|
+
* Content
|
|
13
|
+
* </Dialog.Block>
|
|
14
|
+
* </Dialog>
|
|
15
|
+
* </Dialog.TriggerContext>
|
|
16
|
+
*/
|
|
17
|
+
declare const Dialog: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.DialogHTMLAttributes<HTMLDialogElement>, "asChild" | "onClose" | "closeButton" | "backdropClose"> & {
|
|
18
|
+
closeButton?: string | false;
|
|
19
|
+
backdropClose?: boolean;
|
|
20
|
+
onClose?: (event: Event) => void;
|
|
21
|
+
asChild?: boolean;
|
|
22
|
+
} & React.RefAttributes<HTMLDialogElement>> & {
|
|
23
|
+
Block: React.ForwardRefExoticComponent<{
|
|
24
|
+
asChild?: boolean;
|
|
25
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
TriggerContext: {
|
|
27
|
+
({ children, }: import("./DialogTriggerContext").DialogTriggerContextProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
displayName: string;
|
|
29
|
+
};
|
|
30
|
+
Trigger: React.ForwardRefExoticComponent<Omit<Omit<import("../../types").DefaultProps & React.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "variant" | "icon" | "loading" | "asChild"> & {
|
|
31
|
+
variant?: "primary" | "secondary" | "tertiary";
|
|
32
|
+
icon?: boolean;
|
|
33
|
+
loading?: boolean | React.ReactNode;
|
|
34
|
+
asChild?: boolean;
|
|
35
|
+
type?: React.ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
36
|
+
} & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
37
|
+
};
|
|
38
|
+
export type { DialogBlockProps } from './DialogBlock';
|
|
39
|
+
export type { DialogTriggerContextProps } from './DialogTriggerContext';
|
|
40
|
+
export type { DialogProps } from './Dialog';
|
|
41
|
+
export type { DialogTriggerProps } from './DialogTrigger';
|
|
42
|
+
export { Dialog, DialogBlock, DialogTriggerContext, DialogTrigger };
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;CAIV,CAAC;AAMH,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type HeadingProps } from '../Heading';
|
|
|
2
2
|
export type DropdownHeadingProps = HeadingProps;
|
|
3
3
|
export declare const DropdownHeading: React.ForwardRefExoticComponent<{
|
|
4
4
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
-
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
5
|
+
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
6
6
|
asChild?: boolean;
|
|
7
7
|
} & React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
8
8
|
//# sourceMappingURL=DropdownHeading.d.ts.map
|
|
@@ -29,7 +29,7 @@ declare const Dropdown: React.ForwardRefExoticComponent<Omit<import("../../types
|
|
|
29
29
|
};
|
|
30
30
|
Heading: React.ForwardRefExoticComponent<{
|
|
31
31
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
32
|
-
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
32
|
+
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
33
33
|
asChild?: boolean;
|
|
34
34
|
} & React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
35
35
|
List: React.ForwardRefExoticComponent<import("./DropdownList").DropdownListProps & React.RefAttributes<HTMLUListElement>>;
|
|
@@ -2,7 +2,7 @@ import { type HeadingProps } from '../Heading';
|
|
|
2
2
|
export type ErrorSummaryHeadingProps = HeadingProps;
|
|
3
3
|
export declare const ErrorSummaryHeading: React.ForwardRefExoticComponent<{
|
|
4
4
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
-
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
5
|
+
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
6
6
|
asChild?: boolean;
|
|
7
7
|
} & React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
8
8
|
//# sourceMappingURL=ErrorSummaryHeading.d.ts.map
|
|
@@ -23,7 +23,7 @@ declare const ErrorSummary: React.ForwardRefExoticComponent<{
|
|
|
23
23
|
} & Omit<React.HTMLAttributes<HTMLDivElement> & import("../../types").DefaultProps, "data-color"> & React.RefAttributes<HTMLDivElement>> & {
|
|
24
24
|
Heading: React.ForwardRefExoticComponent<{
|
|
25
25
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
26
|
-
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
26
|
+
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
27
27
|
asChild?: boolean;
|
|
28
28
|
} & React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
29
29
|
Item: React.ForwardRefExoticComponent<{
|
|
@@ -9,7 +9,7 @@ export type FieldsetDescriptionProps = ParagraphProps;
|
|
|
9
9
|
* </Fieldset.Description>
|
|
10
10
|
*/
|
|
11
11
|
export declare const FieldsetDescription: React.ForwardRefExoticComponent<{
|
|
12
|
-
'data-size'?: "xs" | "sm" | "md" | "lg" | "xl"
|
|
12
|
+
'data-size'?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
13
13
|
variant?: "long" | "default" | "short";
|
|
14
14
|
asChild?: boolean;
|
|
15
15
|
} & React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLLegendElement>>;
|
|
@@ -18,7 +18,7 @@ import { FieldsetLegend } from './FieldsetLegend';
|
|
|
18
18
|
declare const Fieldset: React.ForwardRefExoticComponent<import("../../types").DefaultProps & React.FieldsetHTMLAttributes<HTMLFieldSetElement> & React.RefAttributes<HTMLFieldSetElement>> & {
|
|
19
19
|
Legend: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLLegendElement> & import("../../types").DefaultProps & React.RefAttributes<HTMLLegendElement>>;
|
|
20
20
|
Description: React.ForwardRefExoticComponent<{
|
|
21
|
-
'data-size'?: "xs" | "sm" | "md" | "lg" | "xl"
|
|
21
|
+
'data-size'?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
22
22
|
variant?: "long" | "default" | "short";
|
|
23
23
|
asChild?: boolean;
|
|
24
24
|
} & React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLLegendElement>>;
|
|
@@ -9,7 +9,7 @@ export type HeadingProps = {
|
|
|
9
9
|
* Changes text sizing
|
|
10
10
|
* @default 'md'
|
|
11
11
|
*/
|
|
12
|
-
'data-size'?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
|
|
12
|
+
'data-size'?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
13
13
|
/**
|
|
14
14
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
15
15
|
* @default false
|
|
@@ -32,7 +32,7 @@ export declare const Heading: React.ForwardRefExoticComponent<{
|
|
|
32
32
|
* Changes text sizing
|
|
33
33
|
* @default 'md'
|
|
34
34
|
*/
|
|
35
|
-
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
35
|
+
'data-size'?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
36
36
|
/**
|
|
37
37
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
38
38
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/components/Heading/Heading.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,OAAO,CAAC;AAGzD,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/components/Heading/Heading.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,OAAO,CAAC;AAGzD,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAC/D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,OAAO;IAvBlB;;;OAGG;YACK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;IAC7B;;;OAGG;kBACW,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK;IAC9D;;;OAGG;cACO,OAAO;iFAiBlB,CAAC"}
|
|
@@ -37,7 +37,5 @@ export type { PaginationProps } from './Pagination';
|
|
|
37
37
|
export type { PaginationButtonProps } from './PaginationButton';
|
|
38
38
|
export type { PaginationListProps } from './PaginationList';
|
|
39
39
|
export type { PaginationItemProps } from './PaginationItem';
|
|
40
|
-
export type { UsePaginationProps } from './usePagination';
|
|
41
40
|
export { Pagination, PaginationList, PaginationItem, PaginationButton };
|
|
42
|
-
export { usePagination } from './usePagination';
|
|
43
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;CAId,CAAC;AAMH,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;CAId,CAAC;AAMH,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ export type ParagraphProps = {
|
|
|
3
3
|
/**
|
|
4
4
|
* Changes text sizing
|
|
5
5
|
*/
|
|
6
|
-
'data-size'?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
6
|
+
'data-size'?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
7
|
/**
|
|
8
8
|
* Adjusts styling for paragraph length
|
|
9
9
|
* @default 'default'
|
|
@@ -26,7 +26,7 @@ export declare const Paragraph: React.ForwardRefExoticComponent<{
|
|
|
26
26
|
/**
|
|
27
27
|
* Changes text sizing
|
|
28
28
|
*/
|
|
29
|
-
'data-size'?: "xs" | "sm" | "md" | "lg" | "xl"
|
|
29
|
+
'data-size'?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
30
30
|
/**
|
|
31
31
|
* Adjusts styling for paragraph length
|
|
32
32
|
* @default 'default'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../../src/components/Paragraph/Paragraph.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../../src/components/Paragraph/Paragraph.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;IAvBpB;;OAEG;kBACW,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;IAC9C;;;OAGG;cACO,MAAM,GAAG,SAAS,GAAG,OAAO;IACtC;;;OAGG;cACO,OAAO;qFA0BlB,CAAC"}
|
|
@@ -29,6 +29,12 @@ export type PopoverProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivEleme
|
|
|
29
29
|
* @default undefined
|
|
30
30
|
*/
|
|
31
31
|
open?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Change the background color of the popover.
|
|
34
|
+
*
|
|
35
|
+
* @default 'default'
|
|
36
|
+
*/
|
|
37
|
+
'data-variant'?: 'default' | 'tinted';
|
|
32
38
|
/**
|
|
33
39
|
* Callback when the popover wants to open.
|
|
34
40
|
*/
|
|
@@ -65,7 +71,7 @@ export type PopoverProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivEleme
|
|
|
65
71
|
* Content
|
|
66
72
|
* </Popover>
|
|
67
73
|
*/
|
|
68
|
-
export declare const Popover: React.ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "id" | "asChild" | "open" | "placement" | "onClose" | "onOpen" | "autoPlacement"> & {
|
|
74
|
+
export declare const Popover: React.ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "id" | "asChild" | "open" | "data-variant" | "placement" | "onClose" | "onOpen" | "autoPlacement"> & {
|
|
69
75
|
/**
|
|
70
76
|
* id to connect the trigger with the popover - required when not using Popover.Context.
|
|
71
77
|
*/
|
|
@@ -80,6 +86,12 @@ export declare const Popover: React.ForwardRefExoticComponent<Omit<DefaultProps
|
|
|
80
86
|
* @default undefined
|
|
81
87
|
*/
|
|
82
88
|
open?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Change the background color of the popover.
|
|
91
|
+
*
|
|
92
|
+
* @default 'default'
|
|
93
|
+
*/
|
|
94
|
+
'data-variant'?: "default" | "tinted";
|
|
83
95
|
/**
|
|
84
96
|
* Callback when the popover wants to open.
|
|
85
97
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC,GAAG,CAAC;QAClB,UAAU,mBAAmB;YAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB;KACF;IACD,UAAU,KAAK,CAAC;QACd,UAAU,cAAc,CAAC,CAAC;YACxB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB;KACF;CACF;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CACnC,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,EAC7C;IACE;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,OAAO;
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC,GAAG,CAAC;QAClB,UAAU,mBAAmB;YAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB;KACF;IACD,UAAU,KAAK,CAAC;QACd,UAAU,cAAc,CAAC,CAAC;YACxB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB;KACF;CACF;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CACnC,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,EAC7C;IACE;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,OAAO;IA1DhB;;OAEG;SACE,MAAM;IACX;;;OAGG;gBACS,SAAS;IACrB;;;OAGG;WACI,OAAO;IACd;;;;OAIG;qBACc,SAAS,GAAG,QAAQ;IACrC;;OAEG;aACM,MAAM,IAAI;IACnB;;OAEG;cACO,MAAM,IAAI;IACpB;;;OAGG;oBACa,OAAO;IACvB;;;OAGG;cACO,OAAO;wCAiIpB,CAAC"}
|
|
@@ -11,10 +11,11 @@ import { PopoverTriggerContext } from './PopoverTriggerContext';
|
|
|
11
11
|
* </Popover>
|
|
12
12
|
* </Popover.TriggerContext>
|
|
13
13
|
*/
|
|
14
|
-
declare const Popover: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.HTMLAttributes<HTMLDivElement>, "id" | "asChild" | "open" | "placement" | "onClose" | "onOpen" | "autoPlacement"> & {
|
|
14
|
+
declare const Popover: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.HTMLAttributes<HTMLDivElement>, "id" | "asChild" | "open" | "data-variant" | "placement" | "onClose" | "onOpen" | "autoPlacement"> & {
|
|
15
15
|
id?: string;
|
|
16
16
|
placement?: import("@floating-ui/utils").Placement;
|
|
17
17
|
open?: boolean;
|
|
18
|
+
'data-variant'?: "default" | "tinted";
|
|
18
19
|
onOpen?: () => void;
|
|
19
20
|
onClose?: () => void;
|
|
20
21
|
autoPlacement?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;CAGX,CAAC;AAKH,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -22,10 +22,10 @@ export type SearchButtonProps = MergeRight<ButtonProps, {
|
|
|
22
22
|
* <Search.Button>Søk</Search.Button>
|
|
23
23
|
* </Search>
|
|
24
24
|
*/
|
|
25
|
-
export declare const SearchButton: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "
|
|
25
|
+
export declare const SearchButton: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "variant" | "icon" | "loading" | "asChild"> & {
|
|
26
26
|
variant?: "primary" | "secondary" | "tertiary";
|
|
27
27
|
icon?: boolean;
|
|
28
|
-
loading?: boolean;
|
|
28
|
+
loading?: boolean | ReactNode;
|
|
29
29
|
asChild?: boolean;
|
|
30
30
|
type?: React.ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
31
31
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -21,10 +21,10 @@ declare const Search: React.ForwardRefExoticComponent<import("../../types").Defa
|
|
|
21
21
|
Clear: React.ForwardRefExoticComponent<Omit<import("..").ButtonProps, "children" | "variant"> & {
|
|
22
22
|
'aria-label'?: string;
|
|
23
23
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
-
Button: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "
|
|
24
|
+
Button: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "variant" | "icon" | "loading" | "asChild"> & {
|
|
25
25
|
variant?: "primary" | "secondary" | "tertiary";
|
|
26
26
|
icon?: boolean;
|
|
27
|
-
loading?: boolean;
|
|
27
|
+
loading?: boolean | React.ReactNode;
|
|
28
28
|
asChild?: boolean;
|
|
29
29
|
type?: React.ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
30
30
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -7,7 +7,7 @@ export type SpinnerProps = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Spinner size
|
|
9
9
|
*/
|
|
10
|
-
'data-size'?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
10
|
+
'data-size'?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
11
|
} & ComponentPropsWithoutRef<'svg'> & ({
|
|
12
12
|
'aria-label': string;
|
|
13
13
|
'aria-hidden'?: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/components/Spinner/Spinner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,wBAAwB,EAAc,MAAM,OAAO,CAAC;AAGlE,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/components/Spinner/Spinner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,wBAAwB,EAAc,MAAM,OAAO,CAAC;AAGlE,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACxD,GAAG,wBAAwB,CAAC,KAAK,CAAC,GACjC,CACI;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/C;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAC1D,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,OAAO,oFA0ClB,CAAC"}
|
|
@@ -30,7 +30,7 @@ export * from './Tabs';
|
|
|
30
30
|
export * from './ToggleGroup';
|
|
31
31
|
export * from './Popover';
|
|
32
32
|
export * from './Divider';
|
|
33
|
-
export * from './
|
|
33
|
+
export * from './Dialog';
|
|
34
34
|
export * from './Dropdown';
|
|
35
35
|
export * from './Search';
|
|
36
36
|
export * from './Card';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ export type DefaultProps = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Changes size for descendant Designsystemet components. Select from predefined sizes.
|
|
7
7
|
*/
|
|
8
|
-
'data-size'?: Size
|
|
8
|
+
'data-size'?: Size;
|
|
9
9
|
/**
|
|
10
10
|
* Changes color for descendant Designsystemet components.
|
|
11
11
|
* Select from predefined colors and colors defined using theme.designsystemet.no.
|
|
12
12
|
*/
|
|
13
|
-
'data-color'?: Color
|
|
13
|
+
'data-color'?: Color;
|
|
14
14
|
};
|
|
15
15
|
export type LabelRequired = {
|
|
16
16
|
'aria-label': string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAClE;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACrE;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
|
|
@@ -4,6 +4,8 @@ export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect/useIsomor
|
|
|
4
4
|
export { useMediaQuery } from './useMediaQuery/useMediaQuery';
|
|
5
5
|
export { useRadioGroup } from './useRadioGroup/useRadioGroup';
|
|
6
6
|
export { useSynchronizedAnimation } from './useSynchronizedAnimation/useSynchronizedAnimation';
|
|
7
|
+
export { usePagination } from './usePagination/usePagination';
|
|
7
8
|
export type { UseRadioGroupProps } from './useRadioGroup/useRadioGroup';
|
|
8
9
|
export type { UseCheckboxGroupProps } from './useCheckboxGroup/useCheckboxGroup';
|
|
10
|
+
export type { UsePaginationProps } from './usePagination/usePagination';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACjF,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -45,7 +45,8 @@ export type UseCheckboxGroupProps = {
|
|
|
45
45
|
export type GetCheckboxProps = Omit<CheckboxProps, 'prefix' | 'role' | 'type' | 'size' | 'aria-label' | 'aria-labelledby' | 'label' | 'checked' | 'value'> & {
|
|
46
46
|
/** Enables indeterminate handling for this `Checkbox` and `CheckboxGroup` */
|
|
47
47
|
allowIndeterminate?: boolean;
|
|
48
|
-
ref?: React.
|
|
48
|
+
ref?: React.ForwardedRef<HTMLInputElement>;
|
|
49
|
+
checked?: boolean;
|
|
49
50
|
value?: string;
|
|
50
51
|
};
|
|
51
52
|
type useCheckboxGroupReturn = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckboxGroup.d.ts","sourceRoot":"","sources":["../../../../src/utilities/hooks/useCheckboxGroup/useCheckboxGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAClE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,aAAa,EACX,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,OAAO,GACP,SAAS,GACT,OAAO,CACV,GAAG;IACF,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,GAAG,CAAC,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"useCheckboxGroup.d.ts","sourceRoot":"","sources":["../../../../src/utilities/hooks/useCheckboxGroup/useCheckboxGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAClE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,aAAa,EACX,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,OAAO,GACP,SAAS,GACT,OAAO,CACV,GAAG;IACF,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAgBF,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACzD,gBAAgB,EAAE,CAChB,YAAY,CAAC,EAAE,MAAM,GAAG,gBAAgB,KACrC,gBAAgB,CAAC;IACtB,sBAAsB,EAAE;QACtB,QAAQ,EAAE,SAAS,CAAC;QACpB,MAAM,EAAE,OAAO,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,KAAK,CAAC,EAAE,qBAAqB,GAC5B,sBAAsB,CAwIxB"}
|
package/dist/types/{components/Pagination → utilities/hooks/usePagination}/usePagination.d.ts
RENAMED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import type { MouseEvent } from 'react';
|
|
2
|
-
import type { PaginationButtonProps } from '
|
|
2
|
+
import type { PaginationButtonProps } from '../../../components';
|
|
3
3
|
export type UsePaginationProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The current page number
|
|
6
6
|
* @default 1
|
|
7
7
|
*/
|
|
8
8
|
currentPage: number;
|
|
9
|
-
/**
|
|
10
|
-
* Function to change currentPage - typically returned from useState
|
|
11
|
-
*/
|
|
12
|
-
setCurrentPage?: (page: number) => void;
|
|
13
|
-
/**
|
|
14
|
-
* Callback when the page changes
|
|
15
|
-
* (event: MouseEvent<HTMLElement>, page: number) => void
|
|
16
|
-
*/
|
|
17
|
-
onChange?: (event: MouseEvent<HTMLElement>, page: number) => void;
|
|
18
9
|
/**
|
|
19
10
|
* The total number of pages
|
|
20
11
|
* @default 1
|
|
@@ -22,9 +13,17 @@ export type UsePaginationProps = {
|
|
|
22
13
|
totalPages: number;
|
|
23
14
|
/**
|
|
24
15
|
* The maximum number of pages to show
|
|
25
|
-
* @default
|
|
16
|
+
* @default 7
|
|
26
17
|
*/
|
|
27
18
|
showPages?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Callback to set the current page
|
|
21
|
+
*/
|
|
22
|
+
setCurrentPage?: (page: number) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Callback when the page changes
|
|
25
|
+
*/
|
|
26
|
+
onChange?: (event: MouseEvent<HTMLElement>, page: number) => void;
|
|
28
27
|
};
|
|
29
28
|
/**
|
|
30
29
|
* Hook to help manage pagination state
|
|
@@ -58,8 +57,17 @@ export type UsePaginationProps = {
|
|
|
58
57
|
export declare const usePagination: ({ currentPage, setCurrentPage, onChange, totalPages, showPages, }: UsePaginationProps) => {
|
|
59
58
|
/** Number of steps */
|
|
60
59
|
pages: {
|
|
60
|
+
/**
|
|
61
|
+
* Page number or "ellipsis" for the ellipsis item
|
|
62
|
+
*/
|
|
61
63
|
page: string | number;
|
|
64
|
+
/**
|
|
65
|
+
* Unique key for the item
|
|
66
|
+
*/
|
|
62
67
|
itemKey: string;
|
|
68
|
+
/**
|
|
69
|
+
* Properties to spread on Pagination.Button
|
|
70
|
+
*/
|
|
63
71
|
buttonProps: PaginationButtonProps | null;
|
|
64
72
|
}[];
|
|
65
73
|
/** Properties to spread on Pagination.Button used for previous naviagation */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../../src/utilities/hooks/usePagination/usePagination.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAcjE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4BI;AACJ,eAAO,MAAM,aAAa,sEAMvB,kBAAkB;IAWf,sBAAsB;;QAGlB;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;qBAOU,qBAAqB,GAAG,IAAI;;IAG7C,8EAA8E;qBAKzE,qBAAqB;IAC1B,0EAA0E;qBAKrE,qBAAqB;IAC1B,gEAAgE;;IAEhE,4DAA4D;;CAGxB,CAAC"}
|
|
@@ -25,7 +25,7 @@ export type UseRadioGroupProps = {
|
|
|
25
25
|
* remove anything that comes from the group itself.
|
|
26
26
|
*/
|
|
27
27
|
export type GetRadioProps = Omit<RadioProps, 'prefix' | 'role' | 'type' | 'size' | 'aria-label' | 'aria-labelledby' | 'label' | 'name' | 'checked' | 'value'> & {
|
|
28
|
-
ref?: React.
|
|
28
|
+
ref?: React.ForwardedRef<HTMLInputElement>;
|
|
29
29
|
value?: string;
|
|
30
30
|
};
|
|
31
31
|
type useRadioGroupReturn = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRadioGroup.d.ts","sourceRoot":"","sources":["../../../../src/utilities/hooks/useRadioGroup/useRadioGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,UAAU,EACR,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,OAAO,GACP,MAAM,GACN,SAAS,GACT,OAAO,CACV,GAAG;IACF,GAAG,CAAC,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"useRadioGroup.d.ts","sourceRoot":"","sources":["../../../../src/utilities/hooks/useRadioGroup/useRadioGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,UAAU,EACR,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,OAAO,GACP,MAAM,GACN,SAAS,GACT,OAAO,CACV,GAAG;IACF,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,aAAa,EAAE,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,KAAK,aAAa,CAAC;IACvE,sBAAsB,EAAE;QACtB,QAAQ,EAAE,SAAS,CAAC;QACpB,MAAM,EAAE,OAAO,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,KAAK,EAAE,WAAgB,GACxB,GAAE,kBAAuB,GAAG,mBAAmB,CAkF/C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digdir/designsystemet-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-next.
|
|
4
|
+
"version": "1.0.0-next.49",
|
|
5
5
|
"description": "React components for Designsystemet",
|
|
6
6
|
"author": "Designsystemet team",
|
|
7
7
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@floating-ui/dom": "^1.6.10",
|
|
46
46
|
"@floating-ui/react": "0.26.23",
|
|
47
|
-
"@navikt/aksel-icons": "^
|
|
47
|
+
"@navikt/aksel-icons": "^7.0.0",
|
|
48
48
|
"@radix-ui/react-slot": "^1.1.1",
|
|
49
49
|
"@tanstack/react-virtual": "^3.11.2",
|
|
50
50
|
"@u-elements/u-datalist": "^0.1.2",
|
|
@@ -58,8 +58,10 @@
|
|
|
58
58
|
"@testing-library/jest-dom": "^6.6.3",
|
|
59
59
|
"@testing-library/react": "^16.2.0",
|
|
60
60
|
"@testing-library/user-event": "^14.6.0",
|
|
61
|
+
"@types/react": "^19.0.8",
|
|
62
|
+
"@types/react-dom": "^19.0.3",
|
|
61
63
|
"copyfiles": "^2.4.1",
|
|
62
|
-
"jsdom": "^
|
|
64
|
+
"jsdom": "^26.0.0",
|
|
63
65
|
"react": "^19.0.0",
|
|
64
66
|
"react-dom": "^19.0.0",
|
|
65
67
|
"rimraf": "^6.0.1",
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var react$1 = require('@floating-ui/react');
|
|
6
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
7
|
-
var cl = require('clsx/lite');
|
|
8
|
-
var react = require('react');
|
|
9
|
-
var ModalTriggerContext = require('./ModalTriggerContext.js');
|
|
10
|
-
var Button = require('../Button/Button.js');
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Modal component, used to display a modal dialog.
|
|
14
|
-
*
|
|
15
|
-
* @example with TriggerContext
|
|
16
|
-
* <Modal.TriggerContext>
|
|
17
|
-
* <Modal.Trigger>Open Modal</Modal.Trigger>
|
|
18
|
-
* <Modal>
|
|
19
|
-
* <Modal.Block>
|
|
20
|
-
* Content
|
|
21
|
-
* </Modal.Block>
|
|
22
|
-
* </Modal>
|
|
23
|
-
* </Modal.TriggerContext>
|
|
24
|
-
*
|
|
25
|
-
* @example without TriggerContext
|
|
26
|
-
* const modalRef = useRef<HTMLDialogElement>(null);
|
|
27
|
-
*
|
|
28
|
-
* ...
|
|
29
|
-
*
|
|
30
|
-
* <Button onClick={() => modalRef.current?.showModal()}>Open Modal</Button>
|
|
31
|
-
* <Modal ref={modalRef}>
|
|
32
|
-
* Content
|
|
33
|
-
* </Modal>
|
|
34
|
-
*/
|
|
35
|
-
const Modal = react.forwardRef(function Modal({ asChild, children, className, closeButton = 'Lukk dialogvindu', onClose, open, backdropClose = false, ...rest }, ref) {
|
|
36
|
-
const contextRef = react.useContext(ModalTriggerContext.Context);
|
|
37
|
-
const modalRef = react.useRef(null); // This local ref is used to make sure the modal works without a ModalTriggerContext
|
|
38
|
-
const Component = asChild ? reactSlot.Slot : 'dialog';
|
|
39
|
-
const mergedRefs = react$1.useMergeRefs([contextRef, ref, modalRef]);
|
|
40
|
-
react.useEffect(() => modalRef.current?.[open ? 'showModal' : 'close'](), [open]); // Toggle open based on prop
|
|
41
|
-
react.useEffect(() => {
|
|
42
|
-
const modal = modalRef.current;
|
|
43
|
-
const handleBackdropClick = ({ clientY: y, clientX: x, target, }) => {
|
|
44
|
-
if (window.getSelection()?.toString())
|
|
45
|
-
return; // Fix bug where if you select text spanning two divs it thinks you clicked outside
|
|
46
|
-
if (modal && target === modal && backdropClose) {
|
|
47
|
-
const { top, left, right, bottom } = modal.getBoundingClientRect();
|
|
48
|
-
const isInDialog = top <= y && y <= bottom && left <= x && x <= right;
|
|
49
|
-
if (!isInDialog)
|
|
50
|
-
modal?.close(); // Both <dialog> and ::backdrop is considered same event.target
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const handleAutoFocus = () => {
|
|
54
|
-
const autofocus = modal?.querySelector('[autofocus]');
|
|
55
|
-
if (document.activeElement !== autofocus)
|
|
56
|
-
autofocus?.focus();
|
|
57
|
-
};
|
|
58
|
-
modal?.addEventListener('animationend', handleAutoFocus);
|
|
59
|
-
modal?.addEventListener('click', handleBackdropClick);
|
|
60
|
-
return () => {
|
|
61
|
-
modal?.removeEventListener('animationend', handleAutoFocus);
|
|
62
|
-
modal?.removeEventListener('click', handleBackdropClick);
|
|
63
|
-
};
|
|
64
|
-
}, [backdropClose]);
|
|
65
|
-
/* handle closing */
|
|
66
|
-
react.useEffect(() => {
|
|
67
|
-
const handleClose = (event) => onClose?.(event);
|
|
68
|
-
modalRef.current?.addEventListener('close', handleClose);
|
|
69
|
-
return () => modalRef.current?.removeEventListener('close', handleClose);
|
|
70
|
-
}, [onClose]);
|
|
71
|
-
return (jsxRuntime.jsxs(Component, { className: cl('ds-modal', className), ref: mergedRefs, ...rest, children: [closeButton !== false && (jsxRuntime.jsx("form", { method: 'dialog', children: jsxRuntime.jsx(Button.Button, { "aria-label": closeButton, autoFocus: true, "data-color": 'neutral', icon: true, name: 'close', type: 'submit', variant: 'tertiary' }) })), children] }));
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
exports.Modal = Modal;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
-
var cl = require('clsx/lite');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* ModalBlock component, used to separate content in a modal.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* <Modal>
|
|
14
|
-
* <Modal.Block>
|
|
15
|
-
* Header
|
|
16
|
-
* </Modal.Block>
|
|
17
|
-
* <Modal.Block>
|
|
18
|
-
* Content
|
|
19
|
-
* </Modal.Block>
|
|
20
|
-
* <Modal.Block>
|
|
21
|
-
* Footer
|
|
22
|
-
* </Modal.Block>
|
|
23
|
-
* </Modal>
|
|
24
|
-
*/
|
|
25
|
-
const ModalBlock = react.forwardRef(function ModalBlock({ asChild, className, ...rest }, ref) {
|
|
26
|
-
const Component = asChild ? reactSlot.Slot : 'div';
|
|
27
|
-
return (jsxRuntime.jsx(Component, { className: cl('ds-modal__block', className), ref: ref, ...rest }));
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
exports.ModalBlock = ModalBlock;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
-
var react = require('react');
|
|
7
|
-
var Button = require('../Button/Button.js');
|
|
8
|
-
var ModalTriggerContext = require('./ModalTriggerContext.js');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* ModalTrigger component, used within a Modal.TriggerContext to open a modal.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* <Modal.TriggerContext>
|
|
15
|
-
* <Modal.Trigger>Open Modal</Modal.Trigger>
|
|
16
|
-
* <Modal>
|
|
17
|
-
* Content
|
|
18
|
-
* </Modal>
|
|
19
|
-
* </Modal.TriggerContext>
|
|
20
|
-
*/
|
|
21
|
-
const ModalTrigger = react.forwardRef(function ModalTrigger({ asChild, ...rest }, ref) {
|
|
22
|
-
const contextRef = react.useContext(ModalTriggerContext.Context);
|
|
23
|
-
const Component = asChild ? reactSlot.Slot : Button.Button;
|
|
24
|
-
return (jsxRuntime.jsx(Component, { "aria-haspopup": 'dialog', onClick: () => contextRef?.current?.showModal(), ref: ref, ...rest }));
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
exports.ModalTrigger = ModalTrigger;
|