@guardian/stand 0.0.55 → 0.0.57
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/ButtonGroup.cjs +5 -0
- package/dist/ButtonGroup.d.cts +5 -0
- package/dist/ButtonGroup.d.ts +5 -0
- package/dist/ButtonGroup.js +3 -0
- 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/ButtonGroup/ButtonGroup.cjs +25 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.cts +11 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +11 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +23 -0
- package/dist/components/ButtonGroup/styles.cjs +21 -0
- package/dist/components/ButtonGroup/styles.d.cts +9 -0
- package/dist/components/ButtonGroup/styles.d.ts +9 -0
- package/dist/components/ButtonGroup/styles.js +20 -0
- package/dist/components/ButtonGroup/types.d.cts +13 -0
- package/dist/components/ButtonGroup/types.d.ts +13 -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 +4 -0
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/styleD/build/css/component/buttonGroup.css +13 -0
- package/dist/styleD/build/css/component/tabs.css +49 -0
- package/dist/styleD/build/typescript/component/buttonGroup.cjs +15 -0
- package/dist/styleD/build/typescript/component/buttonGroup.d.cts +18 -0
- package/dist/styleD/build/typescript/component/buttonGroup.d.ts +18 -0
- package/dist/styleD/build/typescript/component/buttonGroup.js +15 -0
- 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 +32 -4
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_buttonGroup = require("./styleD/build/typescript/component/buttonGroup.cjs");
|
|
3
|
+
const require_ButtonGroup = require("./components/ButtonGroup/ButtonGroup.cjs");
|
|
4
|
+
exports.ButtonGroup = require_ButtonGroup.ButtonGroup;
|
|
5
|
+
exports.componentButtonGroup = require_buttonGroup.componentButtonGroup;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentButtonGroup, componentButtonGroup } from "./styleD/build/typescript/component/buttonGroup.cjs";
|
|
2
|
+
import { PartialButtonGroupTheme } from "./components/ButtonGroup/styles.cjs";
|
|
3
|
+
import { ButtonGroupProps } from "./components/ButtonGroup/types.cjs";
|
|
4
|
+
import { ButtonGroup } from "./components/ButtonGroup/ButtonGroup.cjs";
|
|
5
|
+
export { ButtonGroup, type ButtonGroupProps, type PartialButtonGroupTheme as ButtonGroupTheme, type ComponentButtonGroup, componentButtonGroup };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentButtonGroup, componentButtonGroup } from "./styleD/build/typescript/component/buttonGroup.js";
|
|
2
|
+
import { PartialButtonGroupTheme } from "./components/ButtonGroup/styles.js";
|
|
3
|
+
import { ButtonGroupProps } from "./components/ButtonGroup/types.js";
|
|
4
|
+
import { ButtonGroup } from "./components/ButtonGroup/ButtonGroup.js";
|
|
5
|
+
export { ButtonGroup, type ButtonGroupProps, type PartialButtonGroupTheme as ButtonGroupTheme, type ComponentButtonGroup, componentButtonGroup };
|
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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_mergeDeep = require("../../util/mergeDeep.cjs");
|
|
3
|
+
const require_Button = require("../Button/Button.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
|
+
//#region src/components/ButtonGroup/ButtonGroup.tsx
|
|
9
|
+
const ButtonGroup = ({ size = "md", theme = {}, children, cssOverrides }) => {
|
|
10
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultButtonGroupTheme, theme);
|
|
11
|
+
const buttons = [];
|
|
12
|
+
react.default.Children.forEach(children, (child, index) => {
|
|
13
|
+
if (!react.default.isValidElement(child) || child.type !== require_Button.Button) return;
|
|
14
|
+
buttons.push(react.default.cloneElement(child, {
|
|
15
|
+
key: child.key ?? index,
|
|
16
|
+
size
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
20
|
+
css: [require_styles.buttonGroupStyles(mergedTheme), cssOverrides],
|
|
21
|
+
children: buttons
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.ButtonGroup = ButtonGroup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ButtonGroupProps } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ButtonGroup/ButtonGroup.d.ts
|
|
4
|
+
declare const ButtonGroup: ({
|
|
5
|
+
size,
|
|
6
|
+
theme,
|
|
7
|
+
children,
|
|
8
|
+
cssOverrides
|
|
9
|
+
}: ButtonGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ButtonGroup };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ButtonGroupProps } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ButtonGroup/ButtonGroup.d.ts
|
|
4
|
+
declare const ButtonGroup: ({
|
|
5
|
+
size,
|
|
6
|
+
theme,
|
|
7
|
+
children,
|
|
8
|
+
cssOverrides
|
|
9
|
+
}: ButtonGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ButtonGroup };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { mergeDeep } from "../../util/mergeDeep.js";
|
|
2
|
+
import { Button } from "../Button/Button.js";
|
|
3
|
+
import { buttonGroupStyles, defaultButtonGroupTheme } from "./styles.js";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
6
|
+
//#region src/components/ButtonGroup/ButtonGroup.tsx
|
|
7
|
+
const ButtonGroup = ({ size = "md", theme = {}, children, cssOverrides }) => {
|
|
8
|
+
const mergedTheme = mergeDeep(defaultButtonGroupTheme, theme);
|
|
9
|
+
const buttons = [];
|
|
10
|
+
React.Children.forEach(children, (child, index) => {
|
|
11
|
+
if (!React.isValidElement(child) || child.type !== Button) return;
|
|
12
|
+
buttons.push(React.cloneElement(child, {
|
|
13
|
+
key: child.key ?? index,
|
|
14
|
+
size
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
css: [buttonGroupStyles(mergedTheme), cssOverrides],
|
|
19
|
+
children: buttons
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ButtonGroup };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_mq = require("../../styleD/utils/semantic/mq.cjs");
|
|
2
|
+
const require_buttonGroup = require("../../styleD/build/typescript/component/buttonGroup.cjs");
|
|
3
|
+
let _emotion_react = require("@emotion/react");
|
|
4
|
+
//#region src/components/ButtonGroup/styles.ts
|
|
5
|
+
const defaultButtonGroupTheme = require_buttonGroup.componentButtonGroup;
|
|
6
|
+
const buttonGroupStyles = (theme) => {
|
|
7
|
+
return _emotion_react.css`
|
|
8
|
+
display: ${theme.display};
|
|
9
|
+
flex-direction: ${theme.flexDirection};
|
|
10
|
+
flex-wrap: ${theme.flexWrap};
|
|
11
|
+
gap: ${theme.gap};
|
|
12
|
+
width: ${theme.width};
|
|
13
|
+
justify-content: ${theme.justifyContent};
|
|
14
|
+
${require_mq.from.md} {
|
|
15
|
+
flex-direction: ${theme.md.flexDirection};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.buttonGroupStyles = buttonGroupStyles;
|
|
21
|
+
exports.defaultButtonGroupTheme = defaultButtonGroupTheme;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeepPartial, Prettify } from "../../util/types.cjs";
|
|
2
|
+
import { ComponentButtonGroup } from "../../styleD/build/typescript/component/buttonGroup.cjs";
|
|
3
|
+
import { SerializedStyles } from "@emotion/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ButtonGroup/styles.d.ts
|
|
6
|
+
type ButtonGroupTheme = Prettify<ComponentButtonGroup>;
|
|
7
|
+
type PartialButtonGroupTheme = Prettify<DeepPartial<ButtonGroupTheme>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ButtonGroupTheme, PartialButtonGroupTheme };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeepPartial, Prettify } from "../../util/types.js";
|
|
2
|
+
import { ComponentButtonGroup } from "../../styleD/build/typescript/component/buttonGroup.js";
|
|
3
|
+
import { SerializedStyles } from "@emotion/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ButtonGroup/styles.d.ts
|
|
6
|
+
type ButtonGroupTheme = Prettify<ComponentButtonGroup>;
|
|
7
|
+
type PartialButtonGroupTheme = Prettify<DeepPartial<ButtonGroupTheme>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ButtonGroupTheme, PartialButtonGroupTheme };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { from } from "../../styleD/utils/semantic/mq.js";
|
|
2
|
+
import { componentButtonGroup } from "../../styleD/build/typescript/component/buttonGroup.js";
|
|
3
|
+
import { css } from "@emotion/react";
|
|
4
|
+
//#region src/components/ButtonGroup/styles.ts
|
|
5
|
+
const defaultButtonGroupTheme = componentButtonGroup;
|
|
6
|
+
const buttonGroupStyles = (theme) => {
|
|
7
|
+
return css`
|
|
8
|
+
display: ${theme.display};
|
|
9
|
+
flex-direction: ${theme.flexDirection};
|
|
10
|
+
flex-wrap: ${theme.flexWrap};
|
|
11
|
+
gap: ${theme.gap};
|
|
12
|
+
width: ${theme.width};
|
|
13
|
+
justify-content: ${theme.justifyContent};
|
|
14
|
+
${from.md} {
|
|
15
|
+
flex-direction: ${theme.md.flexDirection};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { buttonGroupStyles, defaultButtonGroupTheme };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DefaultPropsWithChildren } from "../../util/types.cjs";
|
|
2
|
+
import { ButtonTheme } from "../Button/styles.cjs";
|
|
3
|
+
import { ButtonGroupTheme } from "./styles.cjs";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ButtonGroup/types.d.ts
|
|
6
|
+
type ButtonGroupProps = DefaultPropsWithChildren<ButtonGroupTheme> & {
|
|
7
|
+
/**
|
|
8
|
+
* Size of buttons within the group
|
|
9
|
+
*/
|
|
10
|
+
size?: keyof Omit<ButtonTheme['primary'], 'shared'>;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ButtonGroupProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DefaultPropsWithChildren } from "../../util/types.js";
|
|
2
|
+
import { ButtonTheme } from "../Button/styles.js";
|
|
3
|
+
import { ButtonGroupTheme } from "./styles.js";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ButtonGroup/types.d.ts
|
|
6
|
+
type ButtonGroupProps = DefaultPropsWithChildren<ButtonGroupTheme> & {
|
|
7
|
+
/**
|
|
8
|
+
* Size of buttons within the group
|
|
9
|
+
*/
|
|
10
|
+
size?: keyof Omit<ButtonTheme['primary'], 'shared'>;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ButtonGroupProps };
|
|
@@ -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 };
|