@navikt/ds-react 6.1.1 → 6.2.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 (176) hide show
  1. package/cjs/accordion/Accordion.d.ts +4 -4
  2. package/cjs/alert/Alert.d.ts +12 -10
  3. package/cjs/alert/Alert.js.map +1 -1
  4. package/cjs/button/Button.d.ts +9 -8
  5. package/cjs/button/Button.js.map +1 -1
  6. package/cjs/chat/Chat.d.ts +6 -6
  7. package/cjs/chips/Chips.d.ts +2 -2
  8. package/cjs/copybutton/CopyButton.d.ts +14 -12
  9. package/cjs/copybutton/CopyButton.js.map +1 -1
  10. package/cjs/date/datepicker/types.d.ts +7 -6
  11. package/cjs/date/hooks/useDatepicker.d.ts +4 -3
  12. package/cjs/date/hooks/useDatepicker.js.map +1 -1
  13. package/cjs/date/hooks/useMonthPicker.d.ts +4 -3
  14. package/cjs/date/hooks/useMonthPicker.js.map +1 -1
  15. package/cjs/date/monthpicker/types.d.ts +2 -1
  16. package/cjs/date/parts/DateInput.d.ts +1 -1
  17. package/cjs/expansion-card/ExpansionCardTitle.d.ts +1 -1
  18. package/cjs/form/checkbox/CheckboxGroup.d.ts +3 -3
  19. package/cjs/form/checkbox/types.d.ts +4 -4
  20. package/cjs/form/combobox/types.d.ts +15 -15
  21. package/cjs/form/error-summary/ErrorSummary.d.ts +5 -5
  22. package/cjs/form/radio/RadioGroup.d.ts +1 -1
  23. package/cjs/form/search/Search.d.ts +3 -2
  24. package/cjs/form/search/Search.js.map +1 -1
  25. package/cjs/form/select/Select.d.ts +9 -9
  26. package/cjs/form/switch/Switch.d.ts +5 -5
  27. package/cjs/form/textarea/Textarea.d.ts +5 -4
  28. package/cjs/form/textarea/Textarea.js.map +1 -1
  29. package/cjs/form/useFormField.d.ts +10 -8
  30. package/cjs/form/useFormField.js.map +1 -1
  31. package/cjs/layout/bleed/Bleed.d.ts +9 -1
  32. package/cjs/layout/bleed/Bleed.js.map +1 -1
  33. package/cjs/layout/box/Box.d.ts +5 -5
  34. package/cjs/layout/grid/HGrid.d.ts +1 -3
  35. package/cjs/layout/grid/HGrid.js.map +1 -1
  36. package/cjs/layout/page/Page.d.ts +2 -2
  37. package/cjs/layout/responsive/Responsive.d.ts +2 -4
  38. package/cjs/layout/responsive/Responsive.js.map +1 -1
  39. package/cjs/layout/stack/Stack.d.ts +18 -4
  40. package/cjs/layout/stack/Stack.js.map +1 -1
  41. package/cjs/list/types.d.ts +1 -1
  42. package/cjs/loader/Loader.d.ts +1 -0
  43. package/cjs/loader/Loader.js.map +1 -1
  44. package/cjs/modal/Modal.js +2 -2
  45. package/cjs/modal/types.d.ts +8 -8
  46. package/cjs/pagination/Pagination.d.ts +3 -2
  47. package/cjs/pagination/Pagination.js.map +1 -1
  48. package/cjs/pagination/PaginationItem.d.ts +1 -1
  49. package/cjs/popover/Popover.d.ts +2 -1
  50. package/cjs/popover/Popover.js.map +1 -1
  51. package/cjs/read-more/ReadMore.d.ts +7 -7
  52. package/cjs/stepper/Step.d.ts +4 -4
  53. package/cjs/stepper/Stepper.d.ts +7 -5
  54. package/cjs/stepper/Stepper.js.map +1 -1
  55. package/cjs/table/AnimateHeight.d.ts +1 -1
  56. package/cjs/tabs/TabList.d.ts +1 -1
  57. package/cjs/tabs/Tabs.d.ts +7 -7
  58. package/cjs/timeline/Timeline.d.ts +6 -3
  59. package/cjs/timeline/Timeline.js +2 -1
  60. package/cjs/timeline/Timeline.js.map +1 -1
  61. package/cjs/timeline/period/index.d.ts +3 -2
  62. package/cjs/timeline/period/index.js.map +1 -1
  63. package/cjs/tooltip/Tooltip.d.ts +19 -12
  64. package/cjs/tooltip/Tooltip.js.map +1 -1
  65. package/esm/accordion/Accordion.d.ts +4 -4
  66. package/esm/alert/Alert.d.ts +12 -10
  67. package/esm/alert/Alert.js.map +1 -1
  68. package/esm/button/Button.d.ts +9 -8
  69. package/esm/button/Button.js.map +1 -1
  70. package/esm/chat/Chat.d.ts +6 -6
  71. package/esm/chips/Chips.d.ts +2 -2
  72. package/esm/copybutton/CopyButton.d.ts +14 -12
  73. package/esm/copybutton/CopyButton.js.map +1 -1
  74. package/esm/date/datepicker/types.d.ts +7 -6
  75. package/esm/date/hooks/useDatepicker.d.ts +4 -3
  76. package/esm/date/hooks/useDatepicker.js.map +1 -1
  77. package/esm/date/hooks/useMonthPicker.d.ts +4 -3
  78. package/esm/date/hooks/useMonthPicker.js.map +1 -1
  79. package/esm/date/monthpicker/types.d.ts +2 -1
  80. package/esm/date/parts/DateInput.d.ts +1 -1
  81. package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
  82. package/esm/form/checkbox/CheckboxGroup.d.ts +3 -3
  83. package/esm/form/checkbox/types.d.ts +4 -4
  84. package/esm/form/combobox/types.d.ts +15 -15
  85. package/esm/form/error-summary/ErrorSummary.d.ts +5 -5
  86. package/esm/form/radio/RadioGroup.d.ts +1 -1
  87. package/esm/form/search/Search.d.ts +3 -2
  88. package/esm/form/search/Search.js.map +1 -1
  89. package/esm/form/select/Select.d.ts +9 -9
  90. package/esm/form/switch/Switch.d.ts +5 -5
  91. package/esm/form/textarea/Textarea.d.ts +5 -4
  92. package/esm/form/textarea/Textarea.js.map +1 -1
  93. package/esm/form/useFormField.d.ts +10 -8
  94. package/esm/form/useFormField.js.map +1 -1
  95. package/esm/layout/bleed/Bleed.d.ts +9 -1
  96. package/esm/layout/bleed/Bleed.js.map +1 -1
  97. package/esm/layout/box/Box.d.ts +5 -5
  98. package/esm/layout/grid/HGrid.d.ts +1 -3
  99. package/esm/layout/grid/HGrid.js.map +1 -1
  100. package/esm/layout/page/Page.d.ts +2 -2
  101. package/esm/layout/responsive/Responsive.d.ts +2 -4
  102. package/esm/layout/responsive/Responsive.js.map +1 -1
  103. package/esm/layout/stack/Stack.d.ts +18 -4
  104. package/esm/layout/stack/Stack.js.map +1 -1
  105. package/esm/list/types.d.ts +1 -1
  106. package/esm/loader/Loader.d.ts +1 -0
  107. package/esm/loader/Loader.js.map +1 -1
  108. package/esm/modal/Modal.js +2 -2
  109. package/esm/modal/types.d.ts +8 -8
  110. package/esm/pagination/Pagination.d.ts +3 -2
  111. package/esm/pagination/Pagination.js.map +1 -1
  112. package/esm/pagination/PaginationItem.d.ts +1 -1
  113. package/esm/popover/Popover.d.ts +2 -1
  114. package/esm/popover/Popover.js.map +1 -1
  115. package/esm/read-more/ReadMore.d.ts +7 -7
  116. package/esm/stepper/Step.d.ts +4 -4
  117. package/esm/stepper/Stepper.d.ts +7 -5
  118. package/esm/stepper/Stepper.js.map +1 -1
  119. package/esm/table/AnimateHeight.d.ts +1 -1
  120. package/esm/tabs/TabList.d.ts +1 -1
  121. package/esm/tabs/Tabs.d.ts +7 -7
  122. package/esm/timeline/Timeline.d.ts +6 -3
  123. package/esm/timeline/Timeline.js +2 -1
  124. package/esm/timeline/Timeline.js.map +1 -1
  125. package/esm/timeline/period/index.d.ts +3 -2
  126. package/esm/timeline/period/index.js.map +1 -1
  127. package/esm/tooltip/Tooltip.d.ts +19 -12
  128. package/esm/tooltip/Tooltip.js.map +1 -1
  129. package/package.json +3 -3
  130. package/src/accordion/Accordion.tsx +4 -4
  131. package/src/accordion/accordion.stories.tsx +0 -2
  132. package/src/alert/Alert.tsx +12 -10
  133. package/src/button/Button.tsx +9 -8
  134. package/src/chat/Chat.tsx +6 -6
  135. package/src/chips/Chips.tsx +2 -2
  136. package/src/copybutton/CopyButton.tsx +14 -12
  137. package/src/date/datepicker/datepicker.stories.tsx +0 -1
  138. package/src/date/datepicker/types.ts +7 -6
  139. package/src/date/hooks/useDatepicker.tsx +4 -3
  140. package/src/date/hooks/useMonthPicker.tsx +4 -3
  141. package/src/date/monthpicker/types.ts +2 -1
  142. package/src/date/parts/DateInput.tsx +1 -1
  143. package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
  144. package/src/form/checkbox/CheckboxGroup.tsx +3 -3
  145. package/src/form/checkbox/types.ts +4 -4
  146. package/src/form/combobox/types.ts +15 -15
  147. package/src/form/error-summary/ErrorSummary.tsx +5 -5
  148. package/src/form/radio/RadioGroup.tsx +1 -1
  149. package/src/form/search/Search.tsx +3 -2
  150. package/src/form/select/Select.tsx +9 -9
  151. package/src/form/select/select.stories.tsx +32 -37
  152. package/src/form/switch/Switch.tsx +5 -5
  153. package/src/form/textarea/Textarea.tsx +5 -4
  154. package/src/form/useFormField.ts +10 -8
  155. package/src/layout/bleed/Bleed.tsx +9 -1
  156. package/src/layout/box/Box.tsx +5 -5
  157. package/src/layout/grid/HGrid.tsx +1 -3
  158. package/src/layout/page/Page.tsx +2 -2
  159. package/src/layout/responsive/Responsive.tsx +2 -4
  160. package/src/layout/stack/Stack.tsx +18 -4
  161. package/src/list/types.ts +1 -1
  162. package/src/loader/Loader.tsx +1 -0
  163. package/src/modal/Modal.tsx +2 -2
  164. package/src/modal/types.ts +8 -8
  165. package/src/pagination/Pagination.tsx +3 -2
  166. package/src/pagination/PaginationItem.tsx +1 -1
  167. package/src/popover/Popover.tsx +2 -1
  168. package/src/read-more/ReadMore.tsx +7 -7
  169. package/src/stepper/Step.tsx +4 -4
  170. package/src/stepper/Stepper.tsx +7 -5
  171. package/src/table/AnimateHeight.tsx +1 -1
  172. package/src/tabs/TabList.tsx +1 -1
  173. package/src/tabs/Tabs.tsx +7 -7
  174. package/src/timeline/Timeline.tsx +6 -3
  175. package/src/timeline/period/index.tsx +3 -2
  176. package/src/tooltip/Tooltip.tsx +19 -12
