@navikt/ds-react 5.5.0 → 5.6.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 +507 -106
- package/cjs/accordion/Accordion.js +1 -0
- package/cjs/accordion/AccordionContext.js +1 -1
- package/cjs/accordion/AccordionHeader.js +2 -2
- package/cjs/accordion/AccordionItem.js +6 -2
- package/cjs/date/datepicker/DatePicker.js +30 -34
- package/cjs/date/datepicker/DatePickerStandalone.js +23 -26
- package/cjs/date/datepicker/parts/Caption.js +28 -0
- package/cjs/date/datepicker/{DayButton.js → parts/DayButton.js} +1 -2
- package/cjs/date/datepicker/{caption → parts}/DropdownCaption.js +13 -7
- package/cjs/date/datepicker/parts/HeadRow.js +36 -0
- package/cjs/date/datepicker/parts/Row.js +23 -0
- package/cjs/date/datepicker/{TableHead.js → parts/TableHead.js} +4 -3
- package/cjs/date/datepicker/parts/WeekNumber.js +35 -0
- package/cjs/date/datepicker/parts/WeekRow.js +34 -0
- package/cjs/date/hooks/useDatepicker.js +2 -2
- package/cjs/date/hooks/useMonthPicker.js +2 -2
- package/cjs/date/hooks/useRangeDatepicker.js +3 -3
- package/cjs/date/monthpicker/MonthSelector.js +1 -1
- package/cjs/date/utils/get-month-weeks.js +46 -0
- package/cjs/date/utils/labels.js +40 -1
- package/cjs/dropdown/Toggle.js +2 -2
- package/cjs/dropdown/index.js +0 -15
- package/cjs/form/Select.js +1 -1
- package/cjs/form/checkbox/useCheckbox.js +3 -4
- package/cjs/form/combobox/Combobox.js +1 -1
- package/cjs/form/combobox/Input/Input.js +1 -1
- package/cjs/form/search/Search.js +3 -1
- package/cjs/index.js +1 -0
- package/cjs/layout/bleed/Bleed.js +69 -0
- package/cjs/layout/bleed/index.js +5 -0
- package/cjs/layout/bleed/package.json +6 -0
- package/cjs/layout/box/Box.js +1 -1
- package/cjs/layout/responsive/Responsive.js +8 -6
- package/cjs/layout/sidemal-test/AvatarPanel.js +18 -0
- package/cjs/layout/sidemal-test/Content.js +66 -0
- package/cjs/layout/sidemal-test/Filter.js +48 -0
- package/cjs/layout/sidemal-test/Header.js +48 -0
- package/cjs/layout/sidemal-test/Intro.js +36 -0
- package/cjs/layout/sidemal-test/Sidebar.js +49 -0
- package/cjs/layout/sidemal-test/content-box/ContentBox.js +65 -0
- package/cjs/layout/sidemal-test/content-box/index.js +8 -0
- package/cjs/layout/sidemal-test/content-box/package.json +6 -0
- package/cjs/layout/stack/Stack.js +2 -2
- package/cjs/layout/stack/index.js +3 -1
- package/cjs/layout/utilities/css.js +37 -14
- package/cjs/loader/Loader.js +2 -2
- package/cjs/modal/dialog-polyfill.js +2 -0
- package/cjs/popover/Popover.js +3 -2
- package/cjs/tabs/TabList.js +6 -7
- package/cjs/timeline/Pin.js +20 -20
- package/cjs/timeline/Timeline.js +4 -4
- package/cjs/timeline/period/ClickablePeriod.js +19 -19
- package/cjs/timeline/period/index.js +1 -1
- package/cjs/timeline/utils/timeline.js +3 -3
- package/cjs/toggle-group/ToggleGroup.js +1 -1
- package/cjs/tooltip/Tooltip.js +1 -1
- package/cjs/typography/Heading.js +1 -1
- package/cjs/util/RandomIcon.js +1 -0
- package/cjs/util/Slot.js +88 -0
- package/cjs/util/useId.js +2 -4
- package/esm/accordion/Accordion.js +1 -0
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContext.d.ts +1 -0
- package/esm/accordion/AccordionContext.js +1 -1
- package/esm/accordion/AccordionContext.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +2 -2
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.js +6 -2
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/date/datepicker/DatePicker.d.ts +14 -5
- package/esm/date/datepicker/DatePicker.js +29 -33
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.d.ts +3 -2
- package/esm/date/datepicker/DatePickerStandalone.js +22 -25
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/datepicker/{caption → parts}/Caption.d.ts +3 -0
- package/esm/date/datepicker/parts/Caption.js +22 -0
- package/esm/date/datepicker/parts/Caption.js.map +1 -0
- package/esm/date/datepicker/parts/DayButton.d.ts +4 -0
- package/esm/date/datepicker/{DayButton.js → parts/DayButton.js} +2 -1
- package/esm/date/datepicker/parts/DayButton.js.map +1 -0
- package/esm/date/datepicker/{caption → parts}/DropdownCaption.d.ts +3 -0
- package/esm/date/datepicker/parts/DropdownCaption.js +44 -0
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -0
- package/esm/date/datepicker/parts/HeadRow.d.ts +11 -0
- package/esm/date/datepicker/parts/HeadRow.js +29 -0
- package/esm/date/datepicker/parts/HeadRow.js.map +1 -0
- package/esm/date/datepicker/parts/Row.d.ts +17 -0
- package/esm/date/datepicker/parts/Row.js +19 -0
- package/esm/date/datepicker/parts/Row.js.map +1 -0
- package/esm/date/datepicker/parts/TableHead.d.ts +6 -0
- package/esm/date/datepicker/{TableHead.js → parts/TableHead.js} +5 -2
- package/esm/date/datepicker/parts/TableHead.js.map +1 -0
- package/esm/date/datepicker/parts/WeekNumber.d.ts +13 -0
- package/esm/date/datepicker/parts/WeekNumber.js +31 -0
- package/esm/date/datepicker/parts/WeekNumber.js.map +1 -0
- package/esm/date/datepicker/parts/WeekRow.d.ts +5 -0
- package/esm/date/datepicker/parts/WeekRow.js +30 -0
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -0
- package/esm/date/hooks/useDatepicker.js +2 -2
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.js +2 -2
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.js +3 -3
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/monthpicker/MonthButton.d.ts +2 -2
- package/esm/date/monthpicker/MonthPicker.d.ts +1 -1
- package/esm/date/monthpicker/MonthSelector.js +1 -1
- package/esm/date/monthpicker/MonthSelector.js.map +1 -1
- package/esm/date/utils/get-month-weeks.d.ts +16 -0
- package/esm/date/utils/get-month-weeks.js +42 -0
- package/esm/date/utils/get-month-weeks.js.map +1 -0
- package/esm/date/utils/labels.d.ts +9 -0
- package/esm/date/utils/labels.js +36 -0
- package/esm/date/utils/labels.js.map +1 -1
- package/esm/date/utils/navigation.d.ts +1 -1
- package/esm/date/utils/navigation.js.map +1 -1
- package/esm/dropdown/Toggle.js +1 -1
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/dropdown/index.d.ts +1 -2
- package/esm/dropdown/index.js +0 -1
- package/esm/dropdown/index.js.map +1 -1
- package/esm/form/Select.js +1 -1
- package/esm/form/Select.js.map +1 -1
- package/esm/form/checkbox/useCheckbox.d.ts +1 -1
- package/esm/form/checkbox/useCheckbox.js +3 -4
- package/esm/form/checkbox/useCheckbox.js.map +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Combobox.js +1 -1
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/Input/Input.d.ts +0 -2
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/search/Search.js +3 -1
- package/esm/form/search/Search.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/layout/bleed/Bleed.d.ts +47 -0
- package/esm/layout/bleed/Bleed.js +41 -0
- package/esm/layout/bleed/Bleed.js.map +1 -0
- package/esm/layout/bleed/index.d.ts +1 -0
- package/esm/layout/bleed/index.js +2 -0
- package/esm/layout/bleed/index.js.map +1 -0
- package/esm/layout/box/Box.d.ts +1 -2
- package/esm/layout/box/Box.js +1 -1
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/responsive/Responsive.d.ts +8 -4
- package/esm/layout/responsive/Responsive.js +8 -6
- package/esm/layout/responsive/Responsive.js.map +1 -1
- package/esm/layout/sidemal-test/AvatarPanel.d.ts +4 -0
- package/esm/layout/sidemal-test/AvatarPanel.js +12 -0
- package/esm/layout/sidemal-test/AvatarPanel.js.map +1 -0
- package/esm/layout/sidemal-test/Content.d.ts +2 -0
- package/esm/layout/sidemal-test/Content.js +60 -0
- package/esm/layout/sidemal-test/Content.js.map +1 -0
- package/esm/layout/sidemal-test/Filter.d.ts +2 -0
- package/esm/layout/sidemal-test/Filter.js +22 -0
- package/esm/layout/sidemal-test/Filter.js.map +1 -0
- package/esm/layout/sidemal-test/Header.d.ts +2 -0
- package/esm/layout/sidemal-test/Header.js +42 -0
- package/esm/layout/sidemal-test/Header.js.map +1 -0
- package/esm/layout/sidemal-test/Intro.d.ts +2 -0
- package/esm/layout/sidemal-test/Intro.js +30 -0
- package/esm/layout/sidemal-test/Intro.js.map +1 -0
- package/esm/layout/sidemal-test/Sidebar.d.ts +4 -0
- package/esm/layout/sidemal-test/Sidebar.js +41 -0
- package/esm/layout/sidemal-test/Sidebar.js.map +1 -0
- package/esm/layout/sidemal-test/content-box/ContentBox.d.ts +8 -0
- package/esm/layout/sidemal-test/content-box/ContentBox.js +37 -0
- package/esm/layout/sidemal-test/content-box/ContentBox.js.map +1 -0
- package/esm/layout/sidemal-test/content-box/index.d.ts +1 -0
- package/esm/layout/sidemal-test/content-box/index.js +2 -0
- package/esm/layout/sidemal-test/content-box/index.js.map +1 -0
- package/esm/layout/stack/Stack.d.ts +7 -3
- package/esm/layout/stack/Stack.js +3 -3
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/stack/index.d.ts +1 -0
- package/esm/layout/stack/index.js +1 -0
- package/esm/layout/stack/index.js.map +1 -1
- package/esm/layout/utilities/css.d.ts +1 -1
- package/esm/layout/utilities/css.js +37 -14
- package/esm/layout/utilities/css.js.map +1 -1
- package/esm/loader/Loader.js +3 -3
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/dialog-polyfill.js +2 -0
- package/esm/modal/dialog-polyfill.js.map +1 -1
- package/esm/popover/Popover.js +3 -2
- package/esm/popover/Popover.js.map +1 -1
- package/esm/tabs/TabList.js +6 -7
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/timeline/Pin.js +21 -21
- package/esm/timeline/Pin.js.map +1 -1
- package/esm/timeline/Timeline.js +4 -4
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/timeline/TimelineRow.js.map +1 -1
- package/esm/timeline/hooks/usePeriodContext.d.ts +1 -1
- package/esm/timeline/period/ClickablePeriod.js +20 -20
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/timeline/period/index.d.ts +2 -2
- package/esm/timeline/period/index.js +1 -1
- package/esm/timeline/period/index.js.map +1 -1
- package/esm/timeline/utils/timeline.js +3 -3
- package/esm/timeline/utils/timeline.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +1 -1
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/tooltip/Tooltip.js +1 -1
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/Heading.js +1 -1
- package/esm/typography/Heading.js.map +1 -1
- package/esm/util/RandomIcon.js +1 -0
- package/esm/util/RandomIcon.js.map +1 -1
- package/esm/util/Slot.d.ts +6 -0
- package/esm/util/Slot.js +60 -0
- package/esm/util/Slot.js.map +1 -0
- package/esm/util/mergeRefs.d.ts +1 -1
- package/esm/util/useId.js +2 -4
- package/esm/util/useId.js.map +1 -1
- package/package.json +4 -4
- package/src/accordion/Accordion.tsx +1 -0
- package/src/accordion/AccordionContext.tsx +2 -1
- package/src/accordion/AccordionHeader.tsx +2 -2
- package/src/accordion/AccordionItem.tsx +7 -5
- package/src/accordion/accordion.stories.tsx +21 -34
- package/src/alert/alert.stories.tsx +2 -2
- package/src/chips/chips.stories.tsx +29 -32
- package/src/date/datepicker/DatePicker.tsx +63 -58
- package/src/date/datepicker/DatePickerStandalone.tsx +36 -39
- package/src/date/datepicker/datepicker.stories.tsx +67 -2
- package/src/date/datepicker/datepicker.test.tsx +5 -4
- package/src/date/datepicker/{caption → parts}/Caption.tsx +19 -17
- package/src/date/datepicker/{DayButton.tsx → parts/DayButton.tsx} +3 -1
- package/src/date/datepicker/parts/DropdownCaption.tsx +113 -0
- package/src/date/datepicker/parts/HeadRow.tsx +56 -0
- package/src/date/datepicker/parts/Row.tsx +47 -0
- package/src/date/datepicker/{TableHead.tsx → parts/TableHead.tsx} +6 -2
- package/src/date/datepicker/parts/WeekNumber.tsx +79 -0
- package/src/date/datepicker/parts/WeekRow.tsx +60 -0
- package/src/date/hooks/useDatepicker.tsx +2 -2
- package/src/date/hooks/useMonthPicker.tsx +2 -2
- package/src/date/hooks/useRangeDatepicker.test.tsx +11 -11
- package/src/date/hooks/useRangeDatepicker.tsx +3 -3
- package/src/date/monthpicker/MonthButton.tsx +2 -2
- package/src/date/monthpicker/MonthPicker.tsx +1 -1
- package/src/date/monthpicker/MonthSelector.tsx +3 -3
- package/src/date/monthpicker/monthpicker.stories.tsx +1 -1
- package/src/date/utils/__tests__/get-initial-year.test.ts +0 -12
- package/src/date/utils/__tests__/get-month-weeks.test.ts +113 -0
- package/src/date/utils/__tests__/is-match.test.ts +3 -3
- package/src/date/utils/__tests__/parse-dates.test.ts +4 -2
- package/src/date/utils/get-month-weeks.ts +93 -0
- package/src/date/utils/labels.ts +51 -0
- package/src/date/utils/navigation.ts +3 -3
- package/src/dropdown/Toggle.tsx +1 -1
- package/src/dropdown/dropdown.stories.tsx +25 -28
- package/src/dropdown/index.ts +1 -2
- package/src/expansion-card/expansion-card.stories.tsx +143 -161
- package/src/form/ConfirmationPanel.test.tsx +5 -5
- package/src/form/Select.tsx +1 -1
- package/src/form/checkbox/Checkbox.test.tsx +14 -26
- package/src/form/checkbox/checkbox.stories.tsx +66 -71
- package/src/form/checkbox/useCheckbox.ts +3 -4
- package/src/form/combobox/Combobox.tsx +2 -3
- package/src/form/combobox/Input/Input.tsx +1 -3
- package/src/form/combobox/combobox.stories.tsx +20 -23
- package/src/form/combobox/combobox.test.tsx +22 -20
- package/src/form/radio/radio.stories.tsx +39 -44
- package/src/form/search/Search.tsx +1 -0
- package/src/form/search/search.stories.tsx +22 -26
- package/src/form/stories/fieldset.stories.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/layout/bleed/Bleed.stories.tsx +381 -0
- package/src/layout/bleed/Bleed.tsx +130 -0
- package/src/layout/bleed/index.ts +1 -0
- package/src/layout/box/Box.stories.tsx +251 -256
- package/src/layout/box/Box.tsx +2 -1
- package/src/layout/responsive/Responsive.tsx +21 -6
- package/src/layout/responsive/hide.stories.tsx +35 -0
- package/src/layout/responsive/show.stories.tsx +35 -0
- package/src/layout/sidemal-test/AvatarPanel.tsx +27 -0
- package/src/layout/sidemal-test/Content.tsx +129 -0
- package/src/layout/sidemal-test/Filter.tsx +46 -0
- package/src/layout/sidemal-test/Header.tsx +96 -0
- package/src/layout/sidemal-test/Intro.tsx +91 -0
- package/src/layout/sidemal-test/Sidebar.tsx +77 -0
- package/src/layout/sidemal-test/content-box/ContentBox.tsx +46 -0
- package/src/layout/sidemal-test/content-box/index.ts +1 -0
- package/src/layout/sidemal-test/navno-sidemal.stories.mdx +29 -0
- package/src/layout/sidemal-test/navno-sidemal.stories.tsx +65 -0
- package/src/layout/sidemal-test/styling.css +43 -0
- package/src/layout/stack/Stack.tsx +14 -8
- package/src/layout/stack/index.ts +1 -0
- package/src/layout/stack/stack.stories.tsx +23 -1
- package/src/layout/utilities/css.ts +59 -20
- package/src/loader/Loader.tsx +2 -3
- package/src/modal/dialog-polyfill.ts +2 -0
- package/src/pagination/pagination.stories.tsx +35 -42
- package/src/popover/Popover.test.tsx +21 -35
- package/src/popover/Popover.tsx +2 -2
- package/src/popover/popover.stories.tsx +25 -41
- package/src/react-css.d.ts +0 -1
- package/src/read-more/readmore.stories.tsx +35 -36
- package/src/stepper/stepper.stories.tsx +45 -52
- package/src/table/stories/table-expandable.stories.tsx +59 -63
- package/src/tabs/TabList.tsx +4 -6
- package/src/tabs/Tabs.stories.tsx +3 -3
- package/src/tag/tag.stories.tsx +4 -4
- package/src/timeline/Pin.tsx +44 -39
- package/src/timeline/Timeline.tsx +6 -6
- package/src/timeline/TimelineRow.tsx +1 -0
- package/src/timeline/hooks/usePeriodContext.tsx +1 -1
- package/src/timeline/period/ClickablePeriod.tsx +42 -38
- package/src/timeline/period/index.tsx +5 -4
- package/src/timeline/timeline.stories.tsx +11 -10
- package/src/timeline/utils/timeline.ts +3 -3
- package/src/toggle-group/ToggleGroup.stories.tsx +25 -29
- package/src/toggle-group/ToggleGroup.tsx +0 -1
- package/src/tooltip/Tooltip.test.tsx +40 -54
- package/src/tooltip/Tooltip.tsx +1 -1
- package/src/typography/Heading.tsx +1 -1
- package/src/util/RandomIcon.tsx +1 -0
- package/src/util/Slot.tsx +69 -0
- package/src/util/__tests__/Slot.test.tsx +98 -0
- package/src/util/mergeRefs.tsx +1 -1
- package/src/util/useId.ts +1 -3
- package/cjs/date/datepicker/caption/Caption.js +0 -23
- package/cjs/date/datepicker/caption/index.js +0 -10
- package/cjs/date/datepicker/caption/package.json +0 -6
- package/esm/date/datepicker/DayButton.d.ts +0 -3
- package/esm/date/datepicker/DayButton.js.map +0 -1
- package/esm/date/datepicker/TableHead.d.ts +0 -3
- package/esm/date/datepicker/TableHead.js.map +0 -1
- package/esm/date/datepicker/caption/Caption.js +0 -17
- package/esm/date/datepicker/caption/Caption.js.map +0 -1
- package/esm/date/datepicker/caption/DropdownCaption.js +0 -38
- package/esm/date/datepicker/caption/DropdownCaption.js.map +0 -1
- package/esm/date/datepicker/caption/index.d.ts +0 -2
- package/esm/date/datepicker/caption/index.js +0 -3
- package/esm/date/datepicker/caption/index.js.map +0 -1
- package/src/date/datepicker/caption/DropdownCaption.tsx +0 -108
- package/src/date/datepicker/caption/index.ts +0 -2
|
@@ -6,23 +6,22 @@ import { HGrid, HStack, VStack } from "../..";
|
|
|
6
6
|
import { BackgroundToken, BorderRadiiToken } from "../utilities/types";
|
|
7
7
|
import { ChevronRightIcon } from "@navikt/aksel-icons";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const meta: Meta<typeof Box> = {
|
|
10
10
|
title: "ds-react/Primitives/Box",
|
|
11
11
|
component: Box,
|
|
12
|
-
} satisfies Meta<typeof Box>;
|
|
13
|
-
|
|
14
|
-
export const Default = {
|
|
15
|
-
render: () => (
|
|
16
|
-
<Box>
|
|
17
|
-
<BodyLong>
|
|
18
|
-
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
19
|
-
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore pariatur.
|
|
20
|
-
Proident pariatur proident pariatur magna consequat velit id commodo
|
|
21
|
-
quis sunt tempor ullamco aliquip pariatur.
|
|
22
|
-
</BodyLong>
|
|
23
|
-
</Box>
|
|
24
|
-
),
|
|
25
12
|
};
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
export const Default = () => (
|
|
16
|
+
<Box>
|
|
17
|
+
<BodyLong>
|
|
18
|
+
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
19
|
+
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore pariatur.
|
|
20
|
+
Proident pariatur proident pariatur magna consequat velit id commodo quis
|
|
21
|
+
sunt tempor ullamco aliquip pariatur.
|
|
22
|
+
</BodyLong>
|
|
23
|
+
</Box>
|
|
24
|
+
);
|
|
26
25
|
|
|
27
26
|
const Card = ({
|
|
28
27
|
background,
|
|
@@ -44,43 +43,38 @@ const Card = ({
|
|
|
44
43
|
</Box>
|
|
45
44
|
);
|
|
46
45
|
|
|
47
|
-
export const AsCard =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</HStack>
|
|
73
|
-
);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
46
|
+
export const AsCard = () => (
|
|
47
|
+
<HStack gap="4" justify="center">
|
|
48
|
+
<Card>
|
|
49
|
+
<h1>Card one</h1>
|
|
50
|
+
<BodyLong>
|
|
51
|
+
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
52
|
+
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore
|
|
53
|
+
</BodyLong>
|
|
54
|
+
</Card>
|
|
55
|
+
<Card>
|
|
56
|
+
<h1>Card two</h1>
|
|
57
|
+
<BodyLong>
|
|
58
|
+
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
59
|
+
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore
|
|
60
|
+
</BodyLong>
|
|
61
|
+
</Card>
|
|
62
|
+
<Card>
|
|
63
|
+
<h1>Card three</h1>
|
|
64
|
+
<BodyLong>
|
|
65
|
+
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
66
|
+
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore
|
|
67
|
+
</BodyLong>
|
|
68
|
+
</Card>
|
|
69
|
+
</HStack>
|
|
70
|
+
);
|
|
76
71
|
|
|
77
|
-
export const ThemingDemo = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{`
|
|
72
|
+
export const ThemingDemo = () => {
|
|
73
|
+
const LinkCard = () => {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<style>
|
|
77
|
+
{`
|
|
84
78
|
.link-card {
|
|
85
79
|
color: var(--navds-color-text-primary);
|
|
86
80
|
text-decoration: none;
|
|
@@ -103,99 +97,99 @@ export const ThemingDemo = {
|
|
|
103
97
|
transition: transform 200ms;
|
|
104
98
|
}
|
|
105
99
|
`}
|
|
106
|
-
|
|
100
|
+
</style>
|
|
101
|
+
<Box
|
|
102
|
+
as="a"
|
|
103
|
+
href="#"
|
|
104
|
+
className="link-card"
|
|
105
|
+
borderRadius="small"
|
|
106
|
+
borderColor="border-default"
|
|
107
|
+
borderWidth="1"
|
|
108
|
+
padding="4"
|
|
109
|
+
onClick={() => alert("Clicked!")}
|
|
110
|
+
>
|
|
111
|
+
<HStack gap="4" align="center">
|
|
112
|
+
<VStack gap="2">
|
|
113
|
+
<Heading size="medium">
|
|
114
|
+
LinkCard som bruker Box, HStack og VStack
|
|
115
|
+
</Heading>
|
|
116
|
+
<BodyLong>This truly is inside a box!</BodyLong>
|
|
117
|
+
</VStack>
|
|
118
|
+
<ChevronRightIcon fontSize={24} className="link-card__chevron" />
|
|
119
|
+
</HStack>
|
|
120
|
+
</Box>
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const ChatBubble = () => {
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<Box
|
|
129
|
+
background="surface-neutral-subtle"
|
|
130
|
+
shadow="xsmall"
|
|
131
|
+
padding="4"
|
|
132
|
+
borderRadius="xlarge xlarge xlarge 0"
|
|
133
|
+
>
|
|
134
|
+
<VStack gap="2">
|
|
135
|
+
<Detail>BOX • 01.01.21 14:00</Detail>
|
|
136
|
+
<BodyLong>
|
|
137
|
+
Hei! Dette er en chatbobble som bruker Box som base!
|
|
138
|
+
</BodyLong>
|
|
139
|
+
</VStack>
|
|
140
|
+
</Box>
|
|
141
|
+
</>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const PricePill = () => {
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
<style>
|
|
149
|
+
{`
|
|
150
|
+
.old-price {
|
|
151
|
+
text-decoration: line-through;
|
|
152
|
+
}
|
|
153
|
+
`}
|
|
154
|
+
</style>
|
|
155
|
+
<HStack>
|
|
107
156
|
<Box
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
className="link-card"
|
|
111
|
-
borderRadius="small"
|
|
112
|
-
borderColor="border-default"
|
|
157
|
+
background="surface-success-subtle"
|
|
158
|
+
shadow="xsmall"
|
|
113
159
|
padding="4"
|
|
114
|
-
|
|
160
|
+
borderRadius="full 0 0 full"
|
|
115
161
|
>
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</Heading>
|
|
121
|
-
<BodyLong>This truly is inside a box!</BodyLong>
|
|
122
|
-
</VStack>
|
|
123
|
-
<ChevronRightIcon fontSize={24} className="link-card__chevron" />
|
|
124
|
-
</HStack>
|
|
162
|
+
<VStack align="center">
|
|
163
|
+
<Detail>Episk ny pris</Detail>
|
|
164
|
+
<Heading size="medium">889.99 kr</Heading>
|
|
165
|
+
</VStack>
|
|
125
166
|
</Box>
|
|
126
|
-
</>
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const ChatBubble = () => {
|
|
131
|
-
return (
|
|
132
|
-
<>
|
|
133
167
|
<Box
|
|
134
|
-
background="surface-
|
|
168
|
+
background="surface-danger-subtle"
|
|
135
169
|
shadow="xsmall"
|
|
136
170
|
padding="4"
|
|
137
|
-
borderRadius="
|
|
171
|
+
borderRadius="0 full full 0"
|
|
138
172
|
>
|
|
139
|
-
<VStack
|
|
140
|
-
<Detail>
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
</
|
|
173
|
+
<VStack align="center">
|
|
174
|
+
<Detail>Førpris</Detail>
|
|
175
|
+
<Heading className="old-price" size="medium">
|
|
176
|
+
399.99 kr
|
|
177
|
+
</Heading>
|
|
144
178
|
</VStack>
|
|
145
179
|
</Box>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const PricePill = () => {
|
|
151
|
-
return (
|
|
152
|
-
<>
|
|
153
|
-
<style>
|
|
154
|
-
{`
|
|
155
|
-
.old-price {
|
|
156
|
-
text-decoration: line-through;
|
|
157
|
-
}
|
|
158
|
-
`}
|
|
159
|
-
</style>
|
|
160
|
-
<HStack>
|
|
161
|
-
<Box
|
|
162
|
-
background="surface-success-subtle"
|
|
163
|
-
shadow="xsmall"
|
|
164
|
-
padding="4"
|
|
165
|
-
borderRadius="full 0 0 full"
|
|
166
|
-
>
|
|
167
|
-
<VStack align="center">
|
|
168
|
-
<Detail>Episk ny pris</Detail>
|
|
169
|
-
<Heading size="medium">889.99 kr</Heading>
|
|
170
|
-
</VStack>
|
|
171
|
-
</Box>
|
|
172
|
-
<Box
|
|
173
|
-
background="surface-danger-subtle"
|
|
174
|
-
shadow="xsmall"
|
|
175
|
-
padding="4"
|
|
176
|
-
borderRadius="0 full full 0"
|
|
177
|
-
>
|
|
178
|
-
<VStack align="center">
|
|
179
|
-
<Detail>Førpris</Detail>
|
|
180
|
-
<Heading className="old-price" size="medium">
|
|
181
|
-
399.99 kr
|
|
182
|
-
</Heading>
|
|
183
|
-
</VStack>
|
|
184
|
-
</Box>
|
|
185
|
-
</HStack>
|
|
186
|
-
</>
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
return (
|
|
191
|
-
<VStack gap="8">
|
|
192
|
-
<Card>Dette er et Card som bruker Box som base</Card>
|
|
193
|
-
<LinkCard />
|
|
194
|
-
<ChatBubble />
|
|
195
|
-
<PricePill />
|
|
196
|
-
</VStack>
|
|
180
|
+
</HStack>
|
|
181
|
+
</>
|
|
197
182
|
);
|
|
198
|
-
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<VStack gap="8">
|
|
187
|
+
<Card>Dette er et Card som bruker Box som base</Card>
|
|
188
|
+
<LinkCard />
|
|
189
|
+
<ChatBubble />
|
|
190
|
+
<PricePill />
|
|
191
|
+
</VStack>
|
|
192
|
+
);
|
|
199
193
|
};
|
|
200
194
|
|
|
201
195
|
export const PaddingBreakpoints = {
|
|
@@ -203,14 +197,14 @@ export const PaddingBreakpoints = {
|
|
|
203
197
|
<div>
|
|
204
198
|
<Box
|
|
205
199
|
padding={{ xs: "2", sm: "3", md: "4", lg: "5", xl: "6" }}
|
|
206
|
-
|
|
200
|
+
background="surface-neutral"
|
|
207
201
|
>
|
|
208
|
-
<
|
|
202
|
+
<Box background="surface-alt-3-subtle">
|
|
209
203
|
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
210
204
|
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore pariatur.
|
|
211
205
|
Proident pariatur proident pariatur magna consequat velit id commodo
|
|
212
206
|
quis sunt tempor ullamco aliquip pariatur.
|
|
213
|
-
</
|
|
207
|
+
</Box>
|
|
214
208
|
</Box>
|
|
215
209
|
</div>
|
|
216
210
|
),
|
|
@@ -222,67 +216,74 @@ export const PaddingBreakpointsInherit1 = {
|
|
|
222
216
|
<Box
|
|
223
217
|
padding={{ xs: "2" }}
|
|
224
218
|
paddingInline={{ md: "24 0" }}
|
|
225
|
-
|
|
219
|
+
background="surface-neutral"
|
|
226
220
|
>
|
|
227
|
-
<
|
|
221
|
+
<Box background="surface-alt-3-subtle">
|
|
228
222
|
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
229
223
|
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore pariatur.
|
|
230
224
|
Proident pariatur proident pariatur magna consequat velit id commodo
|
|
231
225
|
quis sunt tempor ullamco aliquip pariatur.
|
|
232
|
-
</
|
|
226
|
+
</Box>
|
|
233
227
|
</Box>
|
|
234
228
|
</div>
|
|
235
229
|
),
|
|
236
230
|
};
|
|
237
|
-
export const PaddingBreakpointsInherit2 =
|
|
238
|
-
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
quis sunt tempor ullamco aliquip pariatur.
|
|
250
|
-
</BodyLong>
|
|
231
|
+
export const PaddingBreakpointsInherit2 = () => (
|
|
232
|
+
<div>
|
|
233
|
+
<Box
|
|
234
|
+
padding={{ xs: "2", sm: "3" }}
|
|
235
|
+
paddingInline={{ sm: "4 0", md: "24 0" }}
|
|
236
|
+
background="surface-neutral"
|
|
237
|
+
>
|
|
238
|
+
<Box background="surface-alt-3-subtle">
|
|
239
|
+
This is inside a box. Deserunt veniam eu fugiat ad est occaecat aliqua
|
|
240
|
+
nisi aliquip. Aute amet occaecat ex aliqua irure elit labore pariatur.
|
|
241
|
+
Proident pariatur proident pariatur magna consequat velit id commodo
|
|
242
|
+
quis sunt tempor ullamco aliquip pariatur.
|
|
251
243
|
</Box>
|
|
252
|
-
</
|
|
253
|
-
|
|
254
|
-
|
|
244
|
+
</Box>
|
|
245
|
+
</div>
|
|
246
|
+
);
|
|
255
247
|
|
|
256
|
-
export const Padding =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
</
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
248
|
+
export const Padding = () => (
|
|
249
|
+
<VStack align="center" gap="2">
|
|
250
|
+
<Box padding="20" background="surface-alt-3-subtle">
|
|
251
|
+
<BodyLong>Padding all around</BodyLong>
|
|
252
|
+
</Box>
|
|
253
|
+
<Box padding="1" paddingBlock="20 0" background="surface-alt-3-subtle">
|
|
254
|
+
<BodyLong>Padding to the North</BodyLong>
|
|
255
|
+
</Box>
|
|
256
|
+
<Box padding="1" paddingInline="0 20" background="surface-alt-3-subtle">
|
|
257
|
+
<BodyLong>Padding to the East</BodyLong>
|
|
258
|
+
</Box>
|
|
259
|
+
<Box padding="1" paddingBlock="0 20" background="surface-alt-3-subtle">
|
|
260
|
+
<BodyLong>Padding to the South</BodyLong>
|
|
261
|
+
</Box>
|
|
262
|
+
<Box padding="1" paddingInline="20 0" background="surface-alt-3-subtle">
|
|
263
|
+
<BodyLong>Padding to the West</BodyLong>
|
|
264
|
+
</Box>
|
|
265
|
+
</VStack>
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
export const BoxInBox = () => (
|
|
269
|
+
<div>
|
|
270
|
+
<Box
|
|
271
|
+
padding={{ xs: "2", sm: "3" }}
|
|
272
|
+
paddingInline={{ sm: "4 1" }}
|
|
273
|
+
background="surface-alt-1-moderate"
|
|
274
|
+
shadow="small"
|
|
275
|
+
borderWidth="2"
|
|
276
|
+
borderColor="border-alt-3"
|
|
277
|
+
borderRadius="large"
|
|
278
|
+
>
|
|
279
|
+
<Box padding="8" paddingInline={{ sm: "12" }} background="bg-default">
|
|
280
|
+
<Box background="surface-alt-3-subtle">
|
|
281
|
+
CSS variables on a Box should not be inherited by children.
|
|
281
282
|
</Box>
|
|
282
|
-
</
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
</Box>
|
|
284
|
+
</Box>
|
|
285
|
+
</div>
|
|
286
|
+
);
|
|
286
287
|
|
|
287
288
|
export const WithHGrid = () => {
|
|
288
289
|
return (
|
|
@@ -308,77 +309,71 @@ export const WithHGrid = () => {
|
|
|
308
309
|
);
|
|
309
310
|
};
|
|
310
311
|
|
|
311
|
-
export const BorderWidth = () =>
|
|
312
|
-
|
|
313
|
-
<
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
);
|
|
341
|
-
};
|
|
312
|
+
export const BorderWidth = () => (
|
|
313
|
+
<VStack gap="4">
|
|
314
|
+
<Box
|
|
315
|
+
background="bg-subtle"
|
|
316
|
+
padding="10"
|
|
317
|
+
borderWidth="2"
|
|
318
|
+
borderColor="border-strong"
|
|
319
|
+
>
|
|
320
|
+
Box
|
|
321
|
+
</Box>
|
|
322
|
+
<Box
|
|
323
|
+
background="bg-subtle"
|
|
324
|
+
padding="10"
|
|
325
|
+
borderWidth="1 2 3 4"
|
|
326
|
+
borderColor="border-strong"
|
|
327
|
+
>
|
|
328
|
+
Box
|
|
329
|
+
</Box>
|
|
330
|
+
<Box
|
|
331
|
+
background="bg-subtle"
|
|
332
|
+
padding="10"
|
|
333
|
+
borderWidth="5 2 4 1"
|
|
334
|
+
borderColor="border-strong"
|
|
335
|
+
borderRadius="large"
|
|
336
|
+
>
|
|
337
|
+
Box
|
|
338
|
+
</Box>
|
|
339
|
+
</VStack>
|
|
340
|
+
);
|
|
342
341
|
|
|
343
|
-
export const BorderRadius = () =>
|
|
344
|
-
|
|
345
|
-
<
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
);
|
|
370
|
-
};
|
|
342
|
+
export const BorderRadius = () => (
|
|
343
|
+
<VStack gap="4">
|
|
344
|
+
<Box
|
|
345
|
+
background="bg-subtle"
|
|
346
|
+
padding="10"
|
|
347
|
+
borderWidth="2"
|
|
348
|
+
borderColor="border-strong"
|
|
349
|
+
borderRadius="small medium large xlarge"
|
|
350
|
+
>
|
|
351
|
+
Box
|
|
352
|
+
</Box>
|
|
353
|
+
<Box
|
|
354
|
+
background="bg-subtle"
|
|
355
|
+
padding="10"
|
|
356
|
+
borderWidth="2"
|
|
357
|
+
borderColor="border-strong"
|
|
358
|
+
borderRadius={{
|
|
359
|
+
xs: "small medium large xlarge",
|
|
360
|
+
md: "medium small large full",
|
|
361
|
+
lg: "xlarge large",
|
|
362
|
+
}}
|
|
363
|
+
>
|
|
364
|
+
Box
|
|
365
|
+
</Box>
|
|
366
|
+
</VStack>
|
|
367
|
+
);
|
|
371
368
|
|
|
372
|
-
export const PaddingDemo = () =>
|
|
373
|
-
|
|
374
|
-
<
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
);
|
|
384
|
-
};
|
|
369
|
+
export const PaddingDemo = () => (
|
|
370
|
+
<VStack gap="4">
|
|
371
|
+
<Box
|
|
372
|
+
background="bg-subtle"
|
|
373
|
+
padding="0"
|
|
374
|
+
paddingInline={{ xs: "20", lg: "10" }}
|
|
375
|
+
>
|
|
376
|
+
Box
|
|
377
|
+
</Box>
|
|
378
|
+
</VStack>
|
|
379
|
+
);
|
package/src/layout/box/Box.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import { OverridableComponent } from "../../util/OverridableComponent";
|
|
4
|
-
import { BorderRadiiToken } from "../utilities/types";
|
|
5
4
|
import {
|
|
6
5
|
SpaceDelimitedAttribute,
|
|
7
6
|
ResponsiveProp,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
BackgroundToken,
|
|
13
12
|
BorderColorToken,
|
|
14
13
|
ShadowToken,
|
|
14
|
+
BorderRadiiToken,
|
|
15
15
|
} from "../utilities/types";
|
|
16
16
|
|
|
17
17
|
export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -129,6 +129,7 @@ export const Box: OverridableComponent<BoxProps, HTMLDivElement> = forwardRef(
|
|
|
129
129
|
"border-radius",
|
|
130
130
|
"border-radius",
|
|
131
131
|
borderRadius,
|
|
132
|
+
false,
|
|
132
133
|
["0"]
|
|
133
134
|
),
|
|
134
135
|
...getResponsiveProps("box", "padding", "spacing", padding),
|