@norges-domstoler/dds-components 0.0.0-dev-20260317093703 → 0.0.0-dev-20260319072103

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 CHANGED
@@ -5403,7 +5403,14 @@ declare const TextInput: {
5403
5403
  type ToggleBarValue = string | number | null | undefined;
5404
5404
  declare const TOGGLE_BAR_SIZES: ["xsmall", "small", "medium", "large"];
5405
5405
  type ToggleBarSize = (typeof TOGGLE_BAR_SIZES)[number];
5406
+ declare const TOGGLE_BAR_PURPOSES: ["primary", "secondary"];
5407
+ type ToggleBarPurpose = (typeof TOGGLE_BAR_PURPOSES)[number];
5406
5408
  type ToggleBarProps<T extends string | number> = BaseComponentPropsWithChildren<HTMLDivElement, {
5409
+ /**
5410
+ * Formål med komponenten.
5411
+ * @default "primary"
5412
+ */
5413
+ purpose?: ToggleBarPurpose;
5407
5414
  /**Størrelse på komponenten.
5408
5415
  * @default "medium"
5409
5416
  */
package/dist/index.d.ts CHANGED
@@ -5403,7 +5403,14 @@ declare const TextInput: {
5403
5403
  type ToggleBarValue = string | number | null | undefined;
5404
5404
  declare const TOGGLE_BAR_SIZES: ["xsmall", "small", "medium", "large"];
5405
5405
  type ToggleBarSize = (typeof TOGGLE_BAR_SIZES)[number];
5406
+ declare const TOGGLE_BAR_PURPOSES: ["primary", "secondary"];
5407
+ type ToggleBarPurpose = (typeof TOGGLE_BAR_PURPOSES)[number];
5406
5408
  type ToggleBarProps<T extends string | number> = BaseComponentPropsWithChildren<HTMLDivElement, {
5409
+ /**
5410
+ * Formål med komponenten.
5411
+ * @default "primary"
5412
+ */
5413
+ purpose?: ToggleBarPurpose;
5407
5414
  /**Størrelse på komponenten.
5408
5415
  * @default "medium"
5409
5416
  */
package/dist/index.js CHANGED
@@ -15042,7 +15042,8 @@ var import_react103 = require("react");
15042
15042
  // src/components/ToggleBar/ToggleBar.context.tsx
15043
15043
  var import_react102 = require("react");
15044
15044
  var ToggleBarContext = (0, import_react102.createContext)({
15045
- size: "medium"
15045
+ size: "medium",
15046
+ purpose: "primary"
15046
15047
  });
15047
15048
  var useToggleBarContext = () => (0, import_react102.useContext)(ToggleBarContext);
15048
15049
 
@@ -15050,7 +15051,9 @@ var useToggleBarContext = () => (0, import_react102.useContext)(ToggleBarContext
15050
15051
  var ToggleBar_default = {
15051
15052
  bar: "ToggleBar_bar",
15052
15053
  content: "ToggleBar_content",
15053
- label: "ToggleBar_label"
15054
+ label: "ToggleBar_label",
15055
+ "label--primary": "ToggleBar_label--primary",
15056
+ "label--secondary": "ToggleBar_label--secondary"
15054
15057
  };
15055
15058
 
15056
15059
  // src/components/ToggleBar/ToggleBar.tsx
@@ -15059,6 +15062,7 @@ var ToggleBar = (props) => {
15059
15062
  const {
15060
15063
  children,
15061
15064
  size: size2 = "medium",
15065
+ purpose = "primary",
15062
15066
  label,
15063
15067
  onChange,
15064
15068
  value,
@@ -15082,6 +15086,7 @@ var ToggleBar = (props) => {
15082
15086
  ToggleBarContext,
15083
15087
  {
15084
15088
  value: {
15089
+ purpose,
15085
15090
  size: size2,
15086
15091
  onChange: handleChange,
15087
15092
  name,
@@ -15151,45 +15156,52 @@ var ToggleRadio = ({
15151
15156
  const hasLabel = !!label;
15152
15157
  const hasIcon = !!icon;
15153
15158
  const contentTypeCn = !hasLabel ? "just-icon" : !hasIcon ? "just-text" : "with-text-and-icon";
15154
- return /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)("label", { htmlFor: uniqueId, className: ToggleBar_default.label, children: [
15155
- /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
15156
- HiddenInput,
15157
- {
15158
- ...getBaseHTMLProps(
15159
- uniqueId,
15160
- cn(className, focus_default["focusable-sibling"]),
15161
- style,
15162
- htmlProps,
15163
- rest
15164
- ),
15165
- type: "radio",
15166
- name: name != null ? name : group.name,
15167
- onChange: handleChange,
15168
- value,
15169
- checked: calculateChecked(value, group, checked),
15170
- "aria-label": ariaLabel,
15171
- "aria-labelledby": ariaLabelledBy
15172
- }
15173
- ),
15174
- /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)(
15175
- Typography,
15176
- {
15177
- as: "span",
15178
- typographyType: typographyTypes[group.size],
15179
- className: cn(
15180
- ToggleBar_default.content,
15181
- Button_default[contentTypeCn],
15182
- hasLabel && hasIcon && Button_default["with-icon-left"],
15183
- Button_default[`button--${group.size}`],
15184
- focus_default["focus-styled-sibling"]
15159
+ return /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)(
15160
+ "label",
15161
+ {
15162
+ htmlFor: uniqueId,
15163
+ className: cn(ToggleBar_default.label, ToggleBar_default[`label--${group.purpose}`]),
15164
+ children: [
15165
+ /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
15166
+ HiddenInput,
15167
+ {
15168
+ ...getBaseHTMLProps(
15169
+ uniqueId,
15170
+ cn(className, focus_default["focusable-sibling"]),
15171
+ style,
15172
+ htmlProps,
15173
+ rest
15174
+ ),
15175
+ type: "radio",
15176
+ name: name != null ? name : group.name,
15177
+ onChange: handleChange,
15178
+ value,
15179
+ checked: calculateChecked(value, group, checked),
15180
+ "aria-label": ariaLabel,
15181
+ "aria-labelledby": ariaLabelledBy
15182
+ }
15185
15183
  ),
15186
- children: [
15187
- icon && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(Icon, { icon, iconSize: "component" }),
15188
- label && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)("span", { children: label })
15189
- ]
15190
- }
15191
- )
15192
- ] });
15184
+ /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)(
15185
+ Typography,
15186
+ {
15187
+ as: "span",
15188
+ typographyType: typographyTypes[group.size],
15189
+ className: cn(
15190
+ ToggleBar_default.content,
15191
+ Button_default[contentTypeCn],
15192
+ hasLabel && hasIcon && Button_default["with-icon-left"],
15193
+ Button_default[`button--${group.size}`],
15194
+ focus_default["focus-styled-sibling"]
15195
+ ),
15196
+ children: [
15197
+ icon && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(Icon, { icon, iconSize: "component" }),
15198
+ label && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)("span", { children: label })
15199
+ ]
15200
+ }
15201
+ )
15202
+ ]
15203
+ }
15204
+ );
15193
15205
  };
15194
15206
  ToggleRadio.displayName = "ToggleRadio";
15195
15207