@norges-domstoler/dds-components 14.0.0 → 14.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/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +297 -254
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +224 -178
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3468,8 +3468,7 @@ var import_react19 = require("react");
|
|
|
3468
3468
|
var import_jsx_runtime168 = require("react/jsx-runtime");
|
|
3469
3469
|
var AppShellContext = (0, import_react19.createContext)({
|
|
3470
3470
|
isOpen: false,
|
|
3471
|
-
setOpen: () =>
|
|
3472
|
-
}
|
|
3471
|
+
setOpen: () => null
|
|
3473
3472
|
});
|
|
3474
3473
|
var AppShellContextProvider = ({
|
|
3475
3474
|
children
|
|
@@ -7248,13 +7247,10 @@ function createEmptyChangeEvent(inputElementId) {
|
|
|
7248
7247
|
defaultPrevented: false,
|
|
7249
7248
|
eventPhase: 0,
|
|
7250
7249
|
isTrusted: false,
|
|
7251
|
-
preventDefault: () =>
|
|
7252
|
-
|
|
7253
|
-
stopPropagation: () => {
|
|
7254
|
-
},
|
|
7250
|
+
preventDefault: () => null,
|
|
7251
|
+
stopPropagation: () => null,
|
|
7255
7252
|
nativeEvent: new Event("input"),
|
|
7256
|
-
persist: () =>
|
|
7257
|
-
},
|
|
7253
|
+
persist: () => null,
|
|
7258
7254
|
type: "change",
|
|
7259
7255
|
timeStamp: Date.now(),
|
|
7260
7256
|
isDefaultPrevented: () => false,
|
|
@@ -9766,8 +9762,7 @@ var Tooltip = (0, import_react72.forwardRef)(
|
|
|
9766
9762
|
}
|
|
9767
9763
|
return () => {
|
|
9768
9764
|
if (tooltipRef.current) {
|
|
9769
|
-
window.removeEventListener("scroll", () =>
|
|
9770
|
-
});
|
|
9765
|
+
window.removeEventListener("scroll", () => null);
|
|
9771
9766
|
}
|
|
9772
9767
|
};
|
|
9773
9768
|
}, []);
|
|
@@ -10929,6 +10924,7 @@ var DateInput = (0, import_react81.forwardRef)(
|
|
|
10929
10924
|
InputDiv,
|
|
10930
10925
|
{
|
|
10931
10926
|
...fieldProps,
|
|
10927
|
+
style,
|
|
10932
10928
|
disabled,
|
|
10933
10929
|
componentSize,
|
|
10934
10930
|
ref: internalRef,
|
|
@@ -11012,8 +11008,7 @@ var { popover: popoverTokens } = calendarTokens;
|
|
|
11012
11008
|
var CalendarPopoverContext = (0, import_react83.createContext)({
|
|
11013
11009
|
anchorRef: null,
|
|
11014
11010
|
isOpen: false,
|
|
11015
|
-
onClose: () =>
|
|
11016
|
-
}
|
|
11011
|
+
onClose: () => null
|
|
11017
11012
|
});
|
|
11018
11013
|
var CalendarPopover = ({
|
|
11019
11014
|
children,
|
|
@@ -11142,7 +11137,7 @@ var TimePickerIcon = (0, import_styled_components74.default)(Icon)`
|
|
|
11142
11137
|
width: ${({ $componentSize }) => datePickerTokens.calendarButton[$componentSize].size};
|
|
11143
11138
|
margin-left: -1px; // To align with TextInputs icons
|
|
11144
11139
|
`;
|
|
11145
|
-
function _TimePicker({ componentSize = "medium",
|
|
11140
|
+
function _TimePicker({ componentSize = "medium", ...props }, forwardedRef) {
|
|
11146
11141
|
const ref = (0, import_react86.useRef)(null);
|
|
11147
11142
|
const state = (0, import_datepicker7.useTimeFieldState)({
|
|
11148
11143
|
...props,
|
|
@@ -11640,7 +11635,7 @@ var Tabs = (0, import_react92.forwardRef)((props, ref) => {
|
|
|
11640
11635
|
Tabs.displayName = "Tabs";
|
|
11641
11636
|
|
|
11642
11637
|
// src/components/Tabs/Tab.tsx
|
|
11643
|
-
var
|
|
11638
|
+
var import_react94 = require("react");
|
|
11644
11639
|
var import_styled_components79 = __toESM(require("styled-components"));
|
|
11645
11640
|
|
|
11646
11641
|
// src/components/Tabs/Tabs.tokens.tsx
|
|
@@ -11682,8 +11677,47 @@ var tabsTokens = {
|
|
|
11682
11677
|
panel
|
|
11683
11678
|
};
|
|
11684
11679
|
|
|
11685
|
-
// src/components/Tabs/
|
|
11680
|
+
// src/components/Tabs/TabWidthContext.tsx
|
|
11681
|
+
var import_react93 = require("react");
|
|
11686
11682
|
var import_jsx_runtime244 = require("react/jsx-runtime");
|
|
11683
|
+
var TabContext = (0, import_react93.createContext)(null);
|
|
11684
|
+
function TabWidthContextProvider({
|
|
11685
|
+
children,
|
|
11686
|
+
onChangeWidths
|
|
11687
|
+
}) {
|
|
11688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(
|
|
11689
|
+
TabContext.Provider,
|
|
11690
|
+
{
|
|
11691
|
+
value: {
|
|
11692
|
+
updateWidth: (index, newWidth) => {
|
|
11693
|
+
onChangeWidths((prev) => {
|
|
11694
|
+
const newValue = [...prev];
|
|
11695
|
+
newValue[index] = newWidth;
|
|
11696
|
+
return newValue;
|
|
11697
|
+
});
|
|
11698
|
+
},
|
|
11699
|
+
removeTab: (index) => {
|
|
11700
|
+
onChangeWidths((prev) => {
|
|
11701
|
+
const newValue = [...prev];
|
|
11702
|
+
newValue.splice(index, 1);
|
|
11703
|
+
return newValue;
|
|
11704
|
+
});
|
|
11705
|
+
}
|
|
11706
|
+
},
|
|
11707
|
+
children
|
|
11708
|
+
}
|
|
11709
|
+
);
|
|
11710
|
+
}
|
|
11711
|
+
function useSetTabWidth(index, width) {
|
|
11712
|
+
const context = (0, import_react93.useContext)(TabContext);
|
|
11713
|
+
(0, import_react93.useLayoutEffect)(() => {
|
|
11714
|
+
context == null ? void 0 : context.updateWidth(index, width);
|
|
11715
|
+
return () => context == null ? void 0 : context.removeTab(index);
|
|
11716
|
+
}, [index, width]);
|
|
11717
|
+
}
|
|
11718
|
+
|
|
11719
|
+
// src/components/Tabs/Tab.tsx
|
|
11720
|
+
var import_jsx_runtime245 = require("react/jsx-runtime");
|
|
11687
11721
|
var { tab: tab2 } = tabsTokens;
|
|
11688
11722
|
var Button2 = import_styled_components79.default.button`
|
|
11689
11723
|
${normalizeButton}
|
|
@@ -11728,7 +11762,7 @@ var Button2 = import_styled_components79.default.button`
|
|
|
11728
11762
|
box-shadow: ${tab2.hover.boxShadow};
|
|
11729
11763
|
}
|
|
11730
11764
|
`;
|
|
11731
|
-
var Tab = (0,
|
|
11765
|
+
var Tab = (0, import_react94.forwardRef)((props, ref) => {
|
|
11732
11766
|
const {
|
|
11733
11767
|
active = false,
|
|
11734
11768
|
icon: icon12,
|
|
@@ -11741,12 +11775,14 @@ var Tab = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
11741
11775
|
id,
|
|
11742
11776
|
className,
|
|
11743
11777
|
htmlProps,
|
|
11778
|
+
width = "1fr",
|
|
11744
11779
|
...rest
|
|
11745
11780
|
} = props;
|
|
11746
|
-
|
|
11781
|
+
useSetTabWidth(index, width);
|
|
11782
|
+
const itemRef = (0, import_react94.useRef)(null);
|
|
11747
11783
|
const combinedRef = useCombinedRef(ref, itemRef);
|
|
11748
11784
|
const { tabPanelsRef, setHasTabFocus, tabContentDirection } = useTabsContext();
|
|
11749
|
-
(0,
|
|
11785
|
+
(0, import_react94.useEffect)(() => {
|
|
11750
11786
|
var _a;
|
|
11751
11787
|
if (focus) {
|
|
11752
11788
|
(_a = itemRef.current) == null ? void 0 : _a.focus();
|
|
@@ -11758,7 +11794,7 @@ var Tab = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
11758
11794
|
setHasTabFocus(false);
|
|
11759
11795
|
(_a = tabPanelsRef == null ? void 0 : tabPanelsRef.current) == null ? void 0 : _a.focus();
|
|
11760
11796
|
});
|
|
11761
|
-
const handleSelect = (0,
|
|
11797
|
+
const handleSelect = (0, import_react94.useCallback)(() => {
|
|
11762
11798
|
if (setFocus && index) {
|
|
11763
11799
|
setFocus(index);
|
|
11764
11800
|
}
|
|
@@ -11771,7 +11807,7 @@ var Tab = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
11771
11807
|
handleSelect();
|
|
11772
11808
|
onKeyDown && onKeyDown(e);
|
|
11773
11809
|
};
|
|
11774
|
-
return /* @__PURE__ */ (0,
|
|
11810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(
|
|
11775
11811
|
Button2,
|
|
11776
11812
|
{
|
|
11777
11813
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
@@ -11784,8 +11820,8 @@ var Tab = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
11784
11820
|
onKeyDown: handleOnKeyDown,
|
|
11785
11821
|
tabIndex: focus ? 0 : -1,
|
|
11786
11822
|
children: [
|
|
11787
|
-
icon12 && /* @__PURE__ */ (0,
|
|
11788
|
-
/* @__PURE__ */ (0,
|
|
11823
|
+
icon12 && /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(Icon, { icon: icon12, iconSize: "inherit" }),
|
|
11824
|
+
/* @__PURE__ */ (0, import_jsx_runtime245.jsx)("span", { children })
|
|
11789
11825
|
]
|
|
11790
11826
|
}
|
|
11791
11827
|
);
|
|
@@ -11793,15 +11829,21 @@ var Tab = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
11793
11829
|
Tab.displayName = "Tab";
|
|
11794
11830
|
|
|
11795
11831
|
// src/components/Tabs/TabList.tsx
|
|
11796
|
-
var
|
|
11832
|
+
var import_react95 = require("react");
|
|
11797
11833
|
var import_styled_components80 = __toESM(require("styled-components"));
|
|
11798
|
-
var
|
|
11834
|
+
var import_jsx_runtime246 = require("react/jsx-runtime");
|
|
11799
11835
|
var { tabList: tabList2 } = tabsTokens;
|
|
11836
|
+
var autoFlow = import_styled_components80.css`
|
|
11837
|
+
grid-auto-flow: column;
|
|
11838
|
+
grid-auto-columns: 1fr;
|
|
11839
|
+
`;
|
|
11840
|
+
var templateColumns = (templateColumns2) => import_styled_components80.css`
|
|
11841
|
+
grid-template-columns: ${templateColumns2};
|
|
11842
|
+
`;
|
|
11800
11843
|
var TabRow = import_styled_components80.default.div`
|
|
11801
11844
|
border-bottom: ${tabList2.borderBottom};
|
|
11802
11845
|
display: grid;
|
|
11803
|
-
|
|
11804
|
-
grid-auto-columns: 1fr;
|
|
11846
|
+
${({ $gridTemplateColumns }) => $gridTemplateColumns === "" ? autoFlow : templateColumns($gridTemplateColumns)}
|
|
11805
11847
|
overflow-x: auto;
|
|
11806
11848
|
${scrollbarStyling.webkit}
|
|
11807
11849
|
${scrollbarStyling.firefox}
|
|
@@ -11817,7 +11859,7 @@ var TabRow = import_styled_components80.default.div`
|
|
|
11817
11859
|
outline: none;
|
|
11818
11860
|
}
|
|
11819
11861
|
`;
|
|
11820
|
-
var TabList = (0,
|
|
11862
|
+
var TabList = (0, import_react95.forwardRef)(
|
|
11821
11863
|
({ children, id, onFocus, ...rest }, ref) => {
|
|
11822
11864
|
const {
|
|
11823
11865
|
activeTab,
|
|
@@ -11829,11 +11871,11 @@ var TabList = (0, import_react94.forwardRef)(
|
|
|
11829
11871
|
setHasTabFocus
|
|
11830
11872
|
} = useTabsContext();
|
|
11831
11873
|
const uniqueId = id != null ? id : `${tabsId}-tablist`;
|
|
11832
|
-
const childrenArray =
|
|
11874
|
+
const childrenArray = import_react95.Children.toArray(children).length;
|
|
11833
11875
|
const [focus, setFocus] = useRoveFocus(childrenArray, !hasTabFocus, "row");
|
|
11834
11876
|
const combinedRef = useCombinedRef(ref, tabListRef);
|
|
11835
|
-
const tabListChildren =
|
|
11836
|
-
return (0,
|
|
11877
|
+
const tabListChildren = import_react95.Children.map(children, (child, index) => {
|
|
11878
|
+
return (0, import_react95.isValidElement)(child) && (0, import_react95.cloneElement)(child, {
|
|
11837
11879
|
id: `${tabsId}-tab-${index}`,
|
|
11838
11880
|
"aria-controls": `${tabsId}-panel-${index}`,
|
|
11839
11881
|
active: activeTab === index,
|
|
@@ -11843,6 +11885,7 @@ var TabList = (0, import_react94.forwardRef)(
|
|
|
11843
11885
|
onClick: () => handleTabChange(index)
|
|
11844
11886
|
});
|
|
11845
11887
|
});
|
|
11888
|
+
const [widths, setWidths] = (0, import_react95.useState)([]);
|
|
11846
11889
|
useOnKeyDown("Tab", () => {
|
|
11847
11890
|
var _a;
|
|
11848
11891
|
setHasTabFocus(false);
|
|
@@ -11864,15 +11907,15 @@ var TabList = (0, import_react94.forwardRef)(
|
|
|
11864
11907
|
tabIndex: 0,
|
|
11865
11908
|
onFocus: handleOnFocus
|
|
11866
11909
|
};
|
|
11867
|
-
return /* @__PURE__ */ (0,
|
|
11910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(TabWidthContextProvider, { onChangeWidths: setWidths, children: /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(TabRow, { ...tabListProps, $gridTemplateColumns: widths.join(" "), children: tabListChildren }) });
|
|
11868
11911
|
}
|
|
11869
11912
|
);
|
|
11870
11913
|
TabList.displayName = "TabList";
|
|
11871
11914
|
|
|
11872
11915
|
// src/components/Tabs/TabPanel.tsx
|
|
11873
|
-
var
|
|
11916
|
+
var import_react96 = require("react");
|
|
11874
11917
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11875
|
-
var
|
|
11918
|
+
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
11876
11919
|
var { panel: panel2 } = tabsTokens;
|
|
11877
11920
|
var Panel = import_styled_components81.default.div`
|
|
11878
11921
|
padding: ${panel2.padding};
|
|
@@ -11887,9 +11930,9 @@ var Panel = import_styled_components81.default.div`
|
|
|
11887
11930
|
${focusVisible}
|
|
11888
11931
|
}
|
|
11889
11932
|
`;
|
|
11890
|
-
var TabPanel = (0,
|
|
11933
|
+
var TabPanel = (0, import_react96.forwardRef)(
|
|
11891
11934
|
({ active = false, children, id, className, htmlProps, ...rest }, ref) => {
|
|
11892
|
-
return /* @__PURE__ */ (0,
|
|
11935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(
|
|
11893
11936
|
Panel,
|
|
11894
11937
|
{
|
|
11895
11938
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
@@ -11905,28 +11948,28 @@ var TabPanel = (0, import_react95.forwardRef)(
|
|
|
11905
11948
|
TabPanel.displayName = "TabPanel";
|
|
11906
11949
|
|
|
11907
11950
|
// src/components/Tabs/TabPanels.tsx
|
|
11908
|
-
var
|
|
11909
|
-
var
|
|
11910
|
-
var TabPanels = (0,
|
|
11951
|
+
var import_react97 = require("react");
|
|
11952
|
+
var import_jsx_runtime248 = require("react/jsx-runtime");
|
|
11953
|
+
var TabPanels = (0, import_react97.forwardRef)(
|
|
11911
11954
|
({ children, ...rest }, ref) => {
|
|
11912
11955
|
const { activeTab, tabsId, tabPanelsRef } = useTabsContext();
|
|
11913
11956
|
const combinedRef = useCombinedRef(ref, tabPanelsRef);
|
|
11914
|
-
const panelChildren =
|
|
11957
|
+
const panelChildren = import_react97.Children.map(children, (child, index) => {
|
|
11915
11958
|
const active = index === activeTab;
|
|
11916
|
-
return (0,
|
|
11959
|
+
return (0, import_react97.isValidElement)(child) && (0, import_react97.cloneElement)(child, {
|
|
11917
11960
|
id: `${tabsId}-panel-${index}`,
|
|
11918
11961
|
"aria-labelledby": `${tabsId}-tab-${index}`,
|
|
11919
11962
|
active,
|
|
11920
11963
|
"aria-expanded": active
|
|
11921
11964
|
});
|
|
11922
11965
|
});
|
|
11923
|
-
return /* @__PURE__ */ (0,
|
|
11966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime248.jsx)("div", { ref: combinedRef, ...rest, children: panelChildren });
|
|
11924
11967
|
}
|
|
11925
11968
|
);
|
|
11926
11969
|
TabPanels.displayName = "TabPanels";
|
|
11927
11970
|
|
|
11928
11971
|
// src/components/Tag/Tag.tsx
|
|
11929
|
-
var
|
|
11972
|
+
var import_react98 = require("react");
|
|
11930
11973
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
11931
11974
|
|
|
11932
11975
|
// src/components/Tag/Tag.tokens.tsx
|
|
@@ -11953,7 +11996,7 @@ var tagTokens = {
|
|
|
11953
11996
|
};
|
|
11954
11997
|
|
|
11955
11998
|
// src/components/Tag/Tag.tsx
|
|
11956
|
-
var
|
|
11999
|
+
var import_jsx_runtime249 = require("react/jsx-runtime");
|
|
11957
12000
|
var { wrapper: wrapper8 } = tagTokens;
|
|
11958
12001
|
var Wrapper7 = (0, import_styled_components82.default)(TextOverflowEllipsisWrapper)`
|
|
11959
12002
|
display: inline-flex;
|
|
@@ -11967,7 +12010,7 @@ var Wrapper7 = (0, import_styled_components82.default)(TextOverflowEllipsisWrapp
|
|
|
11967
12010
|
border-color: ${wrapper8.purpose[$purpose].borderColor};
|
|
11968
12011
|
`}
|
|
11969
12012
|
`;
|
|
11970
|
-
var Tag = (0,
|
|
12013
|
+
var Tag = (0, import_react98.forwardRef)((props, ref) => {
|
|
11971
12014
|
const {
|
|
11972
12015
|
text,
|
|
11973
12016
|
purpose = "default",
|
|
@@ -11976,20 +12019,20 @@ var Tag = (0, import_react97.forwardRef)((props, ref) => {
|
|
|
11976
12019
|
htmlProps,
|
|
11977
12020
|
...rest
|
|
11978
12021
|
} = props;
|
|
11979
|
-
return /* @__PURE__ */ (0,
|
|
12022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
11980
12023
|
Wrapper7,
|
|
11981
12024
|
{
|
|
11982
12025
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
11983
12026
|
ref,
|
|
11984
12027
|
$purpose: purpose,
|
|
11985
|
-
children: /* @__PURE__ */ (0,
|
|
12028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(TextOverflowEllipsisInner, { children: text })
|
|
11986
12029
|
}
|
|
11987
12030
|
);
|
|
11988
12031
|
});
|
|
11989
12032
|
Tag.displayName = "Tag";
|
|
11990
12033
|
|
|
11991
12034
|
// src/components/Chip/Chip.tsx
|
|
11992
|
-
var
|
|
12035
|
+
var import_react99 = require("react");
|
|
11993
12036
|
var import_styled_components83 = __toESM(require("styled-components"));
|
|
11994
12037
|
|
|
11995
12038
|
// src/components/Chip/Chip.tokens.tsx
|
|
@@ -12012,7 +12055,7 @@ var chipTokens = {
|
|
|
12012
12055
|
};
|
|
12013
12056
|
|
|
12014
12057
|
// src/components/Chip/Chip.tsx
|
|
12015
|
-
var
|
|
12058
|
+
var import_jsx_runtime250 = require("react/jsx-runtime");
|
|
12016
12059
|
var { container: container17 } = chipTokens;
|
|
12017
12060
|
var Container15 = (0, import_styled_components83.default)(TextOverflowEllipsisWrapper)`
|
|
12018
12061
|
display: flex;
|
|
@@ -12025,23 +12068,23 @@ var Container15 = (0, import_styled_components83.default)(TextOverflowEllipsisWr
|
|
|
12025
12068
|
background-color: ${container17.backgroundColor};
|
|
12026
12069
|
${getFontStyling(typographyType6, true)};
|
|
12027
12070
|
`;
|
|
12028
|
-
var Chip = (0,
|
|
12071
|
+
var Chip = (0, import_react99.forwardRef)((props, ref) => {
|
|
12029
12072
|
const { text, onClose, id, className, htmlProps = {}, ...rest } = props;
|
|
12030
12073
|
const { "aria-label": ariaLabel, ...restHTMLprops } = htmlProps;
|
|
12031
|
-
const [isOpen, setIsOpen] = (0,
|
|
12074
|
+
const [isOpen, setIsOpen] = (0, import_react99.useState)(true);
|
|
12032
12075
|
const onClick = () => {
|
|
12033
12076
|
setIsOpen(false);
|
|
12034
12077
|
onClose && onClose();
|
|
12035
12078
|
};
|
|
12036
|
-
return isOpen ? /* @__PURE__ */ (0,
|
|
12079
|
+
return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)(
|
|
12037
12080
|
Container15,
|
|
12038
12081
|
{
|
|
12039
12082
|
...getBaseHTMLProps(id, className, restHTMLprops, rest),
|
|
12040
12083
|
ref,
|
|
12041
12084
|
as: "div",
|
|
12042
12085
|
children: [
|
|
12043
|
-
/* @__PURE__ */ (0,
|
|
12044
|
-
/* @__PURE__ */ (0,
|
|
12086
|
+
/* @__PURE__ */ (0, import_jsx_runtime250.jsx)(TextOverflowEllipsisInner, { children: text }),
|
|
12087
|
+
/* @__PURE__ */ (0, import_jsx_runtime250.jsx)(
|
|
12045
12088
|
Button,
|
|
12046
12089
|
{
|
|
12047
12090
|
size: "tiny",
|
|
@@ -12059,33 +12102,33 @@ var Chip = (0, import_react98.forwardRef)((props, ref) => {
|
|
|
12059
12102
|
Chip.displayName = "Chip";
|
|
12060
12103
|
|
|
12061
12104
|
// src/components/Chip/ChipGroup.tsx
|
|
12062
|
-
var
|
|
12105
|
+
var import_react100 = require("react");
|
|
12063
12106
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
12064
|
-
var
|
|
12107
|
+
var import_jsx_runtime251 = require("react/jsx-runtime");
|
|
12065
12108
|
var Group2 = import_styled_components84.default.ul`
|
|
12066
12109
|
${removeListStyling}
|
|
12067
12110
|
display: flex;
|
|
12068
12111
|
gap: ${chipTokens.group.gap};
|
|
12069
12112
|
`;
|
|
12070
|
-
var ChipGroup = (0,
|
|
12113
|
+
var ChipGroup = (0, import_react100.forwardRef)(
|
|
12071
12114
|
({ children, ...rest }, ref) => {
|
|
12072
|
-
const childrenArray =
|
|
12073
|
-
const groupChildren = childrenArray.map((item, index) => /* @__PURE__ */ (0,
|
|
12074
|
-
return /* @__PURE__ */ (0,
|
|
12115
|
+
const childrenArray = import_react100.Children.toArray(children);
|
|
12116
|
+
const groupChildren = childrenArray.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime251.jsx)("li", { children: item }, `chip-${index}`));
|
|
12117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime251.jsx)(Group2, { ...rest, ref, children: groupChildren });
|
|
12075
12118
|
}
|
|
12076
12119
|
);
|
|
12077
12120
|
ChipGroup.displayName = "ChipGroup";
|
|
12078
12121
|
|
|
12079
12122
|
// src/components/ToggleBar/ToggleBar.tsx
|
|
12080
|
-
var
|
|
12123
|
+
var import_react102 = require("react");
|
|
12081
12124
|
var import_styled_components85 = __toESM(require("styled-components"));
|
|
12082
12125
|
|
|
12083
12126
|
// src/components/ToggleBar/ToggleBar.context.tsx
|
|
12084
|
-
var
|
|
12085
|
-
var ToggleBarContext = (0,
|
|
12127
|
+
var import_react101 = require("react");
|
|
12128
|
+
var ToggleBarContext = (0, import_react101.createContext)({
|
|
12086
12129
|
size: "medium"
|
|
12087
12130
|
});
|
|
12088
|
-
var useToggleBarContext = () => (0,
|
|
12131
|
+
var useToggleBarContext = () => (0, import_react101.useContext)(ToggleBarContext);
|
|
12089
12132
|
|
|
12090
12133
|
// src/components/ToggleBar/ToggleBar.tokens.tsx
|
|
12091
12134
|
var import_dds_design_tokens51 = require("@norges-domstoler/dds-design-tokens");
|
|
@@ -12194,7 +12237,7 @@ var toggleBarTokens = {
|
|
|
12194
12237
|
};
|
|
12195
12238
|
|
|
12196
12239
|
// src/components/ToggleBar/ToggleBar.tsx
|
|
12197
|
-
var
|
|
12240
|
+
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
12198
12241
|
var OuterContainer4 = import_styled_components85.default.div`
|
|
12199
12242
|
display: flex;
|
|
12200
12243
|
flex-direction: column;
|
|
@@ -12226,15 +12269,15 @@ var ToggleBar = (props) => {
|
|
|
12226
12269
|
id,
|
|
12227
12270
|
...rest
|
|
12228
12271
|
} = props;
|
|
12229
|
-
const generatedId = (0,
|
|
12272
|
+
const generatedId = (0, import_react102.useId)();
|
|
12230
12273
|
const uniqueId = id != null ? id : `${generatedId}-ToggleBar`;
|
|
12231
|
-
const [groupValue, setGroupValue] = (0,
|
|
12274
|
+
const [groupValue, setGroupValue] = (0, import_react102.useState)(value);
|
|
12232
12275
|
const handleChange = combineHandlers(
|
|
12233
12276
|
(e) => setGroupValue(e.target.value),
|
|
12234
12277
|
(e) => onChange && onChange(e, e.target.value)
|
|
12235
12278
|
);
|
|
12236
12279
|
const labelId = label3 && `${uniqueId}-label`;
|
|
12237
|
-
return /* @__PURE__ */ (0,
|
|
12280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(
|
|
12238
12281
|
ToggleBarContext.Provider,
|
|
12239
12282
|
{
|
|
12240
12283
|
value: {
|
|
@@ -12243,7 +12286,7 @@ var ToggleBar = (props) => {
|
|
|
12243
12286
|
name,
|
|
12244
12287
|
value: groupValue
|
|
12245
12288
|
},
|
|
12246
|
-
children: /* @__PURE__ */ (0,
|
|
12289
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)(
|
|
12247
12290
|
OuterContainer4,
|
|
12248
12291
|
{
|
|
12249
12292
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
@@ -12251,8 +12294,8 @@ var ToggleBar = (props) => {
|
|
|
12251
12294
|
"aria-labelledby": labelId != null ? labelId : htmlProps == null ? void 0 : htmlProps["aria-labelledby"],
|
|
12252
12295
|
$width: width,
|
|
12253
12296
|
children: [
|
|
12254
|
-
label3 && /* @__PURE__ */ (0,
|
|
12255
|
-
/* @__PURE__ */ (0,
|
|
12297
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(Typography, { typographyType: "supportingStyleLabel01", id: labelId, children: label3 }),
|
|
12298
|
+
/* @__PURE__ */ (0, import_jsx_runtime252.jsx)(Bar2, { children })
|
|
12256
12299
|
]
|
|
12257
12300
|
}
|
|
12258
12301
|
)
|
|
@@ -12262,7 +12305,7 @@ var ToggleBar = (props) => {
|
|
|
12262
12305
|
ToggleBar.displayName = "ToggleBar";
|
|
12263
12306
|
|
|
12264
12307
|
// src/components/ToggleBar/ToggleRadio.tsx
|
|
12265
|
-
var
|
|
12308
|
+
var import_react103 = require("react");
|
|
12266
12309
|
|
|
12267
12310
|
// src/components/ToggleBar/ToggleRadio.styles.tsx
|
|
12268
12311
|
var import_styled_components86 = __toESM(require("styled-components"));
|
|
@@ -12334,7 +12377,7 @@ var Label3 = import_styled_components86.default.label`
|
|
|
12334
12377
|
`;
|
|
12335
12378
|
|
|
12336
12379
|
// src/components/ToggleBar/ToggleRadio.tsx
|
|
12337
|
-
var
|
|
12380
|
+
var import_jsx_runtime253 = require("react/jsx-runtime");
|
|
12338
12381
|
var calculateChecked = (value, group4, checked) => {
|
|
12339
12382
|
if (typeof checked !== "undefined")
|
|
12340
12383
|
return checked;
|
|
@@ -12346,7 +12389,7 @@ var calculateChecked = (value, group4, checked) => {
|
|
|
12346
12389
|
}
|
|
12347
12390
|
return !!value;
|
|
12348
12391
|
};
|
|
12349
|
-
var ToggleRadio = (0,
|
|
12392
|
+
var ToggleRadio = (0, import_react103.forwardRef)(
|
|
12350
12393
|
(props, ref) => {
|
|
12351
12394
|
const {
|
|
12352
12395
|
value,
|
|
@@ -12360,15 +12403,15 @@ var ToggleRadio = (0, import_react102.forwardRef)(
|
|
|
12360
12403
|
id,
|
|
12361
12404
|
...rest
|
|
12362
12405
|
} = props;
|
|
12363
|
-
const generatedId = (0,
|
|
12406
|
+
const generatedId = (0, import_react103.useId)();
|
|
12364
12407
|
const uniqueId = id != null ? id : `${generatedId}-ToggleRadio`;
|
|
12365
12408
|
const group4 = useToggleBarContext();
|
|
12366
12409
|
const handleChange = (event) => {
|
|
12367
12410
|
onChange && onChange(event);
|
|
12368
12411
|
(group4 == null ? void 0 : group4.onChange) && group4.onChange(event);
|
|
12369
12412
|
};
|
|
12370
|
-
return /* @__PURE__ */ (0,
|
|
12371
|
-
/* @__PURE__ */ (0,
|
|
12413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(Label3, { size: group4.size, htmlFor: uniqueId, children: [
|
|
12414
|
+
/* @__PURE__ */ (0, import_jsx_runtime253.jsx)(
|
|
12372
12415
|
HiddenInput,
|
|
12373
12416
|
{
|
|
12374
12417
|
...getBaseHTMLProps(uniqueId, className, htmlProps, rest),
|
|
@@ -12380,9 +12423,9 @@ var ToggleRadio = (0, import_react102.forwardRef)(
|
|
|
12380
12423
|
checked: calculateChecked(value, group4, checked)
|
|
12381
12424
|
}
|
|
12382
12425
|
),
|
|
12383
|
-
/* @__PURE__ */ (0,
|
|
12384
|
-
icon12 && /* @__PURE__ */ (0,
|
|
12385
|
-
label3 && /* @__PURE__ */ (0,
|
|
12426
|
+
/* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(Content3, { $size: group4.size, $justIcon: !!icon12 && !label3, children: [
|
|
12427
|
+
icon12 && /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(Icon, { icon: icon12, iconSize: "inherit" }),
|
|
12428
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime253.jsx)("span", { children: label3 })
|
|
12386
12429
|
] })
|
|
12387
12430
|
] });
|
|
12388
12431
|
}
|
|
@@ -12487,16 +12530,16 @@ var gridTokens2 = {
|
|
|
12487
12530
|
};
|
|
12488
12531
|
|
|
12489
12532
|
// src/components/Grid/Grid.context.tsx
|
|
12490
|
-
var
|
|
12491
|
-
var GridContext = (0,
|
|
12533
|
+
var import_react104 = require("react");
|
|
12534
|
+
var GridContext = (0, import_react104.createContext)({
|
|
12492
12535
|
screenSize: 3 /* Large */
|
|
12493
12536
|
});
|
|
12494
12537
|
var useGridContext = () => {
|
|
12495
|
-
return (0,
|
|
12538
|
+
return (0, import_react104.useContext)(GridContext);
|
|
12496
12539
|
};
|
|
12497
12540
|
|
|
12498
12541
|
// src/components/Grid/Grid.tsx
|
|
12499
|
-
var
|
|
12542
|
+
var import_jsx_runtime254 = require("react/jsx-runtime");
|
|
12500
12543
|
var getHooksGridStyling = (screenSize, maxWidth, rowGap) => {
|
|
12501
12544
|
const tokens3 = gridTokens2[screenSize].grid;
|
|
12502
12545
|
return {
|
|
@@ -12527,14 +12570,14 @@ var StyledGrid = import_styled_components87.default.div.withConfig({
|
|
|
12527
12570
|
var Grid = (props) => {
|
|
12528
12571
|
const { id, className, children, htmlProps, as, ...rest } = props;
|
|
12529
12572
|
const screenSize = useScreenSize();
|
|
12530
|
-
return /* @__PURE__ */ (0,
|
|
12573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(GridContext.Provider, { value: { screenSize }, children: as === "div" ? /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
|
|
12531
12574
|
StyledGrid,
|
|
12532
12575
|
{
|
|
12533
12576
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
12534
12577
|
screenSize,
|
|
12535
12578
|
children
|
|
12536
12579
|
}
|
|
12537
|
-
) : /* @__PURE__ */ (0,
|
|
12580
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
|
|
12538
12581
|
StyledGrid,
|
|
12539
12582
|
{
|
|
12540
12583
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
@@ -12548,7 +12591,7 @@ Grid.displayName = "Grid";
|
|
|
12548
12591
|
|
|
12549
12592
|
// src/components/Grid/GridChild.tsx
|
|
12550
12593
|
var import_styled_components88 = __toESM(require("styled-components"));
|
|
12551
|
-
var
|
|
12594
|
+
var import_jsx_runtime255 = require("react/jsx-runtime");
|
|
12552
12595
|
var isRelativeGridColumn = (type) => {
|
|
12553
12596
|
return type === "all" || type === "firstHalf" || type === "secondHalf";
|
|
12554
12597
|
};
|
|
@@ -12574,7 +12617,7 @@ var StyledGridChild = import_styled_components88.default.div.withConfig({
|
|
|
12574
12617
|
var GridChild = (props) => {
|
|
12575
12618
|
const { id, className, htmlProps, children, ...rest } = props;
|
|
12576
12619
|
const { screenSize } = useGridContext();
|
|
12577
|
-
return /* @__PURE__ */ (0,
|
|
12620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
|
|
12578
12621
|
StyledGridChild,
|
|
12579
12622
|
{
|
|
12580
12623
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
@@ -12586,17 +12629,17 @@ var GridChild = (props) => {
|
|
|
12586
12629
|
GridChild.displayName = "GridChild";
|
|
12587
12630
|
|
|
12588
12631
|
// src/components/ProgressTracker/ProgressTracker.tsx
|
|
12589
|
-
var
|
|
12632
|
+
var import_react107 = require("react");
|
|
12590
12633
|
var import_styled_components90 = __toESM(require("styled-components"));
|
|
12591
12634
|
|
|
12592
12635
|
// src/components/ProgressTracker/ProgressTracker.context.tsx
|
|
12593
|
-
var
|
|
12594
|
-
var ProgressTrackerContext = (0,
|
|
12636
|
+
var import_react105 = require("react");
|
|
12637
|
+
var ProgressTrackerContext = (0, import_react105.createContext)(
|
|
12595
12638
|
{
|
|
12596
12639
|
activeStep: 0
|
|
12597
12640
|
}
|
|
12598
12641
|
);
|
|
12599
|
-
var useProgressTrackerContext = () => (0,
|
|
12642
|
+
var useProgressTrackerContext = () => (0, import_react105.useContext)(ProgressTrackerContext);
|
|
12600
12643
|
|
|
12601
12644
|
// src/components/ProgressTracker/ProgressTracker.tokens.tsx
|
|
12602
12645
|
var import_dds_design_tokens53 = require("@norges-domstoler/dds-design-tokens");
|
|
@@ -12678,9 +12721,9 @@ var progressTrackerTokens = {
|
|
|
12678
12721
|
};
|
|
12679
12722
|
|
|
12680
12723
|
// src/components/ProgressTracker/ProgressTrackerItem.tsx
|
|
12681
|
-
var
|
|
12724
|
+
var import_react106 = require("react");
|
|
12682
12725
|
var import_styled_components89 = __toESM(require("styled-components"));
|
|
12683
|
-
var
|
|
12726
|
+
var import_jsx_runtime256 = require("react/jsx-runtime");
|
|
12684
12727
|
var toItemState = (active, completed, disabled) => {
|
|
12685
12728
|
if (disabled) {
|
|
12686
12729
|
return "disabled";
|
|
@@ -12812,16 +12855,16 @@ var ProgressTrackerItem = (props) => {
|
|
|
12812
12855
|
const styleProps = {
|
|
12813
12856
|
$state: toItemState(active, completed, disabled)
|
|
12814
12857
|
};
|
|
12815
|
-
const stepNumberContent = (0,
|
|
12858
|
+
const stepNumberContent = (0, import_react106.useMemo)(() => {
|
|
12816
12859
|
if (completed) {
|
|
12817
|
-
return /* @__PURE__ */ (0,
|
|
12860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(Icon, { icon: CheckIcon, iconSize: itemNumber2.iconSize });
|
|
12818
12861
|
}
|
|
12819
12862
|
if (icon12 !== void 0) {
|
|
12820
|
-
return /* @__PURE__ */ (0,
|
|
12863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(Icon, { icon: icon12, iconSize: itemNumber2.iconSize });
|
|
12821
12864
|
}
|
|
12822
12865
|
return index + 1;
|
|
12823
12866
|
}, [completed, icon12, index]);
|
|
12824
|
-
return /* @__PURE__ */ (0,
|
|
12867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(ItemWrapper, { "aria-current": active ? "step" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)(
|
|
12825
12868
|
ItemContentWrapper,
|
|
12826
12869
|
{
|
|
12827
12870
|
...styleProps,
|
|
@@ -12829,9 +12872,9 @@ var ProgressTrackerItem = (props) => {
|
|
|
12829
12872
|
onClick: !disabled && handleStepChange ? () => handleStepChange(index) : void 0,
|
|
12830
12873
|
disabled,
|
|
12831
12874
|
children: [
|
|
12832
|
-
/* @__PURE__ */ (0,
|
|
12833
|
-
/* @__PURE__ */ (0,
|
|
12834
|
-
/* @__PURE__ */ (0,
|
|
12875
|
+
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)(ItemNumber, { ...styleProps, "aria-hidden": true, children: stepNumberContent }),
|
|
12876
|
+
/* @__PURE__ */ (0, import_jsx_runtime256.jsxs)(ItemText, { ...styleProps, children: [
|
|
12877
|
+
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)(VisuallyHidden, { as: "span", children: getVisuallyHiddenText(active, completed, index) }),
|
|
12835
12878
|
children
|
|
12836
12879
|
] })
|
|
12837
12880
|
]
|
|
@@ -12841,7 +12884,7 @@ var ProgressTrackerItem = (props) => {
|
|
|
12841
12884
|
ProgressTrackerItem.displayName = "ProgressTracker.Item";
|
|
12842
12885
|
|
|
12843
12886
|
// src/components/ProgressTracker/ProgressTracker.tsx
|
|
12844
|
-
var
|
|
12887
|
+
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
12845
12888
|
var ItemsWrapper = import_styled_components90.default.ol`
|
|
12846
12889
|
display: flex;
|
|
12847
12890
|
flex-direction: column;
|
|
@@ -12860,7 +12903,7 @@ var ProgressTrackerConnector = import_styled_components90.default.div`
|
|
|
12860
12903
|
${progressTrackerTokens.connector.color};
|
|
12861
12904
|
`;
|
|
12862
12905
|
var ProgressTracker = (() => {
|
|
12863
|
-
const Res = (0,
|
|
12906
|
+
const Res = (0, import_react107.forwardRef)((props, ref) => {
|
|
12864
12907
|
const {
|
|
12865
12908
|
id,
|
|
12866
12909
|
activeStep = 0,
|
|
@@ -12870,12 +12913,12 @@ var ProgressTracker = (() => {
|
|
|
12870
12913
|
htmlProps,
|
|
12871
12914
|
...rest
|
|
12872
12915
|
} = props;
|
|
12873
|
-
const [thisActiveStep, setActiveStep] = (0,
|
|
12916
|
+
const [thisActiveStep, setActiveStep] = (0, import_react107.useState)(activeStep);
|
|
12874
12917
|
const handleChange = (step) => {
|
|
12875
12918
|
setActiveStep(step);
|
|
12876
12919
|
onStepChange && onStepChange(step);
|
|
12877
12920
|
};
|
|
12878
|
-
(0,
|
|
12921
|
+
(0, import_react107.useEffect)(() => {
|
|
12879
12922
|
if (activeStep !== void 0 && activeStep != thisActiveStep) {
|
|
12880
12923
|
setActiveStep(activeStep);
|
|
12881
12924
|
}
|
|
@@ -12884,20 +12927,20 @@ var ProgressTracker = (() => {
|
|
|
12884
12927
|
...getBaseHTMLProps(id, className, htmlProps, rest),
|
|
12885
12928
|
ref
|
|
12886
12929
|
};
|
|
12887
|
-
const steps = (0,
|
|
12930
|
+
const steps = (0, import_react107.useMemo)(() => {
|
|
12888
12931
|
const validChildren = removeInvalidChildren(children);
|
|
12889
12932
|
const itemsWithIndex = passIndexPropToProgressTrackerItem(validChildren);
|
|
12890
12933
|
const itemsWithConnectorsBetween = intersperseItemsWithConnector(itemsWithIndex);
|
|
12891
12934
|
return itemsWithConnectorsBetween;
|
|
12892
12935
|
}, [children]);
|
|
12893
|
-
return /* @__PURE__ */ (0,
|
|
12936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
|
|
12894
12937
|
ProgressTrackerContext.Provider,
|
|
12895
12938
|
{
|
|
12896
12939
|
value: {
|
|
12897
12940
|
activeStep: thisActiveStep,
|
|
12898
12941
|
handleStepChange: handleChange
|
|
12899
12942
|
},
|
|
12900
|
-
children: /* @__PURE__ */ (0,
|
|
12943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)("div", { role: "group", "aria-label": "progress", ...containerProps, children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(ItemsWrapper, { children: steps }) })
|
|
12901
12944
|
}
|
|
12902
12945
|
);
|
|
12903
12946
|
});
|
|
@@ -12906,33 +12949,33 @@ var ProgressTracker = (() => {
|
|
|
12906
12949
|
return Res;
|
|
12907
12950
|
})();
|
|
12908
12951
|
function removeInvalidChildren(children) {
|
|
12909
|
-
return
|
|
12952
|
+
return import_react107.Children.toArray(children).filter(import_react107.isValidElement);
|
|
12910
12953
|
}
|
|
12911
12954
|
function passIndexPropToProgressTrackerItem(children) {
|
|
12912
|
-
return
|
|
12955
|
+
return import_react107.Children.map(
|
|
12913
12956
|
children,
|
|
12914
|
-
(item, index) => (0,
|
|
12957
|
+
(item, index) => (0, import_react107.cloneElement)(item, {
|
|
12915
12958
|
...item.props,
|
|
12916
12959
|
index
|
|
12917
12960
|
})
|
|
12918
12961
|
);
|
|
12919
12962
|
}
|
|
12920
|
-
var intersperseItemsWithConnector = (children) =>
|
|
12963
|
+
var intersperseItemsWithConnector = (children) => import_react107.Children.map(children, (child, index) => {
|
|
12921
12964
|
if (index === 0) {
|
|
12922
12965
|
return child;
|
|
12923
12966
|
}
|
|
12924
|
-
return /* @__PURE__ */ (0,
|
|
12925
|
-
/* @__PURE__ */ (0,
|
|
12967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime257.jsxs)(import_react107.Fragment, { children: [
|
|
12968
|
+
/* @__PURE__ */ (0, import_jsx_runtime257.jsx)(ProgressTrackerConnector, { "aria-hidden": true }),
|
|
12926
12969
|
child
|
|
12927
12970
|
] }, index);
|
|
12928
12971
|
});
|
|
12929
12972
|
|
|
12930
12973
|
// src/components/InlineEdit/InlineEditTextArea.tsx
|
|
12931
|
-
var
|
|
12974
|
+
var import_react110 = require("react");
|
|
12932
12975
|
|
|
12933
12976
|
// src/components/InlineEdit/InlineEdit.tsx
|
|
12934
|
-
var
|
|
12935
|
-
var
|
|
12977
|
+
var import_react108 = require("react");
|
|
12978
|
+
var import_jsx_runtime258 = require("react/jsx-runtime");
|
|
12936
12979
|
var InlineEdit = (props) => {
|
|
12937
12980
|
const {
|
|
12938
12981
|
emptiable,
|
|
@@ -12944,8 +12987,8 @@ var InlineEdit = (props) => {
|
|
|
12944
12987
|
inputRef,
|
|
12945
12988
|
children
|
|
12946
12989
|
} = props;
|
|
12947
|
-
const [editingValue, setEditingValue] = (0,
|
|
12948
|
-
const [isEditing, setIsEditing] = (0,
|
|
12990
|
+
const [editingValue, setEditingValue] = (0, import_react108.useState)(value != null ? value : "");
|
|
12991
|
+
const [isEditing, setIsEditing] = (0, import_react108.useState)(false);
|
|
12949
12992
|
const onChangeHandler = (e) => {
|
|
12950
12993
|
setEditingValue(e.target.value);
|
|
12951
12994
|
onChange && onChange();
|
|
@@ -12972,8 +13015,8 @@ var InlineEdit = (props) => {
|
|
|
12972
13015
|
useOnKeyDown(["Enter"], () => onExitHandler());
|
|
12973
13016
|
useOnKeyDown(["Escape"], () => onExitHandler());
|
|
12974
13017
|
useOnClickOutside(inputRef.current, () => onExitHandler());
|
|
12975
|
-
const inputChild =
|
|
12976
|
-
(0,
|
|
13018
|
+
const inputChild = import_react108.Children.only(
|
|
13019
|
+
(0, import_react108.isValidElement)(children) && (0, import_react108.cloneElement)(children, {
|
|
12977
13020
|
onChange: onChangeHandler,
|
|
12978
13021
|
onBlur: onBlurHandler,
|
|
12979
13022
|
onFocus: onFocusHandler,
|
|
@@ -12982,12 +13025,12 @@ var InlineEdit = (props) => {
|
|
|
12982
13025
|
emptiable
|
|
12983
13026
|
})
|
|
12984
13027
|
);
|
|
12985
|
-
return /* @__PURE__ */ (0,
|
|
13028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_jsx_runtime258.Fragment, { children: inputChild });
|
|
12986
13029
|
};
|
|
12987
13030
|
InlineEdit.displayName = "InlineEdit";
|
|
12988
13031
|
|
|
12989
13032
|
// src/components/InlineEdit/InlineTextArea.tsx
|
|
12990
|
-
var
|
|
13033
|
+
var import_react109 = require("react");
|
|
12991
13034
|
|
|
12992
13035
|
// src/components/InlineEdit/InlineEdit.styles.tsx
|
|
12993
13036
|
var import_styled_components91 = __toESM(require("styled-components"));
|
|
@@ -13059,16 +13102,16 @@ var IconWrapper2 = import_styled_components91.default.span`
|
|
|
13059
13102
|
`;
|
|
13060
13103
|
|
|
13061
13104
|
// src/components/InlineEdit/InlineEdit.utils.tsx
|
|
13062
|
-
var
|
|
13063
|
-
var inlineEditVisuallyHidden = (id, emptiable) => /* @__PURE__ */ (0,
|
|
13105
|
+
var import_jsx_runtime259 = require("react/jsx-runtime");
|
|
13106
|
+
var inlineEditVisuallyHidden = (id, emptiable) => /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)(VisuallyHidden, { id, as: "span", children: [
|
|
13064
13107
|
"Escape, Enter eller Tab for \xE5 lagre.",
|
|
13065
13108
|
" ",
|
|
13066
13109
|
!emptiable && "Inputfeltet er ikke t\xF8mmbar."
|
|
13067
13110
|
] });
|
|
13068
13111
|
|
|
13069
13112
|
// src/components/InlineEdit/InlineTextArea.tsx
|
|
13070
|
-
var
|
|
13071
|
-
var InlineTextArea = (0,
|
|
13113
|
+
var import_jsx_runtime260 = require("react/jsx-runtime");
|
|
13114
|
+
var InlineTextArea = (0, import_react109.forwardRef)((props, ref) => {
|
|
13072
13115
|
const {
|
|
13073
13116
|
id,
|
|
13074
13117
|
error,
|
|
@@ -13080,26 +13123,26 @@ var InlineTextArea = (0, import_react108.forwardRef)((props, ref) => {
|
|
|
13080
13123
|
hideIcon,
|
|
13081
13124
|
...rest
|
|
13082
13125
|
} = props;
|
|
13083
|
-
const genereatedId = (0,
|
|
13126
|
+
const genereatedId = (0, import_react109.useId)();
|
|
13084
13127
|
const uniqueId = id != null ? id : `${genereatedId}-InlineTextArea`;
|
|
13085
13128
|
const hasErrorMessage = !!errorMessage;
|
|
13086
13129
|
const errorMessageId = derivativeIdGenerator(uniqueId, "errorMessage");
|
|
13087
13130
|
const descId = derivativeIdGenerator(uniqueId, "desc");
|
|
13088
|
-
const inputRef = (0,
|
|
13131
|
+
const inputRef = (0, import_react109.useRef)(null);
|
|
13089
13132
|
const combinedRef = useCombinedRef(ref, inputRef);
|
|
13090
|
-
return /* @__PURE__ */ (0,
|
|
13091
|
-
/* @__PURE__ */ (0,
|
|
13092
|
-
!isEditing && !hideIcon && /* @__PURE__ */ (0,
|
|
13133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)(OuterInputContainer, { width, children: [
|
|
13134
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsxs)(InputContainer, { children: [
|
|
13135
|
+
!isEditing && !hideIcon && /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
13093
13136
|
IconWrapper2,
|
|
13094
13137
|
{
|
|
13095
13138
|
onClick: () => {
|
|
13096
13139
|
var _a;
|
|
13097
13140
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
13098
13141
|
},
|
|
13099
|
-
children: /* @__PURE__ */ (0,
|
|
13142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(Icon, { icon: EditIcon, iconSize: "small" })
|
|
13100
13143
|
}
|
|
13101
13144
|
),
|
|
13102
|
-
/* @__PURE__ */ (0,
|
|
13145
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
13103
13146
|
StyledInlineTextArea,
|
|
13104
13147
|
{
|
|
13105
13148
|
...rest,
|
|
@@ -13123,12 +13166,12 @@ var InlineTextArea = (0, import_react108.forwardRef)((props, ref) => {
|
|
|
13123
13166
|
InlineTextArea.displayName = "InlineTextArea";
|
|
13124
13167
|
|
|
13125
13168
|
// src/components/InlineEdit/InlineEditTextArea.tsx
|
|
13126
|
-
var
|
|
13127
|
-
var InlineEditTextArea = (0,
|
|
13169
|
+
var import_jsx_runtime261 = require("react/jsx-runtime");
|
|
13170
|
+
var InlineEditTextArea = (0, import_react110.forwardRef)((props, ref) => {
|
|
13128
13171
|
const { onSetValue, emptiable, value, onFocus, onChange, onBlur, ...rest } = props;
|
|
13129
|
-
const textareaRef = (0,
|
|
13172
|
+
const textareaRef = (0, import_react110.useRef)(null);
|
|
13130
13173
|
const combinedRef = useCombinedRef(ref, textareaRef);
|
|
13131
|
-
return /* @__PURE__ */ (0,
|
|
13174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
13132
13175
|
InlineEdit,
|
|
13133
13176
|
{
|
|
13134
13177
|
onSetValue,
|
|
@@ -13138,18 +13181,18 @@ var InlineEditTextArea = (0, import_react109.forwardRef)((props, ref) => {
|
|
|
13138
13181
|
onFocus,
|
|
13139
13182
|
onChange,
|
|
13140
13183
|
onBlur,
|
|
13141
|
-
children: /* @__PURE__ */ (0,
|
|
13184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(InlineTextArea, { ref: combinedRef, ...rest })
|
|
13142
13185
|
}
|
|
13143
13186
|
);
|
|
13144
13187
|
});
|
|
13145
13188
|
|
|
13146
13189
|
// src/components/InlineEdit/InlineEditInput.tsx
|
|
13147
|
-
var
|
|
13190
|
+
var import_react112 = require("react");
|
|
13148
13191
|
|
|
13149
13192
|
// src/components/InlineEdit/InlineInput.tsx
|
|
13150
|
-
var
|
|
13151
|
-
var
|
|
13152
|
-
var InlineInput = (0,
|
|
13193
|
+
var import_react111 = require("react");
|
|
13194
|
+
var import_jsx_runtime262 = require("react/jsx-runtime");
|
|
13195
|
+
var InlineInput = (0, import_react111.forwardRef)(
|
|
13153
13196
|
(props, ref) => {
|
|
13154
13197
|
const {
|
|
13155
13198
|
id,
|
|
@@ -13162,28 +13205,28 @@ var InlineInput = (0, import_react110.forwardRef)(
|
|
|
13162
13205
|
hideIcon,
|
|
13163
13206
|
...rest
|
|
13164
13207
|
} = props;
|
|
13165
|
-
const genereatedId = (0,
|
|
13208
|
+
const genereatedId = (0, import_react111.useId)();
|
|
13166
13209
|
const uniqueId = id != null ? id : `${genereatedId}-InlineInput`;
|
|
13167
13210
|
const hasErrorMessage = !!errorMessage;
|
|
13168
13211
|
const hasError = !!error;
|
|
13169
13212
|
const hasErrorState = hasError || hasErrorMessage;
|
|
13170
13213
|
const errorMessageId = derivativeIdGenerator(uniqueId, "errorMessage");
|
|
13171
13214
|
const descId = derivativeIdGenerator(uniqueId, "desc");
|
|
13172
|
-
const inputRef = (0,
|
|
13215
|
+
const inputRef = (0, import_react111.useRef)(null);
|
|
13173
13216
|
const combinedRef = useCombinedRef(ref, inputRef);
|
|
13174
|
-
return /* @__PURE__ */ (0,
|
|
13175
|
-
/* @__PURE__ */ (0,
|
|
13176
|
-
!isEditing && !hideIcon && /* @__PURE__ */ (0,
|
|
13217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(OuterInputContainer, { width, children: [
|
|
13218
|
+
/* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(InputContainer, { children: [
|
|
13219
|
+
!isEditing && !hideIcon && /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
13177
13220
|
IconWrapper2,
|
|
13178
13221
|
{
|
|
13179
13222
|
onClick: () => {
|
|
13180
13223
|
var _a;
|
|
13181
13224
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
13182
13225
|
},
|
|
13183
|
-
children: /* @__PURE__ */ (0,
|
|
13226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(Icon, { icon: EditIcon, iconSize: "small" })
|
|
13184
13227
|
}
|
|
13185
13228
|
),
|
|
13186
|
-
/* @__PURE__ */ (0,
|
|
13229
|
+
/* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
13187
13230
|
StyledInlineInput,
|
|
13188
13231
|
{
|
|
13189
13232
|
...rest,
|
|
@@ -13209,12 +13252,12 @@ var InlineInput = (0, import_react110.forwardRef)(
|
|
|
13209
13252
|
InlineInput.displayName = "InlineInput";
|
|
13210
13253
|
|
|
13211
13254
|
// src/components/InlineEdit/InlineEditInput.tsx
|
|
13212
|
-
var
|
|
13213
|
-
var InlineEditInput = (0,
|
|
13255
|
+
var import_jsx_runtime263 = require("react/jsx-runtime");
|
|
13256
|
+
var InlineEditInput = (0, import_react112.forwardRef)((props, ref) => {
|
|
13214
13257
|
const { onSetValue, emptiable, value, onFocus, onChange, onBlur, ...rest } = props;
|
|
13215
|
-
const inputRef = (0,
|
|
13258
|
+
const inputRef = (0, import_react112.useRef)(null);
|
|
13216
13259
|
const combinedRef = useCombinedRef(ref, inputRef);
|
|
13217
|
-
return /* @__PURE__ */ (0,
|
|
13260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
13218
13261
|
InlineEdit,
|
|
13219
13262
|
{
|
|
13220
13263
|
onSetValue,
|
|
@@ -13224,13 +13267,13 @@ var InlineEditInput = (0, import_react111.forwardRef)((props, ref) => {
|
|
|
13224
13267
|
onFocus,
|
|
13225
13268
|
onChange,
|
|
13226
13269
|
onBlur,
|
|
13227
|
-
children: /* @__PURE__ */ (0,
|
|
13270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(InlineInput, { ...rest, ref: combinedRef })
|
|
13228
13271
|
}
|
|
13229
13272
|
);
|
|
13230
13273
|
});
|
|
13231
13274
|
|
|
13232
13275
|
// src/components/TextArea/TextArea.tsx
|
|
13233
|
-
var
|
|
13276
|
+
var import_react113 = require("react");
|
|
13234
13277
|
var import_styled_components92 = __toESM(require("styled-components"));
|
|
13235
13278
|
|
|
13236
13279
|
// src/components/TextArea/TextArea.tokens.tsx
|
|
@@ -13244,7 +13287,7 @@ var textAreaTokens = {
|
|
|
13244
13287
|
};
|
|
13245
13288
|
|
|
13246
13289
|
// src/components/TextArea/TextArea.tsx
|
|
13247
|
-
var
|
|
13290
|
+
var import_jsx_runtime264 = require("react/jsx-runtime");
|
|
13248
13291
|
var defaultWidth5 = "320px";
|
|
13249
13292
|
var { textarea: textarea2 } = textAreaTokens;
|
|
13250
13293
|
var StyledTextArea = (0, import_styled_components92.default)(StatefulInput)`
|
|
@@ -13256,7 +13299,7 @@ var StyledTextArea = (0, import_styled_components92.default)(StatefulInput)`
|
|
|
13256
13299
|
padding-bottom: ${textarea2.paddingBottom};
|
|
13257
13300
|
${getFontStyling(inputTypographyTypes.medium)}
|
|
13258
13301
|
`;
|
|
13259
|
-
var TextArea = (0,
|
|
13302
|
+
var TextArea = (0, import_react113.forwardRef)(
|
|
13260
13303
|
(props, ref) => {
|
|
13261
13304
|
const {
|
|
13262
13305
|
id,
|
|
@@ -13275,14 +13318,14 @@ var TextArea = (0, import_react112.forwardRef)(
|
|
|
13275
13318
|
width = defaultWidth5,
|
|
13276
13319
|
...rest
|
|
13277
13320
|
} = props;
|
|
13278
|
-
const generatedId = (0,
|
|
13321
|
+
const generatedId = (0, import_react113.useId)();
|
|
13279
13322
|
const uniqueId = id != null ? id : `${generatedId}-textArea`;
|
|
13280
|
-
const textAreaRef = (0,
|
|
13323
|
+
const textAreaRef = (0, import_react113.useRef)(null);
|
|
13281
13324
|
const multiRef = useCombinedRef(ref, textAreaRef);
|
|
13282
|
-
const [text, setText] = (0,
|
|
13325
|
+
const [text, setText] = (0, import_react113.useState)(
|
|
13283
13326
|
getDefaultText(value, defaultValue)
|
|
13284
13327
|
);
|
|
13285
|
-
(0,
|
|
13328
|
+
(0, import_react113.useEffect)(() => {
|
|
13286
13329
|
if (textAreaRef == null ? void 0 : textAreaRef.current) {
|
|
13287
13330
|
textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight + 2}px`;
|
|
13288
13331
|
}
|
|
@@ -13321,9 +13364,9 @@ var TextArea = (0, import_react112.forwardRef)(
|
|
|
13321
13364
|
"aria-invalid": hasErrorMessage ? true : void 0,
|
|
13322
13365
|
...rest
|
|
13323
13366
|
};
|
|
13324
|
-
return /* @__PURE__ */ (0,
|
|
13325
|
-
hasLabel && /* @__PURE__ */ (0,
|
|
13326
|
-
/* @__PURE__ */ (0,
|
|
13367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(OuterInputContainer, { ...containerProps, children: [
|
|
13368
|
+
hasLabel && /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Label, { showRequiredStyling, htmlFor: uniqueId, children: label3 }),
|
|
13369
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(StyledTextArea, { ...textAreaProps, as: "textarea" }),
|
|
13327
13370
|
renderInputMessage(tip, tipId, errorMessage, errorMessageId)
|
|
13328
13371
|
] });
|
|
13329
13372
|
}
|
|
@@ -13331,7 +13374,7 @@ var TextArea = (0, import_react112.forwardRef)(
|
|
|
13331
13374
|
TextArea.displayName = "TextArea";
|
|
13332
13375
|
|
|
13333
13376
|
// src/components/SplitButton/SplitButton.tsx
|
|
13334
|
-
var
|
|
13377
|
+
var import_react114 = require("react");
|
|
13335
13378
|
var import_styled_components93 = __toESM(require("styled-components"));
|
|
13336
13379
|
|
|
13337
13380
|
// src/components/SplitButton/SplitButton.tokens.ts
|
|
@@ -13346,7 +13389,7 @@ var tokens2 = {
|
|
|
13346
13389
|
};
|
|
13347
13390
|
|
|
13348
13391
|
// src/components/SplitButton/SplitButton.tsx
|
|
13349
|
-
var
|
|
13392
|
+
var import_jsx_runtime265 = require("react/jsx-runtime");
|
|
13350
13393
|
var Container16 = import_styled_components93.default.div`
|
|
13351
13394
|
display: flex;
|
|
13352
13395
|
`;
|
|
@@ -13377,7 +13420,7 @@ var OptionButton = (0, import_styled_components93.default)(Button)`
|
|
|
13377
13420
|
${(props) => props.purpose === "primary" && `border-left: ${tokens2.mainButton.primary.borderLeft}`};
|
|
13378
13421
|
}
|
|
13379
13422
|
`;
|
|
13380
|
-
var SplitButton = (0,
|
|
13423
|
+
var SplitButton = (0, import_react114.forwardRef)(
|
|
13381
13424
|
(props, ref) => {
|
|
13382
13425
|
const {
|
|
13383
13426
|
size: size2,
|
|
@@ -13385,14 +13428,14 @@ var SplitButton = (0, import_react113.forwardRef)(
|
|
|
13385
13428
|
secondaryActions,
|
|
13386
13429
|
purpose = "primary"
|
|
13387
13430
|
} = props;
|
|
13388
|
-
const [isOpen, setIsOpen] = (0,
|
|
13431
|
+
const [isOpen, setIsOpen] = (0, import_react114.useState)(false);
|
|
13389
13432
|
const buttonStyleProps = {
|
|
13390
13433
|
appearance: "filled",
|
|
13391
13434
|
purpose,
|
|
13392
13435
|
size: size2
|
|
13393
13436
|
};
|
|
13394
|
-
return /* @__PURE__ */ (0,
|
|
13395
|
-
/* @__PURE__ */ (0,
|
|
13437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(Container16, { ref, children: [
|
|
13438
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
13396
13439
|
MainButton,
|
|
13397
13440
|
{
|
|
13398
13441
|
...buttonStyleProps,
|
|
@@ -13400,8 +13443,8 @@ var SplitButton = (0, import_react113.forwardRef)(
|
|
|
13400
13443
|
iconPosition: "left"
|
|
13401
13444
|
}
|
|
13402
13445
|
),
|
|
13403
|
-
/* @__PURE__ */ (0,
|
|
13404
|
-
/* @__PURE__ */ (0,
|
|
13446
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(OverflowMenuGroup, { onToggle: () => setIsOpen(!isOpen), children: [
|
|
13447
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
13405
13448
|
OptionButton,
|
|
13406
13449
|
{
|
|
13407
13450
|
...buttonStyleProps,
|
|
@@ -13410,7 +13453,7 @@ var SplitButton = (0, import_react113.forwardRef)(
|
|
|
13410
13453
|
purpose
|
|
13411
13454
|
}
|
|
13412
13455
|
),
|
|
13413
|
-
/* @__PURE__ */ (0,
|
|
13456
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(OverflowMenu, { items: secondaryActions, placement: "bottom-end" })
|
|
13414
13457
|
] })
|
|
13415
13458
|
] });
|
|
13416
13459
|
}
|
|
@@ -13418,7 +13461,7 @@ var SplitButton = (0, import_react113.forwardRef)(
|
|
|
13418
13461
|
SplitButton.displayName = "SplitButton";
|
|
13419
13462
|
|
|
13420
13463
|
// src/components/Stack/Stack.tsx
|
|
13421
|
-
var
|
|
13464
|
+
var import_react115 = require("react");
|
|
13422
13465
|
var import_styled_components94 = __toESM(require("styled-components"));
|
|
13423
13466
|
|
|
13424
13467
|
// src/components/Stack/Stack.tokens.tsx
|
|
@@ -13443,7 +13486,7 @@ var stackTokens = {
|
|
|
13443
13486
|
};
|
|
13444
13487
|
|
|
13445
13488
|
// src/components/Stack/Stack.tsx
|
|
13446
|
-
var
|
|
13489
|
+
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
13447
13490
|
var Stack = import_styled_components94.default.div.withConfig({
|
|
13448
13491
|
shouldForwardProp: (prop) => {
|
|
13449
13492
|
const styleOnlyProps = [
|
|
@@ -13473,8 +13516,8 @@ Stack.defaultProps = {
|
|
|
13473
13516
|
align: "center",
|
|
13474
13517
|
justify: "flex-start"
|
|
13475
13518
|
};
|
|
13476
|
-
var HStack = (0,
|
|
13477
|
-
({ id, className, htmlProps, ...rest }, ref) => /* @__PURE__ */ (0,
|
|
13519
|
+
var HStack = (0, import_react115.forwardRef)(
|
|
13520
|
+
({ id, className, htmlProps, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
13478
13521
|
Stack,
|
|
13479
13522
|
{
|
|
13480
13523
|
direction: "horizontal",
|
|
@@ -13484,8 +13527,8 @@ var HStack = (0, import_react114.forwardRef)(
|
|
|
13484
13527
|
)
|
|
13485
13528
|
);
|
|
13486
13529
|
HStack.displayName = "HStack";
|
|
13487
|
-
var VStack = (0,
|
|
13488
|
-
({ id, className, htmlProps, ...rest }, ref) => /* @__PURE__ */ (0,
|
|
13530
|
+
var VStack = (0, import_react115.forwardRef)(
|
|
13531
|
+
({ id, className, htmlProps, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
13489
13532
|
Stack,
|
|
13490
13533
|
{
|
|
13491
13534
|
direction: "vertical",
|
|
@@ -13497,7 +13540,7 @@ var VStack = (0, import_react114.forwardRef)(
|
|
|
13497
13540
|
VStack.displayName = "VStack";
|
|
13498
13541
|
|
|
13499
13542
|
// src/components/FileUploader/FileUploader.tsx
|
|
13500
|
-
var
|
|
13543
|
+
var import_react117 = require("react");
|
|
13501
13544
|
var import_styled_components97 = __toESM(require("styled-components"));
|
|
13502
13545
|
|
|
13503
13546
|
// src/components/FileUploader/ErrorList.tsx
|
|
@@ -13533,7 +13576,7 @@ var errorsTokens = {
|
|
|
13533
13576
|
};
|
|
13534
13577
|
|
|
13535
13578
|
// src/components/FileUploader/ErrorList.tsx
|
|
13536
|
-
var
|
|
13579
|
+
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
13537
13580
|
var MessageContainer2 = import_styled_components95.default.div`
|
|
13538
13581
|
display: flex;
|
|
13539
13582
|
flex-direction: column;
|
|
@@ -13544,8 +13587,8 @@ var ErrorList = (props) => {
|
|
|
13544
13587
|
if (errors.length < 1) {
|
|
13545
13588
|
return null;
|
|
13546
13589
|
}
|
|
13547
|
-
return /* @__PURE__ */ (0,
|
|
13548
|
-
return /* @__PURE__ */ (0,
|
|
13590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(MessageContainer2, { children: errors.map(({ id, message: message2 }) => {
|
|
13591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
13549
13592
|
InputMessage,
|
|
13550
13593
|
{
|
|
13551
13594
|
id,
|
|
@@ -13559,7 +13602,7 @@ var ErrorList = (props) => {
|
|
|
13559
13602
|
|
|
13560
13603
|
// src/components/FileUploader/File.tsx
|
|
13561
13604
|
var import_styled_components96 = __toESM(require("styled-components"));
|
|
13562
|
-
var
|
|
13605
|
+
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
13563
13606
|
var FileWrapper = import_styled_components96.default.li``;
|
|
13564
13607
|
var FileNameWrapper = import_styled_components96.default.span`
|
|
13565
13608
|
word-break: break-all;
|
|
@@ -13585,10 +13628,10 @@ var File = (props) => {
|
|
|
13585
13628
|
id: derivativeIdGenerator(parentId, `file-${index}-error-${errorIndex}`),
|
|
13586
13629
|
message: e
|
|
13587
13630
|
}));
|
|
13588
|
-
return /* @__PURE__ */ (0,
|
|
13589
|
-
/* @__PURE__ */ (0,
|
|
13590
|
-
/* @__PURE__ */ (0,
|
|
13591
|
-
/* @__PURE__ */ (0,
|
|
13631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(FileWrapper, { children: [
|
|
13632
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(FileElement, { ...props, children: [
|
|
13633
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(FileNameWrapper, { children: stateFile.file.name }),
|
|
13634
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
13592
13635
|
RemoveFileButton,
|
|
13593
13636
|
{
|
|
13594
13637
|
size: "small",
|
|
@@ -13608,12 +13651,12 @@ var File = (props) => {
|
|
|
13608
13651
|
}
|
|
13609
13652
|
)
|
|
13610
13653
|
] }),
|
|
13611
|
-
/* @__PURE__ */ (0,
|
|
13654
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(ErrorList, { errors: errorsList })
|
|
13612
13655
|
] }, stateFile.file.name);
|
|
13613
13656
|
};
|
|
13614
13657
|
|
|
13615
13658
|
// src/components/FileUploader/useFileUploader.ts
|
|
13616
|
-
var
|
|
13659
|
+
var import_react116 = require("react");
|
|
13617
13660
|
|
|
13618
13661
|
// src/components/FileUploader/fileUploaderReducer.ts
|
|
13619
13662
|
var fileUploaderReducer = (state, action) => {
|
|
@@ -13696,18 +13739,18 @@ var useFileUploader = (props) => {
|
|
|
13696
13739
|
disabled,
|
|
13697
13740
|
errorMessage
|
|
13698
13741
|
} = props;
|
|
13699
|
-
const rootRef = (0,
|
|
13700
|
-
const inputRef = (0,
|
|
13701
|
-
const buttonRef = (0,
|
|
13742
|
+
const rootRef = (0, import_react116.useRef)(null);
|
|
13743
|
+
const inputRef = (0, import_react116.useRef)(null);
|
|
13744
|
+
const buttonRef = (0, import_react116.useRef)(null);
|
|
13702
13745
|
const isControlled = !!value;
|
|
13703
|
-
const initialFileUploaderFiles = (0,
|
|
13746
|
+
const initialFileUploaderFiles = (0, import_react116.useMemo)(
|
|
13704
13747
|
() => (initialFiles != null ? initialFiles : []).map((f) => ({
|
|
13705
13748
|
file: f,
|
|
13706
13749
|
errors: []
|
|
13707
13750
|
})),
|
|
13708
13751
|
[initialFiles]
|
|
13709
13752
|
);
|
|
13710
|
-
const [state, dispatch] = (0,
|
|
13753
|
+
const [state, dispatch] = (0, import_react116.useReducer)(fileUploaderReducer, {
|
|
13711
13754
|
files: initialFileUploaderFiles,
|
|
13712
13755
|
isFocused: false,
|
|
13713
13756
|
isFileDialogActive: false,
|
|
@@ -13719,7 +13762,7 @@ var useFileUploader = (props) => {
|
|
|
13719
13762
|
)
|
|
13720
13763
|
});
|
|
13721
13764
|
const { files: stateFiles } = state;
|
|
13722
|
-
(0,
|
|
13765
|
+
(0, import_react116.useEffect)(() => {
|
|
13723
13766
|
if (isControlled) {
|
|
13724
13767
|
const files = value.map((file) => {
|
|
13725
13768
|
const accepted2 = isFileAccepted(file, accept);
|
|
@@ -13734,18 +13777,18 @@ var useFileUploader = (props) => {
|
|
|
13734
13777
|
});
|
|
13735
13778
|
}
|
|
13736
13779
|
}, [value, isControlled, accept, dispatch]);
|
|
13737
|
-
(0,
|
|
13780
|
+
(0, import_react116.useEffect)(() => {
|
|
13738
13781
|
dispatch({
|
|
13739
13782
|
type: "setRootErrors",
|
|
13740
13783
|
payload: calcRootErrors(stateFiles, maxFiles, errorMessage)
|
|
13741
13784
|
});
|
|
13742
13785
|
}, [dispatch, stateFiles, maxFiles, errorMessage]);
|
|
13743
|
-
const onRootFocus = (0,
|
|
13786
|
+
const onRootFocus = (0, import_react116.useCallback)(
|
|
13744
13787
|
() => dispatch({ type: "focus" }),
|
|
13745
13788
|
[dispatch]
|
|
13746
13789
|
);
|
|
13747
|
-
const onRootBlur = (0,
|
|
13748
|
-
const onRootDragEnter = (0,
|
|
13790
|
+
const onRootBlur = (0, import_react116.useCallback)(() => dispatch({ type: "blur" }), [dispatch]);
|
|
13791
|
+
const onRootDragEnter = (0, import_react116.useCallback)(
|
|
13749
13792
|
async (evt) => {
|
|
13750
13793
|
preventDefaults(evt);
|
|
13751
13794
|
if (isEventWithFiles(evt)) {
|
|
@@ -13758,7 +13801,7 @@ var useFileUploader = (props) => {
|
|
|
13758
13801
|
},
|
|
13759
13802
|
[dispatch, accept, maxFiles]
|
|
13760
13803
|
);
|
|
13761
|
-
const onRootDragOver = (0,
|
|
13804
|
+
const onRootDragOver = (0, import_react116.useCallback)((evt) => {
|
|
13762
13805
|
preventDefaults(evt);
|
|
13763
13806
|
const hasFiles = isEventWithFiles(evt);
|
|
13764
13807
|
if (hasFiles && evt.dataTransfer) {
|
|
@@ -13768,7 +13811,7 @@ var useFileUploader = (props) => {
|
|
|
13768
13811
|
}
|
|
13769
13812
|
}
|
|
13770
13813
|
}, []);
|
|
13771
|
-
const onRootDragLeave = (0,
|
|
13814
|
+
const onRootDragLeave = (0, import_react116.useCallback)(
|
|
13772
13815
|
(evt) => {
|
|
13773
13816
|
preventDefaults(evt);
|
|
13774
13817
|
if (evt.currentTarget.contains(evt.relatedTarget))
|
|
@@ -13777,7 +13820,7 @@ var useFileUploader = (props) => {
|
|
|
13777
13820
|
},
|
|
13778
13821
|
[dispatch]
|
|
13779
13822
|
);
|
|
13780
|
-
const setFiles = (0,
|
|
13823
|
+
const setFiles = (0, import_react116.useCallback)(
|
|
13781
13824
|
async (evt) => {
|
|
13782
13825
|
evt.preventDefault();
|
|
13783
13826
|
if (isEventWithFiles(evt)) {
|
|
@@ -13809,13 +13852,13 @@ var useFileUploader = (props) => {
|
|
|
13809
13852
|
dispatch
|
|
13810
13853
|
]
|
|
13811
13854
|
);
|
|
13812
|
-
const openFileDialog = (0,
|
|
13855
|
+
const openFileDialog = (0, import_react116.useCallback)(() => {
|
|
13813
13856
|
if (inputRef.current) {
|
|
13814
13857
|
inputRef.current.value = "";
|
|
13815
13858
|
inputRef.current.click();
|
|
13816
13859
|
}
|
|
13817
13860
|
}, [inputRef]);
|
|
13818
|
-
const removeFile = (0,
|
|
13861
|
+
const removeFile = (0, import_react116.useCallback)(
|
|
13819
13862
|
(file) => {
|
|
13820
13863
|
const newFiles = [...stateFiles];
|
|
13821
13864
|
newFiles.splice(stateFiles.indexOf(file), 1);
|
|
@@ -13829,7 +13872,7 @@ var useFileUploader = (props) => {
|
|
|
13829
13872
|
},
|
|
13830
13873
|
[stateFiles, isControlled, maxFiles, errorMessage, onChange, dispatch]
|
|
13831
13874
|
);
|
|
13832
|
-
const getRootProps = (0,
|
|
13875
|
+
const getRootProps = (0, import_react116.useCallback)(
|
|
13833
13876
|
() => ({
|
|
13834
13877
|
onBlur: onRootBlur,
|
|
13835
13878
|
onFocus: onRootFocus,
|
|
@@ -13851,14 +13894,14 @@ var useFileUploader = (props) => {
|
|
|
13851
13894
|
disabled
|
|
13852
13895
|
]
|
|
13853
13896
|
);
|
|
13854
|
-
const getButtonProps = (0,
|
|
13897
|
+
const getButtonProps = (0, import_react116.useCallback)(
|
|
13855
13898
|
() => ({
|
|
13856
13899
|
onClick: openFileDialog,
|
|
13857
13900
|
ref: buttonRef
|
|
13858
13901
|
}),
|
|
13859
13902
|
[openFileDialog, buttonRef]
|
|
13860
13903
|
);
|
|
13861
|
-
const getInputProps = (0,
|
|
13904
|
+
const getInputProps = (0, import_react116.useCallback)(
|
|
13862
13905
|
() => ({
|
|
13863
13906
|
type: "file",
|
|
13864
13907
|
style: { display: "none" },
|
|
@@ -13881,7 +13924,7 @@ var useFileUploader = (props) => {
|
|
|
13881
13924
|
};
|
|
13882
13925
|
|
|
13883
13926
|
// src/components/FileUploader/FileUploader.tsx
|
|
13884
|
-
var
|
|
13927
|
+
var import_jsx_runtime269 = require("react/jsx-runtime");
|
|
13885
13928
|
var defaultWidth6 = "320px";
|
|
13886
13929
|
var Wrapper8 = import_styled_components97.default.div`
|
|
13887
13930
|
width: ${({ width }) => width ? width : defaultWidth6};
|
|
@@ -13918,7 +13961,7 @@ var FileUploader = (props) => {
|
|
|
13918
13961
|
width,
|
|
13919
13962
|
errorMessage
|
|
13920
13963
|
} = props;
|
|
13921
|
-
const generatedId = (0,
|
|
13964
|
+
const generatedId = (0, import_react117.useId)();
|
|
13922
13965
|
const uniqueId = id != null ? id : `${generatedId}-fileUploader`;
|
|
13923
13966
|
const {
|
|
13924
13967
|
state: { files: stateFiles, isDragActive, rootErrors },
|
|
@@ -13941,7 +13984,7 @@ var FileUploader = (props) => {
|
|
|
13941
13984
|
const hasRootErrors = rootErrors.length > 0;
|
|
13942
13985
|
const showRequiredMarker = required;
|
|
13943
13986
|
const tipId = derivativeIdGenerator(uniqueId, "tip");
|
|
13944
|
-
const fileListElements = stateFiles.map((stateFile, index) => /* @__PURE__ */ (0,
|
|
13987
|
+
const fileListElements = stateFiles.map((stateFile, index) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
|
|
13945
13988
|
File,
|
|
13946
13989
|
{
|
|
13947
13990
|
parentId: uniqueId,
|
|
@@ -13956,21 +13999,21 @@ var FileUploader = (props) => {
|
|
|
13956
13999
|
id: derivativeIdGenerator(uniqueId, `error-${index}`),
|
|
13957
14000
|
message: e
|
|
13958
14001
|
}));
|
|
13959
|
-
return /* @__PURE__ */ (0,
|
|
13960
|
-
hasLabel && /* @__PURE__ */ (0,
|
|
13961
|
-
hasTip && /* @__PURE__ */ (0,
|
|
13962
|
-
/* @__PURE__ */ (0,
|
|
14002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(Wrapper8, { width, children: [
|
|
14003
|
+
hasLabel && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Label, { showRequiredStyling: showRequiredMarker, htmlFor: uniqueId, children: label3 }),
|
|
14004
|
+
hasTip && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(InputMessage, { id: tipId, message: tip, messageType: "tip" }),
|
|
14005
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
|
|
13963
14006
|
Root,
|
|
13964
14007
|
{
|
|
13965
14008
|
...getRootProps(),
|
|
13966
14009
|
$isDragActive: isDragActive,
|
|
13967
14010
|
$hasRootErrors: hasRootErrors,
|
|
13968
14011
|
children: [
|
|
13969
|
-
/* @__PURE__ */ (0,
|
|
14012
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(FileUploaderInput, { ...getInputProps() }),
|
|
13970
14013
|
"Dra og slipp filer her eller",
|
|
13971
14014
|
" ",
|
|
13972
|
-
/* @__PURE__ */ (0,
|
|
13973
|
-
/* @__PURE__ */ (0,
|
|
14015
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(VisuallyHidden, { as: "span", children: "velg fil med p\xE5f\xF8lgende knapp" }),
|
|
14016
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
|
|
13974
14017
|
Button,
|
|
13975
14018
|
{
|
|
13976
14019
|
...getButtonProps(),
|
|
@@ -13993,8 +14036,8 @@ var FileUploader = (props) => {
|
|
|
13993
14036
|
]
|
|
13994
14037
|
}
|
|
13995
14038
|
),
|
|
13996
|
-
/* @__PURE__ */ (0,
|
|
13997
|
-
/* @__PURE__ */ (0,
|
|
14039
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(ErrorList, { errors: rootErrorsList }),
|
|
14040
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(FileListElement, { children: fileListElements })
|
|
13998
14041
|
] });
|
|
13999
14042
|
};
|
|
14000
14043
|
FileUploader.displayName = "FileUploader";
|
|
@@ -14002,7 +14045,7 @@ FileUploader.displayName = "FileUploader";
|
|
|
14002
14045
|
// src/components/EmptyContent/EmptyContent.tsx
|
|
14003
14046
|
var import_dds_design_tokens59 = require("@norges-domstoler/dds-design-tokens");
|
|
14004
14047
|
var import_styled_components98 = __toESM(require("styled-components"));
|
|
14005
|
-
var
|
|
14048
|
+
var import_jsx_runtime270 = require("react/jsx-runtime");
|
|
14006
14049
|
var { colors: colors35, spacing: spacing39 } = import_dds_design_tokens59.ddsBaseTokens;
|
|
14007
14050
|
var StyledEmptyContent = import_styled_components98.default.div`
|
|
14008
14051
|
display: flex;
|
|
@@ -14022,15 +14065,15 @@ var StyledEmptyContentText = import_styled_components98.default.div`
|
|
|
14022
14065
|
gap: ${spacing39.SizesDdsSpacingX1};
|
|
14023
14066
|
`;
|
|
14024
14067
|
function EmptyContent({ title: title3, message: message2, ...rest }) {
|
|
14025
|
-
return /* @__PURE__ */ (0,
|
|
14026
|
-
title3 && /* @__PURE__ */ (0,
|
|
14027
|
-
/* @__PURE__ */ (0,
|
|
14068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(StyledEmptyContent, { ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(StyledEmptyContentText, { children: [
|
|
14069
|
+
title3 && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Typography, { typographyType: "headingSans02", children: title3 }),
|
|
14070
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Typography, { typographyType: "bodySans02", children: message2 })
|
|
14028
14071
|
] }) });
|
|
14029
14072
|
}
|
|
14030
14073
|
EmptyContent.displayName = "EmptyContent";
|
|
14031
14074
|
|
|
14032
14075
|
// src/components/BackLink/BackLink.tsx
|
|
14033
|
-
var
|
|
14076
|
+
var import_react118 = require("react");
|
|
14034
14077
|
var import_styled_components99 = __toESM(require("styled-components"));
|
|
14035
14078
|
|
|
14036
14079
|
// src/components/BackLink/BackLink.tokens.tsx
|
|
@@ -14048,7 +14091,7 @@ var backLinkTokens = {
|
|
|
14048
14091
|
};
|
|
14049
14092
|
|
|
14050
14093
|
// src/components/BackLink/BackLink.tsx
|
|
14051
|
-
var
|
|
14094
|
+
var import_jsx_runtime271 = require("react/jsx-runtime");
|
|
14052
14095
|
var Nav2 = (0, import_styled_components99.default)("nav")`
|
|
14053
14096
|
align-items: center;
|
|
14054
14097
|
display: flex;
|
|
@@ -14057,21 +14100,21 @@ var Nav2 = (0, import_styled_components99.default)("nav")`
|
|
|
14057
14100
|
var StyledIcon4 = (0, import_styled_components99.default)(Icon)`
|
|
14058
14101
|
color: ${backLinkTokens.icon.color};
|
|
14059
14102
|
`;
|
|
14060
|
-
var BackLink = (0,
|
|
14061
|
-
return /* @__PURE__ */ (0,
|
|
14062
|
-
/* @__PURE__ */ (0,
|
|
14063
|
-
/* @__PURE__ */ (0,
|
|
14103
|
+
var BackLink = (0, import_react118.forwardRef)((props, ref) => {
|
|
14104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(Nav2, { ref, children: [
|
|
14105
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(StyledIcon4, { icon: icons_exports.ArrowLeftIcon, iconSize: "small" }),
|
|
14106
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Typography, { typographyType: "a", href: props.href, children: props.label })
|
|
14064
14107
|
] });
|
|
14065
14108
|
});
|
|
14066
14109
|
BackLink.displayName = "BackLink";
|
|
14067
14110
|
|
|
14068
14111
|
// src/components/Feedback/Feedback.tsx
|
|
14069
|
-
var
|
|
14112
|
+
var import_react119 = require("react");
|
|
14070
14113
|
|
|
14071
14114
|
// src/components/Feedback/RatingComponent.tsx
|
|
14072
14115
|
var import_styled_components100 = __toESM(require("styled-components"));
|
|
14073
14116
|
var import_dds_design_tokens61 = require("@norges-domstoler/dds-design-tokens");
|
|
14074
|
-
var
|
|
14117
|
+
var import_jsx_runtime272 = require("react/jsx-runtime");
|
|
14075
14118
|
var RatingContainer = import_styled_components100.default.div`
|
|
14076
14119
|
display: flex;
|
|
14077
14120
|
gap: ${import_dds_design_tokens61.ddsBaseTokens.spacing.SizesDdsSpacingX1};
|
|
@@ -14092,10 +14135,10 @@ var RatingComponent = ({
|
|
|
14092
14135
|
thumbDownTooltip,
|
|
14093
14136
|
handleRatingChange
|
|
14094
14137
|
}) => {
|
|
14095
|
-
return /* @__PURE__ */ (0,
|
|
14096
|
-
/* @__PURE__ */ (0,
|
|
14097
|
-
loading ? /* @__PURE__ */ (0,
|
|
14098
|
-
/* @__PURE__ */ (0,
|
|
14138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(RatingContainer, { $layout: layout, children: [
|
|
14139
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Label, { children: ratingLabel }),
|
|
14140
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Spinner, { tooltip: "Laster opp tilbakemelding ..." }) : /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(HStack, { gap: "x1", children: [
|
|
14141
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Tooltip, { text: thumbUpTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
14099
14142
|
RatingButton,
|
|
14100
14143
|
{
|
|
14101
14144
|
htmlProps: { "aria-label": thumbUpTooltip },
|
|
@@ -14105,7 +14148,7 @@ var RatingComponent = ({
|
|
|
14105
14148
|
size: "large"
|
|
14106
14149
|
}
|
|
14107
14150
|
) }),
|
|
14108
|
-
/* @__PURE__ */ (0,
|
|
14151
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Tooltip, { text: thumbDownTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
14109
14152
|
RatingButton,
|
|
14110
14153
|
{
|
|
14111
14154
|
htmlProps: { "aria-label": thumbDownTooltip },
|
|
@@ -14122,7 +14165,7 @@ var RatingComponent = ({
|
|
|
14122
14165
|
// src/components/Feedback/CommentComponent.tsx
|
|
14123
14166
|
var import_styled_components101 = __toESM(require("styled-components"));
|
|
14124
14167
|
var import_dds_design_tokens62 = require("@norges-domstoler/dds-design-tokens");
|
|
14125
|
-
var
|
|
14168
|
+
var import_jsx_runtime273 = require("react/jsx-runtime");
|
|
14126
14169
|
var IconLabelSpan = import_styled_components101.default.span`
|
|
14127
14170
|
display: inline-flex;
|
|
14128
14171
|
align-items: center;
|
|
@@ -14138,21 +14181,21 @@ var CommentComponent = ({
|
|
|
14138
14181
|
handleSubmit,
|
|
14139
14182
|
handleFeedbackTextChange
|
|
14140
14183
|
}) => {
|
|
14141
|
-
return /* @__PURE__ */ (0,
|
|
14142
|
-
/* @__PURE__ */ (0,
|
|
14143
|
-
/* @__PURE__ */ (0,
|
|
14184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(VStack, { gap: "x1", align: "flex-start", children: [
|
|
14185
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(IconLabelSpan, { children: [
|
|
14186
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
14144
14187
|
Icon,
|
|
14145
14188
|
{
|
|
14146
14189
|
icon: rating === "positive" ? ThumbupFilled : ThumbdownFilled,
|
|
14147
14190
|
color: import_dds_design_tokens62.ddsBaseTokens.colors.DdsColorInteractiveBase
|
|
14148
14191
|
}
|
|
14149
14192
|
),
|
|
14150
|
-
/* @__PURE__ */ (0,
|
|
14193
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(Paragraph, { children: [
|
|
14151
14194
|
ratingSubmittedTitle,
|
|
14152
14195
|
" "
|
|
14153
14196
|
] })
|
|
14154
14197
|
] }),
|
|
14155
|
-
/* @__PURE__ */ (0,
|
|
14198
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
14156
14199
|
TextArea,
|
|
14157
14200
|
{
|
|
14158
14201
|
value: feedbackText,
|
|
@@ -14161,7 +14204,7 @@ var CommentComponent = ({
|
|
|
14161
14204
|
tip: "Ikke send inn personopplysninger eller annen sensitiv informasjon"
|
|
14162
14205
|
}
|
|
14163
14206
|
),
|
|
14164
|
-
/* @__PURE__ */ (0,
|
|
14207
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
14165
14208
|
Button,
|
|
14166
14209
|
{
|
|
14167
14210
|
purpose: "secondary",
|
|
@@ -14175,7 +14218,7 @@ var CommentComponent = ({
|
|
|
14175
14218
|
};
|
|
14176
14219
|
|
|
14177
14220
|
// src/components/Feedback/Feedback.tsx
|
|
14178
|
-
var
|
|
14221
|
+
var import_jsx_runtime274 = require("react/jsx-runtime");
|
|
14179
14222
|
var Feedback = ({
|
|
14180
14223
|
layout = "vertical",
|
|
14181
14224
|
ratingLabel = "Hva syns du om tjenesten?",
|
|
@@ -14194,16 +14237,16 @@ var Feedback = ({
|
|
|
14194
14237
|
onFeedbackTextChange,
|
|
14195
14238
|
onSubmit
|
|
14196
14239
|
}) => {
|
|
14197
|
-
const [rating, setRating] = (0,
|
|
14198
|
-
const [feedbackText, setFeedbackText] = (0,
|
|
14199
|
-
const [isFeedbackSubmitted, setIsFeedbackSubmitted] = (0,
|
|
14200
|
-
(0,
|
|
14240
|
+
const [rating, setRating] = (0, import_react119.useState)(null);
|
|
14241
|
+
const [feedbackText, setFeedbackText] = (0, import_react119.useState)();
|
|
14242
|
+
const [isFeedbackSubmitted, setIsFeedbackSubmitted] = (0, import_react119.useState)(false);
|
|
14243
|
+
(0, import_react119.useEffect)(() => {
|
|
14201
14244
|
ratingProp !== void 0 && setRating(ratingProp);
|
|
14202
14245
|
}, [ratingProp]);
|
|
14203
|
-
(0,
|
|
14246
|
+
(0, import_react119.useEffect)(() => {
|
|
14204
14247
|
feedbackTextProp !== void 0 && setFeedbackText(feedbackTextProp);
|
|
14205
14248
|
}, [feedbackTextProp]);
|
|
14206
|
-
(0,
|
|
14249
|
+
(0, import_react119.useEffect)(() => {
|
|
14207
14250
|
isSubmittedProp !== void 0 && setIsFeedbackSubmitted(isSubmittedProp);
|
|
14208
14251
|
}, [isSubmittedProp]);
|
|
14209
14252
|
const handleRatingChange = (newRating) => {
|
|
@@ -14220,7 +14263,7 @@ var Feedback = ({
|
|
|
14220
14263
|
isSubmittedProp === void 0 && setIsFeedbackSubmitted(true);
|
|
14221
14264
|
};
|
|
14222
14265
|
if (rating === null && !isFeedbackSubmitted) {
|
|
14223
|
-
return /* @__PURE__ */ (0,
|
|
14266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
14224
14267
|
RatingComponent,
|
|
14225
14268
|
{
|
|
14226
14269
|
layout,
|
|
@@ -14233,7 +14276,7 @@ var Feedback = ({
|
|
|
14233
14276
|
);
|
|
14234
14277
|
}
|
|
14235
14278
|
if (!feedbackTextAreaExcluded && !isFeedbackSubmitted) {
|
|
14236
|
-
return /* @__PURE__ */ (0,
|
|
14279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
14237
14280
|
CommentComponent,
|
|
14238
14281
|
{
|
|
14239
14282
|
rating,
|
|
@@ -14247,7 +14290,7 @@ var Feedback = ({
|
|
|
14247
14290
|
}
|
|
14248
14291
|
);
|
|
14249
14292
|
}
|
|
14250
|
-
return /* @__PURE__ */ (0,
|
|
14293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Paragraph, { children: submittedTitle });
|
|
14251
14294
|
};
|
|
14252
14295
|
// Annotate the CommonJS export names for ESM import in node:
|
|
14253
14296
|
0 && (module.exports = {
|