@norges-domstoler/dds-components 5.4.0 → 5.4.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.
@@ -1,9 +1,11 @@
1
1
  import { InputProps } from '../../helpers';
2
- import { Property } from 'csstype';
3
- export declare type DatepickerProps = InputProps;
4
- export declare const Datepicker: import("react").ForwardRefExoticComponent<{
5
- label?: string | undefined;
6
- width?: Property.Width<string> | undefined;
7
- tip?: string | undefined;
8
- errorMessage?: string | undefined;
9
- } & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
2
+ declare type DatepickerType = 'date' | 'datetime-local';
3
+ export declare type DatepickerProps = Modify<InputProps, {
4
+ /** Angi dato-input med eller uten klokkeslett. */
5
+ type?: DatepickerType;
6
+ }>;
7
+ export declare const Datepicker: import("react").ForwardRefExoticComponent<Omit<InputProps, "type"> & {
8
+ /** Angi dato-input med eller uten klokkeslett. */
9
+ type?: DatepickerType | undefined;
10
+ } & import("react").RefAttributes<HTMLInputElement>>;
11
+ export {};
@@ -1,12 +1,9 @@
1
1
  import { DatepickerProps } from '.';
2
2
  declare const _default: {
3
3
  title: string;
4
- component: import("react").ForwardRefExoticComponent<{
5
- label?: string | undefined;
6
- width?: import("csstype").Property.Width<string> | undefined;
7
- tip?: string | undefined;
8
- errorMessage?: string | undefined;
9
- } & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
4
+ component: import("react").ForwardRefExoticComponent<Omit<import("../../helpers").InputProps, "type"> & {
5
+ type?: ("date" | "datetime-local") | undefined;
6
+ } & import("react").RefAttributes<HTMLInputElement>>;
10
7
  argTypes: {
11
8
  label: {
12
9
  control: {
@@ -8,6 +8,11 @@ declare const _default: {
8
8
  type: string;
9
9
  };
10
10
  };
11
+ applicationDesc: {
12
+ control: {
13
+ type: string;
14
+ };
15
+ };
11
16
  currentPageHref: {
12
17
  control: {
13
18
  type: string;
@@ -30,10 +35,10 @@ export declare const Overview: () => JSX.Element;
30
35
  export declare const Default: (args: InternalHeaderProps) => JSX.Element;
31
36
  export declare const WithNavigationAndContextMenu: (args: InternalHeaderProps) => JSX.Element;
32
37
  export declare const WithCurrentPage: (args: InternalHeaderProps) => JSX.Element;
33
- export declare const SmallScreenWithNavigation: () => JSX.Element;
38
+ export declare const SmallScreenWithNavigation: (args: InternalHeaderProps) => JSX.Element;
34
39
  export declare const SmallScreenWithContextMenu: (args: InternalHeaderProps) => JSX.Element;
35
- export declare const SmallScreenWithNavigationAndContextMenu: () => JSX.Element;
40
+ export declare const SmallScreenWithNavigationAndContextMenu: (args: InternalHeaderProps) => JSX.Element;
36
41
  export declare const NoStoryHeading: (args: InternalHeaderProps) => JSX.Element;
37
- export declare const NoStoryHeadingSmallScreen: () => JSX.Element;
38
- export declare const NoStoryHeadingSmallScreenLong: () => JSX.Element;
39
- export declare const NonInteractiveUserOnly: () => JSX.Element;
42
+ export declare const NoStoryHeadingSmallScreen: (args: InternalHeaderProps) => JSX.Element;
43
+ export declare const NoStoryHeadingSmallScreenLong: (args: InternalHeaderProps) => JSX.Element;
44
+ export declare const NonInteractiveUserOnly: (args: InternalHeaderProps) => JSX.Element;
@@ -18,6 +18,8 @@ declare type InternaHeaderUserProps = {
18
18
  export declare type InternalHeaderProps = BaseComponentProps<HTMLDivElement, {
19
19
  /**Navn på applikasjonen. */
20
20
  applicationName?: string;
21
+ /**Beskrivelse på applikasjonen ellen tittel på en underside. Tilgjengelig fram til Lovisa Next kommer. */
22
+ applicationDesc?: string;
21
23
  /**Indikerer om versjonen for små skjermer skal vises. */
22
24
  smallScreen?: boolean;
23
25
  /**Info om brukeren. Dukker opp som punkt på toppen av kontekstmenyen med tekst oppgitt i name. Blir en lenke hvis href er oppgitt. */
@@ -12,5 +12,6 @@ export declare const Container: import("styled-components").StyledComponent<"div
12
12
  export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
13
13
  width?: string | number | undefined;
14
14
  }, never>;
15
+ export declare const InnerSingleValue: import("styled-components").StyledComponent<"div", any, {}, never>;
15
16
  export declare const getCustomStyles: <TOption>() => Partial<StylesConfig<TOption, boolean, GroupBase<TOption>>>;
16
17
  export {};
package/dist/cjs/index.js CHANGED
@@ -5392,8 +5392,6 @@ var Scrollbar = function Scrollbar(props) {
5392
5392
  }
5393
5393
  }, [thumbHeight]);
5394
5394
  var handleThumbPositioning = React.useCallback(function () {
5395
- console.log('positioning');
5396
-
5397
5395
  if (!(contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) || !trackRef.current || !thumbRef.current) {
5398
5396
  return;
5399
5397
  }
@@ -5823,6 +5821,7 @@ var optionBase = Object.assign(Object.assign({
5823
5821
  color: textDefault$4.textColor
5824
5822
  });
5825
5823
  var optionHoverBase = {
5824
+ color: textDefault$4.textColor,
5826
5825
  backgroundColor: Colors$c.DdsColorInteractiveLightest
5827
5826
  };
5828
5827
  var optionSelectedBase = Object.assign({
@@ -6036,6 +6035,10 @@ var Wrapper$6 = styled__default["default"].div.withConfig({
6036
6035
  var width = _ref5.width;
6037
6036
  return width;
6038
6037
  });
6038
+ var InnerSingleValue = styled__default["default"].div.withConfig({
6039
+ displayName: "Selectstyles__InnerSingleValue",
6040
+ componentId: "sc-19jkd5s-3"
6041
+ })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box;max-width:100%;"]);
6039
6042
  var getCustomStyles = function getCustomStyles() {
6040
6043
  return {
6041
6044
  control: function control() {
@@ -6073,10 +6076,12 @@ var getCustomStyles = function getCustomStyles() {
6073
6076
  padding: 0
6074
6077
  });
6075
6078
  },
6076
- singleValue: function singleValue(provided) {
6077
- return Object.assign(Object.assign({}, provided), {
6078
- margin: 0
6079
- });
6079
+ singleValue: function singleValue() {
6080
+ return {
6081
+ gridArea: '1/1/2/3',
6082
+ overflow: 'hidden',
6083
+ boxSizing: 'border-box'
6084
+ };
6080
6085
  },
6081
6086
  multiValue: function multiValue(provided, state) {
6082
6087
  return Object.assign(Object.assign(Object.assign({}, provided), selectTokens.multiValue.base), state.selectProps.isDisabled ? selectTokens.multiValue.disabled.base : selectTokens.multiValue.enabled.base);
@@ -6115,13 +6120,13 @@ var getCustomStyles = function getCustomStyles() {
6115
6120
  });
6116
6121
  },
6117
6122
  option: function option(provided, state) {
6118
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, provided), {
6123
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, provided), {
6119
6124
  '@media (prefers-reduced-motion: no-preference)': {
6120
6125
  transition: 'color 0.2s, background-color 0.2s'
6121
6126
  }
6122
6127
  }), selectTokens.option.base), {
6123
6128
  '&:hover': Object.assign({}, selectTokens.option.hover.base)
6124
- }), state.isSelected || state.isFocused ? selectTokens.option.selected.base : {});
6129
+ }), state.isSelected ? selectTokens.option.selected.base : {}), state.isFocused ? focusVisibleLink : {});
6125
6130
  },
6126
6131
  noOptionsMessage: function noOptionsMessage() {
6127
6132
  return Object.assign({}, selectTokens.noOptionsMessage.base);
@@ -6177,9 +6182,13 @@ var CustomOption = function CustomOption(props, Element) {
6177
6182
  }));
