@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.
- package/_docs.json +293 -394
- package/cjs/date/hooks/useDatepicker.js +4 -4
- package/cjs/date/hooks/useMonthPicker.js +4 -4
- package/cjs/date/hooks/useRangeDatepicker.js +5 -5
- package/cjs/date/utils/check-dates.js +1 -1
- package/cjs/date/utils/parse-date.js +58 -13
- package/esm/date/hooks/useDatepicker.js +4 -4
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.js +4 -4
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.js +5 -5
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/utils/check-dates.js +1 -1
- package/esm/date/utils/check-dates.js.map +1 -1
- package/esm/date/utils/parse-date.js +57 -12
- package/esm/date/utils/parse-date.js.map +1 -1
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/loader/Loader.js.map +1 -1
- package/package.json +2 -2
- package/src/date/hooks/useDatepicker.tsx +29 -3
- package/src/date/hooks/useMonthPicker.tsx +29 -3
- package/src/date/hooks/useRangeDatepicker.tsx +29 -4
- package/src/date/utils/__tests__/format-dates.test.ts +11 -1
- package/src/date/utils/__tests__/parse-dates.test.ts +44 -3
- package/src/date/utils/check-dates.ts +1 -1
- package/src/date/utils/parse-date.ts +98 -19
- package/src/guide-panel/Illustration.tsx +6 -2
- package/src/loader/Loader.tsx +6 -1
- package/esm/accordion/Accordion.d.ts +0 -17
- package/esm/accordion/AccordionContent.d.ts +0 -10
- package/esm/accordion/AccordionHeader.d.ts +0 -10
- package/esm/accordion/AccordionItem.d.ts +0 -26
- package/esm/accordion/index.d.ts +0 -1
- package/esm/alert/Alert.d.ts +0 -31
- package/esm/alert/index.d.ts +0 -2
- package/esm/button/Button.d.ts +0 -39
- package/esm/button/index.d.ts +0 -2
- package/esm/chat/Bubble.d.ts +0 -26
- package/esm/chat/Chat.d.ts +0 -43
- package/esm/chat/index.d.ts +0 -1
- package/esm/chips/Chips.d.ts +0 -17
- package/esm/chips/Removable.d.ts +0 -23
- package/esm/chips/Toggle.d.ts +0 -13
- package/esm/chips/index.d.ts +0 -1
- package/esm/date/DateInput.d.ts +0 -25
- package/esm/date/datepicker/DatePicker.d.ts +0 -97
- package/esm/date/datepicker/DatePickerStandalone.d.ts +0 -12
- package/esm/date/datepicker/DayButton.d.ts +0 -3
- package/esm/date/datepicker/Head.d.ts +0 -3
- package/esm/date/datepicker/caption/Caption.d.ts +0 -4
- package/esm/date/datepicker/caption/DropdownCaption.d.ts +0 -4
- package/esm/date/datepicker/caption/index.d.ts +0 -2
- package/esm/date/hooks/index.d.ts +0 -8
- package/esm/date/hooks/useDateInputContext.d.ts +0 -18
- package/esm/date/hooks/useDatepicker.d.ts +0 -66
- package/esm/date/hooks/useMonthPicker.d.ts +0 -61
- package/esm/date/hooks/useRangeDatepicker.d.ts +0 -58
- package/esm/date/hooks/useSharedMonthContext.d.ts +0 -21
- package/esm/date/index.d.ts +0 -6
- package/esm/date/monthpicker/MonthButton.d.ts +0 -11
- package/esm/date/monthpicker/MonthCaption.d.ts +0 -3
- package/esm/date/monthpicker/MonthPicker.d.ts +0 -92
- package/esm/date/monthpicker/MonthPickerStandalone.d.ts +0 -11
- package/esm/date/monthpicker/MonthSelector.d.ts +0 -3
- package/esm/date/utils/check-dates.d.ts +0 -4
- package/esm/date/utils/dates-disabled.d.ts +0 -1
- package/esm/date/utils/format-date.d.ts +0 -1
- package/esm/date/utils/get-dates.d.ts +0 -2
- package/esm/date/utils/get-initial-year.d.ts +0 -5
- package/esm/date/utils/index.d.ts +0 -10
- package/esm/date/utils/is-match.d.ts +0 -4
- package/esm/date/utils/labels.d.ts +0 -6
- package/esm/date/utils/locale.d.ts +0 -2
- package/esm/date/utils/navigation.d.ts +0 -2
- package/esm/date/utils/parse-date.d.ts +0 -3
- package/esm/form/ConfirmationPanel.d.ts +0 -22
- package/esm/form/Fieldset/Fieldset.d.ts +0 -42
- package/esm/form/Fieldset/index.d.ts +0 -1
- package/esm/form/Fieldset/useFieldset.d.ts +0 -14
- package/esm/form/Select.d.ts +0 -26
- package/esm/form/Switch.d.ts +0 -27
- package/esm/form/TextField.d.ts +0 -31
- package/esm/form/Textarea.d.ts +0 -48
- package/esm/form/checkbox/Checkbox.d.ts +0 -36
- package/esm/form/checkbox/CheckboxGroup.d.ts +0 -28
- package/esm/form/checkbox/index.d.ts +0 -2
- package/esm/form/checkbox/useCheckbox.d.ts +0 -21
- package/esm/form/error-summary/ErrorSummary.d.ts +0 -27
- package/esm/form/error-summary/ErrorSummaryItem.d.ts +0 -11
- package/esm/form/error-summary/index.d.ts +0 -2
- package/esm/form/index.d.ts +0 -10
- package/esm/form/radio/Radio.d.ts +0 -18
- package/esm/form/radio/RadioGroup.d.ts +0 -38
- package/esm/form/radio/index.d.ts +0 -2
- package/esm/form/radio/useRadio.d.ts +0 -23
- package/esm/form/search/Search.d.ts +0 -57
- package/esm/form/search/SearchButton.d.ts +0 -11
- package/esm/form/search/index.d.ts +0 -1
- package/esm/form/useFormField.d.ts +0 -44
- package/esm/grid/Cell.d.ts +0 -26
- package/esm/grid/ContentContainer.d.ts +0 -9
- package/esm/grid/Grid.d.ts +0 -9
- package/esm/grid/index.d.ts +0 -3
- package/esm/guide-panel/Guide.d.ts +0 -14
- package/esm/guide-panel/GuidePanel.d.ts +0 -18
- package/esm/guide-panel/Illustration.d.ts +0 -7
- package/esm/guide-panel/index.d.ts +0 -3
- package/esm/help-text/HelpText.d.ts +0 -17
- package/esm/help-text/index.d.ts +0 -2
- package/esm/index.d.ts +0 -27
- package/esm/link/Link.d.ts +0 -10
- package/esm/link/index.d.ts +0 -2
- package/esm/link-panel/LinkPanel.d.ts +0 -22
- package/esm/link-panel/LinkPanelDescription.d.ts +0 -7
- package/esm/link-panel/LinkPanelTitle.d.ts +0 -8
- package/esm/link-panel/index.d.ts +0 -2
- package/esm/loader/Loader.d.ts +0 -26
- package/esm/loader/index.d.ts +0 -2
- package/esm/modal/Modal.d.ts +0 -63
- package/esm/modal/ModalContent.d.ts +0 -10
- package/esm/modal/index.d.ts +0 -2
- package/esm/pagination/Pagination.d.ts +0 -53
- package/esm/pagination/PaginationItem.d.ts +0 -22
- package/esm/pagination/index.d.ts +0 -1
- package/esm/panel/Panel.d.ts +0 -16
- package/esm/panel/index.d.ts +0 -2
- package/esm/popover/Popover.d.ts +0 -47
- package/esm/popover/PopoverContent.d.ts +0 -10
- package/esm/popover/index.d.ts +0 -2
- package/esm/provider/Provider.d.ts +0 -20
- package/esm/provider/index.d.ts +0 -1
- package/esm/read-more/ReadMore.d.ts +0 -28
- package/esm/read-more/index.d.ts +0 -2
- package/esm/stepper/Step.d.ts +0 -28
- package/esm/stepper/Stepper.d.ts +0 -41
- package/esm/stepper/index.d.ts +0 -1
- package/esm/table/Body.d.ts +0 -7
- package/esm/table/ColumnHeader.d.ts +0 -17
- package/esm/table/DataCell.d.ts +0 -12
- package/esm/table/ExpandableRow.d.ts +0 -41
- package/esm/table/Header.d.ts +0 -7
- package/esm/table/HeaderCell.d.ts +0 -13
- package/esm/table/Row.d.ts +0 -17
- package/esm/table/Table.d.ts +0 -49
- package/esm/table/index.d.ts +0 -8
- package/esm/tabs/Tab.d.ts +0 -19
- package/esm/tabs/TabList.d.ts +0 -10
- package/esm/tabs/TabPanel.d.ts +0 -14
- package/esm/tabs/Tabs.d.ts +0 -52
- package/esm/tabs/index.d.ts +0 -4
- package/esm/tag/Tag.d.ts +0 -14
- package/esm/tag/index.d.ts +0 -1
- package/esm/toggle-group/ToggleGroup.d.ts +0 -38
- package/esm/toggle-group/ToggleItem.d.ts +0 -14
- package/esm/toggle-group/index.d.ts +0 -2
- package/esm/tooltip/Tooltip.d.ts +0 -53
- package/esm/tooltip/index.d.ts +0 -1
- package/esm/typography/BodyLong.d.ts +0 -19
- package/esm/typography/BodyShort.d.ts +0 -19
- package/esm/typography/Detail.d.ts +0 -22
- package/esm/typography/ErrorMessage.d.ts +0 -19
- package/esm/typography/Heading.d.ts +0 -24
- package/esm/typography/Ingress.d.ts +0 -14
- package/esm/typography/Label.d.ts +0 -19
- package/esm/typography/index.d.ts +0 -7
- package/esm/util/AnimateHeight.d.ts +0 -10
- package/esm/util/OverridableComponent.d.ts +0 -7
- package/esm/util/TextareaAutoSize.d.ts +0 -14
- package/esm/util/debounce.d.ts +0 -4
- package/esm/util/index.d.ts +0 -13
- package/esm/util/mergeRefs.d.ts +0 -2
- 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,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
|
-
};
|
package/esm/form/Select.d.ts
DELETED
|
@@ -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;
|
package/esm/form/Switch.d.ts
DELETED
|
@@ -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;
|
package/esm/form/TextField.d.ts
DELETED
|
@@ -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;
|
package/esm/form/Textarea.d.ts
DELETED
|
@@ -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,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;
|
package/esm/form/index.d.ts
DELETED
|
@@ -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,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
|
-
};
|
package/esm/grid/Cell.d.ts
DELETED
|
@@ -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;
|
package/esm/grid/Grid.d.ts
DELETED
|
@@ -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;
|