@@ -6,20 +6,20 @@ import ErrorSummaryItem, { ErrorSummaryItemType } from "./ErrorSummaryItem";
6
6
 
7
7
  export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
8
8
  /**
9
- * Collectipn of ErrorSummary.Item
9
+ * Collection of `ErrorSummary.Item`.
10
10
  */
11
11
  children: React.ReactNode;
12
12
  /**
13
- * Changes padding and font-sizes
13
+ * Changes padding and font-sizes.
14
14
  * @default "medium"
15
15
  */
16
16
  size?: "medium" | "small";
17
17
  /**
18
- * Heading above links
18
+ * Heading above links.
19
19
  */
20
20
  heading?: React.ReactNode;
21
21
  /**
22
- * Allows setting a different HTML h-tag
22
+ * Allows setting a different HTML h-tag.
23
23
  * @default "h2"
24
24
  */
25
25
  headingTag?: React.ElementType<any>;
@@ -30,7 +30,7 @@ interface ErrorSummaryComponent
30
30
  ErrorSummaryProps & React.RefAttributes<HTMLDivElement>
31
31
  > {
32
32
  /**
33
- * Link to error
33
+ * Link to error.
34
34
  *
35
35
  * @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
36
36
  *
@@ -21,7 +21,7 @@ export interface RadioGroupProps
21
21
  "onChange" | "errorPropagation" | "defaultValue"
22
22
  > {
23
23
  /**
24
- * Collection of <Radio />-elements
24
+ * Collection of `<Radio />`-elements
25
25
  */
26
26
  children: React.ReactNode;
27
27
  /**
@@ -26,8 +26,9 @@ export interface SearchProps
26
26
  Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "type"> {
27
27
  children?: React.ReactNode;
28
28
  /**
29
- * Search label
30
- * @note Will be hidden by default, is required for accessibility reasons.
29
+ * Search label.
30
+ *
31
+ * Will be hidden by default, is required for accessibility reasons.
31
32
  */
32
33
  label: React.ReactNode;
33
34
  /**
@@ -8,27 +8,27 @@ import { FormFieldProps, useFormField } from "../useFormField";
8
8
 
9
9
  export interface SelectProps
10
10
  extends FormFieldProps,
11
- Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
11
+ Omit<SelectHTMLAttributes<HTMLSelectElement>, "size" | "multiple"> {
12
12
  /**
13
- * Collection of <option />-elements
13
+ * Collection of <option />-elements.
14
14
  */
15
15
  children: React.ReactNode;
16
16
  /**
17
- * Exposes the HTML size attribute
17
+ * Exposes the HTML size attribute.
18
18
  */
19
19
  htmlSize?: number;
20
20
  /**
21
- * Label for select
21
+ * Sets inline-style on select wrapper.
22
22
  */
23
- label: React.ReactNode;
23
+ style?: React.CSSProperties;
24
24
  /**
25
- * If enabled shows the label and description for screenreaders only
25
+ * Label for select.
26
26
  */
27
- hideLabel?: boolean;
27
+ label: React.ReactNode;
28
28
  /**
29
- * Sets inline-style on select wrapper
29
+ * Shows label and description for screenreaders only.
30
30
  */
31
- style?: React.CSSProperties;
31
+ hideLabel?: boolean;
32
32
  }
