@navikt/ds-react 6.5.0 → 6.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.
Files changed (153) hide show
  1. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +2 -4
  2. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  3. package/cjs/form/combobox/Input/Input.js +6 -1
  4. package/cjs/form/combobox/Input/Input.js.map +1 -1
  5. package/cjs/form/form-summary/FormSummary.d.ts +82 -0
  6. package/cjs/form/form-summary/FormSummary.js +81 -0
  7. package/cjs/form/form-summary/FormSummary.js.map +1 -0
  8. package/cjs/form/form-summary/FormSummaryAnswer.d.ts +11 -0
  9. package/cjs/form/form-summary/FormSummaryAnswer.js +25 -0
  10. package/cjs/form/form-summary/FormSummaryAnswer.js.map +1 -0
  11. package/cjs/form/form-summary/FormSummaryAnswers.d.ts +9 -0
  12. package/cjs/form/form-summary/FormSummaryAnswers.js +48 -0
  13. package/cjs/form/form-summary/FormSummaryAnswers.js.map +1 -0
  14. package/cjs/form/form-summary/FormSummaryEditLink.d.ts +17 -0
  15. package/cjs/form/form-summary/FormSummaryEditLink.js +49 -0
  16. package/cjs/form/form-summary/FormSummaryEditLink.js.map +1 -0
  17. package/cjs/form/form-summary/FormSummaryHeader.d.ts +9 -0
  18. package/cjs/form/form-summary/FormSummaryHeader.js +48 -0
  19. package/cjs/form/form-summary/FormSummaryHeader.js.map +1 -0
  20. package/cjs/form/form-summary/FormSummaryHeading.d.ts +14 -0
  21. package/cjs/form/form-summary/FormSummaryHeading.js +31 -0
  22. package/cjs/form/form-summary/FormSummaryHeading.js.map +1 -0
  23. package/cjs/form/form-summary/FormSummaryLabel.d.ts +6 -0
  24. package/cjs/form/form-summary/FormSummaryLabel.js +45 -0
  25. package/cjs/form/form-summary/FormSummaryLabel.js.map +1 -0
  26. package/cjs/form/form-summary/FormSummaryValue.d.ts +6 -0
  27. package/cjs/form/form-summary/FormSummaryValue.js +49 -0
  28. package/cjs/form/form-summary/FormSummaryValue.js.map +1 -0
  29. package/cjs/form/form-summary/index.d.ts +8 -0
  30. package/cjs/form/form-summary/index.js +24 -0
  31. package/cjs/form/form-summary/index.js.map +1 -0
  32. package/cjs/index.d.ts +3 -2
  33. package/cjs/index.js +5 -3
  34. package/cjs/index.js.map +1 -1
  35. package/cjs/util/hooks/descendants/descendant.js +10 -1
  36. package/cjs/util/hooks/descendants/descendant.js.map +1 -1
  37. package/cjs/util/hooks/descendants/useDescendant.js +0 -5
  38. package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
  39. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +2 -4
  40. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  41. package/esm/form/combobox/Input/Input.js +6 -1
  42. package/esm/form/combobox/Input/Input.js.map +1 -1
  43. package/esm/form/form-summary/FormSummary.d.ts +82 -0
  44. package/esm/form/form-summary/FormSummary.js +52 -0
  45. package/esm/form/form-summary/FormSummary.js.map +1 -0
  46. package/esm/form/form-summary/FormSummaryAnswer.d.ts +11 -0
  47. package/esm/form/form-summary/FormSummaryAnswer.js +19 -0
  48. package/esm/form/form-summary/FormSummaryAnswer.js.map +1 -0
  49. package/esm/form/form-summary/FormSummaryAnswers.d.ts +9 -0
  50. package/esm/form/form-summary/FormSummaryAnswers.js +19 -0
  51. package/esm/form/form-summary/FormSummaryAnswers.js.map +1 -0
  52. package/esm/form/form-summary/FormSummaryEditLink.d.ts +17 -0
  53. package/esm/form/form-summary/FormSummaryEditLink.js +20 -0
  54. package/esm/form/form-summary/FormSummaryEditLink.js.map +1 -0
  55. package/esm/form/form-summary/FormSummaryHeader.d.ts +9 -0
  56. package/esm/form/form-summary/FormSummaryHeader.js +19 -0
  57. package/esm/form/form-summary/FormSummaryHeader.js.map +1 -0
  58. package/esm/form/form-summary/FormSummaryHeading.d.ts +14 -0
  59. package/esm/form/form-summary/FormSummaryHeading.js +5 -0
  60. package/esm/form/form-summary/FormSummaryHeading.js.map +1 -0
  61. package/esm/form/form-summary/FormSummaryLabel.d.ts +6 -0
  62. package/esm/form/form-summary/FormSummaryLabel.js +19 -0
  63. package/esm/form/form-summary/FormSummaryLabel.js.map +1 -0
  64. package/esm/form/form-summary/FormSummaryValue.d.ts +6 -0
  65. package/esm/form/form-summary/FormSummaryValue.js +20 -0
  66. package/esm/form/form-summary/FormSummaryValue.js.map +1 -0
  67. package/esm/form/form-summary/index.d.ts +8 -0
  68. package/esm/form/form-summary/index.js +10 -0
  69. package/esm/form/form-summary/index.js.map +1 -0
  70. package/esm/index.d.ts +3 -2
  71. package/esm/index.js +2 -1
  72. package/esm/index.js.map +1 -1
  73. package/esm/util/hooks/descendants/descendant.js +10 -1
  74. package/esm/util/hooks/descendants/descendant.js.map +1 -1
  75. package/esm/util/hooks/descendants/useDescendant.js +0 -5
  76. package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
  77. package/package.json +15 -4
  78. package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +9 -1
  79. package/src/form/combobox/Input/Input.tsx +5 -0
  80. package/src/form/form-summary/FormSummary.tsx +106 -0
  81. package/src/form/form-summary/FormSummaryAnswer.tsx +27 -0
  82. package/src/form/form-summary/FormSummaryAnswers.tsx +25 -0
  83. package/src/form/form-summary/FormSummaryEditLink.tsx +35 -0
  84. package/src/form/form-summary/FormSummaryHeader.tsx +25 -0
  85. package/src/form/form-summary/FormSummaryHeading.tsx +23 -0
  86. package/src/form/form-summary/FormSummaryLabel.tsx +17 -0
  87. package/src/form/form-summary/FormSummaryValue.tsx +24 -0
  88. package/src/form/form-summary/index.ts +30 -0
  89. package/src/index.ts +16 -15
  90. package/src/util/hooks/descendants/descendant.ts +15 -1
  91. package/src/util/hooks/descendants/useDescendant.tsx +0 -5
  92. package/src/accordion/accordion.stories.tsx +0 -286
  93. package/src/alert/alert.stories.tsx +0 -306
  94. package/src/button/button.stories.tsx +0 -185
  95. package/src/chat/chat.stories.tsx +0 -341
  96. package/src/chips/chips.stories.tsx +0 -260
  97. package/src/copybutton/copy-button.stories.tsx +0 -261
  98. package/src/date/datepicker/datepicker.stories.tsx +0 -614
  99. package/src/date/monthpicker/monthpicker.stories.tsx +0 -221
  100. package/src/dropdown/dropdown.stories.tsx +0 -124
  101. package/src/expansion-card/expansion-card.stories.tsx +0 -282
  102. package/src/form/checkbox/checkbox.stories.tsx +0 -281
  103. package/src/form/combobox/combobox.stories.tsx +0 -626
  104. package/src/form/confirmation-panel/confirmation-panel.stories.tsx +0 -128
  105. package/src/form/error-summary/error-summary.stories.tsx +0 -81
  106. package/src/form/fieldset/fieldset.stories.tsx +0 -157
  107. package/src/form/file-upload/file-upload-dropzone.stories.tsx +0 -123
  108. package/src/form/file-upload/file-upload-item.stories.tsx +0 -148
  109. package/src/form/file-upload/file-upload.stories.tsx +0 -248
  110. package/src/form/radio/radio.stories.tsx +0 -230
  111. package/src/form/search/search.stories.tsx +0 -238
  112. package/src/form/select/select.stories.tsx +0 -172
  113. package/src/form/switch/switch.stories.tsx +0 -171
  114. package/src/form/textarea/textarea.stories.tsx +0 -254
  115. package/src/form/textfield/text-field.stories.tsx +0 -143
  116. package/src/guide-panel/guidepanel.stories.tsx +0 -90
  117. package/src/help-text/help-text.stories.tsx +0 -91
  118. package/src/internal-header/header.stories.tsx +0 -229
  119. package/src/layout/bleed/Bleed.stories.tsx +0 -395
  120. package/src/layout/box/Box.stories.tsx +0 -380
  121. package/src/layout/grid/h-grid.stories.tsx +0 -122
  122. package/src/layout/page/Page.stories.tsx +0 -271
  123. package/src/layout/responsive/hide.stories.tsx +0 -80
  124. package/src/layout/responsive/show.stories.tsx +0 -80
  125. package/src/layout/sidemal-test/navno-sidemal.stories.tsx +0 -69
  126. package/src/layout/stack/stack.stories.tsx +0 -183
  127. package/src/link/stories/link.stories.tsx +0 -304
  128. package/src/link-panel/link-panel.stories.tsx +0 -59
  129. package/src/list/list.stories.tsx +0 -280
  130. package/src/loader/loader.stories.tsx +0 -82
  131. package/src/modal/modal.stories.tsx +0 -391
  132. package/src/pagination/pagination.stories.tsx +0 -110
  133. package/src/popover/popover.stories.tsx +0 -113
  134. package/src/portal/Portal.stories.tsx +0 -102
  135. package/src/read-more/readmore.stories.tsx +0 -91
  136. package/src/skeleton/skeleton.stories.tsx +0 -130
  137. package/src/stepper/stepper.stories.tsx +0 -200
  138. package/src/table/stories/table-1.stories.tsx +0 -292
  139. package/src/table/stories/table-2-expandable.stories.tsx +0 -298
  140. package/src/table/stories/table-3-async.stories.tsx +0 -179
  141. package/src/table/stories/tests/table.stories.tsx +0 -102
  142. package/src/tabs/Tabs.stories.tsx +0 -311
  143. package/src/tag/tag.stories.tsx +0 -126
  144. package/src/timeline/timeline.stories.tsx +0 -445
  145. package/src/toggle-group/ToggleGroup.stories.tsx +0 -198
  146. package/src/tooltip/tooltip.stories.tsx +0 -101
  147. package/src/typography/stories/bodylong.stories.tsx +0 -209
  148. package/src/typography/stories/bodyshort.stories.tsx +0 -208
  149. package/src/typography/stories/detail.stories.tsx +0 -115
  150. package/src/typography/stories/error-message.stories.tsx +0 -122
  151. package/src/typography/stories/heading.stories.tsx +0 -169
  152. package/src/typography/stories/label.stories.tsx +0 -131
  153. package/src/util/hooks/descendants/descendant.stories.tsx +0 -147