6178
6183
  };
6179
6184
 
6180
- var CustomSingleValue = function CustomSingleValue(props, Element) {
6185
+ var CustomSingleValue = function CustomSingleValue(props, id, Element) {
6181
6186
  return jsxRuntime.jsx(SingleValue, Object.assign({}, props, {
6182
- children: jsxRuntime.jsx(Element, Object.assign({}, props))
6187
+ children: jsxRuntime.jsx(InnerSingleValue, Object.assign({
6188
+ id: id
6189
+ }, {
6190
+ children: Element ? jsxRuntime.jsx(Element, Object.assign({}, props)) : props.children
6191
+ }))
6183
6192
  }));
6184
6193
  };
6185
6194
 
@@ -6216,6 +6225,13 @@ var CustomDropdownIndicator = function CustomDropdownIndicator(props) {
6216
6225
  }));
6217
6226
  };
6218
6227
 
6228
+ var CustomInput = function CustomInput(props, ariaInvalid, ariaDescribedby) {
6229
+ return jsxRuntime.jsx(Input$1, Object.assign({}, props, {
6230
+ "aria-invalid": ariaInvalid,
6231
+ "aria-describedby": ariaDescribedby
6232
+ }));
6233
+ };
6234
+
6219
6235
  function escapeRegexCharacters(text) {
6220
6236
  return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
6221
6237
  }
