@navikt/ds-react 2.0.18 → 2.1.1-next.1

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 (172) hide show
  1. package/_docs.json +293 -394
  2. package/cjs/date/hooks/useDatepicker.js +4 -4
  3. package/cjs/date/hooks/useMonthPicker.js +4 -4
  4. package/cjs/date/hooks/useRangeDatepicker.js +5 -5
  5. package/cjs/date/utils/check-dates.js +1 -1
  6. package/cjs/date/utils/parse-date.js +58 -13
  7. package/esm/date/hooks/useDatepicker.js +4 -4
  8. package/esm/date/hooks/useDatepicker.js.map +1 -1
  9. package/esm/date/hooks/useMonthPicker.js +4 -4
  10. package/esm/date/hooks/useMonthPicker.js.map +1 -1
  11. package/esm/date/hooks/useRangeDatepicker.js +5 -5
  12. package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
  13. package/esm/date/utils/check-dates.js +1 -1
  14. package/esm/date/utils/check-dates.js.map +1 -1
  15. package/esm/date/utils/parse-date.js +57 -12
  16. package/esm/date/utils/parse-date.js.map +1 -1
  17. package/esm/guide-panel/Illustration.js.map +1 -1
  18. package/esm/loader/Loader.js.map +1 -1
  19. package/package.json +2 -2
  20. package/src/date/hooks/useDatepicker.tsx +29 -3
  21. package/src/date/hooks/useMonthPicker.tsx +29 -3
  22. package/src/date/hooks/useRangeDatepicker.tsx +29 -4
  23. package/src/date/utils/__tests__/format-dates.test.ts +11 -1
  24. package/src/date/utils/__tests__/parse-dates.test.ts +44 -3
  25. package/src/date/utils/check-dates.ts +1 -1
  26. package/src/date/utils/parse-date.ts +98 -19
  27. package/src/guide-panel/Illustration.tsx +6 -2
  28. package/src/loader/Loader.tsx +6 -1
  29. package/esm/accordion/Accordion.d.ts +0 -17
  30. package/esm/accordion/AccordionContent.d.ts +0 -10
  31. package/esm/accordion/AccordionHeader.d.ts +0 -10
  32. package/esm/accordion/AccordionItem.d.ts +0 -26
  33. package/esm/accordion/index.d.ts +0 -1
  34. package/esm/alert/Alert.d.ts +0 -31
  35. package/esm/alert/index.d.ts +0 -2
  36. package/esm/button/Button.d.ts +0 -39
  37. package/esm/button/index.d.ts +0 -2
  38. package/esm/chat/Bubble.d.ts +0 -26
  39. package/esm/chat/Chat.d.ts +0 -43
  40. package/esm/chat/index.d.ts +0 -1
  41. package/esm/chips/Chips.d.ts +0 -17
  42. package/esm/chips/Removable.d.ts +0 -23
  43. package/esm/chips/Toggle.d.ts +0 -13
  44. package/esm/chips/index.d.ts +0 -1
  45. package/esm/date/DateInput.d.ts +0 -25
  46. package/esm/date/datepicker/DatePicker.d.ts +0 -97
  47. package/esm/date/datepicker/DatePickerStandalone.d.ts +0 -12
  48. package/esm/date/datepicker/DayButton.d.ts +0 -3
  49. package/esm/date/datepicker/Head.d.ts +0 -3
  50. package/esm/date/datepicker/caption/Caption.d.ts +0 -4
  51. package/esm/date/datepicker/caption/DropdownCaption.d.ts +0 -4
  52. package/esm/date/datepicker/caption/index.d.ts +0 -2
  53. package/esm/date/hooks/index.d.ts +0 -8
  54. package/esm/date/hooks/useDateInputContext.d.ts +0 -18
  55. package/esm/date/hooks/useDatepicker.d.ts +0 -66
  56. package/esm/date/hooks/useMonthPicker.d.ts +0 -61
  57. package/esm/date/hooks/useRangeDatepicker.d.ts +0 -58
  58. package/esm/date/hooks/useSharedMonthContext.d.ts +0 -21
  59. package/esm/date/index.d.ts +0 -6
  60. package/esm/date/monthpicker/MonthButton.d.ts +0 -11
  61. package/esm/date/monthpicker/MonthCaption.d.ts +0 -3
  62. package/esm/date/monthpicker/MonthPicker.d.ts +0 -92
  63. package/esm/date/monthpicker/MonthPickerStandalone.d.ts +0 -11
  64. package/esm/date/monthpicker/MonthSelector.d.ts +0 -3
  65. package/esm/date/utils/check-dates.d.ts +0 -4
  66. package/esm/date/utils/dates-disabled.d.ts +0 -1
  67. package/esm/date/utils/format-date.d.ts +0 -1
  68. package/esm/date/utils/get-dates.d.ts +0 -2
  69. package/esm/date/utils/get-initial-year.d.ts +0 -5
  70. package/esm/date/utils/index.d.ts +0 -10
  71. package/esm/date/utils/is-match.d.ts +0 -4
  72. package/esm/date/utils/labels.d.ts +0 -6
  73. package/esm/date/utils/locale.d.ts +0 -2
  74. package/esm/date/utils/navigation.d.ts +0 -2
  75. package/esm/date/utils/parse-date.d.ts +0 -3
  76. package/esm/form/ConfirmationPanel.d.ts +0 -22
  77. package/esm/form/Fieldset/Fieldset.d.ts +0 -42
  78. package/esm/form/Fieldset/index.d.ts +0 -1
  79. package/esm/form/Fieldset/useFieldset.d.ts +0 -14
  80. package/esm/form/Select.d.ts +0 -26
  81. package/esm/form/Switch.d.ts +0 -27
  82. package/esm/form/TextField.d.ts +0 -31
  83. package/esm/form/Textarea.d.ts +0 -48
  84. package/esm/form/checkbox/Checkbox.d.ts +0 -36
  85. package/esm/form/checkbox/CheckboxGroup.d.ts +0 -28
  86. package/esm/form/checkbox/index.d.ts +0 -2
  87. package/esm/form/checkbox/useCheckbox.d.ts +0 -21
  88. package/esm/form/error-summary/ErrorSummary.d.ts +0 -27
  89. package/esm/form/error-summary/ErrorSummaryItem.d.ts +0 -11
  90. package/esm/form/error-summary/index.d.ts +0 -2
  91. package/esm/form/index.d.ts +0 -10
  92. package/esm/form/radio/Radio.d.ts +0 -18
  93. package/esm/form/radio/RadioGroup.d.ts +0 -38
  94. package/esm/form/radio/index.d.ts +0 -2
  95. package/esm/form/radio/useRadio.d.ts +0 -23
  96. package/esm/form/search/Search.d.ts +0 -57
  97. package/esm/form/search/SearchButton.d.ts +0 -11
  98. package/esm/form/search/index.d.ts +0 -1
  99. package/esm/form/useFormField.d.ts +0 -44
  100. package/esm/grid/Cell.d.ts +0 -26
  101. package/esm/grid/ContentContainer.d.ts +0 -9
  102. package/esm/grid/Grid.d.ts +0 -9
  103. package/esm/grid/index.d.ts +0 -3
  104. package/esm/guide-panel/Guide.d.ts +0 -14
  105. package/esm/guide-panel/GuidePanel.d.ts +0 -18
  106. package/esm/guide-panel/Illustration.d.ts +0 -7
  107. package/esm/guide-panel/index.d.ts +0 -3
  108. package/esm/help-text/HelpText.d.ts +0 -17
  109. package/esm/help-text/index.d.ts +0 -2
  110. package/esm/index.d.ts +0 -27
  111. package/esm/link/Link.d.ts +0 -10
  112. package/esm/link/index.d.ts +0 -2
  113. package/esm/link-panel/LinkPanel.d.ts +0 -22
  114. package/esm/link-panel/LinkPanelDescription.d.ts +0 -7
  115. package/esm/link-panel/LinkPanelTitle.d.ts +0 -8
  116. package/esm/link-panel/index.d.ts +0 -2
  117. package/esm/loader/Loader.d.ts +0 -26
  118. package/esm/loader/index.d.ts +0 -2
  119. package/esm/modal/Modal.d.ts +0 -63
  120. package/esm/modal/ModalContent.d.ts +0 -10
  121. package/esm/modal/index.d.ts +0 -2
  122. package/esm/pagination/Pagination.d.ts +0 -53
  123. package/esm/pagination/PaginationItem.d.ts +0 -22
  124. package/esm/pagination/index.d.ts +0 -1
  125. package/esm/panel/Panel.d.ts +0 -16
  126. package/esm/panel/index.d.ts +0 -2
  127. package/esm/popover/Popover.d.ts +0 -47
  128. package/esm/popover/PopoverContent.d.ts +0 -10
  129. package/esm/popover/index.d.ts +0 -2
  130. package/esm/provider/Provider.d.ts +0 -20
  131. package/esm/provider/index.d.ts +0 -1
  132. package/esm/read-more/ReadMore.d.ts +0 -28
  133. package/esm/read-more/index.d.ts +0 -2
  134. package/esm/stepper/Step.d.ts +0 -28
  135. package/esm/stepper/Stepper.d.ts +0 -41
  136. package/esm/stepper/index.d.ts +0 -1
  137. package/esm/table/Body.d.ts +0 -7
  138. package/esm/table/ColumnHeader.d.ts +0 -17
  139. package/esm/table/DataCell.d.ts +0 -12
  140. package/esm/table/ExpandableRow.d.ts +0 -41
  141. package/esm/table/Header.d.ts +0 -7
  142. package/esm/table/HeaderCell.d.ts +0 -13
  143. package/esm/table/Row.d.ts +0 -17
  144. package/esm/table/Table.d.ts +0 -49
  145. package/esm/table/index.d.ts +0 -8
  146. package/esm/tabs/Tab.d.ts +0 -19
  147. package/esm/tabs/TabList.d.ts +0 -10
  148. package/esm/tabs/TabPanel.d.ts +0 -14
  149. package/esm/tabs/Tabs.d.ts +0 -52
  150. package/esm/tabs/index.d.ts +0 -4
  151. package/esm/tag/Tag.d.ts +0 -14
  152. package/esm/tag/index.d.ts +0 -1
  153. package/esm/toggle-group/ToggleGroup.d.ts +0 -38
  154. package/esm/toggle-group/ToggleItem.d.ts +0 -14
  155. package/esm/toggle-group/index.d.ts +0 -2
  156. package/esm/tooltip/Tooltip.d.ts +0 -53
  157. package/esm/tooltip/index.d.ts +0 -1
  158. package/esm/typography/BodyLong.d.ts +0 -19
  159. package/esm/typography/BodyShort.d.ts +0 -19
  160. package/esm/typography/Detail.d.ts +0 -22
  161. package/esm/typography/ErrorMessage.d.ts +0 -19
  162. package/esm/typography/Heading.d.ts +0 -24
  163. package/esm/typography/Ingress.d.ts +0 -14
  164. package/esm/typography/Label.d.ts +0 -19
  165. package/esm/typography/index.d.ts +0 -7
  166. package/esm/util/AnimateHeight.d.ts +0 -10
  167. package/esm/util/OverridableComponent.d.ts +0 -7
  168. package/esm/util/TextareaAutoSize.d.ts +0 -14
  169. package/esm/util/debounce.d.ts +0 -4
  170. package/esm/util/index.d.ts +0 -13
  171. package/esm/util/mergeRefs.d.ts +0 -2
  172. package/esm/util/useId.d.ts +0 -7
