@norges-domstoler/dds-components 21.1.0 → 21.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +15 -52
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +70 -64
- package/dist/index.d.ts +70 -64
- package/dist/index.js +254 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +368 -288
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -281,6 +281,7 @@ __export(index_exports, {
|
|
|
281
281
|
StarIcon: () => StarIcon,
|
|
282
282
|
StatefulInput: () => StatefulInput,
|
|
283
283
|
StylelessList: () => StylelessList,
|
|
284
|
+
StylelessOList: () => StylelessOList,
|
|
284
285
|
SvgWrapper: () => SvgWrapper,
|
|
285
286
|
SyncIcon: () => SyncIcon,
|
|
286
287
|
Tab: () => Tab,
|
|
@@ -3042,6 +3043,7 @@ var getLiteralScreenSize = (screenSize) => {
|
|
|
3042
3043
|
// src/components/helpers/StylelessList/StylelessList.tsx
|
|
3043
3044
|
var import_jsx_runtime176 = require("react/jsx-runtime");
|
|
3044
3045
|
var StylelessList = ({ className, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("ul", { ...rest, className: cn(className, utilStyles_default["remove-list-styling"]) });
|
|
3046
|
+
var StylelessOList = ({ className, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("ol", { ...rest, className: cn(className, utilStyles_default["remove-list-styling"]) });
|
|
3045
3047
|
|
|
3046
3048
|
// src/components/helpers/styling/utils.ts
|
|
3047
3049
|
var outlineOffset = "var(--dds-spacing-x0-125)";
|
|
@@ -4968,8 +4970,14 @@ var Label2 = ({
|
|
|
4968
4970
|
...rest
|
|
4969
4971
|
}) => {
|
|
4970
4972
|
return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(
|
|
4971
|
-
|
|
4973
|
+
Box,
|
|
4972
4974
|
{
|
|
4975
|
+
as: "label",
|
|
4976
|
+
position: "relative",
|
|
4977
|
+
display: "flex",
|
|
4978
|
+
alignItems: "center",
|
|
4979
|
+
width: "fit-content",
|
|
4980
|
+
paddingInline: "calc(18px + var(--dds-spacing-x0-5)) 0",
|
|
4973
4981
|
className: cn(
|
|
4974
4982
|
className,
|
|
4975
4983
|
SelectionControl_default.label,
|
|
@@ -4985,6 +4993,35 @@ var Label2 = ({
|
|
|
4985
4993
|
}
|
|
4986
4994
|
);
|
|
4987
4995
|
};
|
|
4996
|
+
var GroupLabel = ({
|
|
4997
|
+
id,
|
|
4998
|
+
showRequiredMarker,
|
|
4999
|
+
readOnly,
|
|
5000
|
+
children
|
|
5001
|
+
}) => {
|
|
5002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(
|
|
5003
|
+
Typography,
|
|
5004
|
+
{
|
|
5005
|
+
as: "span",
|
|
5006
|
+
typographyType: "labelMedium",
|
|
5007
|
+
id,
|
|
5008
|
+
className: readOnly ? Label_default["read-only"] : void 0,
|
|
5009
|
+
children: [
|
|
5010
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(
|
|
5011
|
+
Icon,
|
|
5012
|
+
{
|
|
5013
|
+
icon: LockIcon,
|
|
5014
|
+
className: Label_default["read-only__icon"],
|
|
5015
|
+
iconSize: "small"
|
|
5016
|
+
}
|
|
5017
|
+
),
|
|
5018
|
+
children,
|
|
5019
|
+
" ",
|
|
5020
|
+
showRequiredMarker && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(RequiredMarker, {})
|
|
5021
|
+
]
|
|
5022
|
+
}
|
|
5023
|
+
);
|
|
5024
|
+
};
|
|
4988
5025
|
|
|
4989
5026
|
// src/components/SelectionControl/SelectionControl.utils.tsx
|
|
4990
5027
|
var selectionControlSizeNumberPx = 18;
|
|
@@ -5021,14 +5058,8 @@ var Checkbox = ({
|
|
|
5021
5058
|
const hasError = error || (checkboxGroup == null ? void 0 : checkboxGroup.error);
|
|
5022
5059
|
const isDisabled = disabled || (checkboxGroup == null ? void 0 : checkboxGroup.disabled);
|
|
5023
5060
|
return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(
|
|
5024
|
-
|
|
5061
|
+
Label2,
|
|
5025
5062
|
{
|
|
5026
|
-
position: "relative",
|
|
5027
|
-
display: "flex",
|
|
5028
|
-
alignItems: "center",
|
|
5029
|
-
width: "fit-content",
|
|
5030
|
-
paddingInline: "calc(18px + var(--dds-spacing-x0-5)) 0",
|
|
5031
|
-
as: Label2,
|
|
5032
5063
|
hasError,
|
|
5033
5064
|
disabled: isDisabled,
|
|
5034
5065
|
readOnly: isReadOnly,
|
|
@@ -5084,6 +5115,17 @@ Checkbox.displayName = "Checkbox";
|
|
|
5084
5115
|
// src/components/SelectionControl/Checkbox/CheckboxGroup.tsx
|
|
5085
5116
|
var import_react27 = require("react");
|
|
5086
5117
|
|
|
5118
|
+
// src/types/Booleanish.ts
|
|
5119
|
+
function convertBooleanishToBoolean(value) {
|
|
5120
|
+
if (value === "true") {
|
|
5121
|
+
return true;
|
|
5122
|
+
} else if (value === "false") {
|
|
5123
|
+
return false;
|
|
5124
|
+
} else {
|
|
5125
|
+
return value;
|
|
5126
|
+
}
|
|
5127
|
+
}
|
|
5128
|
+
|
|
5087
5129
|
// src/components/InputMessage/InputMessage.module.css
|
|
5088
5130
|
var InputMessage_default = {
|
|
5089
5131
|
container: "InputMessage_container",
|
|
@@ -5161,7 +5203,7 @@ var CheckboxGroup = (props) => {
|
|
|
5161
5203
|
const generatedId = (0, import_react27.useId)();
|
|
5162
5204
|
const uniqueGroupId = groupId != null ? groupId : `${generatedId}-checkboxGroup`;
|
|
5163
5205
|
const hasErrorMessage = !!errorMessage;
|
|
5164
|
-
const showRequiredMarker = required || ariaRequired;
|
|
5206
|
+
const showRequiredMarker = required || convertBooleanishToBoolean(ariaRequired);
|
|
5165
5207
|
const errorMessageId = derivativeIdGenerator(uniqueGroupId, "errorMessage");
|
|
5166
5208
|
const tipId = derivativeIdGenerator(uniqueGroupId, "tip");
|
|
5167
5209
|
const contextProps = {
|
|
@@ -5182,19 +5224,13 @@ var CheckboxGroup = (props) => {
|
|
|
5182
5224
|
rest
|
|
5183
5225
|
),
|
|
5184
5226
|
children: [
|
|
5185
|
-
label !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime214.
|
|
5186
|
-
|
|
5227
|
+
label !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
5228
|
+
GroupLabel,
|
|
5187
5229
|
{
|
|
5188
|
-
as: "span",
|
|
5189
|
-
typographyType: "labelMedium",
|
|
5190
5230
|
id: uniqueGroupId,
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
label,
|
|
5195
|
-
" ",
|
|
5196
|
-
showRequiredMarker && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(RequiredMarker, {})
|
|
5197
|
-
]
|
|
5231
|
+
readOnly,
|
|
5232
|
+
showRequiredMarker,
|
|
5233
|
+
children: label
|
|
5198
5234
|
}
|
|
5199
5235
|
) : null,
|
|
5200
5236
|
renderInputMessage(tip, tipId),
|
|
@@ -8481,8 +8517,7 @@ var LocalMessage = ({
|
|
|
8481
8517
|
),
|
|
8482
8518
|
width,
|
|
8483
8519
|
display: "grid",
|
|
8484
|
-
|
|
8485
|
-
padding: "x0.75",
|
|
8520
|
+
padding: "x0.75 x0.75 x0.75 x0.5",
|
|
8486
8521
|
gap: "x0.5",
|
|
8487
8522
|
children: [
|
|
8488
8523
|
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
@@ -8502,7 +8537,7 @@ var LocalMessage = ({
|
|
|
8502
8537
|
setClosed(true);
|
|
8503
8538
|
onClose && onClose();
|
|
8504
8539
|
},
|
|
8505
|
-
size: "
|
|
8540
|
+
size: "xsmall",
|
|
8506
8541
|
"aria-label": "Lukk melding",
|
|
8507
8542
|
className: LocalMessage_default.container__button
|
|
8508
8543
|
}
|
|
@@ -10491,7 +10526,8 @@ var import_react70 = require("react");
|
|
|
10491
10526
|
var import_react68 = require("react");
|
|
10492
10527
|
var ProgressTrackerContext = (0, import_react68.createContext)(
|
|
10493
10528
|
{
|
|
10494
|
-
activeStep: 0
|
|
10529
|
+
activeStep: 0,
|
|
10530
|
+
direction: "column"
|
|
10495
10531
|
}
|
|
10496
10532
|
);
|
|
10497
10533
|
var useProgressTrackerContext = () => (0, import_react68.useContext)(ProgressTrackerContext);
|
|
@@ -10499,8 +10535,9 @@ var useProgressTrackerContext = () => (0, import_react68.useContext)(ProgressTra
|
|
|
10499
10535
|
// src/components/ProgressTracker/ProgressTracker.module.css
|
|
10500
10536
|
var ProgressTracker_default = {
|
|
10501
10537
|
list: "ProgressTracker_list",
|
|
10502
|
-
|
|
10503
|
-
item: "
|
|
10538
|
+
"list-item": "ProgressTracker_list-item",
|
|
10539
|
+
"list-item--column": "ProgressTracker_list-item--column",
|
|
10540
|
+
"list-item--row": "ProgressTracker_list-item--row",
|
|
10504
10541
|
"item-button": "ProgressTracker_item-button",
|
|
10505
10542
|
"item-number--active-incomplete": "ProgressTracker_item-number--active-incomplete",
|
|
10506
10543
|
"item-number--inactive-incomplete": "ProgressTracker_item-number--inactive-incomplete",
|
|
@@ -10537,7 +10574,8 @@ var itemStateCn = {
|
|
|
10537
10574
|
inactiveCompleted: "inactive-completed",
|
|
10538
10575
|
inactiveIncomplete: "inactive-incomplete"
|
|
10539
10576
|
};
|
|
10540
|
-
var
|
|
10577
|
+
var getVisuallyHiddenTextBefore = (index) => `${index + 1}. trinn, `;
|
|
10578
|
+
var getVisuallyHiddenTextAfter = (completed) => `, ${completed ? "ferdig" : "ikke ferdig"}`;
|
|
10541
10579
|
var ProgressTrackerItem = (props) => {
|
|
10542
10580
|
const {
|
|
10543
10581
|
id,
|
|
@@ -10551,7 +10589,7 @@ var ProgressTrackerItem = (props) => {
|
|
|
10551
10589
|
children,
|
|
10552
10590
|
...rest
|
|
10553
10591
|
} = props;
|
|
10554
|
-
const { activeStep, handleStepChange } = useProgressTrackerContext();
|
|
10592
|
+
const { activeStep, handleStepChange, direction } = useProgressTrackerContext();
|
|
10555
10593
|
const active = activeStep === index;
|
|
10556
10594
|
const itemState = toItemState(active, completed, disabled);
|
|
10557
10595
|
const handleClick = () => {
|
|
@@ -10571,8 +10609,11 @@ var ProgressTrackerItem = (props) => {
|
|
|
10571
10609
|
}, [completed, icon, index]);
|
|
10572
10610
|
const stepContent = /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)(import_jsx_runtime283.Fragment, { children: [
|
|
10573
10611
|
/* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
|
|
10574
|
-
|
|
10612
|
+
Box,
|
|
10575
10613
|
{
|
|
10614
|
+
display: "flex",
|
|
10615
|
+
alignItems: "center",
|
|
10616
|
+
justifyContent: "center",
|
|
10576
10617
|
"aria-hidden": true,
|
|
10577
10618
|
className: cn(
|
|
10578
10619
|
ProgressTracker_default["item-number"],
|
|
@@ -10591,37 +10632,47 @@ var ProgressTrackerItem = (props) => {
|
|
|
10591
10632
|
typographyStyles_default["body-medium"]
|
|
10592
10633
|
),
|
|
10593
10634
|
children: [
|
|
10594
|
-
/* @__PURE__ */ (0, import_jsx_runtime283.jsx)(VisuallyHidden, { as: "span", children:
|
|
10595
|
-
children
|
|
10635
|
+
/* @__PURE__ */ (0, import_jsx_runtime283.jsx)(VisuallyHidden, { as: "span", children: getVisuallyHiddenTextBefore(index) }),
|
|
10636
|
+
children,
|
|
10637
|
+
/* @__PURE__ */ (0, import_jsx_runtime283.jsx)(VisuallyHidden, { as: "span", children: getVisuallyHiddenTextAfter(completed) })
|
|
10596
10638
|
]
|
|
10597
10639
|
}
|
|
10598
10640
|
)
|
|
10599
10641
|
] });
|
|
10600
|
-
return /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
|
|
10601
|
-
|
|
10602
|
-
{
|
|
10603
|
-
...getBaseHTMLProps(
|
|
10604
|
-
id,
|
|
10605
|
-
cn(className, ProgressTracker_default["item-button"], focusable),
|
|
10606
|
-
htmlProps,
|
|
10607
|
-
rest
|
|
10608
|
-
),
|
|
10609
|
-
onClick: () => handleClick(),
|
|
10610
|
-
disabled,
|
|
10611
|
-
children: stepContent
|
|
10612
|
-
}
|
|
10613
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
|
|
10614
|
-
"div",
|
|
10642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
|
|
10643
|
+
Box,
|
|
10615
10644
|
{
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10645
|
+
as: "li",
|
|
10646
|
+
display: direction === "row" ? "flex" : void 0,
|
|
10647
|
+
"aria-current": active ? "step" : void 0,
|
|
10648
|
+
className: cn(ProgressTracker_default["list-item"], ProgressTracker_default[`list-item--${direction}`]),
|
|
10649
|
+
children: handleStepChange ? /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
|
|
10650
|
+
"button",
|
|
10651
|
+
{
|
|
10652
|
+
...getBaseHTMLProps(
|
|
10653
|
+
id,
|
|
10654
|
+
cn(className, ProgressTracker_default["item-button"], focusable),
|
|
10655
|
+
htmlProps,
|
|
10656
|
+
rest
|
|
10657
|
+
),
|
|
10658
|
+
onClick: () => handleClick(),
|
|
10659
|
+
disabled,
|
|
10660
|
+
children: stepContent
|
|
10661
|
+
}
|
|
10662
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
|
|
10663
|
+
"div",
|
|
10664
|
+
{
|
|
10665
|
+
...getBaseHTMLProps(
|
|
10666
|
+
id,
|
|
10667
|
+
cn(className, cn(ProgressTracker_default["item-button"], ProgressTracker_default["item-div"])),
|
|
10668
|
+
htmlProps,
|
|
10669
|
+
rest
|
|
10670
|
+
),
|
|
10671
|
+
children: stepContent
|
|
10672
|
+
}
|
|
10673
|
+
)
|
|
10623
10674
|
}
|
|
10624
|
-
)
|
|
10675
|
+
);
|
|
10625
10676
|
};
|
|
10626
10677
|
ProgressTrackerItem.displayName = "ProgressTracker.Item";
|
|
10627
10678
|
|
|
@@ -10632,9 +10683,10 @@ var ProgressTracker = (() => {
|
|
|
10632
10683
|
id,
|
|
10633
10684
|
activeStep = 0,
|
|
10634
10685
|
onStepChange,
|
|
10686
|
+
direction = "column",
|
|
10635
10687
|
children,
|
|
10636
10688
|
className,
|
|
10637
|
-
htmlProps,
|
|
10689
|
+
htmlProps = {},
|
|
10638
10690
|
...rest
|
|
10639
10691
|
}) => {
|
|
10640
10692
|
const [thisActiveStep, setActiveStep] = (0, import_react70.useState)(activeStep);
|
|
@@ -10650,23 +10702,38 @@ var ProgressTracker = (() => {
|
|
|
10650
10702
|
const steps = (0, import_react70.useMemo)(() => {
|
|
10651
10703
|
const validChildren = removeInvalidChildren(children);
|
|
10652
10704
|
const itemsWithIndex = passIndexPropToProgressTrackerItem(validChildren);
|
|
10653
|
-
|
|
10654
|
-
return itemsWithConnectorsBetween;
|
|
10705
|
+
return itemsWithIndex;
|
|
10655
10706
|
}, [children]);
|
|
10707
|
+
const isRow = direction === "row";
|
|
10708
|
+
const { "aria-label": ariaLabel } = htmlProps;
|
|
10656
10709
|
return /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
|
|
10657
10710
|
ProgressTrackerContext,
|
|
10658
10711
|
{
|
|
10659
10712
|
value: {
|
|
10660
10713
|
activeStep: thisActiveStep,
|
|
10661
|
-
handleStepChange: handleChange
|
|
10714
|
+
handleStepChange: handleChange,
|
|
10715
|
+
direction
|
|
10662
10716
|
},
|
|
10663
10717
|
children: /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
|
|
10664
|
-
"
|
|
10718
|
+
"nav",
|
|
10665
10719
|
{
|
|
10666
|
-
|
|
10667
|
-
"aria-label": "progress",
|
|
10720
|
+
"aria-label": ariaLabel != null ? ariaLabel : "stegprogresjon",
|
|
10668
10721
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
10669
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
|
|
10722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
|
|
10723
|
+
Box,
|
|
10724
|
+
{
|
|
10725
|
+
as: StylelessOList,
|
|
10726
|
+
display: "flex",
|
|
10727
|
+
flexDirection: direction,
|
|
10728
|
+
alignItems: "start",
|
|
10729
|
+
gap: isRow ? "x0.5" : "x0.125",
|
|
10730
|
+
overflowX: isRow ? "auto" : void 0,
|
|
10731
|
+
margin: "0",
|
|
10732
|
+
padding: isRow ? "x0.25" : "0",
|
|
10733
|
+
className: cn(ProgressTracker_default.list, scrollbar),
|
|
10734
|
+
children: steps
|
|
10735
|
+
}
|
|
10736
|
+
)
|
|
10670
10737
|
}
|
|
10671
10738
|
)
|
|
10672
10739
|
}
|
|
@@ -10688,15 +10755,6 @@ function passIndexPropToProgressTrackerItem(children) {
|
|
|
10688
10755
|
})
|
|
10689
10756
|
);
|
|
10690
10757
|
}
|
|
10691
|
-
var intersperseItemsWithConnector = (children) => import_react70.Children.map(children, (child, index) => {
|
|
10692
|
-
if (index === 0) {
|
|
10693
|
-
return child;
|
|
10694
|
-
}
|
|
10695
|
-
return /* @__PURE__ */ (0, import_jsx_runtime284.jsxs)(import_react70.Fragment, { children: [
|
|
10696
|
-
/* @__PURE__ */ (0, import_jsx_runtime284.jsx)("div", { "aria-hidden": true, className: ProgressTracker_default.connector }),
|
|
10697
|
-
child
|
|
10698
|
-
] }, index);
|
|
10699
|
-
});
|
|
10700
10758
|
|
|
10701
10759
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
10702
10760
|
var import_react71 = require("react");
|
|
@@ -10794,17 +10852,11 @@ var useAutocompleteSearch = () => {
|
|
|
10794
10852
|
|
|
10795
10853
|
// src/components/Search/Search.module.css
|
|
10796
10854
|
var Search_default = {
|
|
10797
|
-
container: "Search_container",
|
|
10798
|
-
"input-group": "Search_input-group",
|
|
10799
10855
|
"with-button-container": "Search_with-button-container",
|
|
10800
10856
|
input: "Search_input",
|
|
10801
|
-
"input--small": "Search_input--small",
|
|
10802
|
-
"input--medium": "Search_input--medium",
|
|
10803
|
-
"input--large": "Search_input--large",
|
|
10804
10857
|
"search-icon": "Search_search-icon",
|
|
10805
10858
|
"clear-button": "Search_clear-button",
|
|
10806
|
-
suggestions: "Search_suggestions"
|
|
10807
|
-
suggestions__header: "Search_suggestions__header"
|
|
10859
|
+
suggestions: "Search_suggestions"
|
|
10808
10860
|
};
|
|
10809
10861
|
|
|
10810
10862
|
// src/components/Search/Search.utils.ts
|
|
@@ -10910,15 +10962,20 @@ var SearchSuggestions = ({
|
|
|
10910
10962
|
),
|
|
10911
10963
|
"aria-hidden": !showSuggestions,
|
|
10912
10964
|
border: "border-default",
|
|
10965
|
+
position: "absolute",
|
|
10966
|
+
top: "100%",
|
|
10967
|
+
width: "100%",
|
|
10968
|
+
maxHeight: "300px",
|
|
10969
|
+
overflowY: "scroll",
|
|
10970
|
+
marginBlock: "x0.25 0",
|
|
10913
10971
|
children: [
|
|
10914
10972
|
/* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
|
|
10915
|
-
|
|
10973
|
+
Box,
|
|
10916
10974
|
{
|
|
10975
|
+
as: "h2",
|
|
10976
|
+
paddingInline: "0 x1",
|
|
10917
10977
|
id: suggestionsHeaderId,
|
|
10918
|
-
className:
|
|
10919
|
-
Search_default.suggestions__header,
|
|
10920
|
-
typographyStyles_default["body-xsmall"]
|
|
10921
|
-
),
|
|
10978
|
+
className: typographyStyles_default["body-xsmall"],
|
|
10922
10979
|
children: "S\xF8keforslag"
|
|
10923
10980
|
}
|
|
10924
10981
|
),
|
|
@@ -10955,9 +11012,28 @@ var getIconSize2 = (size2) => {
|
|
|
10955
11012
|
return "small";
|
|
10956
11013
|
}
|
|
10957
11014
|
};
|
|
11015
|
+
var getPadding = (size2, showIcon) => {
|
|
11016
|
+
const paddingRight = (textSize) => `calc(
|
|
11017
|
+
var(--dds-spacing-x1) + ${textSize} * 1.5 + var(--dds-spacing-x0-5)
|
|
11018
|
+
)`;
|
|
11019
|
+
const paddingLeft = (iconSize) => `calc(
|
|
11020
|
+
var(--dds-spacing-x0-75) + ${iconSize} + var(--dds-spacing-x0-5)
|
|
11021
|
+
)`;
|
|
11022
|
+
const pRSmallButton = paddingRight("0.875rem");
|
|
11023
|
+
const pRMediumButton = paddingRight("1rem");
|
|
11024
|
+
const pLSmallIcon = paddingLeft("var(--dds-icon-size-small)");
|
|
11025
|
+
const pLMediumIcon = paddingLeft("var(--dds-icon-size-medium)");
|
|
11026
|
+
const paddingMap = {
|
|
11027
|
+
large: `x1 ${pRMediumButton} x1 ${showIcon ? pLMediumIcon : "x0.75"}`,
|
|
11028
|
+
medium: `x0.75 ${pRSmallButton} x0.75 ${showIcon ? pLMediumIcon : "x0.75"}`,
|
|
11029
|
+
small: `x0.5 ${pRSmallButton} x0.5 ${showIcon ? pLSmallIcon : "x0.75"}`
|
|
11030
|
+
};
|
|
11031
|
+
return paddingMap[size2];
|
|
11032
|
+
};
|
|
10958
11033
|
var Search = ({
|
|
10959
11034
|
componentSize = "medium",
|
|
10960
11035
|
buttonProps,
|
|
11036
|
+
showIcon = true,
|
|
10961
11037
|
name,
|
|
10962
11038
|
label,
|
|
10963
11039
|
tip,
|
|
@@ -11000,87 +11076,98 @@ var Search = ({
|
|
|
11000
11076
|
} = buttonProps != null ? buttonProps : {};
|
|
11001
11077
|
const hasSuggestions = !!context.suggestions;
|
|
11002
11078
|
const showSearchButton = !!buttonProps && !!onClick;
|
|
11003
|
-
|
|
11079
|
+
const inputGroup = /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(
|
|
11080
|
+
HStack,
|
|
11081
|
+
{
|
|
11082
|
+
position: "relative",
|
|
11083
|
+
width: !showSearchButton ? width : void 0,
|
|
11084
|
+
className: !showSearchButton ? className : void 0,
|
|
11085
|
+
children: [
|
|
11086
|
+
showIcon && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11087
|
+
Icon,
|
|
11088
|
+
{
|
|
11089
|
+
icon: SearchIcon,
|
|
11090
|
+
iconSize: getIconSize2(componentSize),
|
|
11091
|
+
className: cn(
|
|
11092
|
+
Input_default["input-group__absolute-element"],
|
|
11093
|
+
Search_default["search-icon"]
|
|
11094
|
+
)
|
|
11095
|
+
}
|
|
11096
|
+
),
|
|
11097
|
+
/* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11098
|
+
Box,
|
|
11099
|
+
{
|
|
11100
|
+
as: Input,
|
|
11101
|
+
...rest,
|
|
11102
|
+
ref: combinedRef,
|
|
11103
|
+
name,
|
|
11104
|
+
type: "search",
|
|
11105
|
+
id: uniqueId,
|
|
11106
|
+
"aria-describedby": spaceSeparatedIdListGenerator([
|
|
11107
|
+
tip ? tipId : void 0,
|
|
11108
|
+
context.suggestions ? suggestionsDescriptionId : void 0,
|
|
11109
|
+
ariaDescribedby
|
|
11110
|
+
]),
|
|
11111
|
+
value: (_a = context.inputValue) != null ? _a : value,
|
|
11112
|
+
onChange: handleChange,
|
|
11113
|
+
autoComplete: "off",
|
|
11114
|
+
"aria-autocomplete": hasSuggestions ? "list" : void 0,
|
|
11115
|
+
"aria-controls": hasSuggestions ? suggestionsId : void 0,
|
|
11116
|
+
"aria-expanded": context.showSuggestions,
|
|
11117
|
+
role: hasSuggestions ? "combobox" : void 0,
|
|
11118
|
+
width: "100%",
|
|
11119
|
+
padding: getPadding(componentSize, showIcon),
|
|
11120
|
+
className: cn(
|
|
11121
|
+
Search_default.input,
|
|
11122
|
+
typographyStyles_default[getTypographyCn(typographyTypes2[componentSize])]
|
|
11123
|
+
)
|
|
11124
|
+
}
|
|
11125
|
+
),
|
|
11126
|
+
hasSuggestions && /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(import_jsx_runtime288.Fragment, { children: [
|
|
11127
|
+
/* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11128
|
+
SearchSuggestions,
|
|
11129
|
+
{
|
|
11130
|
+
id: suggestionsId,
|
|
11131
|
+
ref: context.suggestionsRef,
|
|
11132
|
+
searchId: uniqueId,
|
|
11133
|
+
onSuggestionClick: context.onSugggestionClick,
|
|
11134
|
+
suggestions: context.suggestions,
|
|
11135
|
+
showSuggestions: context.showSuggestions,
|
|
11136
|
+
componentSize
|
|
11137
|
+
}
|
|
11138
|
+
),
|
|
11139
|
+
/* @__PURE__ */ (0, import_jsx_runtime288.jsx)(VisuallyHidden, { id: suggestionsDescriptionId, as: "span", children: "Bla i s\xF8keforslag med piltaster n\xE5r listen er utvidet." })
|
|
11140
|
+
] }),
|
|
11141
|
+
hasValue && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11142
|
+
Button,
|
|
11143
|
+
{
|
|
11144
|
+
icon: CloseSmallIcon,
|
|
11145
|
+
size: componentSize === "large" ? "medium" : "small",
|
|
11146
|
+
purpose: "tertiary",
|
|
11147
|
+
"aria-label": "T\xF8m",
|
|
11148
|
+
onClick: clearInput,
|
|
11149
|
+
className: Search_default["clear-button"]
|
|
11150
|
+
}
|
|
11151
|
+
)
|
|
11152
|
+
]
|
|
11153
|
+
}
|
|
11154
|
+
);
|
|
11155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(VStack, { gap: "x0.125", children: [
|
|
11004
11156
|
hasLabel && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(Label, { htmlFor: uniqueId, children: label }),
|
|
11005
11157
|
/* @__PURE__ */ (0, import_jsx_runtime288.jsxs)("div", { children: [
|
|
11006
|
-
/* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(
|
|
11007
|
-
|
|
11158
|
+
showSearchButton ? /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(
|
|
11159
|
+
Grid,
|
|
11008
11160
|
{
|
|
11009
|
-
className
|
|
11010
|
-
className,
|
|
11011
|
-
showSearchButton && Search_default["with-button-container"]
|
|
11012
|
-
),
|
|
11161
|
+
className,
|
|
11013
11162
|
width,
|
|
11014
|
-
|
|
11163
|
+
columnGap: "x0.5",
|
|
11164
|
+
rowGap: "0",
|
|
11165
|
+
marginInline: "0",
|
|
11166
|
+
gridTemplateColumns: "1fr auto",
|
|
11015
11167
|
style,
|
|
11016
11168
|
children: [
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
Icon,
|
|
11020
|
-
{
|
|
11021
|
-
icon: SearchIcon,
|
|
11022
|
-
iconSize: getIconSize2(componentSize),
|
|
11023
|
-
className: cn(
|
|
11024
|
-
Input_default["input-group__absolute-element"],
|
|
11025
|
-
Search_default["search-icon"]
|
|
11026
|
-
)
|
|
11027
|
-
}
|
|
11028
|
-
),
|
|
11029
|
-
/* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11030
|
-
Input,
|
|
11031
|
-
{
|
|
11032
|
-
...rest,
|
|
11033
|
-
ref: combinedRef,
|
|
11034
|
-
name,
|
|
11035
|
-
type: "search",
|
|
11036
|
-
id: uniqueId,
|
|
11037
|
-
"aria-describedby": spaceSeparatedIdListGenerator([
|
|
11038
|
-
tip ? tipId : void 0,
|
|
11039
|
-
context.suggestions ? suggestionsDescriptionId : void 0,
|
|
11040
|
-
ariaDescribedby
|
|
11041
|
-
]),
|
|
11042
|
-
value: (_a = context.inputValue) != null ? _a : value,
|
|
11043
|
-
onChange: handleChange,
|
|
11044
|
-
autoComplete: "off",
|
|
11045
|
-
"aria-autocomplete": hasSuggestions ? "list" : void 0,
|
|
11046
|
-
"aria-controls": hasSuggestions ? suggestionsId : void 0,
|
|
11047
|
-
"aria-expanded": context.showSuggestions,
|
|
11048
|
-
role: hasSuggestions ? "combobox" : void 0,
|
|
11049
|
-
className: cn(
|
|
11050
|
-
Search_default.input,
|
|
11051
|
-
Search_default[`input--${componentSize}`],
|
|
11052
|
-
typographyStyles_default[getTypographyCn(typographyTypes2[componentSize])]
|
|
11053
|
-
)
|
|
11054
|
-
}
|
|
11055
|
-
),
|
|
11056
|
-
hasSuggestions && /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(import_jsx_runtime288.Fragment, { children: [
|
|
11057
|
-
/* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11058
|
-
SearchSuggestions,
|
|
11059
|
-
{
|
|
11060
|
-
id: suggestionsId,
|
|
11061
|
-
ref: context.suggestionsRef,
|
|
11062
|
-
searchId: uniqueId,
|
|
11063
|
-
onSuggestionClick: context.onSugggestionClick,
|
|
11064
|
-
suggestions: context.suggestions,
|
|
11065
|
-
showSuggestions: context.showSuggestions,
|
|
11066
|
-
componentSize
|
|
11067
|
-
}
|
|
11068
|
-
),
|
|
11069
|
-
/* @__PURE__ */ (0, import_jsx_runtime288.jsx)(VisuallyHidden, { id: suggestionsDescriptionId, as: "span", children: "Bla i s\xF8keforslag med piltaster n\xE5r listen er utvidet." })
|
|
11070
|
-
] }),
|
|
11071
|
-
hasValue && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11072
|
-
Button,
|
|
11073
|
-
{
|
|
11074
|
-
icon: CloseSmallIcon,
|
|
11075
|
-
size: componentSize === "large" ? "medium" : "small",
|
|
11076
|
-
purpose: "tertiary",
|
|
11077
|
-
"aria-label": "T\xF8m",
|
|
11078
|
-
onClick: clearInput,
|
|
11079
|
-
className: Search_default["clear-button"]
|
|
11080
|
-
}
|
|
11081
|
-
)
|
|
11082
|
-
] }),
|
|
11083
|
-
showSearchButton && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11169
|
+
inputGroup,
|
|
11170
|
+
/* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
11084
11171
|
Button,
|
|
11085
11172
|
{
|
|
11086
11173
|
size: componentSize,
|
|
@@ -11091,7 +11178,7 @@ var Search = ({
|
|
|
11091
11178
|
)
|
|
11092
11179
|
]
|
|
11093
11180
|
}
|
|
11094
|
-
),
|
|
11181
|
+
) : inputGroup,
|
|
11095
11182
|
renderInputMessage(tip, tipId)
|
|
11096
11183
|
] })
|
|
11097
11184
|
] });
|
|
@@ -11337,7 +11424,7 @@ var RadioButtonGroup = ({
|
|
|
11337
11424
|
}
|
|
11338
11425
|
};
|
|
11339
11426
|
const hasErrorMessage = !!errorMessage;
|
|
11340
|
-
const showRequiredMarker = required || ariaRequired;
|
|
11427
|
+
const showRequiredMarker = required || convertBooleanishToBoolean(ariaRequired);
|
|
11341
11428
|
const tipId = tip && `${uniqueGroupId}-tip`;
|
|
11342
11429
|
const errorMessageId = errorMessage && `${uniqueGroupId}-errorMessage`;
|
|
11343
11430
|
const contextProps = {
|
|
@@ -11361,21 +11448,15 @@ var RadioButtonGroup = ({
|
|
|
11361
11448
|
rest
|
|
11362
11449
|
),
|
|
11363
11450
|
children: [
|
|
11364
|
-
/* @__PURE__ */ (0, import_jsx_runtime291.
|
|
11365
|
-
|
|
11451
|
+
label !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(
|
|
11452
|
+
GroupLabel,
|
|
11366
11453
|
{
|
|
11367
|
-
as: "span",
|
|
11368
|
-
typographyType: "labelMedium",
|
|
11369
11454
|
id: uniqueGroupId,
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
label,
|
|
11374
|
-
" ",
|
|
11375
|
-
showRequiredMarker && /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(RequiredMarker, {})
|
|
11376
|
-
]
|
|
11455
|
+
readOnly,
|
|
11456
|
+
showRequiredMarker,
|
|
11457
|
+
children: label
|
|
11377
11458
|
}
|
|
11378
|
-
),
|
|
11459
|
+
) : null,
|
|
11379
11460
|
renderInputMessage(tip, tipId),
|
|
11380
11461
|
/* @__PURE__ */ (0, import_jsx_runtime291.jsx)(RadioButtonGroupContext, { value: { ...contextProps }, children: /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(
|
|
11381
11462
|
"div",
|
|
@@ -13182,6 +13263,7 @@ ToggleButtonGroup.displayName = "ToggleButtonGroup";
|
|
|
13182
13263
|
StarIcon,
|
|
13183
13264
|
StatefulInput,
|
|
13184
13265
|
StylelessList,
|
|
13266
|
+
StylelessOList,
|
|
13185
13267
|
SvgWrapper,
|
|
13186
13268
|
SyncIcon,
|
|
13187
13269
|
Tab,
|