@norges-domstoler/dds-components 20.0.0 → 20.1.0

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
@@ -2757,6 +2757,7 @@ declare const Tabs: {
2757
2757
  displayName: string;
2758
2758
  };
2759
2759
 
2760
+ type PickedAttributes = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>;
2760
2761
  type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2761
2762
  /**Spesifiserer om fanen er aktiv.
2762
2763
  * @default false
@@ -2774,7 +2775,7 @@ type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2774
2775
  * @default "1fr"
2775
2776
  */
2776
2777
  width?: CSS.Properties['width'];
2777
- } & Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>>;
2778
+ } & PickedAttributes, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof PickedAttributes>>;
2778
2779
  declare const Tab: {
2779
2780
  ({ active, icon, children, focus, setFocus, index, onClick, onKeyDown, id, className, htmlProps, width, ref, ...rest }: TabProps): react_jsx_runtime.JSX.Element;
2780
2781
  displayName: string;
package/dist/index.d.ts CHANGED
@@ -2757,6 +2757,7 @@ declare const Tabs: {
2757
2757
  displayName: string;
2758
2758
  };
2759
2759
 
2760
+ type PickedAttributes = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>;
2760
2761
  type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2761
2762
  /**Spesifiserer om fanen er aktiv.
2762
2763
  * @default false
@@ -2774,7 +2775,7 @@ type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2774
2775
  * @default "1fr"
2775
2776
  */
2776
2777
  width?: CSS.Properties['width'];
2777
- } & Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>>;
2778
+ } & PickedAttributes, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof PickedAttributes>>;
2778
2779
  declare const Tab: {
2779
2780
  ({ active, icon, children, focus, setFocus, index, onClick, onKeyDown, id, className, htmlProps, width, ref, ...rest }: TabProps): react_jsx_runtime.JSX.Element;
2780
2781
  displayName: string;
package/dist/index.js CHANGED
@@ -11663,7 +11663,7 @@ var Tab = ({
11663
11663
  onKeyDown,
11664
11664
  id,
11665
11665
  className,
11666
- htmlProps,
11666
+ htmlProps = {},
11667
11667
  width = "1fr",
11668
11668
  ref,
11669
11669
  ...rest
@@ -11672,6 +11672,8 @@ var Tab = ({
11672
11672
  const itemRef = (0, import_react86.useRef)(null);
11673
11673
  const combinedRef = useCombinedRef(ref, itemRef);
11674
11674
  const { tabContentDirection, size: size2 } = useTabsContext();
11675
+ const { type = "button", ...restHtmlProps } = htmlProps;
11676
+ const fixedHtmlProps = { type, ...restHtmlProps };
11675
11677
  (0, import_react86.useEffect)(() => {
11676
11678
  var _a;
11677
11679
  if (focus) {
@@ -11685,11 +11687,11 @@ var Tab = ({
11685
11687
  }, [index, setFocus]);
11686
11688
  const handleOnClick = (e) => {
11687
11689
  handleSelect();
11688
- onClick && onClick(e);
11690
+ onClick == null ? void 0 : onClick(e);
11689
11691
  };
11690
11692
  const handleOnKeyDown = (e) => {
11691
11693
  handleSelect();
11692
- onKeyDown && onKeyDown(e);
11694
+ onKeyDown == null ? void 0 : onKeyDown(e);
11693
11695
  };
11694
11696
  return /* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(
11695
11697
  "button",
@@ -11705,7 +11707,7 @@ var Tab = ({
11705
11707
  typographyStyles_default[`body-${size2}`],
11706
11708
  focus_default["focusable--inset"]
11707
11709
  ),
11708
- htmlProps,
11710
+ fixedHtmlProps,
11709
11711
  rest
11710
11712
  ),
11711
11713
  ref: combinedRef,
@@ -11755,6 +11757,7 @@ var TabList = ({
11755
11757
  return (0, import_react87.isValidElement)(child) && (0, import_react87.cloneElement)(child, {
11756
11758
  id: `${tabsId}-tab-${index}`,
11757
11759
  htmlProps: {
11760
+ ...child.props.htmlProps,
11758
11761
  "aria-controls": `${tabsId}-panel-${index}`
11759
11762
  },
11760
11763
  active: activeTab === index,