@anker-in/headless-ui 0.0.12 → 0.0.13
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/CONTRIBUTING.md +14 -0
- package/README.md +1 -1
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +2 -2
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +2 -2
- package/dist/cjs/components/heading.d.ts +2 -2
- package/dist/cjs/components/heading.js +1 -1
- package/dist/cjs/components/heading.js.map +2 -2
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +2 -2
- package/dist/cjs/components/skeleton.d.ts +1 -1
- package/dist/cjs/components/skeleton.js.map +1 -1
- package/dist/cjs/components/text.d.ts +17 -3
- package/dist/cjs/components/text.js +1 -1
- package/dist/cjs/components/text.js.map +2 -2
- package/dist/cjs/stories/dialog.stories.d.ts +18 -3
- package/dist/cjs/stories/dialog.stories.js +1 -1
- package/dist/cjs/stories/dialog.stories.js.map +3 -3
- package/dist/cjs/stories/heading.stories.d.ts +5 -3
- package/dist/cjs/stories/heading.stories.js +1 -1
- package/dist/cjs/stories/heading.stories.js.map +2 -2
- package/dist/cjs/stories/input.stories.d.ts +5 -0
- package/dist/cjs/stories/input.stories.js +1 -1
- package/dist/cjs/stories/input.stories.js.map +2 -2
- package/dist/cjs/stories/radio.stories.d.ts +3 -0
- package/dist/cjs/stories/radio.stories.js +1 -1
- package/dist/cjs/stories/radio.stories.js.map +2 -2
- package/dist/cjs/stories/text.stories.d.ts +6 -3
- package/dist/cjs/stories/text.stories.js +1 -1
- package/dist/cjs/stories/text.stories.js.map +2 -2
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/checkbox.js.map +2 -2
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dialog.js.map +2 -2
- package/dist/esm/components/heading.d.ts +2 -2
- package/dist/esm/components/heading.js +1 -1
- package/dist/esm/components/heading.js.map +2 -2
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/radio.js.map +2 -2
- package/dist/esm/components/skeleton.d.ts +1 -1
- package/dist/esm/components/skeleton.js.map +1 -1
- package/dist/esm/components/text.d.ts +17 -3
- package/dist/esm/components/text.js +1 -1
- package/dist/esm/components/text.js.map +2 -2
- package/dist/esm/stories/dialog.stories.d.ts +18 -3
- package/dist/esm/stories/dialog.stories.js +1 -1
- package/dist/esm/stories/dialog.stories.js.map +3 -3
- package/dist/esm/stories/heading.stories.d.ts +5 -3
- package/dist/esm/stories/heading.stories.js +1 -1
- package/dist/esm/stories/heading.stories.js.map +2 -2
- package/dist/esm/stories/input.stories.d.ts +5 -0
- package/dist/esm/stories/input.stories.js +1 -1
- package/dist/esm/stories/input.stories.js.map +2 -2
- package/dist/esm/stories/radio.stories.d.ts +3 -0
- package/dist/esm/stories/radio.stories.js +1 -1
- package/dist/esm/stories/radio.stories.js.map +2 -2
- package/dist/esm/stories/text.stories.d.ts +6 -3
- package/dist/esm/stories/text.stories.js +2 -2
- package/dist/esm/stories/text.stories.js.map +2 -2
- package/package.json +1 -1
- package/src/components/checkbox.tsx +1 -1
- package/src/components/dialog.tsx +1 -0
- package/src/components/heading.tsx +3 -2
- package/src/components/radio.tsx +2 -2
- package/src/components/skeleton.tsx +1 -1
- package/src/components/text.tsx +13 -4
- package/src/stories/dialog.stories.tsx +60 -31
- package/src/stories/heading.stories.tsx +7 -5
- package/src/stories/input.stories.tsx +5 -0
- package/src/stories/radio.stories.tsx +3 -3
- package/src/stories/text.stories.tsx +8 -5
- package/dist/cjs/tsconfig.tsbuildinfo +0 -1
- package/dist/esm/tsconfig.tsbuildinfo +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/stories/radio.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react/*'\nimport { RadioGroup, RadioGroupItem } from '../components/index'\nimport React from 'react'\n\nconst meta = {\n title: 'Components/
|
|
5
|
-
"mappings": "AA0CM,mBAAAA,EAEI,OAAAC,EADF,QAAAC,MADF,oBAzCN,OAAS,cAAAC,EAAY,kBAAAC,MAAsB,sBAC3C,
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react/*'\nimport { RadioGroup, RadioGroupItem } from '../components/index'\nimport React, { type ComponentType } from 'react'\n\nconst meta = {\n title: 'Components/RadioGroup',\n component: RadioGroup,\n subcomponents: { RadioGroupItem: RadioGroupItem as ComponentType<unknown> },\n parameters: {\n layout: 'centered',\n docs: {\n description: {\n component:\n '\u5355\u9009\u6846, \u57FA\u4E8E@radix-ui/react-radio-group https://www.radix-ui.com/primitives/docs/components/radio-group',\n },\n },\n },\n tags: ['autodocs'],\n argTypes: {\n size: {\n control: {\n type: 'select',\n },\n options: ['sm', 'base', 'lg'],\n description: '\u5C3A\u5BF8',\n table: {\n defaultValue: { summary: 'base' },\n },\n },\n },\n args: {\n size: 'base',\n },\n} satisfies Meta<typeof RadioGroup>\n\nexport default meta\n\ntype Story = StoryObj<typeof RadioGroup>\nexport const Default: Story = {\n args: {\n size: 'base',\n children: (\n <>\n <div className=\"ai-flex ai-items-center ai-space-x-2\">\n <RadioGroupItem value=\"option-one\" id=\"option-one\" />\n <label htmlFor=\"option-one\">Option One</label>\n </div>\n <div className=\"ai-flex ai-items-center ai-space-x-2\">\n <RadioGroupItem value=\"option-two\" id=\"option-two\" />\n <label htmlFor=\"option-two\">Option Two</label>\n </div>\n </>\n ),\n },\n}\n"],
|
|
5
|
+
"mappings": "AA0CM,mBAAAA,EAEI,OAAAC,EADF,QAAAC,MADF,oBAzCN,OAAS,cAAAC,EAAY,kBAAAC,MAAsB,sBAC3C,MAA0C,QAE1C,MAAMC,EAAO,CACX,MAAO,wBACP,UAAWF,EACX,cAAe,CAAE,eAAgBC,CAAyC,EAC1E,WAAY,CACV,OAAQ,WACR,KAAM,CACJ,YAAa,CACX,UACE,6HACJ,CACF,CACF,EACA,KAAM,CAAC,UAAU,EACjB,SAAU,CACR,KAAM,CACJ,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,KAAM,OAAQ,IAAI,EAC5B,YAAa,eACb,MAAO,CACL,aAAc,CAAE,QAAS,MAAO,CAClC,CACF,CACF,EACA,KAAM,CACJ,KAAM,MACR,CACF,EAEA,IAAOE,EAAQD,EAGR,MAAME,EAAiB,CAC5B,KAAM,CACJ,KAAM,OACN,SACEL,EAAAF,EAAA,CACE,UAAAE,EAAC,OAAI,UAAU,uCACb,UAAAD,EAACG,EAAA,CAAe,MAAM,aAAa,GAAG,aAAa,EACnDH,EAAC,SAAM,QAAQ,aAAa,sBAAU,GACxC,EACAC,EAAC,OAAI,UAAU,uCACb,UAAAD,EAACG,EAAA,CAAe,MAAM,aAAa,GAAG,aAAa,EACnDH,EAAC,SAAM,QAAQ,aAAa,sBAAU,GACxC,GACF,CAEJ,CACF",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "RadioGroup", "RadioGroupItem", "meta", "radio_stories_default", "Default"]
|
|
7
7
|
}
|
|
@@ -17,7 +17,8 @@ declare const meta: {
|
|
|
17
17
|
control: {
|
|
18
18
|
type: "select";
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
description: string;
|
|
21
|
+
options: (string | number)[];
|
|
21
22
|
table: {
|
|
22
23
|
defaultValue: {
|
|
23
24
|
summary: string;
|
|
@@ -36,7 +37,9 @@ declare const meta: {
|
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
39
|
color: {
|
|
39
|
-
control:
|
|
40
|
+
control: {
|
|
41
|
+
type: "color";
|
|
42
|
+
};
|
|
40
43
|
};
|
|
41
44
|
as: {
|
|
42
45
|
control: {
|
|
@@ -56,7 +59,7 @@ declare const meta: {
|
|
|
56
59
|
};
|
|
57
60
|
};
|
|
58
61
|
args: {
|
|
59
|
-
size:
|
|
62
|
+
size: "none";
|
|
60
63
|
weights: "normal";
|
|
61
64
|
html: string;
|
|
62
65
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{Text as e}from"../components/index";import"react";const r={title:"Typography/Text",component:e,parameters:{layout:"centered",docs:{description:{component:"\u6587\u672C\u7EC4\u4EF6, \u7B80\u5355\u5C01\u88C5\u4E86\u5E38\u7528\u7684\u6837\u5F0F\u5B57\u6BB5\uFF0C\u7528\u4E8E\u5C55\u793A\u6587\u672C\u5185\u5BB9."}}},tags:["autodocs"],argTypes:{size:{control:{type:"select"},options:[1,2,3,4,5,6,7,8,9],table:{defaultValue:{summary:"
|
|
1
|
+
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{Text as e}from"../components/index";import"react";const r={title:"Typography/Text",component:e,parameters:{layout:"centered",docs:{description:{component:"\u6587\u672C\u7EC4\u4EF6, \u7B80\u5355\u5C01\u88C5\u4E86\u5E38\u7528\u7684\u6837\u5F0F\u5B57\u6BB5\uFF0C\u7528\u4E8E\u5C55\u793A\u6587\u672C\u5185\u5BB9."}}},tags:["autodocs"],argTypes:{size:{control:{type:"select"},description:"\u6587\u672C\u5C3A\u5BF8\uFF0C\u9ED8\u8BA4\u4E3Anone\uFF0C\u6D4F\u89C8\u5668\u9ED8\u8BA4\u5927\u5C0F\u548C\u884C\u9AD8\uFF0C1\uFF5E9\u9884\u8BBE\u5B57\u4F53\u5927\u5C0F\u548C\u884C\u9AD8",options:["none",1,2,3,4,5,6,7,8,9],table:{defaultValue:{summary:"none"}}},weights:{control:{type:"select"},options:["light","normal","medium","bold"],table:{defaultValue:{summary:"normal"}}},color:{control:{type:"color"}},as:{control:{type:"select"},description:"html \u6807\u7B7E\u7C7B\u578B",options:["div","label","p","span"],table:{defaultValue:{summary:"span"}}},html:{type:"string",description:"\u76F8\u5F53\u4E8E dangerouslySetInnerHTML"}},args:{size:"none",weights:"normal",html:""}};var a=r;const l={args:{children:" The quick brown fox jumps over the lazy dog.",size:"none",weights:"normal"}},p={render(){return t("div",{className:"ai-flex ai-flex-col",children:[o(e,{size:1,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:2,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:3,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:4,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:5,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:6,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:7,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:8,children:"The quick brown fox jumps over the lazy dog."}),o(e,{size:9,children:"The quick brown fox jumps over the lazy dog."})]})}},u={render(){return t("div",{className:"ai-flex ai-flex-col",children:[o(e,{weights:"light",children:"The quick brown fox jumps over the lazy dog."}),o(e,{weights:"normal",children:"The quick brown fox jumps over the lazy dog."}),o(e,{weights:"medium",children:"The quick brown fox jumps over the lazy dog."}),o(e,{weights:"bold",children:"The quick brown fox jumps over the lazy dog."})]})}},c={render(){return o(e,{html:`The <span style='font-size:20px;font:bold; -webkit-background-clip: text; background: linear-gradient(
|
|
2
2
|
to right,
|
|
3
3
|
#00ff00, /* \u7EFF\u8272 */
|
|
4
4
|
#00ff99, /* \u6D45\u7EFF\u8272 */
|
|
@@ -6,5 +6,5 @@ import{jsx as o,jsxs as t}from"react/jsx-runtime";import{Text as e}from"../compo
|
|
|
6
6
|
#0099ff, /* \u6D45\u84DD\u8272 */
|
|
7
7
|
#8000ff, /* \u7D2B\u8272 */
|
|
8
8
|
#ff00ff /* \u7C89\u8272 */
|
|
9
|
-
);color: transparent;background-clip: text;'>quick brown fox</span> <br/> jumps over the lazy dog.`})}};export{
|
|
9
|
+
);color: transparent;background-clip: text;'>quick brown fox</span> <br/> jumps over the lazy dog.`})}};export{l as Default,c as Html,p as Sizes,u as Weights,a as default};
|
|
10
10
|
//# sourceMappingURL=text.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/stories/text.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\n\nimport { Text } from '../components/index'\nimport React from 'react'\n\nconst meta = {\n title: 'Typography/Text',\n component: Text,\n parameters: {\n layout: 'centered',\n docs: {\n description: {\n component: '\u6587\u672C\u7EC4\u4EF6, \u7B80\u5355\u5C01\u88C5\u4E86\u5E38\u7528\u7684\u6837\u5F0F\u5B57\u6BB5\uFF0C\u7528\u4E8E\u5C55\u793A\u6587\u672C\u5185\u5BB9.',\n },\n },\n },\n tags: ['autodocs'],\n argTypes: {\n size: {\n control: {\n type: 'select',\n },\n options: [1, 2, 3, 4, 5, 6, 7, 8, 9],\n table: {\n defaultValue: { summary: '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\n\nimport { Text } from '../components/index'\nimport React from 'react'\n\nconst meta = {\n title: 'Typography/Text',\n component: Text,\n parameters: {\n layout: 'centered',\n docs: {\n description: {\n component: '\u6587\u672C\u7EC4\u4EF6, \u7B80\u5355\u5C01\u88C5\u4E86\u5E38\u7528\u7684\u6837\u5F0F\u5B57\u6BB5\uFF0C\u7528\u4E8E\u5C55\u793A\u6587\u672C\u5185\u5BB9.',\n },\n },\n },\n tags: ['autodocs'],\n argTypes: {\n size: {\n control: {\n type: 'select',\n },\n description: '\u6587\u672C\u5C3A\u5BF8\uFF0C\u9ED8\u8BA4\u4E3Anone\uFF0C\u6D4F\u89C8\u5668\u9ED8\u8BA4\u5927\u5C0F\u548C\u884C\u9AD8\uFF0C1\uFF5E9\u9884\u8BBE\u5B57\u4F53\u5927\u5C0F\u548C\u884C\u9AD8',\n options: ['none', 1, 2, 3, 4, 5, 6, 7, 8, 9],\n table: {\n defaultValue: { summary: 'none' },\n },\n },\n weights: {\n control: {\n type: 'select',\n },\n options: ['light', 'normal', 'medium', 'bold'],\n table: {\n defaultValue: { summary: 'normal' },\n },\n },\n color: {\n control: {\n type: 'color',\n },\n },\n as: {\n control: {\n type: 'select',\n },\n description: 'html \u6807\u7B7E\u7C7B\u578B',\n options: ['div', 'label', 'p', 'span'],\n table: {\n defaultValue: { summary: 'span' },\n },\n },\n html: {\n type: 'string',\n description: '\u76F8\u5F53\u4E8E dangerouslySetInnerHTML',\n },\n },\n args: {\n size: 'none',\n weights: 'normal',\n html: '',\n },\n} satisfies Meta<typeof Text>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\nexport const Default: Story = {\n args: {\n children: ' The quick brown fox jumps over the lazy dog.',\n size: 'none',\n weights: 'normal',\n },\n}\n\nexport const Sizes: Story = {\n render() {\n return (\n <div className=\"ai-flex ai-flex-col\">\n <Text size={1}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={2}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={3}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={4}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={5}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={6}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={7}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={8}>The quick brown fox jumps over the lazy dog.</Text>\n <Text size={9}>The quick brown fox jumps over the lazy dog.</Text>\n </div>\n )\n },\n}\n\nexport const Weights: Story = {\n render() {\n return (\n <div className=\"ai-flex ai-flex-col\">\n <Text weights=\"light\">The quick brown fox jumps over the lazy dog.</Text>\n <Text weights=\"normal\">The quick brown fox jumps over the lazy dog.</Text>\n <Text weights=\"medium\">The quick brown fox jumps over the lazy dog.</Text>\n <Text weights=\"bold\">The quick brown fox jumps over the lazy dog.</Text>\n </div>\n )\n },\n}\n\nexport const Html: Story = {\n render() {\n return (\n <Text\n html={`The <span style='font-size:20px;font:bold; -webkit-background-clip: text; background: linear-gradient(\n to right, \n #00ff00, /* \u7EFF\u8272 */\n #00ff99, /* \u6D45\u7EFF\u8272 */\n #00ffff, /* \u9752\u8272 */\n #0099ff, /* \u6D45\u84DD\u8272 */\n #8000ff, /* \u7D2B\u8272 */\n #ff00ff /* \u7C89\u8272 */\n );color: transparent;background-clip: text;'>quick brown fox</span> <br/> jumps over the lazy dog.`}\n />\n )\n },\n}\n"],
|
|
5
|
+
"mappings": "AA8EM,OACE,OAAAA,EADF,QAAAC,MAAA,oBA5EN,OAAS,QAAAC,MAAY,sBACrB,MAAkB,QAElB,MAAMC,EAAO,CACX,MAAO,kBACP,UAAWD,EACX,WAAY,CACV,OAAQ,WACR,KAAM,CACJ,YAAa,CACX,UAAW,2JACb,CACF,CACF,EACA,KAAM,CAAC,UAAU,EACjB,SAAU,CACR,KAAM,CACJ,QAAS,CACP,KAAM,QACR,EACA,YAAa,6LACb,QAAS,CAAC,OAAQ,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,CAAC,EAC3C,MAAO,CACL,aAAc,CAAE,QAAS,MAAO,CAClC,CACF,EACA,QAAS,CACP,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,QAAS,SAAU,SAAU,MAAM,EAC7C,MAAO,CACL,aAAc,CAAE,QAAS,QAAS,CACpC,CACF,EACA,MAAO,CACL,QAAS,CACP,KAAM,OACR,CACF,EACA,GAAI,CACF,QAAS,CACP,KAAM,QACR,EACA,YAAa,gCACb,QAAS,CAAC,MAAO,QAAS,IAAK,MAAM,EACrC,MAAO,CACL,aAAc,CAAE,QAAS,MAAO,CAClC,CACF,EACA,KAAM,CACJ,KAAM,SACN,YAAa,4CACf,CACF,EACA,KAAM,CACJ,KAAM,OACN,QAAS,SACT,KAAM,EACR,CACF,EAEA,IAAOE,EAAQD,EAGR,MAAME,EAAiB,CAC5B,KAAM,CACJ,SAAU,gDACV,KAAM,OACN,QAAS,QACX,CACF,EAEaC,EAAe,CAC1B,QAAS,CACP,OACEL,EAAC,OAAI,UAAU,sBACb,UAAAD,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,EAC3DF,EAACE,EAAA,CAAK,KAAM,EAAG,wDAA4C,GAC7D,CAEJ,CACF,EAEaK,EAAiB,CAC5B,QAAS,CACP,OACEN,EAAC,OAAI,UAAU,sBACb,UAAAD,EAACE,EAAA,CAAK,QAAQ,QAAQ,wDAA4C,EAClEF,EAACE,EAAA,CAAK,QAAQ,SAAS,wDAA4C,EACnEF,EAACE,EAAA,CAAK,QAAQ,SAAS,wDAA4C,EACnEF,EAACE,EAAA,CAAK,QAAQ,OAAO,wDAA4C,GACnE,CAEJ,CACF,EAEaM,EAAc,CACzB,QAAS,CACP,OACER,EAACE,EAAA,CACC,KAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wGASR,CAEJ,CACF",
|
|
6
6
|
"names": ["jsx", "jsxs", "Text", "meta", "text_stories_default", "Default", "Sizes", "Weights", "Html"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ const Checkbox = React.forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root
|
|
|
38
38
|
</CheckboxPrimitive.Root>
|
|
39
39
|
)
|
|
40
40
|
)
|
|
41
|
-
Checkbox.displayName =
|
|
41
|
+
Checkbox.displayName = 'Checkbox'
|
|
42
42
|
|
|
43
43
|
export default Checkbox
|
|
44
44
|
export type { CheckboxProps }
|
|
@@ -6,6 +6,7 @@ import React from 'react'
|
|
|
6
6
|
const headingVariants = cva('', {
|
|
7
7
|
variants: {
|
|
8
8
|
size: {
|
|
9
|
+
none: '',
|
|
9
10
|
1: 'ai-text-xs',
|
|
10
11
|
2: 'ai-text-sm',
|
|
11
12
|
3: 'ai-text-base',
|
|
@@ -24,7 +25,7 @@ const headingVariants = cva('', {
|
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
27
|
defaultVariants: {
|
|
27
|
-
size:
|
|
28
|
+
size: 'none',
|
|
28
29
|
weights: 'normal',
|
|
29
30
|
},
|
|
30
31
|
})
|
|
@@ -32,7 +33,7 @@ const headingVariants = cva('', {
|
|
|
32
33
|
type HeadingElement = React.ElementRef<'h1'>
|
|
33
34
|
|
|
34
35
|
interface HeadingProps extends React.ComponentPropsWithoutRef<'h1'>, VariantProps<typeof headingVariants> {
|
|
35
|
-
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
36
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
36
37
|
asChild?: boolean
|
|
37
38
|
color?: string
|
|
38
39
|
html?: string
|
package/src/components/radio.tsx
CHANGED
|
@@ -40,7 +40,7 @@ const RadioGroup = React.forwardRef<React.ElementRef<typeof RadioGroupPrimitive.
|
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
)
|
|
43
|
-
RadioGroup.displayName =
|
|
43
|
+
RadioGroup.displayName = 'RadioGroup'
|
|
44
44
|
|
|
45
45
|
interface RadioGroupItemProps
|
|
46
46
|
extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>,
|
|
@@ -67,7 +67,7 @@ const RadioGroupItem = React.forwardRef<React.ElementRef<typeof RadioGroupPrimit
|
|
|
67
67
|
)
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
|
-
RadioGroupItem.displayName =
|
|
70
|
+
RadioGroupItem.displayName = 'RadioGroupItem'
|
|
71
71
|
|
|
72
72
|
export { RadioGroup, RadioGroupItem }
|
|
73
73
|
export type { RadioGroupProps, RadioGroupItemProps }
|
|
@@ -6,7 +6,7 @@ import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-p
|
|
|
6
6
|
type SkeletonElement = React.ElementRef<'span'>
|
|
7
7
|
|
|
8
8
|
interface SkeletonProps extends ComponentPropsWithout<'span', RemovedProps> {
|
|
9
|
-
/** 是否正在加载 */
|
|
9
|
+
/** 是否正在加载 , 默认是true*/
|
|
10
10
|
loading?: boolean
|
|
11
11
|
}
|
|
12
12
|
|
package/src/components/text.tsx
CHANGED
|
@@ -2,10 +2,12 @@ import * as React from 'react'
|
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot'
|
|
3
3
|
import { cn } from '../helpers/index.js'
|
|
4
4
|
import { type VariantProps, cva } from 'class-variance-authority'
|
|
5
|
+
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js'
|
|
5
6
|
|
|
6
7
|
const textVariants = cva('', {
|
|
7
8
|
variants: {
|
|
8
9
|
size: {
|
|
10
|
+
none: '',
|
|
9
11
|
1: 'ai-text-xs',
|
|
10
12
|
2: 'ai-text-sm',
|
|
11
13
|
3: 'ai-text-base',
|
|
@@ -24,22 +26,29 @@ const textVariants = cva('', {
|
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
defaultVariants: {
|
|
27
|
-
size:
|
|
29
|
+
size: 'none',
|
|
28
30
|
weights: 'normal',
|
|
29
31
|
},
|
|
30
32
|
})
|
|
31
33
|
|
|
32
34
|
type TextElement = React.ElementRef<'span'>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
type TextSpanProps = { as?: 'span' } & ComponentPropsWithout<'span', RemovedProps>
|
|
36
|
+
type TextDivProps = { as: 'div' } & ComponentPropsWithout<'div', RemovedProps>
|
|
37
|
+
type TextLabelProps = { as: 'label' } & ComponentPropsWithout<'label', RemovedProps>
|
|
38
|
+
type TextPProps = { as: 'p' } & ComponentPropsWithout<'p', RemovedProps>
|
|
39
|
+
|
|
40
|
+
interface CommonTextProps extends VariantProps<typeof textVariants> {
|
|
41
|
+
as?: 'div' | 'label' | 'p' | 'span'
|
|
35
42
|
asChild?: boolean
|
|
36
43
|
color?: string
|
|
37
44
|
/** 相当于 dangerouslySetInnerHTML */
|
|
38
45
|
html?: string
|
|
39
46
|
}
|
|
40
47
|
|
|
48
|
+
type TextProps = CommonTextProps & (TextSpanProps | TextDivProps | TextLabelProps | TextPProps)
|
|
49
|
+
|
|
41
50
|
const Text = React.forwardRef<TextElement, TextProps>((props, forwardedRef) => {
|
|
42
|
-
const { children, size, weights, className, asChild, as: Tag = 'span', color, html, ...textProps } = props
|
|
51
|
+
const { children, size = 'none', weights, className, asChild, as: Tag = 'span', color, html, ...textProps } = props
|
|
43
52
|
|
|
44
53
|
const htmlContentProps = html
|
|
45
54
|
? {
|
|
@@ -10,36 +10,65 @@ import {
|
|
|
10
10
|
DialogTrigger,
|
|
11
11
|
Input,
|
|
12
12
|
} from '../components/index'
|
|
13
|
+
import type { Meta, StoryObj } from '@storybook/react/*'
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Components/Dialog',
|
|
17
|
+
component: Dialog,
|
|
18
|
+
subcomponents: {
|
|
19
|
+
DialogTrigger,
|
|
20
|
+
DialogContent,
|
|
21
|
+
DialogHeader,
|
|
22
|
+
DialogTitle,
|
|
23
|
+
DialogDescription,
|
|
24
|
+
DialogFooter,
|
|
25
|
+
} as any,
|
|
26
|
+
parameters: {
|
|
27
|
+
layout: 'centered',
|
|
28
|
+
docs: {
|
|
29
|
+
description: {
|
|
30
|
+
component: '弹窗组件,基于@radix-ui/react-dialog,https://www.radix-ui.com/primitives/docs/components/dialog ',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
tags: ['autodocs'],
|
|
35
|
+
} satisfies Meta<typeof Dialog>
|
|
15
36
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
export default meta
|
|
38
|
+
|
|
39
|
+
type Story = StoryObj<typeof Dialog>
|
|
40
|
+
|
|
41
|
+
export const Default: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
children: (
|
|
44
|
+
<>
|
|
45
|
+
<DialogTrigger asChild>
|
|
46
|
+
<button>Edit Profile</button>
|
|
47
|
+
</DialogTrigger>
|
|
48
|
+
<DialogContent className="sm:ai-max-w-[425px]">
|
|
49
|
+
<DialogHeader>
|
|
50
|
+
<DialogTitle>Edit profile</DialogTitle>
|
|
51
|
+
<DialogDescription>Make changes to your profile here. Click save when you're done.</DialogDescription>
|
|
52
|
+
</DialogHeader>
|
|
53
|
+
<div className="ai-grid ai-gap-4 ai-py-4">
|
|
54
|
+
<div className="ai-grid ai-grid-cols-4 ai-items-center ai-gap-4">
|
|
55
|
+
<label htmlFor="name" className="ai-text-right">
|
|
56
|
+
Name
|
|
57
|
+
</label>
|
|
58
|
+
<Input id="name" defaultValue="Pedro Duarte" className="ai-col-span-3" />
|
|
59
|
+
</div>
|
|
60
|
+
<div className="ai-grid ai-grid-cols-4 ai-items-center ai-gap-4">
|
|
61
|
+
<label htmlFor="username" className="ai-text-right">
|
|
62
|
+
Username
|
|
63
|
+
</label>
|
|
64
|
+
<Input id="username" defaultValue="@peduarte" className="ai-col-span-3" />
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<DialogFooter>
|
|
68
|
+
<Button type="submit">Save changes</Button>
|
|
69
|
+
</DialogFooter>
|
|
70
|
+
</DialogContent>
|
|
71
|
+
</>
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
}
|
|
@@ -20,10 +20,10 @@ const meta = {
|
|
|
20
20
|
control: {
|
|
21
21
|
type: 'select',
|
|
22
22
|
},
|
|
23
|
-
options: [1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
24
|
-
description: '1
|
|
23
|
+
options: ['none', 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
24
|
+
description: '文本尺寸,默认为none,浏览器默认大小和行高,1~9预设字体大小和行高',
|
|
25
25
|
table: {
|
|
26
|
-
defaultValue: { summary: '
|
|
26
|
+
defaultValue: { summary: 'none' },
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
weights: {
|
|
@@ -36,7 +36,9 @@ const meta = {
|
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
color: {
|
|
39
|
-
control:
|
|
39
|
+
control: {
|
|
40
|
+
type: 'color',
|
|
41
|
+
},
|
|
40
42
|
},
|
|
41
43
|
as: {
|
|
42
44
|
control: {
|
|
@@ -55,7 +57,7 @@ const meta = {
|
|
|
55
57
|
},
|
|
56
58
|
args: {
|
|
57
59
|
as: 'h1',
|
|
58
|
-
size:
|
|
60
|
+
size: 'none',
|
|
59
61
|
weights: 'normal',
|
|
60
62
|
},
|
|
61
63
|
} satisfies Meta<typeof Heading>
|
|
@@ -10,6 +10,11 @@ const meta = {
|
|
|
10
10
|
subcomponents: { InputSlot: InputSlot as ComponentType<unknown> }, // TODO: 检查type , 去掉as类型转换
|
|
11
11
|
parameters: {
|
|
12
12
|
layout: 'centered',
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component: 'Input 组件, 用于输入框, 可以通过插槽插入额外的内容, 比如icon, 按钮',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
13
18
|
},
|
|
14
19
|
tags: ['autodocs'],
|
|
15
20
|
argTypes: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react/*'
|
|
2
2
|
import { RadioGroup, RadioGroupItem } from '../components/index'
|
|
3
|
-
import React from 'react'
|
|
3
|
+
import React, { type ComponentType } from 'react'
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: 'Components/
|
|
6
|
+
title: 'Components/RadioGroup',
|
|
7
7
|
component: RadioGroup,
|
|
8
|
-
|
|
8
|
+
subcomponents: { RadioGroupItem: RadioGroupItem as ComponentType<unknown> },
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'centered',
|
|
11
11
|
docs: {
|
|
@@ -20,9 +20,10 @@ const meta = {
|
|
|
20
20
|
control: {
|
|
21
21
|
type: 'select',
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
description: '文本尺寸,默认为none,浏览器默认大小和行高,1~9预设字体大小和行高',
|
|
24
|
+
options: ['none', 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
24
25
|
table: {
|
|
25
|
-
defaultValue: { summary: '
|
|
26
|
+
defaultValue: { summary: 'none' },
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
weights: {
|
|
@@ -35,7 +36,9 @@ const meta = {
|
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
color: {
|
|
38
|
-
control:
|
|
39
|
+
control: {
|
|
40
|
+
type: 'color',
|
|
41
|
+
},
|
|
39
42
|
},
|
|
40
43
|
as: {
|
|
41
44
|
control: {
|
|
@@ -53,7 +56,7 @@ const meta = {
|
|
|
53
56
|
},
|
|
54
57
|
},
|
|
55
58
|
args: {
|
|
56
|
-
size:
|
|
59
|
+
size: 'none',
|
|
57
60
|
weights: 'normal',
|
|
58
61
|
html: '',
|
|
59
62
|
},
|
|
@@ -65,7 +68,7 @@ type Story = StoryObj<typeof meta>
|
|
|
65
68
|
export const Default: Story = {
|
|
66
69
|
args: {
|
|
67
70
|
children: ' The quick brown fox jumps over the lazy dog.',
|
|
68
|
-
size:
|
|
71
|
+
size: 'none',
|
|
69
72
|
weights: 'normal',
|
|
70
73
|
},
|
|
71
74
|
}
|