@linzjs/lui 21.20.0 → 21.21.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [21.21.0](https://github.com/linz/lui/compare/v21.20.0...v21.21.0) (2024-02-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * **LuiTab:** exposes button props ([#1095](https://github.com/linz/lui/issues/1095)) ([476aac1](https://github.com/linz/lui/commit/476aac1608298588c8854c9055bc25d1db549d18))
7
+
1
8
  # [21.20.0](https://github.com/linz/lui/compare/v21.19.0...v21.20.0) (2024-02-12)
2
9
 
3
10
 
@@ -1,11 +1,11 @@
1
- import React, { MouseEvent } from 'react';
2
- interface LuiTabProps {
1
+ import React, { ButtonHTMLAttributes, MouseEvent } from 'react';
2
+ export interface LuiTabProps {
3
3
  onClick: (e: MouseEvent) => void | (() => void);
4
4
  active: boolean;
5
5
  id: string;
6
6
  ariaControls: string;
7
7
  titleAttribute?: string;
8
8
  children: React.ReactNode;
9
+ buttonProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'id' | 'aria-selected' | 'aria-controls' | 'title' | 'onClick' | 'children'>;
9
10
  }
10
11
  export declare const LuiTab: React.FC<React.PropsWithChildren<LuiTabProps>>;
11
- export {};
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- interface LuiTabsPanelSwitch {
2
+ import { LuiTabProps } from '../LuiTab/LuiTab';
3
+ interface LuiTabsPanelSwitch extends Omit<LuiTabProps, 'id' | 'ariaControls' | 'active' | 'onClick' | 'children'> {
3
4
  targetPanel: string;
4
5
  setActivePanel?: (targetPanel: string) => {};
5
6
  }
package/dist/index.js CHANGED
@@ -31659,7 +31659,7 @@ var LuiTabs = function (props) {
31659
31659
  };
31660
31660
 
31661
31661
  var LuiTab = function (props) {
31662
- return (React__default["default"].createElement("button", { className: clsx('LuiTab', props.active && 'LuiTab--active'), id: props.id, role: "tab", type: "button", "aria-selected": props.active, "aria-controls": "".concat(props.ariaControls), title: props.titleAttribute, onClick: props.onClick }, props.children));
31662
+ return (React__default["default"].createElement("button", __assign({ className: clsx('LuiTab', props.active && 'LuiTab--active'), id: props.id, role: "tab", type: "button", "aria-selected": props.active, "aria-controls": "".concat(props.ariaControls), title: props.titleAttribute, onClick: props.onClick }, props.buttonProps), props.children));
31663
31663
  };
31664
31664
 
31665
31665
  // import './LuiTabsGroup.scss';
@@ -31681,12 +31681,13 @@ var LuiTabsPanel = function (_a) {
31681
31681
  };
31682
31682
 
31683
31683
  var LuiTabsPanelSwitch = function (props) {
31684
+ var targetPanel = props.targetPanel; props.setActivePanel; var children = props.children, tabProps = __rest(props, ["targetPanel", "setActivePanel", "children"]);
31684
31685
  var context = React.useContext(LuiTabsContext);
31685
- var active = context.activePanel === props.targetPanel;
31686
- return (React__default["default"].createElement(LuiTab, { id: "".concat(props.targetPanel, "-tab"), ariaControls: "".concat(props.targetPanel, "-tab-panel"), active: active, onClick: function () {
31686
+ var active = context.activePanel === targetPanel;
31687
+ return (React__default["default"].createElement(LuiTab, __assign({ id: "".concat(targetPanel, "-tab"), ariaControls: "".concat(targetPanel, "-tab-panel"), active: active, onClick: function () {
31687
31688
  if (context.setActivePanel)
31688
- context.setActivePanel(props.targetPanel);
31689
- } }, props.children));
31689
+ context.setActivePanel(targetPanel);
31690
+ } }, tabProps), children));
31690
31691
  };
31691
31692
 
31692
31693
  var css_248z$g = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.LuiError {\n font-family: \"Open Sans\", system-ui, sans-serif;\n font-style: normal;\n font-weight: 600;\n margin-bottom: 0.5rem;\n font-size: 0.875rem;\n line-height: 1.5rem;\n color: #2a292c;\n}\n.LuiError-errorIcon {\n vertical-align: middle;\n display: inline-block;\n}\n.LuiError-errorText {\n margin-left: 0.5rem;\n}";