33
33
 
34
34
  /**
@@ -1,36 +1,15 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { Meta, StoryFn, StoryObj } from "@storybook/react";
2
2
  import React from "react";
3
- import Select from "./Select";
3
+ import Select, { SelectProps } from "./Select";
4
4
 
5
- export default {
5
+ const meta: Meta<typeof Select> = {
6
6
  title: "ds-react/Select",
7
7
  component: Select,
8
- argTypes: {
9
- size: {
10
- control: {
11
- type: "radio",
12
- options: ["medium", "small"],
13
- },
14
- },
15
- description: {
16
- type: "string",
17
- },
18
- error: {
19
- type: "string",
20
- },
21
- hideLabel: {
22
- type: "boolean",
23
- },
24
- disabled: {
25
- type: "boolean",
26
- },
27
- },
28
8
  parameters: {
29
9
  chromatic: { disable: true },
30
10
  },
31
- } as Meta;
32
-
33
- type Story = StoryObj<typeof Select>;
11
+ };
12
+ export default meta;
34
13
 
35
14
  const content = (
36
15
  <>
@@ -40,16 +19,32 @@ const content = (
40
19
  </>
41
20
  );
42
21
 
43
- export const Default = {
44
- render: (props) => {
45
- return (
46
- <Select {...props} label="Ipsum enim quis culpa">
47
- {content}
48
- </Select>
49
- );
22
+ export const Default: StoryFn<Omit<SelectProps, "children">> = (props) => (
23
+ <Select {...props}>{content}</Select>
24
+ );
25
+ Default.args = {
26
+ label: "Ipsum enim quis culpa",
27
+ };
28
+ Default.argTypes = {
29
+ description: {
30
+ type: "string",
31
+ },
32
+ size: {
33
+ control: { type: "radio" },
34
+ options: ["medium", "small"],
35
+ },
36
+ error: {
37
+ type: "string",
38
+ },
39
+ hideLabel: {
40
+ type: "boolean",
41
+ },
42
+ disabled: {
43
+ type: "boolean",
44
+ },
45
+ readOnly: {
46
+ type: "boolean",
50
47
  },
51
-
52
- args: {},
53
48
  };
54
49
 
55
50
  export const Small = () => {
@@ -138,12 +133,12 @@ export const Readonly = () => {
138
133
  );
139
134
  };
140
135
 
141
- export const Chromatic: Story = {
136
+ export const Chromatic: StoryObj<typeof Select> = {
142
137
  render: () => (
143
138
  <div>
144
139
  <div>
145
140
  <h2>Default</h2>
146
- {Default.render?.({ label: "Ipsum enim quis culpa" })}
141
+ <Default label="Ipsum enim quis culpa" />
147
142
  </div>
148
143
  <div>
149
144
  <h2>Small</h2>
@@ -36,24 +36,24 @@ export interface SwitchProps
36
36
  extends Omit<FormFieldProps, "error" | "errorId">,
37
37
  Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
38
38
  /**
39
- * Switch-label
39
+ * Switch-label.
40
40
  */