@@ -6253,17 +6269,11 @@ var SelectInner = function SelectInner(_a, ref) {
6253
6269
 
6254
6270
  var generatedId = React.useId();
6255
6271
  var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-select");
6272
+ var singleValueId = !isMulti ? "".concat(uniqueId, "-singleValue") : undefined;
6256
6273
  var hasLabel = !!label;
6257
6274
  var hasErrorMessage = !!errorMessage;
6258
6275
  var tipId = derivativeIdGenerator(uniqueId, 'tip', tip);
6259
6276
  var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage', errorMessage);
6260
-
6261
- var CustomInput = function CustomInput(props) {
6262
- return jsxRuntime.jsx(Input$1, Object.assign({}, props, {
6263
- "aria-describedby": spaceSeparatedIdListGenerator([tipId, errorMessageId])
6264
- }));
6265
- };
6266
-
6267
6277
  var wrapperProps = {
6268
6278
  width: width
6269
6279
  };
@@ -6298,10 +6308,12 @@ var SelectInner = function SelectInner(_a, ref) {
6298
6308
  return CustomOption(props, customOptionElement);
6299
6309
  } : IconOption,
6300
6310
  NoOptionsMessage: NoOptionsMessageCustom,
6301
- Input: CustomInput,
6302
- SingleValue: customSingleValueElement ? function (props) {
6303
- return CustomSingleValue(props, customSingleValueElement);
6304
- } : SingleValue,
6311
+ Input: function Input(props) {
6312
+ return CustomInput(props, hasErrorMessage, spaceSeparatedIdListGenerator([singleValueId, tipId, errorMessageId]));
6313
+ },
6314
+ SingleValue: function SingleValue(props) {
6315
+ return CustomSingleValue(props, singleValueId, customSingleValueElement);
6316
+ },
6305
6317
  ClearIndicator: CustomClearIndicator,
6306
6318
  DropdownIndicator: CustomDropdownIndicator,
6307
6319
  MultiValueRemove: CustomMultiValueRemove
@@ -9015,7 +9027,8 @@ var InternalHeaderListItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
9015
9027
  });
9016
9028
 
