orizon 0.2.1 → 0.2.2
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/README.md +45 -7
- package/bin/cli.mjs +53 -16
- package/bin/init.mjs +13 -9
- package/dist/components/affix/Affix.d.ts +19 -0
- package/dist/components/affix/Affix.stories.d.ts +9 -0
- package/dist/components/affix/index.d.ts +23 -0
- package/dist/components/alert/Alert.d.ts +21 -0
- package/dist/components/alert/Alert.stories.d.ts +13 -0
- package/dist/components/alert/ErrorBoundary.d.ts +10 -0
- package/dist/components/alert/index.d.ts +20 -0
- package/dist/components/anchor/Anchor.d.ts +23 -0
- package/dist/components/anchor/Anchor.stories.d.ts +9 -0
- package/dist/components/anchor/index.d.ts +24 -0
- package/dist/components/app/App.d.ts +25 -0
- package/dist/components/app/App.stories.d.ts +8 -0
- package/dist/components/app/index.d.ts +18 -0
- package/dist/components/auto-complete/AutoComplete.d.ts +22 -0
- package/dist/components/auto-complete/AutoComplete.stories.d.ts +12 -0
- package/dist/components/auto-complete/index.d.ts +22 -0
- package/dist/components/avatar/Avatar.d.ts +24 -0
- package/dist/components/avatar/Avatar.stories.d.ts +10 -0
- package/dist/components/avatar/index.d.ts +21 -0
- package/dist/components/badge/Badge.d.ts +19 -0
- package/dist/components/badge/Badge.stories.d.ts +12 -0
- package/dist/components/badge/index.d.ts +19 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/Breadcrumb.stories.d.ts +9 -0
- package/dist/components/breadcrumb/index.d.ts +25 -0
- package/dist/components/button/Button.d.ts +24 -0
- package/dist/components/button/Button.stories.d.ts +20 -0
- package/dist/components/button/ButtonGroup.d.ts +23 -0
- package/dist/components/button/index.d.ts +33 -0
- package/dist/components/button/types.d.ts +87 -11
- package/dist/components/calendar/Calendar.d.ts +21 -0
- package/dist/components/calendar/Calendar.stories.d.ts +10 -0
- package/dist/components/calendar/index.d.ts +19 -0
- package/dist/components/card/Card.d.ts +21 -0
- package/dist/components/card/Card.stories.d.ts +14 -0
- package/dist/components/card/index.d.ts +25 -0
- package/dist/components/carousel/Carousel.d.ts +23 -0
- package/dist/components/carousel/Carousel.stories.d.ts +11 -0
- package/dist/components/carousel/index.d.ts +25 -0
- package/dist/components/cascader/Cascader.d.ts +26 -0
- package/dist/components/cascader/Cascader.stories.d.ts +11 -0
- package/dist/components/cascader/index.d.ts +25 -0
- package/dist/components/checkbox/Checkbox.d.ts +21 -0
- package/dist/components/checkbox/Checkbox.stories.d.ts +11 -0
- package/dist/components/checkbox/CheckboxGroup.d.ts +10 -0
- package/dist/components/checkbox/index.d.ts +19 -0
- package/dist/components/collapse/Collapse.d.ts +25 -0
- package/dist/components/collapse/Collapse.stories.d.ts +12 -0
- package/dist/components/collapse/index.d.ts +26 -0
- package/dist/components/color-picker/ColorPicker.d.ts +22 -0
- package/dist/components/color-picker/ColorPicker.stories.d.ts +11 -0
- package/dist/components/color-picker/index.d.ts +22 -0
- package/dist/components/date-picker/DatePicker.d.ts +20 -0
- package/dist/components/date-picker/DatePicker.stories.d.ts +12 -0
- package/dist/components/date-picker/RangePicker.d.ts +12 -0
- package/dist/components/date-picker/index.d.ts +21 -0
- package/dist/components/descriptions/Descriptions.d.ts +25 -0
- package/dist/components/descriptions/Descriptions.stories.d.ts +12 -0
- package/dist/components/descriptions/index.d.ts +25 -0
- package/dist/components/divider/Divider.stories.d.ts +12 -0
- package/dist/components/divider/index.d.ts +10 -0
- package/dist/components/drawer/Drawer.stories.d.ts +10 -0
- package/dist/components/drawer/index.d.ts +13 -0
- package/dist/components/dropdown/Dropdown.stories.d.ts +12 -0
- package/dist/components/dropdown/index.d.ts +14 -0
- package/dist/components/empty/Empty.stories.d.ts +11 -0
- package/dist/components/empty/index.d.ts +14 -0
- package/dist/components/flex/Flex.stories.d.ts +12 -0
- package/dist/components/flex/index.d.ts +15 -0
- package/dist/components/float-button/FloatButton.stories.d.ts +12 -0
- package/dist/components/float-button/index.d.ts +15 -0
- package/dist/components/form/Form.stories.d.ts +10 -0
- package/dist/components/form/index.d.ts +17 -0
- package/dist/components/grid/Grid.stories.d.ts +11 -0
- package/dist/components/grid/index.d.ts +20 -0
- package/dist/components/image/Image.stories.d.ts +11 -0
- package/dist/components/image/index.d.ts +14 -0
- package/dist/components/input/Input.stories.d.ts +14 -0
- package/dist/components/input/index.d.ts +15 -0
- package/dist/components/input-number/InputNumber.stories.d.ts +13 -0
- package/dist/components/input-number/index.d.ts +10 -0
- package/dist/components/layout/Layout.stories.d.ts +9 -0
- package/dist/components/layout/index.d.ts +17 -0
- package/dist/components/list/List.stories.d.ts +13 -0
- package/dist/components/list/index.d.ts +18 -0
- package/dist/components/masonry/Masonry.stories.d.ts +11 -0
- package/dist/components/masonry/index.d.ts +12 -0
- package/dist/components/mentions/Mentions.stories.d.ts +12 -0
- package/dist/components/mentions/index.d.ts +11 -0
- package/dist/components/menu/Menu.stories.d.ts +12 -0
- package/dist/components/menu/index.d.ts +15 -0
- package/dist/components/message/Message.stories.d.ts +8 -0
- package/dist/components/message/index.d.ts +16 -0
- package/dist/components/modal/Modal.stories.d.ts +12 -0
- package/dist/components/modal/index.d.ts +17 -0
- package/dist/components/notification/Notification.stories.d.ts +10 -0
- package/dist/components/notification/index.d.ts +14 -0
- package/dist/components/pagination/Pagination.stories.d.ts +13 -0
- package/dist/components/pagination/index.d.ts +13 -0
- package/dist/components/popconfirm/Popconfirm.stories.d.ts +11 -0
- package/dist/components/popconfirm/index.d.ts +13 -0
- package/dist/components/popover/Popover.stories.d.ts +10 -0
- package/dist/components/popover/index.d.ts +10 -0
- package/dist/components/progress/Progress.stories.d.ts +13 -0
- package/dist/components/progress/index.d.ts +10 -0
- package/dist/components/qrcode/QRCode.stories.d.ts +11 -0
- package/dist/components/qrcode/index.d.ts +9 -0
- package/dist/components/radio/Radio.stories.d.ts +13 -0
- package/dist/components/radio/index.d.ts +17 -0
- package/dist/components/rate/Rate.stories.d.ts +12 -0
- package/dist/components/rate/index.d.ts +13 -0
- package/dist/components/result/Result.stories.d.ts +12 -0
- package/dist/components/result/index.d.ts +9 -0
- package/dist/components/segmented/Segmented.stories.d.ts +12 -0
- package/dist/components/segmented/index.d.ts +9 -0
- package/dist/components/select/Select.stories.d.ts +14 -0
- package/dist/components/select/index.d.ts +10 -0
- package/dist/components/skeleton/Skeleton.stories.d.ts +12 -0
- package/dist/components/skeleton/index.d.ts +15 -0
- package/dist/components/slider/Slider.stories.d.ts +13 -0
- package/dist/components/slider/index.d.ts +10 -0
- package/dist/components/space/Space.stories.d.ts +13 -0
- package/dist/components/space/index.d.ts +18 -0
- package/dist/components/spin/Spin.stories.d.ts +13 -0
- package/dist/components/spin/index.d.ts +14 -0
- package/dist/components/splitter/Splitter.stories.d.ts +12 -0
- package/dist/components/splitter/index.d.ts +18 -0
- package/dist/components/statistic/Statistic.stories.d.ts +10 -0
- package/dist/components/statistic/index.d.ts +17 -0
- package/dist/components/steps/Steps.stories.d.ts +11 -0
- package/dist/components/steps/index.d.ts +15 -0
- package/dist/components/switch/Switch.stories.d.ts +10 -0
- package/dist/components/switch/index.d.ts +12 -0
- package/dist/components/table/Table.stories.d.ts +12 -0
- package/dist/components/table/index.d.ts +12 -0
- package/dist/components/tabs/Tabs.stories.d.ts +11 -0
- package/dist/components/tabs/index.d.ts +16 -0
- package/dist/components/tag/Tag.stories.d.ts +11 -0
- package/dist/components/tag/index.d.ts +14 -0
- package/dist/components/time-picker/TimePicker.stories.d.ts +10 -0
- package/dist/components/time-picker/index.d.ts +13 -0
- package/dist/components/timeline/Timeline.stories.d.ts +10 -0
- package/dist/components/timeline/index.d.ts +15 -0
- package/dist/components/tooltip/Tooltip.stories.d.ts +8 -0
- package/dist/components/tooltip/index.d.ts +10 -0
- package/dist/components/tour/Tour.stories.d.ts +8 -0
- package/dist/components/tour/index.d.ts +16 -0
- package/dist/components/transfer/Transfer.stories.d.ts +9 -0
- package/dist/components/transfer/index.d.ts +15 -0
- package/dist/components/tree/Tree.stories.d.ts +10 -0
- package/dist/components/tree/index.d.ts +18 -0
- package/dist/components/tree-select/TreeSelect.stories.d.ts +9 -0
- package/dist/components/tree-select/index.d.ts +16 -0
- package/dist/components/typography/Typography.stories.d.ts +11 -0
- package/dist/components/typography/index.d.ts +14 -0
- package/dist/components/upload/Upload.stories.d.ts +10 -0
- package/dist/components/upload/index.d.ts +17 -0
- package/dist/components/watermark/Watermark.stories.d.ts +9 -0
- package/dist/components/watermark/index.d.ts +11 -0
- package/dist/orizon.cjs.js +101 -101
- package/dist/orizon.es.js +26200 -25378
- package/dist/preset.css +4 -4
- package/dist/themes/corporate.css +169 -0
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Orizon
|
|
2
2
|
|
|
3
|
-
Ant Design API on shadcn/ui primitives. 68 React components with full TypeScript support.
|
|
3
|
+
Ant Design API on shadcn/ui primitives. 68 production-ready React components with full TypeScript support, built with Tailwind CSS v4.
|
|
4
|
+
|
|
5
|
+
> **Note:** I'm a junior developer and started this as a side project to learn React component architecture. Currently Orizon works with **Vite** only. Support for Next.js and other frameworks may come in the future.
|
|
6
|
+
|
|
7
|
+
[Documentation](https://ui-orizon.netlify.app/) | [GitHub](https://github.com/web-vikas/orizon)
|
|
4
8
|
|
|
5
9
|
## Install
|
|
6
10
|
|
|
@@ -11,7 +15,7 @@ npm install orizon
|
|
|
11
15
|
**Peer dependencies** — your project needs:
|
|
12
16
|
|
|
13
17
|
```bash
|
|
14
|
-
npm install react react-dom tailwindcss
|
|
18
|
+
npm install react react-dom tailwindcss @tailwindcss/vite
|
|
15
19
|
```
|
|
16
20
|
|
|
17
21
|
For the **Form** component (optional):
|
|
@@ -20,9 +24,19 @@ For the **Form** component (optional):
|
|
|
20
24
|
npm install react-hook-form @hookform/resolvers zod
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
## Setup
|
|
27
|
+
## Setup (Vite)
|
|
28
|
+
|
|
29
|
+
1. Add the Tailwind plugin to `vite.config.ts`:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
plugins: [react(), tailwindcss()],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
24
38
|
|
|
25
|
-
Add these 3 lines to your app's CSS file:
|
|
39
|
+
2. Add these 3 lines to your app's CSS file:
|
|
26
40
|
|
|
27
41
|
```css
|
|
28
42
|
@import "tailwindcss";
|
|
@@ -77,7 +91,17 @@ notification.open({ message: "Done" });
|
|
|
77
91
|
|
|
78
92
|
## Theming
|
|
79
93
|
|
|
80
|
-
|
|
94
|
+
Swap the CSS import to completely change the look of all components:
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
/* Default theme */
|
|
98
|
+
@import "orizon/preset.css";
|
|
99
|
+
|
|
100
|
+
/* Corporate theme — teal primary, large radius */
|
|
101
|
+
@import "orizon/themes/corporate.css";
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Or override individual CSS variables:
|
|
81
105
|
|
|
82
106
|
```css
|
|
83
107
|
:root {
|
|
@@ -86,16 +110,30 @@ Override CSS variables in your CSS:
|
|
|
86
110
|
}
|
|
87
111
|
```
|
|
88
112
|
|
|
89
|
-
Or use the ConfigProvider:
|
|
113
|
+
Or use the ConfigProvider at runtime:
|
|
90
114
|
|
|
91
115
|
```tsx
|
|
92
116
|
import { ConfigProvider } from "orizon";
|
|
93
117
|
|
|
94
|
-
<ConfigProvider theme={{ algorithm: "dark" }}>
|
|
118
|
+
<ConfigProvider theme={{ algorithm: "dark", token: { colorPrimary: "#1890ff" } }}>
|
|
95
119
|
<App />
|
|
96
120
|
</ConfigProvider>
|
|
97
121
|
```
|
|
98
122
|
|
|
123
|
+
## CLI
|
|
124
|
+
|
|
125
|
+
Orizon includes a CLI to help you get started:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npx orizon init # scaffold a new Vite + Orizon project
|
|
129
|
+
npx orizon add button # show usage info for a component
|
|
130
|
+
npx orizon list # list all 68 components
|
|
131
|
+
```
|
|
132
|
+
|
|
99
133
|
## License
|
|
100
134
|
|
|
101
135
|
MIT
|
|
136
|
+
|
|
137
|
+
## Author
|
|
138
|
+
|
|
139
|
+
[Vikas Patel](https://github.com/web-vikas) — Junior Developer, learning by building.
|
package/bin/cli.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
+
import pc from "picocolors";
|
|
6
7
|
|
|
7
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
9
|
const pkg = JSON.parse(
|
|
@@ -11,20 +12,47 @@ const pkg = JSON.parse(
|
|
|
11
12
|
|
|
12
13
|
const [command] = process.argv.slice(2);
|
|
13
14
|
|
|
14
|
-
function
|
|
15
|
-
console.log(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
function printBanner() {
|
|
16
|
+
console.log();
|
|
17
|
+
console.log(
|
|
18
|
+
pc.cyan(pc.bold(" ⬡ Orizon")) +
|
|
19
|
+
pc.dim(` v${pkg.version}`) +
|
|
20
|
+
pc.dim(" — Ant Design API on shadcn/ui primitives"),
|
|
21
|
+
);
|
|
22
|
+
console.log(pc.dim(" " + "─".repeat(54)));
|
|
23
|
+
console.log();
|
|
24
|
+
}
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`)
|
|
26
|
+
function printHelp() {
|
|
27
|
+
printBanner();
|
|
28
|
+
console.log(
|
|
29
|
+
` ${pc.bold("Usage")}`,
|
|
30
|
+
);
|
|
31
|
+
console.log(
|
|
32
|
+
` ${pc.cyan("$")} npx orizon ${pc.green("<command>")}`,
|
|
33
|
+
);
|
|
34
|
+
console.log();
|
|
35
|
+
console.log(
|
|
36
|
+
` ${pc.bold("Commands")}`,
|
|
37
|
+
);
|
|
38
|
+
console.log(
|
|
39
|
+
` ${pc.green("init")} Set up Orizon in your React + Vite project`,
|
|
40
|
+
);
|
|
41
|
+
console.log();
|
|
42
|
+
console.log(
|
|
43
|
+
` ${pc.bold("Options")}`,
|
|
44
|
+
);
|
|
45
|
+
console.log(
|
|
46
|
+
` ${pc.yellow("--version")} Show version number`,
|
|
47
|
+
);
|
|
48
|
+
console.log(
|
|
49
|
+
` ${pc.yellow("--help")} Show this help message`,
|
|
50
|
+
);
|
|
51
|
+
console.log();
|
|
52
|
+
console.log(
|
|
53
|
+
pc.dim(" Docs: https://orizon.dev | GitHub: github.com/nicepkg/orizon"),
|
|
54
|
+
);
|
|
55
|
+
console.log();
|
|
28
56
|
}
|
|
29
57
|
|
|
30
58
|
switch (command) {
|
|
@@ -36,7 +64,9 @@ switch (command) {
|
|
|
36
64
|
|
|
37
65
|
case "--version":
|
|
38
66
|
case "-v":
|
|
39
|
-
console.log(
|
|
67
|
+
console.log(
|
|
68
|
+
pc.cyan(pc.bold("⬡ Orizon")) + " " + pc.bold(pkg.version),
|
|
69
|
+
);
|
|
40
70
|
break;
|
|
41
71
|
|
|
42
72
|
case "--help":
|
|
@@ -46,7 +76,14 @@ switch (command) {
|
|
|
46
76
|
break;
|
|
47
77
|
|
|
48
78
|
default:
|
|
49
|
-
console.
|
|
50
|
-
|
|
79
|
+
console.log();
|
|
80
|
+
console.error(
|
|
81
|
+
` ${pc.red("✖")} Unknown command: ${pc.bold(command)}`,
|
|
82
|
+
);
|
|
83
|
+
console.log();
|
|
84
|
+
console.log(
|
|
85
|
+
` Run ${pc.cyan("npx orizon --help")} to see available commands.`,
|
|
86
|
+
);
|
|
87
|
+
console.log();
|
|
51
88
|
process.exit(1);
|
|
52
89
|
}
|
package/bin/init.mjs
CHANGED
|
@@ -204,8 +204,8 @@ export async function init() {
|
|
|
204
204
|
console.log(
|
|
205
205
|
pc.bold(pc.cyan(" ⬡ Orizon")) + pc.dim(" — project setup wizard"),
|
|
206
206
|
);
|
|
207
|
+
console.log(pc.dim(" " + "─".repeat(54)));
|
|
207
208
|
console.log();
|
|
208
|
-
log.divider();
|
|
209
209
|
|
|
210
210
|
// -----------------------------------------------------------------------
|
|
211
211
|
// Pre-flight: Detect project or scaffold a new one
|
|
@@ -613,26 +613,30 @@ export async function init() {
|
|
|
613
613
|
// Done!
|
|
614
614
|
// =======================================================================
|
|
615
615
|
console.log();
|
|
616
|
-
log.
|
|
616
|
+
console.log(pc.dim(" " + "─".repeat(54)));
|
|
617
617
|
console.log();
|
|
618
618
|
console.log(pc.green(pc.bold(" ✓ Orizon setup complete!")));
|
|
619
619
|
console.log();
|
|
620
620
|
|
|
621
621
|
if (scaffolded) {
|
|
622
|
-
console.log(" Get started:");
|
|
623
|
-
console.log(pc.cyan(`
|
|
624
|
-
console.log(pc.cyan("
|
|
622
|
+
console.log(pc.bold(" Get started:"));
|
|
623
|
+
console.log(` ${pc.cyan("$")} ${pc.bold(`cd ${projectName}`)}`);
|
|
624
|
+
console.log(` ${pc.cyan("$")} ${pc.bold("npm run dev")}`);
|
|
625
625
|
console.log();
|
|
626
626
|
}
|
|
627
627
|
|
|
628
|
-
console.log(" Import components:");
|
|
628
|
+
console.log(pc.bold(" Import components:"));
|
|
629
629
|
console.log(
|
|
630
|
-
pc.cyan('
|
|
630
|
+
` ${pc.cyan('import { Button, Form, Input, Select } from')} ${pc.green('"orizon"')}${pc.cyan(";")}`,
|
|
631
631
|
);
|
|
632
632
|
console.log();
|
|
633
|
-
console.log(" Example with Form + Zod:");
|
|
633
|
+
console.log(pc.bold(" Example with Form + Zod:"));
|
|
634
634
|
console.log(
|
|
635
|
-
pc.dim("
|
|
635
|
+
` ${pc.dim("const [form] = Form.useForm({ schema: myZodSchema });")}`,
|
|
636
|
+
);
|
|
637
|
+
console.log();
|
|
638
|
+
console.log(
|
|
639
|
+
pc.dim(" Docs: https://orizon.dev | 68 components ready to use"),
|
|
636
640
|
);
|
|
637
641
|
console.log();
|
|
638
642
|
}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { AffixProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @file Affix Component
|
|
4
|
+
*
|
|
5
|
+
* Pins its children to the viewport when the scroll position crosses
|
|
6
|
+
* a configurable offset. Supports both top and bottom pinning, and
|
|
7
|
+
* a custom scroll container via the `target` prop.
|
|
8
|
+
*
|
|
9
|
+
* Key props: `offsetTop`, `offsetBottom`, `target`, `onChange`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Affix offsetTop={80}>
|
|
14
|
+
* <nav>Sticky toolbar</nav>
|
|
15
|
+
* </Affix>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @see {@link ./types.ts} — prop definitions
|
|
19
|
+
* @see {@link ./index.ts} — barrel export
|
|
20
|
+
*/
|
|
2
21
|
import * as React from "react";
|
|
3
22
|
declare const Affix: React.FC<AffixProps>;
|
|
4
23
|
export { Affix };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Affix } from './index';
|
|
3
|
+
declare const meta: Meta<typeof Affix>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Affix>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const OffsetTop: Story;
|
|
8
|
+
export declare const OffsetBottom: Story;
|
|
9
|
+
export declare const OnChange: Story;
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Affix — Public Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the `<Affix>` component that pins content to the viewport
|
|
5
|
+
* on scroll.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Affix component that pins its children to the viewport when scrolling.
|
|
9
|
+
*
|
|
10
|
+
* Supports `offsetTop` / `offsetBottom` for threshold control, a custom
|
|
11
|
+
* `target` scroll container, and an `onChange` callback.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Affix offsetTop={64}>
|
|
16
|
+
* <div>I stick 64px from top</div>
|
|
17
|
+
* </Affix>
|
|
18
|
+
*
|
|
19
|
+
* <Affix offsetBottom={20}>
|
|
20
|
+
* <button>Floating action</button>
|
|
21
|
+
* </Affix>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
1
24
|
export { Affix } from './Affix';
|
|
2
25
|
export type { AffixProps } from './types';
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { AlertProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @file Alert Component
|
|
4
|
+
*
|
|
5
|
+
* Renders a feedback alert banner with semantic colouring for
|
|
6
|
+
* success, info, warning, and error states. Supports closable
|
|
7
|
+
* behaviour (with animation), an action slot, custom icons,
|
|
8
|
+
* and a full-width banner mode.
|
|
9
|
+
*
|
|
10
|
+
* Key props: `type`, `message`, `description`, `closable`, `showIcon`,
|
|
11
|
+
* `banner`, `action`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Alert type="success" message="Saved!" showIcon />
|
|
16
|
+
* <Alert type="error" message="Failed" description="Details..." closable />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @see {@link ./types.ts} — prop definitions
|
|
20
|
+
* @see {@link ./ErrorBoundary.tsx} — error boundary sub-component
|
|
21
|
+
* @see {@link ./index.ts} — barrel export
|
|
22
|
+
*/
|
|
2
23
|
import * as React from "react";
|
|
3
24
|
declare const InternalAlert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
25
|
export { InternalAlert };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Alert } from './index';
|
|
3
|
+
declare const meta: Meta<typeof Alert>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Alert>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const Types: Story;
|
|
8
|
+
export declare const WithIcon: Story;
|
|
9
|
+
export declare const Closable: Story;
|
|
10
|
+
export declare const Description: Story;
|
|
11
|
+
export declare const Banner: Story;
|
|
12
|
+
export declare const Actions: Story;
|
|
13
|
+
export declare const ErrorBoundaryStory: Story;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { AlertErrorBoundaryProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @file Alert Error Boundary
|
|
4
|
+
*
|
|
5
|
+
* A React class-based error boundary that catches render errors
|
|
6
|
+
* in its children and displays them as an error `<Alert>`. Used
|
|
7
|
+
* via `Alert.ErrorBoundary`.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link ./Alert.tsx} — main Alert component
|
|
10
|
+
* @see {@link ./types.ts} — prop definitions
|
|
11
|
+
*/
|
|
2
12
|
import * as React from "react";
|
|
3
13
|
interface ErrorBoundaryState {
|
|
4
14
|
hasError: boolean;
|
|
@@ -3,6 +3,26 @@ import { AlertErrorBoundary } from './ErrorBoundary';
|
|
|
3
3
|
type AlertComponent = typeof InternalAlert & {
|
|
4
4
|
ErrorBoundary: typeof AlertErrorBoundary;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Alert component for feedback messages.
|
|
8
|
+
*
|
|
9
|
+
* Supports `type` (success / info / warning / error), `closable`,
|
|
10
|
+
* `banner` mode, custom `icon`, and an `action` slot.
|
|
11
|
+
*
|
|
12
|
+
* Use `Alert.ErrorBoundary` to catch React errors and display
|
|
13
|
+
* them as an alert.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Alert type="success" message="Done!" />
|
|
18
|
+
* <Alert type="warning" message="Watch out" description="Details here" closable />
|
|
19
|
+
* <Alert type="info" message="Tip" showIcon banner />
|
|
20
|
+
*
|
|
21
|
+
* <Alert.ErrorBoundary message="Oops">
|
|
22
|
+
* <SomeComponent />
|
|
23
|
+
* </Alert.ErrorBoundary>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
6
26
|
declare const Alert: AlertComponent;
|
|
7
27
|
export { Alert };
|
|
8
28
|
export type { AlertProps, AlertType, AlertClosableConfig, AlertErrorBoundaryProps, } from './types';
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { AnchorProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @file Anchor Component
|
|
4
|
+
*
|
|
5
|
+
* A scroll-spy navigation component that highlights the current
|
|
6
|
+
* section in view and smooth-scrolls to anchor targets on click.
|
|
7
|
+
* Supports vertical / horizontal layout, nested items, affix
|
|
8
|
+
* (sticky) positioning, and a sliding active indicator.
|
|
9
|
+
*
|
|
10
|
+
* Key props: `items`, `direction`, `affix`, `targetOffset`, `onChange`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Anchor
|
|
15
|
+
* items={[
|
|
16
|
+
* { key: "1", href: "#section-1", title: "Introduction" },
|
|
17
|
+
* { key: "2", href: "#section-2", title: "Usage" },
|
|
18
|
+
* ]}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @see {@link ./types.ts} — prop definitions
|
|
23
|
+
* @see {@link ./index.ts} — barrel export
|
|
24
|
+
*/
|
|
2
25
|
import * as React from "react";
|
|
3
26
|
declare const Anchor: React.ForwardRefExoticComponent<AnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
27
|
export { Anchor };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Anchor } from './index';
|
|
3
|
+
declare const meta: Meta<typeof Anchor>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Anchor>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const Vertical: Story;
|
|
8
|
+
export declare const Horizontal: Story;
|
|
9
|
+
export declare const NestedItems: Story;
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Anchor — Public Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the `<Anchor>` scroll-spy navigation component.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Anchor component for scroll-spy navigation.
|
|
8
|
+
*
|
|
9
|
+
* Highlights the active section as the user scrolls and smooth-scrolls
|
|
10
|
+
* to targets on click. Supports `direction` (vertical / horizontal),
|
|
11
|
+
* `affix` mode, nested `items`, and custom `getContainer`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Anchor
|
|
16
|
+
* items={[
|
|
17
|
+
* { key: "intro", href: "#intro", title: "Introduction" },
|
|
18
|
+
* { key: "api", href: "#api", title: "API" },
|
|
19
|
+
* ]}
|
|
20
|
+
* direction="vertical"
|
|
21
|
+
* offsetTop={80}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
1
25
|
export { Anchor } from './Anchor';
|
|
2
26
|
export type { AnchorProps, AnchorItem, AnchorDirection } from './types';
|
|
@@ -2,6 +2,31 @@ import { MessageAPI } from '../message/types';
|
|
|
2
2
|
import { NotificationAPI } from '../notification/types';
|
|
3
3
|
import { ModalHookAPI } from '../modal/types';
|
|
4
4
|
import { AppProps } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* @file App Component
|
|
7
|
+
*
|
|
8
|
+
* Top-level provider that makes imperative `message`, `notification`,
|
|
9
|
+
* and `modal` APIs available via `App.useApp()`. Wrap your application
|
|
10
|
+
* (or a subtree) with `<App>` and call `const { message } = App.useApp()`
|
|
11
|
+
* to show feedback without prop-drilling.
|
|
12
|
+
*
|
|
13
|
+
* Key props: `children`, `component`, `className`, `style`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <App>
|
|
18
|
+
* <MyPage />
|
|
19
|
+
* </App>
|
|
20
|
+
*
|
|
21
|
+
* function MyPage() {
|
|
22
|
+
* const { message } = App.useApp();
|
|
23
|
+
* return <button onClick={() => message.success("Saved!")}>Save</button>;
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see {@link ./types.ts} — prop definitions
|
|
28
|
+
* @see {@link ./index.ts} — barrel export
|
|
29
|
+
*/
|
|
5
30
|
import * as React from "react";
|
|
6
31
|
interface AppContextValue {
|
|
7
32
|
message: MessageAPI;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { App } from './index';
|
|
3
|
+
declare const meta: Meta<typeof App>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof App>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const CustomComponent: Story;
|
|
8
|
+
export declare const NoWrapper: Story;
|
|
@@ -2,6 +2,24 @@ import { InternalApp, useApp } from './App';
|
|
|
2
2
|
type AppComponent = typeof InternalApp & {
|
|
3
3
|
useApp: typeof useApp;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* App provider component for imperative feedback APIs.
|
|
7
|
+
*
|
|
8
|
+
* Wrap your application with `<App>` to gain access to
|
|
9
|
+
* `message`, `notification`, and `modal` via the `App.useApp()` hook.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <App>
|
|
14
|
+
* <MyPage />
|
|
15
|
+
* </App>
|
|
16
|
+
*
|
|
17
|
+
* function MyPage() {
|
|
18
|
+
* const { message, notification, modal } = App.useApp();
|
|
19
|
+
* return <button onClick={() => message.info("Hello!")}>Greet</button>;
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
5
23
|
declare const App: AppComponent;
|
|
6
24
|
export { App };
|
|
7
25
|
export type { AppProps } from './types';
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import { AutoCompleteProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @file AutoComplete Component
|
|
4
|
+
*
|
|
5
|
+
* An input field with a filterable dropdown suggestion list.
|
|
6
|
+
* Supports keyboard navigation, controlled / uncontrolled value,
|
|
7
|
+
* custom filter functions, backfill, allow-clear, and three
|
|
8
|
+
* visual variants (outlined, borderless, filled).
|
|
9
|
+
*
|
|
10
|
+
* Key props: `options`, `value`, `onChange`, `onSelect`, `onSearch`,
|
|
11
|
+
* `filterOption`, `size`, `status`, `variant`, `allowClear`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <AutoComplete
|
|
16
|
+
* options={[{ value: "React" }, { value: "Vue" }, { value: "Angular" }]}
|
|
17
|
+
* placeholder="Search frameworks"
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @see {@link ./types.ts} — prop definitions
|
|
22
|
+
* @see {@link ./index.ts} — barrel export
|
|
23
|
+
*/
|
|
2
24
|
import * as React from "react";
|
|
3
25
|
declare const InternalAutoComplete: React.ForwardRefExoticComponent<AutoCompleteProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
26
|
export { InternalAutoComplete };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AutoComplete } from './index';
|
|
3
|
+
declare const meta: Meta<typeof AutoComplete>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AutoComplete>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const Variants: Story;
|
|
9
|
+
export declare const Status: Story;
|
|
10
|
+
export declare const AllowClear: Story;
|
|
11
|
+
export declare const Disabled: Story;
|
|
12
|
+
export declare const CustomFilter: Story;
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file AutoComplete — Public Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the `<AutoComplete>` input component with dropdown
|
|
5
|
+
* suggestions.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* AutoComplete input with filterable dropdown suggestions.
|
|
9
|
+
*
|
|
10
|
+
* Supports `options`, controlled / uncontrolled `value`, custom
|
|
11
|
+
* `filterOption`, `allowClear`, `size`, `status`, and `variant`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <AutoComplete
|
|
16
|
+
* options={[{ value: "React" }, { value: "Vue" }]}
|
|
17
|
+
* placeholder="Search..."
|
|
18
|
+
* onSelect={(val) => console.log(val)}
|
|
19
|
+
* />
|
|
20
|
+
* <AutoComplete size="large" variant="filled" allowClear />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
1
23
|
declare const AutoComplete: import('react').ForwardRefExoticComponent<import('./types').AutoCompleteProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
2
24
|
export { AutoComplete };
|
|
3
25
|
export type { AutoCompleteProps, AutoCompleteOption, AutoCompleteSize, AutoCompleteStatus, AutoCompleteVariant, } from './types';
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
import { AvatarProps, AvatarGroupProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @file Avatar Component
|
|
4
|
+
*
|
|
5
|
+
* Renders a user avatar as an image, icon, or auto-scaled text
|
|
6
|
+
* initials. Supports circle / square shapes, three preset sizes
|
|
7
|
+
* (plus custom numeric), and grouped display via `Avatar.Group`.
|
|
8
|
+
*
|
|
9
|
+
* Key props: `src`, `size`, `shape`, `icon`, `alt`, `gap`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Avatar src="/user.jpg" alt="Jane" />
|
|
14
|
+
* <Avatar icon={<UserIcon />} shape="square" size="large" />
|
|
15
|
+
* <Avatar.Group max={{ count: 3 }}>
|
|
16
|
+
* <Avatar src="/a.jpg" />
|
|
17
|
+
* <Avatar src="/b.jpg" />
|
|
18
|
+
* <Avatar src="/c.jpg" />
|
|
19
|
+
* <Avatar src="/d.jpg" />
|
|
20
|
+
* </Avatar.Group>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @see {@link ./types.ts} — prop definitions
|
|
24
|
+
* @see {@link ./index.ts} — barrel export
|
|
25
|
+
*/
|
|
2
26
|
import * as React from "react";
|
|
3
27
|
declare const InternalAvatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
4
28
|
declare const InternalAvatarGroup: React.FC<AvatarGroupProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Avatar } from './index';
|
|
3
|
+
declare const meta: Meta<typeof Avatar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Avatar>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const Shapes: Story;
|
|
9
|
+
export declare const Fallbacks: Story;
|
|
10
|
+
export declare const Group: Story;
|
|
@@ -2,6 +2,27 @@ import { InternalAvatar, InternalAvatarGroup } from './Avatar';
|
|
|
2
2
|
type AvatarComponent = typeof InternalAvatar & {
|
|
3
3
|
Group: typeof InternalAvatarGroup;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Avatar component for user profile images, icons, or text initials.
|
|
7
|
+
*
|
|
8
|
+
* Supports `src` image, `icon` fallback, text `children` with
|
|
9
|
+
* auto-scaling, `shape` (circle / square), and `size`.
|
|
10
|
+
*
|
|
11
|
+
* Use `Avatar.Group` to display a stacked group with overflow count.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Avatar src="/photo.jpg" alt="User" />
|
|
16
|
+
* <Avatar shape="square" size={48}>AB</Avatar>
|
|
17
|
+
*
|
|
18
|
+
* <Avatar.Group max={{ count: 3 }}>
|
|
19
|
+
* <Avatar src="/a.jpg" />
|
|
20
|
+
* <Avatar src="/b.jpg" />
|
|
21
|
+
* <Avatar src="/c.jpg" />
|
|
22
|
+
* <Avatar src="/d.jpg" />
|
|
23
|
+
* </Avatar.Group>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
5
26
|
declare const Avatar: AvatarComponent;
|
|
6
27
|
export { Avatar };
|
|
7
28
|
export type { AvatarProps, AvatarGroupProps, AvatarSize, AvatarShape, AvatarGroupMaxConfig } from './types';
|