@norges-domstoler/dds-components 0.0.0-dev-20240122114608 → 0.0.0-dev-20240122135423

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
@@ -2505,17 +2505,45 @@ type TabPanelsProps = HTMLAttributes<HTMLDivElement>;
2505
2505
  declare const TabPanels: react.ForwardRefExoticComponent<TabPanelsProps & react.RefAttributes<HTMLDivElement>>;
2506
2506
 
2507
2507
  type TagPurpose = 'success' | 'info' | 'danger' | 'warning' | 'default';
2508
- type TagProps = BaseComponentProps<HTMLSpanElement, {
2509
- /**Tekst som vises i `<Tag />.` */
2508
+ type TagProps = BaseComponentPropsWithChildren<HTMLSpanElement, {
2509
+ /**
2510
+ * Innholdet til `<Tag>.` Kan brukes istedenfor `text`.
2511
+ */
2512
+ children?: ReactNode;
2513
+ /**
2514
+ * Samme oppførsel som `children`. Er `children` brukt vil denne ignoreres. Tekst som vises i `<Tag>`.
2515
+ */
2510
2516
  text?: string;
2511
- /**Formål med status eller kategorisering. Påvirker styling. */
2517
+ /**
2518
+ * Formål med status eller kategorisering. Påvirker styling.
2519
+ * */
2512
2520
  purpose?: TagPurpose;
2521
+ /**
2522
+ * Om `<Tag>` skal ha et ikon til venstre for teksten. Tags med `purpose="default"` har aldri ikon.
2523
+ * @default false
2524
+ */
2525
+ withIcon?: boolean;
2513
2526
  }>;
2514
2527
  declare const Tag: react.ForwardRefExoticComponent<Pick<react.HTMLAttributes<HTMLSpanElement>, "className" | "id"> & {
2515
- /**Tekst som vises i `<Tag />.` */
2528
+ /**
2529
+ * Innholdet til `<Tag>.` Kan brukes istedenfor `text`.
2530
+ */
2531
+ children?: ReactNode;
2532
+ /**
2533
+ * Samme oppførsel som `children`. Er `children` brukt vil denne ignoreres. Tekst som vises i `<Tag>`.
2534
+ */
2516
2535
  text?: string | undefined;
2517
- /**Formål med status eller kategorisering. Påvirker styling. */
2536
+ /**
2537
+ * Formål med status eller kategorisering. Påvirker styling.
2538
+ * */
2518
2539
  purpose?: TagPurpose | undefined;
2540
+ /**
2541
+ * Om `<Tag>` skal ha et ikon til venstre for teksten. Tags med `purpose="default"` har aldri ikon.
2542
+ * @default false
2543
+ */
2544
+ withIcon?: boolean | undefined;
2545
+ } & {
2546
+ children?: ReactNode;
2519
2547
  } & {
2520
2548
  htmlProps?: react.HTMLAttributes<HTMLSpanElement> | undefined;
2521
2549
  } & react.RefAttributes<HTMLSpanElement>>;
package/dist/index.d.ts CHANGED
@@ -2505,17 +2505,45 @@ type TabPanelsProps = HTMLAttributes<HTMLDivElement>;
2505
2505
  declare const TabPanels: react.ForwardRefExoticComponent<TabPanelsProps & react.RefAttributes<HTMLDivElement>>;
2506
2506
 
2507
2507
  type TagPurpose = 'success' | 'info' | 'danger' | 'warning' | 'default';
2508
- type TagProps = BaseComponentProps<HTMLSpanElement, {
2509
- /**Tekst som vises i `<Tag />.` */
2508
+ type TagProps = BaseComponentPropsWithChildren<HTMLSpanElement, {
2509
+ /**
2510
+ * Innholdet til `<Tag>.` Kan brukes istedenfor `text`.
2511
+ */
2512
+ children?: ReactNode;
2513
+ /**
2514
+ * Samme oppførsel som `children`. Er `children` brukt vil denne ignoreres. Tekst som vises i `<Tag>`.
2515
+ */
2510
2516
  text?: string;
2511
- /**Formål med status eller kategorisering. Påvirker styling. */
2517
+ /**
2518
+ * Formål med status eller kategorisering. Påvirker styling.
2519
+ * */
2512
2520
  purpose?: TagPurpose;
2521
+ /**
2522
+ * Om `<Tag>` skal ha et ikon til venstre for teksten. Tags med `purpose="default"` har aldri ikon.
2523
+ * @default false
2524
+ */
2525
+ withIcon?: boolean;
2513
2526
  }>;
2514
2527
  declare const Tag: react.ForwardRefExoticComponent<Pick<react.HTMLAttributes<HTMLSpanElement>, "className" | "id"> & {
2515
- /**Tekst som vises i `<Tag />.` */
2528
+ /**
2529
+ * Innholdet til `<Tag>.` Kan brukes istedenfor `text`.
2530
+ */
2531
+ children?: ReactNode;
2532
+ /**
2533
+ * Samme oppførsel som `children`. Er `children` brukt vil denne ignoreres. Tekst som vises i `<Tag>`.
2534
+ */
2516
2535
  text?: string | undefined;
2517
- /**Formål med status eller kategorisering. Påvirker styling. */
2536
+ /**
2537
+ * Formål med status eller kategorisering. Påvirker styling.
2538
+ * */
2518
2539
  purpose?: TagPurpose | undefined;
2540
+ /**
2541
+ * Om `<Tag>` skal ha et ikon til venstre for teksten. Tags med `purpose="default"` har aldri ikon.
2542
+ * @default false
2543
+ */
2544
+ withIcon?: boolean | undefined;
2545
+ } & {
2546
+ children?: ReactNode;
2519
2547
  } & {
2520
2548
  htmlProps?: react.HTMLAttributes<HTMLSpanElement> | undefined;
2521
2549
  } & react.RefAttributes<HTMLSpanElement>>;
package/dist/index.js CHANGED
@@ -11847,15 +11847,50 @@ var wrapper7 = {
11847
11847
  border: "1px solid",
11848
11848
  borderRadius: borderRadius9.RadiiDdsBorderRadius1Radius,
11849
11849
  padding: `${spacing30.SizesDdsSpacingX0125} ${spacing30.SizesDdsSpacingX025}`,
11850
+ icon: {
11851
+ padding: [
11852
+ spacing30.SizesDdsSpacingX0125,
11853
+ spacing30.SizesDdsSpacingX025,
11854
+ spacing30.SizesDdsSpacingX0125,
11855
+ spacing30.SizesDdsSpacingX0125
11856
+ ].join(" "),
11857
+ gap: spacing30.SizesDdsSpacingX0125,
11858
+ size: "small"
11859
+ },
11850
11860
  purpose: {
11851
11861
  default: {
11852
11862
  backgroundColor: colors29.DdsColorNeutralsGray1,
11853
- borderColor: colors29.DdsColorNeutralsGray3
11863
+ borderColor: colors29.DdsColorNeutralsGray3,
11864
+ icon: void 0
11865
+ },
11866
+ success: {
11867
+ ...localMessageTokens.container.purpose.success,
11868
+ icon: {
11869
+ icon: CheckCircledIcon,
11870
+ color: colors29.DdsColorSuccessDarkest
11871
+ }
11872
+ },
11873
+ danger: {
11874
+ ...localMessageTokens.container.purpose.danger,
11875
+ icon: {
11876
+ icon: ErrorIcon,
11877
+ color: colors29.DdsColorDangerDarkest
11878
+ }
11879
+ },
11880
+ warning: {
11881
+ ...localMessageTokens.container.purpose.warning,
11882
+ icon: {
11883
+ icon: WarningIcon,
11884
+ color: colors29.DdsColorWarningDarkest
11885
+ }
11854
11886
  },
11855
- success: localMessageTokens.container.purpose.success,
11856
- danger: localMessageTokens.container.purpose.danger,
11857
- warning: localMessageTokens.container.purpose.warning,
11858
- info: localMessageTokens.container.purpose.info
11887
+ info: {
11888
+ ...localMessageTokens.container.purpose.info,
11889
+ icon: {
11890
+ icon: InfoIcon,
11891
+ color: colors29.DdsColorInfoDarkest
11892
+ }
11893
+ }
11859
11894
  }
11860
11895
  };
11861
11896
  var tagTokens = {
@@ -11868,31 +11903,52 @@ var { wrapper: wrapper8 } = tagTokens;
11868
11903
  var Wrapper7 = (0, import_styled_components80.default)(TextOverflowEllipsisWrapper)`
11869
11904
  display: inline-flex;
11870
11905
  align-items: center;
11906
+ gap: ${tagTokens.wrapper.icon.gap};
11871
11907
  border: ${wrapper8.border};
11872
11908
  border-radius: ${wrapper8.borderRadius};
11873
- padding: ${wrapper8.padding};
11909
+ padding: ${({ $withIcon }) => $withIcon ? wrapper8.icon.padding : wrapper8.padding};
11874
11910
  ${getFontStyling(typographyType5)}
11875
11911
  ${({ $purpose }) => import_styled_components80.css`
11876
11912
  background-color: ${wrapper8.purpose[$purpose].backgroundColor};
11877
11913
  border-color: ${wrapper8.purpose[$purpose].borderColor};
11878
11914
  `}
11879
11915
  `;
11916
+ var StyledIcon4 = (0, import_styled_components80.default)(Icon)`
11917
+ color: ${({ $purpose }) => {
11918
+ var _a;
11919
+ return (_a = wrapper8.purpose[$purpose].icon) == null ? void 0 : _a.color;
11920
+ }};
11921
+ `;
11880
11922
  var Tag = (0, import_react95.forwardRef)((props, ref) => {
11881
11923
  const {
11882
11924
  text,
11883
11925
  purpose = "default",
11884
11926
  id,
11885
11927
  className,
11928
+ children,
11886
11929
  htmlProps,
11930
+ withIcon,
11887
11931
  ...rest
11888
11932
  } = props;
11889
- return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(
11933
+ const icon12 = tagTokens.wrapper.purpose[purpose].icon;
11934
+ return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
11890
11935
  Wrapper7,
11891
11936
  {
11892
11937
  ...getBaseHTMLProps(id, className, htmlProps, rest),
11893
11938
  ref,
11894
11939
  $purpose: purpose,
11895
- children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TextOverflowEllipsisInner, { children: text })
11940
+ $withIcon: Boolean(withIcon && icon12),
11941
+ children: [
11942
+ withIcon && icon12 && /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(
11943
+ StyledIcon4,
11944
+ {
11945
+ $purpose: purpose,
11946
+ icon: icon12.icon,
11947
+ iconSize: tagTokens.wrapper.icon.size
11948
+ }
11949
+ ),
11950
+ /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TextOverflowEllipsisInner, { children: children != null ? children : text })
11951
+ ]
11896
11952
  }
11897
11953
  );
11898
11954
  });
@@ -13964,12 +14020,12 @@ var Nav2 = (0, import_styled_components97.default)("nav")`
13964
14020
  display: flex;
13965
14021
  gap: ${backLinkTokens.nav.gap};
13966
14022
  `;
13967
- var StyledIcon4 = (0, import_styled_components97.default)(Icon)`
14023
+ var StyledIcon5 = (0, import_styled_components97.default)(Icon)`
13968
14024
  color: ${backLinkTokens.icon.color};
13969
14025
  `;
13970
14026
  var BackLink = (0, import_react115.forwardRef)((props, ref) => {
13971
14027
  return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(Nav2, { ref, children: [
13972
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(StyledIcon4, { icon: ArrowLeftIcon, iconSize: "small" }),
14028
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(StyledIcon5, { icon: ArrowLeftIcon, iconSize: "small" }),
13973
14029
  /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Typography, { typographyType: "a", href: props.href, children: props.label })
13974
14030
  ] });
13975
14031
  });