@navikt/ds-react 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_docs.json +171 -5
- package/cjs/accordion/Accordion.js +22 -2
- package/cjs/alert/Alert.js +9 -0
- package/cjs/button/Button.js +10 -0
- package/cjs/chat/Chat.js +16 -0
- package/cjs/chips/Chips.js +27 -0
- package/cjs/chips/Toggle.js +4 -6
- package/cjs/copybutton/CopyButton.js +11 -0
- package/cjs/date/DateInput.js +1 -1
- package/cjs/date/datepicker/DatePicker.js +22 -0
- package/cjs/date/hooks/useDatepicker.js +13 -0
- package/cjs/date/hooks/useMonthPicker.js +13 -0
- package/cjs/date/hooks/useRangeDatepicker.js +12 -0
- package/cjs/date/monthpicker/MonthPicker.js +22 -0
- package/cjs/dropdown/Dropdown.js +31 -0
- package/cjs/dropdown/Menu/GroupedList/index.js +1 -1
- package/cjs/dropdown/Menu/List/index.js +1 -1
- package/cjs/dropdown/Menu/index.js +1 -1
- package/cjs/expansion-card/ExpansionCard.js +18 -0
- package/cjs/form/ConfirmationPanel.js +18 -0
- package/cjs/form/Select.js +16 -0
- package/cjs/form/Switch.js +11 -0
- package/cjs/form/TextField.js +11 -0
- package/cjs/form/Textarea.js +11 -0
- package/cjs/form/checkbox/CheckboxGroup.js +15 -0
- package/cjs/form/error-summary/ErrorSummary.js +18 -0
- package/cjs/form/radio/RadioGroup.js +2 -2
- package/cjs/form/search/Search.js +13 -0
- package/cjs/guide-panel/GuidePanel.js +15 -0
- package/cjs/help-text/HelpText.js +13 -0
- package/cjs/index.js +1 -0
- package/cjs/internal-header/InternalHeader.js +30 -2
- package/cjs/link/Link.js +13 -0
- package/cjs/link-panel/LinkPanel.js +17 -0
- package/cjs/loader/Loader.js +11 -0
- package/cjs/modal/Modal.js +27 -0
- package/cjs/pagination/Pagination.js +17 -0
- package/cjs/panel/Panel.js +19 -0
- package/cjs/popover/Popover.js +20 -0
- package/cjs/provider/Provider.js +13 -0
- package/cjs/read-more/ReadMore.js +2 -2
- package/cjs/skeleton/Skeleton.js +51 -0
- package/cjs/skeleton/index.js +8 -0
- package/cjs/skeleton/package.json +6 -0
- package/cjs/stepper/Step.js +3 -4
- package/cjs/stepper/Stepper.js +24 -0
- package/cjs/table/Table.js +32 -0
- package/cjs/tabs/Tabs.js +27 -1
- package/cjs/tag/Tag.js +11 -0
- package/cjs/timeline/Timeline.js +18 -0
- package/cjs/toggle-group/ToggleGroup.js +17 -2
- package/cjs/tooltip/Tooltip.js +13 -0
- package/cjs/typography/BodyLong.js +14 -0
- package/cjs/typography/BodyShort.js +14 -0
- package/cjs/typography/Detail.js +14 -0
- package/cjs/typography/ErrorMessage.js +14 -0
- package/cjs/typography/Heading.js +14 -0
- package/cjs/typography/Ingress.js +14 -0
- package/cjs/typography/Label.js +14 -0
- package/esm/accordion/Accordion.d.ts +40 -6
- package/esm/accordion/Accordion.js +22 -2
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContent.d.ts +1 -2
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.d.ts +1 -2
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.d.ts +1 -2
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/alert/Alert.d.ts +9 -0
- package/esm/alert/Alert.js +9 -0
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.d.ts +10 -0
- package/esm/button/Button.js +10 -0
- package/esm/button/Button.js.map +1 -1
- package/esm/chat/Bubble.d.ts +1 -2
- package/esm/chat/Bubble.js.map +1 -1
- package/esm/chat/Chat.d.ts +21 -2
- package/esm/chat/Chat.js +16 -0
- package/esm/chat/Chat.js.map +1 -1
- package/esm/chips/Chips.d.ts +42 -4
- package/esm/chips/Chips.js +27 -0
- package/esm/chips/Chips.js.map +1 -1
- package/esm/chips/Removable.d.ts +0 -2
- package/esm/chips/Removable.js.map +1 -1
- package/esm/chips/Toggle.d.ts +11 -3
- package/esm/chips/Toggle.js +4 -6
- package/esm/chips/Toggle.js.map +1 -1
- package/esm/copybutton/CopyButton.d.ts +11 -0
- package/esm/copybutton/CopyButton.js +11 -0
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/DateInput.d.ts +2 -3
- package/esm/date/DateInput.js +1 -1
- package/esm/date/DateInput.js.map +1 -1
- package/esm/date/datepicker/DatePicker.d.ts +38 -2
- package/esm/date/datepicker/DatePicker.js +22 -0
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/hooks/useDatepicker.d.ts +13 -0
- package/esm/date/hooks/useDatepicker.js +13 -0
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.d.ts +13 -0
- package/esm/date/hooks/useMonthPicker.js +13 -0
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.d.ts +12 -0
- package/esm/date/hooks/useRangeDatepicker.js +12 -0
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.d.ts +34 -4
- package/esm/date/monthpicker/MonthPicker.js +22 -0
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/dropdown/Dropdown.d.ts +39 -2
- package/esm/dropdown/Dropdown.js +31 -0
- package/esm/dropdown/Dropdown.js.map +1 -1
- package/esm/dropdown/Menu/Divider.d.ts +1 -2
- package/esm/dropdown/Menu/Divider.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/Heading.d.ts +1 -2
- package/esm/dropdown/Menu/GroupedList/Heading.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/Item.d.ts +1 -2
- package/esm/dropdown/Menu/GroupedList/Item.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/index.d.ts +12 -4
- package/esm/dropdown/Menu/GroupedList/index.js +1 -1
- package/esm/dropdown/Menu/GroupedList/index.js.map +1 -1
- package/esm/dropdown/Menu/List/Item.d.ts +1 -2
- package/esm/dropdown/Menu/List/Item.js.map +1 -1
- package/esm/dropdown/Menu/List/index.d.ts +7 -2
- package/esm/dropdown/Menu/List/index.js +1 -1
- package/esm/dropdown/Menu/List/index.js.map +1 -1
- package/esm/dropdown/Menu/index.d.ts +10 -2
- package/esm/dropdown/Menu/index.js +1 -1
- package/esm/dropdown/Menu/index.js.map +1 -1
- package/esm/dropdown/Toggle.d.ts +1 -2
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/expansion-card/ExpansionCard.d.ts +40 -8
- package/esm/expansion-card/ExpansionCard.js +18 -0
- package/esm/expansion-card/ExpansionCard.js.map +1 -1
- package/esm/expansion-card/ExpansionCardContent.d.ts +1 -2
- package/esm/expansion-card/ExpansionCardContent.js.map +1 -1
- package/esm/expansion-card/ExpansionCardDescription.d.ts +2 -4
- package/esm/expansion-card/ExpansionCardDescription.js.map +1 -1
- package/esm/expansion-card/ExpansionCardHeader.d.ts +1 -2
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +2 -4
- package/esm/expansion-card/ExpansionCardTitle.js.map +1 -1
- package/esm/form/ConfirmationPanel.d.ts +18 -0
- package/esm/form/ConfirmationPanel.js +18 -0
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Select.d.ts +16 -0
- package/esm/form/Select.js +16 -0
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.d.ts +11 -0
- package/esm/form/Switch.js +11 -0
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.d.ts +11 -0
- package/esm/form/TextField.js +11 -0
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.d.ts +11 -0
- package/esm/form/Textarea.js +11 -0
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.d.ts +15 -0
- package/esm/form/checkbox/CheckboxGroup.js +15 -0
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.d.ts +18 -0
- package/esm/form/error-summary/ErrorSummary.js +18 -0
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/radio/RadioGroup.d.ts +2 -2
- package/esm/form/radio/RadioGroup.js +2 -2
- package/esm/form/search/Search.d.ts +13 -0
- package/esm/form/search/Search.js +13 -0
- package/esm/form/search/Search.js.map +1 -1
- package/esm/guide-panel/GuidePanel.d.ts +15 -0
- package/esm/guide-panel/GuidePanel.js +15 -0
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +13 -0
- package/esm/help-text/HelpText.js +13 -0
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/internal-header/InternalHeader.d.ts +52 -8
- package/esm/internal-header/InternalHeader.js +30 -2
- package/esm/internal-header/InternalHeader.js.map +1 -1
- package/esm/internal-header/InternalHeaderButton.d.ts +1 -2
- package/esm/internal-header/InternalHeaderButton.js.map +1 -1
- package/esm/internal-header/InternalHeaderTitle.d.ts +1 -2
- package/esm/internal-header/InternalHeaderTitle.js.map +1 -1
- package/esm/internal-header/InternalHeaderUser.d.ts +0 -1
- package/esm/internal-header/InternalHeaderUser.js.map +1 -1
- package/esm/internal-header/InternalHeaderUserButton.d.ts +1 -2
- package/esm/internal-header/InternalHeaderUserButton.js.map +1 -1
- package/esm/link/Link.d.ts +13 -0
- package/esm/link/Link.js +13 -0
- package/esm/link/Link.js.map +1 -1
- package/esm/link-panel/LinkPanel.d.ts +28 -4
- package/esm/link-panel/LinkPanel.js +17 -0
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/link-panel/LinkPanelDescription.d.ts +2 -4
- package/esm/link-panel/LinkPanelDescription.js.map +1 -1
- package/esm/link-panel/LinkPanelTitle.d.ts +2 -4
- package/esm/link-panel/LinkPanelTitle.js.map +1 -1
- package/esm/list/List.d.ts +5 -2
- package/esm/list/List.js.map +1 -1
- package/esm/list/ListItem.d.ts +1 -3
- package/esm/list/ListItem.js.map +1 -1
- package/esm/loader/Loader.d.ts +11 -0
- package/esm/loader/Loader.js +11 -0
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.d.ts +27 -0
- package/esm/modal/Modal.js +27 -0
- package/esm/modal/Modal.js.map +1 -1
- package/esm/pagination/Pagination.d.ts +17 -0
- package/esm/pagination/Pagination.js +17 -0
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/panel/Panel.d.ts +19 -0
- package/esm/panel/Panel.js +19 -0
- package/esm/panel/Panel.js.map +1 -1
- package/esm/popover/Popover.d.ts +20 -0
- package/esm/popover/Popover.js +20 -0
- package/esm/popover/Popover.js.map +1 -1
- package/esm/provider/Provider.d.ts +13 -0
- package/esm/provider/Provider.js +13 -0
- package/esm/provider/Provider.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +2 -2
- package/esm/read-more/ReadMore.js +2 -2
- package/esm/skeleton/Skeleton.d.ts +18 -0
- package/esm/skeleton/Skeleton.js +23 -0
- package/esm/skeleton/Skeleton.js.map +1 -0
- package/esm/skeleton/index.d.ts +2 -0
- package/esm/skeleton/index.js +2 -0
- package/esm/skeleton/index.js.map +1 -0
- package/esm/stepper/Step.d.ts +1 -4
- package/esm/stepper/Step.js +1 -2
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.d.ts +31 -2
- package/esm/stepper/Stepper.js +24 -0
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/table/Table.d.ts +32 -0
- package/esm/table/Table.js +32 -0
- package/esm/table/Table.js.map +1 -1
- package/esm/tabs/Tab.d.ts +1 -2
- package/esm/tabs/Tab.js.map +1 -1
- package/esm/tabs/TabList.d.ts +1 -2
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/TabPanel.d.ts +1 -2
- package/esm/tabs/TabPanel.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +43 -6
- package/esm/tabs/Tabs.js +27 -1
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tag/Tag.d.ts +11 -0
- package/esm/tag/Tag.js +11 -0
- package/esm/tag/Tag.js.map +1 -1
- package/esm/timeline/Timeline.d.ts +22 -4
- package/esm/timeline/Timeline.js +18 -0
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.d.ts +20 -2
- package/esm/toggle-group/ToggleGroup.js +17 -2
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/ToggleItem.d.ts +1 -2
- package/esm/toggle-group/ToggleItem.js.map +1 -1
- package/esm/tooltip/Tooltip.d.ts +13 -0
- package/esm/tooltip/Tooltip.js +13 -0
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +14 -0
- package/esm/typography/BodyLong.js +14 -0
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.d.ts +14 -0
- package/esm/typography/BodyShort.js +14 -0
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.d.ts +14 -0
- package/esm/typography/Detail.js +14 -0
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/ErrorMessage.d.ts +14 -0
- package/esm/typography/ErrorMessage.js +14 -0
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/typography/Heading.d.ts +14 -0
- package/esm/typography/Heading.js +14 -0
- package/esm/typography/Heading.js.map +1 -1
- package/esm/typography/Ingress.d.ts +14 -0
- package/esm/typography/Ingress.js +14 -0
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.d.ts +14 -0
- package/esm/typography/Label.js +14 -0
- package/esm/typography/Label.js.map +1 -1
- package/package.json +2 -2
- package/src/accordion/Accordion.tsx +49 -7
- package/src/accordion/AccordionContent.tsx +1 -5
- package/src/accordion/AccordionHeader.tsx +1 -5
- package/src/accordion/AccordionItem.tsx +1 -5
- package/src/accordion/accordion.stories.tsx +4 -2
- package/src/alert/Alert.tsx +9 -0
- package/src/button/Button.tsx +10 -0
- package/src/chat/Bubble.tsx +1 -5
- package/src/chat/Chat.tsx +23 -2
- package/src/chips/Chips.tsx +42 -4
- package/src/chips/Removable.tsx +1 -4
- package/src/chips/Toggle.tsx +47 -11
- package/src/chips/chips.stories.tsx +73 -20
- package/src/copybutton/CopyButton.tsx +11 -0
- package/src/date/DateInput.tsx +105 -115
- package/src/date/datepicker/DatePicker.tsx +40 -2
- package/src/date/hooks/useDatepicker.tsx +13 -0
- package/src/date/hooks/useMonthPicker.tsx +13 -0
- package/src/date/hooks/useRangeDatepicker.tsx +13 -1
- package/src/date/monthpicker/MonthPicker.tsx +36 -4
- package/src/dropdown/Dropdown.tsx +41 -2
- package/src/dropdown/Menu/Divider.tsx +10 -13
- package/src/dropdown/Menu/GroupedList/Heading.tsx +15 -18
- package/src/dropdown/Menu/GroupedList/Item.tsx +23 -27
- package/src/dropdown/Menu/GroupedList/index.tsx +15 -5
- package/src/dropdown/Menu/List/Item.tsx +3 -9
- package/src/dropdown/Menu/List/index.tsx +8 -3
- package/src/dropdown/Menu/index.tsx +14 -3
- package/src/dropdown/Toggle.tsx +1 -5
- package/src/expansion-card/ExpansionCard.tsx +46 -8
- package/src/expansion-card/ExpansionCardContent.tsx +25 -28
- package/src/expansion-card/ExpansionCardDescription.tsx +22 -24
- package/src/expansion-card/ExpansionCardHeader.tsx +31 -34
- package/src/expansion-card/ExpansionCardTitle.tsx +3 -5
- package/src/form/ConfirmationPanel.tsx +18 -0
- package/src/form/Select.tsx +16 -0
- package/src/form/Switch.tsx +11 -0
- package/src/form/TextField.tsx +11 -0
- package/src/form/Textarea.tsx +11 -0
- package/src/form/checkbox/CheckboxGroup.tsx +15 -0
- package/src/form/error-summary/ErrorSummary.tsx +18 -0
- package/src/form/radio/RadioGroup.tsx +2 -2
- package/src/form/search/Search.tsx +13 -0
- package/src/guide-panel/GuidePanel.tsx +15 -0
- package/src/help-text/HelpText.tsx +13 -0
- package/src/index.ts +1 -0
- package/src/internal-header/InternalHeader.tsx +60 -11
- package/src/internal-header/InternalHeaderButton.tsx +8 -13
- package/src/internal-header/InternalHeaderTitle.tsx +11 -19
- package/src/internal-header/InternalHeaderUser.tsx +0 -4
- package/src/internal-header/InternalHeaderUserButton.tsx +17 -20
- package/src/link/Link.tsx +13 -0
- package/src/link-panel/LinkPanel.tsx +30 -4
- package/src/link-panel/LinkPanelDescription.tsx +12 -15
- package/src/link-panel/LinkPanelTitle.tsx +15 -18
- package/src/list/List.tsx +7 -2
- package/src/list/ListItem.tsx +1 -6
- package/src/loader/Loader.tsx +11 -0
- package/src/modal/Modal.tsx +27 -0
- package/src/pagination/Pagination.tsx +17 -0
- package/src/panel/Panel.tsx +19 -0
- package/src/popover/Popover.tsx +20 -0
- package/src/provider/Provider.tsx +13 -0
- package/src/read-more/ReadMore.tsx +2 -2
- package/src/skeleton/Skeleton.tsx +48 -0
- package/src/skeleton/index.ts +2 -0
- package/src/skeleton/skeleton.stories.tsx +118 -0
- package/src/stepper/Step.tsx +57 -60
- package/src/stepper/Stepper.tsx +31 -2
- package/src/table/Table.tsx +32 -0
- package/src/tabs/Tab.tsx +38 -39
- package/src/tabs/TabList.tsx +1 -5
- package/src/tabs/TabPanel.tsx +1 -5
- package/src/tabs/Tabs.tsx +48 -7
- package/src/tag/Tag.tsx +11 -0
- package/src/timeline/Timeline.tsx +22 -4
- package/src/toggle-group/ToggleGroup.tsx +23 -3
- package/src/toggle-group/ToggleItem.tsx +1 -5
- package/src/tooltip/Tooltip.tsx +13 -0
- package/src/typography/BodyLong.tsx +14 -0
- package/src/typography/BodyShort.tsx +14 -0
- package/src/typography/Detail.tsx +14 -0
- package/src/typography/ErrorMessage.tsx +14 -0
- package/src/typography/Heading.tsx +14 -0
- package/src/typography/Ingress.tsx +14 -0
- package/src/typography/Label.tsx +14 -0
|
@@ -32,8 +32,8 @@ export interface ReadMoreProps
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* ReadMore
|
|
35
|
-
* @see https://aksel.nav.no/komponenter/core/read-more
|
|
36
|
-
* @see {@link ReadMoreProps}
|
|
35
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/read-more)
|
|
36
|
+
* @see 🏷️ {@link ReadMoreProps}
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* // Default
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import cl from "clsx";
|
|
3
|
+
|
|
4
|
+
export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* @default text
|
|
8
|
+
*/
|
|
9
|
+
variant?: "circle" | "rectangle" | "rounded" | "text";
|
|
10
|
+
/**
|
|
11
|
+
* When not inferring height from children, you must specify height
|
|
12
|
+
*/
|
|
13
|
+
height?: number | string;
|
|
14
|
+
/**
|
|
15
|
+
* When not infering width from children, you must specify width
|
|
16
|
+
*/
|
|
17
|
+
width?: number | string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(
|
|
21
|
+
(
|
|
22
|
+
{ className, children, height, width, style, variant = "text", ...rest },
|
|
23
|
+
ref
|
|
24
|
+
) => {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
{...rest}
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cl(
|
|
30
|
+
"navds-skeleton",
|
|
31
|
+
className,
|
|
32
|
+
`navds-skeleton--${variant}`,
|
|
33
|
+
{
|
|
34
|
+
"navds-skeleton--has-children": Boolean(children),
|
|
35
|
+
"navds-skeleton--no-height": !height,
|
|
36
|
+
"navds-skeleton--no-width": !width,
|
|
37
|
+
}
|
|
38
|
+
)}
|
|
39
|
+
style={{ ...style, width, height }}
|
|
40
|
+
aria-hidden
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export default Skeleton;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Skeleton } from ".";
|
|
3
|
+
import { Alert } from "../alert";
|
|
4
|
+
import { Button } from "../button";
|
|
5
|
+
import { Checkbox } from "../form";
|
|
6
|
+
import { BodyLong, Heading } from "../typography";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "ds-react/Skeleton",
|
|
10
|
+
component: Skeleton,
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story) => (
|
|
13
|
+
<div style={{ display: "grid", gap: "0.5rem" }}>
|
|
14
|
+
<Story />
|
|
15
|
+
</div>
|
|
16
|
+
),
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Default = {
|
|
21
|
+
render: () => (
|
|
22
|
+
<div>
|
|
23
|
+
<Skeleton>
|
|
24
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur
|
|
25
|
+
voluptas sint dolore omnis quia consequatur beatae vero cum officia
|
|
26
|
+
debitis. Quidem debitis omnis reprehenderit nobis rerum. Nulla, magnam?
|
|
27
|
+
Saepe, eveniet? Test
|
|
28
|
+
</Skeleton>
|
|
29
|
+
<Skeleton>
|
|
30
|
+
<Alert variant="info">
|
|
31
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur
|
|
32
|
+
voluptas sint dolore omnis quia consequatur beatae vero cum officia
|
|
33
|
+
debitis. Quidem debitis omnis reprehenderit nobis rerum. Nulla,
|
|
34
|
+
magnam? Saepe, eveniet?
|
|
35
|
+
</Alert>
|
|
36
|
+
</Skeleton>
|
|
37
|
+
<Skeleton>
|
|
38
|
+
<BodyLong>
|
|
39
|
+
Quidem debitis omnis reprehenderit nobis rerum. Nulla, magnam? Saepe,
|
|
40
|
+
eveniet?
|
|
41
|
+
</BodyLong>
|
|
42
|
+
<Checkbox value="test">Valg 1</Checkbox>
|
|
43
|
+
<Checkbox value="tes2">Valg 2</Checkbox>
|
|
44
|
+
<div style={{ display: "flex", gap: "2rem" }}>
|
|
45
|
+
<Button>Send inn</Button>
|
|
46
|
+
<Button>Tilbake</Button>
|
|
47
|
+
</div>
|
|
48
|
+
</Skeleton>
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Shapes = {
|
|
54
|
+
render: () => (
|
|
55
|
+
<>
|
|
56
|
+
<Skeleton variant="text"></Skeleton>
|
|
57
|
+
<Skeleton variant="circle" width={60} height={60}></Skeleton>
|
|
58
|
+
<Skeleton variant="rectangle" width={200} height={40}></Skeleton>
|
|
59
|
+
<Skeleton variant="rounded" width={200} height={40}></Skeleton>
|
|
60
|
+
</>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const WrappingComponents = {
|
|
65
|
+
render: () => (
|
|
66
|
+
<Skeleton style={{ display: "grid", gap: "0.5rem" }}>
|
|
67
|
+
<BodyLong>
|
|
68
|
+
Quidem debitis omnis reprehenderit nobis rerum. Nulla, magnam? Saepe,
|
|
69
|
+
eveniet?
|
|
70
|
+
</BodyLong>
|
|
71
|
+
<Checkbox value="test">Valg 1</Checkbox>
|
|
72
|
+
<Checkbox value="tes2">Valg 2</Checkbox>
|
|
73
|
+
<div style={{ display: "flex", gap: "2rem" }}>
|
|
74
|
+
<Button>Send inn</Button>
|
|
75
|
+
<Button>Tilbake</Button>
|
|
76
|
+
</div>
|
|
77
|
+
</Skeleton>
|
|
78
|
+
),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const TextSizing = {
|
|
82
|
+
render: () => (
|
|
83
|
+
<div style={{ display: "grid", width: 300 }}>
|
|
84
|
+
<Skeleton>
|
|
85
|
+
<Heading level="1" size="xlarge">
|
|
86
|
+
Placeholder
|
|
87
|
+
</Heading>
|
|
88
|
+
</Skeleton>
|
|
89
|
+
<Skeleton>
|
|
90
|
+
<BodyLong>Placeholder</BodyLong>
|
|
91
|
+
</Skeleton>
|
|
92
|
+
<BodyLong as={Skeleton}>Placeholder</BodyLong>
|
|
93
|
+
</div>
|
|
94
|
+
),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const NativeText = {
|
|
98
|
+
render: () => (
|
|
99
|
+
<div>
|
|
100
|
+
<h1>
|
|
101
|
+
<Skeleton>
|
|
102
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur
|
|
103
|
+
voluptas sint dolore omnis quia consequatur beatae vero cum officia
|
|
104
|
+
debitis. Quidem debitis omnis reprehenderit nobis rerum. Nulla,
|
|
105
|
+
magnam? Saepe, eveniet? Test
|
|
106
|
+
</Skeleton>
|
|
107
|
+
</h1>
|
|
108
|
+
<Skeleton>
|
|
109
|
+
<p>
|
|
110
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur
|
|
111
|
+
voluptas sint dolore omnis quia consequatur beatae vero cum officia
|
|
112
|
+
debitis. Quidem debitis omnis reprehenderit nobis rerum. Nulla,
|
|
113
|
+
magnam? Saepe, eveniet? Test
|
|
114
|
+
</p>
|
|
115
|
+
</Skeleton>
|
|
116
|
+
</div>
|
|
117
|
+
),
|
|
118
|
+
};
|
package/src/stepper/Step.tsx
CHANGED
|
@@ -45,69 +45,66 @@ const CompletedIcon = () => (
|
|
|
45
45
|
</svg>
|
|
46
46
|
);
|
|
47
47
|
|
|
48
|
-
export
|
|
49
|
-
|
|
48
|
+
export const Step: OverridableComponent<StepperStepProps, HTMLAnchorElement> =
|
|
49
|
+
forwardRef(
|
|
50
|
+
(
|
|
51
|
+
{
|
|
52
|
+
className,
|
|
53
|
+
children,
|
|
54
|
+
as: Component = "a",
|
|
55
|
+
unsafe_index = 0,
|
|
56
|
+
completed = false,
|
|
57
|
+
interactive,
|
|
58
|
+
...rest
|
|
59
|
+
},
|
|
60
|
+
ref
|
|
61
|
+
) => {
|
|
62
|
+
const context = useContext(StepperContext);
|
|
63
|
+
if (context === null) {
|
|
64
|
+
console.error("<Stepper.Step> has to be used within <Stepper>");
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const { activeStep } = context;
|
|
50
68
|
|
|
51
|
-
|
|
52
|
-
StepperStepProps,
|
|
53
|
-
HTMLAnchorElement
|
|
54
|
-
> = forwardRef(
|
|
55
|
-
(
|
|
56
|
-
{
|
|
57
|
-
className,
|
|
58
|
-
children,
|
|
59
|
-
as: Component = "a",
|
|
60
|
-
unsafe_index = 0,
|
|
61
|
-
completed = false,
|
|
62
|
-
interactive,
|
|
63
|
-
...rest
|
|
64
|
-
},
|
|
65
|
-
ref
|
|
66
|
-
) => {
|
|
67
|
-
const context = useContext(StepperContext);
|
|
68
|
-
if (context === null) {
|
|
69
|
-
console.error("<Stepper.Step> has to be used within <Stepper>");
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
const { activeStep } = context;
|
|
73
|
-
|
|
74
|
-
const isInteractive = interactive ?? context?.interactive;
|
|
69
|
+
const isInteractive = interactive ?? context?.interactive;
|
|
75
70
|
|
|
76
|
-
|
|
71
|
+
const Comp = isInteractive ? Component : "div";
|
|
77
72
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
73
|
+
return (
|
|
74
|
+
<Comp
|
|
75
|
+
{...rest}
|
|
76
|
+
aria-current={activeStep === unsafe_index}
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={cl("navds-stepper__step", className, {
|
|
79
|
+
"navds-stepper__step--active": activeStep === unsafe_index,
|
|
80
|
+
"navds-stepper__step--behind": activeStep > unsafe_index,
|
|
81
|
+
"navds-stepper__step--non-interactive": !isInteractive,
|
|
82
|
+
"navds-stepper__step--completed": completed,
|
|
83
|
+
})}
|
|
84
|
+
onClick={(e) => {
|
|
85
|
+
isInteractive && context.onStepChange(unsafe_index + 1);
|
|
86
|
+
rest?.onClick?.(e);
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{completed ? (
|
|
90
|
+
<span className="navds-stepper__circle navds-stepper__circle--success">
|
|
91
|
+
<CompletedIcon />
|
|
92
|
+
</span>
|
|
93
|
+
) : (
|
|
94
|
+
<Label
|
|
95
|
+
className="navds-stepper__circle"
|
|
96
|
+
as="span"
|
|
97
|
+
aria-hidden="true"
|
|
98
|
+
>
|
|
99
|
+
{unsafe_index + 1}
|
|
100
|
+
</Label>
|
|
101
|
+
)}
|
|
102
|
+
<Label as="span" className="navds-stepper__content">
|
|
103
|
+
{children}
|
|
101
104
|
</Label>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
</Comp>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const Step = StepComponent as StepperStepType;
|
|
105
|
+
</Comp>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
112
109
|
|
|
113
110
|
export default Step;
|
package/src/stepper/Stepper.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { createContext, forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import Step, { StepperStepProps
|
|
3
|
+
import Step, { StepperStepProps } from "./Step";
|
|
4
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
5
|
|
|
5
6
|
export interface StepperProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
6
7
|
/**
|
|
@@ -33,7 +34,11 @@ interface StepperComponent
|
|
|
33
34
|
extends React.ForwardRefExoticComponent<
|
|
34
35
|
StepperProps & React.RefAttributes<HTMLOListElement>
|
|
35
36
|
> {
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @see 🏷️ {@link StepperStepProps}
|
|
39
|
+
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
|
40
|
+
*/
|
|
41
|
+
Step: OverridableComponent<StepperStepProps, HTMLAnchorElement>;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
interface StepperContextProps {
|
|
@@ -46,6 +51,30 @@ interface StepperContextProps {
|
|
|
46
51
|
|
|
47
52
|
export const StepperContext = createContext<StepperContextProps | null>(null);
|
|
48
53
|
|
|
54
|
+
/**
|
|
55
|
+
* A component that displays a stepper with clickable steps.
|
|
56
|
+
*
|
|
57
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/stepper)
|
|
58
|
+
* @see 🏷️ {@link StepperProps}
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```jsx
|
|
62
|
+
* <>
|
|
63
|
+
* <Heading size="medium" spacing level="2" id="stepper-heading">
|
|
64
|
+
* Søknadssteg
|
|
65
|
+
* </Heading>
|
|
66
|
+
* <Stepper
|
|
67
|
+
* aria-labelledby="stepper-heading"
|
|
68
|
+
* activeStep={activeStep}
|
|
69
|
+
* onStepChange={(x) => setActiveStep(x)}
|
|
70
|
+
* >
|
|
71
|
+
* <Stepper.Step href="#">Start søknad</Stepper.Step>
|
|
72
|
+
* <Stepper.Step href="#">Saksopplysninger</Stepper.Step>
|
|
73
|
+
* <Stepper.Step href="#">Vedlegg</Stepper.Step>
|
|
74
|
+
* </Stepper>
|
|
75
|
+
* </>
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
49
78
|
export const Stepper: StepperComponent = forwardRef<
|
|
50
79
|
HTMLOListElement,
|
|
51
80
|
StepperProps
|
package/src/table/Table.tsx
CHANGED
|
@@ -56,6 +56,38 @@ export interface TableContextProps {
|
|
|
56
56
|
|
|
57
57
|
export const TableContext = createContext<TableContextProps | null>(null);
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* A component that displays a table with headers and rows.
|
|
61
|
+
*
|
|
62
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/table)
|
|
63
|
+
* @see 🏷️ {@link TableProps}
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```jsx
|
|
67
|
+
* <Table>
|
|
68
|
+
* <Table.Header>
|
|
69
|
+
* <Table.Row>
|
|
70
|
+
* <Table.HeaderCell scope="col">Navn</Table.HeaderCell>
|
|
71
|
+
* <Table.HeaderCell scope="col">Fødseslnr.</Table.HeaderCell>
|
|
72
|
+
* <Table.HeaderCell scope="col">Start</Table.HeaderCell>
|
|
73
|
+
* </Table.Row>
|
|
74
|
+
* </Table.Header>
|
|
75
|
+
* <Table.Body>
|
|
76
|
+
* {data.map(({ name, fnr, start }, i) => {
|
|
77
|
+
* return (
|
|
78
|
+
* <Table.Row key={i + fnr}>
|
|
79
|
+
* <Table.HeaderCell scope="row">{name}</Table.HeaderCell>
|
|
80
|
+
* <Table.DataCell>{fnr}</Table.DataCell>
|
|
81
|
+
* <Table.DataCell>
|
|
82
|
+
* {format(new Date(start), "dd.MM.yyyy")}
|
|
83
|
+
* </Table.DataCell>
|
|
84
|
+
* </Table.Row>
|
|
85
|
+
* );
|
|
86
|
+
* })}
|
|
87
|
+
* </Table.Body>
|
|
88
|
+
* </Table>
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
59
91
|
export const Table = forwardRef(
|
|
60
92
|
(
|
|
61
93
|
{
|
package/src/tabs/Tab.tsx
CHANGED
|
@@ -20,47 +20,46 @@ export interface TabProps
|
|
|
20
20
|
value: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export const Tab: OverridableComponent<TabProps, HTMLButtonElement> =
|
|
24
|
+
forwardRef(
|
|
25
|
+
(
|
|
26
|
+
{ className, as: Component = "button", label, icon, value, ...rest },
|
|
27
|
+
ref
|
|
28
|
+
) => {
|
|
29
|
+
const context = useContext(TabsContext);
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
) => {
|
|
30
|
-
const context = useContext(TabsContext);
|
|
31
|
+
if (!label && !icon) {
|
|
32
|
+
console.error("<Tabs.Tab/> needs label/icon");
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
"navds-tabs__tab--icon-only": icon && !label,
|
|
48
|
-
}
|
|
49
|
-
)}
|
|
50
|
-
{...rest}
|
|
51
|
-
>
|
|
52
|
-
<BodyShort
|
|
53
|
-
as="span"
|
|
54
|
-
className="navds-tabs__tab-inner"
|
|
55
|
-
size={context?.size}
|
|
36
|
+
return (
|
|
37
|
+
<RadixTabs.Trigger value={value} asChild>
|
|
38
|
+
<Component
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={cl(
|
|
41
|
+
"navds-tabs__tab",
|
|
42
|
+
`navds-tabs__tab--${context?.size ?? "medium"}`,
|
|
43
|
+
`navds-tabs__tab-icon--${context?.iconPosition}`,
|
|
44
|
+
className,
|
|
45
|
+
{
|
|
46
|
+
"navds-tabs__tab--icon-only": icon && !label,
|
|
47
|
+
}
|
|
48
|
+
)}
|
|
49
|
+
{...rest}
|
|
56
50
|
>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
<BodyShort
|
|
52
|
+
as="span"
|
|
53
|
+
className="navds-tabs__tab-inner"
|
|
54
|
+
size={context?.size}
|
|
55
|
+
>
|
|
56
|
+
{icon}
|
|
57
|
+
{label}
|
|
58
|
+
</BodyShort>
|
|
59
|
+
</Component>
|
|
60
|
+
</RadixTabs.Trigger>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
65
64
|
|
|
66
65
|
export default Tab;
|
package/src/tabs/TabList.tsx
CHANGED
|
@@ -19,10 +19,6 @@ export interface TabListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
19
19
|
children: React.ReactNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export type TabListType = React.ForwardRefExoticComponent<
|
|
23
|
-
TabListProps & React.RefAttributes<HTMLDivElement>
|
|
24
|
-
>;
|
|
25
|
-
|
|
26
22
|
export const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
27
23
|
({ className, ...rest }, ref) => {
|
|
28
24
|
const context = useContext(TabsContext);
|
|
@@ -127,6 +123,6 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
|
127
123
|
</div>
|
|
128
124
|
);
|
|
129
125
|
}
|
|
130
|
-
)
|
|
126
|
+
);
|
|
131
127
|
|
|
132
128
|
export default TabList;
|
package/src/tabs/TabPanel.tsx
CHANGED
|
@@ -13,10 +13,6 @@ export interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
value: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export type TabPanelType = React.ForwardRefExoticComponent<
|
|
17
|
-
TabPanelProps & React.RefAttributes<HTMLDivElement>
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
16
|
const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(
|
|
21
17
|
({ className, ...rest }, ref) => (
|
|
22
18
|
<TabsContent
|
|
@@ -25,6 +21,6 @@ const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(
|
|
|
25
21
|
className={cl("navds-tabs__tabpanel", className)}
|
|
26
22
|
/>
|
|
27
23
|
)
|
|
28
|
-
)
|
|
24
|
+
);
|
|
29
25
|
|
|
30
26
|
export default TabPanel;
|
package/src/tabs/Tabs.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
1
2
|
import cl from "clsx";
|
|
2
3
|
import React, { createContext, forwardRef, HTMLAttributes } from "react";
|
|
3
|
-
import
|
|
4
|
-
import Tab, {
|
|
5
|
-
import TabList, {
|
|
6
|
-
import TabPanel, {
|
|
4
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
5
|
+
import Tab, { TabProps } from "./Tab";
|
|
6
|
+
import TabList, { TabListProps } from "./TabList";
|
|
7
|
+
import TabPanel, { TabPanelProps } from "./TabPanel";
|
|
7
8
|
|
|
8
9
|
export interface TabsProps
|
|
9
10
|
extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "dir"> {
|
|
@@ -46,9 +47,23 @@ interface TabsComponent
|
|
|
46
47
|
extends React.ForwardRefExoticComponent<
|
|
47
48
|
TabsProps & React.RefAttributes<HTMLDivElement>
|
|
48
49
|
> {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
/**
|
|
51
|
+
* @see 🏷️ {@link TabProps}
|
|
52
|
+
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
|
53
|
+
*/
|
|
54
|
+
Tab: OverridableComponent<TabProps, HTMLButtonElement>;
|
|
55
|
+
/**
|
|
56
|
+
* @see 🏷️ {@link TabListProps}
|
|
57
|
+
*/
|
|
58
|
+
List: React.ForwardRefExoticComponent<
|
|
59
|
+
TabListProps & React.RefAttributes<HTMLDivElement>
|
|
60
|
+
>;
|
|
61
|
+
/**
|
|
62
|
+
* @see 🏷️ {@link TabPanelProps}
|
|
63
|
+
*/
|
|
64
|
+
Panel: React.ForwardRefExoticComponent<
|
|
65
|
+
TabPanelProps & React.RefAttributes<HTMLDivElement>
|
|
66
|
+
>;
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
interface TabsContextProps {
|
|
@@ -59,6 +74,32 @@ interface TabsContextProps {
|
|
|
59
74
|
|
|
60
75
|
export const TabsContext = createContext<TabsContextProps | null>(null);
|
|
61
76
|
|
|
77
|
+
/**
|
|
78
|
+
* A component that displays a set of tabs that can be used to switch between different views.
|
|
79
|
+
*
|
|
80
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/tabs)
|
|
81
|
+
* @see 🏷️ {@link TabsProps}
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```jsx
|
|
85
|
+
* <Tabs defaultValue="logg">
|
|
86
|
+
* <Tabs.List>
|
|
87
|
+
* <Tabs.Tab value="logg" label="Logg" />
|
|
88
|
+
* <Tabs.Tab value="inbox" label="Inbox" />
|
|
89
|
+
* <Tabs.Tab value="sendt" label="Sendt" />
|
|
90
|
+
* </Tabs.List>
|
|
91
|
+
* <Tabs.Panel value="logg" className="h-24 w-full bg-gray-50 p-4">
|
|
92
|
+
* Logg-tab
|
|
93
|
+
* </Tabs.Panel>
|
|
94
|
+
* <Tabs.Panel value="inbox" className="h-24 w-full bg-gray-50 p-4">
|
|
95
|
+
* Inbox-tab
|
|
96
|
+
* </Tabs.Panel>
|
|
97
|
+
* <Tabs.Panel value="sendt" className="h-24 w-full bg-gray-50 p-4">
|
|
98
|
+
* Sendt-tab
|
|
99
|
+
* </Tabs.Panel>
|
|
100
|
+
* </Tabs>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
62
103
|
export const Tabs = forwardRef<HTMLDivElement, TabsProps>(
|
|
63
104
|
(
|
|
64
105
|
{
|
package/src/tag/Tag.tsx
CHANGED
|
@@ -38,6 +38,17 @@ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
38
38
|
size?: "medium" | "small" | "xsmall";
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* A component that displays a small label with a text and a background color.
|
|
43
|
+
*
|
|
44
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/tag)
|
|
45
|
+
* @see 🏷️ {@link TagProps}
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```jsx
|
|
49
|
+
* <Tag variant="success">Success</Tag>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
41
52
|
export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
42
53
|
({ className, variant, size = "medium", ...rest }, ref) => (
|
|
43
54
|
<BodyShort
|
|
@@ -38,23 +38,41 @@ export interface TimelineProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
38
38
|
interface TimelineComponent
|
|
39
39
|
extends React.ForwardRefExoticComponent<TimelineProps> {
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* @see 🏷️ {@link TimelineRowType}
|
|
42
42
|
*/
|
|
43
43
|
Row: TimelineRowType;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* @see 🏷️ {@link PeriodType}
|
|
46
46
|
*/
|
|
47
47
|
Period: PeriodType;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* @see 🏷️ {@link PinType}
|
|
50
50
|
*/
|
|
51
51
|
Pin: PinType;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* @see 🏷️ {@link ZoomType}
|
|
54
54
|
*/
|
|
55
55
|
Zoom: ZoomType;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* A component that displays a timeline of events. Meant for Internal systems.
|
|
60
|
+
* @note Component is made for desktop enviroments and will start having issues on smaller screens.
|
|
61
|
+
*
|
|
62
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/timeline)
|
|
63
|
+
* @see 🏷️ {@link TimelineProps}
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```jsx
|
|
67
|
+
* <Timeline>
|
|
68
|
+
* <Timeline.Row>
|
|
69
|
+
* <Timeline.Period start={new Date("2020-01-01")} end={new Date("2020-01-31")}>
|
|
70
|
+
* <p>Period 1</p>
|
|
71
|
+
* </Timeline.Period>
|
|
72
|
+
* <Timeline.Row>
|
|
73
|
+
* </Timeline>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
58
76
|
export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
59
77
|
({ children, startDate, endDate, direction = "left", ...rest }, ref) => {
|
|
60
78
|
const isMultipleRows = Array.isArray(children);
|