@norges-domstoler/dds-components 0.0.0-dev-20240209091857 → 0.0.0-dev-20240212110341

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
@@ -2597,9 +2597,14 @@ type CheckboxGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
2597
2597
  groupId?: string;
2598
2598
  /**Meldingen som vises ved valideringsfeil. Sender error-tilstand til barna når det finnes og setter `aria-describedby` for barna. */
2599
2599
  errorMessage?: string;
2600
+ /**Hjelpetekst for gruppen. */
2600
2601
  tip?: string;
2601
2602
  /**Indikerer at det er påkrevd å velge minst ett alternativ. Innebærer visuell endring. **OBS!** `required` må i tillegg gis til `<Checkbox />` manuelt. */
2602
2603
  required?: boolean;
2604
+ /**Gir alle barna `disabled` prop. */
2605
+ disabled?: boolean;
2606
+ /**Gir alle barna `readOnly` prop. */
2607
+ readOnly?: boolean;
2603
2608
  }>;
2604
2609
  declare const CheckboxGroup: {
2605
2610
  (props: CheckboxGroupProps): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -2597,9 +2597,14 @@ type CheckboxGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
2597
2597
  groupId?: string;
2598
2598
  /**Meldingen som vises ved valideringsfeil. Sender error-tilstand til barna når det finnes og setter `aria-describedby` for barna. */
2599
2599
  errorMessage?: string;
2600
+ /**Hjelpetekst for gruppen. */
2600
2601
  tip?: string;
2601
2602
  /**Indikerer at det er påkrevd å velge minst ett alternativ. Innebærer visuell endring. **OBS!** `required` må i tillegg gis til `<Checkbox />` manuelt. */
2602
2603
  required?: boolean;
2604
+ /**Gir alle barna `disabled` prop. */
2605
+ disabled?: boolean;
2606
+ /**Gir alle barna `readOnly` prop. */
2607
+ readOnly?: boolean;
2603
2608
  }>;
2604
2609
  declare const CheckboxGroup: {
2605
2610
  (props: CheckboxGroupProps): react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -11928,6 +11928,11 @@ var import_dds_design_tokens55 = require("@norges-domstoler/dds-design-tokens");
11928
11928
  // src/components/SelectionControl/SelectionControl.utils.tsx
11929
11929
  var selectionControlSizeNumberPx = 18;
11930
11930
  var selectionControlSize = `${selectionControlSizeNumberPx}px`;
11931
+ var selectionControlTypographyProps = {
11932
+ color: "inherit",
11933
+ typographyType: "bodySans02",
11934
+ as: "span"
11935
+ };
11931
11936
 
11932
11937
  // src/components/SelectionControl/SelectionControl.tokens.tsx
11933
11938
  var { colors: colors29, spacing: spacing33, borderRadius: borderRadius8 } = import_dds_design_tokens55.ddsBaseTokens;
@@ -12142,6 +12147,9 @@ var Container13 = import_styled_components77.default.label`
12142
12147
  display: block;
12143
12148
  }
12144
12149
 
12150
+ ${({ $readOnly }) => $readOnly && import_styled_components77.css`
12151
+ cursor: default;
12152
+ `}
12145
12153
  ${({ disabled }) => disabled && import_styled_components77.css`
12146
12154
  cursor: not-allowed;
12147
12155
  color: ${container14.disabled.color};
@@ -12219,7 +12227,8 @@ var Checkbox = (0, import_react89.forwardRef)(
12219
12227
  Container13,
12220
12228
  {
12221
12229
  $error: error || (checkboxGroup == null ? void 0 : checkboxGroup.error),
12222
- disabled,
12230
+ disabled: disabled || (checkboxGroup == null ? void 0 : checkboxGroup.disabled),
12231
+ $readOnly: readOnly || (checkboxGroup == null ? void 0 : checkboxGroup.readOnly),
12223
12232
  htmlFor: uniqueId,
12224
12233
  $hasLabel: hasLabel,
12225
12234
  $controlType: "checkbox",
@@ -12232,7 +12241,7 @@ var Checkbox = (0, import_react89.forwardRef)(
12232
12241
  ...getBaseHTMLProps(uniqueId, restHtmlProps, rest),
12233
12242
  ref,
12234
12243
  name,
12235
- disabled,
12244
+ disabled: disabled || readOnly || !!(checkboxGroup == null ? void 0 : checkboxGroup.disabled) || !!(checkboxGroup == null ? void 0 : checkboxGroup.readOnly),
12236
12245
  "aria-describedby": spaceSeparatedIdListGenerator([
12237
12246
  checkboxGroup == null ? void 0 : checkboxGroup.tipId,
12238
12247
  checkboxGroup == null ? void 0 : checkboxGroup.errorMessageId,
@@ -12247,7 +12256,7 @@ var Checkbox = (0, import_react89.forwardRef)(
12247
12256
  }
12248
12257
  ),
12249
12258
  /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(CustomSelectionControl, { $controlType: "checkbox" }),
12250
- hasLabel && /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(Typography, { color: "inherit", as: "span", typographyType: "bodySans02", children: label3 })
12259
+ hasLabel && /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(Typography, { ...selectionControlTypographyProps, children: label3 })
12251
12260
  ]
12252
12261
  }
12253
12262
  );
@@ -12265,6 +12274,8 @@ var CheckboxGroup = (props) => {
12265
12274
  errorMessage,
12266
12275
  tip,
12267
12276
  required = false,
12277
+ disabled = false,
12278
+ readOnly = false,
12268
12279
  groupId,
12269
12280
  children,
12270
12281
  id,
@@ -12283,7 +12294,9 @@ var CheckboxGroup = (props) => {
12283
12294
  error: hasErrorMessage,
12284
12295
  errorMessageId: errorMessage ? errorMessageId : void 0,
12285
12296
  uniqueGroupId,
12286
- tipId: tip ? tipId : void 0
12297
+ tipId: tip ? tipId : void 0,
12298
+ disabled,
12299
+ readOnly
12287
12300
  };
12288
12301
  return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
12289
12302
  OuterGroupContainer,
@@ -12410,7 +12423,7 @@ var RadioButton = (0, import_react92.forwardRef)(
12410
12423
  children: [
12411
12424
  /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(HiddenInput, { ...inputProps, ref }),
12412
12425
  /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(CustomSelectionControl, { $controlType: "radio" }),
12413
- /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(Typography, { as: "span", children: children != null ? children : label3 })
12426
+ /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(Typography, { ...selectionControlTypographyProps, children: children != null ? children : label3 })
12414
12427
  ]
12415
12428
  }
12416
12429
  );