41
41
  children: React.ReactNode;
42
42
  /**
43
- * If enabled shows the label and description for screenreaders only
43
+ * If enabled shows the label and description for screenreaders only.
44
44
  */
45
45
  hideLabel?: boolean;
46
46
  /**
47
- * Toggles loading state with loader-component on switch
47
+ * Toggles loading state with loader-component on switch.
48
48
  */
49
49
  loading?: boolean;
50
50
  /**
51
- * Positions switch on left/right side of label
51
+ * Positions switch on left/right side of label.
52
52
  * @default "left"
53
53
  */
54
54
  position?: "left" | "right";
55
55
  /**
56
- * Adds a description to extend labling of Switch
56
+ * Adds a description to extend labling of Switch.
57
57
  */
58
58
  description?: string;
59
59
  }
@@ -17,7 +17,8 @@ export interface TextareaProps
17
17
  React.TextareaHTMLAttributes<HTMLTextAreaElement> {
18
18
  /**
19
19
  * Allowed character-count for content
20
- * @note This is just a visual indicator! You will need to handle actual character-limits/validation if needed
20
+ *
21
+ * This is just a visual indicator! You will still need to handle actual character-limits/validation if needed.
21
22
  */
22
23
  maxLength?: number;
23
24
  /**
@@ -37,15 +38,15 @@ export interface TextareaProps
37
38
  */
38
39
  minRows?: number;
39
40
  /**
40
- * Textarea label
41
+ * Textarea label.
41
42
  */
42
43
  label: React.ReactNode;
43
44
  /**
44
- * If enabled shows the label and description for screenreaders only
45
+ * If enabled shows the label and description for screenreaders only.
45
46
  */
46
47
  hideLabel?: boolean;
47
48
  /**
48
- * Enables resizing of field
49
+ * Enables resizing of field.
49
50
  */
50
51
  resize?: boolean | "vertical" | "horizontal";
51
52
  /**
@@ -5,32 +5,34 @@ import { FieldsetContext } from "./fieldset/context";
5
5
 
6
6
  export interface FormFieldProps {
7
7
  /**
8
- * Error message for element
8
+ * Adds a description to extend labling of the field.
9
+ * Error message for element.
9
10
  */
10
11
  error?: React.ReactNode;
11
12
  /**
12
- * Override internal errorId
13
+ * Override internal errorId.
13
14
  */
14
15
  errorId?: string;
15
16
  /**
16
- * Changes font-size, padding and gaps
17
+ * Changes font-size, padding and gaps.
17
18
  */
18
19
  size?: "medium" | "small";
19
20
  /**
20
- * Disables element
21
- * @note Avoid using if possible for accessibility purposes
21
+ * **Avoid using if possible for accessibility purposes**.
22
+ *
23
+ * Disables element.
22
24
  */
23
25
  disabled?: boolean;
24
26
  /**
25
- * Adds a description to extend labling of a field
27
+ * Adds a description to extend labling of a field.
26
28
  */
27
29
  description?: React.ReactNode;
28
30
  /**
29
- * Override internal id
31
+ * Override internal id.
30
32
  */
31
33
  id?: string;
32
34
  /**
33
- * Read only-state
35
+ * Read-only state.
34
36
  */
35
37
  readOnly?: boolean;
36
38
  }