9017
9029
  var InternalHeader = function InternalHeader(props) {
9018
- var applicationName = props.applicationName,
9030
+ var applicationDesc = props.applicationDesc,
9031
+ applicationName = props.applicationName,
9019
9032
  smallScreen = props.smallScreen,
9020
9033
  navigationElements = props.navigationElements,
9021
9034
  contextMenuElements = props.contextMenuElements,
@@ -9025,7 +9038,7 @@ var InternalHeader = function InternalHeader(props) {
9025
9038
  id = props.id,
9026
9039
  className = props.className,
9027
9040
  htmlProps = props.htmlProps,
9028
- rest = tslib.__rest(props, ["applicationName", "smallScreen", "navigationElements", "contextMenuElements", "currentPageHref", "userProps", "onCurrentPageChange", "id", "className", "htmlProps"]);
9041
+ rest = tslib.__rest(props, ["applicationDesc", "applicationName", "smallScreen", "navigationElements", "contextMenuElements", "currentPageHref", "userProps", "onCurrentPageChange", "id", "className", "htmlProps"]);
9029
9042
 
9030
9043
  var _useState = React.useState(true),
9031
9044
  _useState2 = _slicedToArray(_useState, 2),
@@ -9089,14 +9102,14 @@ var InternalHeader = function InternalHeader(props) {
9089
9102
  bold: true,
9090
9103
  as: "span"
9091
9104
  }, {
9092
- children: "Lovisa Next"
9105
+ children: applicationName
9093
9106
  }))
9094
9107
  }), jsxRuntime.jsx(ApplicationNameWrapper, {
9095
9108
  children: jsxRuntime.jsx(Typography, Object.assign({
9096
9109
  typographyType: "bodySans02",
9097
9110
  as: "span"
9098
9111
  }, {
9099
- children: applicationName
9112
+ children: applicationDesc
9100
9113
  }))
9101
9114
  })]
9102
9115
  })
@@ -9147,10 +9160,6 @@ var datepickerTokens = {
9147
9160
  }
9148
9161
  };
9149
9162
 
9150
- var getWidth = function getWidth(type) {
9151
- return type === 'date' ? '205px' : type === 'datetime-local' ? '235px' : '320px';
9152
- };
9153
-
9154
9163
  var StyledInput = styled__default["default"](StatefulInput).withConfig({
9155
9164
  displayName: "Datepicker__StyledInput",
9156
9165
  componentId: "sc-1ijxhje-0"
@@ -9192,7 +9201,7 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
9192
9201
  type: type,
9193
9202
  'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
9194
9203
  'aria-invalid': hasErrorMessage ? true : undefined,
9195
- max: max || '9999-12-31'
9204
+ max: getMax(type, max)
9196
9205
  }, rest);
9197
9206
  var outerInputContainerProps = {
9198
9207
  width: componentWidth,
@@ -9223,6 +9232,33 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
9223
9232
  }));
9224
9233
  });
9225
9234
 
9235
+ var getWidth = function getWidth(type) {
9236
+ if (type === 'date') {
9237
+ return '205px';
9238
+ }
9239
+
9240
+ if (type === 'datetime-local') {
9241
+ return '235px';
9242
+ }
9243
+
9244
+ return '320px';
9245
+ };
9246
+
9247
+ var getMax = function getMax(type, max) {
9248
+ if (max !== undefined) {
9249
+ return max;
9250
+ } // Limit the year-part to only four digits by default
9251
+
9252
+
9253
+ if (type === 'datetime-local') {
9254
+ return '9999-12-31T23:59';
9255
+ }
9256
+
9257
+ if (type === 'date') {
9258
+ return '9999-12-31';
9259
+ }
9260
+ };
9261
+
9226
9262
  var Colors$5 = ddsDesignTokens.ddsBaseTokens.colors,
9227
9263
  Spacing$7 = ddsDesignTokens.ddsBaseTokens.spacing,
9228
9264
  FontPackages$1 = ddsDesignTokens.ddsBaseTokens.fontPackages,
@@ -1,9 +1,11 @@
1
1
  import { InputProps } from '../../helpers';
