@norges-domstoler/dds-components 21.17.0 → 21.17.1

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
@@ -451,7 +451,7 @@ interface CommonComponentProps<THTMLProps extends object, TRef extends Ref<unkno
451
451
  * @template TOtherProps Andre props komponenten skal eksponere til konsumenter.
452
452
  * @template THTMLAttributesProps Standard `HTMLAttributes<T>` men kan overstyres for f.eks knapper hvis man trenger en annen basetype for `htmlProps`.
453
453
  */
454
- type BaseComponentProps<TElement extends Element, TOtherProps extends object = object, THTMLAttributesProps extends HTMLAttributes<TElement> = HTMLAttributes<TElement>> = Omit<THTMLAttributesProps, 'id' | 'className'> & TOtherProps & CommonComponentProps<THTMLAttributesProps, Ref<TElement>>;
454
+ type BaseComponentProps<TElement extends Element, TOtherProps extends object = object, THTMLAttributesProps extends HTMLAttributes<TElement> = HTMLAttributes<TElement>> = Omit<THTMLAttributesProps, 'id' | 'className' | keyof TOtherProps> & TOtherProps & CommonComponentProps<THTMLAttributesProps, Ref<TElement>>;
455
455
  /**
456
456
  * Basetype for polymorfe props som eksponeres til konsumenter av designsystemet.
457
457
  * Lager en intersection-type med props som sendes inn og `id` og `htmlProps`
@@ -462,7 +462,7 @@ type BaseComponentProps<TElement extends Element, TOtherProps extends object = o
462
462
  * @template TOtherProps Andre props komponenten skal eksponere til konsumenter.
463
463
  * @template TComponentProps Standard `ComponentPropsWithoutRef<E>` som kan overstyres hvis man trenger en annen basetype for `htmlProps`, f.eks. for å støtte ofte brukte attributter på roten.
464
464
  */