@@ -9,7 +9,11 @@ export type BleedSpacingBlock = "0" | "px" | SpacingScale;
9
9
 
10
10
  export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
11
11
  /** **Negative** horizontal margin around children.
12
- * Accepts a spacing token or an object of spacing tokens for different breakpoints.
12
+ * Accepts a spacing token or an object of spacing tokens for different breakpoints.
13
+ *
14
+ * The `px` value is useful to nudge by just 1px.
15
+ * The `full` value is used to extend the margin to the full width of the parent.
16
+ *
13
17
  * @example
14
18
  * marginInline='4'
15
19
  * marginInline='4 5'
@@ -20,6 +24,10 @@ export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
20
24
  >;
21
25
  /** **Negative** vertical margin around children.
22
26
  * Accepts a spacing token or an object of spacing tokens for different breakpoints.
27
+ *
28
+ * The `px` value is useful to nudge by just 1px.
29
+ * This prop does **not** accept the `full` value.
30
+ *
23
31
  * @example
24
32
  * marginBlock='4'
25
33
  * marginBlock='4 5'
@@ -13,11 +13,11 @@ import {
13
13
  } from "../utilities/types";
14
14
 
15
15
  export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
16
- /** Background color. Accepts a color token. */
16
+ /** CSS `background-color` property. Accepts a color token. */
17
17
  background?: BackgroundToken;