2
- import { Property } from 'csstype';
3
- export declare type DatepickerProps = InputProps;
4
- export declare const Datepicker: import("react").ForwardRefExoticComponent<{
5
- label?: string | undefined;
6
- width?: Property.Width<string> | undefined;
7
- tip?: string | undefined;
8
- errorMessage?: string | undefined;
9
- } & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
2
+ declare type DatepickerType = 'date' | 'datetime-local';
3
+ export declare type DatepickerProps = Modify<InputProps, {
4
+ /** Angi dato-input med eller uten klokkeslett. */
5
+ type?: DatepickerType;
6
+ }>;
7
+ export declare const Datepicker: import("react").ForwardRefExoticComponent<Omit<InputProps, "type"> & {
8
+ /** Angi dato-input med eller uten klokkeslett. */
9
+ type?: DatepickerType | undefined;
10
+ } & import("react").RefAttributes<HTMLInputElement>>;
11
+ export {};
@@ -10,10 +10,6 @@ import { derivativeIdGenerator, spaceSeparatedIdListGenerator } from '../../util
10
10
  import { RequiredMarker } from '../../helpers/RequiredMarker/RequiredMarker.js';
11
11
  import { InputMessage } from '../InputMessage/InputMessage.js';
12
12
 
13
- var getWidth = function getWidth(type) {
14
- return type === 'date' ? '205px' : type === 'datetime-local' ? '235px' : '320px';
15
- };
16
-
17
13
  var StyledInput = styled(StatefulInput).withConfig({
18
14
  displayName: "Datepicker__StyledInput",
19
15
  componentId: "sc-1ijxhje-0"
@@ -55,7 +51,7 @@ var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
55
51
  type: type,
56
52
  'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
57
53
  'aria-invalid': hasErrorMessage ? true : undefined,
58
- max: max || '9999-12-31'
54
+ max: getMax(type, max)
59
55
  }, rest);
60
56
  var outerInputContainerProps = {
61
57
  width: componentWidth,
@@ -86,4 +82,31 @@ var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
86
82
  }));
87
83
  });
88
84
 
85
+ var getWidth = function getWidth(type) {
86
+ if (type === 'date') {
87
+ return '205px';
88
+ }
89
+
90
+ if (type === 'datetime-local') {
91
+ return '235px';
92
+ }
93
+
94
+ return '320px';
95
+ };
96
+
97
+ var getMax = function getMax(type, max) {
98
+ if (max !== undefined) {
99
+ return max;
100
+ } // Limit the year-part to only four digits by default
101
+
102
+
103
+ if (type === 'datetime-local') {
104
+ return '9999-12-31T23:59';
105
+ }
106
+
107
+ if (type === 'date') {
108
+ return '9999-12-31';
109
+ }
110
+ };
111
+
89
112
  export { Datepicker };
@@ -1,12 +1,9 @@
1
1
  import { DatepickerProps } from '.';
2
2
  declare const _default: {
3
3
  title: string;
4
- component: import("react").ForwardRefExoticComponent<{
5
- label?: string | undefined;
6
- width?: import("csstype").Property.Width<string> | undefined;
7
- tip?: string | undefined;
8
- errorMessage?: string | undefined;
9
- } & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
4
+ component: import("react").ForwardRefExoticComponent<Omit<import("../../helpers").InputProps, "type"> & {
5
+ type?: ("date" | "datetime-local") | undefined;
6
+ } & import("react").RefAttributes<HTMLInputElement>>;
10
7
  argTypes: {
11
8
  label: {
12
9
  control: {
@@ -12,7 +12,8 @@ import { Typography } from '../Typography/Typography.js';
12
12
  import { Button } from '../Button/Button.js';
13
13
 
14
14
  var InternalHeader = function InternalHeader(props) {
15
- var applicationName = props.applicationName,
15
+ var applicationDesc = props.applicationDesc,
16
+ applicationName = props.applicationName,
16
17
  smallScreen = props.smallScreen,
17
18
  navigationElements = props.navigationElements,
18
19
  contextMenuElements = props.contextMenuElements,
@@ -22,7 +23,7 @@ var InternalHeader = function InternalHeader(props) {
22
23
  id = props.id,
23
24
  className = props.className,
24
25
  htmlProps = props.htmlProps,
25
- rest = __rest(props, ["applicationName", "smallScreen", "navigationElements", "contextMenuElements", "currentPageHref", "userProps", "onCurrentPageChange", "id", "className", "htmlProps"]);
26
+ rest = __rest(props, ["applicationDesc", "applicationName", "smallScreen", "navigationElements", "contextMenuElements", "currentPageHref", "userProps", "onCurrentPageChange", "id", "className", "htmlProps"]);
26
27
 
27
28
  var _useState = useState(true),
28
29
  _useState2 = _slicedToArray(_useState, 2),
@@ -86,14 +87,14 @@ var InternalHeader = function InternalHeader(props) {
86
87
  bold: true,
87
88
  as: "span"
88
89
  }, {
89
- children: "Lovisa Next"
90
+ children: applicationName
90
91
  }))
91
92
  }), jsx(ApplicationNameWrapper, {
92
93
  children: jsx(Typography, Object.assign({
93
94
  typographyType: "bodySans02",
94
95
  as: "span"
95
96
  }, {
96
- children: applicationName
97
+ children: applicationDesc
97
98
  }))
98
99
  })]
99
100
  })