465
- type PolymorphicBaseComponentProps<E extends ElementType, TOtherProps extends object = object, TComponentProps extends object = ComponentPropsWithoutRef<E>> = Omit<TComponentProps, 'id' | 'className' | 'style' | 'ref'> & TOtherProps & CommonComponentProps<TComponentProps, ComponentPropsWithRef<E>['ref']> & {
465
+ type PolymorphicBaseComponentProps<E extends ElementType, TOtherProps extends object = object, TComponentProps extends object = ComponentPropsWithoutRef<E>> = Omit<TComponentProps, 'id' | 'className' | 'style' | 'ref' | keyof TOtherProps> & TOtherProps & CommonComponentProps<TComponentProps, ComponentPropsWithRef<E>['ref']> & {
466
466
  /**HTML- eller React-element som returneres. */
467
467
  as?: E;
468
468
  /**Inline style. */
@@ -2325,7 +2325,7 @@ type InputProps = CommonInputProps & {
2325
2325
  * @default "medium"
2326
2326
  */
2327
2327
  componentSize?: InputSize;
2328
- } & Omit<ComponentPropsWithRef<'input'>, 'width'>;
2328
+ } & Omit<ComponentPropsWithRef<'input'>, 'width' | 'height'>;
2329
2329
 
2330
2330
  declare const defaultTypographyType: TypographyBodyType;
2331
2331
  declare const defaultTypographyTypeClassName: HyphenTypographyType;
@@ -3695,7 +3695,7 @@ type SearchProps = Pick<InputProps, 'tip' | 'label'> & {
3695
3695
  buttonProps?: SearchButtonProps;
3696
3696
  /**Om søkeikonet skal vises. */
3697
3697
  showIcon?: boolean;
3698
- } & Pick<InputProps, 'width'> & Omit<ComponentPropsWithRef<'input'>, 'width'>;
3698
+ } & Pick<InputProps, 'width'> & Omit<ComponentPropsWithRef<'input'>, 'width' | 'height'>;
3699
3699
  declare const Search$1: {
3700
3700
  ({ componentSize, buttonProps, showIcon, name, label, tip, id, value, width, onChange, className, style, "aria-describedby": ariaDescribedby, ref, ...rest }: SearchProps): react_jsx_runtime.JSX.Element;
3701
3701
  displayName: string;
package/dist/index.d.ts CHANGED
@@ -451,7 +451,7 @@ interface CommonComponentProps<THTMLProps extends object, TRef extends Ref<unkno
451
451
  * @template TOtherProps Andre props komponenten skal eksponere til konsumenter.
452
452
  * @template THTMLAttributesProps Standard `HTMLAttributes<T>` men kan overstyres for f.eks knapper hvis man trenger en annen basetype for `htmlProps`.
453
453
  */
454
- type BaseComponentProps<TElement extends Element, TOtherProps extends object = object, THTMLAttributesProps extends HTMLAttributes<TElement> = HTMLAttributes<TElement>> = Omit<THTMLAttributesProps, 'id' | 'className'> & TOtherProps & CommonComponentProps<THTMLAttributesProps, Ref<TElement>>;
454
+ type BaseComponentProps<TElement extends Element, TOtherProps extends object = object, THTMLAttributesProps extends HTMLAttributes<TElement> = HTMLAttributes<TElement>> = Omit<THTMLAttributesProps, 'id' | 'className' | keyof TOtherProps> & TOtherProps & CommonComponentProps<THTMLAttributesProps, Ref<TElement>>;
455
455
  /**
456
456
  * Basetype for polymorfe props som eksponeres til konsumenter av designsystemet.
457
457
  * Lager en intersection-type med props som sendes inn og `id` og `htmlProps`
@@ -462,7 +462,7 @@ type BaseComponentProps<TElement extends Element, TOtherProps extends object = o
462
462
  * @template TOtherProps Andre props komponenten skal eksponere til konsumenter.
463
463
  * @template TComponentProps Standard `ComponentPropsWithoutRef<E>` som kan overstyres hvis man trenger en annen basetype for `htmlProps`, f.eks. for å støtte ofte brukte attributter på roten.
464
464
  */
465
- type PolymorphicBaseComponentProps<E extends ElementType, TOtherProps extends object = object, TComponentProps extends object = ComponentPropsWithoutRef<E>> = Omit<TComponentProps, 'id' | 'className' | 'style' | 'ref'> & TOtherProps & CommonComponentProps<TComponentProps, ComponentPropsWithRef<E>['ref']> & {
465
+ type PolymorphicBaseComponentProps<E extends ElementType, TOtherProps extends object = object, TComponentProps extends object = ComponentPropsWithoutRef<E>> = Omit<TComponentProps, 'id' | 'className' | 'style' | 'ref' | keyof TOtherProps> & TOtherProps & CommonComponentProps<TComponentProps, ComponentPropsWithRef<E>['ref']> & {
466
466
  /**HTML- eller React-element som returneres. */
467
467
  as?: E;
468
468
  /**Inline style. */
@@ -2325,7 +2325,7 @@ type InputProps = CommonInputProps & {
2325
2325
  * @default "medium"
2326
2326
  */
2327
2327
  componentSize?: InputSize;
2328
- } & Omit<ComponentPropsWithRef<'input'>, 'width'>;
2328
+ } & Omit<ComponentPropsWithRef<'input'>, 'width' | 'height'>;
2329
2329
 
2330
2330
  declare const defaultTypographyType: TypographyBodyType;
2331
2331
  declare const defaultTypographyTypeClassName: HyphenTypographyType;
@@ -3695,7 +3695,7 @@ type SearchProps = Pick<InputProps, 'tip' | 'label'> & {
3695
3695
  buttonProps?: SearchButtonProps;
3696
3696
  /**Om søkeikonet skal vises. */
3697
3697
  showIcon?: boolean;
3698
- } & Pick<InputProps, 'width'> & Omit<ComponentPropsWithRef<'input'>, 'width'>;
3698
+ } & Pick<InputProps, 'width'> & Omit<ComponentPropsWithRef<'input'>, 'width' | 'height'>;
3699
3699
  declare const Search$1: {
3700
3700
  ({ componentSize, buttonProps, showIcon, name, label, tip, id, value, width, onChange, className, style, "aria-describedby": ariaDescribedby, ref, ...rest }: SearchProps): react_jsx_runtime.JSX.Element;
3701
3701
  displayName: string;
package/dist/index.js CHANGED
@@ -7066,6 +7066,36 @@ DatePicker.displayName = "DatePicker";
7066
7066
  var import_datepicker6 = require("@react-aria/datepicker");
7067
7067
  var import_datepicker7 = require("@react-stately/datepicker");
7068
7068
  var import_react48 = require("react");
7069
+
7070
+ // src/components/date-inputs/TimePicker/TimePicker.utils.ts
7071
+ function formatTimeSegments(segments) {
7072
+ const hourSegment = segments.find((segment) => segment.type === "hour");
7073
+ const minuteSegment = segments.find((segment) => segment.type === "minute");
7074
+ const separatorSegment = segments.find(
7075
+ (segment) => segment.type === "literal" && segment.isPlaceholder === void 0
7076
+ );
7077
+ if (!hourSegment || !minuteSegment || !separatorSegment) {
7078
+ throw new Error("Invalid time segments");
7079
+ }
7080
+ const formattedHourSegment = {
7081
+ ...hourSegment,
7082
+ text: hourSegment.text.padStart(2, "0"),
7083
+ placeholder: "\u2013\u2013"
7084
+ };
7085
+ const formattedMinuteSegment = {
7086
+ ...minuteSegment,
7087
+ text: minuteSegment.text.padStart(2, "0"),
7088
+ placeholder: "\u2013\u2013"
7089
+ };
7090
+ const formattedSeparatorSegment = { ...separatorSegment, text: ":" };
7091
+ return [
7092
+ formattedHourSegment,
7093
+ formattedSeparatorSegment,
7094
+ formattedMinuteSegment
7095
+ ];
7096
+ }
7097
+
7098
+ // src/components/date-inputs/TimePicker/TimePicker.tsx
7069
7099
  var import_jsx_runtime238 = require("react/jsx-runtime");
7070
7100
  function TimePicker({
7071
7101
  componentSize = "medium",
@@ -7075,7 +7105,7 @@ function TimePicker({
7075
7105
  }) {
7076
7106
  const lang = useLanguage();
7077
7107
  if (!lang) {
7078
- throw new Error("DatePicker must be used within a DdsProvider");
7108
+ throw new Error("TimePicker must be used within a DdsProvider");
7079
7109
  }
7080
7110
  const internalRef = (0, import_react48.useRef)(null);
7081
7111
  const state = (0, import_datepicker7.useTimeFieldState)({
@@ -7089,6 +7119,7 @@ function TimePicker({
7089
7119
  );
7090
7120
  const iconSize = componentSize === "xsmall" ? "small" : "medium";
7091
7121
  const disabled = props.isDisabled || !!fieldProps["aria-disabled"];
7122
+ const formattedSegments = formatTimeSegments(state.segments);
7092
7123
  return /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(
7093
7124
  DateInput,
7094
7125
  {
@@ -7114,7 +7145,7 @@ function TimePicker({
7114
7145
  )
7115
7146
  }
7116
7147
  ),
7117
- children: state.segments.map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(
7148
+ children: formattedSegments.map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(
7118
7149
  DateSegment,
7119
7150
  {
7120
7151
  componentSize,