18
- /** Border color. Accepts a color token. */
18
+ /** CSS `border-color` property. Accepts a color token. */
19
19
  borderColor?: BorderColorToken;
20
- /** Border radius. Accepts a radius token, or an object of radius tokens for different breakpoints.
20
+ /** CSS `border-radius` property. Accepts a radius token, or an object of radius tokens for different breakpoints.
21
21
  * @example
22
22
  * borderRadius='full'
23
23
  * borderRadius='0 full large small'
@@ -25,13 +25,13 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
25
25
  */
26
26
  borderRadius?: ResponsiveProp<SpaceDelimitedAttribute<BorderRadiiToken>>;
27
27
  /**
28
- * Border-width. If this is not set there will be no border.
28
+ * CSS `border-width` property. If this is not set there will be no border.
29
29
  * @example
30
30
  * borderWidth='2'
31
31
  * borderWidth='1 2 3 4'
32
32
  */
33
33
  borderWidth?: SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">;
34
- /** Spacing around children. Accepts a spacing token or an object of spacing tokens for different breakpoints.
34
+ /** Padding around children. Accepts a spacing token or an object of spacing tokens for different breakpoints.
35
35
  * @example
36
36
  * padding='4'
37
37
  * padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
@@ -6,13 +6,11 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
6
6
  export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
7
7
  children: React.ReactNode;
8
8
  /**
9
- * Number of columns to display. Can be a number, a string with a unit or tokens for spesific breakpoints.
9
+ * Number of columns to display. Can be a number, a string with a unit, or tokens for specific breakpoints.
10
10
  * Sets `grid-template-columns`, so `fr`, `minmax` etc. works.
11
11
  * @example
12
12
  * columns={{ sm: 1, md: 1, lg: "1fr auto", xl: "1fr auto"}}
13
- * @example
14
13
  * columns={3}
15
- * @example
16
14
  * columns="repeat(3, minmax(0, 1fr))"
17
15
  */
18
16
  columns?: ResponsiveProp<number | string>;
@@ -12,7 +12,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
12
12
  as?: "div" | "body";
13
13
  /**
14
14
  * Background color. Accepts a color token.
15
- * @default bg-default
15
+ * @default "bg-default"
16
16
  */
17
17
  background?: keyof typeof bgColors.a | "surface-subtle";
18
18
  /**
@@ -25,7 +25,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
25
25
  footerPosition?: "belowFold";
26
26
  /**
27
27
  * Adds a standardised padding of 4rem between content and footer
28
- * @default block-end
28
+ * @default "end"
29
29
  */
30
30
  contentBlockPadding?: "end" | "none";
31
31
  }