@@ -1,271 +0,0 @@
1
- import type { Meta, StoryFn } from "@storybook/react";
2
- import React, { useEffect } from "react";
3
- import bgColors from "@navikt/ds-tokens/src/colors-bg.json";
4
- import { Box } from "../box";
5
- import { HGrid } from "../grid";
6
- import Page from "./Page";
7
- import { widths } from "./parts/PageBlock";
8
-
9
- const meta: Meta = {
10
- title: "ds-react/Primitives/Page",
11
- component: Page,
12
- parameters: {
13
- layout: "fullscreen",
14
- },
15
- };
16
-
17
- export default meta;
18
-
19
- export const Default: StoryFn = ({
20
- belowFold,
21
- background,
22
- width,
23
- gutters,
24
- contentBlockPadding,
25
- }) => (
26
- <Page
27
- footer={<Footer width={width} gutters={gutters} />}
28
- footerPosition={belowFold ? "belowFold" : undefined}
29
- background={background}
30
- contentBlockPadding={contentBlockPadding}
31
- >
32
- <Header width={width} gutters={gutters} />
33
- <Content width={width} gutters={gutters} />
34
- </Page>
35
- );
36
-
37
- Default.argTypes = {
38
- width: {
39
- control: "radio",
40
- options: widths,
41
- },
42
- background: {
43
- control: "radio",
44
- options: Object.keys(bgColors.a),
45
- },
46
- belowFold: {
47
- control: "boolean",
48
- },
49
- gutters: {
50
- control: "boolean",
51
- },
52
- contentBlockPadding: {
53
- control: "radio",
54
- options: ["end", "none"],
55
- },
56
- };
57
-
58
- Default.args = {
59
- belowFold: false,
60
- gutters: false,
61
- contentBlockPadding: "end",
62
- };
63
-
64
- export const BelowFold: StoryFn = () => (
65
- <Page
66
- footer={<Footer />}
67
- footerPosition="belowFold"
68
- contentBlockPadding="end"
69
- >
70
- <Header />
71
- <Content />
72
- </Page>
73
- );
74
-
75
- export const Background: StoryFn = () => (
76
- <HGrid columns={2} gap="4">
77
- <Page
78
- background="bg-default"
79
- footer={<div>footer</div>}
80
- contentBlockPadding="end"
81
- >
82
- <div>header</div>
83
- <div>content</div>
84
- </Page>
85
- <Page
86
- background="bg-subtle"
87
- footer={<div>footer</div>}
88
- contentBlockPadding="end"
89
- >
90
- <div>header</div>
91
- <div>content</div>
92
- </Page>
93
- </HGrid>
94
- );
95
-
96
- export const ContentBlockPadding: StoryFn = () => (
97
- <HGrid columns={2} gap="6" align="start">
98
- <Page
99
- footer={<Footer width="lg" gutters />}
100
- contentBlockPadding="end"
101
- background="bg-subtle"
102
- >
103
- <Header width="lg" gutters />
104
- <Page.Block width="lg" gutters as="main">
105
- <Box background="surface-alt-3-subtle" style={{ height: "80vh" }}>
106
- Main
107
- </Box>
108
- </Page.Block>
109
- </Page>
110
- <Page
111
- footer={<Footer width="lg" gutters />}
112
- contentBlockPadding="none"
113
- background="bg-subtle"
114
- >
115
- <Header width="lg" gutters />
116
- <Page.Block width="lg" gutters as="main">
117
- <Box background="surface-alt-3-subtle" style={{ height: "80vh" }}>
118
- Main
119
- </Box>
120
- </Page.Block>
121
- </Page>
122
- </HGrid>
123
- );
124
-
125
- export const Gutters: StoryFn = () => (
126
- <HGrid columns={2} gap="6" align="start">
127
- <Page footer={<Footer width="lg" gutters />} background="bg-subtle">
128
- <Header width="lg" gutters />
129
- <Page.Block width="lg" gutters as="main">
130
- <Box background="surface-alt-3-subtle" style={{ height: "80vh" }}>
131
- Main
132
- </Box>
133
- </Page.Block>
134
- </Page>
135
- <Page footer={<Footer width="lg" />} background="bg-subtle">
136
- <Header width="lg" />
137
- <Page.Block width="lg" as="main">
138
- <Box background="surface-alt-3-subtle" style={{ height: "80vh" }}>
139
- Main
140
- </Box>
141
- </Page.Block>
142
- </Page>
143
- </HGrid>
144
- );
145
-
146
- Gutters.parameters = {
147
- chromatic: {
148
- modes: {
149
- mobile_portrait: {
150
- viewport: {
151
- width: 400,
152
- height: 850,
153
- },
154
- },
155
- desktop: {
156
- viewport: {
157
- width: 1280,
158
- height: 960,
159
- },
160
- },
161
- },
162
- },
163
- };
164
-
165
- const MILJO_URL = "https://www.nav.no/dekoratoren";
166
-
167
- export const WithDecorator: StoryFn = () => {
168
- return (
169
- <Page
170
- contentBlockPadding="end"
171
- footerPosition="belowFold"
172
- footer={<div id="decorator-footer"></div>}
173
- >
174
- <div id="decorator-header"></div>
175
- <Content width="lg" gutters />
176
- <div
177
- id="decorator-env"
178
- data-src={`${MILJO_URL}/env?context=privatperson`}
179
- ></div>
180
- </Page>
181
- );
182
- };
183
-
184
- WithDecorator.decorators = [
185
- (Story) => {
186
- useEffect(() => {
187
- const script = document.createElement("script");
188
- script.src = `${MILJO_URL}/client.js`;
189
- script.async = true;
190
- document.body.appendChild(script);
191
-
192
- const styles = document.createElement("link");
193
- styles.href = `${MILJO_URL}/css/client.css`;
194
- styles.rel = "stylesheet";
195
- document.head.appendChild(styles);
196
-
197
- return () => {
198
- document.body.removeChild(script);
199
- document.head.removeChild(styles);
200
- };
201
- }, []);
202
-
203
- return <Story />;
204
- },
205
- ];
206
-
207
- WithDecorator.parameters = {
208
- chromatic: {
209
- disable: true,
210
- },
211
- };
212
-
213
- export const OutsideBackground = () => {
214
- return (
215
- <Page
216
- contentBlockPadding="end"
217
- footer={
218
- <Box
219
- background="surface-alt-3-subtle"
220
- style={{ height: 100 }}
221
- as="footer"
222
- >
223
- <Page.Block width="lg" gutters>
224
- Footer
225
- </Page.Block>
226
- </Box>
227
- }
228
- >
229
- <Box background="surface-alt-1-subtle" style={{ height: 64 }} as="header">
230
- <Page.Block width="lg" gutters>
231
- Header
232
- </Page.Block>
233
- </Box>
234
- <Box background="surface-alt-2-subtle" style={{ height: 300 }} as="main">
235
- <Page.Block width="lg" gutters>
236
- main
237
- </Page.Block>
238
- </Box>
239
- </Page>
240
- );
241
- };
242
-
243
- function Header({ width = "lg", gutters = false }: any) {
244
- return (
245
- <Page.Block as="header" width={width} gutters={gutters}>
246
- <Box background="surface-alt-3-subtle" style={{ height: 64 }}>
247
- Header
248
- </Box>
249
- </Page.Block>
250
- );
251
- }
252
-
253
- function Content({ width = "lg", gutters = false }: any) {
254
- return (
255
- <Page.Block width={width} gutters={gutters} as="main">
256
- <Box background="surface-alt-3-subtle" style={{ height: 300 }}>
257
- Main
258
- </Box>
259
- </Page.Block>
260
- );
261
- }
262
-
263
- function Footer({ width = "lg", gutters = false }: any) {
264
- return (
265
- <Page.Block width={width} gutters={gutters} as="footer">
266
- <Box background="surface-alt-3-subtle" style={{ height: 100 }}>
267
- Footer
268
- </Box>
269
- </Page.Block>
270
- );
271
- }
@@ -1,80 +0,0 @@
1
- import type { Meta } from "@storybook/react";
2
- import React from "react";
3
- import { Hide } from ".";
4
- import { Tag } from "../../tag";
5
- import { VStack } from "../stack";
6
-
7
- export default {
8
- title: "ds-react/Primitives/Hide",
9
- component: Hide,
10
- } satisfies Meta<typeof Hide>;
11
-
12
- export const Default = {
13
- render: () => (
14
- <VStack gap="12">
15
- <VStack gap="2" align="center">
16
- <Hide above="xl">
17
- <Tag variant="neutral">Visible below xl</Tag>
18
- </Hide>
19
- <Hide above="lg">
20
- <Tag variant="neutral">Visible below lg</Tag>
21
- </Hide>
22
- <Hide above="md">
23
- <Tag variant="neutral">Visible below md</Tag>
24
- </Hide>
25
- <Hide above="sm">
26
- <Tag variant="neutral">Visible below sm</Tag>
27
- </Hide>
28
- </VStack>
29
- <VStack gap="2" align="center">
30
- <Hide below="xl">
31
- <Tag variant="alt3">Visible above xl</Tag>
32
- </Hide>
33
- <Hide below="lg">
34
- <Tag variant="alt3">Visible above lg</Tag>
35
- </Hide>
36
- <Hide below="md">
37
- <Tag variant="alt3">Visible above md</Tag>
38
- </Hide>
39
- <Hide below="sm">
40
- <Tag variant="alt3">Visible above sm</Tag>
41
- </Hide>
42
- </VStack>
43
- </VStack>
44
- ),
45
- };
46
-
47
- export const AsChild = {
48
- render: () => (
49
- <VStack gap="12">
50
- <VStack gap="2" align="center">
51
- <Hide above="xl" asChild>
52
- <Tag variant="neutral">Hidden above xl</Tag>
53
- </Hide>
54
- <Hide above="lg" asChild>
55
- <Tag variant="neutral">Hidden above lg</Tag>
56
- </Hide>
57
- <Hide above="md" asChild>
58
- <Tag variant="neutral">Hidden above md</Tag>
59
- </Hide>
60
- <Hide above="sm" asChild>
61
- <Tag variant="neutral">Hidden above sm</Tag>
62
- </Hide>
63
- </VStack>
64
- <VStack gap="2" align="center">
65
- <Hide below="xl" asChild>
66
- <Tag variant="alt3">Hidden below xl</Tag>
67
- </Hide>
68
- <Hide below="lg" asChild>
69
- <Tag variant="alt3">Hidden below lg</Tag>
70
- </Hide>
71
- <Hide below="md" asChild>
72
- <Tag variant="alt3">Hidden below md</Tag>
73
- </Hide>
74
- <Hide below="sm" asChild>
75
- <Tag variant="alt3">Hidden below sm</Tag>
76
- </Hide>
77
- </VStack>
78
- </VStack>
79
- ),
80
- };
@@ -1,80 +0,0 @@
1
- import type { Meta } from "@storybook/react";
2
- import React from "react";
3
- import { Show } from ".";
4
- import { Tag } from "../../tag";
5
- import { VStack } from "../stack";
6
-
7
- export default {
8
- title: "ds-react/Primitives/Show",
9
- component: Show,
10
- } satisfies Meta<typeof Show>;
11
-
12
- export const Default = {
13
- render: () => (
14
- <VStack gap="12">
15
- <VStack gap="2" align="center">
16
- <Show above="xl">
17
- <Tag variant="neutral">Visible above xl</Tag>
18
- </Show>
19
- <Show above="lg">
20
- <Tag variant="neutral">Visible above lg</Tag>
21
- </Show>
22
- <Show above="md">
23
- <Tag variant="neutral">Visible above md</Tag>
24
- </Show>
25
- <Show above="sm">
26
- <Tag variant="neutral">Visible above sm</Tag>
27
- </Show>
28
- </VStack>
29
- <VStack gap="2" align="center">
30
- <Show below="xl">
31
- <Tag variant="alt3">Visible below xl</Tag>
32
- </Show>
33
- <Show below="lg">
34
- <Tag variant="alt3">Visible below lg</Tag>
35
- </Show>
36
- <Show below="md">
37
- <Tag variant="alt3">Visible below md</Tag>
38
- </Show>
39
- <Show below="sm">
40
- <Tag variant="alt3">Visible below sm</Tag>
41
- </Show>
42
- </VStack>
43
- </VStack>
44
- ),
45
- };
46
-
47
- export const AsChild = {
48
- render: () => (
49
- <VStack gap="12">
50
- <VStack gap="2" align="center">
51
- <Show above="xl" asChild>
52
- <Tag variant="neutral">Visible above xl</Tag>
53
- </Show>
54
- <Show above="lg" asChild>
55
- <Tag variant="neutral">Visible above lg</Tag>
56
- </Show>
57
- <Show above="md" asChild>
58
- <Tag variant="neutral">Visible above md</Tag>
59
- </Show>
60
- <Show above="sm" asChild>
61
- <Tag variant="neutral">Visible above sm</Tag>
62
- </Show>
63
- </VStack>
64
- <VStack gap="2" align="center">
65
- <Show below="xl" asChild>
66
- <Tag variant="alt3">Visible below xl</Tag>
67
- </Show>
68
- <Show below="lg" asChild>
69
- <Tag variant="alt3">Visible below lg</Tag>
70
- </Show>
71
- <Show below="md" asChild>
72
- <Tag variant="alt3">Visible below md</Tag>
73
- </Show>
74
- <Show below="sm" asChild>
75
- <Tag variant="alt3">Visible below sm</Tag>
76
- </Show>
77
- </VStack>
78
- </VStack>
79
- ),
80
- };
@@ -1,69 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import React from "react";
3
- import { Box } from "../box";
4
- import { HGrid } from "../grid";
5
- import { Hide, Show } from "../responsive";
6
- import { VStack } from "../stack";
7
- import { Content } from "./Content";
8
- import { FilterCard } from "./Filter";
9
- import { Header } from "./Header";
10
- import { IntroCard } from "./Intro";
11
- import { Sidebar } from "./Sidebar";
12
- import { ContentBox } from "./content-box";
13
- import "./styling.css";
14
-
15
- const meta = {
16
- title: "kitchen sink/navno-sidemal",
17
- parameters: {
18
- layout: "fullscreen",
19
- chromatic: { disableSnapshot: true },
20
- },
21
- } satisfies Meta;
22
-
23
- export default meta;
24
- type Story = StoryObj<typeof meta>;
25
-
26
- export const Page: Story = {
27
- render: () => {
28
- return (
29
- <div>
30
- <Header />
31
- <Box
32
- style={{ minHeight: "calc(100vh - 10rem)" }}
33
- background="surface-subtle"
34
- paddingBlock="12 0"
35
- >
36
- <ContentBox maxWidth="lg">
37
- <Box paddingInline="4">
38
- <HGrid
39
- align="start"
40
- columns={{
41
- xs: "minmax(auto, 600px)",
42
- md: "288px minmax(auto, 600px)",
43
- }}
44
- gap={{ xs: "3", md: "6" }}
45
- >
46
- <Box style={{ position: "sticky", top: "1rem" }}>
47
- <Show above="md">
48
- <Sidebar />
49
- </Show>
50
- </Box>
51
- <VStack gap={{ xs: "6", md: "8" }}>
52
- <IntroCard />
53
- <FilterCard />
54
- <Hide above="md">
55
- <Sidebar />
56
- </Hide>
57
- <Content />
58
- <Content />
59
- <Content />
60
- <Content />
61
- </VStack>
62
- </HGrid>
63
- </Box>
64
- </ContentBox>
65
- </Box>
66
- </div>
67
- );
68
- },
69
- };
@@ -1,183 +0,0 @@
1
- import type { Meta } from "@storybook/react";
2
- import React from "react";
3
- import { HStack, Spacer, Stack, VStack } from ".";
4
- import { Box } from "../box";
5
-
6
- export default {
7
- title: "ds-react/Primitives/Stack",
8
- component: HStack,
9
- } satisfies Meta<typeof HStack>;
10
-
11
- export const Horizontal = {
12
- render: () => (
13
- <HStack gap="4">
14
- <Placeholders count={4} />
15
- </HStack>
16
- ),
17
- };
18
-
19
- export const Spacing = {
20
- render: () => (
21
- <div style={{ height: "80vh", display: "flex" }}>
22
- <VStack gap="8">
23
- <Spacer />
24
- <HStack gap="4">
25
- <Placeholders count={1} />
26
- <Spacer />
27
- <Placeholders count={1} />
28
- </HStack>
29
- <HStack gap="4">
30
- <Placeholders count={1} />
31
- <Placeholders count={1} />
32
- </HStack>
33
- <HStack gap="4">
34
- <Placeholders count={2} />
35
- </HStack>
36
- </VStack>
37
- </div>
38
- ),
39
- parameters: {
40
- layout: "fullscreen",
41
- },
42
- };
43
-
44
- export const Vertical = {
45
- render: () => (
46
- <VStack gap="4">
47
- <Placeholders count={4} />
48
- </VStack>
49
- ),
50
- };
51
-
52
- export const VerticalDemo = {
53
- render: () => (
54
- <VStack gap="2">
55
- <VStack>
56
- <Placeholders count={4} />
57
- </VStack>
58
- <Placeholders count={4} />
59
- <VStack>
60
- <Placeholders count={4} />
61
- </VStack>
62
- </VStack>
63
- ),
64
- };
65
-
66
- export const VerticalAlign = {
67
- render: () => (
68
- <VStack gap="4">
69
- <VStack align="start">
70
- <Placeholders count={2} />
71
- </VStack>
72
- <VStack align="center">
73
- <Placeholders count={2} />
74
- </VStack>
75
- <VStack align="end">
76
- <Placeholders count={2} />
77
- </VStack>
78
- </VStack>
79
- ),
80
- parameters: {
81
- layout: "fullscreen",
82
- },
83
- };
84
-
85
- export const OverrideComponent = {
86
- render: () => (
87
- <VStack gap="4" as="form" onSubmit={(e) => e.preventDefault()}>
88
- <Placeholders count={4} />
89
- </VStack>
90
- ),
91
- };
92
-
93
- export const Responsive = {
94
- render: () => (
95
- <VStack gap={{ xs: "1", sm: "3", md: "6", lg: "10", xl: "16" }}>
96
- <Placeholders count={4} />
97
- </VStack>
98
- ),
99
- };
100
-
101
- export const Nested = {
102
- render: () => (
103
- <VStack gap="16">
104
- <Placeholders count={2}>
105
- <VStack gap="4">
106
- <Placeholders count={2} color="gray" />
107
- </VStack>
108
- </Placeholders>
109
- </VStack>
110
- ),
111
- };
112
-
113
- export const DividerDemo = {
114
- render: () => (
115
- <div style={{ height: "80vh", width: "40rem" }}>
116
- <VStack gap={{ xs: "2", md: "6", lg: "12" }}>
117
- <HStack gap={{ xs: "2", md: "6", lg: "12" }}>
118
- <Placeholders count={1} />
119
- <Spacer />
120
- <Placeholders count={1} />
121
- </HStack>
122
- <hr
123
- style={{
124
- border: "none",
125
- borderBottom: "1px solid var(--a-border-divider)",
126
- margin: 0,
127
- }}
128
- />
129
- <HStack gap={{ xs: "2", md: "6", lg: "12" }}>
130
- <Placeholders count={2} />
131
- </HStack>
132
- </VStack>
133
- </div>
134
- ),
135
- };
136
-
137
- export const ResponsiveDirection = {
138
- render: () => (
139
- <Box
140
- background="surface-alt-3-subtle"
141
- padding="12"
142
- style={{ minWidth: "20rem", aspectRatio: "1/1" }}
143
- >
144
- <Stack
145
- align={{ xs: "center", md: "start" }}
146
- gap="2"
147
- direction={{ xs: "column", lg: "row" }}
148
- >
149
- <Box padding="6" background="surface-action" />
150
- <Box padding="2" background="surface-action" />
151
- <Box padding="6" background="surface-action" />
152
- <Box padding="4" background="surface-action" />
153
- </Stack>
154
- </Box>
155
- ),
156
- };
157
-
158
- function Placeholders({
159
- count,
160
- children,
161
- color,
162
- }: {
163
- count: number;
164
- children?: React.ReactNode;
165
- color?: string;
166
- }) {
167
- return (
168
- <>
169
- {Array.from({ length: count }, (_, i) => (
170
- <div
171
- key={i}
172
- style={{
173
- backgroundColor: color ?? "var(--a-purple-200)",
174
- height: children ? "" : "3rem",
175
- width: children ? "" : "3rem",
176
- }}
177
- >
178
- {children}
179
- </div>
180
- ))}
181
- </>
182
- );
183
- }