@guardian/stand 0.0.56 → 0.0.58
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/Tabs.cjs +5 -0
- package/dist/Tabs.d.cts +5 -0
- package/dist/Tabs.d.ts +5 -0
- package/dist/Tabs.js +3 -0
- package/dist/components/RadioGroup/RadioGroup.cjs +5 -2
- package/dist/components/RadioGroup/RadioGroup.d.cts +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +5 -2
- package/dist/components/RadioGroup/styles.cjs +6 -2
- package/dist/components/RadioGroup/styles.js +6 -2
- package/dist/components/RadioGroup/types.d.cts +5 -0
- package/dist/components/RadioGroup/types.d.ts +5 -0
- package/dist/components/Tabs/Tabs.cjs +88 -0
- package/dist/components/Tabs/Tabs.d.cts +15 -0
- package/dist/components/Tabs/Tabs.d.ts +15 -0
- package/dist/components/Tabs/Tabs.js +86 -0
- package/dist/components/Tabs/styles.cjs +146 -0
- package/dist/components/Tabs/styles.d.cts +17 -0
- package/dist/components/Tabs/styles.d.ts +17 -0
- package/dist/components/Tabs/styles.js +137 -0
- package/dist/components/Tabs/types.d.cts +63 -0
- package/dist/components/Tabs/types.d.ts +63 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/styleD/build/css/component/radioGroup.css +2 -1
- package/dist/styleD/build/css/component/tabs.css +49 -0
- package/dist/styleD/build/typescript/component/radioGroup.cjs +4 -1
- package/dist/styleD/build/typescript/component/radioGroup.d.cts +8 -1
- package/dist/styleD/build/typescript/component/radioGroup.d.ts +8 -1
- package/dist/styleD/build/typescript/component/radioGroup.js +4 -1
- package/dist/styleD/build/typescript/component/tabs.cjs +87 -0
- package/dist/styleD/build/typescript/component/tabs.d.cts +104 -0
- package/dist/styleD/build/typescript/component/tabs.d.ts +104 -0
- package/dist/styleD/build/typescript/component/tabs.js +87 -0
- package/package.json +18 -4
package/dist/Tabs.cjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_tabs = require("./styleD/build/typescript/component/tabs.cjs");
|
|
3
|
+
const require_Tabs = require("./components/Tabs/Tabs.cjs");
|
|
4
|
+
exports.Tabs = require_Tabs.Tabs;
|
|
5
|
+
exports.componentTabs = require_tabs.componentTabs;
|
package/dist/Tabs.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentTabs, componentTabs } from "./styleD/build/typescript/component/tabs.cjs";
|
|
2
|
+
import { PartialTabListTheme, PartialTabPanelTheme, PartialTabPanelsTheme, PartialTabTheme, PartialTabsTheme } from "./components/Tabs/styles.cjs";
|
|
3
|
+
import { TabListProps, TabPanelProps, TabPanelsProps, TabProps, TabsProps } from "./components/Tabs/types.cjs";
|
|
4
|
+
import { Tabs } from "./components/Tabs/Tabs.cjs";
|
|
5
|
+
export { type ComponentTabs, type TabListProps, type PartialTabListTheme as TabListTheme, type TabPanelProps, type PartialTabPanelTheme as TabPanelTheme, type TabPanelsProps, type PartialTabPanelsTheme as TabPanelsTheme, type TabProps, type PartialTabTheme as TabTheme, Tabs, type TabsProps, type PartialTabsTheme as TabsTheme, componentTabs };
|
package/dist/Tabs.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentTabs, componentTabs } from "./styleD/build/typescript/component/tabs.js";
|
|
2
|
+
import { PartialTabListTheme, PartialTabPanelTheme, PartialTabPanelsTheme, PartialTabTheme, PartialTabsTheme } from "./components/Tabs/styles.js";
|
|
3
|
+
import { TabListProps, TabPanelProps, TabPanelsProps, TabProps, TabsProps } from "./components/Tabs/types.js";
|
|
4
|
+
import { Tabs } from "./components/Tabs/Tabs.js";
|
|
5
|
+
export { type ComponentTabs, type TabListProps, type PartialTabListTheme as TabListTheme, type TabPanelProps, type PartialTabPanelTheme as TabPanelTheme, type TabPanelsProps, type PartialTabPanelsTheme as TabPanelsTheme, type TabProps, type PartialTabTheme as TabTheme, Tabs, type TabsProps, type PartialTabsTheme as TabsTheme, componentTabs };
|
package/dist/Tabs.js
ADDED
|
@@ -7,7 +7,7 @@ react = require_runtime.__toESM(react);
|
|
|
7
7
|
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
8
8
|
let react_aria_components = require("react-aria-components");
|
|
9
9
|
//#region src/components/RadioGroup/RadioGroup.tsx
|
|
10
|
-
function RadioGroup({ size = "md", isInvalid = false, theme = {}, children, ...props }) {
|
|
10
|
+
function RadioGroup({ size = "md", orientation = "vertical", isInvalid = false, theme = {}, children, ...props }) {
|
|
11
11
|
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultRadioGroupTheme, theme);
|
|
12
12
|
const radios = [];
|
|
13
13
|
react.default.Children.forEach(children, (child) => {
|
|
@@ -24,7 +24,10 @@ function RadioGroup({ size = "md", isInvalid = false, theme = {}, children, ...p
|
|
|
24
24
|
isInvalid,
|
|
25
25
|
...props,
|
|
26
26
|
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
27
|
-
css: require_styles.radioGroupStyles(mergedTheme, {
|
|
27
|
+
css: require_styles.radioGroupStyles(mergedTheme, {
|
|
28
|
+
size,
|
|
29
|
+
orientation
|
|
30
|
+
}),
|
|
28
31
|
children: radios
|
|
29
32
|
})
|
|
30
33
|
});
|
|
@@ -5,7 +5,7 @@ import React from "react";
|
|
|
5
5
|
import { Fragment, jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
6
6
|
import { Radio, RadioGroup, composeRenderProps } from "react-aria-components";
|
|
7
7
|
//#region src/components/RadioGroup/RadioGroup.tsx
|
|
8
|
-
function RadioGroup$1({ size = "md", isInvalid = false, theme = {}, children, ...props }) {
|
|
8
|
+
function RadioGroup$1({ size = "md", orientation = "vertical", isInvalid = false, theme = {}, children, ...props }) {
|
|
9
9
|
const mergedTheme = mergeDeep(defaultRadioGroupTheme, theme);
|
|
10
10
|
const radios = [];
|
|
11
11
|
React.Children.forEach(children, (child) => {
|
|
@@ -22,7 +22,10 @@ function RadioGroup$1({ size = "md", isInvalid = false, theme = {}, children, ..
|
|
|
22
22
|
isInvalid,
|
|
23
23
|
...props,
|
|
24
24
|
children: /* @__PURE__ */ jsx("div", {
|
|
25
|
-
css: radioGroupStyles(mergedTheme, {
|
|
25
|
+
css: radioGroupStyles(mergedTheme, {
|
|
26
|
+
size,
|
|
27
|
+
orientation
|
|
28
|
+
}),
|
|
26
29
|
children: radios
|
|
27
30
|
})
|
|
28
31
|
});
|
|
@@ -3,13 +3,17 @@ const require_radioGroup = require("../../styleD/build/typescript/component/radi
|
|
|
3
3
|
let _emotion_react = require("@emotion/react");
|
|
4
4
|
//#region src/components/RadioGroup/styles.ts
|
|
5
5
|
const defaultRadioGroupTheme = require_radioGroup.componentRadioGroup;
|
|
6
|
-
const radioGroupStyles = (theme, { size }) => {
|
|
6
|
+
const radioGroupStyles = (theme, { size, orientation }) => {
|
|
7
7
|
return _emotion_react.css`
|
|
8
8
|
display: ${theme.shared.display};
|
|
9
|
-
flex-direction: ${theme.shared.flexDirection};
|
|
9
|
+
flex-direction: ${theme.shared.orientation.vertical.flexDirection};
|
|
10
10
|
gap: ${theme[size].gap};
|
|
11
11
|
margin-top: ${theme.shared.marginTop};
|
|
12
12
|
margin-bottom: ${theme.shared.marginBottom};
|
|
13
|
+
|
|
14
|
+
${orientation === "horizontal" && _emotion_react.css`
|
|
15
|
+
flex-direction: ${theme.shared.orientation.horizontal.flexDirection};
|
|
16
|
+
`}
|
|
13
17
|
`;
|
|
14
18
|
};
|
|
15
19
|
const radioStyles = (theme, { size, isInvalid }) => {
|
|
@@ -3,13 +3,17 @@ import { componentRadioGroup } from "../../styleD/build/typescript/component/rad
|
|
|
3
3
|
import { css } from "@emotion/react";
|
|
4
4
|
//#region src/components/RadioGroup/styles.ts
|
|
5
5
|
const defaultRadioGroupTheme = componentRadioGroup;
|
|
6
|
-
const radioGroupStyles = (theme, { size }) => {
|
|
6
|
+
const radioGroupStyles = (theme, { size, orientation }) => {
|
|
7
7
|
return css`
|
|
8
8
|
display: ${theme.shared.display};
|
|
9
|
-
flex-direction: ${theme.shared.flexDirection};
|
|
9
|
+
flex-direction: ${theme.shared.orientation.vertical.flexDirection};
|
|
10
10
|
gap: ${theme[size].gap};
|
|
11
11
|
margin-top: ${theme.shared.marginTop};
|
|
12
12
|
margin-bottom: ${theme.shared.marginBottom};
|
|
13
|
+
|
|
14
|
+
${orientation === "horizontal" && css`
|
|
15
|
+
flex-direction: ${theme.shared.orientation.horizontal.flexDirection};
|
|
16
|
+
`}
|
|
13
17
|
`;
|
|
14
18
|
};
|
|
15
19
|
const radioStyles = (theme, { size, isInvalid }) => {
|
|
@@ -7,6 +7,11 @@ import { RadioGroupProps, RadioProps } from "react-aria-components";
|
|
|
7
7
|
type RadioGroupProps$1 = FormInputContainerDefaultProps<RadioGroupProps, RadioGroupTheme>;
|
|
8
8
|
interface RadioProps$1 extends DefaultProps<RadioGroupTheme, RadioProps['className']>, RadioProps {
|
|
9
9
|
size?: keyof Omit<RadioGroupTheme, 'shared'>;
|
|
10
|
+
/**
|
|
11
|
+
* Orientation of the radio buttons. Can be either 'horizontal' or 'vertical'.
|
|
12
|
+
* @default 'vertical'
|
|
13
|
+
*/
|
|
14
|
+
orientation?: 'horizontal' | 'vertical';
|
|
10
15
|
/** Whether the input value is invalid. */
|
|
11
16
|
isInvalid?: boolean;
|
|
12
17
|
}
|
|
@@ -7,6 +7,11 @@ import { RadioGroupProps, RadioProps } from "react-aria-components";
|
|
|
7
7
|
type RadioGroupProps$1 = FormInputContainerDefaultProps<RadioGroupProps, RadioGroupTheme>;
|
|
8
8
|
interface RadioProps$1 extends DefaultProps<RadioGroupTheme, RadioProps['className']>, RadioProps {
|
|
9
9
|
size?: keyof Omit<RadioGroupTheme, 'shared'>;
|
|
10
|
+
/**
|
|
11
|
+
* Orientation of the radio buttons. Can be either 'horizontal' or 'vertical'.
|
|
12
|
+
* @default 'vertical'
|
|
13
|
+
*/
|
|
14
|
+
orientation?: 'horizontal' | 'vertical';
|
|
10
15
|
/** Whether the input value is invalid. */
|
|
11
16
|
isInvalid?: boolean;
|
|
12
17
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_mergeDeep = require("../../util/mergeDeep.cjs");
|
|
3
|
+
const require_Icon = require("../Icon/Icon.cjs");
|
|
4
|
+
const require_styles = require("./styles.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_runtime.__toESM(react);
|
|
7
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
8
|
+
let react_aria_components = require("react-aria-components");
|
|
9
|
+
//#region src/components/Tabs/Tabs.tsx
|
|
10
|
+
function TabsRoot({ children, orientation = "horizontal", size = "md", theme = {}, cssOverrides, ...props }) {
|
|
11
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultTabsTheme, theme);
|
|
12
|
+
const validChildren = [];
|
|
13
|
+
react.default.Children.forEach(children, (child, i) => {
|
|
14
|
+
if (!react.default.isValidElement(child)) return;
|
|
15
|
+
if (child.type === TabList || child.type === TabPanels) validChildren.push(react.default.cloneElement(child, {
|
|
16
|
+
key: `${child.key}-${i}`,
|
|
17
|
+
orientation,
|
|
18
|
+
size
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.Tabs, {
|
|
22
|
+
css: [require_styles.tabsStyles(mergedTheme), cssOverrides],
|
|
23
|
+
orientation,
|
|
24
|
+
...props,
|
|
25
|
+
children: validChildren
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function TabList({ children, orientation = "horizontal", size = "md", theme = {}, cssOverrides, ...props }) {
|
|
29
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultTabListTheme, theme);
|
|
30
|
+
const tabs = [];
|
|
31
|
+
react.default.Children.forEach(children, (child, i) => {
|
|
32
|
+
if (!react.default.isValidElement(child)) return;
|
|
33
|
+
if (child.type === Tab) tabs.push(react.default.cloneElement(child, {
|
|
34
|
+
key: `${child.key}-${i}`,
|
|
35
|
+
orientation,
|
|
36
|
+
size
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.TabList, {
|
|
40
|
+
css: [require_styles.tabListStyles(mergedTheme), cssOverrides],
|
|
41
|
+
...props,
|
|
42
|
+
children: tabs
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function Tab({ children, orientation = "horizontal", size = "md", icon, theme = {}, cssOverrides, ...props }) {
|
|
46
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultTabTheme, theme);
|
|
47
|
+
const iconSize = size === "md" ? "lg" : "sm";
|
|
48
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(react_aria_components.Tab, {
|
|
49
|
+
css: [require_styles.tabStyles(mergedTheme, {
|
|
50
|
+
orientation,
|
|
51
|
+
size,
|
|
52
|
+
icon
|
|
53
|
+
}), cssOverrides],
|
|
54
|
+
...props,
|
|
55
|
+
children: [icon && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
56
|
+
size: iconSize,
|
|
57
|
+
children: icon
|
|
58
|
+
}), children]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function TabPanels({ children, theme = {}, cssOverrides, ...props }) {
|
|
62
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultTabPanelsTheme, theme);
|
|
63
|
+
const panels = [];
|
|
64
|
+
react.default.Children.forEach(children, (child, i) => {
|
|
65
|
+
if (!react.default.isValidElement(child)) return;
|
|
66
|
+
if (child.type === TabPanel) panels.push(react.default.cloneElement(child, { key: `${child.key}-${i}` }));
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.TabPanels, {
|
|
69
|
+
css: [require_styles.tabPanelsStyles(mergedTheme), cssOverrides],
|
|
70
|
+
...props,
|
|
71
|
+
children: panels
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function TabPanel({ children, theme = {}, cssOverrides, ...props }) {
|
|
75
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.TabPanel, {
|
|
76
|
+
css: [require_styles.tabPanelStyles(require_mergeDeep.mergeDeep(require_styles.defaultTabPanelTheme, theme)), cssOverrides],
|
|
77
|
+
...props,
|
|
78
|
+
children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const Tabs = Object.assign(TabsRoot, {
|
|
82
|
+
TabList,
|
|
83
|
+
Tab,
|
|
84
|
+
TabPanels,
|
|
85
|
+
TabPanel
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
exports.Tabs = Tabs;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabPanelsProps as TabPanelsProps$1, TabProps as TabProps$1, TabsProps as TabsProps$1 } from "./types.cjs";
|
|
2
|
+
import { Tab, TabList, TabPanel, TabPanels, Tabs } from "react-aria-components";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Tabs/Tabs.d.ts
|
|
6
|
+
interface TabsCompound {
|
|
7
|
+
(props: TabsProps$1): React.ReactElement<TabsProps$1, typeof Tabs>;
|
|
8
|
+
TabList: (props: TabListProps$1) => React.ReactElement<TabListProps$1, typeof TabList>;
|
|
9
|
+
Tab: (props: TabProps$1) => React.ReactElement<TabProps$1, typeof Tab>;
|
|
10
|
+
TabPanels: (props: TabPanelsProps$1) => React.ReactElement<TabPanelsProps$1, typeof TabPanels>;
|
|
11
|
+
TabPanel: (props: TabPanelProps$1) => React.ReactElement<TabPanelProps$1, typeof TabPanel>;
|
|
12
|
+
}
|
|
13
|
+
declare const Tabs$1: TabsCompound;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Tabs$1 as Tabs };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabPanelsProps as TabPanelsProps$1, TabProps as TabProps$1, TabsProps as TabsProps$1 } from "./types.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Tab, TabList, TabPanel, TabPanels, Tabs } from "react-aria-components";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Tabs/Tabs.d.ts
|
|
6
|
+
interface TabsCompound {
|
|
7
|
+
(props: TabsProps$1): React.ReactElement<TabsProps$1, typeof Tabs>;
|
|
8
|
+
TabList: (props: TabListProps$1) => React.ReactElement<TabListProps$1, typeof TabList>;
|
|
9
|
+
Tab: (props: TabProps$1) => React.ReactElement<TabProps$1, typeof Tab>;
|
|
10
|
+
TabPanels: (props: TabPanelsProps$1) => React.ReactElement<TabPanelsProps$1, typeof TabPanels>;
|
|
11
|
+
TabPanel: (props: TabPanelProps$1) => React.ReactElement<TabPanelProps$1, typeof TabPanel>;
|
|
12
|
+
}
|
|
13
|
+
declare const Tabs$1: TabsCompound;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Tabs$1 as Tabs };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { mergeDeep } from "../../util/mergeDeep.js";
|
|
2
|
+
import { Icon } from "../Icon/Icon.js";
|
|
3
|
+
import { defaultTabListTheme, defaultTabPanelTheme, defaultTabPanelsTheme, defaultTabTheme, defaultTabsTheme, tabListStyles, tabPanelStyles, tabPanelsStyles, tabStyles, tabsStyles } from "./styles.js";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
6
|
+
import { Tab, TabList, TabPanel, TabPanels, Tabs } from "react-aria-components";
|
|
7
|
+
//#region src/components/Tabs/Tabs.tsx
|
|
8
|
+
function TabsRoot({ children, orientation = "horizontal", size = "md", theme = {}, cssOverrides, ...props }) {
|
|
9
|
+
const mergedTheme = mergeDeep(defaultTabsTheme, theme);
|
|
10
|
+
const validChildren = [];
|
|
11
|
+
React.Children.forEach(children, (child, i) => {
|
|
12
|
+
if (!React.isValidElement(child)) return;
|
|
13
|
+
if (child.type === TabList$1 || child.type === TabPanels$1) validChildren.push(React.cloneElement(child, {
|
|
14
|
+
key: `${child.key}-${i}`,
|
|
15
|
+
orientation,
|
|
16
|
+
size
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx(Tabs, {
|
|
20
|
+
css: [tabsStyles(mergedTheme), cssOverrides],
|
|
21
|
+
orientation,
|
|
22
|
+
...props,
|
|
23
|
+
children: validChildren
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function TabList$1({ children, orientation = "horizontal", size = "md", theme = {}, cssOverrides, ...props }) {
|
|
27
|
+
const mergedTheme = mergeDeep(defaultTabListTheme, theme);
|
|
28
|
+
const tabs = [];
|
|
29
|
+
React.Children.forEach(children, (child, i) => {
|
|
30
|
+
if (!React.isValidElement(child)) return;
|
|
31
|
+
if (child.type === Tab$1) tabs.push(React.cloneElement(child, {
|
|
32
|
+
key: `${child.key}-${i}`,
|
|
33
|
+
orientation,
|
|
34
|
+
size
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ jsx(TabList, {
|
|
38
|
+
css: [tabListStyles(mergedTheme), cssOverrides],
|
|
39
|
+
...props,
|
|
40
|
+
children: tabs
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function Tab$1({ children, orientation = "horizontal", size = "md", icon, theme = {}, cssOverrides, ...props }) {
|
|
44
|
+
const mergedTheme = mergeDeep(defaultTabTheme, theme);
|
|
45
|
+
const iconSize = size === "md" ? "lg" : "sm";
|
|
46
|
+
return /* @__PURE__ */ jsxs(Tab, {
|
|
47
|
+
css: [tabStyles(mergedTheme, {
|
|
48
|
+
orientation,
|
|
49
|
+
size,
|
|
50
|
+
icon
|
|
51
|
+
}), cssOverrides],
|
|
52
|
+
...props,
|
|
53
|
+
children: [icon && /* @__PURE__ */ jsx(Icon, {
|
|
54
|
+
size: iconSize,
|
|
55
|
+
children: icon
|
|
56
|
+
}), children]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function TabPanels$1({ children, theme = {}, cssOverrides, ...props }) {
|
|
60
|
+
const mergedTheme = mergeDeep(defaultTabPanelsTheme, theme);
|
|
61
|
+
const panels = [];
|
|
62
|
+
React.Children.forEach(children, (child, i) => {
|
|
63
|
+
if (!React.isValidElement(child)) return;
|
|
64
|
+
if (child.type === TabPanel$1) panels.push(React.cloneElement(child, { key: `${child.key}-${i}` }));
|
|
65
|
+
});
|
|
66
|
+
return /* @__PURE__ */ jsx(TabPanels, {
|
|
67
|
+
css: [tabPanelsStyles(mergedTheme), cssOverrides],
|
|
68
|
+
...props,
|
|
69
|
+
children: panels
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function TabPanel$1({ children, theme = {}, cssOverrides, ...props }) {
|
|
73
|
+
return /* @__PURE__ */ jsx(TabPanel, {
|
|
74
|
+
css: [tabPanelStyles(mergeDeep(defaultTabPanelTheme, theme)), cssOverrides],
|
|
75
|
+
...props,
|
|
76
|
+
children
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const Tabs$1 = Object.assign(TabsRoot, {
|
|
80
|
+
TabList: TabList$1,
|
|
81
|
+
Tab: Tab$1,
|
|
82
|
+
TabPanels: TabPanels$1,
|
|
83
|
+
TabPanel: TabPanel$1
|
|
84
|
+
});
|
|
85
|
+
//#endregion
|
|
86
|
+
export { Tabs$1 as Tabs };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const require_typography = require("../../styleD/utils/semantic/typography.cjs");
|
|
2
|
+
const require_tabs = require("../../styleD/build/typescript/component/tabs.cjs");
|
|
3
|
+
let _emotion_react = require("@emotion/react");
|
|
4
|
+
//#region src/components/Tabs/styles.ts
|
|
5
|
+
const defaultTabsTheme = require_tabs.componentTabs.tabs;
|
|
6
|
+
const tabsStyles = (theme) => {
|
|
7
|
+
return _emotion_react.css`
|
|
8
|
+
display: ${theme.shared.display};
|
|
9
|
+
max-width: ${theme.shared.maxWidth};
|
|
10
|
+
|
|
11
|
+
&[data-orientation='vertical'] {
|
|
12
|
+
flex-direction: ${theme.shared.orientation.vertical.flexDirection};
|
|
13
|
+
width: ${theme.shared.orientation.vertical.width};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&[data-orientation='horizontal'] {
|
|
17
|
+
flex-direction: ${theme.shared.orientation.horizontal.flexDirection};
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
const defaultTabTheme = require_tabs.componentTabs.tab;
|
|
22
|
+
const tabStyles = (theme, { orientation, size, icon }) => {
|
|
23
|
+
const hasIcon = !!icon;
|
|
24
|
+
return _emotion_react.css`
|
|
25
|
+
position: ${theme.shared.position};
|
|
26
|
+
display: ${theme.shared.display};
|
|
27
|
+
gap: ${theme.shared.gap};
|
|
28
|
+
height: ${theme[size].height};
|
|
29
|
+
cursor: ${theme.shared.cursor};
|
|
30
|
+
flex-direction: ${theme.shared.flexDirection};
|
|
31
|
+
justify-content: ${theme.shared.justifyContent};
|
|
32
|
+
align-items: ${theme.shared.alignItems};
|
|
33
|
+
padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
|
|
34
|
+
${theme.shared.padding.bottom} ${theme.shared.padding.left};
|
|
35
|
+
${hasIcon && _emotion_react.css`
|
|
36
|
+
padding-right: ${theme.shared.padding.withIcon.right};
|
|
37
|
+
`}
|
|
38
|
+
color: ${theme.shared.color};
|
|
39
|
+
${require_typography.convertTypographyToEmotionStringStyle(theme[size].typography)}
|
|
40
|
+
|
|
41
|
+
&[data-disabled] {
|
|
42
|
+
cursor: ${theme.shared.disabled.cursor};
|
|
43
|
+
color: ${theme.shared.disabled.color};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Override default browser focus behaviour */
|
|
47
|
+
&:focus-visible {
|
|
48
|
+
outline: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&[data-focus-visible] {
|
|
52
|
+
outline: ${theme.shared.focusVisible.outline};
|
|
53
|
+
outline-offset: ${theme.shared.focusVisible.outlineOffset};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&[data-selected] {
|
|
57
|
+
background: ${theme.shared.selected.background};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&[data-hovered]::after,
|
|
61
|
+
&[data-selected]::after {
|
|
62
|
+
background: ${theme.shared.selected.border.background};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
${orientation === "horizontal" && _emotion_react.css`
|
|
66
|
+
border-right: ${theme.shared.border};
|
|
67
|
+
|
|
68
|
+
&:first-child {
|
|
69
|
+
border-left: ${theme.shared.border};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&::after {
|
|
73
|
+
content: '';
|
|
74
|
+
position: absolute;
|
|
75
|
+
bottom: 0;
|
|
76
|
+
left: 0;
|
|
77
|
+
right: 0;
|
|
78
|
+
height: ${theme.shared.selected.border.size};
|
|
79
|
+
background: transparent;
|
|
80
|
+
}
|
|
81
|
+
`}
|
|
82
|
+
|
|
83
|
+
${orientation === "vertical" && _emotion_react.css`
|
|
84
|
+
border-bottom: ${theme.shared.border};
|
|
85
|
+
padding-right: ${theme.shared.padding.verticalRight};
|
|
86
|
+
${hasIcon && _emotion_react.css`
|
|
87
|
+
padding-right: ${theme.shared.padding.withIcon.verticalRight};
|
|
88
|
+
`}
|
|
89
|
+
|
|
90
|
+
&:first-child {
|
|
91
|
+
border-top: ${theme.shared.border};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&::after {
|
|
95
|
+
content: '';
|
|
96
|
+
position: absolute;
|
|
97
|
+
top: 0;
|
|
98
|
+
bottom: 0;
|
|
99
|
+
right: 0;
|
|
100
|
+
width: ${theme.shared.selected.border.size};
|
|
101
|
+
background: transparent;
|
|
102
|
+
}
|
|
103
|
+
`}
|
|
104
|
+
`;
|
|
105
|
+
};
|
|
106
|
+
const defaultTabListTheme = require_tabs.componentTabs.tabList;
|
|
107
|
+
const tabListStyles = (theme) => {
|
|
108
|
+
return _emotion_react.css`
|
|
109
|
+
display: ${theme.shared.display};
|
|
110
|
+
|
|
111
|
+
&[data-orientation='horizontal'] {
|
|
112
|
+
flex-direction: ${theme.shared.orientation.horizontal.flexDirection};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&[data-orientation='vertical'] {
|
|
116
|
+
flex-direction: ${theme.shared.orientation.vertical.flexDirection};
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
};
|
|
120
|
+
const defaultTabPanelsTheme = require_tabs.componentTabs.tabPanels;
|
|
121
|
+
const tabPanelsStyles = (theme) => {
|
|
122
|
+
return _emotion_react.css`
|
|
123
|
+
position: ${theme.shared.position};
|
|
124
|
+
height: var(--tab-panel-height, auto);
|
|
125
|
+
width: var(--tab-panel-width, auto);
|
|
126
|
+
overflow: ${theme.shared.overflow};
|
|
127
|
+
`;
|
|
128
|
+
};
|
|
129
|
+
const defaultTabPanelTheme = require_tabs.componentTabs.tabPanel;
|
|
130
|
+
const tabPanelStyles = (theme) => {
|
|
131
|
+
return _emotion_react.css`
|
|
132
|
+
/* TODO: Designs to be provided for tab panel */
|
|
133
|
+
position: ${theme.shared.position};
|
|
134
|
+
`;
|
|
135
|
+
};
|
|
136
|
+
//#endregion
|
|
137
|
+
exports.defaultTabListTheme = defaultTabListTheme;
|
|
138
|
+
exports.defaultTabPanelTheme = defaultTabPanelTheme;
|
|
139
|
+
exports.defaultTabPanelsTheme = defaultTabPanelsTheme;
|
|
140
|
+
exports.defaultTabTheme = defaultTabTheme;
|
|
141
|
+
exports.defaultTabsTheme = defaultTabsTheme;
|
|
142
|
+
exports.tabListStyles = tabListStyles;
|
|
143
|
+
exports.tabPanelStyles = tabPanelStyles;
|
|
144
|
+
exports.tabPanelsStyles = tabPanelsStyles;
|
|
145
|
+
exports.tabStyles = tabStyles;
|
|
146
|
+
exports.tabsStyles = tabsStyles;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DeepPartial, Prettify } from "../../util/types.cjs";
|
|
2
|
+
import { ComponentTabs } from "../../styleD/build/typescript/component/tabs.cjs";
|
|
3
|
+
import { SerializedStyles } from "@emotion/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Tabs/styles.d.ts
|
|
6
|
+
type TabsTheme = Prettify<ComponentTabs['tabs']>;
|
|
7
|
+
type PartialTabsTheme = DeepPartial<TabsTheme>;
|
|
8
|
+
type TabTheme = Prettify<ComponentTabs['tab']>;
|
|
9
|
+
type PartialTabTheme = DeepPartial<TabTheme>;
|
|
10
|
+
type TabListTheme = Prettify<ComponentTabs['tabList']>;
|
|
11
|
+
type PartialTabListTheme = DeepPartial<TabListTheme>;
|
|
12
|
+
type TabPanelsTheme = Prettify<ComponentTabs['tabPanels']>;
|
|
13
|
+
type PartialTabPanelsTheme = DeepPartial<TabPanelsTheme>;
|
|
14
|
+
type TabPanelTheme = Prettify<ComponentTabs['tabPanel']>;
|
|
15
|
+
type PartialTabPanelTheme = DeepPartial<TabPanelTheme>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { PartialTabListTheme, PartialTabPanelTheme, PartialTabPanelsTheme, PartialTabTheme, PartialTabsTheme, TabListTheme, TabPanelTheme, TabPanelsTheme, TabTheme, TabsTheme };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DeepPartial, Prettify } from "../../util/types.js";
|
|
2
|
+
import { ComponentTabs } from "../../styleD/build/typescript/component/tabs.js";
|
|
3
|
+
import { SerializedStyles } from "@emotion/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Tabs/styles.d.ts
|
|
6
|
+
type TabsTheme = Prettify<ComponentTabs['tabs']>;
|
|
7
|
+
type PartialTabsTheme = DeepPartial<TabsTheme>;
|
|
8
|
+
type TabTheme = Prettify<ComponentTabs['tab']>;
|
|
9
|
+
type PartialTabTheme = DeepPartial<TabTheme>;
|
|
10
|
+
type TabListTheme = Prettify<ComponentTabs['tabList']>;
|
|
11
|
+
type PartialTabListTheme = DeepPartial<TabListTheme>;
|
|
12
|
+
type TabPanelsTheme = Prettify<ComponentTabs['tabPanels']>;
|
|
13
|
+
type PartialTabPanelsTheme = DeepPartial<TabPanelsTheme>;
|
|
14
|
+
type TabPanelTheme = Prettify<ComponentTabs['tabPanel']>;
|
|
15
|
+
type PartialTabPanelTheme = DeepPartial<TabPanelTheme>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { PartialTabListTheme, PartialTabPanelTheme, PartialTabPanelsTheme, PartialTabTheme, PartialTabsTheme, TabListTheme, TabPanelTheme, TabPanelsTheme, TabTheme, TabsTheme };
|