@norges-domstoler/dds-components 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Checkbox/Checkbox.d.ts +6 -2
- package/dist/cjs/components/Checkbox/Checkbox.stories.d.ts +6 -2
- package/dist/cjs/components/Checkbox/Checkbox.types.d.ts +1 -1
- package/dist/cjs/components/TextInput/TextInput.d.ts +1 -0
- package/dist/cjs/components/TextInput/TextInput.stories.d.ts +1 -0
- package/dist/cjs/components/TextInput/TextInput.types.d.ts +2 -0
- package/dist/cjs/components/Typography/Typography.d.ts +1 -0
- package/dist/cjs/components/Typography/Typography.stories.d.ts +5 -0
- package/dist/cjs/components/Typography/Typography.types.d.ts +1 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.d.ts +12 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.d.ts +17 -0
- package/dist/cjs/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/cjs/hooks/useFloatPosition.d.ts +2 -2
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +61 -23
- package/dist/cjs/utils/idGenerator.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +6 -2
- package/dist/components/Checkbox/Checkbox.stories.d.ts +6 -2
- package/dist/components/Checkbox/Checkbox.types.d.ts +1 -1
- package/dist/components/Datepicker/Datepicker.js +4 -2
- package/dist/components/TextInput/TextInput.d.ts +1 -0
- package/dist/components/TextInput/TextInput.js +5 -3
- package/dist/components/TextInput/TextInput.stories.d.ts +1 -0
- package/dist/components/TextInput/TextInput.types.d.ts +2 -0
- package/dist/components/Typography/Typography.d.ts +1 -0
- package/dist/components/Typography/Typography.js +10 -3
- package/dist/components/Typography/Typography.stories.d.ts +5 -0
- package/dist/components/Typography/Typography.types.d.ts +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +12 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +31 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.stories.d.ts +17 -0
- package/dist/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/hooks/useFloatPosition.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/utils/idGenerator.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
3
|
-
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "onChange"> | undefined;
|
|
4
|
-
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "onChange">, "id" | "className"> & {
|
|
3
|
+
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "defaultChecked" | "value" | "defaultValue" | "onChange" | "onBlur"> | undefined;
|
|
4
|
+
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "defaultChecked" | "value" | "defaultValue" | "onChange" | "onBlur">, "id" | "className"> & {
|
|
5
5
|
label?: string | undefined;
|
|
6
6
|
error?: boolean | undefined;
|
|
7
7
|
disabled?: boolean | undefined;
|
|
@@ -11,5 +11,9 @@ export declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
|
11
11
|
'aria-describedby'?: string | undefined;
|
|
12
12
|
name?: string | undefined;
|
|
13
13
|
checked?: boolean | undefined;
|
|
14
|
+
defaultChecked?: boolean | undefined;
|
|
15
|
+
value?: string | number | readonly string[] | undefined;
|
|
16
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
14
17
|
onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
|
|
18
|
+
onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
|
|
15
19
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,17 +3,21 @@ import { CheckboxProps } from '.';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
5
|
component: import("react").ForwardRefExoticComponent<{
|
|
6
|
-
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "onChange" | "name" | "checked"> | undefined;
|
|
7
|
-
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "onChange" | "name" | "checked">, "id" | "className"> & {
|
|
6
|
+
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "defaultValue" | "aria-describedby" | "onBlur" | "onChange" | "name" | "value" | "checked"> | undefined;
|
|
7
|
+
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "defaultValue" | "aria-describedby" | "onBlur" | "onChange" | "name" | "value" | "checked">, "id" | "className"> & {
|
|
8
8
|
label?: string | undefined;
|
|
9
9
|
error?: boolean | undefined;
|
|
10
10
|
disabled?: boolean | undefined;
|
|
11
11
|
readOnly?: boolean | undefined;
|
|
12
12
|
indeterminate?: boolean | undefined;
|
|
13
13
|
} & {
|
|
14
|
+
defaultChecked?: boolean | undefined;
|
|
15
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
14
16
|
'aria-describedby'?: string | undefined;
|
|
17
|
+
onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
|
|
15
18
|
onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
|
|
16
19
|
name?: string | undefined;
|
|
20
|
+
value?: string | number | readonly string[] | undefined;
|
|
17
21
|
checked?: boolean | undefined;
|
|
18
22
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
23
|
argTypes: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { BaseComponentProps } from '../../types';
|
|
3
|
-
declare type PickedHTMLAttributes = Pick<InputHTMLAttributes<HTMLInputElement>, 'aria-describedby' | 'name' | 'checked' | 'onChange'>;
|
|
3
|
+
declare type PickedHTMLAttributes = Pick<InputHTMLAttributes<HTMLInputElement>, 'aria-describedby' | 'name' | 'checked' | 'defaultChecked' | 'value' | 'defaultValue' | 'onChange' | 'onBlur'>;
|
|
4
4
|
export declare type CheckboxProps = BaseComponentProps<HTMLInputElement, {
|
|
5
5
|
/** Ledetekst for inputelementet. */
|
|
6
6
|
label?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
3
3
|
multiline?: boolean | undefined;
|
|
4
|
+
withCharacterCounter?: boolean | undefined;
|
|
4
5
|
} & {
|
|
5
6
|
label?: string | undefined;
|
|
6
7
|
width?: import("csstype").Property.Width<string> | undefined;
|
|
@@ -4,6 +4,7 @@ declare const _default: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
component: import("react").ForwardRefExoticComponent<{
|
|
6
6
|
multiline?: boolean | undefined;
|
|
7
|
+
withCharacterCounter?: boolean | undefined;
|
|
7
8
|
} & {
|
|
8
9
|
label?: string | undefined;
|
|
9
10
|
width?: import("csstype").Property.Width<string> | undefined;
|
|
@@ -3,4 +3,6 @@ import { InputProps } from '../../helpers';
|
|
|
3
3
|
export declare type TextInputProps = {
|
|
4
4
|
/**Gjør inputfeltet om til `<textarea>`. */
|
|
5
5
|
multiline?: boolean;
|
|
6
|
+
/** Spesifiserer om tegntelleren skal vises. */
|
|
7
|
+
withCharacterCounter?: boolean;
|
|
6
8
|
} & InputProps & InputHTMLAttributes<HTMLTextAreaElement>;
|
|
@@ -2,6 +2,7 @@ import { ElementType, PropsWithChildren, HTMLAttributes, AnchorHTMLAttributes }
|
|
|
2
2
|
import { CSSObject } from 'styled-components';
|
|
3
3
|
import { TextColor, OtherTypographyType, AnchorTypographyType, LabelTypographyType } from './Typography.types';
|
|
4
4
|
import { BaseComponentProps } from '../../types';
|
|
5
|
+
export declare const inlineElements: ElementType[];
|
|
5
6
|
export declare function isTextColor(color: string): color is TextColor;
|
|
6
7
|
export declare const getTextColor: (color: TextColor | string) => string;
|
|
7
8
|
export declare type TypographyInteractionProps = {
|
|
@@ -9,4 +9,5 @@ export declare type LabelTypographyType = 'supportingStyleLabel01';
|
|
|
9
9
|
export declare type OtherTypographyType = TypographyHeadingType | TypographyBodyType | TypographyLeadType | TypographySupportingType;
|
|
10
10
|
export declare type TypographyType = AnchorTypographyType | LabelTypographyType | OtherTypographyType;
|
|
11
11
|
export declare type TextColor = 'interactive' | 'primary' | 'danger' | 'warning' | 'success' | 'onLight' | 'onDark' | 'gray1' | 'gray2' | 'gray3' | 'gray4' | 'gray5' | 'gray6' | 'gray7' | 'gray8' | 'gray9';
|
|
12
|
+
export declare type InlineElement = 'a' | 'abbr' | 'audio' | 'b' | 'bdi' | 'bdo' | 'big' | 'br' | 'button' | 'canvas' | 'cite' | 'code' | 'data' | 'datalist' | 'del' | 'dfn' | 'em' | 'embed' | 'i' | 'iframe' | 'img' | 'input' | 'ins' | 'kbd' | 'label' | 'map' | 'mark' | 'meter' | 'noscript' | 'object' | 'output' | 'picture' | 'progress' | 'q' | 'ruby' | 's' | 'samp' | 'script' | 'select' | 'slot' | 'small' | 'span' | 'strong' | 'sub' | 'sup' | 'svg' | 'template' | 'textarea' | 'time' | 'u' | 'var' | 'video' | 'wbr';
|
|
12
13
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseComponentPropsWithChildren } from '../../types';
|
|
3
|
+
declare type VisuallyHiddenDivProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
4
|
+
as: 'div';
|
|
5
|
+
}>;
|
|
6
|
+
declare type VisuallyHiddenSpanProps = BaseComponentPropsWithChildren<HTMLSpanElement, {
|
|
7
|
+
/**Spesifiserer hvilken HTML tag skal returneres. */
|
|
8
|
+
as: 'span';
|
|
9
|
+
}>;
|
|
10
|
+
export declare type VisuallyHiddenProps = VisuallyHiddenSpanProps | VisuallyHiddenDivProps;
|
|
11
|
+
export declare const VisuallyHidden: (props: VisuallyHiddenProps) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { VisuallyHiddenProps } from '.';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: (props: VisuallyHiddenProps) => JSX.Element;
|
|
6
|
+
argTypes: {
|
|
7
|
+
as: {
|
|
8
|
+
control: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
15
|
+
export declare const Default: (args: VisuallyHiddenProps) => JSX.Element;
|
|
16
|
+
export declare const Link: () => JSX.Element;
|
|
17
|
+
export declare const TableButtons: () => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VisuallyHidden';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { Strategy } from '@floating-ui/react-dom';
|
|
3
3
|
export declare type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end';
|
|
4
4
|
export declare const useFloatPosition: (arrowRef: HTMLElement | null, placement?: Placement, offset?: number) => {
|
|
5
|
-
reference: (node:
|
|
5
|
+
reference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
|
|
6
6
|
floating: (node: HTMLElement | null) => void;
|
|
7
7
|
refs: {
|
|
8
|
-
reference: import("react").MutableRefObject<
|
|
8
|
+
reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
|
|
9
9
|
floating: import("react").MutableRefObject<HTMLElement | null>;
|
|
10
10
|
};
|
|
11
11
|
styles: {
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -912,6 +912,12 @@ var getElementType = function getElementType(element) {
|
|
|
912
912
|
}
|
|
913
913
|
};
|
|
914
914
|
|
|
915
|
+
var inlineElements = ['a', 'abbr', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button', 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress', 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'sub', 'sup', 'svg', 'template', 'textarea', 'time', 'u', 'var', 'video', 'wbr'];
|
|
916
|
+
|
|
917
|
+
var isInlineElement = function isInlineElement(as) {
|
|
918
|
+
return inlineElements.indexOf(as) !== -1;
|
|
919
|
+
};
|
|
920
|
+
|
|
915
921
|
function isTextColor(color) {
|
|
916
922
|
return textColorsArray.indexOf(color) !== -1;
|
|
917
923
|
}
|
|
@@ -946,8 +952,9 @@ var StyledTypography = styled__default["default"].p.withConfig({
|
|
|
946
952
|
return interactionProps && interactionProps.active && styled.css(["&:active{", "}"], interactionProps.active);
|
|
947
953
|
}, function (_ref5) {
|
|
948
954
|
var withMargins = _ref5.withMargins,
|
|
949
|
-
typographyType = _ref5.typographyType
|
|
950
|
-
|
|
955
|
+
typographyType = _ref5.typographyType,
|
|
956
|
+
as = _ref5.as;
|
|
957
|
+
return withMargins && typographyType && isInlineElement(as) ? styled.css(["", " display:block;"], typographyTokens.typographyType[typographyType].margins.base) : withMargins && typographyType ? styled.css(["", ""], typographyTokens.typographyType[typographyType].margins.base) : styled.css(["margin:0;"]);
|
|
951
958
|
}, function (_ref6) {
|
|
952
959
|
var color = _ref6.color;
|
|
953
960
|
return color && styled.css(["color:", ";"], getTextColor(color));
|
|
@@ -2721,7 +2728,7 @@ var charCounterTokens = {
|
|
|
2721
2728
|
base: charCounterBase
|
|
2722
2729
|
};
|
|
2723
2730
|
|
|
2724
|
-
var Wrapper$
|
|
2731
|
+
var Wrapper$8 = styled__default["default"](Typography).withConfig({
|
|
2725
2732
|
displayName: "CharCounter__Wrapper",
|
|
2726
2733
|
componentId: "sc-qty1z2-0"
|
|
2727
2734
|
})(["margin-left:auto;", ""], charCounterTokens.base);
|
|
@@ -2739,7 +2746,7 @@ function CharCounter(props) {
|
|
|
2739
2746
|
_useState2 = _slicedToArray(_useState, 1),
|
|
2740
2747
|
uniqueId = _useState2[0];
|
|
2741
2748
|
|
|
2742
|
-
return jsxRuntime.jsxs(Wrapper$
|
|
2749
|
+
return jsxRuntime.jsxs(Wrapper$8, Object.assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest), {
|
|
2743
2750
|
forwardedAs: "div",
|
|
2744
2751
|
typographyType: "supportingStyleHelperText01",
|
|
2745
2752
|
"aria-label": "".concat(current, " av ").concat(max, " tegn skrevet")
|
|
@@ -2791,10 +2798,12 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
2791
2798
|
width = _a$width === void 0 ? textInputTokens.wrapper.defaultWidth : _a$width,
|
|
2792
2799
|
_a$type = _a.type,
|
|
2793
2800
|
type = _a$type === void 0 ? 'text' : _a$type,
|
|
2801
|
+
_a$withCharacterCount = _a.withCharacterCounter,
|
|
2802
|
+
withCharacterCounter = _a$withCharacterCount === void 0 ? true : _a$withCharacterCount,
|
|
2794
2803
|
className = _a.className,
|
|
2795
2804
|
style = _a.style,
|
|
2796
2805
|
ariaDescribedby = _a['aria-describedby'],
|
|
2797
|
-
rest = tslib.__rest(_a, ["label", "disabled", "readOnly", "errorMessage", "tip", "required", "maxLength", "multiline", "onChange", "id", "width", "type", "className", "style", 'aria-describedby']);
|
|
2806
|
+
rest = tslib.__rest(_a, ["label", "disabled", "readOnly", "errorMessage", "tip", "required", "maxLength", "multiline", "onChange", "id", "width", "type", "withCharacterCounter", "className", "style", 'aria-describedby']);
|
|
2798
2807
|
|
|
2799
2808
|
var textAreaRef = React.useRef(null);
|
|
2800
2809
|
|
|
@@ -2834,7 +2843,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
2834
2843
|
var hasLabel = !!label;
|
|
2835
2844
|
var labelPresence = hasLabel ? 'hasLabel' : 'noLabel';
|
|
2836
2845
|
var hasMessage = hasErrorMessage || hasTip || !!maxLength;
|
|
2837
|
-
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter', maxLength);
|
|
2846
|
+
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter', maxLength && withCharacterCounter);
|
|
2838
2847
|
var tipId = derivativeIdGenerator(uniqueId, 'tip', tip);
|
|
2839
2848
|
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage', errorMessage);
|
|
2840
2849
|
var generalInputProps = Object.assign({
|
|
@@ -2890,7 +2899,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
2890
2899
|
message: tip,
|
|
2891
2900
|
messageType: "tip",
|
|
2892
2901
|
id: tipId
|
|
2893
|
-
}), maxLength && Number.isInteger(maxLength) && maxLength > 0 && jsxRuntime.jsx(CharCounter, {
|
|
2902
|
+
}), maxLength && Number.isInteger(maxLength) && maxLength > 0 && withCharacterCounter && jsxRuntime.jsx(CharCounter, {
|
|
2894
2903
|
id: characterCounterId,
|
|
2895
2904
|
current: text.length,
|
|
2896
2905
|
max: maxLength
|
|
@@ -3228,7 +3237,7 @@ var Container$f = styled__default["default"].div.withConfig({
|
|
|
3228
3237
|
var readOnly = _ref5.readOnly;
|
|
3229
3238
|
return readOnly && styled.css(["", " &:hover{box-shadow:none;", " ", "{", "}}.", "__dropdown-indicator,&:hover .", "__dropdown-indicator{", "}"], selectTokens.container.readOnly.base, selectTokens.container.readOnly.base, Label, selectTokens.label.base, prefix, prefix, selectTokens.dropdownIndicator.readOnly.base);
|
|
3230
3239
|
});
|
|
3231
|
-
var Wrapper$
|
|
3240
|
+
var Wrapper$7 = styled__default["default"].div.withConfig({
|
|
3232
3241
|
displayName: "Selectstyles__Wrapper",
|
|
3233
3242
|
componentId: "sc-19jkd5s-2"
|
|
3234
3243
|
})(["margin:0;width:", ";"], function (_ref6) {
|
|
@@ -3460,7 +3469,7 @@ var SelectInner = function SelectInner(_a, ref) {
|
|
|
3460
3469
|
},
|
|
3461
3470
|
'aria-invalid': hasErrorMessage ? true : undefined
|
|
3462
3471
|
}, rest);
|
|
3463
|
-
return jsxRuntime.jsxs(Wrapper$
|
|
3472
|
+
return jsxRuntime.jsxs(Wrapper$7, Object.assign({}, wrapperProps, {
|
|
3464
3473
|
children: [jsxRuntime.jsxs(Container$f, Object.assign({}, containerProps, {
|
|
3465
3474
|
children: [label && jsxRuntime.jsxs(Label, Object.assign({
|
|
3466
3475
|
htmlFor: uniqueId,
|
|
@@ -4358,7 +4367,7 @@ var Foot = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
4358
4367
|
}));
|
|
4359
4368
|
});
|
|
4360
4369
|
|
|
4361
|
-
var Wrapper$
|
|
4370
|
+
var Wrapper$6 = styled__default["default"].div.withConfig({
|
|
4362
4371
|
displayName: "TableWrapper__Wrapper",
|
|
4363
4372
|
componentId: "sc-eb384b-0"
|
|
4364
4373
|
})(["", " ", ""], function (_ref) {
|
|
@@ -4406,7 +4415,7 @@ var TableWrapper = function TableWrapper(_a) {
|
|
|
4406
4415
|
ref: wrapperRef,
|
|
4407
4416
|
overflowX: overflowX
|
|
4408
4417
|
}, rest);
|
|
4409
|
-
return jsxRuntime.jsx(Wrapper$
|
|
4418
|
+
return jsxRuntime.jsx(Wrapper$6, Object.assign({}, wrapperProps, {
|
|
4410
4419
|
children: children
|
|
4411
4420
|
}));
|
|
4412
4421
|
};
|
|
@@ -5182,7 +5191,7 @@ var Card = function Card(props) {
|
|
|
5182
5191
|
}));
|
|
5183
5192
|
};
|
|
5184
5193
|
|
|
5185
|
-
var Wrapper$
|
|
5194
|
+
var Wrapper$5 = styled__default["default"].div.withConfig({
|
|
5186
5195
|
displayName: "CardAccordion__Wrapper",
|
|
5187
5196
|
componentId: "sc-1ctxrby-0"
|
|
5188
5197
|
})([""]);
|
|
@@ -5232,7 +5241,7 @@ var CardAccordion = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
5232
5241
|
var wrapperProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
5233
5242
|
ref: ref
|
|
5234
5243
|
});
|
|
5235
|
-
return jsxRuntime.jsx(Wrapper$
|
|
5244
|
+
return jsxRuntime.jsx(Wrapper$5, Object.assign({}, wrapperProps, {
|
|
5236
5245
|
children: Children
|
|
5237
5246
|
}));
|
|
5238
5247
|
});
|
|
@@ -6098,7 +6107,7 @@ var OverflowMenuGroup = function OverflowMenuGroup(_ref) {
|
|
|
6098
6107
|
});
|
|
6099
6108
|
};
|
|
6100
6109
|
|
|
6101
|
-
var Wrapper$
|
|
6110
|
+
var Wrapper$4 = styled__default["default"].div.withConfig({
|
|
6102
6111
|
displayName: "InternalHeaderstyles__Wrapper",
|
|
6103
6112
|
componentId: "sc-91bnca-0"
|
|
6104
6113
|
})(["position:relative;*::selection{", "}", ""], typographyTokens.selection.base, internalHeaderTokens.wrapper.base);
|
|
@@ -6244,7 +6253,7 @@ var InternalHeader = function InternalHeader(props) {
|
|
|
6244
6253
|
})
|
|
6245
6254
|
})) : null;
|
|
6246
6255
|
var hasContextMenu = hasContextMenuElements || !!userProps || hasNavInContextMenu;
|
|
6247
|
-
return jsxRuntime.jsxs(Wrapper$
|
|
6256
|
+
return jsxRuntime.jsxs(Wrapper$4, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
6248
6257
|
children: [jsxRuntime.jsx(BannerWrapper, Object.assign({
|
|
6249
6258
|
hasContextMenu: hasContextMenu
|
|
6250
6259
|
}, {
|
|
@@ -6335,8 +6344,9 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
6335
6344
|
tip = _a.tip,
|
|
6336
6345
|
style = _a.style,
|
|
6337
6346
|
className = _a.className,
|
|
6347
|
+
max = _a.max,
|
|
6338
6348
|
ariaDescribedby = _a['aria-describedby'],
|
|
6339
|
-
rest = tslib.__rest(_a, ["id", "type", "required", "readOnly", "disabled", "label", "width", "errorMessage", "tip", "style", "className", 'aria-describedby']);
|
|
6349
|
+
rest = tslib.__rest(_a, ["id", "type", "required", "readOnly", "disabled", "label", "width", "errorMessage", "tip", "style", "className", "max", 'aria-describedby']);
|
|
6340
6350
|
|
|
6341
6351
|
var _useState = React.useState(id !== null && id !== void 0 ? id : "datepickerInput-".concat(nextUniqueId$8++)),
|
|
6342
6352
|
_useState2 = _slicedToArray(_useState, 1),
|
|
@@ -6359,7 +6369,8 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
6359
6369
|
disabled: disabled,
|
|
6360
6370
|
type: type,
|
|
6361
6371
|
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
|
|
6362
|
-
'aria-invalid': hasErrorMessage ? true : undefined
|
|
6372
|
+
'aria-invalid': hasErrorMessage ? true : undefined,
|
|
6373
|
+
max: max || '9999-12-31'
|
|
6363
6374
|
}, rest);
|
|
6364
6375
|
var outerInputContainerProps = {
|
|
6365
6376
|
width: componentWidth,
|
|
@@ -6426,7 +6437,7 @@ var skipToContentTokens = {
|
|
|
6426
6437
|
}
|
|
6427
6438
|
};
|
|
6428
6439
|
|
|
6429
|
-
var Wrapper$
|
|
6440
|
+
var Wrapper$3 = styled__default["default"].div.withConfig({
|
|
6430
6441
|
displayName: "SkipToContent__Wrapper",
|
|
6431
6442
|
componentId: "sc-57o1qv-0"
|
|
6432
6443
|
})(["box-sizing:border-box;position:absolute;top:", ";text-align:center;opacity:0;@media (prefers-reduced-motion:no-preference){transition:opacity 0.2s;}overflow:hidden;clip:rect(1px,1px,1px,1px);height:1px;width:1px;white-space:nowrap;", " &:focus-within{clip:auto;height:auto;overflow:auto;width:100%;z-index:200;opacity:1;}"], function (_ref) {
|
|
@@ -6457,7 +6468,7 @@ var SkipToContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
6457
6468
|
className: joinClassNames(className, htmlPropsClassName),
|
|
6458
6469
|
style: style
|
|
6459
6470
|
};
|
|
6460
|
-
return jsxRuntime.jsx(Wrapper$
|
|
6471
|
+
return jsxRuntime.jsx(Wrapper$3, Object.assign({}, wrapperProps, {
|
|
6461
6472
|
children: jsxRuntime.jsx(Link, Object.assign({}, getBaseHTMLProps(id, restHtmlProps, rest), {
|
|
6462
6473
|
ref: ref
|
|
6463
6474
|
}, {
|
|
@@ -7024,7 +7035,7 @@ var popoverTokens = {
|
|
|
7024
7035
|
};
|
|
7025
7036
|
|
|
7026
7037
|
var Spacing$2 = ddsDesignTokens.ddsBaseTokens.spacing;
|
|
7027
|
-
var Wrapper$
|
|
7038
|
+
var Wrapper$2 = styled__default["default"].div.withConfig({
|
|
7028
7039
|
displayName: "Popover__Wrapper",
|
|
7029
7040
|
componentId: "sc-1fecd7e-0"
|
|
7030
7041
|
})(["", " box-sizing:border-box;position:absolute;width:fit-content;z-index:20;", " ", ""], function (_ref) {
|
|
@@ -7088,7 +7099,7 @@ var Popover = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
7088
7099
|
style: Object.assign(Object.assign({}, htmlProps.style), styles.floating),
|
|
7089
7100
|
role: 'dialog'
|
|
7090
7101
|
});
|
|
7091
|
-
return jsxRuntime.jsxs(Wrapper$
|
|
7102
|
+
return jsxRuntime.jsxs(Wrapper$2, Object.assign({}, wrapperProps, {
|
|
7092
7103
|
children: [title && jsxRuntime.jsx(TitleContainer, {
|
|
7093
7104
|
children: typeof title === 'string' ? jsxRuntime.jsx(Typography, Object.assign({
|
|
7094
7105
|
typographyType: "headingSans02"
|
|
@@ -7769,7 +7780,7 @@ var tagTokens = {
|
|
|
7769
7780
|
}
|
|
7770
7781
|
};
|
|
7771
7782
|
|
|
7772
|
-
var Wrapper = styled__default["default"](Typography).withConfig({
|
|
7783
|
+
var Wrapper$1 = styled__default["default"](Typography).withConfig({
|
|
7773
7784
|
displayName: "Tag__Wrapper",
|
|
7774
7785
|
componentId: "sc-rdxtch-0"
|
|
7775
7786
|
})(["", " ", ""], tagTokens.wrapper.base, function (_ref) {
|
|
@@ -7789,7 +7800,7 @@ var Tag = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
7789
7800
|
htmlProps = props.htmlProps,
|
|
7790
7801
|
rest = tslib.__rest(props, ["text", "purpose", "id", "className", "htmlProps"]);
|
|
7791
7802
|
|
|
7792
|
-
return jsxRuntime.jsx(Wrapper, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
7803
|
+
return jsxRuntime.jsx(Wrapper$1, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
7793
7804
|
forwardedAs: "span",
|
|
7794
7805
|
typographyType: "bodySans01",
|
|
7795
7806
|
ref: ref,
|
|
@@ -7910,6 +7921,31 @@ var ChipGroup = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
7910
7921
|
}));
|
|
7911
7922
|
});
|
|
7912
7923
|
|
|
7924
|
+
var Wrapper = styled__default["default"].span.withConfig({
|
|
7925
|
+
displayName: "VisuallyHidden__Wrapper",
|
|
7926
|
+
componentId: "sc-ciubxt-0"
|
|
7927
|
+
})(["width:1px;height:1px;margin:0px;padding:0px;top:0px;inset-inline-start:0px;overflow:hidden;clip:rect(0px,0px,0px,0px);border:0px;"]);
|
|
7928
|
+
var VisuallyHidden = function VisuallyHidden(props) {
|
|
7929
|
+
var children = props.children,
|
|
7930
|
+
id = props.id,
|
|
7931
|
+
className = props.className,
|
|
7932
|
+
htmlProps = props.htmlProps,
|
|
7933
|
+
as = props.as,
|
|
7934
|
+
rest = tslib.__rest(props, ["children", "id", "className", "htmlProps", "as"]);
|
|
7935
|
+
|
|
7936
|
+
if (as === 'div') {
|
|
7937
|
+
return jsxRuntime.jsx(Wrapper, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
7938
|
+
as: as
|
|
7939
|
+
}, {
|
|
7940
|
+
children: children
|
|
7941
|
+
}));
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7944
|
+
return jsxRuntime.jsx(Wrapper, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
7945
|
+
children: children
|
|
7946
|
+
}));
|
|
7947
|
+
};
|
|
7948
|
+
|
|
7913
7949
|
exports.Body = Body$1;
|
|
7914
7950
|
exports.Breadcrumb = Breadcrumb;
|
|
7915
7951
|
exports.Breadcrumbs = Breadcrumbs;
|
|
@@ -7971,7 +8007,9 @@ exports.ToggleButton = ToggleButton;
|
|
|
7971
8007
|
exports.ToggleButtonGroup = ToggleButtonGroup;
|
|
7972
8008
|
exports.Tooltip = Tooltip;
|
|
7973
8009
|
exports.Typography = Typography;
|
|
8010
|
+
exports.VisuallyHidden = VisuallyHidden;
|
|
7974
8011
|
exports.createSelectOptions = createSelectOptions;
|
|
7975
8012
|
exports.getTextColor = getTextColor;
|
|
8013
|
+
exports.inlineElements = inlineElements;
|
|
7976
8014
|
exports.isTextColor = isTextColor;
|
|
7977
8015
|
exports.searchFilter = searchFilter;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const derivativeIdGenerator: (prefix: string, suffix: string, value?: string | number) => string | undefined;
|
|
1
|
+
export declare const derivativeIdGenerator: (prefix: string, suffix: string, value?: string | number | boolean) => string | undefined;
|
|
2
2
|
export declare const idArrayGenerator: (values: (string | undefined)[]) => string[] | undefined;
|
|
3
3
|
export declare const spaceSeparatedIdListGenerator: (values: (string | undefined)[]) => string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
3
|
-
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "onChange"> | undefined;
|
|
4
|
-
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "onChange">, "id" | "className"> & {
|
|
3
|
+
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "defaultChecked" | "value" | "defaultValue" | "onChange" | "onBlur"> | undefined;
|
|
4
|
+
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "defaultChecked" | "value" | "defaultValue" | "onChange" | "onBlur">, "id" | "className"> & {
|
|
5
5
|
label?: string | undefined;
|
|
6
6
|
error?: boolean | undefined;
|
|
7
7
|
disabled?: boolean | undefined;
|
|
@@ -11,5 +11,9 @@ export declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
|
11
11
|
'aria-describedby'?: string | undefined;
|
|
12
12
|
name?: string | undefined;
|
|
13
13
|
checked?: boolean | undefined;
|
|
14
|
+
defaultChecked?: boolean | undefined;
|
|
15
|
+
value?: string | number | readonly string[] | undefined;
|
|
16
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
14
17
|
onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
|
|
18
|
+
onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
|
|
15
19
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,17 +3,21 @@ import { CheckboxProps } from '.';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
5
|
component: import("react").ForwardRefExoticComponent<{
|
|
6
|
-
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "onChange" | "name" | "checked"> | undefined;
|
|
7
|
-
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "onChange" | "name" | "checked">, "id" | "className"> & {
|
|
6
|
+
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "defaultValue" | "aria-describedby" | "onBlur" | "onChange" | "name" | "value" | "checked"> | undefined;
|
|
7
|
+
} & Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "defaultValue" | "aria-describedby" | "onBlur" | "onChange" | "name" | "value" | "checked">, "id" | "className"> & {
|
|
8
8
|
label?: string | undefined;
|
|
9
9
|
error?: boolean | undefined;
|
|
10
10
|
disabled?: boolean | undefined;
|
|
11
11
|
readOnly?: boolean | undefined;
|
|
12
12
|
indeterminate?: boolean | undefined;
|
|
13
13
|
} & {
|
|
14
|
+
defaultChecked?: boolean | undefined;
|
|
15
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
14
16
|
'aria-describedby'?: string | undefined;
|
|
17
|
+
onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
|
|
15
18
|
onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
|
|
16
19
|
name?: string | undefined;
|
|
20
|
+
value?: string | number | readonly string[] | undefined;
|
|
17
21
|
checked?: boolean | undefined;
|
|
18
22
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
23
|
argTypes: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { BaseComponentProps } from '../../types';
|
|
3
|
-
declare type PickedHTMLAttributes = Pick<InputHTMLAttributes<HTMLInputElement>, 'aria-describedby' | 'name' | 'checked' | 'onChange'>;
|
|
3
|
+
declare type PickedHTMLAttributes = Pick<InputHTMLAttributes<HTMLInputElement>, 'aria-describedby' | 'name' | 'checked' | 'defaultChecked' | 'value' | 'defaultValue' | 'onChange' | 'onBlur'>;
|
|
4
4
|
export declare type CheckboxProps = BaseComponentProps<HTMLInputElement, {
|
|
5
5
|
/** Ledetekst for inputelementet. */
|
|
6
6
|
label?: string;
|
|
@@ -33,8 +33,9 @@ var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
33
33
|
tip = _a.tip,
|
|
34
34
|
style = _a.style,
|
|
35
35
|
className = _a.className,
|
|
36
|
+
max = _a.max,
|
|
36
37
|
ariaDescribedby = _a['aria-describedby'],
|
|
37
|
-
rest = __rest(_a, ["id", "type", "required", "readOnly", "disabled", "label", "width", "errorMessage", "tip", "style", "className", 'aria-describedby']);
|
|
38
|
+
rest = __rest(_a, ["id", "type", "required", "readOnly", "disabled", "label", "width", "errorMessage", "tip", "style", "className", "max", 'aria-describedby']);
|
|
38
39
|
|
|
39
40
|
var _useState = useState(id !== null && id !== void 0 ? id : "datepickerInput-".concat(nextUniqueId++)),
|
|
40
41
|
_useState2 = _slicedToArray(_useState, 1),
|
|
@@ -57,7 +58,8 @@ var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
57
58
|
disabled: disabled,
|
|
58
59
|
type: type,
|
|
59
60
|
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
|
|
60
|
-
'aria-invalid': hasErrorMessage ? true : undefined
|
|
61
|
+
'aria-invalid': hasErrorMessage ? true : undefined,
|
|
62
|
+
max: max || '9999-12-31'
|
|
61
63
|
}, rest);
|
|
62
64
|
var outerInputContainerProps = {
|
|
63
65
|
width: componentWidth,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
3
3
|
multiline?: boolean | undefined;
|
|
4
|
+
withCharacterCounter?: boolean | undefined;
|
|
4
5
|
} & {
|
|
5
6
|
label?: string | undefined;
|
|
6
7
|
width?: import("csstype").Property.Width<string> | undefined;
|
|
@@ -26,10 +26,12 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
26
26
|
width = _a$width === void 0 ? textInputTokens.wrapper.defaultWidth : _a$width,
|
|
27
27
|
_a$type = _a.type,
|
|
28
28
|
type = _a$type === void 0 ? 'text' : _a$type,
|
|
29
|
+
_a$withCharacterCount = _a.withCharacterCounter,
|
|
30
|
+
withCharacterCounter = _a$withCharacterCount === void 0 ? true : _a$withCharacterCount,
|
|
29
31
|
className = _a.className,
|
|
30
32
|
style = _a.style,
|
|
31
33
|
ariaDescribedby = _a['aria-describedby'],
|
|
32
|
-
rest = __rest(_a, ["label", "disabled", "readOnly", "errorMessage", "tip", "required", "maxLength", "multiline", "onChange", "id", "width", "type", "className", "style", 'aria-describedby']);
|
|
34
|
+
rest = __rest(_a, ["label", "disabled", "readOnly", "errorMessage", "tip", "required", "maxLength", "multiline", "onChange", "id", "width", "type", "withCharacterCounter", "className", "style", 'aria-describedby']);
|
|
33
35
|
|
|
34
36
|
var textAreaRef = useRef(null);
|
|
35
37
|
|
|
@@ -69,7 +71,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
69
71
|
var hasLabel = !!label;
|
|
70
72
|
var labelPresence = hasLabel ? 'hasLabel' : 'noLabel';
|
|
71
73
|
var hasMessage = hasErrorMessage || hasTip || !!maxLength;
|
|
72
|
-
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter', maxLength);
|
|
74
|
+
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter', maxLength && withCharacterCounter);
|
|
73
75
|
var tipId = derivativeIdGenerator(uniqueId, 'tip', tip);
|
|
74
76
|
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage', errorMessage);
|
|
75
77
|
var generalInputProps = Object.assign({
|
|
@@ -125,7 +127,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
125
127
|
message: tip,
|
|
126
128
|
messageType: "tip",
|
|
127
129
|
id: tipId
|
|
128
|
-
}), maxLength && Number.isInteger(maxLength) && maxLength > 0 && jsx(CharCounter, {
|
|
130
|
+
}), maxLength && Number.isInteger(maxLength) && maxLength > 0 && withCharacterCounter && jsx(CharCounter, {
|
|
129
131
|
id: characterCounterId,
|
|
130
132
|
current: text.length,
|
|
131
133
|
max: maxLength
|
|
@@ -4,6 +4,7 @@ declare const _default: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
component: import("react").ForwardRefExoticComponent<{
|
|
6
6
|
multiline?: boolean | undefined;
|
|
7
|
+
withCharacterCounter?: boolean | undefined;
|
|
7
8
|
} & {
|
|
8
9
|
label?: string | undefined;
|
|
9
10
|
width?: import("csstype").Property.Width<string> | undefined;
|
|
@@ -3,4 +3,6 @@ import { InputProps } from '../../helpers';
|
|
|
3
3
|
export declare type TextInputProps = {
|
|
4
4
|
/**Gjør inputfeltet om til `<textarea>`. */
|
|
5
5
|
multiline?: boolean;
|
|
6
|
+
/** Spesifiserer om tegntelleren skal vises. */
|
|
7
|
+
withCharacterCounter?: boolean;
|
|
6
8
|
} & InputProps & InputHTMLAttributes<HTMLTextAreaElement>;
|
|
@@ -2,6 +2,7 @@ import { ElementType, PropsWithChildren, HTMLAttributes, AnchorHTMLAttributes }
|
|
|
2
2
|
import { CSSObject } from 'styled-components';
|
|
3
3
|
import { TextColor, OtherTypographyType, AnchorTypographyType, LabelTypographyType } from './Typography.types';
|
|
4
4
|
import { BaseComponentProps } from '../../types';
|
|
5
|
+
export declare const inlineElements: ElementType[];
|
|
5
6
|
export declare function isTextColor(color: string): color is TextColor;
|
|
6
7
|
export declare const getTextColor: (color: TextColor | string) => string;
|
|
7
8
|
export declare type TypographyInteractionProps = {
|
|
@@ -61,6 +61,12 @@ var getElementType = function getElementType(element) {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
var inlineElements = ['a', 'abbr', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button', 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress', 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'sub', 'sup', 'svg', 'template', 'textarea', 'time', 'u', 'var', 'video', 'wbr'];
|
|
65
|
+
|
|
66
|
+
var isInlineElement = function isInlineElement(as) {
|
|
67
|
+
return inlineElements.indexOf(as) !== -1;
|
|
68
|
+
};
|
|
69
|
+
|
|
64
70
|
function isTextColor(color) {
|
|
65
71
|
return textColorsArray.indexOf(color) !== -1;
|
|
66
72
|
}
|
|
@@ -95,8 +101,9 @@ var StyledTypography = styled.p.withConfig({
|
|
|
95
101
|
return interactionProps && interactionProps.active && css(["&:active{", "}"], interactionProps.active);
|
|
96
102
|
}, function (_ref5) {
|
|
97
103
|
var withMargins = _ref5.withMargins,
|
|
98
|
-
typographyType = _ref5.typographyType
|
|
99
|
-
|
|
104
|
+
typographyType = _ref5.typographyType,
|
|
105
|
+
as = _ref5.as;
|
|
106
|
+
return withMargins && typographyType && isInlineElement(as) ? css(["", " display:block;"], typographyTokens.typographyType[typographyType].margins.base) : withMargins && typographyType ? css(["", ""], typographyTokens.typographyType[typographyType].margins.base) : css(["margin:0;"]);
|
|
100
107
|
}, function (_ref6) {
|
|
101
108
|
var color = _ref6.color;
|
|
102
109
|
return color && css(["color:", ";"], getTextColor(color));
|
|
@@ -162,4 +169,4 @@ var Typography = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
162
169
|
}));
|
|
163
170
|
});
|
|
164
171
|
|
|
165
|
-
export { Typography, getTextColor, isTextColor };
|
|
172
|
+
export { Typography, getTextColor, inlineElements, isTextColor };
|
|
@@ -9,4 +9,5 @@ export declare type LabelTypographyType = 'supportingStyleLabel01';
|
|
|
9
9
|
export declare type OtherTypographyType = TypographyHeadingType | TypographyBodyType | TypographyLeadType | TypographySupportingType;
|
|
10
10
|
export declare type TypographyType = AnchorTypographyType | LabelTypographyType | OtherTypographyType;
|
|
11
11
|
export declare type TextColor = 'interactive' | 'primary' | 'danger' | 'warning' | 'success' | 'onLight' | 'onDark' | 'gray1' | 'gray2' | 'gray3' | 'gray4' | 'gray5' | 'gray6' | 'gray7' | 'gray8' | 'gray9';
|
|
12
|
+
export declare type InlineElement = 'a' | 'abbr' | 'audio' | 'b' | 'bdi' | 'bdo' | 'big' | 'br' | 'button' | 'canvas' | 'cite' | 'code' | 'data' | 'datalist' | 'del' | 'dfn' | 'em' | 'embed' | 'i' | 'iframe' | 'img' | 'input' | 'ins' | 'kbd' | 'label' | 'map' | 'mark' | 'meter' | 'noscript' | 'object' | 'output' | 'picture' | 'progress' | 'q' | 'ruby' | 's' | 'samp' | 'script' | 'select' | 'slot' | 'small' | 'span' | 'strong' | 'sub' | 'sup' | 'svg' | 'template' | 'textarea' | 'time' | 'u' | 'var' | 'video' | 'wbr';
|
|
12
13
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseComponentPropsWithChildren } from '../../types';
|
|
3
|
+
declare type VisuallyHiddenDivProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
4
|
+
as: 'div';
|
|
5
|
+
}>;
|
|
6
|
+
declare type VisuallyHiddenSpanProps = BaseComponentPropsWithChildren<HTMLSpanElement, {
|
|
7
|
+
/**Spesifiserer hvilken HTML tag skal returneres. */
|
|
8
|
+
as: 'span';
|
|
9
|
+
}>;
|
|
10
|
+
export declare type VisuallyHiddenProps = VisuallyHiddenSpanProps | VisuallyHiddenDivProps;
|
|
11
|
+
export declare const VisuallyHidden: (props: VisuallyHiddenProps) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
5
|
+
|
|
6
|
+
var Wrapper = styled.span.withConfig({
|
|
7
|
+
displayName: "VisuallyHidden__Wrapper",
|
|
8
|
+
componentId: "sc-ciubxt-0"
|
|
9
|
+
})(["width:1px;height:1px;margin:0px;padding:0px;top:0px;inset-inline-start:0px;overflow:hidden;clip:rect(0px,0px,0px,0px);border:0px;"]);
|
|
10
|
+
var VisuallyHidden = function VisuallyHidden(props) {
|
|
11
|
+
var children = props.children,
|
|
12
|
+
id = props.id,
|
|
13
|
+
className = props.className,
|
|
14
|
+
htmlProps = props.htmlProps,
|
|
15
|
+
as = props.as,
|
|
16
|
+
rest = __rest(props, ["children", "id", "className", "htmlProps", "as"]);
|
|
17
|
+
|
|
18
|
+
if (as === 'div') {
|
|
19
|
+
return jsx(Wrapper, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
20
|
+
as: as
|
|
21
|
+
}, {
|
|
22
|
+
children: children
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return jsx(Wrapper, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
27
|
+
children: children
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { VisuallyHidden };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { VisuallyHiddenProps } from '.';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: (props: VisuallyHiddenProps) => JSX.Element;
|
|
6
|
+
argTypes: {
|
|
7
|
+
as: {
|
|
8
|
+
control: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
15
|
+
export declare const Default: (args: VisuallyHiddenProps) => JSX.Element;
|
|
16
|
+
export declare const Link: () => JSX.Element;
|
|
17
|
+
export declare const TableButtons: () => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VisuallyHidden';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { Strategy } from '@floating-ui/react-dom';
|
|
3
3
|
export declare type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end';
|
|
4
4
|
export declare const useFloatPosition: (arrowRef: HTMLElement | null, placement?: Placement, offset?: number) => {
|
|
5
|
-
reference: (node:
|
|
5
|
+
reference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
|
|
6
6
|
floating: (node: HTMLElement | null) => void;
|
|
7
7
|
refs: {
|
|
8
|
-
reference: import("react").MutableRefObject<
|
|
8
|
+
reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
|
|
9
9
|
floating: import("react").MutableRefObject<HTMLElement | null>;
|
|
10
10
|
};
|
|
11
11
|
styles: {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { Select, createSelectOptions, searchFilter } from './components/Select/S
|
|
|
9
9
|
export { GlobalMessage } from './components/GlobalMessage/GlobalMessage.js';
|
|
10
10
|
export { LocalMessage } from './components/LocalMessage/LocalMessage.js';
|
|
11
11
|
export { Search } from './components/Search/Search.js';
|
|
12
|
-
export { Typography, getTextColor, isTextColor } from './components/Typography/Typography.js';
|
|
12
|
+
export { Typography, getTextColor, inlineElements, isTextColor } from './components/Typography/Typography.js';
|
|
13
13
|
export { Table } from './components/Table/Table.js';
|
|
14
14
|
export { Body } from './components/Table/Body.js';
|
|
15
15
|
export { Head } from './components/Table/Head.js';
|
|
@@ -58,3 +58,4 @@ export { TabPanels } from './components/Tabs/TabPanels.js';
|
|
|
58
58
|
export { Tag } from './components/Tag/Tag.js';
|
|
59
59
|
export { Chip } from './components/Chip/Chip.js';
|
|
60
60
|
export { ChipGroup } from './components/Chip/ChipGroup.js';
|
|
61
|
+
export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const derivativeIdGenerator: (prefix: string, suffix: string, value?: string | number) => string | undefined;
|
|
1
|
+
export declare const derivativeIdGenerator: (prefix: string, suffix: string, value?: string | number | boolean) => string | undefined;
|
|
2
2
|
export declare const idArrayGenerator: (values: (string | undefined)[]) => string[] | undefined;
|
|
3
3
|
export declare const spaceSeparatedIdListGenerator: (values: (string | undefined)[]) => string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norges-domstoler/dds-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "React components used in Elsa - domstolenes designsystem",
|
|
5
5
|
"author": "Elsa team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@testing-library/user-event": "^14.1.0",
|
|
63
63
|
"@types/jest": "^27.4.1",
|
|
64
64
|
"@types/react": "^17.0.2",
|
|
65
|
-
"@types/react-dom": "^
|
|
65
|
+
"@types/react-dom": "^18.0.6",
|
|
66
66
|
"@types/styled-components": "^5.1.9",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^5.19.0",
|
|
68
68
|
"@typescript-eslint/parser": "^5.19.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"eslint-config-prettier": "^8.5.0",
|
|
73
73
|
"eslint-plugin-prettier": "^4.0.0",
|
|
74
74
|
"eslint-plugin-react": "^7.29.4",
|
|
75
|
-
"eslint-plugin-storybook": "^0.
|
|
75
|
+
"eslint-plugin-storybook": "^0.6.1",
|
|
76
76
|
"jest": "^27.5.1 ",
|
|
77
77
|
"react": "^18.0.0",
|
|
78
78
|
"react-dom": "^18.0.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"rollup-plugin-copy": "^3.4.0",
|
|
81
81
|
"rollup-plugin-import-css": "^3.0.3",
|
|
82
82
|
"rollup-plugin-sass": "^1.2.12",
|
|
83
|
-
"rollup-plugin-typescript2": "^0.
|
|
83
|
+
"rollup-plugin-typescript2": "^0.32.1",
|
|
84
84
|
"ts-jest": "^27.1.4",
|
|
85
85
|
"typescript": "^4.6.3"
|
|
86
86
|
},
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@emotion/react": "^11.9.0",
|
|
113
113
|
"@emotion/styled": "^11.8.1",
|
|
114
|
-
"@floating-ui/react-dom": "^0.
|
|
114
|
+
"@floating-ui/react-dom": "^0.7.2",
|
|
115
115
|
"@mui/icons-material": "^5.6.2",
|
|
116
116
|
"@mui/material": "^5.6.3",
|
|
117
117
|
"focus-visible": "^5.2.0",
|