@@ -8,6 +8,11 @@ declare const _default: {
8
8
  type: string;
9
9
  };
10
10
  };
11
+ applicationDesc: {
12
+ control: {
13
+ type: string;
14
+ };
15
+ };
11
16
  currentPageHref: {
12
17
  control: {
13
18
  type: string;
@@ -30,10 +35,10 @@ export declare const Overview: () => JSX.Element;
30
35
  export declare const Default: (args: InternalHeaderProps) => JSX.Element;
31
36
  export declare const WithNavigationAndContextMenu: (args: InternalHeaderProps) => JSX.Element;
32
37
  export declare const WithCurrentPage: (args: InternalHeaderProps) => JSX.Element;
33
- export declare const SmallScreenWithNavigation: () => JSX.Element;
38
+ export declare const SmallScreenWithNavigation: (args: InternalHeaderProps) => JSX.Element;
34
39
  export declare const SmallScreenWithContextMenu: (args: InternalHeaderProps) => JSX.Element;
35
- export declare const SmallScreenWithNavigationAndContextMenu: () => JSX.Element;
40
+ export declare const SmallScreenWithNavigationAndContextMenu: (args: InternalHeaderProps) => JSX.Element;
36
41
  export declare const NoStoryHeading: (args: InternalHeaderProps) => JSX.Element;
37
- export declare const NoStoryHeadingSmallScreen: () => JSX.Element;
38
- export declare const NoStoryHeadingSmallScreenLong: () => JSX.Element;
39
- export declare const NonInteractiveUserOnly: () => JSX.Element;
42
+ export declare const NoStoryHeadingSmallScreen: (args: InternalHeaderProps) => JSX.Element;
43
+ export declare const NoStoryHeadingSmallScreenLong: (args: InternalHeaderProps) => JSX.Element;
44
+ export declare const NonInteractiveUserOnly: (args: InternalHeaderProps) => JSX.Element;
@@ -18,6 +18,8 @@ declare type InternaHeaderUserProps = {
18
18
  export declare type InternalHeaderProps = BaseComponentProps<HTMLDivElement, {
19
19
  /**Navn på applikasjonen. */
20
20
  applicationName?: string;
21
+ /**Beskrivelse på applikasjonen ellen tittel på en underside. Tilgjengelig fram til Lovisa Next kommer. */
22
+ applicationDesc?: string;
21
23
  /**Indikerer om versjonen for små skjermer skal vises. */
22
24
  smallScreen?: boolean;
23
25
  /**Info om brukeren. Dukker opp som punkt på toppen av kontekstmenyen med tekst oppgitt i name. Blir en lenke hvis href er oppgitt. */
@@ -95,8 +95,6 @@ var Scrollbar = function Scrollbar(props) {
95
95
  }
96
96
  }, [thumbHeight]);
97
97
  var handleThumbPositioning = useCallback(function () {
98
- console.log('positioning');
99
-
100
98
  if (!(contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) || !trackRef.current || !thumbRef.current) {
101
99
  return;
102
100
  }
@@ -2,15 +2,15 @@ import { __rest } from 'tslib';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import React, { useId } from 'react';
4
4
  import ReactSelect, { components } from 'react-select';
5
- import { prefix, getCustomStyles, Wrapper, Container, Label } from './Select.styles.js';
5
+ import { prefix, getCustomStyles, Wrapper, Container, Label, InnerSingleValue } from './Select.styles.js';
6
6
  import { selectTokens } from './Select.tokens.js';
7
7
  import { CheckIcon } from '../../icons/tsx/check.js';
8
8
  import { CloseSmallIcon } from '../../icons/tsx/closeSmall.js';
9
9
  import { ChevronDownIcon } from '../../icons/tsx/chevronDown.js';
10
+ import { spaceSeparatedIdListGenerator, derivativeIdGenerator } from '../../utils/idGenerator.js';
10
11
  import { RequiredMarker } from '../../helpers/RequiredMarker/RequiredMarker.js';
11
12
  import { InputMessage } from '../InputMessage/InputMessage.js';
12
13
  import { Icon } from '../Icon/Icon.js';
13
- import { derivativeIdGenerator, spaceSeparatedIdListGenerator } from '../../utils/idGenerator.js';
14
14
 
15
15
  var DdsOption = components.Option,
16
16
  NoOptionsMessage = components.NoOptionsMessage,
@@ -47,9 +47,13 @@ var CustomOption = function CustomOption(props, Element) {
47
47
  }));
48
48
  };
49
49
 
50
- var CustomSingleValue = function CustomSingleValue(props, Element) {
50
+ var CustomSingleValue = function CustomSingleValue(props, id, Element) {
51
51
  return jsx(SingleValue, Object.assign({}, props, {
52
- children: jsx(Element, Object.assign({}, props))
52
+ children: jsx(InnerSingleValue, Object.assign({
53
+ id: id
54
+ }, {
55
+ children: Element ? jsx(Element, Object.assign({}, props)) : props.children
56
+ }))
53
57
  }));
54
58
  };
55
59
 
@@ -86,6 +90,13 @@ var CustomDropdownIndicator = function CustomDropdownIndicator(props) {
86
90
  }));
