@norges-domstoler/dds-components 4.0.0 → 4.0.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.
@@ -2,7 +2,7 @@ import { HTMLAttributes } from 'react';
2
2
  import { BaseComponentPropsWithChildren, Direction } from '../../types';
3
3
  import { Property } from 'csstype';
4
4
  export declare type TabsProps = BaseComponentPropsWithChildren<HTMLDivElement, {
5
- /** Indeksen til den aktive fanen. */
5
+ /** Indeksen til den aktive fanen. **OBS!** Ved å sette denne vil brukere aldri kunne endre tab uten at du også registrerer en `onChange`-lytter for å ta vare på aktiv tab utenfor komponenten. */
6
6
  activeTab?: number;
7
7
  /** Ekstra logikk ved endring av aktiv fane. */
8
8
  onChange?: (index: number) => void;
@@ -14,7 +14,7 @@ export declare type TabsProps = BaseComponentPropsWithChildren<HTMLDivElement, {
14
14
  export declare const Tabs: import("react").ForwardRefExoticComponent<{
15
15
  htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, "onChange"> | undefined;
16
16
  } & Pick<Omit<HTMLAttributes<HTMLDivElement>, "onChange">, "className" | "id"> & {
17
- /** Indeksen til den aktive fanen. */
17
+ /** Indeksen til den aktive fanen. **OBS!** Ved å sette denne vil brukere aldri kunne endre tab uten at du også registrerer en `onChange`-lytter for å ta vare på aktiv tab utenfor komponenten. */
18
18
  activeTab?: number | undefined;
19
19
  /** Ekstra logikk ved endring av aktiv fane. */
20
20
  onChange?: ((index: number) => void) | undefined;
package/dist/index.es.js CHANGED
@@ -28695,20 +28695,27 @@ var isAnchorTypographyProps = function isAnchorTypographyProps(props) {
28695
28695
  };
28696
28696
 
28697
28697
  var Breadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
28698
+ var children = props.children,
28699
+ rest = __rest(props, ["children"]);
28700
+
28698
28701
  if (isAnchorTypographyProps(props)) {
28699
- return jsxRuntime.exports.jsx(Typography, {
28700
- htmlProps: props,
28702
+ return jsxRuntime.exports.jsx(Typography, __assign({
28703
+ htmlProps: rest,
28701
28704
  ref: ref,
28702
28705
  typographyType: "a"
28703
- });
28706
+ }, {
28707
+ children: children
28708
+ }));
28704
28709
  }
28705
28710
 
28706
- return jsxRuntime.exports.jsx(Typography, {
28707
- htmlProps: props,
28711
+ return jsxRuntime.exports.jsx(Typography, __assign({
28712
+ htmlProps: rest,
28708
28713
  ref: ref,
28709
28714
  as: "span",
28710
28715
  color: "interactive"
28711
- });
28716
+ }, {
28717
+ children: children
28718
+ }));
28712
28719
  });
28713
28720
 
28714
28721
  var ChevronRightOutlined = {};
@@ -33345,6 +33352,12 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
33345
33352
  onChange && onChange(index);
33346
33353
  };
33347
33354
 
33355
+ useEffect(function () {
33356
+ if (activeTab && activeTab != thisActiveTab) {
33357
+ setActiveTab(activeTab);
33358
+ }
33359
+ }, [activeTab, thisActiveTab]);
33360
+
33348
33361
  var containerProps = __assign(__assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest)), {
33349
33362
  ref: ref
33350
33363
  });
@@ -33501,7 +33514,6 @@ var Tab = /*#__PURE__*/forwardRef(function (props, ref) {
33501
33514
 
33502
33515
  var _b = useTabsContext(),
33503
33516
  tabPanelsRef = _b.tabPanelsRef,
33504
- hasTabFocus = _b.hasTabFocus,
33505
33517
  setHasTabFocus = _b.setHasTabFocus,
33506
33518
  tabContentDirection = _b.tabContentDirection,
33507
33519
  tabWidth = _b.tabWidth;
@@ -33512,7 +33524,6 @@ var Tab = /*#__PURE__*/forwardRef(function (props, ref) {
33512
33524
  if (focus) {
33513
33525
  (_a = itemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
33514
33526
  setHasTabFocus(true);
33515
- console.log('setHasTabFocus if(focus)', hasTabFocus);
33516
33527
  }
33517
33528
  }, [focus]);
33518
33529
  useOnKeyDown('Tab', function () {
package/dist/index.js CHANGED
@@ -28721,20 +28721,27 @@ var isAnchorTypographyProps = function isAnchorTypographyProps(props) {
28721
28721
  };
28722
28722
 
28723
28723
  var Breadcrumb = /*#__PURE__*/React.forwardRef(function (props, ref) {
28724
+ var children = props.children,
28725
+ rest = __rest(props, ["children"]);
28726
+
28724
28727
  if (isAnchorTypographyProps(props)) {
28725
- return jsxRuntime.exports.jsx(Typography, {
28726
- htmlProps: props,
28728
+ return jsxRuntime.exports.jsx(Typography, __assign({
28729
+ htmlProps: rest,
28727
28730
  ref: ref,
28728
28731
  typographyType: "a"
28729
- });
28732
+ }, {
28733
+ children: children
28734
+ }));
28730
28735
  }
28731
28736
 
28732
- return jsxRuntime.exports.jsx(Typography, {
28733
- htmlProps: props,
28737
+ return jsxRuntime.exports.jsx(Typography, __assign({
28738
+ htmlProps: rest,
28734
28739
  ref: ref,
28735
28740
  as: "span",
28736
28741
  color: "interactive"
28737
- });
28742
+ }, {
28743
+ children: children
28744
+ }));
28738
28745
  });
28739
28746
 
28740
28747
  var ChevronRightOutlined = {};
@@ -33371,6 +33378,12 @@ var Tabs = /*#__PURE__*/React.forwardRef(function (props, ref) {
33371
33378
  onChange && onChange(index);
33372
33379
  };
33373
33380
 
33381
+ React.useEffect(function () {
33382
+ if (activeTab && activeTab != thisActiveTab) {
33383
+ setActiveTab(activeTab);
33384
+ }
33385
+ }, [activeTab, thisActiveTab]);
33386
+
33374
33387
  var containerProps = __assign(__assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest)), {
33375
33388
  ref: ref
33376
33389
  });
@@ -33527,7 +33540,6 @@ var Tab = /*#__PURE__*/React.forwardRef(function (props, ref) {
33527
33540
 
33528
33541
  var _b = useTabsContext(),
33529
33542
  tabPanelsRef = _b.tabPanelsRef,
33530
- hasTabFocus = _b.hasTabFocus,
33531
33543
  setHasTabFocus = _b.setHasTabFocus,
33532
33544
  tabContentDirection = _b.tabContentDirection,
33533
33545
  tabWidth = _b.tabWidth;
@@ -33538,7 +33550,6 @@ var Tab = /*#__PURE__*/React.forwardRef(function (props, ref) {
33538
33550
  if (focus) {
33539
33551
  (_a = itemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
33540
33552
  setHasTabFocus(true);
33541
- console.log('setHasTabFocus if(focus)', hasTabFocus);
33542
33553
  }
33543
33554
  }, [focus]);
33544
33555
  useOnKeyDown('Tab', function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "React components used in Elsa - domstolenes designsystem",
5
5
  "author": "Elsa team",
6
6
  "license": "MIT",