@norges-domstoler/dds-components 18.0.0 → 18.2.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.css +163 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +102 -24
- package/dist/index.d.ts +102 -24
- package/dist/index.js +202 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +215 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -19
package/dist/index.mjs
CHANGED
|
@@ -2568,7 +2568,7 @@ import {
|
|
|
2568
2568
|
useState as useState3
|
|
2569
2569
|
} from "react";
|
|
2570
2570
|
var isKeyboardEvent = (e) => e.key !== void 0;
|
|
2571
|
-
function useRoveFocus(size2, active, direction = "column") {
|
|
2571
|
+
function useRoveFocus(size2, active, direction = "column", noWrap) {
|
|
2572
2572
|
const [currentFocusIndex, setCurrentFocusIndex] = useState3(-1);
|
|
2573
2573
|
const nextKey = direction === "row" ? "ArrowRight" : "ArrowDown";
|
|
2574
2574
|
const previousKey = direction === "row" ? "ArrowLeft" : "ArrowUp";
|
|
@@ -2577,16 +2577,19 @@ function useRoveFocus(size2, active, direction = "column") {
|
|
|
2577
2577
|
if (!size2 || !isKeyboardEvent(e)) return;
|
|
2578
2578
|
if (e.key === nextKey) {
|
|
2579
2579
|
e.preventDefault();
|
|
2580
|
-
setCurrentFocusIndex((prev) =>
|
|
2580
|
+
setCurrentFocusIndex((prev) => {
|
|
2581
|
+
if (prev === size2 - 1) return noWrap ? prev : 0;
|
|
2582
|
+
return prev + 1;
|
|
2583
|
+
});
|
|
2581
2584
|
} else if (e.key === previousKey) {
|
|
2582
2585
|
e.preventDefault();
|
|
2583
2586
|
setCurrentFocusIndex((prev) => {
|
|
2584
|
-
if (prev === -1 || prev === 0) return size2 - 1;
|
|
2587
|
+
if (prev === -1 || prev === 0) return noWrap ? prev : size2 - 1;
|
|
2585
2588
|
return prev - 1;
|
|
2586
2589
|
});
|
|
2587
2590
|
}
|
|
2588
2591
|
},
|
|
2589
|
-
[size2, setCurrentFocusIndex]
|
|
2592
|
+
[size2, setCurrentFocusIndex, direction, noWrap]
|
|
2590
2593
|
);
|
|
2591
2594
|
useEffect8(() => {
|
|
2592
2595
|
if (!active) {
|
|
@@ -6691,7 +6694,15 @@ var FileUploader = (props) => {
|
|
|
6691
6694
|
style: { ...style, width },
|
|
6692
6695
|
...rest,
|
|
6693
6696
|
children: [
|
|
6694
|
-
hasLabel && /* @__PURE__ */ jsx238(
|
|
6697
|
+
hasLabel && /* @__PURE__ */ jsx238(
|
|
6698
|
+
Label,
|
|
6699
|
+
{
|
|
6700
|
+
id: labelId,
|
|
6701
|
+
showRequiredStyling: showRequiredMarker,
|
|
6702
|
+
htmlFor: inputId,
|
|
6703
|
+
children: label
|
|
6704
|
+
}
|
|
6705
|
+
),
|
|
6695
6706
|
hasTip && /* @__PURE__ */ jsx238(InputMessage, { id: tipId, message: tip, messageType: "tip" }),
|
|
6696
6707
|
withDragAndDrop ? /* @__PURE__ */ jsxs50(
|
|
6697
6708
|
"div",
|
|
@@ -8012,7 +8023,11 @@ function PaginationGenerator(pagesAmount, activePage) {
|
|
|
8012
8023
|
}
|
|
8013
8024
|
|
|
8014
8025
|
// src/components/Select/Select.tsx
|
|
8015
|
-
import {
|
|
8026
|
+
import {
|
|
8027
|
+
forwardRef as forwardRef75,
|
|
8028
|
+
useContext as useContext11,
|
|
8029
|
+
useId as useId15
|
|
8030
|
+
} from "react";
|
|
8016
8031
|
import {
|
|
8017
8032
|
default as ReactSelect
|
|
8018
8033
|
} from "react-select";
|
|
@@ -10700,12 +10715,17 @@ var useRadioButtonGroup = () => {
|
|
|
10700
10715
|
|
|
10701
10716
|
// src/components/SelectionControl/RadioButton/RadioButton.tsx
|
|
10702
10717
|
import { jsx as jsx281, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
10703
|
-
var
|
|
10718
|
+
var getIsChecked = ({
|
|
10719
|
+
value,
|
|
10720
|
+
group,
|
|
10721
|
+
checked
|
|
10722
|
+
}) => {
|
|
10723
|
+
if (checked !== void 0) return checked;
|
|
10704
10724
|
if (typeof value !== "undefined" && value !== null && group) {
|
|
10705
10725
|
if (typeof value === "number") {
|
|
10706
|
-
return value === Number(group
|
|
10726
|
+
return value === Number(group.value);
|
|
10707
10727
|
}
|
|
10708
|
-
return value ===
|
|
10728
|
+
return value === group.value;
|
|
10709
10729
|
}
|
|
10710
10730
|
return !!value;
|
|
10711
10731
|
};
|
|
@@ -10739,7 +10759,7 @@ var RadioButton = forwardRef87(
|
|
|
10739
10759
|
const radioButtonGroup = useRadioButtonGroup();
|
|
10740
10760
|
const handleChange = (event) => {
|
|
10741
10761
|
onChange && onChange(event);
|
|
10742
|
-
radioButtonGroup == null ? void 0 : radioButtonGroup.onChange(event);
|
|
10762
|
+
radioButtonGroup == null ? void 0 : radioButtonGroup.onChange(event, event.target.value);
|
|
10743
10763
|
};
|
|
10744
10764
|
const describedByIds = [];
|
|
10745
10765
|
if (radioButtonGroup == null ? void 0 : radioButtonGroup.errorMessageId)
|
|
@@ -10748,6 +10768,7 @@ var RadioButton = forwardRef87(
|
|
|
10748
10768
|
const isReadOnly = readOnly || (radioButtonGroup == null ? void 0 : radioButtonGroup.readOnly);
|
|
10749
10769
|
const isDisabled = disabled || (radioButtonGroup == null ? void 0 : radioButtonGroup.disabled);
|
|
10750
10770
|
const hasError = error || (radioButtonGroup == null ? void 0 : radioButtonGroup.error);
|
|
10771
|
+
const isChecked = getIsChecked({ value, group: radioButtonGroup, checked });
|
|
10751
10772
|
return /* @__PURE__ */ jsxs71(
|
|
10752
10773
|
Label2,
|
|
10753
10774
|
{
|
|
@@ -10768,7 +10789,7 @@ var RadioButton = forwardRef87(
|
|
|
10768
10789
|
name: name != null ? name : radioButtonGroup == null ? void 0 : radioButtonGroup.name,
|
|
10769
10790
|
disabled: isDisabled,
|
|
10770
10791
|
required: required || !!(radioButtonGroup == null ? void 0 : radioButtonGroup.required),
|
|
10771
|
-
checked:
|
|
10792
|
+
checked: isChecked,
|
|
10772
10793
|
onChange: readOnlyChangeHandler(isReadOnly, handleChange),
|
|
10773
10794
|
value,
|
|
10774
10795
|
"aria-describedby": describedByIds.length > 0 ? describedByIds.join(" ") : void 0,
|
|
@@ -10819,6 +10840,7 @@ var RadioButtonGroupInner = (props, ref) => {
|
|
|
10819
10840
|
readOnly = false,
|
|
10820
10841
|
direction = "row",
|
|
10821
10842
|
value,
|
|
10843
|
+
defaultValue,
|
|
10822
10844
|
children,
|
|
10823
10845
|
required = false,
|
|
10824
10846
|
onChange,
|
|
@@ -10828,13 +10850,22 @@ var RadioButtonGroupInner = (props, ref) => {
|
|
|
10828
10850
|
...rest
|
|
10829
10851
|
} = props;
|
|
10830
10852
|
const { "aria-required": ariaRequired = false } = htmlProps;
|
|
10831
|
-
const [
|
|
10853
|
+
const [uncontrolledValue, setUncontrolledValue] = useState25(
|
|
10854
|
+
defaultValue
|
|
10855
|
+
);
|
|
10832
10856
|
const generatedId = useId24();
|
|
10833
10857
|
const uniqueGroupId = groupId != null ? groupId : `${generatedId}-radioButtonGroup`;
|
|
10834
|
-
const
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10858
|
+
const isControlled = value !== void 0;
|
|
10859
|
+
const groupValue = isControlled ? value : uncontrolledValue;
|
|
10860
|
+
const handleChange = (e) => {
|
|
10861
|
+
const newValue = e.target.value;
|
|
10862
|
+
if (!isControlled) {
|
|
10863
|
+
setUncontrolledValue(newValue);
|
|
10864
|
+
}
|
|
10865
|
+
if (onChange) {
|
|
10866
|
+
onChange(e, newValue);
|
|
10867
|
+
}
|
|
10868
|
+
};
|
|
10838
10869
|
const hasErrorMessage = !!errorMessage;
|
|
10839
10870
|
const showRequiredMarker = required || ariaRequired;
|
|
10840
10871
|
const tipId = tip && `${uniqueGroupId}-tip`;
|
|
@@ -10842,6 +10873,7 @@ var RadioButtonGroupInner = (props, ref) => {
|
|
|
10842
10873
|
const contextProps = {
|
|
10843
10874
|
name,
|
|
10844
10875
|
disabled,
|
|
10876
|
+
defaultValue,
|
|
10845
10877
|
error: hasErrorMessage,
|
|
10846
10878
|
errorMessageId,
|
|
10847
10879
|
required,
|
|
@@ -11254,11 +11286,19 @@ var Table = forwardRef98(
|
|
|
11254
11286
|
Table.displayName = "Table";
|
|
11255
11287
|
|
|
11256
11288
|
// src/components/Table/normal/TableWrapper.tsx
|
|
11257
|
-
import {
|
|
11289
|
+
import {
|
|
11290
|
+
useContext as useContext18,
|
|
11291
|
+
useEffect as useEffect28,
|
|
11292
|
+
useRef as useRef34,
|
|
11293
|
+
useState as useState27
|
|
11294
|
+
} from "react";
|
|
11258
11295
|
import { jsx as jsx293 } from "react/jsx-runtime";
|
|
11259
11296
|
var TableWrapper = ({ className, ...rest }) => {
|
|
11297
|
+
const themeContext = useContext18(ThemeContext);
|
|
11298
|
+
const container = themeContext == null ? void 0 : themeContext.el;
|
|
11299
|
+
const containerWidth = container ? container.clientWidth : 0;
|
|
11260
11300
|
const [overflowX, setOverflowX] = useState27(false);
|
|
11261
|
-
const [
|
|
11301
|
+
const [themeContainerWidth, setThemeContainerWidth] = useState27(containerWidth);
|
|
11262
11302
|
function isOverflowingX(event) {
|
|
11263
11303
|
return event.offsetWidth < event.scrollWidth;
|
|
11264
11304
|
}
|
|
@@ -11269,10 +11309,10 @@ var TableWrapper = ({ className, ...rest }) => {
|
|
|
11269
11309
|
return;
|
|
11270
11310
|
}
|
|
11271
11311
|
setOverflowX(false);
|
|
11272
|
-
}, [
|
|
11312
|
+
}, [themeContainerWidth]);
|
|
11273
11313
|
useEffect28(() => {
|
|
11274
11314
|
function handleResize() {
|
|
11275
|
-
|
|
11315
|
+
setThemeContainerWidth(containerWidth);
|
|
11276
11316
|
}
|
|
11277
11317
|
window.addEventListener("resize", handleResize);
|
|
11278
11318
|
return () => window.removeEventListener("resize", handleResize);
|
|
@@ -11445,7 +11485,7 @@ import {
|
|
|
11445
11485
|
} from "react";
|
|
11446
11486
|
|
|
11447
11487
|
// src/components/Tabs/Tabs.context.tsx
|
|
11448
|
-
import { createContext as createContext11, useContext as
|
|
11488
|
+
import { createContext as createContext11, useContext as useContext19 } from "react";
|
|
11449
11489
|
var TabsContext = createContext11({
|
|
11450
11490
|
activeTab: 0,
|
|
11451
11491
|
tabsId: "",
|
|
@@ -11456,7 +11496,7 @@ var TabsContext = createContext11({
|
|
|
11456
11496
|
setHasTabFocus: () => null,
|
|
11457
11497
|
tabContentDirection: "row"
|
|
11458
11498
|
});
|
|
11459
|
-
var useTabsContext = () =>
|
|
11499
|
+
var useTabsContext = () => useContext19(TabsContext);
|
|
11460
11500
|
|
|
11461
11501
|
// src/components/Tabs/Tabs.module.css
|
|
11462
11502
|
var Tabs_default = {
|
|
@@ -11547,7 +11587,7 @@ import {
|
|
|
11547
11587
|
// src/components/Tabs/TabWidthContext.tsx
|
|
11548
11588
|
import {
|
|
11549
11589
|
createContext as createContext12,
|
|
11550
|
-
useContext as
|
|
11590
|
+
useContext as useContext20,
|
|
11551
11591
|
useLayoutEffect as useLayoutEffect3
|
|
11552
11592
|
} from "react";
|
|
11553
11593
|
import { jsx as jsx297 } from "react/jsx-runtime";
|
|
@@ -11580,7 +11620,7 @@ function TabWidthContextProvider({
|
|
|
11580
11620
|
);
|
|
11581
11621
|
}
|
|
11582
11622
|
function useSetTabWidth(index, width) {
|
|
11583
|
-
const context =
|
|
11623
|
+
const context = useContext20(TabContext);
|
|
11584
11624
|
useLayoutEffect3(() => {
|
|
11585
11625
|
context == null ? void 0 : context.updateWidth(index, width);
|
|
11586
11626
|
return () => context == null ? void 0 : context.removeTab(index);
|
|
@@ -12113,15 +12153,132 @@ var TextInput = forwardRef107(
|
|
|
12113
12153
|
);
|
|
12114
12154
|
TextInput.displayName = "TextInput";
|
|
12115
12155
|
|
|
12156
|
+
// src/components/Toggle/Toggle.tsx
|
|
12157
|
+
import {
|
|
12158
|
+
forwardRef as forwardRef108,
|
|
12159
|
+
useId as useId27
|
|
12160
|
+
} from "react";
|
|
12161
|
+
|
|
12162
|
+
// src/components/Toggle/Toggle.module.css
|
|
12163
|
+
var Toggle_default = {
|
|
12164
|
+
label: "Toggle_label",
|
|
12165
|
+
track: "Toggle_track",
|
|
12166
|
+
thumb: "Toggle_thumb",
|
|
12167
|
+
checkmark: "Toggle_checkmark",
|
|
12168
|
+
"labeltext--readonly": "Toggle_labeltext--readonly",
|
|
12169
|
+
"icon--read-only": "Toggle_icon--read-only",
|
|
12170
|
+
medium: "Toggle_medium",
|
|
12171
|
+
large: "Toggle_large",
|
|
12172
|
+
"label--is-loading": "Toggle_label--is-loading",
|
|
12173
|
+
"label--disabled": "Toggle_label--disabled",
|
|
12174
|
+
"label--read-only": "Toggle_label--read-only"
|
|
12175
|
+
};
|
|
12176
|
+
|
|
12177
|
+
// src/components/Toggle/Toggle.tsx
|
|
12178
|
+
import { jsx as jsx304, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
12179
|
+
var Toggle = forwardRef108(
|
|
12180
|
+
({
|
|
12181
|
+
id,
|
|
12182
|
+
children,
|
|
12183
|
+
size: size2 = "medium",
|
|
12184
|
+
checked: checkedProp,
|
|
12185
|
+
defaultChecked,
|
|
12186
|
+
onChange,
|
|
12187
|
+
disabled,
|
|
12188
|
+
readOnly,
|
|
12189
|
+
isLoading,
|
|
12190
|
+
className,
|
|
12191
|
+
htmlProps = {},
|
|
12192
|
+
...rest
|
|
12193
|
+
}, ref) => {
|
|
12194
|
+
const generatedId = useId27();
|
|
12195
|
+
const uniqueId = id != null ? id : `${generatedId}-toggle`;
|
|
12196
|
+
const iconSize = size2 === "large" ? "medium" : "small";
|
|
12197
|
+
const [checked, setChecked] = useControllableState({
|
|
12198
|
+
value: checkedProp,
|
|
12199
|
+
defaultValue: defaultChecked != null ? defaultChecked : false,
|
|
12200
|
+
onChange
|
|
12201
|
+
});
|
|
12202
|
+
return /* @__PURE__ */ jsxs79(
|
|
12203
|
+
"label",
|
|
12204
|
+
{
|
|
12205
|
+
htmlFor: uniqueId,
|
|
12206
|
+
className: cn(
|
|
12207
|
+
Toggle_default.label,
|
|
12208
|
+
Toggle_default[size2],
|
|
12209
|
+
isLoading && Toggle_default["label--is-loading"],
|
|
12210
|
+
disabled && Toggle_default["label--disabled"],
|
|
12211
|
+
readOnly && Toggle_default["label--read-only"]
|
|
12212
|
+
),
|
|
12213
|
+
children: [
|
|
12214
|
+
/* @__PURE__ */ jsx304(
|
|
12215
|
+
"input",
|
|
12216
|
+
{
|
|
12217
|
+
...getBaseHTMLProps(
|
|
12218
|
+
uniqueId,
|
|
12219
|
+
cn(
|
|
12220
|
+
className,
|
|
12221
|
+
focus_default["focusable-sibling"],
|
|
12222
|
+
utilStyles_default["hide-input"]
|
|
12223
|
+
),
|
|
12224
|
+
htmlProps,
|
|
12225
|
+
rest
|
|
12226
|
+
),
|
|
12227
|
+
ref,
|
|
12228
|
+
type: "checkbox",
|
|
12229
|
+
checked,
|
|
12230
|
+
onChange: (e) => setChecked(e.target.checked),
|
|
12231
|
+
disabled,
|
|
12232
|
+
"aria-disabled": isLoading,
|
|
12233
|
+
"aria-readonly": readOnly,
|
|
12234
|
+
onKeyDown: readOnlyKeyDownHandler(
|
|
12235
|
+
"selectionControl",
|
|
12236
|
+
readOnly || isLoading,
|
|
12237
|
+
htmlProps.onKeyDown
|
|
12238
|
+
),
|
|
12239
|
+
onClick: readOnlyClickHandler(
|
|
12240
|
+
readOnly || isLoading,
|
|
12241
|
+
htmlProps.onClick
|
|
12242
|
+
)
|
|
12243
|
+
}
|
|
12244
|
+
),
|
|
12245
|
+
/* @__PURE__ */ jsx304("span", { className: cn(Toggle_default.track, focus_default["focus-styled-sibling"]), children: /* @__PURE__ */ jsx304("span", { className: Toggle_default.thumb, children: isLoading ? /* @__PURE__ */ jsx304(Spinner, { size: `var(--dds-icon-size-${size2})` }) : /* @__PURE__ */ jsx304(
|
|
12246
|
+
Icon,
|
|
12247
|
+
{
|
|
12248
|
+
className: Toggle_default.checkmark,
|
|
12249
|
+
icon: CheckIcon,
|
|
12250
|
+
iconSize
|
|
12251
|
+
}
|
|
12252
|
+
) }) }),
|
|
12253
|
+
/* @__PURE__ */ jsxs79("span", { className: cn(readOnly && Toggle_default["labeltext--readonly"]), children: [
|
|
12254
|
+
readOnly && /* @__PURE__ */ jsx304(
|
|
12255
|
+
Icon,
|
|
12256
|
+
{
|
|
12257
|
+
icon: LockIcon,
|
|
12258
|
+
iconSize: "small",
|
|
12259
|
+
className: Toggle_default["icon--read-only"]
|
|
12260
|
+
}
|
|
12261
|
+
),
|
|
12262
|
+
children,
|
|
12263
|
+
" ",
|
|
12264
|
+
isLoading && /* @__PURE__ */ jsx304(VisuallyHidden, { as: "span", children: "Innlastning p\xE5g\xE5r" })
|
|
12265
|
+
] })
|
|
12266
|
+
]
|
|
12267
|
+
}
|
|
12268
|
+
);
|
|
12269
|
+
}
|
|
12270
|
+
);
|
|
12271
|
+
Toggle.displayName = "Toggle";
|
|
12272
|
+
|
|
12116
12273
|
// src/components/ToggleBar/ToggleBar.tsx
|
|
12117
|
-
import { useId as
|
|
12274
|
+
import { useId as useId28, useState as useState32 } from "react";
|
|
12118
12275
|
|
|
12119
12276
|
// src/components/ToggleBar/ToggleBar.context.tsx
|
|
12120
|
-
import { createContext as createContext13, useContext as
|
|
12277
|
+
import { createContext as createContext13, useContext as useContext21 } from "react";
|
|
12121
12278
|
var ToggleBarContext = createContext13({
|
|
12122
12279
|
size: "medium"
|
|
12123
12280
|
});
|
|
12124
|
-
var useToggleBarContext = () =>
|
|
12281
|
+
var useToggleBarContext = () => useContext21(ToggleBarContext);
|
|
12125
12282
|
|
|
12126
12283
|
// src/components/ToggleBar/ToggleBar.module.css
|
|
12127
12284
|
var ToggleBar_default = {
|
|
@@ -12140,7 +12297,7 @@ var ToggleBar_default = {
|
|
|
12140
12297
|
};
|
|
12141
12298
|
|
|
12142
12299
|
// src/components/ToggleBar/ToggleBar.tsx
|
|
12143
|
-
import { jsx as
|
|
12300
|
+
import { jsx as jsx305, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
12144
12301
|
var ToggleBar = (props) => {
|
|
12145
12302
|
const {
|
|
12146
12303
|
children,
|
|
@@ -12155,7 +12312,7 @@ var ToggleBar = (props) => {
|
|
|
12155
12312
|
id,
|
|
12156
12313
|
...rest
|
|
12157
12314
|
} = props;
|
|
12158
|
-
const generatedId =
|
|
12315
|
+
const generatedId = useId28();
|
|
12159
12316
|
const uniqueId = id != null ? id : `${generatedId}-ToggleBar`;
|
|
12160
12317
|
const [groupValue, setGroupValue] = useState32(value);
|
|
12161
12318
|
const handleChange = combineHandlers(
|
|
@@ -12163,7 +12320,7 @@ var ToggleBar = (props) => {
|
|
|
12163
12320
|
(e) => onChange && onChange(e, e.target.value)
|
|
12164
12321
|
);
|
|
12165
12322
|
const labelId = label && `${uniqueId}-label`;
|
|
12166
|
-
return /* @__PURE__ */
|
|
12323
|
+
return /* @__PURE__ */ jsx305(
|
|
12167
12324
|
ToggleBarContext.Provider,
|
|
12168
12325
|
{
|
|
12169
12326
|
value: {
|
|
@@ -12172,7 +12329,7 @@ var ToggleBar = (props) => {
|
|
|
12172
12329
|
name,
|
|
12173
12330
|
value: groupValue
|
|
12174
12331
|
},
|
|
12175
|
-
children: /* @__PURE__ */
|
|
12332
|
+
children: /* @__PURE__ */ jsxs80(
|
|
12176
12333
|
"div",
|
|
12177
12334
|
{
|
|
12178
12335
|
...getBaseHTMLProps(
|
|
@@ -12185,8 +12342,8 @@ var ToggleBar = (props) => {
|
|
|
12185
12342
|
role: "radiogroup",
|
|
12186
12343
|
"aria-labelledby": labelId != null ? labelId : htmlProps == null ? void 0 : htmlProps["aria-labelledby"],
|
|
12187
12344
|
children: [
|
|
12188
|
-
label && /* @__PURE__ */
|
|
12189
|
-
/* @__PURE__ */
|
|
12345
|
+
label && /* @__PURE__ */ jsx305(Typography, { id: labelId, as: "span", typographyType: "labelMedium", children: label }),
|
|
12346
|
+
/* @__PURE__ */ jsx305("div", { className: ToggleBar_default.bar, children })
|
|
12190
12347
|
]
|
|
12191
12348
|
}
|
|
12192
12349
|
)
|
|
@@ -12197,10 +12354,10 @@ ToggleBar.displayName = "ToggleBar";
|
|
|
12197
12354
|
|
|
12198
12355
|
// src/components/ToggleBar/ToggleRadio.tsx
|
|
12199
12356
|
import {
|
|
12200
|
-
forwardRef as
|
|
12201
|
-
useId as
|
|
12357
|
+
forwardRef as forwardRef109,
|
|
12358
|
+
useId as useId29
|
|
12202
12359
|
} from "react";
|
|
12203
|
-
import { jsx as
|
|
12360
|
+
import { jsx as jsx306, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
12204
12361
|
var typographyTypes4 = {
|
|
12205
12362
|
large: "bodyLarge",
|
|
12206
12363
|
medium: "bodyMedium",
|
|
@@ -12217,7 +12374,7 @@ var calculateChecked = (value, group, checked) => {
|
|
|
12217
12374
|
}
|
|
12218
12375
|
return !!value;
|
|
12219
12376
|
};
|
|
12220
|
-
var ToggleRadio =
|
|
12377
|
+
var ToggleRadio = forwardRef109(
|
|
12221
12378
|
(props, ref) => {
|
|
12222
12379
|
const {
|
|
12223
12380
|
value,
|
|
@@ -12233,7 +12390,7 @@ var ToggleRadio = forwardRef108(
|
|
|
12233
12390
|
id,
|
|
12234
12391
|
...rest
|
|
12235
12392
|
} = props;
|
|
12236
|
-
const generatedId =
|
|
12393
|
+
const generatedId = useId29();
|
|
12237
12394
|
const uniqueId = id != null ? id : `${generatedId}-ToggleRadio`;
|
|
12238
12395
|
const group = useToggleBarContext();
|
|
12239
12396
|
const handleChange = (event) => {
|
|
@@ -12241,8 +12398,8 @@ var ToggleRadio = forwardRef108(
|
|
|
12241
12398
|
(group == null ? void 0 : group.onChange) && group.onChange(event);
|
|
12242
12399
|
};
|
|
12243
12400
|
const contentTypeCn = label ? "with-text" : "just-icon";
|
|
12244
|
-
return /* @__PURE__ */
|
|
12245
|
-
/* @__PURE__ */
|
|
12401
|
+
return /* @__PURE__ */ jsxs81("label", { htmlFor: uniqueId, className: ToggleBar_default.label, children: [
|
|
12402
|
+
/* @__PURE__ */ jsx306(
|
|
12246
12403
|
"input",
|
|
12247
12404
|
{
|
|
12248
12405
|
...getBaseHTMLProps(
|
|
@@ -12265,7 +12422,7 @@ var ToggleRadio = forwardRef108(
|
|
|
12265
12422
|
"aria-labelledby": ariaLabelledBy
|
|
12266
12423
|
}
|
|
12267
12424
|
),
|
|
12268
|
-
/* @__PURE__ */
|
|
12425
|
+
/* @__PURE__ */ jsxs81(
|
|
12269
12426
|
Typography,
|
|
12270
12427
|
{
|
|
12271
12428
|
as: "span",
|
|
@@ -12276,8 +12433,8 @@ var ToggleRadio = forwardRef108(
|
|
|
12276
12433
|
focus_default["focus-styled-sibling"]
|
|
12277
12434
|
),
|
|
12278
12435
|
children: [
|
|
12279
|
-
icon && /* @__PURE__ */
|
|
12280
|
-
label && /* @__PURE__ */
|
|
12436
|
+
icon && /* @__PURE__ */ jsx306(Icon, { icon, iconSize: "inherit" }),
|
|
12437
|
+
label && /* @__PURE__ */ jsx306("span", { children: label })
|
|
12281
12438
|
]
|
|
12282
12439
|
}
|
|
12283
12440
|
)
|
|
@@ -12287,7 +12444,7 @@ var ToggleRadio = forwardRef108(
|
|
|
12287
12444
|
ToggleRadio.displayName = "ToggleRadio";
|
|
12288
12445
|
|
|
12289
12446
|
// src/components/ToggleButton/ToggleButton.tsx
|
|
12290
|
-
import { forwardRef as
|
|
12447
|
+
import { forwardRef as forwardRef110, useId as useId30 } from "react";
|
|
12291
12448
|
|
|
12292
12449
|
// src/components/ToggleButton/ToggleButton.module.css
|
|
12293
12450
|
var ToggleButton_default = {
|
|
@@ -12301,14 +12458,14 @@ var ToggleButton_default = {
|
|
|
12301
12458
|
};
|
|
12302
12459
|
|
|
12303
12460
|
// src/components/ToggleButton/ToggleButton.tsx
|
|
12304
|
-
import { jsx as
|
|
12305
|
-
var ToggleButton =
|
|
12461
|
+
import { jsx as jsx307, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
12462
|
+
var ToggleButton = forwardRef110(
|
|
12306
12463
|
({ id, label, icon, className, htmlProps, ...rest }, ref) => {
|
|
12307
|
-
const generatedId =
|
|
12464
|
+
const generatedId = useId30();
|
|
12308
12465
|
const uniqueId = id != null ? id : `${generatedId}-toggleButton`;
|
|
12309
12466
|
const hasIcon = !!icon;
|
|
12310
|
-
return /* @__PURE__ */
|
|
12311
|
-
/* @__PURE__ */
|
|
12467
|
+
return /* @__PURE__ */ jsxs82("label", { htmlFor: uniqueId, className: ToggleButton_default.container, children: [
|
|
12468
|
+
/* @__PURE__ */ jsx307(
|
|
12312
12469
|
"input",
|
|
12313
12470
|
{
|
|
12314
12471
|
...getBaseHTMLProps(
|
|
@@ -12325,7 +12482,7 @@ var ToggleButton = forwardRef109(
|
|
|
12325
12482
|
type: "checkbox"
|
|
12326
12483
|
}
|
|
12327
12484
|
),
|
|
12328
|
-
/* @__PURE__ */
|
|
12485
|
+
/* @__PURE__ */ jsxs82(
|
|
12329
12486
|
"span",
|
|
12330
12487
|
{
|
|
12331
12488
|
className: cn(
|
|
@@ -12335,7 +12492,7 @@ var ToggleButton = forwardRef109(
|
|
|
12335
12492
|
focus_default["focus-styled-sibling"]
|
|
12336
12493
|
),
|
|
12337
12494
|
children: [
|
|
12338
|
-
hasIcon && /* @__PURE__ */
|
|
12495
|
+
hasIcon && /* @__PURE__ */ jsx307(Icon, { icon, iconSize: "inherit" }),
|
|
12339
12496
|
" ",
|
|
12340
12497
|
label
|
|
12341
12498
|
]
|
|
@@ -12347,8 +12504,8 @@ var ToggleButton = forwardRef109(
|
|
|
12347
12504
|
ToggleButton.displayName = "ToggleButton";
|
|
12348
12505
|
|
|
12349
12506
|
// src/components/ToggleButton/ToggleButtonGroup.tsx
|
|
12350
|
-
import { useId as
|
|
12351
|
-
import { jsx as
|
|
12507
|
+
import { useId as useId31 } from "react";
|
|
12508
|
+
import { jsx as jsx308, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
12352
12509
|
var ToggleButtonGroup = (props) => {
|
|
12353
12510
|
const {
|
|
12354
12511
|
children,
|
|
@@ -12360,9 +12517,9 @@ var ToggleButtonGroup = (props) => {
|
|
|
12360
12517
|
htmlProps,
|
|
12361
12518
|
...rest
|
|
12362
12519
|
} = props;
|
|
12363
|
-
const generatedId =
|
|
12520
|
+
const generatedId = useId31();
|
|
12364
12521
|
const uniqueLabelId = labelId != null ? labelId : `${generatedId}-ToggleButtonGroupLabel`;
|
|
12365
|
-
return /* @__PURE__ */
|
|
12522
|
+
return /* @__PURE__ */ jsxs83(
|
|
12366
12523
|
"div",
|
|
12367
12524
|
{
|
|
12368
12525
|
...getBaseHTMLProps(
|
|
@@ -12374,8 +12531,8 @@ var ToggleButtonGroup = (props) => {
|
|
|
12374
12531
|
role: "group",
|
|
12375
12532
|
"aria-labelledby": label ? uniqueLabelId : void 0,
|
|
12376
12533
|
children: [
|
|
12377
|
-
!!label && /* @__PURE__ */
|
|
12378
|
-
/* @__PURE__ */
|
|
12534
|
+
!!label && /* @__PURE__ */ jsx308(Typography, { as: "span", typographyType: "labelMedium", id: uniqueLabelId, children: label }),
|
|
12535
|
+
/* @__PURE__ */ jsx308("div", { className: cn(ToggleButton_default.group, ToggleButton_default[`group--${direction}`]), children })
|
|
12379
12536
|
]
|
|
12380
12537
|
}
|
|
12381
12538
|
);
|
|
@@ -12652,6 +12809,7 @@ export {
|
|
|
12652
12809
|
TimePicker,
|
|
12653
12810
|
TingrettIcon,
|
|
12654
12811
|
TipIcon,
|
|
12812
|
+
Toggle,
|
|
12655
12813
|
ToggleBar,
|
|
12656
12814
|
ToggleButton,
|
|
12657
12815
|
ToggleButtonGroup,
|