87
91
  };
88
92
 
93
+ var CustomInput = function CustomInput(props, ariaInvalid, ariaDescribedby) {
94
+ return jsx(Input, Object.assign({}, props, {
95
+ "aria-invalid": ariaInvalid,
96
+ "aria-describedby": ariaDescribedby
97
+ }));
98
+ };
99
+
89
100
  function escapeRegexCharacters(text) {
90
101
  return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
91
102
  }
@@ -123,17 +134,11 @@ var SelectInner = function SelectInner(_a, ref) {
123
134
 
124
135
  var generatedId = useId();
125
136
  var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-select");
137
+ var singleValueId = !isMulti ? "".concat(uniqueId, "-singleValue") : undefined;
126
138
  var hasLabel = !!label;
127
139
  var hasErrorMessage = !!errorMessage;
128
140
  var tipId = derivativeIdGenerator(uniqueId, 'tip', tip);
129
141
  var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage', errorMessage);
130
-
131
- var CustomInput = function CustomInput(props) {
132
- return jsx(Input, Object.assign({}, props, {
133
- "aria-describedby": spaceSeparatedIdListGenerator([tipId, errorMessageId])
134
- }));
135
- };
136
-
137
142
  var wrapperProps = {
138
143
  width: width
139
144
  };
@@ -168,10 +173,12 @@ var SelectInner = function SelectInner(_a, ref) {
168
173
  return CustomOption(props, customOptionElement);
169
174
  } : IconOption,
170
175
  NoOptionsMessage: NoOptionsMessageCustom,
171
- Input: CustomInput,
172
- SingleValue: customSingleValueElement ? function (props) {
173
- return CustomSingleValue(props, customSingleValueElement);
174
- } : SingleValue,
176
+ Input: function Input(props) {
177
+ return CustomInput(props, hasErrorMessage, spaceSeparatedIdListGenerator([singleValueId, tipId, errorMessageId]));
178
+ },
179
+ SingleValue: function SingleValue(props) {
180
+ return CustomSingleValue(props, singleValueId, customSingleValueElement);
181
+ },
175
182
  ClearIndicator: CustomClearIndicator,
176
183
  DropdownIndicator: CustomDropdownIndicator,
177
184
  MultiValueRemove: CustomMultiValueRemove
@@ -12,5 +12,6 @@ export declare const Container: import("styled-components").StyledComponent<"div
12
12
  export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
13
13
  width?: string | number | undefined;
14
14
  }, never>;
