@norges-domstoler/dds-components 24.2.2 → 24.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +22 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -13
package/dist/index.cjs
CHANGED
|
@@ -9508,15 +9508,23 @@ const getCustomStyles = (size, hasError, isReadOnly) => ({
|
|
|
9508
9508
|
//#endregion
|
|
9509
9509
|
//#region src/components/Select/SelectComponents.tsx
|
|
9510
9510
|
const { Option, NoOptionsMessage, Input, SingleValue, ClearIndicator, DropdownIndicator, MultiValueRemove, Control } = react_select.components;
|
|
9511
|
-
const DDSOption = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Option, {
|
|
9511
|
+
const DDSOption = ({ testId, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Option, {
|
|
9512
9512
|
...props,
|
|
9513
|
+
innerProps: {
|
|
9514
|
+
...props.innerProps,
|
|
9515
|
+
"data-testid": testId
|
|
9516
|
+
},
|
|
9513
9517
|
children: [props.isSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
9514
9518
|
icon: CheckIcon,
|
|
9515
9519
|
iconSize: "small"
|
|
9516
9520
|
}), props.children]
|
|
9517
9521
|
});
|
|
9518
|
-
const CustomOption = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Option, {
|
|
9522
|
+
const CustomOption = ({ testId, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Option, {
|
|
9519
9523
|
...props,
|
|
9524
|
+
innerProps: {
|
|
9525
|
+
...props.innerProps,
|
|
9526
|
+
"data-testid": testId
|
|
9527
|
+
},
|
|
9520
9528
|
children: react.default.createElement(props.customElement, props)
|
|
9521
9529
|
});
|
|
9522
9530
|
const CustomSingleValue = ({ id, Element, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SingleValue, {
|
|
@@ -9629,12 +9637,21 @@ function Select({ id, label, componentSize = "medium", errorMessage, tip, "aria-
|
|
|
9629
9637
|
dataTestId
|
|
9630
9638
|
]);
|
|
9631
9639
|
const customOptionComponent = (0, react.useCallback)((props) => {
|
|
9640
|
+
const optionTestId = dataTestId ? `${dataTestId}-option-${String(rest.getOptionValue?.(props.data) ?? props.data.value)}` : void 0;
|
|
9632
9641
|
if (customOptionElement) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomOption, {
|
|
9633
9642
|
...props,
|
|
9634
|
-
customElement: customOptionElement
|
|
9643
|
+
customElement: customOptionElement,
|
|
9644
|
+
testId: optionTestId
|
|
9645
|
+
});
|
|
9646
|
+
else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DDSOption, {
|
|
9647
|
+
...props,
|
|
9648
|
+
testId: optionTestId
|
|
9635
9649
|
});
|
|
9636
|
-
|
|
9637
|
-
|
|
9650
|
+
}, [
|
|
9651
|
+
customOptionElement,
|
|
9652
|
+
dataTestId,
|
|
9653
|
+
rest.getOptionValue
|
|
9654
|
+
]);
|
|
9638
9655
|
const reactSelectProps = {
|
|
9639
9656
|
options,
|
|
9640
9657
|
value,
|