@norges-domstoler/dds-components 9.0.0 → 9.1.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/assets/fonts/IBMPlexMono-Light.woff +0 -0
- package/dist/assets/fonts/IBMPlexMono-Light.woff2 +0 -0
- package/dist/assets/fonts/IBMPlexMono-Regular.woff +0 -0
- package/dist/assets/fonts/IBMPlexMono-Regular.woff2 +0 -0
- package/dist/assets/fonts/IBMPlexMono-SemiBold.woff +0 -0
- package/dist/assets/fonts/IBMPlexMono-SemiBold.woff2 +0 -0
- package/dist/bundle.css +30 -0
- package/dist/cjs/bundle.css +30 -0
- package/dist/cjs/components/Checkbox/CheckboxGroupContext.d.ts +3 -3
- package/dist/cjs/index.js +24 -34
- package/dist/cjs/utils/idGenerator.d.ts +1 -2
- package/dist/components/Checkbox/CheckboxGroup.js +5 -5
- package/dist/components/Checkbox/CheckboxGroupContext.d.ts +3 -3
- package/dist/components/Datepicker/Datepicker.js +3 -3
- package/dist/components/Search/Search.js +2 -2
- package/dist/components/Select/Select.js +3 -3
- package/dist/components/TextArea/TextArea.js +3 -3
- package/dist/components/TextInput/TextInput.js +4 -4
- package/dist/styles/fontStyles.css +30 -0
- package/dist/utils/idGenerator.d.ts +1 -2
- package/dist/utils/idGenerator.js +5 -15
- package/package.json +5 -5
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/bundle.css
CHANGED
|
@@ -59,6 +59,36 @@
|
|
|
59
59
|
url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff') format('woff');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
@font-face {
|
|
63
|
+
font-family: IBM Plex Mono;
|
|
64
|
+
font-style: normal;
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
font-display: swap;
|
|
67
|
+
src: local('IBM Plex Mono'), local('IBMPlexMono'),
|
|
68
|
+
url('../assets/fonts/IBMPlexMono-Regular.woff2') format('woff2'),
|
|
69
|
+
url('../assets/fonts/IBMPlexMono-Regular.woff') format('woff');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@font-face {
|
|
73
|
+
font-family: IBM Plex Mono;
|
|
74
|
+
font-style: normal;
|
|
75
|
+
font-weight: 300;
|
|
76
|
+
font-display: swap;
|
|
77
|
+
src: local('IBM Plex Mono Light'), local('IBMPlexMono-Light'),
|
|
78
|
+
url('../assets/fonts/IBMPlexMono-Light.woff2') format('woff2'),
|
|
79
|
+
url('../assets/fonts/IBMPlexMono-Light.woff') format('woff');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@font-face {
|
|
83
|
+
font-family: IBM Plex Mono;
|
|
84
|
+
font-style: normal;
|
|
85
|
+
font-weight: 600;
|
|
86
|
+
font-display: swap;
|
|
87
|
+
src: local('IBM Plex Mono SemiBold'), local('IBMPlexMono-SemiBold'),
|
|
88
|
+
url('../assets/fonts/IBMPlexMono-SemiBold.woff2') format('woff2'),
|
|
89
|
+
url('../assets/fonts/IBMPlexMono-SemiBold.woff') format('woff');
|
|
90
|
+
}
|
|
91
|
+
|
|
62
92
|
@import '~@norges-domstoler/dds-design-tokens/dist/css/colors.css';
|
|
63
93
|
|
|
64
94
|
*::selection {
|
package/dist/cjs/bundle.css
CHANGED
|
@@ -59,6 +59,36 @@
|
|
|
59
59
|
url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff') format('woff');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
@font-face {
|
|
63
|
+
font-family: IBM Plex Mono;
|
|
64
|
+
font-style: normal;
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
font-display: swap;
|
|
67
|
+
src: local('IBM Plex Mono'), local('IBMPlexMono'),
|
|
68
|
+
url('../assets/fonts/IBMPlexMono-Regular.woff2') format('woff2'),
|
|
69
|
+
url('../assets/fonts/IBMPlexMono-Regular.woff') format('woff');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@font-face {
|
|
73
|
+
font-family: IBM Plex Mono;
|
|
74
|
+
font-style: normal;
|
|
75
|
+
font-weight: 300;
|
|
76
|
+
font-display: swap;
|
|
77
|
+
src: local('IBM Plex Mono Light'), local('IBMPlexMono-Light'),
|
|
78
|
+
url('../assets/fonts/IBMPlexMono-Light.woff2') format('woff2'),
|
|
79
|
+
url('../assets/fonts/IBMPlexMono-Light.woff') format('woff');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@font-face {
|
|
83
|
+
font-family: IBM Plex Mono;
|
|
84
|
+
font-style: normal;
|
|
85
|
+
font-weight: 600;
|
|
86
|
+
font-display: swap;
|
|
87
|
+
src: local('IBM Plex Mono SemiBold'), local('IBMPlexMono-SemiBold'),
|
|
88
|
+
url('../assets/fonts/IBMPlexMono-SemiBold.woff2') format('woff2'),
|
|
89
|
+
url('../assets/fonts/IBMPlexMono-SemiBold.woff') format('woff');
|
|
90
|
+
}
|
|
91
|
+
|
|
62
92
|
@import '~@norges-domstoler/dds-design-tokens/dist/css/colors.css';
|
|
63
93
|
|
|
64
94
|
*::selection {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface CheckboxGroupContextProps {
|
|
3
3
|
error?: boolean;
|
|
4
4
|
errorMessageId?: string;
|
|
5
5
|
uniqueGroupId?: string;
|
|
6
6
|
tipId?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const CheckboxGroupContext: React.Context<Nullable<
|
|
9
|
-
export declare const useCheckboxGroup: () => Nullable<
|
|
8
|
+
export declare const CheckboxGroupContext: React.Context<Nullable<CheckboxGroupContextProps>>;
|
|
9
|
+
export declare const useCheckboxGroup: () => Nullable<CheckboxGroupContextProps>;
|
package/dist/cjs/index.js
CHANGED
|
@@ -3191,22 +3191,12 @@ var combineHandlers = function combineHandlers(handler1, handler2) {
|
|
|
3191
3191
|
return callback;
|
|
3192
3192
|
};
|
|
3193
3193
|
|
|
3194
|
-
var derivativeIdGenerator = function derivativeIdGenerator(prefix, suffix
|
|
3195
|
-
return
|
|
3196
|
-
};
|
|
3197
|
-
var idArrayGenerator = function idArrayGenerator(values) {
|
|
3198
|
-
var array = [];
|
|
3199
|
-
values.forEach(function (e) {
|
|
3200
|
-
if (e) {
|
|
3201
|
-
array.push(e);
|
|
3202
|
-
}
|
|
3203
|
-
});
|
|
3204
|
-
return array.length > 0 ? array : undefined;
|
|
3194
|
+
var derivativeIdGenerator = function derivativeIdGenerator(prefix, suffix) {
|
|
3195
|
+
return "".concat(prefix, "-").concat(suffix);
|
|
3205
3196
|
};
|
|
3206
3197
|
var spaceSeparatedIdListGenerator = function spaceSeparatedIdListGenerator(values) {
|
|
3207
|
-
var
|
|
3208
|
-
|
|
3209
|
-
return (_a = idArrayGenerator(values)) === null || _a === void 0 ? void 0 : _a.join(' ');
|
|
3198
|
+
var filtered = values.filter(Boolean);
|
|
3199
|
+
return filtered.length > 0 ? filtered.join(' ') : undefined;
|
|
3210
3200
|
};
|
|
3211
3201
|
|
|
3212
3202
|
var calculateHeightWithLineHeight = function calculateHeightWithLineHeight(lineHeight, fontSize) {
|
|
@@ -4439,13 +4429,13 @@ var CheckboxGroup = function CheckboxGroup(props) {
|
|
|
4439
4429
|
var uniqueGroupId = groupId !== null && groupId !== void 0 ? groupId : "".concat(generatedId, "-checkboxGroup");
|
|
4440
4430
|
var hasErrorMessage = !!errorMessage;
|
|
4441
4431
|
var showRequiredMarker = required || ariaRequired;
|
|
4442
|
-
var errorMessageId = derivativeIdGenerator(uniqueGroupId, 'errorMessage'
|
|
4443
|
-
var tipId = derivativeIdGenerator(uniqueGroupId, 'tip'
|
|
4432
|
+
var errorMessageId = derivativeIdGenerator(uniqueGroupId, 'errorMessage');
|
|
4433
|
+
var tipId = derivativeIdGenerator(uniqueGroupId, 'tip');
|
|
4444
4434
|
var contextProps = {
|
|
4445
4435
|
error: hasErrorMessage,
|
|
4446
|
-
errorMessageId: errorMessageId,
|
|
4436
|
+
errorMessageId: errorMessage ? errorMessageId : undefined,
|
|
4447
4437
|
uniqueGroupId: uniqueGroupId,
|
|
4448
|
-
tipId: tipId
|
|
4438
|
+
tipId: tip ? tipId : undefined
|
|
4449
4439
|
};
|
|
4450
4440
|
return jsxRuntime.jsxs(Container$f, Object.assign({}, getBaseHTMLProps(id, className, Object.assign(Object.assign({}, htmlProps), {
|
|
4451
4441
|
'aria-required': ariaRequired
|
|
@@ -4462,7 +4452,7 @@ var CheckboxGroup = function CheckboxGroup(props) {
|
|
|
4462
4452
|
children: jsxRuntime.jsx(GroupContainer, Object.assign({
|
|
4463
4453
|
role: "group",
|
|
4464
4454
|
"aria-labelledby": uniqueGroupId,
|
|
4465
|
-
"aria-describedby": tipId,
|
|
4455
|
+
"aria-describedby": tip ? tipId : undefined,
|
|
4466
4456
|
direction: direction
|
|
4467
4457
|
}, {
|
|
4468
4458
|
children: children
|
|
@@ -5282,9 +5272,9 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
5282
5272
|
var hasLabel = !!label;
|
|
5283
5273
|
var hasMessage = hasErrorMessage || hasTip || !!maxLength;
|
|
5284
5274
|
var hasIcon = !!icon;
|
|
5285
|
-
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter'
|
|
5286
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
5287
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
5275
|
+
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter');
|
|
5276
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
5277
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
5288
5278
|
var generalInputProps = Object.assign({
|
|
5289
5279
|
id: uniqueId,
|
|
5290
5280
|
errorMessage: errorMessage,
|
|
@@ -5297,7 +5287,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
5297
5287
|
value: value,
|
|
5298
5288
|
defaultValue: defaultValue,
|
|
5299
5289
|
'aria-required': ariaRequired,
|
|
5300
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, characterCounterId, ariaDescribedby]),
|
|
5290
|
+
'aria-describedby': spaceSeparatedIdListGenerator([hasTip ? tipId : undefined, hasErrorMessage ? errorMessageId : undefined, maxLength && withCharacterCounter ? characterCounterId : undefined, ariaDescribedby]),
|
|
5301
5291
|
'aria-invalid': hasErrorMessage ? true : undefined
|
|
5302
5292
|
}, rest);
|
|
5303
5293
|
var outerInputContainerProps = {
|
|
@@ -6173,8 +6163,8 @@ var SelectInner = function SelectInner(props, ref) {
|
|
|
6173
6163
|
var hasLabel = !!label;
|
|
6174
6164
|
var hasErrorMessage = !!errorMessage;
|
|
6175
6165
|
var showRequiredStyling = !!(required || ariaRequired);
|
|
6176
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
6177
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
6166
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
6167
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
6178
6168
|
var containerProps = {
|
|
6179
6169
|
width: width,
|
|
6180
6170
|
componentSize: componentSize,
|
|
@@ -6211,7 +6201,7 @@ var SelectInner = function SelectInner(props, ref) {
|
|
|
6211
6201
|
return DDSInput(Object.assign(Object.assign({}, props), {
|
|
6212
6202
|
required: required,
|
|
6213
6203
|
'aria-required': ariaRequired
|
|
6214
|
-
}), hasErrorMessage, spaceSeparatedIdListGenerator([singleValueId, tipId, errorMessageId]));
|
|
6204
|
+
}), hasErrorMessage, spaceSeparatedIdListGenerator([singleValueId, tip ? tipId : undefined, errorMessage ? errorMessageId : undefined]));
|
|
6215
6205
|
},
|
|
6216
6206
|
SingleValue: function SingleValue(props) {
|
|
6217
6207
|
return CustomSingleValue(props, singleValueId, customSingleValueElement);
|
|
@@ -6767,7 +6757,7 @@ var Search = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
6767
6757
|
var generatedId = React.useId();
|
|
6768
6758
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-searchInput");
|
|
6769
6759
|
var hasLabel = !!label;
|
|
6770
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
6760
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
6771
6761
|
var containerProps = {
|
|
6772
6762
|
className: className,
|
|
6773
6763
|
style: style
|
|
@@ -6779,7 +6769,7 @@ var Search = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
6779
6769
|
name: name,
|
|
6780
6770
|
type: 'search',
|
|
6781
6771
|
id: uniqueId,
|
|
6782
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, ariaDescribedby])
|
|
6772
|
+
'aria-describedby': spaceSeparatedIdListGenerator([tip ? tipId : undefined, ariaDescribedby])
|
|
6783
6773
|
});
|
|
6784
6774
|
|
|
6785
6775
|
var _b = buttonProps || {},
|
|
@@ -9345,8 +9335,8 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
9345
9335
|
var hasLabel = !!label;
|
|
9346
9336
|
var hasErrorMessage = !!errorMessage;
|
|
9347
9337
|
var showRequiredStyling = !!(required || ariaRequired);
|
|
9348
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
9349
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
9338
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
9339
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
9350
9340
|
var inputProps = Object.assign({
|
|
9351
9341
|
id: uniqueId,
|
|
9352
9342
|
hasErrorMessage: hasErrorMessage,
|
|
@@ -9357,7 +9347,7 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
9357
9347
|
disabled: disabled,
|
|
9358
9348
|
componentSize: componentSize,
|
|
9359
9349
|
type: type,
|
|
9360
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
|
|
9350
|
+
'aria-describedby': spaceSeparatedIdListGenerator([tip ? tipId : undefined, errorMessage ? errorMessageId : undefined, ariaDescribedby]),
|
|
9361
9351
|
'aria-required': ariaRequired,
|
|
9362
9352
|
'aria-invalid': hasErrorMessage ? true : undefined,
|
|
9363
9353
|
max: getMax(type, max)
|
|
@@ -11714,8 +11704,8 @@ var TextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
11714
11704
|
|
|
11715
11705
|
var hasErrorMessage = !!errorMessage;
|
|
11716
11706
|
var hasLabel = !!label;
|
|
11717
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
11718
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
11707
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
11708
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
11719
11709
|
var showRequiredStyling = required || !!ariaRequired;
|
|
11720
11710
|
var containerProps = {
|
|
11721
11711
|
width: width,
|
|
@@ -11732,7 +11722,7 @@ var TextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
11732
11722
|
hasErrorMessage: hasErrorMessage,
|
|
11733
11723
|
required: required,
|
|
11734
11724
|
'aria-required': ariaRequired,
|
|
11735
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
|
|
11725
|
+
'aria-describedby': spaceSeparatedIdListGenerator([tip ? tipId : undefined, errorMessage ? errorMessageId : undefined, ariaDescribedby]),
|
|
11736
11726
|
'aria-invalid': hasErrorMessage ? true : undefined
|
|
11737
11727
|
}, rest);
|
|
11738
11728
|
return jsxRuntime.jsxs(OuterInputContainer, Object.assign({}, containerProps, {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export declare const derivativeIdGenerator: (prefix: string, suffix: string
|
|
2
|
-
export declare const idArrayGenerator: (values: (string | undefined)[]) => string[] | undefined;
|
|
1
|
+
export declare const derivativeIdGenerator: (prefix: string, suffix: string) => string;
|
|
3
2
|
export declare const spaceSeparatedIdListGenerator: (values: (string | undefined)[]) => string | undefined;
|
|
@@ -51,13 +51,13 @@ var CheckboxGroup = function CheckboxGroup(props) {
|
|
|
51
51
|
var uniqueGroupId = groupId !== null && groupId !== void 0 ? groupId : "".concat(generatedId, "-checkboxGroup");
|
|
52
52
|
var hasErrorMessage = !!errorMessage;
|
|
53
53
|
var showRequiredMarker = required || ariaRequired;
|
|
54
|
-
var errorMessageId = derivativeIdGenerator(uniqueGroupId, 'errorMessage'
|
|
55
|
-
var tipId = derivativeIdGenerator(uniqueGroupId, 'tip'
|
|
54
|
+
var errorMessageId = derivativeIdGenerator(uniqueGroupId, 'errorMessage');
|
|
55
|
+
var tipId = derivativeIdGenerator(uniqueGroupId, 'tip');
|
|
56
56
|
var contextProps = {
|
|
57
57
|
error: hasErrorMessage,
|
|
58
|
-
errorMessageId: errorMessageId,
|
|
58
|
+
errorMessageId: errorMessage ? errorMessageId : undefined,
|
|
59
59
|
uniqueGroupId: uniqueGroupId,
|
|
60
|
-
tipId: tipId
|
|
60
|
+
tipId: tip ? tipId : undefined
|
|
61
61
|
};
|
|
62
62
|
return jsxs(Container, Object.assign({}, getBaseHTMLProps(id, className, Object.assign(Object.assign({}, htmlProps), {
|
|
63
63
|
'aria-required': ariaRequired
|
|
@@ -74,7 +74,7 @@ var CheckboxGroup = function CheckboxGroup(props) {
|
|
|
74
74
|
children: jsx(GroupContainer, Object.assign({
|
|
75
75
|
role: "group",
|
|
76
76
|
"aria-labelledby": uniqueGroupId,
|
|
77
|
-
"aria-describedby": tipId,
|
|
77
|
+
"aria-describedby": tip ? tipId : undefined,
|
|
78
78
|
direction: direction
|
|
79
79
|
}, {
|
|
80
80
|
children: children
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface CheckboxGroupContextProps {
|
|
3
3
|
error?: boolean;
|
|
4
4
|
errorMessageId?: string;
|
|
5
5
|
uniqueGroupId?: string;
|
|
6
6
|
tipId?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const CheckboxGroupContext: React.Context<Nullable<
|
|
9
|
-
export declare const useCheckboxGroup: () => Nullable<
|
|
8
|
+
export declare const CheckboxGroupContext: React.Context<Nullable<CheckboxGroupContextProps>>;
|
|
9
|
+
export declare const useCheckboxGroup: () => Nullable<CheckboxGroupContextProps>;
|
|
@@ -57,8 +57,8 @@ var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
57
57
|
var hasLabel = !!label;
|
|
58
58
|
var hasErrorMessage = !!errorMessage;
|
|
59
59
|
var showRequiredStyling = !!(required || ariaRequired);
|
|
60
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
61
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
60
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
61
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
62
62
|
var inputProps = Object.assign({
|
|
63
63
|
id: uniqueId,
|
|
64
64
|
hasErrorMessage: hasErrorMessage,
|
|
@@ -69,7 +69,7 @@ var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
69
69
|
disabled: disabled,
|
|
70
70
|
componentSize: componentSize,
|
|
71
71
|
type: type,
|
|
72
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
|
|
72
|
+
'aria-describedby': spaceSeparatedIdListGenerator([tip ? tipId : undefined, errorMessage ? errorMessageId : undefined, ariaDescribedby]),
|
|
73
73
|
'aria-required': ariaRequired,
|
|
74
74
|
'aria-invalid': hasErrorMessage ? true : undefined,
|
|
75
75
|
max: getMax(type, max)
|
|
@@ -81,7 +81,7 @@ var Search = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
81
81
|
var generatedId = useId();
|
|
82
82
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-searchInput");
|
|
83
83
|
var hasLabel = !!label;
|
|
84
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
84
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
85
85
|
var containerProps = {
|
|
86
86
|
className: className,
|
|
87
87
|
style: style
|
|
@@ -93,7 +93,7 @@ var Search = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
93
93
|
name: name,
|
|
94
94
|
type: 'search',
|
|
95
95
|
id: uniqueId,
|
|
96
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, ariaDescribedby])
|
|
96
|
+
'aria-describedby': spaceSeparatedIdListGenerator([tip ? tipId : undefined, ariaDescribedby])
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
var _b = buttonProps || {},
|
|
@@ -159,8 +159,8 @@ var SelectInner = function SelectInner(props, ref) {
|
|
|
159
159
|
var hasLabel = !!label;
|
|
160
160
|
var hasErrorMessage = !!errorMessage;
|
|
161
161
|
var showRequiredStyling = !!(required || ariaRequired);
|
|
162
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
163
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
162
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
163
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
164
164
|
var containerProps = {
|
|
165
165
|
width: width,
|
|
166
166
|
componentSize: componentSize,
|
|
@@ -197,7 +197,7 @@ var SelectInner = function SelectInner(props, ref) {
|
|
|
197
197
|
return DDSInput(Object.assign(Object.assign({}, props), {
|
|
198
198
|
required: required,
|
|
199
199
|
'aria-required': ariaRequired
|
|
200
|
-
}), hasErrorMessage, spaceSeparatedIdListGenerator([singleValueId, tipId, errorMessageId]));
|
|
200
|
+
}), hasErrorMessage, spaceSeparatedIdListGenerator([singleValueId, tip ? tipId : undefined, errorMessage ? errorMessageId : undefined]));
|
|
201
201
|
},
|
|
202
202
|
SingleValue: function SingleValue(props) {
|
|
203
203
|
return CustomSingleValue(props, singleValueId, customSingleValueElement);
|
|
@@ -69,8 +69,8 @@ var TextArea = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
69
|
|
|
70
70
|
var hasErrorMessage = !!errorMessage;
|
|
71
71
|
var hasLabel = !!label;
|
|
72
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
73
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
72
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
73
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
74
74
|
var showRequiredStyling = required || !!ariaRequired;
|
|
75
75
|
var containerProps = {
|
|
76
76
|
width: width,
|
|
@@ -87,7 +87,7 @@ var TextArea = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
87
87
|
hasErrorMessage: hasErrorMessage,
|
|
88
88
|
required: required,
|
|
89
89
|
'aria-required': ariaRequired,
|
|
90
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
|
|
90
|
+
'aria-describedby': spaceSeparatedIdListGenerator([tip ? tipId : undefined, errorMessage ? errorMessageId : undefined, ariaDescribedby]),
|
|
91
91
|
'aria-invalid': hasErrorMessage ? true : undefined
|
|
92
92
|
}, rest);
|
|
93
93
|
return jsxs(OuterInputContainer, Object.assign({}, containerProps, {
|
|
@@ -77,9 +77,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
77
77
|
var hasLabel = !!label;
|
|
78
78
|
var hasMessage = hasErrorMessage || hasTip || !!maxLength;
|
|
79
79
|
var hasIcon = !!icon;
|
|
80
|
-
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter'
|
|
81
|
-
var tipId = derivativeIdGenerator(uniqueId, 'tip'
|
|
82
|
-
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage'
|
|
80
|
+
var characterCounterId = derivativeIdGenerator(uniqueId, 'characterCounter');
|
|
81
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
82
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage');
|
|
83
83
|
var generalInputProps = Object.assign({
|
|
84
84
|
id: uniqueId,
|
|
85
85
|
errorMessage: errorMessage,
|
|
@@ -92,7 +92,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
92
92
|
value: value,
|
|
93
93
|
defaultValue: defaultValue,
|
|
94
94
|
'aria-required': ariaRequired,
|
|
95
|
-
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, characterCounterId, ariaDescribedby]),
|
|
95
|
+
'aria-describedby': spaceSeparatedIdListGenerator([hasTip ? tipId : undefined, hasErrorMessage ? errorMessageId : undefined, maxLength && withCharacterCounter ? characterCounterId : undefined, ariaDescribedby]),
|
|
96
96
|
'aria-invalid': hasErrorMessage ? true : undefined
|
|
97
97
|
}, rest);
|
|
98
98
|
var outerInputContainerProps = {
|
|
@@ -58,3 +58,33 @@
|
|
|
58
58
|
url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff2') format('woff2'),
|
|
59
59
|
url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff') format('woff');
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
@font-face {
|
|
63
|
+
font-family: IBM Plex Mono;
|
|
64
|
+
font-style: normal;
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
font-display: swap;
|
|
67
|
+
src: local('IBM Plex Mono'), local('IBMPlexMono'),
|
|
68
|
+
url('../assets/fonts/IBMPlexMono-Regular.woff2') format('woff2'),
|
|
69
|
+
url('../assets/fonts/IBMPlexMono-Regular.woff') format('woff');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@font-face {
|
|
73
|
+
font-family: IBM Plex Mono;
|
|
74
|
+
font-style: normal;
|
|
75
|
+
font-weight: 300;
|
|
76
|
+
font-display: swap;
|
|
77
|
+
src: local('IBM Plex Mono Light'), local('IBMPlexMono-Light'),
|
|
78
|
+
url('../assets/fonts/IBMPlexMono-Light.woff2') format('woff2'),
|
|
79
|
+
url('../assets/fonts/IBMPlexMono-Light.woff') format('woff');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@font-face {
|
|
83
|
+
font-family: IBM Plex Mono;
|
|
84
|
+
font-style: normal;
|
|
85
|
+
font-weight: 600;
|
|
86
|
+
font-display: swap;
|
|
87
|
+
src: local('IBM Plex Mono SemiBold'), local('IBMPlexMono-SemiBold'),
|
|
88
|
+
url('../assets/fonts/IBMPlexMono-SemiBold.woff2') format('woff2'),
|
|
89
|
+
url('../assets/fonts/IBMPlexMono-SemiBold.woff') format('woff');
|
|
90
|
+
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export declare const derivativeIdGenerator: (prefix: string, suffix: string
|
|
2
|
-
export declare const idArrayGenerator: (values: (string | undefined)[]) => string[] | undefined;
|
|
1
|
+
export declare const derivativeIdGenerator: (prefix: string, suffix: string) => string;
|
|
3
2
|
export declare const spaceSeparatedIdListGenerator: (values: (string | undefined)[]) => string | undefined;
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
var derivativeIdGenerator = function derivativeIdGenerator(prefix, suffix
|
|
2
|
-
return
|
|
3
|
-
};
|
|
4
|
-
var idArrayGenerator = function idArrayGenerator(values) {
|
|
5
|
-
var array = [];
|
|
6
|
-
values.forEach(function (e) {
|
|
7
|
-
if (e) {
|
|
8
|
-
array.push(e);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
return array.length > 0 ? array : undefined;
|
|
1
|
+
var derivativeIdGenerator = function derivativeIdGenerator(prefix, suffix) {
|
|
2
|
+
return "".concat(prefix, "-").concat(suffix);
|
|
12
3
|
};
|
|
13
4
|
var spaceSeparatedIdListGenerator = function spaceSeparatedIdListGenerator(values) {
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
return (_a = idArrayGenerator(values)) === null || _a === void 0 ? void 0 : _a.join(' ');
|
|
5
|
+
var filtered = values.filter(Boolean);
|
|
6
|
+
return filtered.length > 0 ? filtered.join(' ') : undefined;
|
|
17
7
|
};
|
|
18
8
|
|
|
19
|
-
export { derivativeIdGenerator,
|
|
9
|
+
export { derivativeIdGenerator, spaceSeparatedIdListGenerator };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norges-domstoler/dds-components",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "React components used in Elsa - domstolenes designsystem",
|
|
5
5
|
"author": "Elsa team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"@babel/preset-env": "^7.19.1",
|
|
52
52
|
"@babel/preset-react": "^7.18.6",
|
|
53
53
|
"@mdx-js/react": "^2.1.3",
|
|
54
|
-
"@rollup/plugin-babel": "^
|
|
55
|
-
"@rollup/plugin-commonjs": "^
|
|
56
|
-
"@rollup/plugin-image": "^
|
|
57
|
-
"@rollup/plugin-node-resolve": "^
|
|
54
|
+
"@rollup/plugin-babel": "^6.0.0",
|
|
55
|
+
"@rollup/plugin-commonjs": "^23.0.0",
|
|
56
|
+
"@rollup/plugin-image": "^3.0.0",
|
|
57
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
58
58
|
"@storybook/addon-essentials": "^6.5.12",
|
|
59
59
|
"@storybook/addons": "^6.5.12",
|
|
60
60
|
"@storybook/mdx2-csf": "^0.0.3",
|