15
+ export declare const InnerSingleValue: import("styled-components").StyledComponent<"div", any, {}, never>;
15
16
  export declare const getCustomStyles: <TOption>() => Partial<StylesConfig<TOption, boolean, GroupBase<TOption>>>;
16
17
  export {};
@@ -3,6 +3,7 @@ import { typographyTokens } from '../Typography/Typography.tokens.js';
3
3
  import { selectTokens } from './Select.tokens.js';
4
4
  import { Typography } from '../Typography/Typography.js';
5
5
  import { scrollbarStyling } from '../ScrollableContainer/scrollbarStyling.js';
6
+ import { focusVisibleLink } from '../../helpers/styling/focusVisible.js';
6
7
 
7
8
  var prefix = 'dds-select';
8
9
  var Label = styled(Typography).withConfig({
@@ -33,6 +34,10 @@ var Wrapper = styled.div.withConfig({
33
34
  var width = _ref5.width;
34
35
  return width;
35
36
  });
37
+ var InnerSingleValue = styled.div.withConfig({
38
+ displayName: "Selectstyles__InnerSingleValue",
39
+ componentId: "sc-19jkd5s-3"
40
+ })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box;max-width:100%;"]);
36
41
  var getCustomStyles = function getCustomStyles() {
37
42
  return {
38
43
  control: function control() {
@@ -70,10 +75,12 @@ var getCustomStyles = function getCustomStyles() {
70
75
  padding: 0
71
76
  });
72
77
  },
73
- singleValue: function singleValue(provided) {
74
- return Object.assign(Object.assign({}, provided), {
75
- margin: 0
76
- });
78
+ singleValue: function singleValue() {
79
+ return {
80
+ gridArea: '1/1/2/3',
81
+ overflow: 'hidden',
82
+ boxSizing: 'border-box'
83
+ };
77
84
  },
78
85
  multiValue: function multiValue(provided, state) {
79
86
  return Object.assign(Object.assign(Object.assign({}, provided), selectTokens.multiValue.base), state.selectProps.isDisabled ? selectTokens.multiValue.disabled.base : selectTokens.multiValue.enabled.base);
@@ -112,13 +119,13 @@ var getCustomStyles = function getCustomStyles() {
112
119
  });
113
120
  },
114
121
  option: function option(provided, state) {
115
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, provided), {
122
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, provided), {
116
123
  '@media (prefers-reduced-motion: no-preference)': {
117
124
  transition: 'color 0.2s, background-color 0.2s'
118
125
  }
119
126
  }), selectTokens.option.base), {
120
127
  '&:hover': Object.assign({}, selectTokens.option.hover.base)
121
- }), state.isSelected || state.isFocused ? selectTokens.option.selected.base : {});
128
+ }), state.isSelected ? selectTokens.option.selected.base : {}), state.isFocused ? focusVisibleLink : {});
122
129
  },
123
130
  noOptionsMessage: function noOptionsMessage() {
124
131
  return Object.assign({}, selectTokens.noOptionsMessage.base);
@@ -139,4 +146,4 @@ var getCustomStyles = function getCustomStyles() {
139
146
  };
140
147
  };
141
148
 
142
- export { Container, Label, Wrapper, getCustomStyles, prefix };
149
+ export { Container, InnerSingleValue, Label, Wrapper, getCustomStyles, prefix };
@@ -115,6 +115,7 @@ var optionBase = Object.assign(Object.assign({
115
115
  color: textDefault.textColor
116
116
  });
117
117
  var optionHoverBase = {
118
+ color: textDefault.textColor,
118
119
  backgroundColor: Colors.DdsColorInteractiveLightest
119
120
  };
120
121
  var optionSelectedBase = Object.assign({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "5.4.0",
3
+ "version": "5.4.1",
4
4
  "description": "React components used in Elsa - domstolenes designsystem",
5
5
  "author": "Elsa team",
6
6
  "license": "MIT",