@digdir/designsystemet-react 1.1.5 → 1.1.6
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/breadcrumbs/index.js +6 -6
- package/dist/cjs/components/card/index.js +3 -3
- package/dist/cjs/components/chip/index.js +6 -6
- package/dist/cjs/components/details/index.js +4 -4
- package/dist/cjs/components/dialog/index.js +5 -5
- package/dist/cjs/components/dropdown/dropdown-button.js +12 -0
- package/dist/cjs/components/dropdown/dropdown-heading.js +8 -0
- package/dist/cjs/components/dropdown/dropdown-item.js +12 -0
- package/dist/cjs/components/dropdown/dropdown-list.js +12 -0
- package/dist/cjs/components/dropdown/dropdown-trigger-context.js +9 -9
- package/dist/cjs/components/dropdown/dropdown-trigger.js +16 -0
- package/dist/cjs/components/dropdown/index.js +20 -9
- package/dist/cjs/components/error-summary/error-summary-heading.js +8 -0
- package/dist/cjs/components/error-summary/error-summary-item.js +4 -4
- package/dist/cjs/components/error-summary/error-summary-link.js +8 -1
- package/dist/cjs/components/error-summary/error-summary-list.js +15 -0
- package/dist/cjs/components/error-summary/index.js +6 -6
- package/dist/cjs/components/field/field-description.js +6 -0
- package/dist/cjs/components/field/index.js +6 -6
- package/dist/cjs/components/fieldset/fieldset-description.js +2 -2
- package/dist/cjs/components/fieldset/fieldset-legend.js +1 -1
- package/dist/cjs/components/fieldset/index.js +4 -4
- package/dist/cjs/components/list/index.js +5 -5
- package/dist/cjs/components/list/list-item.js +6 -0
- package/dist/cjs/components/list/lists.js +8 -8
- package/dist/cjs/components/pagination/index.js +5 -5
- package/dist/cjs/components/pagination/pagination-button.js +3 -3
- package/dist/cjs/components/pagination/pagination-item.js +5 -5
- package/dist/cjs/components/pagination/pagination-list.js +5 -5
- package/dist/cjs/components/popover/index.js +4 -4
- package/dist/cjs/components/popover/popover-trigger-context.js +3 -3
- package/dist/cjs/components/popover/popover-trigger.js +6 -6
- package/dist/cjs/components/search/index.js +5 -5
- package/dist/cjs/components/search/search-button.js +2 -2
- package/dist/cjs/components/search/search-clear.js +2 -2
- package/dist/cjs/components/search/search-input.js +1 -1
- package/dist/cjs/components/select/index.js +4 -4
- package/dist/cjs/components/select/select-optgroup.js +4 -4
- package/dist/cjs/components/select/select-option.js +2 -2
- package/dist/cjs/components/table/index.js +9 -9
- package/dist/cjs/components/table/table-body.js +6 -6
- package/dist/cjs/components/table/table-cell.js +1 -1
- package/dist/cjs/components/table/table-foot.js +6 -6
- package/dist/cjs/components/table/table-head.js +6 -6
- package/dist/cjs/components/table/table-header-cell.js +1 -1
- package/dist/cjs/components/table/table-row.js +4 -4
- package/dist/cjs/components/tabs/index.js +5 -5
- package/dist/cjs/components/tabs/tabs-list.js +4 -4
- package/dist/cjs/components/tabs/tabs-panel.js +1 -1
- package/dist/cjs/components/tabs/tabs-tab.js +1 -1
- package/dist/cjs/components/toggle-group/index.js +3 -3
- package/dist/cjs/components/toggle-group/toggle-group-item.js +1 -1
- package/dist/esm/components/breadcrumbs/index.js +7 -7
- package/dist/esm/components/card/index.js +4 -4
- package/dist/esm/components/checkbox/checkbox.js +2 -2
- package/dist/esm/components/chip/index.js +6 -6
- package/dist/esm/components/details/index.js +5 -5
- package/dist/esm/components/dialog/index.js +6 -6
- package/dist/esm/components/dropdown/dropdown-button.js +12 -0
- package/dist/esm/components/dropdown/dropdown-heading.js +8 -0
- package/dist/esm/components/dropdown/dropdown-item.js +12 -0
- package/dist/esm/components/dropdown/dropdown-list.js +12 -0
- package/dist/esm/components/dropdown/dropdown-trigger-context.js +9 -9
- package/dist/esm/components/dropdown/dropdown-trigger.js +16 -0
- package/dist/esm/components/dropdown/index.js +21 -10
- package/dist/esm/components/error-summary/error-summary-heading.js +8 -0
- package/dist/esm/components/error-summary/error-summary-item.js +4 -4
- package/dist/esm/components/error-summary/error-summary-link.js +8 -1
- package/dist/esm/components/error-summary/error-summary-list.js +17 -2
- package/dist/esm/components/error-summary/index.js +7 -7
- package/dist/esm/components/field/field-description.js +6 -0
- package/dist/esm/components/field/index.js +7 -7
- package/dist/esm/components/fieldset/fieldset-description.js +2 -2
- package/dist/esm/components/fieldset/fieldset-legend.js +1 -1
- package/dist/esm/components/fieldset/index.js +5 -5
- package/dist/esm/components/list/index.js +5 -5
- package/dist/esm/components/list/list-item.js +6 -0
- package/dist/esm/components/list/lists.js +8 -8
- package/dist/esm/components/pagination/index.js +6 -6
- package/dist/esm/components/pagination/pagination-button.js +3 -3
- package/dist/esm/components/pagination/pagination-item.js +5 -5
- package/dist/esm/components/pagination/pagination-list.js +5 -5
- package/dist/esm/components/popover/index.js +5 -5
- package/dist/esm/components/popover/popover-trigger-context.js +3 -3
- package/dist/esm/components/popover/popover-trigger.js +6 -6
- package/dist/esm/components/radio/radio.js +2 -2
- package/dist/esm/components/search/index.js +6 -6
- package/dist/esm/components/search/search-button.js +2 -2
- package/dist/esm/components/search/search-clear.js +2 -2
- package/dist/esm/components/search/search-input.js +1 -1
- package/dist/esm/components/select/index.js +5 -5
- package/dist/esm/components/select/select-optgroup.js +4 -4
- package/dist/esm/components/select/select-option.js +2 -2
- package/dist/esm/components/suggestion/suggestion.js +2 -2
- package/dist/esm/components/switch/switch.js +2 -2
- package/dist/esm/components/table/index.js +10 -10
- package/dist/esm/components/table/table-body.js +6 -6
- package/dist/esm/components/table/table-cell.js +1 -1
- package/dist/esm/components/table/table-foot.js +6 -6
- package/dist/esm/components/table/table-head.js +6 -6
- package/dist/esm/components/table/table-header-cell.js +1 -1
- package/dist/esm/components/table/table-row.js +4 -4
- package/dist/esm/components/tabs/index.js +6 -6
- package/dist/esm/components/tabs/tabs-list.js +4 -4
- package/dist/esm/components/tabs/tabs-panel.js +1 -1
- package/dist/esm/components/tabs/tabs-tab.js +1 -1
- package/dist/esm/components/textfield/textfield.js +2 -2
- package/dist/esm/components/toggle-group/index.js +4 -4
- package/dist/esm/components/toggle-group/toggle-group-item.js +1 -1
- package/dist/react-types.d.ts +1 -2
- package/dist/types/colors.d.ts +1 -23
- package/dist/types/colors.d.ts.map +1 -1
- package/dist/types/components/Combobox/Combobox.d.ts +2 -2
- package/dist/types/components/Combobox/useFormField/useFormField.d.ts +1 -1
- package/dist/types/components/Combobox/useFormField/useFormField.d.ts.map +1 -1
- package/dist/types/components/alert/alert.d.ts +1 -1
- package/dist/types/components/alert/alert.d.ts.map +1 -1
- package/dist/types/components/avatar/avatar.d.ts +2 -1
- package/dist/types/components/avatar/avatar.d.ts.map +1 -1
- package/dist/types/components/badge/badge.d.ts +1 -1
- package/dist/types/components/badge/badge.d.ts.map +1 -1
- package/dist/types/components/badge/index.d.ts +1 -1
- package/dist/types/components/breadcrumbs/index.d.ts +48 -12
- package/dist/types/components/breadcrumbs/index.d.ts.map +1 -1
- package/dist/types/components/button/button.d.ts +3 -3
- package/dist/types/components/button/button.d.ts.map +1 -1
- package/dist/types/components/card/index.d.ts +18 -10
- package/dist/types/components/card/index.d.ts.map +1 -1
- package/dist/types/components/chip/index.d.ts +33 -14
- package/dist/types/components/chip/index.d.ts.map +1 -1
- package/dist/types/components/details/index.d.ts +19 -7
- package/dist/types/components/details/index.d.ts.map +1 -1
- package/dist/types/components/dialog/dialog-trigger.d.ts +1 -1
- package/dist/types/components/dialog/index.d.ts +46 -25
- package/dist/types/components/dialog/index.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown-button.d.ts +12 -0
- package/dist/types/components/dropdown/dropdown-button.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown-heading.d.ts +8 -0
- package/dist/types/components/dropdown/dropdown-heading.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown-item.d.ts +12 -0
- package/dist/types/components/dropdown/dropdown-item.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown-list.d.ts +12 -0
- package/dist/types/components/dropdown/dropdown-list.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown-trigger-context.d.ts +9 -9
- package/dist/types/components/dropdown/dropdown-trigger.d.ts +16 -0
- package/dist/types/components/dropdown/dropdown-trigger.d.ts.map +1 -1
- package/dist/types/components/dropdown/index.d.ts +99 -19
- package/dist/types/components/dropdown/index.d.ts.map +1 -1
- package/dist/types/components/error-summary/error-summary-heading.d.ts +8 -0
- package/dist/types/components/error-summary/error-summary-heading.d.ts.map +1 -1
- package/dist/types/components/error-summary/error-summary-item.d.ts +4 -4
- package/dist/types/components/error-summary/error-summary-link.d.ts +8 -1
- package/dist/types/components/error-summary/error-summary-link.d.ts.map +1 -1
- package/dist/types/components/error-summary/error-summary-list.d.ts +15 -0
- package/dist/types/components/error-summary/error-summary-list.d.ts.map +1 -1
- package/dist/types/components/error-summary/index.d.ts +52 -20
- package/dist/types/components/error-summary/index.d.ts.map +1 -1
- package/dist/types/components/field/field-counter.d.ts +1 -1
- package/dist/types/components/field/field-description.d.ts +6 -0
- package/dist/types/components/field/field-description.d.ts.map +1 -1
- package/dist/types/components/field/index.d.ts +45 -17
- package/dist/types/components/field/index.d.ts.map +1 -1
- package/dist/types/components/fieldset/fieldset-description.d.ts +2 -2
- package/dist/types/components/fieldset/fieldset-legend.d.ts +1 -1
- package/dist/types/components/fieldset/index.d.ts +21 -9
- package/dist/types/components/fieldset/index.d.ts.map +1 -1
- package/dist/types/components/list/index.d.ts +32 -11
- package/dist/types/components/list/index.d.ts.map +1 -1
- package/dist/types/components/list/list-item.d.ts +6 -0
- package/dist/types/components/list/list-item.d.ts.map +1 -1
- package/dist/types/components/list/lists.d.ts +8 -8
- package/dist/types/components/pagination/index.d.ts +38 -15
- package/dist/types/components/pagination/index.d.ts.map +1 -1
- package/dist/types/components/pagination/pagination-button.d.ts +3 -3
- package/dist/types/components/pagination/pagination-item.d.ts +5 -5
- package/dist/types/components/pagination/pagination-list.d.ts +5 -5
- package/dist/types/components/popover/index.d.ts +39 -18
- package/dist/types/components/popover/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover-trigger-context.d.ts +3 -3
- package/dist/types/components/popover/popover-trigger.d.ts +6 -6
- package/dist/types/components/popover/popover.d.ts +1 -1
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/search/index.d.ts +34 -15
- package/dist/types/components/search/index.d.ts.map +1 -1
- package/dist/types/components/search/search-button.d.ts +3 -3
- package/dist/types/components/search/search-clear.d.ts +2 -2
- package/dist/types/components/search/search-input.d.ts +1 -1
- package/dist/types/components/select/index.d.ts +27 -12
- package/dist/types/components/select/index.d.ts.map +1 -1
- package/dist/types/components/select/select-optgroup.d.ts +4 -4
- package/dist/types/components/select/select-option.d.ts +2 -2
- package/dist/types/components/suggestion/suggestion.d.ts +8 -8
- package/dist/types/components/table/index.d.ts +65 -16
- package/dist/types/components/table/index.d.ts.map +1 -1
- package/dist/types/components/table/table-body.d.ts +6 -6
- package/dist/types/components/table/table-cell.d.ts +1 -1
- package/dist/types/components/table/table-foot.d.ts +6 -6
- package/dist/types/components/table/table-head.d.ts +6 -6
- package/dist/types/components/table/table-header-cell.d.ts +1 -1
- package/dist/types/components/table/table-row.d.ts +4 -4
- package/dist/types/components/tabs/index.d.ts +29 -14
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/tabs/tabs-list.d.ts +4 -4
- package/dist/types/components/tabs/tabs-panel.d.ts +1 -1
- package/dist/types/components/tabs/tabs-tab.d.ts +1 -1
- package/dist/types/components/tag/tag.d.ts +1 -1
- package/dist/types/components/tag/tag.d.ts.map +1 -1
- package/dist/types/components/toggle-group/index.d.ts +11 -11
- package/dist/types/components/toggle-group/index.d.ts.map +1 -1
- package/dist/types/components/toggle-group/toggle-group-item.d.ts +1 -1
- package/dist/types/components/validation-message/validation-message.d.ts +1 -1
- package/dist/types/components/validation-message/validation-message.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utilities/roving-focus/use-roving-focus.d.ts +2 -2
- package/package.json +8 -7
|
@@ -3,6 +3,22 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { PopoverTrigger } from '../popover/popover-trigger.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* DropdownTrigger component, used within a Dropdown.TriggerContext to open a Dropdown.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <Dropdown.TriggerContext>
|
|
11
|
+
* <Dropdown.Trigger>Dropdown</Dropdown.Trigger>
|
|
12
|
+
* <Dropdown>
|
|
13
|
+
* <Dropdown.Heading>Heading</Dropdown.Heading>
|
|
14
|
+
* <Dropdown.List>
|
|
15
|
+
* <Dropdown.Item>
|
|
16
|
+
* <Dropdown.Button>Button</Dropdown.Button>
|
|
17
|
+
* </Dropdown.Item>
|
|
18
|
+
* </Dropdown.List>
|
|
19
|
+
* </Dropdown>
|
|
20
|
+
* </Dropdown.TriggerContext>
|
|
21
|
+
*/
|
|
6
22
|
const DropdownTrigger = forwardRef(function DropdownTrigger({ asChild, ...rest }, ref) {
|
|
7
23
|
return jsx(PopoverTrigger, { ref: ref, ...rest });
|
|
8
24
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Dropdown
|
|
2
|
+
import { Dropdown } from './dropdown.js';
|
|
3
3
|
import { DropdownButton } from './dropdown-button.js';
|
|
4
4
|
import { DropdownHeading } from './dropdown-heading.js';
|
|
5
5
|
import { DropdownItem } from './dropdown-item.js';
|
|
@@ -10,7 +10,7 @@ import { DropdownTriggerContext } from './dropdown-trigger-context.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* Dropdown component, used to display a list of options.
|
|
12
12
|
*
|
|
13
|
-
* @example
|
|
13
|
+
* @example with TriggerContext
|
|
14
14
|
* <Dropdown.TriggerContext>
|
|
15
15
|
* <Dropdown.Trigger>Dropdown trigger</Dropdown.Trigger>
|
|
16
16
|
* <Dropdown placement='bottom-end'>
|
|
@@ -22,8 +22,19 @@ import { DropdownTriggerContext } from './dropdown-trigger-context.js';
|
|
|
22
22
|
* </Dropdown.List>
|
|
23
23
|
* </Dropdown>
|
|
24
24
|
* </Dropdown.TriggerContext>
|
|
25
|
+
*
|
|
26
|
+
* @example without TriggerContext
|
|
27
|
+
* <Button popovertarget="my-dropdown">Trigger</Button>
|
|
28
|
+
* <Dropdown id="my-dropdown">
|
|
29
|
+
* <Dropdown.Heading>Heading</Dropdown.Heading>
|
|
30
|
+
* <Dropdown.List>
|
|
31
|
+
* <Dropdown.Item>
|
|
32
|
+
* <Dropdown.Button>Item</Dropdown.Button>
|
|
33
|
+
* </Dropdown.Item>
|
|
34
|
+
* </Dropdown.List>
|
|
35
|
+
* </Dropdown>
|
|
25
36
|
*/
|
|
26
|
-
const
|
|
37
|
+
const DropdownComponent = Object.assign(Dropdown, {
|
|
27
38
|
TriggerContext: DropdownTriggerContext,
|
|
28
39
|
Heading: DropdownHeading,
|
|
29
40
|
List: DropdownList,
|
|
@@ -31,11 +42,11 @@ const Dropdown = Object.assign(Dropdown$1, {
|
|
|
31
42
|
Button: DropdownButton,
|
|
32
43
|
Trigger: DropdownTrigger,
|
|
33
44
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
DropdownComponent.TriggerContext.displayName = 'Dropdown.TriggerContext';
|
|
46
|
+
DropdownComponent.List.displayName = 'Dropdown.List';
|
|
47
|
+
DropdownComponent.Heading.displayName = 'Dropdown.Heading';
|
|
48
|
+
DropdownComponent.Item.displayName = 'Dropdown.Item';
|
|
49
|
+
DropdownComponent.Button.displayName = 'Dropdown.Button';
|
|
50
|
+
DropdownComponent.Trigger.displayName = 'Dropdown.Trigger';
|
|
40
51
|
|
|
41
|
-
export { Dropdown, DropdownButton, DropdownHeading, DropdownItem, DropdownList, DropdownTrigger, DropdownTriggerContext };
|
|
52
|
+
export { DropdownComponent as Dropdown, DropdownButton, DropdownHeading, DropdownItem, DropdownList, DropdownTrigger, DropdownTriggerContext };
|
|
@@ -4,6 +4,14 @@ import { forwardRef, useContext, useEffect } from 'react';
|
|
|
4
4
|
import { Heading } from '../heading/heading.js';
|
|
5
5
|
import { ErrorSummaryContext } from './error-summary.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* ErrorSummary heading component, used to display a heading for the error summary.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <ErrorSummary>
|
|
12
|
+
* <ErrorSummaryHeading>Heading</ErrorSummaryHeading>
|
|
13
|
+
* </ErrorSummary>
|
|
14
|
+
*/
|
|
7
15
|
const ErrorSummaryHeading = forwardRef(function ErrorSummaryHeading({ className, id, ...rest }, ref) {
|
|
8
16
|
const { headingId, setHeadingId } = useContext(ErrorSummaryContext);
|
|
9
17
|
useEffect(() => {
|
|
@@ -8,11 +8,11 @@ import { ListItem } from '../list/list-item.js';
|
|
|
8
8
|
* ErrorSummaryItem component, used to display an error link in the ErrorSummary.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
* <
|
|
12
|
-
* <
|
|
11
|
+
* <ErrorSummaryItem>
|
|
12
|
+
* <ErrorSummaryLink href="#">
|
|
13
13
|
* Link to error
|
|
14
|
-
* </
|
|
15
|
-
* </
|
|
14
|
+
* </ErrorSummaryLink>
|
|
15
|
+
* </ErrorSummaryItem>
|
|
16
16
|
*/
|
|
17
17
|
const ErrorSummaryItem = forwardRef(function ErrorSummaryItem({ ...rest }, ref) {
|
|
18
18
|
return jsx(ListItem, { ref: ref, ...rest });
|
|
@@ -4,7 +4,14 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { Link } from '../link/link.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* ErrorSummary link component, used to link to a specific error. Used within an ErrorSummary.Item.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <ErrorSummary>
|
|
11
|
+
* <ErrorSummaryItem>
|
|
12
|
+
* <ErrorSummaryLink href='#'>Error 1</ErrorSummaryLink>
|
|
13
|
+
* </ErrorSummaryItem>
|
|
14
|
+
* </ErrorSummary>
|
|
8
15
|
*/
|
|
9
16
|
const ErrorSummaryLink = forwardRef(function ErrorSummaryLink({ ...rest }, ref) {
|
|
10
17
|
return jsx(Link, { ref: ref, "data-color": 'neutral', ...rest });
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { List } from '../list/index.js';
|
|
4
|
+
import { List as ListComponent } from '../list/index.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* ErrorSummary list component, used to display a list of errors.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <ErrorSummary>
|
|
11
|
+
* <ErrorSummary.List>
|
|
12
|
+
* <ErrorSummary.Item>
|
|
13
|
+
* <ErrorSummary.Link href='#'>Error 1</ErrorSummary.Link>
|
|
14
|
+
* </ErrorSummary.Item>
|
|
15
|
+
* <ErrorSummary.Item>
|
|
16
|
+
* <ErrorSummary.Link href='#'>Error 2</ErrorSummary.Link>
|
|
17
|
+
* </ErrorSummary.Item>
|
|
18
|
+
* </ErrorSummary.List>
|
|
19
|
+
* </ErrorSummary>
|
|
20
|
+
*/
|
|
6
21
|
const ErrorSummaryList = forwardRef(function ErrorSummaryList({ ...rest }, ref) {
|
|
7
|
-
return jsx(
|
|
22
|
+
return jsx(ListComponent.Unordered, { ...rest, ref: ref });
|
|
8
23
|
});
|
|
9
24
|
|
|
10
25
|
export { ErrorSummaryList };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { ErrorSummary
|
|
2
|
+
import { ErrorSummary } from './error-summary.js';
|
|
3
3
|
import { ErrorSummaryHeading } from './error-summary-heading.js';
|
|
4
4
|
import { ErrorSummaryItem } from './error-summary-item.js';
|
|
5
5
|
import { ErrorSummaryLink } from './error-summary-link.js';
|
|
@@ -21,15 +21,15 @@ import { ErrorSummaryList } from './error-summary-list.js';
|
|
|
21
21
|
* </ErrorSummary.List>
|
|
22
22
|
* </ErrorSummary>
|
|
23
23
|
*/
|
|
24
|
-
const
|
|
24
|
+
const ErrorSummaryComponent = Object.assign(ErrorSummary, {
|
|
25
25
|
Heading: ErrorSummaryHeading,
|
|
26
26
|
Item: ErrorSummaryItem,
|
|
27
27
|
List: ErrorSummaryList,
|
|
28
28
|
Link: ErrorSummaryLink,
|
|
29
29
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
ErrorSummaryComponent.Item.displayName = 'ErrorSummary.Item';
|
|
31
|
+
ErrorSummaryComponent.Heading.displayName = 'ErrorSummary.Heading';
|
|
32
|
+
ErrorSummaryComponent.List.displayName = 'ErrorSummary.List';
|
|
33
|
+
ErrorSummaryComponent.Link.displayName = 'ErrorSummary.Link';
|
|
34
34
|
|
|
35
|
-
export { ErrorSummary, ErrorSummaryHeading, ErrorSummaryItem, ErrorSummaryLink, ErrorSummaryList };
|
|
35
|
+
export { ErrorSummaryComponent as ErrorSummary, ErrorSummaryHeading, ErrorSummaryItem, ErrorSummaryLink, ErrorSummaryList };
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Field description component, used to provide additional information below the input.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <FieldDescription>Additional information</FieldDescription>
|
|
10
|
+
*/
|
|
5
11
|
const FieldDescription = forwardRef(function FieldDescription(rest, ref) {
|
|
6
12
|
return jsx("div", { "data-field": 'description', ref: ref, ...rest });
|
|
7
13
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Field
|
|
2
|
+
import { Field } from './field.js';
|
|
3
3
|
import { FieldAffix, FieldAffixes } from './field-affix.js';
|
|
4
4
|
import { FieldCounter } from './field-counter.js';
|
|
5
5
|
import { FieldDescription } from './field-description.js';
|
|
@@ -15,15 +15,15 @@ import { FieldDescription } from './field-description.js';
|
|
|
15
15
|
* <ValidationMessage>Feilmelding</ValidationMessage>
|
|
16
16
|
* </Field>
|
|
17
17
|
*/
|
|
18
|
-
const
|
|
18
|
+
const FieldComponent = Object.assign(Field, {
|
|
19
19
|
Description: FieldDescription,
|
|
20
20
|
Affixes: FieldAffixes,
|
|
21
21
|
Affix: FieldAffix,
|
|
22
22
|
Counter: FieldCounter,
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
FieldComponent.Description.displayName = 'Field.Description';
|
|
25
|
+
FieldComponent.Affixes.displayName = 'Field.Affixes';
|
|
26
|
+
FieldComponent.Affix.displayName = 'Field.Affix';
|
|
27
|
+
FieldComponent.Counter.displayName = 'Field.Counter';
|
|
28
28
|
|
|
29
|
-
export { Field, FieldAffix, FieldAffixes, FieldCounter, FieldDescription };
|
|
29
|
+
export { FieldComponent as Field, FieldAffix, FieldAffixes, FieldCounter, FieldDescription };
|
|
@@ -7,9 +7,9 @@ import { Paragraph } from '../paragraph/paragraph.js';
|
|
|
7
7
|
* FieldsetDescription component, used to display a description for a fieldset.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* <
|
|
10
|
+
* <FieldsetDescription>
|
|
11
11
|
* Gi en kort beskrivelse i begge feltene
|
|
12
|
-
* </
|
|
12
|
+
* </FieldsetDescription>
|
|
13
13
|
*/
|
|
14
14
|
const FieldsetDescription = forwardRef(function FieldsetDescription(rest, ref) {
|
|
15
15
|
return jsx(Paragraph, { ref: ref, ...rest });
|
|
@@ -7,7 +7,7 @@ import { Label } from '../label/label.js';
|
|
|
7
7
|
* FieldsetLegend component, used to display a legend for a fieldset.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* <
|
|
10
|
+
* <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>
|
|
11
11
|
*/
|
|
12
12
|
const FieldsetLegend = forwardRef(function FieldsetLegend(rest, ref) {
|
|
13
13
|
return (jsx(Label, { asChild: true, children: jsx("legend", { ref: ref, ...rest }) }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Fieldset
|
|
2
|
+
import { Fieldset } from './fieldset.js';
|
|
3
3
|
import { FieldsetDescription } from './fieldset-description.js';
|
|
4
4
|
import { FieldsetLegend } from './fieldset-legend.js';
|
|
5
5
|
|
|
@@ -18,11 +18,11 @@ import { FieldsetLegend } from './fieldset-legend.js';
|
|
|
18
18
|
* </Field>
|
|
19
19
|
* </Fieldset>
|
|
20
20
|
*/
|
|
21
|
-
const
|
|
21
|
+
const FieldsetComponent = Object.assign(Fieldset, {
|
|
22
22
|
Legend: FieldsetLegend,
|
|
23
23
|
Description: FieldsetDescription,
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
FieldsetComponent.Legend.displayName = 'Fieldset.Legend';
|
|
26
|
+
FieldsetComponent.Description.displayName = 'Fieldset.Description';
|
|
27
27
|
|
|
28
|
-
export { Fieldset, FieldsetDescription, FieldsetLegend };
|
|
28
|
+
export { FieldsetComponent as Fieldset, FieldsetDescription, FieldsetLegend };
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { ListItem } from './list-item.js';
|
|
3
3
|
import { ListUnordered, ListOrdered } from './lists.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const ListComponent = {
|
|
6
6
|
Item: ListItem,
|
|
7
7
|
Ordered: ListOrdered,
|
|
8
8
|
Unordered: ListUnordered,
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
ListComponent.Item.displayName = 'List.Item';
|
|
11
|
+
ListComponent.Ordered.displayName = 'List.Ordered';
|
|
12
|
+
ListComponent.Unordered.displayName = 'List.Unordered';
|
|
13
13
|
|
|
14
|
-
export { List, ListItem, ListOrdered, ListUnordered };
|
|
14
|
+
export { ListComponent as List, ListItem, ListOrdered, ListUnordered };
|
|
@@ -3,6 +3,12 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Component that provides a list item.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <List.Item>Item</List.Item>
|
|
11
|
+
*/
|
|
6
12
|
const ListItem = forwardRef(function ListItem({ asChild, ...rest }, ref) {
|
|
7
13
|
const Component = asChild ? Slot : 'li';
|
|
8
14
|
return jsx(Component, { ...rest, ref: ref });
|
|
@@ -13,10 +13,10 @@ const render = (tagName, { asChild, className, ...rest }, ref) => {
|
|
|
13
13
|
* Renders a native `ul` element.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* <
|
|
17
|
-
* <
|
|
18
|
-
* <
|
|
19
|
-
* </
|
|
16
|
+
* <ListUnordered>
|
|
17
|
+
* <ListItem>Item 1</ListItem>
|
|
18
|
+
* <ListItem>Item 2</ListItem>
|
|
19
|
+
* </ListUnordered>
|
|
20
20
|
*/
|
|
21
21
|
const ListUnordered = forwardRef(function ListUnordered(props, ref) {
|
|
22
22
|
return render('ul', props, ref);
|
|
@@ -26,10 +26,10 @@ const ListUnordered = forwardRef(function ListUnordered(props, ref) {
|
|
|
26
26
|
* Renders a native `ol` element.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
|
-
* <
|
|
30
|
-
* <
|
|
31
|
-
* <
|
|
32
|
-
* </
|
|
29
|
+
* <ListOrdered>
|
|
30
|
+
* <ListItem>Item 1</ListItem>
|
|
31
|
+
* <ListItem>Item 2</ListItem>
|
|
32
|
+
* </ListOrdered>
|
|
33
33
|
*/
|
|
34
34
|
const ListOrdered = forwardRef(function ListOrdered(props, ref) {
|
|
35
35
|
return render('ol', props, ref);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Pagination
|
|
2
|
+
import { Pagination } from './pagination.js';
|
|
3
3
|
import { PaginationButton } from './pagination-button.js';
|
|
4
4
|
import { PaginationItem } from './pagination-item.js';
|
|
5
5
|
import { PaginationList } from './pagination-list.js';
|
|
@@ -22,13 +22,13 @@ import { PaginationList } from './pagination-list.js';
|
|
|
22
22
|
* </Pagination.List>
|
|
23
23
|
* </Pagination>
|
|
24
24
|
*/
|
|
25
|
-
const
|
|
25
|
+
const PaginationComponent = Object.assign(Pagination, {
|
|
26
26
|
List: PaginationList,
|
|
27
27
|
Item: PaginationItem,
|
|
28
28
|
Button: PaginationButton,
|
|
29
29
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
PaginationComponent.List.displayName = 'Pagination.List';
|
|
31
|
+
PaginationComponent.Item.displayName = 'Pagination.Item';
|
|
32
|
+
PaginationComponent.Button.displayName = 'Pagination.Button';
|
|
33
33
|
|
|
34
|
-
export { Pagination, PaginationButton, PaginationItem, PaginationList };
|
|
34
|
+
export { PaginationComponent as Pagination, PaginationButton, PaginationItem, PaginationList };
|
|
@@ -7,9 +7,9 @@ import { Button } from '../button/button.js';
|
|
|
7
7
|
* PaginationButton component, use within a Pagination.Item.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* <
|
|
11
|
-
* <
|
|
12
|
-
* </
|
|
10
|
+
* <PaginationItem>
|
|
11
|
+
* <PaginationButton aria-label='Forrige side'>Forrige</PaginationButton>
|
|
12
|
+
* </PaginationItem>
|
|
13
13
|
*/
|
|
14
14
|
const PaginationButton = forwardRef(function PaginationButton(rest, ref) {
|
|
15
15
|
return jsx(Button, { ref: ref, ...rest });
|
|
@@ -7,11 +7,11 @@ import { forwardRef } from 'react';
|
|
|
7
7
|
* PaginationItem component, use within a Pagination.List.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* <
|
|
11
|
-
* <
|
|
12
|
-
* <
|
|
13
|
-
* </
|
|
14
|
-
* </
|
|
10
|
+
* <PaginationList>
|
|
11
|
+
* <PaginationItem>
|
|
12
|
+
* <PaginationButton aria-label='Forrige side'>Forrige</PaginationButton>
|
|
13
|
+
* </PaginationItem>
|
|
14
|
+
* </PaginationList>
|
|
15
15
|
*/
|
|
16
16
|
const PaginationItem = forwardRef(function PaginationItem({ asChild, className, ...rest }, ref) {
|
|
17
17
|
const Component = asChild ? Slot : 'li';
|
|
@@ -8,11 +8,11 @@ import { forwardRef } from 'react';
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* <Pagination>
|
|
11
|
-
* <
|
|
12
|
-
* <
|
|
13
|
-
* <
|
|
14
|
-
* </
|
|
15
|
-
* </
|
|
11
|
+
* <PaginationList>
|
|
12
|
+
* <PaginationItem>
|
|
13
|
+
* <PaginationButton aria-label='Forrige side'>Forrige</PaginationButton>
|
|
14
|
+
* </PaginationItem>
|
|
15
|
+
* </PaginationList>
|
|
16
16
|
* </Pagination>
|
|
17
17
|
*/
|
|
18
18
|
const PaginationList = forwardRef(function PaginationList({ asChild, ...rest }, ref) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Popover
|
|
2
|
+
import { Popover } from './popover.js';
|
|
3
3
|
import { PopoverTrigger } from './popover-trigger.js';
|
|
4
4
|
import { PopoverTriggerContext } from './popover-trigger-context.js';
|
|
5
5
|
|
|
@@ -14,11 +14,11 @@ import { PopoverTriggerContext } from './popover-trigger-context.js';
|
|
|
14
14
|
* </Popover>
|
|
15
15
|
* </Popover.TriggerContext>
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const PopoverComponent = Object.assign(Popover, {
|
|
18
18
|
TriggerContext: PopoverTriggerContext,
|
|
19
19
|
Trigger: PopoverTrigger,
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
PopoverComponent.TriggerContext.displayName = 'Popover.TriggerContext';
|
|
22
|
+
PopoverComponent.Trigger.displayName = 'Popover.Trigger';
|
|
23
23
|
|
|
24
|
-
export { Popover, PopoverTrigger, PopoverTriggerContext };
|
|
24
|
+
export { PopoverComponent as Popover, PopoverTrigger, PopoverTriggerContext };
|
|
@@ -6,12 +6,12 @@ import { createContext, useId, useState } from 'react';
|
|
|
6
6
|
* PopoverTriggerContext component, use to wrap a Popover.Trigger and Popover.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* <
|
|
10
|
-
* <
|
|
9
|
+
* <PopoverTriggerContext>
|
|
10
|
+
* <PopoverTrigger>Open Popover</PopoverTrigger>
|
|
11
11
|
* <Popover>
|
|
12
12
|
* Content
|
|
13
13
|
* </Popover>
|
|
14
|
-
* </
|
|
14
|
+
* </PopoverTriggerContext>
|
|
15
15
|
*/
|
|
16
16
|
const PopoverTriggerContext = ({ children, }) => {
|
|
17
17
|
const randomPopoverId = useId();
|
|
@@ -9,22 +9,22 @@ import { Context } from './popover-trigger-context.js';
|
|
|
9
9
|
* PopoverTrigger component, used to trigger a popover.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
* <
|
|
13
|
-
* <
|
|
12
|
+
* <PopoverTriggerContext>
|
|
13
|
+
* <PopoverTrigger>Open Popover</PopoverTrigger>
|
|
14
14
|
* <Popover>
|
|
15
15
|
* Content
|
|
16
16
|
* </Popover>
|
|
17
|
-
* </
|
|
17
|
+
* </PopoverTriggerContext>
|
|
18
18
|
*
|
|
19
19
|
* @example inline
|
|
20
|
-
* <
|
|
20
|
+
* <PopoverTriggerContext>
|
|
21
21
|
* <Paragraph>
|
|
22
|
-
* We can use it <
|
|
22
|
+
* We can use it <PopoverTrigger inline={true}>inline</PopoverTrigger>.
|
|
23
23
|
* </Paragraph>
|
|
24
24
|
* <Popover>
|
|
25
25
|
* Content
|
|
26
26
|
* </Popover>
|
|
27
|
-
* </
|
|
27
|
+
* </PopoverTriggerContext>
|
|
28
28
|
*/
|
|
29
29
|
const PopoverTrigger = forwardRef(function PopoverTrigger({ id, inline, asChild, ...rest }, ref) {
|
|
30
30
|
const { popoverId } = useContext(Context);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { Field } from '../field/index.js';
|
|
4
|
+
import { Field as FieldComponent } from '../field/index.js';
|
|
5
5
|
import { Input } from '../input/input.js';
|
|
6
6
|
import { Label } from '../label/label.js';
|
|
7
7
|
import { ValidationMessage } from '../validation-message/validation-message.js';
|
|
@@ -13,7 +13,7 @@ import { ValidationMessage } from '../validation-message/validation-message.js';
|
|
|
13
13
|
* <Radio label="I agree" value="agree" />
|
|
14
14
|
*/
|
|
15
15
|
const Radio = forwardRef(function Radio({ 'data-size': size, className, style, children, label, description, error, ...rest }, ref) {
|
|
16
|
-
return (jsxs(
|
|
16
|
+
return (jsxs(FieldComponent, { "data-size": size, className: className, style: style, children: [jsx(Input, { type: 'radio', ref: ref, ...rest }), !!label && jsx(Label, { weight: 'regular', children: label }), !!description && jsx("div", { "data-field": 'description', children: description }), !!error && jsx(ValidationMessage, { children: error })] }));
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
export { Radio };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Search
|
|
2
|
+
import { Search } from './search.js';
|
|
3
3
|
import { SearchButton } from './search-button.js';
|
|
4
4
|
import { SearchClear } from './search-clear.js';
|
|
5
5
|
import { SearchInput } from './search-input.js';
|
|
@@ -20,13 +20,13 @@ import { SearchInput } from './search-input.js';
|
|
|
20
20
|
* <Search.Clear />
|
|
21
21
|
* </Search>
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const SearchComponent = Object.assign(Search, {
|
|
24
24
|
Clear: SearchClear,
|
|
25
25
|
Button: SearchButton,
|
|
26
26
|
Input: SearchInput,
|
|
27
27
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
SearchComponent.Clear.displayName = 'Search.Clear';
|
|
29
|
+
SearchComponent.Button.displayName = 'Search.Button';
|
|
30
|
+
SearchComponent.Input.displayName = 'Search.Input';
|
|
31
31
|
|
|
32
|
-
export { Search, SearchButton, SearchClear, SearchInput };
|
|
32
|
+
export { SearchComponent as Search, SearchButton, SearchClear, SearchInput };
|
|
@@ -8,8 +8,8 @@ import { Button } from '../button/button.js';
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* <Search>
|
|
11
|
-
* <
|
|
12
|
-
* <
|
|
11
|
+
* <SearchInput aria-label='Søk' />
|
|
12
|
+
* <SearchButton>Søk</SearchButton>
|
|
13
13
|
* </Search>
|
|
14
14
|
*/
|
|
15
15
|
const SearchButton = forwardRef(function SearchButton({ children = 'Søk', ...rest }, ref) {
|
|
@@ -9,8 +9,8 @@ import { setReactInputValue } from '../Combobox/utilities.js';
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* <Search>
|
|
12
|
-
* <
|
|
13
|
-
* <
|
|
12
|
+
* <SearchInput aria-label='Søk' />
|
|
13
|
+
* <SearchClear />
|
|
14
14
|
* </Search>
|
|
15
15
|
*/
|
|
16
16
|
const SearchClear = forwardRef(function SearchClear({ 'aria-label': label = 'Tøm', onClick, ...rest }, ref) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Select
|
|
2
|
+
import { Select } from './select.js';
|
|
3
3
|
import { SelectOptgroup } from './select-optgroup.js';
|
|
4
4
|
import { SelectOption } from './select-option.js';
|
|
5
5
|
|
|
@@ -12,11 +12,11 @@ import { SelectOption } from './select-option.js';
|
|
|
12
12
|
* <Select.Option value='2'>Option 2</Select.Option>
|
|
13
13
|
* </Select>
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
15
|
+
const SelectComponent = Object.assign(Select, {
|
|
16
16
|
Option: SelectOption,
|
|
17
17
|
Optgroup: SelectOptgroup,
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
SelectComponent.Option.displayName = 'Select.Option';
|
|
20
|
+
SelectComponent.Optgroup.displayName = 'Select.Optgroup';
|
|
21
21
|
|
|
22
|
-
export { Select, SelectOptgroup, SelectOption };
|
|
22
|
+
export { SelectComponent as Select, SelectOptgroup, SelectOption };
|
|
@@ -8,10 +8,10 @@ import { forwardRef } from 'react';
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* <Select>
|
|
11
|
-
* <
|
|
12
|
-
* <
|
|
13
|
-
* <
|
|
14
|
-
* </
|
|
11
|
+
* <SelectOptgroup label='Group 1'>
|
|
12
|
+
* <SelectOption value='1'>Option 1</SelectOption>
|
|
13
|
+
* <SelectOption value='2'>Option 2</SelectOption>
|
|
14
|
+
* </SelectOptgroup>
|
|
15
15
|
* </Select>
|
|
16
16
|
*/
|
|
17
17
|
const SelectOptgroup = forwardRef(function SelectOptgroup({ asChild, ...rest }, ref) {
|
|
@@ -8,8 +8,8 @@ import { forwardRef } from 'react';
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* <Select>
|
|
11
|
-
* <
|
|
12
|
-
* <
|
|
11
|
+
* <SelectOption value='1'>Option 1</SelectOption>
|
|
12
|
+
* <SelectOption value='2'>Option 2</SelectOption>
|
|
13
13
|
* </Select>
|
|
14
14
|
*/
|
|
15
15
|
const SelectOption = forwardRef(function SelectOption({ asChild, ...rest }, ref) {
|