@a-type/ui 1.5.0 → 1.5.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.
- package/dist/cjs/components/avatar/Avatar.js +3 -3
- package/dist/cjs/components/avatar/Avatar.js.map +1 -1
- package/dist/cjs/components/box/Box.d.ts +13 -7
- package/dist/cjs/components/box/Box.js +39 -4
- package/dist/cjs/components/box/Box.js.map +1 -1
- package/dist/cjs/components/box/Box.stories.d.ts +3 -0
- package/dist/cjs/components/box/Box.stories.js +3 -0
- package/dist/cjs/components/box/Box.stories.js.map +1 -1
- package/dist/cjs/components/button/classes.d.ts +11 -0
- package/dist/cjs/components/button/classes.js +2 -0
- package/dist/cjs/components/button/classes.js.map +1 -1
- package/dist/cjs/components/card/Card.d.ts +2 -2
- package/dist/cjs/components/dropdownMenu/DropdownMenu.js +2 -2
- package/dist/cjs/components/dropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/cjs/components/tabs/tabs.d.ts +6 -2
- package/dist/cjs/components/tabs/tabs.js +27 -2
- package/dist/cjs/components/tabs/tabs.js.map +1 -1
- package/dist/cjs/components/tabs/tabs.stories.d.ts +8 -3
- package/dist/cjs/components/tabs/tabs.stories.js +9 -4
- package/dist/cjs/components/tabs/tabs.stories.js.map +1 -1
- package/dist/cjs/hooks/index.d.ts +5 -4
- package/dist/cjs/hooks/index.js +5 -4
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/withProps.d.ts +2 -0
- package/dist/cjs/hooks/withProps.js +12 -0
- package/dist/cjs/hooks/withProps.js.map +1 -0
- package/dist/css/main.css +1 -1
- package/dist/esm/components/avatar/Avatar.js +3 -3
- package/dist/esm/components/avatar/Avatar.js.map +1 -1
- package/dist/esm/components/box/Box.d.ts +13 -7
- package/dist/esm/components/box/Box.js +39 -4
- package/dist/esm/components/box/Box.js.map +1 -1
- package/dist/esm/components/box/Box.stories.d.ts +3 -0
- package/dist/esm/components/box/Box.stories.js +3 -0
- package/dist/esm/components/box/Box.stories.js.map +1 -1
- package/dist/esm/components/button/classes.d.ts +11 -0
- package/dist/esm/components/button/classes.js +1 -0
- package/dist/esm/components/button/classes.js.map +1 -1
- package/dist/esm/components/card/Card.d.ts +2 -2
- package/dist/esm/components/dropdownMenu/DropdownMenu.js +2 -2
- package/dist/esm/components/dropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/esm/components/tabs/tabs.d.ts +6 -2
- package/dist/esm/components/tabs/tabs.js +22 -1
- package/dist/esm/components/tabs/tabs.js.map +1 -1
- package/dist/esm/components/tabs/tabs.stories.d.ts +8 -3
- package/dist/esm/components/tabs/tabs.stories.js +9 -4
- package/dist/esm/components/tabs/tabs.stories.js.map +1 -1
- package/dist/esm/hooks/index.d.ts +5 -4
- package/dist/esm/hooks/index.js +5 -4
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/withProps.d.ts +2 -0
- package/dist/esm/hooks/withProps.js +8 -0
- package/dist/esm/hooks/withProps.js.map +1 -0
- package/package.json +1 -1
- package/src/components/avatar/Avatar.tsx +3 -3
- package/src/components/box/Box.stories.tsx +3 -0
- package/src/components/box/Box.tsx +70 -11
- package/src/components/button/classes.tsx +1 -0
- package/src/components/dropdownMenu/DropdownMenu.tsx +2 -2
- package/src/components/tabs/tabs.stories.tsx +18 -7
- package/src/components/tabs/tabs.tsx +29 -3
- package/src/hooks/index.ts +5 -4
- package/src/hooks/withProps.tsx +10 -0
|
@@ -24,8 +24,8 @@ export declare const CardFooter: import("react").FunctionComponent<import("react
|
|
|
24
24
|
export declare const CardActions: import("react").FunctionComponent<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
25
25
|
export declare const CardMenu: import("react").FunctionComponent<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
26
26
|
export declare const cardGridColumns: {
|
|
27
|
-
default: (size: number) =>
|
|
28
|
-
small: (size: number) => 1 | 4 | 3
|
|
27
|
+
default: (size: number) => 2 | 1 | 3;
|
|
28
|
+
small: (size: number) => 2 | 1 | 4 | 3;
|
|
29
29
|
};
|
|
30
30
|
export declare const CardGrid: ({ children, className, columns, gap, }: MasonryProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
export declare const Card: import("react").FunctionComponent<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>> & {
|
|
@@ -15,8 +15,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
16
16
|
import classNames, { clsx } from 'clsx';
|
|
17
17
|
import { withClassName } from '../../hooks/withClassName.js';
|
|
18
|
-
const StyledContent = withClassName(DropdownMenuPrimitive.Content, 'min-w-220px bg-white z-menu shadow-lg rounded-
|
|
19
|
-
const itemClassName = classNames('layer-components:text-md layer-components:leading-4 layer-components:color-black layer-components:
|
|
18
|
+
const StyledContent = withClassName(DropdownMenuPrimitive.Content, 'min-w-220px bg-white z-menu shadow-lg rounded-lg border-default', 'layer-components:transform-origin-[var(--radix-dropdown-menu-transform-origin)]', 'layer-components:[&[data-state=open]]:animate-popover-in', 'layer-components:[&[data-state=closed]]:animate-popover-out', 'layer-components:max-h-[var(--radix-dropdown-menu-content-available-height)]', 'important:motion-reduce:animate-none', 'will-change-transform');
|
|
19
|
+
const itemClassName = classNames('layer-components:text-md layer-components:leading-4 layer-components:color-black layer-components:flex layer-components:items-center layer-components:pr-4 layer-components:pl-8 layer-components:py-2 layer-components:relative layer-components:text-left layer-components:select-none layer-components:cursor-pointer', 'layer-components:[&[data-disabled]]:color-gray9 layer-components:[&[data-disabled]]:pointer-events-none', 'layer-components:focus-visible:bg-gray2 layer-components:focus-visible:color-gray9', 'layer-components:focus:outline-none');
|
|
20
20
|
const StyledItemBase = withClassName(DropdownMenuPrimitive.Item, itemClassName);
|
|
21
21
|
const StyledItem = (_a) => {
|
|
22
22
|
var { ref: forwardedRef, className, color } = _a, props = __rest(_a, ["ref", "className", "color"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","sourceRoot":"","sources":["../../../../src/components/dropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AACb,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,aAAa,GAAG,aAAa,CAClC,qBAAqB,CAAC,OAAO,EAC7B,iEAAiE,EACjE,iFAAiF,EACjF,0DAA0D,EAC1D,6DAA6D,EAC7D,gFAAgF,EAChF,sCAAsC,EACtC,uBAAuB,CACvB,CAAC;AACF,MAAM,aAAa,GAAG,UAAU,CAC/B,
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","sourceRoot":"","sources":["../../../../src/components/dropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
2
|
export declare const TabsRoot: import("react").FunctionComponent<TabsPrimitive.TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export declare const TabsList: import("react").FunctionComponent<TabsPrimitive.TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const TabsTriggerBase: import("react").FunctionComponent<TabsPrimitive.TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export interface TabsTriggerProps extends Omit<TabsPrimitive.TabsTriggerProps, 'color'> {
|
|
6
|
+
color?: 'default' | 'primary';
|
|
7
|
+
}
|
|
8
|
+
export declare const TabsTrigger: ({ className, color, ...props }: TabsTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
9
|
export declare const TabsContent: import("react").FunctionComponent<TabsPrimitive.TabsContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
10
|
export declare const Tabs: import("react").FunctionComponent<TabsPrimitive.TabsProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
7
11
|
List: import("react").FunctionComponent<TabsPrimitive.TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
-
Trigger:
|
|
12
|
+
Trigger: ({ className, color, ...props }: TabsTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
13
|
Content: import("react").FunctionComponent<TabsPrimitive.TabsContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
14
|
};
|
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
// @unocss-include
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
14
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
15
|
+
import clsx from 'clsx';
|
|
3
16
|
import { withClassName } from '../../hooks/withClassName.js';
|
|
4
17
|
export const TabsRoot = withClassName(TabsPrimitive.Root, '');
|
|
5
18
|
export const TabsList = withClassName(TabsPrimitive.List, 'flex flex-row flex-wrap py-2 px-2 items-start gap-2');
|
|
6
|
-
export const
|
|
19
|
+
export const TabsTriggerBase = withClassName(TabsPrimitive.Trigger, 'layer-components:flex layer-components:flex-row layer-components:items-center layer-components:justify-center layer-components:gap-2 layer-components:color-black layer-components:py-1 layer-components:px-5 layer-components:bg-wash layer-components:text-md layer-components:min-w-100px layer-components:rounded-lg layer-components:border-default layer-components:font-semibold layer-components:text-gray-8 layer-components:border-gray-8 layer-components:transition-colors layer-components:cursor-pointer layer-components:select-none layer-components:font-sans layer-components:flex-shrink-0 layer-components:shadow-sm', 'layer-components:hover:bg-[var(--hover)]', 'layer-components:focus-visible:focus-ring layer-components:focus-visible:focus-ring-[var(--focus)] layer-components:focus-visible:outline-off', '[&[data-state=active]]:font-semibold [&[data-state=active]]:bg-[var(--focus,var(--hover))] [&[data-state=active]]:text-black [&[data-state=active]]:cursor-default [&[data-state=active]]:hover:bg-[var(--hover)] [&[data-state=active]]:relative [&[data-state=active]]:z-1');
|
|
20
|
+
const colorClasses = {
|
|
21
|
+
default: 'layer-variants:[--bg:var(--color-white)] layer-variants:[--hover:var(--color-gray-3)] layer-variants:[--focus:var(--color-gray-4)] layer-variants:[--active:var(--color-gray-4)]',
|
|
22
|
+
primary: 'layer-variants:[--bg:var(--color-primary-light)] layer-variants:[--hover:var(--color-primary)] layer-variants:[--focus:var(--color-primary)] layer-variants:[--active:var(--color-primary)]',
|
|
23
|
+
};
|
|
24
|
+
export const TabsTrigger = (_a) => {
|
|
25
|
+
var { className, color = 'primary' } = _a, props = __rest(_a, ["className", "color"]);
|
|
26
|
+
return (_jsx(TabsTriggerBase, Object.assign({ className: clsx(colorClasses[color], `btn-color-${color}`, className) }, props)));
|
|
27
|
+
};
|
|
7
28
|
export const TabsContent = withClassName(TabsPrimitive.Content, '');
|
|
8
29
|
export const Tabs = Object.assign(TabsRoot, {
|
|
9
30
|
List: TabsList,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../../src/components/tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CACpC,aAAa,CAAC,IAAI,EAClB,qDAAqD,CACrD,CAAC;AAEF,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../../src/components/tabs/tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CACpC,aAAa,CAAC,IAAI,EAClB,qDAAqD,CACrD,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAC3C,aAAa,CAAC,OAAO,EACrB,uQAAuQ,EACvQ,0CAA0C,EAC1C,mFAAmF,EACnF,sIAAsI,CACtI,CAAC;AAEF,MAAM,YAAY,GAAG;IACpB,OAAO,EACN,uIAAuI;IACxI,OAAO,EACN,kJAAkJ;CACnJ,CAAC;AAOF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAIT,EAAE,EAAE;QAJK,EAC3B,SAAS,EACT,KAAK,GAAG,SAAS,OAEC,EADf,KAAK,cAHmB,sBAI3B,CADQ;IACe,OAAA,CACvB,KAAC,eAAe,kBACf,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,aAAa,KAAK,EAAE,EAAE,SAAS,CAAC,IACjE,KAAK,EACR,CACF,CAAA;CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC3C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;CACpB,CAAC,CAAC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
argTypes: {
|
|
4
|
+
argTypes: {
|
|
5
|
+
color: {
|
|
6
|
+
control: "select";
|
|
7
|
+
options: string[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
5
10
|
parameters: {
|
|
6
11
|
controls: {
|
|
7
12
|
expanded: boolean;
|
|
@@ -9,5 +14,5 @@ declare const meta: {
|
|
|
9
14
|
};
|
|
10
15
|
};
|
|
11
16
|
export default meta;
|
|
12
|
-
type Story = StoryObj
|
|
17
|
+
type Story = StoryObj<Meta>;
|
|
13
18
|
export declare const Default: Story;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
// @unocss-include
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { TabsRoot, TabsList, TabsContent, TabsTrigger } from './tabs.js';
|
|
4
3
|
import { useState } from 'react';
|
|
4
|
+
import { TabsContent, TabsList, TabsRoot, TabsTrigger } from './tabs.js';
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Tabs',
|
|
7
|
-
argTypes: {
|
|
7
|
+
argTypes: {
|
|
8
|
+
color: {
|
|
9
|
+
control: 'select',
|
|
10
|
+
options: ['default', 'primary'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
8
13
|
parameters: {
|
|
9
14
|
controls: { expanded: true },
|
|
10
15
|
},
|
|
11
16
|
};
|
|
12
17
|
export default meta;
|
|
13
18
|
export const Default = {
|
|
14
|
-
render: () => {
|
|
19
|
+
render: (args) => {
|
|
15
20
|
const [value, setValue] = useState('tab1');
|
|
16
|
-
return (_jsxs(TabsRoot, { value: value, onValueChange: setValue, children: [_jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "tab1", children: "Tab 1" }), _jsx(TabsTrigger, { value: "tab2", children: "Tab 2 (long)" }), _jsx(TabsTrigger, { value: "tab3", children: "Tab 3" })] }), _jsx(TabsContent, { value: "tab1", children: _jsx("div", { children: "Tab 1 content" }) }), _jsx(TabsContent, { value: "tab2", children: _jsx("div", { children: "Tab 2 content" }) }), _jsx(TabsContent, { value: "tab3", children: _jsx("div", { children: "Tab 3 content" }) })] }));
|
|
21
|
+
return (_jsxs(TabsRoot, { value: value, onValueChange: setValue, children: [_jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "tab1", color: args.color, children: "Tab 1" }), _jsx(TabsTrigger, { value: "tab2", color: args.color, children: "Tab 2 (long)" }), _jsx(TabsTrigger, { value: "tab3", color: args.color, children: "Tab 3" })] }), _jsx(TabsContent, { value: "tab1", children: _jsx("div", { children: "Tab 1 content" }) }), _jsx(TabsContent, { value: "tab2", children: _jsx("div", { children: "Tab 2 content" }) }), _jsx(TabsContent, { value: "tab3", children: _jsx("div", { children: "Tab 3 content" }) })] }));
|
|
17
22
|
},
|
|
18
23
|
};
|
|
19
24
|
//# sourceMappingURL=tabs.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.stories.js","sourceRoot":"","sources":["../../../../src/components/tabs/tabs.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"tabs.stories.js","sourceRoot":"","sources":["../../../../src/components/tabs/tabs.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEzE,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE;QACT,KAAK,EAAE;YACN,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;SAC/B;KACD;IACD,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC5B;CACc,CAAC;AAEjB,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC7B,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3C,OAAO,CACN,MAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,aAC9C,MAAC,QAAQ,eACR,KAAC,WAAW,IAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,sBAE7B,EACd,KAAC,WAAW,IAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,6BAE7B,EACd,KAAC,WAAW,IAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,sBAE7B,IACJ,EACX,KAAC,WAAW,IAAC,KAAK,EAAC,MAAM,YACxB,0CAAwB,GACX,EACd,KAAC,WAAW,IAAC,KAAK,EAAC,MAAM,YACxB,0CAAwB,GACX,EACd,KAAC,WAAW,IAAC,KAAK,EAAC,MAAM,YACxB,0CAAwB,GACX,IACJ,CACX,CAAC;IACH,CAAC;CACe,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
export * from './useAnimationFrame.js';
|
|
2
|
+
export * from './useLongPress.js';
|
|
1
3
|
export * from './useMergedRef.js';
|
|
4
|
+
export * from './useOnUnmount.js';
|
|
2
5
|
export * from './useSize.js';
|
|
3
6
|
export * from './useStableCallback.js';
|
|
7
|
+
export * from './useTitleBarColor.js';
|
|
4
8
|
export * from './useToggle.js';
|
|
5
9
|
export * from './useVisualViewportOffset.js';
|
|
6
|
-
export * from './useOnUnmount.js';
|
|
7
10
|
export * from './withClassName.js';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './useLongPress.js';
|
|
10
|
-
export * from './useTitleBarColor.js';
|
|
11
|
+
export * from './withProps.js';
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// @unocss-include
|
|
2
|
+
export * from './useAnimationFrame.js';
|
|
3
|
+
export * from './useLongPress.js';
|
|
2
4
|
export * from './useMergedRef.js';
|
|
5
|
+
export * from './useOnUnmount.js';
|
|
3
6
|
export * from './useSize.js';
|
|
4
7
|
export * from './useStableCallback.js';
|
|
8
|
+
export * from './useTitleBarColor.js';
|
|
5
9
|
export * from './useToggle.js';
|
|
6
10
|
export * from './useVisualViewportOffset.js';
|
|
7
|
-
export * from './useOnUnmount.js';
|
|
8
11
|
export * from './withClassName.js';
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './useLongPress.js';
|
|
11
|
-
export * from './useTitleBarColor.js';
|
|
12
|
+
export * from './withProps.js';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withProps.js","sourceRoot":"","sources":["../../../src/hooks/withProps.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,CACxB,SAA0C,EAC1C,MAAc,EACb,EAAE;IACH,OAAO,CAAC,KAAiB,EAAE,EAAE;QAC5B,OAAO,KAAC,SAAS,oBAAK,KAAK,EAAM,MAAM,EAAI,CAAC;IAC7C,CAAC,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ export function Avatar({
|
|
|
22
22
|
<div
|
|
23
23
|
data-pop={popIn}
|
|
24
24
|
className={classNames(
|
|
25
|
-
'layer-components:(flex items-center justify-center rounded-lg border-default overflow-hidden w-24px
|
|
25
|
+
'layer-components:(flex items-center justify-center rounded-lg border-default overflow-hidden w-24px aspect-1 select-none relative bg-white flex-shrink-0)',
|
|
26
26
|
popIn &&
|
|
27
27
|
'layer-variants:(animate-pop-in-from-half animate-ease-springy animate-duration-200)',
|
|
28
28
|
empty && 'layer-components(border-dashed bg-gray2)',
|
|
@@ -46,7 +46,7 @@ function AvatarContent({
|
|
|
46
46
|
if (imageSrc) {
|
|
47
47
|
return (
|
|
48
48
|
<img
|
|
49
|
-
className="w-full h-full object-cover
|
|
49
|
+
className="w-full h-full object-cover"
|
|
50
50
|
referrerPolicy="no-referrer"
|
|
51
51
|
crossOrigin="anonymous"
|
|
52
52
|
src={imageSrc}
|
|
@@ -55,7 +55,7 @@ function AvatarContent({
|
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
return (
|
|
58
|
-
<div className="color-black items-center justify-center flex text-sm font-bold
|
|
58
|
+
<div className="color-black items-center justify-center flex text-sm font-bold">
|
|
59
59
|
{name?.charAt(0) || '?'}
|
|
60
60
|
</div>
|
|
61
61
|
);
|
|
@@ -12,21 +12,35 @@ export type BoxJustification =
|
|
|
12
12
|
| 'around'
|
|
13
13
|
| 'end';
|
|
14
14
|
export type BoxSpacingSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
export type BoxResponsive<T> =
|
|
16
|
+
| T
|
|
17
|
+
| {
|
|
18
|
+
sm?: T;
|
|
19
|
+
md?: T;
|
|
20
|
+
lg?: T;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function isResponsive<T>(
|
|
24
|
+
value: BoxResponsive<T>,
|
|
25
|
+
): value is { sm?: T; md?: T; lg?: T } {
|
|
26
|
+
return typeof value === 'object';
|
|
27
|
+
}
|
|
15
28
|
|
|
16
29
|
export interface BoxProps extends Omit<SlotDivProps, 'wrap'> {
|
|
17
30
|
className?: string;
|
|
18
|
-
direction?: 'row' | 'col' | 'row-reverse' | 'col-reverse'
|
|
19
|
-
d?: 'row' | 'col' | 'row-reverse' | 'col-reverse'
|
|
31
|
+
direction?: BoxResponsive<'row' | 'col' | 'row-reverse' | 'col-reverse'>;
|
|
32
|
+
d?: BoxResponsive<'row' | 'col' | 'row-reverse' | 'col-reverse'>;
|
|
20
33
|
items?: BoxAlignment;
|
|
21
34
|
justify?: BoxJustification;
|
|
22
|
-
|
|
23
|
-
gap?: BoxSpacingSize;
|
|
24
|
-
wrap?: boolean
|
|
25
|
-
p?: BoxSpacingSize
|
|
35
|
+
layout?: `${BoxAlignment} ${BoxJustification}`;
|
|
36
|
+
gap?: BoxSpacingSize | boolean;
|
|
37
|
+
wrap?: BoxResponsive<boolean>;
|
|
38
|
+
p?: BoxResponsive<BoxSpacingSize | boolean>;
|
|
26
39
|
container?: boolean;
|
|
27
40
|
surface?: boolean | 'primary' | 'secondary';
|
|
28
41
|
theme?: ThemeName;
|
|
29
42
|
border?: boolean;
|
|
43
|
+
full?: boolean | 'width' | 'height';
|
|
30
44
|
ref?: Ref<HTMLDivElement>;
|
|
31
45
|
}
|
|
32
46
|
|
|
@@ -34,8 +48,8 @@ export function Box({
|
|
|
34
48
|
className,
|
|
35
49
|
items: itemsSolo,
|
|
36
50
|
justify: justifySolo,
|
|
37
|
-
align,
|
|
38
|
-
gap = '
|
|
51
|
+
layout: align,
|
|
52
|
+
gap = 'none',
|
|
39
53
|
wrap,
|
|
40
54
|
p = 'none',
|
|
41
55
|
d = 'row',
|
|
@@ -45,6 +59,7 @@ export function Box({
|
|
|
45
59
|
surface,
|
|
46
60
|
theme,
|
|
47
61
|
border,
|
|
62
|
+
full,
|
|
48
63
|
ref,
|
|
49
64
|
...rest
|
|
50
65
|
}: BoxProps) {
|
|
@@ -67,16 +82,43 @@ export function Box({
|
|
|
67
82
|
{...rest}
|
|
68
83
|
style={style}
|
|
69
84
|
className={clsx(
|
|
70
|
-
'flex',
|
|
85
|
+
'layer-components:flex layer-components:relative',
|
|
71
86
|
{
|
|
72
87
|
'layer-components:flex-row': direction === 'row',
|
|
73
88
|
'layer-components:flex-col': direction === 'col',
|
|
74
89
|
'layer-components:flex-row-reverse': direction === 'row-reverse',
|
|
75
90
|
'layer-components:flex-col-reverse': direction === 'col-reverse',
|
|
91
|
+
'layer-components:sm:flex-row':
|
|
92
|
+
isResponsive(direction) && direction.sm === 'row',
|
|
93
|
+
'layer-components:sm:flex-col':
|
|
94
|
+
isResponsive(direction) && direction.sm === 'col',
|
|
95
|
+
'layer-components:sm:flex-row-reverse':
|
|
96
|
+
isResponsive(direction) && direction.sm === 'row-reverse',
|
|
97
|
+
'layer-components:sm:flex-col-reverse':
|
|
98
|
+
isResponsive(direction) && direction.sm === 'col-reverse',
|
|
99
|
+
'layer-components:md:flex-row':
|
|
100
|
+
isResponsive(direction) && direction.md === 'row',
|
|
101
|
+
'layer-components:md:flex-col':
|
|
102
|
+
isResponsive(direction) && direction.md === 'col',
|
|
103
|
+
'layer-components:md:flex-row-reverse':
|
|
104
|
+
isResponsive(direction) && direction.md === 'row-reverse',
|
|
105
|
+
'layer-components:md:flex-col-reverse':
|
|
106
|
+
isResponsive(direction) && direction.md === 'col-reverse',
|
|
107
|
+
'layer-components:lg:flex-row':
|
|
108
|
+
isResponsive(direction) && direction.lg === 'row',
|
|
109
|
+
'layer-components:lg:flex-col':
|
|
110
|
+
isResponsive(direction) && direction.lg === 'col',
|
|
111
|
+
'layer-components:lg:flex-row-reverse':
|
|
112
|
+
isResponsive(direction) && direction.lg === 'row-reverse',
|
|
113
|
+
'layer-components:lg:flex-col-reverse':
|
|
114
|
+
isResponsive(direction) && direction.lg === 'col-reverse',
|
|
76
115
|
'layer-components:flex-wrap': wrap,
|
|
116
|
+
'layer-components:sm:flex-wrap': isResponsive(wrap) && wrap.sm,
|
|
117
|
+
'layer-components:md:flex-wrap': isResponsive(wrap) && wrap.md,
|
|
118
|
+
'layer-components:lg:flex-wrap': isResponsive(wrap) && wrap.lg,
|
|
77
119
|
'layer-components:gap-xs': gap === 'xs',
|
|
78
120
|
'layer-components:gap-sm': gap === 'sm',
|
|
79
|
-
'layer-components:gap-md': gap === 'md',
|
|
121
|
+
'layer-components:gap-md': gap === 'md' || gap === true,
|
|
80
122
|
'layer-components:gap-lg': gap === 'lg',
|
|
81
123
|
'layer-components:gap-xl': gap === 'xl',
|
|
82
124
|
'layer-components:items-center': items === 'center',
|
|
@@ -91,9 +133,24 @@ export function Box({
|
|
|
91
133
|
'layer-components:justify-around': justify === 'around',
|
|
92
134
|
'layer-components:p-xs': p === 'xs',
|
|
93
135
|
'layer-components:p-sm': p === 'sm',
|
|
94
|
-
'layer-components:p-md': p === 'md',
|
|
136
|
+
'layer-components:p-md': p === 'md' || p === true,
|
|
95
137
|
'layer-components:p-lg': p === 'lg',
|
|
96
138
|
'layer-components:p-xl': p === 'xl',
|
|
139
|
+
'layer-components:sm:p-xs': isResponsive(p) && p.sm === 'xs',
|
|
140
|
+
'layer-components:sm:p-sm': isResponsive(p) && p.sm === 'sm',
|
|
141
|
+
'layer-components:sm:p-md': isResponsive(p) && p.sm === 'md',
|
|
142
|
+
'layer-components:sm:p-lg': isResponsive(p) && p.sm === 'lg',
|
|
143
|
+
'layer-components:sm:p-xl': isResponsive(p) && p.sm === 'xl',
|
|
144
|
+
'layer-components:md:p-xs': isResponsive(p) && p.md === 'xs',
|
|
145
|
+
'layer-components:md:p-sm': isResponsive(p) && p.md === 'sm',
|
|
146
|
+
'layer-components:md:p-md': isResponsive(p) && p.md === 'md',
|
|
147
|
+
'layer-components:md:p-lg': isResponsive(p) && p.md === 'lg',
|
|
148
|
+
'layer-components:md:p-xl': isResponsive(p) && p.md === 'xl',
|
|
149
|
+
'layer-components:lg:p-xs': isResponsive(p) && p.lg === 'xs',
|
|
150
|
+
'layer-components:lg:p-sm': isResponsive(p) && p.lg === 'sm',
|
|
151
|
+
'layer-components:lg:p-md': isResponsive(p) && p.lg === 'md',
|
|
152
|
+
'layer-components:lg:p-lg': isResponsive(p) && p.lg === 'lg',
|
|
153
|
+
'layer-components:lg:p-xl': isResponsive(p) && p.lg === 'xl',
|
|
97
154
|
'layer-components:rounded-lg': !!surface,
|
|
98
155
|
'layer-components:(bg-white border-black)': surface === true,
|
|
99
156
|
'layer-components:(bg-primary-wash border-primary-dark)':
|
|
@@ -101,6 +158,8 @@ export function Box({
|
|
|
101
158
|
'layer-components:(bg-secondary-wash border-secondary-dark)':
|
|
102
159
|
surface === 'secondary',
|
|
103
160
|
'layer-components:(border border-solid rounded-lg)': border,
|
|
161
|
+
'layer-components:w-full': full === true || full === 'width',
|
|
162
|
+
'layer-components:h-full': full === true || full === 'height',
|
|
104
163
|
},
|
|
105
164
|
theme && `theme-${theme}`,
|
|
106
165
|
className,
|
|
@@ -45,6 +45,7 @@ const colors = {
|
|
|
45
45
|
contrast: `layer-variants:[&.btn-color-contrast]:([--bg:var(--color-black)] [--hover:var(--color-gray-7)] [--focus:var(--color-gray-7)] [--active:var(--color-gray-6)] color-white border-black)`,
|
|
46
46
|
unstyled: `layer-variants:(bg-transparent hover:(bg-transparent) focus:(bg-transparent) active:(bg-transparent) color-inherit border-none shadow-none hover:(shadow-none) focus:(shadow-none) active:(shadow-none) p-0 items-start font-inherit font-normal rounded-none text-size-inherit transition-none)`,
|
|
47
47
|
};
|
|
48
|
+
export const buttonColorClasses = colors;
|
|
48
49
|
|
|
49
50
|
const sizes = {
|
|
50
51
|
default: '',
|
|
@@ -6,7 +6,7 @@ import { withClassName } from '../../hooks/withClassName.js';
|
|
|
6
6
|
|
|
7
7
|
const StyledContent = withClassName(
|
|
8
8
|
DropdownMenuPrimitive.Content,
|
|
9
|
-
'min-w-220px bg-white z-menu shadow-lg rounded-
|
|
9
|
+
'min-w-220px bg-white z-menu shadow-lg rounded-lg border-default',
|
|
10
10
|
'layer-components:transform-origin-[var(--radix-dropdown-menu-transform-origin)]',
|
|
11
11
|
'layer-components:[&[data-state=open]]:animate-popover-in',
|
|
12
12
|
'layer-components:[&[data-state=closed]]:animate-popover-out',
|
|
@@ -15,7 +15,7 @@ const StyledContent = withClassName(
|
|
|
15
15
|
'will-change-transform',
|
|
16
16
|
);
|
|
17
17
|
const itemClassName = classNames(
|
|
18
|
-
'layer-components:(text-md leading-4 color-black
|
|
18
|
+
'layer-components:(text-md leading-4 color-black flex items-center pr-4 pl-8 py-2 relative text-left select-none cursor-pointer)',
|
|
19
19
|
'layer-components:[&[data-disabled]]:(color-gray9 pointer-events-none)',
|
|
20
20
|
'layer-components:focus-visible:(bg-gray2 color-gray9)',
|
|
21
21
|
'layer-components:focus:outline-none',
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { TabsRoot, TabsList, TabsContent, TabsTrigger } from './tabs.js';
|
|
3
2
|
import { useState } from 'react';
|
|
3
|
+
import { TabsContent, TabsList, TabsRoot, TabsTrigger } from './tabs.js';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Tabs',
|
|
7
|
-
argTypes: {
|
|
7
|
+
argTypes: {
|
|
8
|
+
color: {
|
|
9
|
+
control: 'select',
|
|
10
|
+
options: ['default', 'primary'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
8
13
|
parameters: {
|
|
9
14
|
controls: { expanded: true },
|
|
10
15
|
},
|
|
@@ -12,17 +17,23 @@ const meta = {
|
|
|
12
17
|
|
|
13
18
|
export default meta;
|
|
14
19
|
|
|
15
|
-
type Story = StoryObj
|
|
20
|
+
type Story = StoryObj<Meta>;
|
|
16
21
|
|
|
17
22
|
export const Default: Story = {
|
|
18
|
-
render: () => {
|
|
23
|
+
render: (args) => {
|
|
19
24
|
const [value, setValue] = useState('tab1');
|
|
20
25
|
return (
|
|
21
26
|
<TabsRoot value={value} onValueChange={setValue}>
|
|
22
27
|
<TabsList>
|
|
23
|
-
<TabsTrigger value="tab1"
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
<TabsTrigger value="tab1" color={args.color}>
|
|
29
|
+
Tab 1
|
|
30
|
+
</TabsTrigger>
|
|
31
|
+
<TabsTrigger value="tab2" color={args.color}>
|
|
32
|
+
Tab 2 (long)
|
|
33
|
+
</TabsTrigger>
|
|
34
|
+
<TabsTrigger value="tab3" color={args.color}>
|
|
35
|
+
Tab 3
|
|
36
|
+
</TabsTrigger>
|
|
26
37
|
</TabsList>
|
|
27
38
|
<TabsContent value="tab1">
|
|
28
39
|
<div>Tab 1 content</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
import clsx from 'clsx';
|
|
2
3
|
import { withClassName } from '../../hooks/withClassName.js';
|
|
3
4
|
|
|
4
5
|
export const TabsRoot = withClassName(TabsPrimitive.Root, '');
|
|
@@ -8,10 +9,35 @@ export const TabsList = withClassName(
|
|
|
8
9
|
'flex flex-row flex-wrap py-2 px-2 items-start gap-2',
|
|
9
10
|
);
|
|
10
11
|
|
|
11
|
-
export const
|
|
12
|
+
export const TabsTriggerBase = withClassName(
|
|
12
13
|
TabsPrimitive.Trigger,
|
|
13
|
-
'layer-components:(flex flex-row items-center justify-center gap-2 color-black py-1 px-5 bg-wash text-md min-w-100px rounded-lg border
|
|
14
|
-
'hover:bg-
|
|
14
|
+
'layer-components:(flex flex-row items-center justify-center gap-2 color-black py-1 px-5 bg-wash text-md min-w-100px rounded-lg border-default font-semibold text-gray-8 border-gray-8 transition-colors cursor-pointer select-none font-sans flex-shrink-0 shadow-sm)',
|
|
15
|
+
'layer-components:hover:bg-[var(--hover)]',
|
|
16
|
+
'layer-components:focus-visible:(focus-ring focus-ring-[var(--focus)] outline-off)',
|
|
17
|
+
'[&[data-state=active]]:(font-semibold bg-[var(--focus,var(--hover))] text-black cursor-default hover:bg-[var(--hover)] relative z-1)',
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const colorClasses = {
|
|
21
|
+
default:
|
|
22
|
+
'layer-variants:([--bg:var(--color-white)] [--hover:var(--color-gray-3)] [--focus:var(--color-gray-4)] [--active:var(--color-gray-4)])',
|
|
23
|
+
primary:
|
|
24
|
+
'layer-variants:([--bg:var(--color-primary-light)] [--hover:var(--color-primary)] [--focus:var(--color-primary)] [--active:var(--color-primary)])',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export interface TabsTriggerProps
|
|
28
|
+
extends Omit<TabsPrimitive.TabsTriggerProps, 'color'> {
|
|
29
|
+
color?: 'default' | 'primary';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const TabsTrigger = ({
|
|
33
|
+
className,
|
|
34
|
+
color = 'primary',
|
|
35
|
+
...props
|
|
36
|
+
}: TabsTriggerProps) => (
|
|
37
|
+
<TabsTriggerBase
|
|
38
|
+
className={clsx(colorClasses[color], `btn-color-${color}`, className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
15
41
|
);
|
|
16
42
|
|
|
17
43
|
export const TabsContent = withClassName(TabsPrimitive.Content, '');
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
export * from './useAnimationFrame.js';
|
|
2
|
+
export * from './useLongPress.js';
|
|
1
3
|
export * from './useMergedRef.js';
|
|
4
|
+
export * from './useOnUnmount.js';
|
|
2
5
|
export * from './useSize.js';
|
|
3
6
|
export * from './useStableCallback.js';
|
|
7
|
+
export * from './useTitleBarColor.js';
|
|
4
8
|
export * from './useToggle.js';
|
|
5
9
|
export * from './useVisualViewportOffset.js';
|
|
6
|
-
export * from './useOnUnmount.js';
|
|
7
10
|
export * from './withClassName.js';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './useLongPress.js';
|
|
10
|
-
export * from './useTitleBarColor.js';
|
|
11
|
+
export * from './withProps.js';
|