@@ -1,10 +0,0 @@
1
- export { formatDateForInput } from "./format-date";
2
- export { getMonths, getYears } from "./get-dates";
3
- export { labelMonthDropdown, labelYearDropdown, labels, labelNextYear, labelPrevYear, } from "./labels";
4
- export { INPUT_DATE_STRING_FORMAT_DATE, INPUT_DATE_STRING_FORMAT_MONTH, parseDate, } from "./parse-date";
5
- export { getLocaleFromString } from "./locale";
6
- export { disableDate } from "./dates-disabled";
7
- export { dateIsInCurrentMonth, isValidDate, hasNextYear } from "./check-dates";
8
- export { getInitialYear } from "./get-initial-year";
9
- export { isMatch, isDateInRange, Matcher } from "./is-match";
10
- export { nextEnabled } from "./navigation";
@@ -1,4 +0,0 @@
1
- import { DateAfter, DateBefore, DateRange } from "react-day-picker";
2
- export type Matcher = ((date: Date) => boolean) | Date | Date[] | DateRange | DateBefore | DateAfter;
3
- export declare function isMatch(day: Date, matchers: Matcher[]): boolean;
4
- export declare function isDateInRange(date: Date, range: DateRange): boolean;
@@ -1,6 +0,0 @@
1
- import { Labels } from "react-day-picker";
2
- export declare const labelYearDropdown: (locale: Locale) => "År" | "Year";
3
- export declare const labelMonthDropdown: (locale: Locale) => "Måned" | "Månad" | "Month";
4
- export declare const labelNextYear: (localeCode: string | undefined) => "Gå til neste måned" | "Gå til neste år" | "Go to next year";
5
- export declare const labelPrevYear: (localeCode: string | undefined) => string;
6
- export declare const labels: Partial<Labels>;
@@ -1,2 +0,0 @@
1
- /** @private */
2
- export declare const getLocaleFromString: (locale?: "nb" | "nn" | "en") => Locale;
@@ -1,2 +0,0 @@
1
- import { Matcher } from "./is-match";
2
- export declare const nextEnabled: (months: any, key: string, disabled: Matcher[], currentMonth: Date, setYearState: Function, yearState: Date, dropdownCaption: boolean, fromDate?: Date, toDate?: Date) => Date;
@@ -1,3 +0,0 @@
1
- export declare const INPUT_DATE_STRING_FORMAT_DATE = "dd.MM.yyyy";
2
- export declare const INPUT_DATE_STRING_FORMAT_MONTH = "MMMM yyyy";
3
- export declare const parseDate: (date: string, today: Date, locale: Locale, type: "date" | "month") => Date;
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- import { CheckboxProps } from "..";
3
- export interface ConfirmationPanelProps extends Omit<CheckboxProps, "children" | "indeterminate" | "hideLabel" | "error"> {
4
- /**
5
- * Additional information on panel
6
- */
7
- children?: React.ReactNode;
8
- /**
9
- * Checkbox label
10
- */
11
- label: React.ReactNode;
12
- /**
13
- * Error message for element
14
- */
15
- error?: React.ReactNode;
16
- /**
17
- * Override internal errorId
18
- */
19
- errorId?: string;
20
- }
21
- export declare const ConfirmationPanel: React.ForwardRefExoticComponent<ConfirmationPanelProps & React.RefAttributes<HTMLInputElement>>;
22
- export default ConfirmationPanel;
@@ -1,42 +0,0 @@
1
- import React, { FieldsetHTMLAttributes } from "react";
2
- import { FormFieldProps } from "../useFormField";
3
- export type FieldsetContextProps = {
4
- /**
5
- * Error message applied to element,
6
- */
7
- error?: React.ReactNode;
8
- /**
9
- * Overrides internal errorId
10
- */
11
- errorId: string;
12
- /**
13
- * Changes paddings, margins and font-sizes
14
- */
15
- size: "medium" | "small";
16
- /**
17
- * Sets fieldset and all form-children to disabled
18
- */
19
- disabled: boolean;
20
- };
21
- export declare const FieldsetContext: React.Context<FieldsetContextProps | null>;
22
- export interface FieldsetProps extends FormFieldProps, FieldsetHTMLAttributes<HTMLFieldSetElement> {
23
- /**
24
- * FormFields in Fieldset
25
- */
26
- children: React.ReactNode;
27
- /**
28
- * Fieldset legend
29
- */
30
- legend: React.ReactNode;
31
- /**
32
- * If enabled shows the legend and description for screenreaders only
33
- */
34
- hideLegend?: boolean;
35
- /**
36
- * Toggles error propagation to child-elements
37
- * @default true
38
- */
39
- errorPropagation?: boolean;
40
- }
41
- export declare const Fieldset: React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<HTMLFieldSetElement>>;
42
- export default Fieldset;
@@ -1 +0,0 @@
1
- export { default as Fieldset, FieldsetProps, FieldsetContext, } from "./Fieldset";
@@ -1,14 +0,0 @@
1
- /**
2
- * Handles props for Fieldset in context with parent Fieldset.
3
- */
4
- export declare const useFieldset: (props: any) => {
5
- inputProps: {
6
- "aria-invalid": boolean;
7
- "aria-describedby": string | undefined;
8
- };
9
- showErrorMsg: boolean;
10
- hasError: boolean;
11
- errorId: string;
12
- inputDescriptionId: string;
13
- size: "medium" | "small";
14
- };
@@ -1,26 +0,0 @@
1
- import React, { SelectHTMLAttributes } from "react";
2
- import { FormFieldProps } from "./useFormField";
3
- export interface SelectProps extends FormFieldProps, Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
4
- /**
5
- * Collection of <option />-elements
6
- */
7
- children: React.ReactNode;
8
- /**
9
- * Exposes the HTML size attribute
10
- */
11
- htmlSize?: number;
12
- /**
13
- * Label for select
14
- */
15
- label: React.ReactNode;
16
- /**
17
- * If enabled shows the label and description for screenreaders only
18
- */
19
- hideLabel?: boolean;
20
- /**
21
- * Sets inline-style on select wrapper
22
- */
23
- style?: React.CSSProperties;
24
- }
25
- export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
26
- export default Select;
@@ -1,27 +0,0 @@
1
- import React, { InputHTMLAttributes } from "react";
2
- import { FormFieldProps } from "./useFormField";
3
- export interface SwitchProps extends Omit<FormFieldProps, "error" | "errorId">, Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
4
- /**
5
- * Switch-label
6
- */
7
- children: React.ReactNode;
8
- /**
9
- * If enabled shows the label and description for screenreaders only
10
- */
11
- hideLabel?: boolean;
12
- /**
13
- * Toggles loading state with loader-component on switch
14
- */
15
- loading?: boolean;
16
- /**
17
- * Positions switch on left/right side of label
18
- * @default "left"
19
- */
20
- position?: "left" | "right";
21
- /**
22
- * Adds a description to extend labling of Switch
23
- */
24
- description?: string;
25
- }
26
- export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
27
- export default Switch;
@@ -1,31 +0,0 @@
1
- import React, { InputHTMLAttributes } from "react";
2
- import { FormFieldProps } from "./useFormField";
3
- export interface TextFieldProps extends FormFieldProps, Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
4
- /**
5
- * Controlled value
6
- */
7
- value?: string | number;
8
- /**
9
- * Defaults input-value without needing controlled-state
10
- */
11
- defaultValue?: string | number;
12
- /**
13
- * Exposes the HTML size attribute
14
- */
15
- htmlSize?: number;
16
- /**
17
- * If enabled shows the label and description for screenreaders only
18
- */
19
- hideLabel?: boolean;
20
- /**
21
- * TextField label
22
- */
23
- label: React.ReactNode;
24
- /**
25
- * Type of form control. Picking the correct type helps user fill inn their required information
26
- * @default "text"
27
- */
28
- type?: "email" | "number" | "password" | "tel" | "text" | "url";
29
- }
30
- export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
31
- export default TextField;
@@ -1,48 +0,0 @@
1
- import React from "react";
2
- import { FormFieldProps } from "./useFormField";
3
- /**
4
- * TODO: Mulighet for lokalisering av sr-only/counter text
5
- */
6
- export interface TextareaProps extends FormFieldProps, React.TextareaHTMLAttributes<HTMLTextAreaElement> {
7
- /**
8
- * Allowed character-count for content
9
- * @note This is just a visual validator, you need to set actual character-limits if needed
10
- */
11
- maxLength?: number;
12
- /**
13
- * Controlled value
14
- */
15
- value?: string;
16
- /**
17
- * Defaults input-value without needing controlled-state
18
- */
19
- defaultValue?: string;
20
- /**
21
- * Maximum number of character rows to display.
22
- * @bug Internal scrolling with `maxLength` scrolls over maxLength-text
23
- */
24
- maxRows?: number;
25
- /**
26
- * Minimum number of character-rows to display when empty.
27
- */
28
- minRows?: number;
29
- /**
30
- * Textarea label
31
- */
32
- label: React.ReactNode;
33
- /**
34
- * If enabled shows the label and description for screenreaders only
35
- */
36
- hideLabel?: boolean;
37
- /**
38
- * Enables resizing of field
39
- */
40
- resize?: boolean;
41
- }
42
- export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
43
- export declare const Counter: ({ maxLength, currentLength, size }: {
44
- maxLength: any;
45
- currentLength: any;
46
- size: any;
47
- }) => JSX.Element;
48
- export default Textarea;
@@ -1,36 +0,0 @@
1
- import React, { InputHTMLAttributes } from "react";
2
- import { FormFieldProps } from "../useFormField";
3
- export interface CheckboxProps extends FormFieldProps, Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value"> {
4
- /**
5
- * Adds error indication on checkbox
6
- * @default false
7
- */
8
- error?: boolean;
9
- /**
10
- * Id for error resulting in checkbox having error
11
- */
12
- errorId?: string;
13
- /**
14
- * Checkbox label
15
- */
16
- children: React.ReactNode;
17
- /**
18
- * Hides label and makes it viewable for screen-readers only.
19
- */
20
- hideLabel?: boolean;
21
- /**
22
- * The value of the HTML element.
23
- */
24
- value?: any;
25
- /**
26
- * Specify whether the Checkbox is in an indeterminate state
27
- * @default false
28
- */
29
- indeterminate?: boolean;
30
- /**
31
- * Adds a description to extend labling of Checkbox
32
- */
33
- description?: string;
34
- }
35
- export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
36
- export default Checkbox;
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import { FieldsetProps } from "..";
3
- export interface CheckboxGroupState {
4
- readonly defaultValue?: readonly any[];
5
- readonly value?: readonly any[];
6
- toggleValue(value: any): void;
7
- }
8
- export declare const CheckboxGroupContext: React.Context<CheckboxGroupState | null>;
9
- export interface CheckboxGroupProps extends Omit<FieldsetProps, "onChange" | "errorPropagation" | "defaultValue"> {
10
- /**
11
- * Collection of <Checkbox/>
12
- */
13
- children: React.ReactNode;
14
- /**
15
- * Controlled state for checkboxes.
16
- */
17
- value?: any[];
18
- /**
19
- * Default checked checkboxes on render
20
- */
21
- defaultValue?: any[];
22
- /**
23
- * Returns current checked checkboxes in group
24
- */
25
- onChange?: (value: any[]) => void;
26
- }
27
- export declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
28
- export default CheckboxGroup;
@@ -1,2 +0,0 @@
1
- export { default as Checkbox, CheckboxProps } from "./Checkbox";
2
- export { default as CheckboxGroup, CheckboxGroupProps } from "./CheckboxGroup";
@@ -1,21 +0,0 @@
1
- import { CheckboxProps } from "../..";
2
- /**
3
- * Handles props for Checkboxes in context with Fieldset and CheckboxGroup
4
- */
5
- declare const useCheckbox: ({ children, ...props }: CheckboxProps) => {
6
- inputProps: {
7
- checked: boolean | undefined;
8
- defaultChecked: boolean | undefined;
9
- onChange: (e: any) => void;
10
- id: string;
11
- "aria-invalid": boolean;
12
- "aria-describedby": string | undefined;
13
- disabled: boolean | undefined;
14
- };
15
- showErrorMsg: boolean;
16
- hasError: boolean;
17
- errorId: string;
18
- inputDescriptionId: string;
19
- size: "medium" | "small";
20
- };
21
- export default useCheckbox;
@@ -1,27 +0,0 @@
1
- import React, { HTMLAttributes } from "react";
2
- import { ErrorSummaryItemType } from "./ErrorSummaryItem";
3
- export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
4
- /**
5
- * Collectipn of ErrorSummary.Item
6
- */
7
- children: React.ReactNode;
8
- /**
9
- * Changes padding and font-sizes
10
- * @default "medium"
11
- */
12
- size?: "medium" | "small";
13
- /**
14
- * Heading above links
15
- */
16
- heading?: React.ReactNode;
17
- /**
18
- * Allows setting a different HTML h-tag
19
- * @default "h2"
20
- */
21
- headingTag?: React.ElementType<any>;
22
- }
23
- interface ErrorSummaryComponent extends React.ForwardRefExoticComponent<ErrorSummaryProps & React.RefAttributes<HTMLDivElement>> {
24
- Item: ErrorSummaryItemType;
25
- }
26
- export declare const ErrorSummary: ErrorSummaryComponent;
27
- export default ErrorSummary;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { OverridableComponent } from "../..";
3
- export interface ErrorSummaryItemProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
4
- /**
5
- * Link text
6
- */
7
- children: React.ReactNode;
8
- }
9
- export type ErrorSummaryItemType = OverridableComponent<ErrorSummaryItemProps, HTMLAnchorElement>;
10
- export declare const ErrorSummaryItem: ErrorSummaryItemType;
11
- export default ErrorSummaryItem;
@@ -1,2 +0,0 @@
1
- export { default as ErrorSummary } from "./ErrorSummary";
2
- export { ErrorSummaryProps } from "./ErrorSummary";
@@ -1,10 +0,0 @@
1
- export { Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, } from "./checkbox";
2
- export { ConfirmationPanelProps, default as ConfirmationPanel, } from "./ConfirmationPanel";
3
- export { ErrorSummary, ErrorSummaryProps } from "./error-summary";
4
- export { Fieldset, FieldsetContext, FieldsetProps } from "./Fieldset";
5
- export { Radio, RadioGroup, RadioGroupProps, RadioProps } from "./radio";
6
- export { Search, SearchClearEvent, SearchProps } from "./search";
7
- export { default as Select, SelectProps } from "./Select";
8
- export { default as Switch, SwitchProps } from "./Switch";
9
- export { Counter, default as Textarea, TextareaProps } from "./Textarea";
10
- export { default as TextField, TextFieldProps } from "./TextField";
@@ -1,18 +0,0 @@
1
- import React, { InputHTMLAttributes } from "react";
2
- import { FormFieldProps } from "../useFormField";
3
- export interface RadioProps extends Omit<FormFieldProps, "error" | "errorId">, Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value"> {
4
- /**
5
- * Radio label
6
- */
7
- children: React.ReactNode;
8
- /**
9
- * The value of the HTML element
10
- */
11
- value: any;
12
- /**
13
- * Adds a description to extend labling of Radio
14
- */
15
- description?: string;
16
- }
17
- export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
18
- export default Radio;
@@ -1,38 +0,0 @@
1
- import React from "react";
2
- import { FieldsetProps } from "..";
3
- export interface RadioGroupContextProps {
4
- name: string;
5
- defaultValue?: any;
6
- value?: any;
7
- onChange: (value: any) => void;
8
- required?: boolean;
9
- }
10
- export declare const RadioGroupContext: React.Context<RadioGroupContextProps | null>;
11
- export interface RadioGroupProps extends Omit<FieldsetProps, "onChange" | "errorPropagation" | "defaultValue"> {
12
- /**
13
- * Collection of <Radio />-elements
14
- */
15
- children: React.ReactNode;
16
- /**
17
- * Override internal name
18
- */
19
- name?: string;
20
- /**
21
- * Default checked Radio
22
- */
23
- defaultValue?: any;
24
- /**
25
- * Controlled state for Radio
26
- */
27
- value?: any;
28
- /**
29
- * Returns current checked Radio in group
30
- */
31
- onChange?: (value: any) => void;
32
- /**
33
- * Tells Fieldset if group is required
34
- */
35
- required?: boolean;
36
- }
37
- export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
38
- export default RadioGroup;
@@ -1,2 +0,0 @@
1
- export { default as Radio, RadioProps } from "./Radio";
2
- export { default as RadioGroup, RadioGroupProps } from "./RadioGroup";
@@ -1,23 +0,0 @@
1
- import { RadioProps } from "./Radio";
2
- /**
3
- * Handles props for Radios in context with Fieldset and RadioGroup
4
- */
5
- export declare const useRadio: (props: RadioProps) => {
6
- inputProps: {
7
- name: string | undefined;
8
- defaultChecked: boolean | undefined;
9
- checked: boolean | undefined;
10
- onChange: (e: any) => void;
11
- required: boolean | undefined;
12
- type: string;
13
- id: string;
14
- "aria-invalid": boolean;
15
- "aria-describedby": string | undefined;
16
- disabled: boolean | undefined;
17
- };
18
- showErrorMsg: boolean;
19
- hasError: boolean;
20
- errorId: string;
21
- inputDescriptionId: string;
22
- size: "medium" | "small";
23
- };
@@ -1,57 +0,0 @@
1
- import React, { InputHTMLAttributes } from "react";
2
- import { FormFieldProps } from "../useFormField";
3
- import { SearchButtonType } from "./SearchButton";
4
- export type SearchClearEvent = {
5
- trigger: "Click";
6
- event: React.MouseEvent<HTMLButtonElement, MouseEvent>;
7
- } | {
8
- trigger: "Escape";
9
- event: React.KeyboardEvent<HTMLDivElement>;
10
- };
11
- export interface SearchProps extends FormFieldProps, Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
12
- children?: React.ReactNode;
13
- /**
14
- * Search label
15
- * @note Will be hidden by default, is required for accessibility reasons.
16
- */
17
- label: React.ReactNode;
18
- /**
19
- * Shows label and description for screenreaders-only
20
- * @default true
21
- */
22
- hideLabel?: boolean;
23
- /**
24
- * Callback for value-change in input
25
- */
26
- onChange?: (value: string) => void;
27
- /**
28
- * Callback for click on clear-button or Escape keydown
29
- */
30
- onClear?: (e: SearchClearEvent) => void;
31
- /**
32
- * aria-label on clear button
33
- * @default "Tøm"
34
- */
35
- clearButtonLabel?: string;
36
- /**
37
- * If false, removes clear-button option from input.
38
- * @default true
39
- */
40
- clearButton?: boolean;
41
- /**
42
- * Changes button-variant, "simple" removes button
43
- * @default "primary"
44
- */
45
- variant?: "primary" | "secondary" | "simple";
46
- }
47
- interface SearchComponent extends React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<HTMLDivElement>> {
48
- Button: SearchButtonType;
49
- }
50
- export interface SearchContextProps {
51
- disabled?: boolean;
52
- size: "medium" | "small";
53
- variant: "primary" | "secondary" | "simple";
54
- }
55
- export declare const SearchContext: React.Context<SearchContextProps | null>;
56
- export declare const Search: SearchComponent;
57
- export default Search;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { ButtonProps } from "../..";
3
- export interface SearchButtonProps extends Omit<ButtonProps, "size" | "children" | "variant"> {
4
- /**
5
- * Text set after <Search/> icon
6
- */
7
- children?: React.ReactNode;
8
- }
9
- export type SearchButtonType = React.ForwardRefExoticComponent<SearchButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
- declare const SearchButton: SearchButtonType;
11
- export default SearchButton;
@@ -1 +0,0 @@
1
- export { default as Search, SearchProps, SearchClearEvent } from "./Search";
@@ -1,44 +0,0 @@
1
- import React from "react";
2
- export interface FormFieldProps {
3
- /**
4
- * Error message for element
5
- */
6
- error?: React.ReactNode;
7
- /**
8
- * Override internal errorId
9
- */
10
- errorId?: string;
11
- /**
12
- * Changes font-size, padding and gaps
13
- */
14
- size?: "medium" | "small";
15
- /**
16
- * Disables element
17
- * @note Avoid using if possible for accessibility purposes
18
- */
19
- disabled?: boolean;
20
- /**
21
- * Adds a description to extend labling of a field
22
- */
23
- description?: React.ReactNode;
24
- /**
25
- * Override internal id
26
- */
27
- id?: string;
28
- }
29
- /**
30
- * Handles props and their state for various form-fields in context with Fieldset
31
- */
32
- export declare const useFormField: (props: FormFieldProps, prefix: string) => {
33
- showErrorMsg: boolean;
34
- hasError: boolean;
35
- errorId: string;
36
- inputDescriptionId: string;
37
- size: "medium" | "small";
38
- inputProps: {
39
- id: string;
40
- "aria-invalid": boolean;
41
- "aria-describedby": string | undefined;
42
- disabled: boolean | undefined;
43
- };
44
- };
@@ -1,26 +0,0 @@
1
- import React, { HTMLAttributes } from "react";
2
- type Column = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
3
- export interface CellProps extends HTMLAttributes<HTMLDivElement> {
4
- /**
5
- * Cell content
6
- */
7
- children?: React.ReactNode;
8
- /**
9
- * Cell columns on width < 448px
10
- */
11
- xs: Column;
12
- /**
13
- * Cell columns on min-width: 448
14
- */
15
- sm?: Column;
16
- /**
17
- * Cell columns on min-width: 648
18
- */
19
- md?: Column;
20
- /**
21
- * Cell columns on min-width: 960px
22
- */
23
- lg?: Column;
24
- }
25
- export declare const Cell: React.ForwardRefExoticComponent<CellProps & React.RefAttributes<HTMLDivElement>>;
26
- export default Cell;
@@ -1,9 +0,0 @@
1
- import React, { HTMLAttributes } from "react";
2
- export interface ContentContainerProps extends HTMLAttributes<HTMLDivElement> {
3
- /**
4
- * ContentContainer content
5
- */
6
- children: React.ReactNode;
7
- }
8
- export declare const ContentContainer: React.ForwardRefExoticComponent<ContentContainerProps & React.RefAttributes<HTMLDivElement>>;
9
- export default ContentContainer;
@@ -1,9 +0,0 @@
1
- import React, { HTMLAttributes } from "react";
2
- export interface GridProps extends HTMLAttributes<HTMLDivElement> {
3
- /**
4
- * Collection of <Cell>-elements
5
- */
6
- children: React.ReactNode;
7
- }
8
- export declare const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<HTMLDivElement>>;
9
- export default Grid;