@norges-domstoler/dds-components 4.2.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.
@@ -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';
@@ -32,3 +32,4 @@ export * from './components/ToggleButton';
32
32
  export * from './components/Tabs';
33
33
  export * from './components/Tag';
34
34
  export * from './components/Chip';
35
+ export * from './components/VisuallyHidden';
package/dist/cjs/index.js CHANGED
@@ -2728,7 +2728,7 @@ var charCounterTokens = {
2728
2728
  base: charCounterBase
2729
2729
  };
2730
2730
 
2731
- var Wrapper$7 = styled__default["default"](Typography).withConfig({
2731
+ var Wrapper$8 = styled__default["default"](Typography).withConfig({
2732
2732
  displayName: "CharCounter__Wrapper",
2733
2733
  componentId: "sc-qty1z2-0"
2734
2734
  })(["margin-left:auto;", ""], charCounterTokens.base);
@@ -2746,7 +2746,7 @@ function CharCounter(props) {
2746
2746
  _useState2 = _slicedToArray(_useState, 1),
2747
2747
  uniqueId = _useState2[0];
2748
2748
 
2749
- return jsxRuntime.jsxs(Wrapper$7, Object.assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest), {
2749
+ return jsxRuntime.jsxs(Wrapper$8, Object.assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest), {
2750
2750
  forwardedAs: "div",
2751
2751
  typographyType: "supportingStyleHelperText01",
2752
2752
  "aria-label": "".concat(current, " av ").concat(max, " tegn skrevet")
@@ -3237,7 +3237,7 @@ var Container$f = styled__default["default"].div.withConfig({
3237
3237
  var readOnly = _ref5.readOnly;
3238
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);
3239
3239
  });
3240
- var Wrapper$6 = styled__default["default"].div.withConfig({
3240
+ var Wrapper$7 = styled__default["default"].div.withConfig({
3241
3241
  displayName: "Selectstyles__Wrapper",
3242
3242
  componentId: "sc-19jkd5s-2"
3243
3243
  })(["margin:0;width:", ";"], function (_ref6) {
@@ -3469,7 +3469,7 @@ var SelectInner = function SelectInner(_a, ref) {
3469
3469
  },
3470
3470
  'aria-invalid': hasErrorMessage ? true : undefined
3471
3471
  }, rest);
3472
- return jsxRuntime.jsxs(Wrapper$6, Object.assign({}, wrapperProps, {
3472
+ return jsxRuntime.jsxs(Wrapper$7, Object.assign({}, wrapperProps, {
3473
3473
  children: [jsxRuntime.jsxs(Container$f, Object.assign({}, containerProps, {
3474
3474
  children: [label && jsxRuntime.jsxs(Label, Object.assign({
3475
3475
  htmlFor: uniqueId,
@@ -4367,7 +4367,7 @@ var Foot = /*#__PURE__*/React.forwardRef(function (_a, ref) {
4367
4367
  }));
4368
4368
  });
4369
4369
 
4370
- var Wrapper$5 = styled__default["default"].div.withConfig({
4370
+ var Wrapper$6 = styled__default["default"].div.withConfig({
4371
4371
  displayName: "TableWrapper__Wrapper",
4372
4372
  componentId: "sc-eb384b-0"
4373
4373
  })(["", " ", ""], function (_ref) {
@@ -4415,7 +4415,7 @@ var TableWrapper = function TableWrapper(_a) {
4415
4415
  ref: wrapperRef,
4416
4416
  overflowX: overflowX
4417
4417
  }, rest);
4418
- return jsxRuntime.jsx(Wrapper$5, Object.assign({}, wrapperProps, {
4418
+ return jsxRuntime.jsx(Wrapper$6, Object.assign({}, wrapperProps, {
4419
4419
  children: children
4420
4420
  }));
4421
4421
  };
@@ -5191,7 +5191,7 @@ var Card = function Card(props) {
5191
5191
  }));
5192
5192
  };
5193
5193
 
5194
- var Wrapper$4 = styled__default["default"].div.withConfig({
5194
+ var Wrapper$5 = styled__default["default"].div.withConfig({
5195
5195
  displayName: "CardAccordion__Wrapper",
5196
5196
  componentId: "sc-1ctxrby-0"
5197
5197
  })([""]);
@@ -5241,7 +5241,7 @@ var CardAccordion = /*#__PURE__*/React.forwardRef(function (props, ref) {
5241
5241
  var wrapperProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
5242
5242
  ref: ref
5243
5243
  });
5244
- return jsxRuntime.jsx(Wrapper$4, Object.assign({}, wrapperProps, {
5244
+ return jsxRuntime.jsx(Wrapper$5, Object.assign({}, wrapperProps, {
5245
5245
  children: Children
5246
5246
  }));
5247
5247
  });
@@ -6107,7 +6107,7 @@ var OverflowMenuGroup = function OverflowMenuGroup(_ref) {
6107
6107
  });
6108
6108
  };
6109
6109
 
6110
- var Wrapper$3 = styled__default["default"].div.withConfig({
6110
+ var Wrapper$4 = styled__default["default"].div.withConfig({
6111
6111
  displayName: "InternalHeaderstyles__Wrapper",
6112
6112
  componentId: "sc-91bnca-0"
6113
6113
  })(["position:relative;*::selection{", "}", ""], typographyTokens.selection.base, internalHeaderTokens.wrapper.base);
@@ -6253,7 +6253,7 @@ var InternalHeader = function InternalHeader(props) {
6253
6253
  })
6254
6254
  })) : null;
6255
6255
  var hasContextMenu = hasContextMenuElements || !!userProps || hasNavInContextMenu;
6256
- return jsxRuntime.jsxs(Wrapper$3, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
6256
+ return jsxRuntime.jsxs(Wrapper$4, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
6257
6257
  children: [jsxRuntime.jsx(BannerWrapper, Object.assign({
6258
6258
  hasContextMenu: hasContextMenu
6259
6259
  }, {
@@ -6344,8 +6344,9 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
6344
6344
  tip = _a.tip,
6345
6345
  style = _a.style,
6346
6346
  className = _a.className,
6347
+ max = _a.max,
6347
6348
  ariaDescribedby = _a['aria-describedby'],
6348
- 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']);
6349
6350
 
6350
6351
  var _useState = React.useState(id !== null && id !== void 0 ? id : "datepickerInput-".concat(nextUniqueId$8++)),
6351
6352
  _useState2 = _slicedToArray(_useState, 1),
@@ -6368,7 +6369,8 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
6368
6369
  disabled: disabled,
6369
6370
  type: type,
6370
6371
  'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
6371
- 'aria-invalid': hasErrorMessage ? true : undefined
6372
+ 'aria-invalid': hasErrorMessage ? true : undefined,
6373
+ max: max || '9999-12-31'
6372
6374
  }, rest);
6373
6375
  var outerInputContainerProps = {
6374
6376
  width: componentWidth,
@@ -6435,7 +6437,7 @@ var skipToContentTokens = {
6435
6437
  }
6436
6438
  };
6437
6439
 
6438
- var Wrapper$2 = styled__default["default"].div.withConfig({
6440
+ var Wrapper$3 = styled__default["default"].div.withConfig({
6439
6441
  displayName: "SkipToContent__Wrapper",
6440
6442
  componentId: "sc-57o1qv-0"
6441
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) {
@@ -6466,7 +6468,7 @@ var SkipToContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
6466
6468
  className: joinClassNames(className, htmlPropsClassName),
6467
6469
  style: style
6468
6470
  };
6469
- return jsxRuntime.jsx(Wrapper$2, Object.assign({}, wrapperProps, {
6471
+ return jsxRuntime.jsx(Wrapper$3, Object.assign({}, wrapperProps, {
6470
6472
  children: jsxRuntime.jsx(Link, Object.assign({}, getBaseHTMLProps(id, restHtmlProps, rest), {
6471
6473
  ref: ref
6472
6474
  }, {
@@ -7033,7 +7035,7 @@ var popoverTokens = {
7033
7035
  };
7034
7036
 
7035
7037
  var Spacing$2 = ddsDesignTokens.ddsBaseTokens.spacing;
7036
- var Wrapper$1 = styled__default["default"].div.withConfig({
7038
+ var Wrapper$2 = styled__default["default"].div.withConfig({
7037
7039
  displayName: "Popover__Wrapper",
7038
7040
  componentId: "sc-1fecd7e-0"
7039
7041
  })(["", " box-sizing:border-box;position:absolute;width:fit-content;z-index:20;", " ", ""], function (_ref) {
@@ -7097,7 +7099,7 @@ var Popover = /*#__PURE__*/React.forwardRef(function (props, ref) {
7097
7099
  style: Object.assign(Object.assign({}, htmlProps.style), styles.floating),
7098
7100
  role: 'dialog'
7099
7101
  });
7100
- return jsxRuntime.jsxs(Wrapper$1, Object.assign({}, wrapperProps, {
7102
+ return jsxRuntime.jsxs(Wrapper$2, Object.assign({}, wrapperProps, {
7101
7103
  children: [title && jsxRuntime.jsx(TitleContainer, {
7102
7104
  children: typeof title === 'string' ? jsxRuntime.jsx(Typography, Object.assign({
7103
7105
  typographyType: "headingSans02"
@@ -7778,7 +7780,7 @@ var tagTokens = {
7778
7780
  }
7779
7781
  };
7780
7782
 
7781
- var Wrapper = styled__default["default"](Typography).withConfig({
7783
+ var Wrapper$1 = styled__default["default"](Typography).withConfig({
7782
7784
  displayName: "Tag__Wrapper",
7783
7785
  componentId: "sc-rdxtch-0"
7784
7786
  })(["", " ", ""], tagTokens.wrapper.base, function (_ref) {
@@ -7798,7 +7800,7 @@ var Tag = /*#__PURE__*/React.forwardRef(function (props, ref) {
7798
7800
  htmlProps = props.htmlProps,
7799
7801
  rest = tslib.__rest(props, ["text", "purpose", "id", "className", "htmlProps"]);
7800
7802
 
7801
- return jsxRuntime.jsx(Wrapper, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
7803
+ return jsxRuntime.jsx(Wrapper$1, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
7802
7804
  forwardedAs: "span",
7803
7805
  typographyType: "bodySans01",
7804
7806
  ref: ref,
@@ -7919,6 +7921,31 @@ var ChipGroup = /*#__PURE__*/React.forwardRef(function (_a, ref) {
7919
7921
  }));
7920
7922
  });
7921
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
+
7922
7949
  exports.Body = Body$1;
7923
7950
  exports.Breadcrumb = Breadcrumb;
7924
7951
  exports.Breadcrumbs = Breadcrumbs;
@@ -7980,6 +8007,7 @@ exports.ToggleButton = ToggleButton;
7980
8007
  exports.ToggleButtonGroup = ToggleButtonGroup;
7981
8008
  exports.Tooltip = Tooltip;
7982
8009
  exports.Typography = Typography;
8010
+ exports.VisuallyHidden = VisuallyHidden;
7983
8011
  exports.createSelectOptions = createSelectOptions;
7984
8012
  exports.getTextColor = getTextColor;
7985
8013
  exports.inlineElements = inlineElements;
@@ -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,
@@ -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';
package/dist/index.d.ts CHANGED
@@ -32,3 +32,4 @@ export * from './components/ToggleButton';
32
32
  export * from './components/Tabs';
33
33
  export * from './components/Tag';
34
34
  export * from './components/Chip';
35
+ export * from './components/VisuallyHidden';
package/dist/index.js CHANGED
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "React components used in Elsa - domstolenes designsystem",
5
5
  "author": "Elsa team",
6
6
  "license": "MIT",
@@ -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.5.13",
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",