@@ -6,13 +6,11 @@ import { BreakpointsAlias } from "../utilities/types";
6
6
  export interface ResponsiveProps extends HTMLAttributes<HTMLDivElement> {
7
7
  children: React.ReactNode;
8
8
  /**
9
- * @example
10
- * above='md'
9
+ * Will show/hide element above breakpoint (inclusive)
11
10
  */
12
11
  above?: Exclude<BreakpointsAlias, "xs">;
13
12
  /**
14
- * @example
15
- * below='md'
13
+ * Will show/hide element below breakpoint (inclusive)
16
14
  */
17
15
  below?: Exclude<BreakpointsAlias, "xs">;
18
16
  /**
@@ -7,7 +7,11 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
7
7
  export interface StackProps extends HTMLAttributes<HTMLDivElement> {
8
8
  children: React.ReactNode;
9
9
  /**
10
- * Justify-content
10
+ * CSS `justify-content` property.
11
+ *
12
+ * @example
13
+ * justify='center'
14
+ * justify={{xs: 'start', sm: 'center', md: 'end', lg: 'space-around', xl: 'space-between'}}
11
15
  */
12
16
  justify?: ResponsiveProp<
13
17
  | "start"
@@ -18,22 +22,32 @@ export interface StackProps extends HTMLAttributes<HTMLDivElement> {
18
22
  | "space-evenly"
19
23
  >;
20
24
  /**
21
- * Align-items
25
+ * CSS `align-items` property.
26
+ *
27
+ * @example
28
+ * align='center'
29
+ * align={{xs: 'start', sm: 'center', md: 'end', lg: 'baseline', xl: 'stretch'}}
22
30
  */
23
31
  align?: ResponsiveProp<"start" | "center" | "end" | "baseline" | "stretch">;
24
32
  /**
25
- * flex-wrap
33
+ * Sets the CSS `flex-wrap` property.
26
34
  */
27
35
  wrap?: boolean;
28
36
  /**
37
+ * CSS `gap` property.
38
+ *
29
39
  * @example
30
40
  * gap='4'
31
41
  * gap={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
32
42
  */
33
43
  gap?: ResponsiveProp<SpacingScale>;
34
44
  /**
35
- * flex-direction
45
+ * CSS `flex-direction` property.
36
46
  * @default "row"
47
+ *
48
+ * @example
49
+ * direction='row'
50
+ * direction={{xs: 'row', sm: 'column'}}
37
51
  */
38
52
  direction?: ResponsiveProp<"row" | "column">;
39
53
  }
package/src/list/types.ts CHANGED
@@ -20,7 +20,7 @@ export interface ListProps extends React.HTMLAttributes<HTMLDivElement> {
20
20
  headingTag?: React.ElementType<any>;
21
21
  /**
22
22
  * Changes padding, height and font-size
23
- * @default medium
23
+ * @default "medium"
24
24
  */
25
25
  size?: "medium" | "small";
26
26
  }
@@ -35,6 +35,7 @@ export interface LoaderProps extends Omit<SVGProps<SVGSVGElement>, "ref"> {
35
35
  /**
36
36
  * Allows getting a ref to the component instance.
37
37
  * Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
38
+ *
38
39
  * @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
39
40
  */
40
41
  ref?: React.Ref<SVGSVGElement>;
@@ -165,7 +165,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
165
165
  const shouldHandleModalClick = closeOnBackdropClick && !needPolyfill;
166
166
 
167
167
  /**
168
- * @note `closeOnBackdropClick` has issues on polyfill when nesting modals (DatePicker)
168
+ * `closeOnBackdropClick` has issues on polyfill when nesting modals (DatePicker)
169
169
  */
170
170
  const handleModalClick = (
171
171
  endEvent: React.MouseEvent<HTMLDialogElement>,
@@ -191,7 +191,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
191
191
  };
192
192
 
193
193
  /**
194
- * @note onCancel fires when you press `Esc`
194
+ * onCancel fires when you press `Esc`
195
195
  */
196
196
  const handleModalCancel = (
197
197
  event: React.SyntheticEvent<HTMLDialogElement, Event>,
@@ -1,25 +1,24 @@
1
1
  interface ModalPropsBase extends React.DialogHTMLAttributes<HTMLDialogElement> {
2
2
  /**
3
- * Content for the header. Alteratively you can use <Modal.Header> instead for more control,
4
- * but then you have to set `aria-label` or `aria-labelledby` on the modal manually.
3
+ * Content for the header. Alteratively you can use `<Modal.Header>` instead for more control, but then you have to set `aria-label` or `aria-labelledby` on the modal manually.
5
4
  */
6
5
  header?: {
7
6
  label?: string;
8
7
  icon?: React.ReactNode;
9
8
  heading: string;
10
9
  /**
11
- * Heading size
10
+ * Heading size.
12
11
  * @default "medium"
13
12
  * */
14
13
  size?: "medium" | "small";
15
14
  /**
16
- * Removes close-button (X) when false
15
+ * Removes close-button (X) when false.
17
16
  * @default true
18
17
  */
19
18
  closeButton?: boolean;
20
19
  };
21
20
  /**
22
- * Modal content
21
+ * Modal content.
23
22
  */
24
23
  children: React.ReactNode;
25
24
  /**
@@ -36,12 +35,13 @@ interface ModalPropsBase extends React.DialogHTMLAttributes<HTMLDialogElement> {
36
35
  * Called when the user tries to close the modal by one of the built-in methods.
37
36
  * Used if you want to ask the user for confirmation before closing.
38
37
  * @warning Will not always be called when pressing Esc. See `onCancel` for more info.
39
- * @returns Whether to close the modal
38
+ * @returns Whether to close the modal or not
40
39
  */
41
40
  onBeforeClose?: () => boolean;
42
41
  /**
43
- * *Sometimes** called when the user presses the Esc key.
44
- * @warning *Some browsers does not always trigger this event. Chrome only triggers it if you have
42
+ * _Sometimes*_ called when the user presses the Esc key.
43
+ *
44
+ * *: Some browsers does not always trigger this event. Chrome only triggers it if you have
45
45
  * interacted with the modal, and will not trigger it a second time if you press Esc twice in a row.
46
46
  */
47
47
  onCancel?: React.ReactEventHandler<HTMLDialogElement>;
@@ -9,8 +9,9 @@ import PaginationItem, {
9
9
 
10
10
  export interface PaginationProps extends React.HTMLAttributes<HTMLElement> {
11
11
  /**
12
- * Current page
13
- * @note Pagination indexing starts at 1
12
+ * Current page.
13
+ *
14
+ * Pagination indexing starts at 1.
14
15
  */
15
16
  page: number;
16
17
  /**
@@ -16,7 +16,7 @@ export interface PaginationItemProps extends ButtonProps {
16
16
  page: number;
17
17
  /**
18
18
  * Changes padding, height and font-size
19
- * @default medium
19
+ * @default "medium"
20
20
  */
21
21
  size?: "medium" | "small" | "xsmall";
22
22
  }
@@ -42,7 +42,8 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
42
42
  onClose: () => void;
43
43
  /**
44
44
  * Default orientation of popover
45
- * @note Try to keep general usage to "top", "bottom", "left", "right"
45
+ *
46
+ * Try to keep general usage to "top", "bottom", "left", "right".
46
47
  * @default "top"
47
48
  */
48
49
  placement?:
@@ -8,20 +8,20 @@ import { useControllableState } from "../util/hooks/useControllableState";
8
8
  export interface ReadMoreProps
9
9
  extends React.ButtonHTMLAttributes<HTMLButtonElement> {
10
10
  /**
11
- * Content inside ReadMore
11
+ * Content inside ReadMore.
12
12
  */
13
13
  children: React.ReactNode;
14
14
  /**
15
- * ReadMore header content
15
+ * ReadMore header content.
16
16
  */
17
17
  header: React.ReactNode;
18
18
  /**
19
- * Opens component if 'true', closes if 'false'
20
- * Using this prop removes automatic control of open-state
19
+ * Opens component if `true`, closes if `false`.
20
+ * Using this prop removes automatic control of open-state.
21
21
  */
22
22
  open?: boolean;
23
23
  /**
24
- * Initially open
24
+ * Initially open.
25
25
  * @default false
26
26
  */
27
27
  defaultOpen?: boolean;
@@ -30,8 +30,8 @@ export interface ReadMoreProps
30
30
  */
31
31
  onOpenChange?: (open: boolean) => void;
32
32
  /**
33
- * Changes fontsize for content
34
- * @default medium
33
+ * Changes fontsize for content.
34
+ * @default "medium"
35
35
  */
36
36
  size?: "medium" | "small";
37
37
  }
@@ -8,21 +8,21 @@ import { StepperContext } from "./context";
8
8
  export interface StepperStepProps
9
9
  extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
10
10
  /**
11
- * Text content by indicator
11
+ * Text content by indicator.
12
12
  */
13
13
  children: string;
14
14
  /**
15
- * Handled by Stepper, overwriting may break component logic
15
+ * Handled by Stepper, overwriting may break component logic.
16
16
  * @private
17
17
  */
18
18
  unsafe_index?: number;
19
19
  /**
20
- * Makes step-indicator a checkmark
20
+ * Makes step-indicator a checkmark.
21
21
  * @default false
22
22
  */
23
23
  completed?: boolean;
24
24
  /**
25
- * Makes step non-interactive if false. Step will be set to a <div>, overriding `as`-prop
25
+ * Makes step non-interactive if false. Step will be set to a `<div>`, overriding `as`-prop.
26
26
  * @default true
27
27
  */
28
28
  interactive?: boolean;