@rockshin/tao-ui 0.0.25 → 0.0.27
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 +17 -6
- package/component-manifest.json +534 -6
- package/dist/components/alert/alert.css +120 -0
- package/dist/components/alert/alert.d.ts +20 -0
- package/dist/components/alert/alert.js +185 -0
- package/dist/components/button/button.css +19 -18
- package/dist/components/button/button.d.ts +8 -0
- package/dist/components/date-picker/date-picker.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +57 -43
- package/dist/components/date-picker/range-picker.js +68 -23
- package/dist/components/dropdown/dropdown.css +22 -1
- package/dist/components/dropdown/dropdown.js +4 -3
- package/dist/components/form/form-context.d.ts +7 -0
- package/dist/components/form/form-context.js +8 -0
- package/dist/components/form/form-item.d.ts +55 -0
- package/dist/components/form/form-item.js +131 -0
- package/dist/components/form/form.css +22 -0
- package/dist/components/form/form.d.ts +35 -0
- package/dist/components/form/form.js +125 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/form-field/form-field-view.d.ts +30 -0
- package/dist/components/form-field/form-field-view.js +154 -0
- package/dist/components/form-field/form-field.d.ts +2 -2
- package/dist/components/form-field/form-field.js +29 -137
- package/dist/components/form-field/form.css +17 -7
- package/dist/components/input/input.css +6 -6
- package/dist/components/modal/confirm-dialog.js +14 -111
- package/dist/components/modal/modal.d.ts +7 -1
- package/dist/components/modal/modal.js +205 -195
- package/dist/components/popconfirm/popconfirm.css +44 -0
- package/dist/components/popconfirm/popconfirm.d.ts +41 -0
- package/dist/components/popconfirm/popconfirm.js +238 -0
- package/dist/components/popover/popover.css +105 -0
- package/dist/components/popover/popover.d.ts +41 -0
- package/dist/components/popover/popover.js +412 -0
- package/dist/components/select/mobile-select.js +9 -20
- package/dist/components/select/select-model.d.ts +7 -1
- package/dist/components/select/select-model.js +30 -7
- package/dist/components/select/select.js +49 -38
- package/dist/components/sonner/sonner.d.ts +2 -1
- package/dist/components/sonner/sonner.js +74 -81
- package/dist/components/status-icon/status-icon.d.ts +5 -0
- package/dist/components/status-icon/status-icon.js +77 -0
- package/dist/components/table/table-types.d.ts +7 -0
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +296 -283
- package/dist/components/tooltip/tooltip.css +93 -0
- package/dist/components/tooltip/tooltip.d.ts +33 -0
- package/dist/components/tooltip/tooltip.js +226 -0
- package/dist/docs/component-docs.js +11 -1
- package/dist/docs/components/alert.doc.d.ts +29 -0
- package/dist/docs/components/alert.doc.js +93 -0
- package/dist/docs/components/form.doc.d.ts +29 -0
- package/dist/docs/components/form.doc.js +71 -0
- package/dist/docs/components/modal.doc.d.ts +6 -0
- package/dist/docs/components/modal.doc.js +9 -1
- package/dist/docs/components/popconfirm.doc.d.ts +29 -0
- package/dist/docs/components/popconfirm.doc.js +132 -0
- package/dist/docs/components/popover.doc.d.ts +29 -0
- package/dist/docs/components/popover.doc.js +121 -0
- package/dist/docs/components/stack.doc.d.ts +6 -0
- package/dist/docs/components/stack.doc.js +23 -2
- package/dist/docs/components/table.doc.js +2 -1
- package/dist/docs/components/tao-provider.doc.js +11 -1
- package/dist/docs/components/tooltip.doc.d.ts +37 -0
- package/dist/docs/components/tooltip.doc.js +76 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +8 -1
- package/dist/layouts/stack/stack.d.ts +12 -3
- package/dist/layouts/stack/stack.js +60 -34
- package/dist/provider/tao-provider.d.ts +71 -0
- package/dist/provider/tao-provider.js +166 -120
- package/dist/theme/control.css +12 -12
- package/dist/theme/theme.css +23 -0
- package/dist/utils/breakpoint.d.ts +31 -0
- package/dist/utils/breakpoint.js +80 -0
- package/dist/utils/overlay.d.ts +19 -0
- package/dist/utils/overlay.js +41 -0
- package/llms.txt +68 -3
- package/package.json +6 -4
- package/dist/components/select/use-is-mobile.d.ts +0 -1
- package/dist/components/select/use-is-mobile.js +0 -27
package/dist/theme/theme.css
CHANGED
|
@@ -146,6 +146,9 @@
|
|
|
146
146
|
--tao-box-shadow: 0 1px 2px oklch(0% 0 0 / .04), 0 0 1px oklch(0% 0 0 / .08);
|
|
147
147
|
--tao-box-shadow-secondary: 0 2px 8px oklch(0% 0 0 / .06), 0 0 1px oklch(0% 0 0 / .06);
|
|
148
148
|
--tao-box-shadow-tertiary: 0 1px 2px oklch(0% 0 0 / .04);
|
|
149
|
+
--tao-drop-shadow-popover: drop-shadow(0 6px 16px oklch(0% 0 0 / .08))
|
|
150
|
+
drop-shadow(0 3px 6px oklch(0% 0 0 / .12))
|
|
151
|
+
drop-shadow(0 9px 28px oklch(0% 0 0 / .05));
|
|
149
152
|
--tao-control-outline: color-mix(in oklch,
|
|
150
153
|
var(--tao-color-primary) 20%,
|
|
151
154
|
transparent);
|
|
@@ -165,6 +168,23 @@
|
|
|
165
168
|
--tao-color-shadow-hint: oklch(0% 0 0 / .05);
|
|
166
169
|
}
|
|
167
170
|
|
|
171
|
+
[data-tao-density="compact"] {
|
|
172
|
+
--tao-control-height: 28px;
|
|
173
|
+
--tao-padding-xs: 4px;
|
|
174
|
+
--tao-padding-sm: 8px;
|
|
175
|
+
--tao-padding: 12px;
|
|
176
|
+
--tao-padding-md: 16px;
|
|
177
|
+
--tao-padding-lg: 20px;
|
|
178
|
+
--tao-padding-xl: 28px;
|
|
179
|
+
--tao-margin-xs: 4px;
|
|
180
|
+
--tao-margin-sm: 8px;
|
|
181
|
+
--tao-margin: 12px;
|
|
182
|
+
--tao-margin-md: 16px;
|
|
183
|
+
--tao-margin-lg: 20px;
|
|
184
|
+
--tao-margin-xl: 28px;
|
|
185
|
+
--tao-margin-xxl: 40px;
|
|
186
|
+
}
|
|
187
|
+
|
|
168
188
|
[data-tao-theme="dark"] {
|
|
169
189
|
--tao-color-bg-base: oklch(16.5% .005 70);
|
|
170
190
|
--tao-color-text-base: oklch(92.2% .005 70);
|
|
@@ -189,6 +209,9 @@
|
|
|
189
209
|
--tao-box-shadow: 0 1px 2px oklch(0% 0 0 / .35), 0 0 1px oklch(0% 0 0 / .5);
|
|
190
210
|
--tao-box-shadow-secondary: 0 4px 12px oklch(0% 0 0 / .4), 0 0 1px oklch(0% 0 0 / .5);
|
|
191
211
|
--tao-box-shadow-tertiary: 0 1px 2px oklch(0% 0 0 / .35);
|
|
212
|
+
--tao-drop-shadow-popover: drop-shadow(0 6px 16px oklch(0% 0 0 / .32))
|
|
213
|
+
drop-shadow(0 3px 6px oklch(0% 0 0 / .4))
|
|
214
|
+
drop-shadow(0 9px 28px oklch(0% 0 0 / .24));
|
|
192
215
|
--tao-color-bg-mask: oklch(0% 0 0 / .55);
|
|
193
216
|
--tao-color-shadow-hint: oklch(0% 0 0 / .35);
|
|
194
217
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsive breakpoints — values aligned with antd v6
|
|
3
|
+
* (`xs <576 / sm ≥576 / md ≥768 / lg ≥992 / xl ≥1200 / xxl ≥1600`).
|
|
4
|
+
*
|
|
5
|
+
* CSS custom properties cannot be referenced from @media queries, so
|
|
6
|
+
* breakpoints live as JS constants only; component CSS keeps its own
|
|
7
|
+
* hardcoded media queries where needed.
|
|
8
|
+
*/
|
|
9
|
+
export type TaoBreakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
10
|
+
export type TaoBreakpointMap<T = boolean> = Partial<Record<TaoBreakpoint, T>>;
|
|
11
|
+
/**
|
|
12
|
+
* A prop value that can vary per breakpoint: either a plain `T` or a
|
|
13
|
+
* breakpoint map like `{ xs: 'vertical', md: 'horizontal' }`.
|
|
14
|
+
*/
|
|
15
|
+
export type TaoResponsiveValue<T> = T | TaoBreakpointMap<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Current breakpoint matches, e.g. `{ sm: true, md: true }` at 800px.
|
|
18
|
+
*
|
|
19
|
+
* SSR and the first client render return `{}` so hydration markup stays
|
|
20
|
+
* desktop-first and identical to the server; real matches apply after mount.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useBreakpoint(): TaoBreakpointMap;
|
|
23
|
+
/** True below the `sm` breakpoint (< 576px, i.e. phones). */
|
|
24
|
+
export declare function useIsMobile(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a possibly-responsive value against current breakpoint matches:
|
|
27
|
+
* the largest matching breakpoint with a defined value wins; a plain value
|
|
28
|
+
* passes through untouched. Returns `undefined` when a map has no usable
|
|
29
|
+
* entry — callers fall back to their own default.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveResponsiveValue<T>(value: TaoResponsiveValue<T>, screens: TaoBreakpointMap): T | undefined;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
|
+
const BREAKPOINTS_DESC = [
|
|
3
|
+
'xxl',
|
|
4
|
+
'xl',
|
|
5
|
+
'lg',
|
|
6
|
+
'md',
|
|
7
|
+
'sm',
|
|
8
|
+
'xs'
|
|
9
|
+
];
|
|
10
|
+
const BREAKPOINT_QUERIES = {
|
|
11
|
+
xs: '(max-width: 575px)',
|
|
12
|
+
sm: '(min-width: 576px)',
|
|
13
|
+
md: '(min-width: 768px)',
|
|
14
|
+
lg: '(min-width: 992px)',
|
|
15
|
+
xl: '(min-width: 1200px)',
|
|
16
|
+
xxl: '(min-width: 1600px)'
|
|
17
|
+
};
|
|
18
|
+
const EMPTY_SCREENS = {};
|
|
19
|
+
let mqls = null;
|
|
20
|
+
let cachedScreens = EMPTY_SCREENS;
|
|
21
|
+
const listeners = new Set();
|
|
22
|
+
function readScreens(current) {
|
|
23
|
+
const next = {};
|
|
24
|
+
for (const bp of BREAKPOINTS_DESC)next[bp] = current[bp].matches;
|
|
25
|
+
return next;
|
|
26
|
+
}
|
|
27
|
+
function sameScreens(a, b) {
|
|
28
|
+
return BREAKPOINTS_DESC.every((bp)=>a[bp] === b[bp]);
|
|
29
|
+
}
|
|
30
|
+
function handleChange() {
|
|
31
|
+
if (!mqls) return;
|
|
32
|
+
const next = readScreens(mqls);
|
|
33
|
+
if (!sameScreens(next, cachedScreens)) {
|
|
34
|
+
cachedScreens = next;
|
|
35
|
+
for (const listener of listeners)listener();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function ensureObserver() {
|
|
39
|
+
if (mqls || "u" < typeof window) return;
|
|
40
|
+
const registered = {};
|
|
41
|
+
for (const bp of BREAKPOINTS_DESC){
|
|
42
|
+
const mql = window.matchMedia(BREAKPOINT_QUERIES[bp]);
|
|
43
|
+
mql.addEventListener('change', handleChange);
|
|
44
|
+
registered[bp] = mql;
|
|
45
|
+
}
|
|
46
|
+
mqls = registered;
|
|
47
|
+
cachedScreens = readScreens(registered);
|
|
48
|
+
}
|
|
49
|
+
function teardownObserver() {
|
|
50
|
+
if (!mqls) return;
|
|
51
|
+
for (const bp of BREAKPOINTS_DESC)mqls[bp].removeEventListener('change', handleChange);
|
|
52
|
+
mqls = null;
|
|
53
|
+
cachedScreens = EMPTY_SCREENS;
|
|
54
|
+
}
|
|
55
|
+
function subscribe(listener) {
|
|
56
|
+
ensureObserver();
|
|
57
|
+
listeners.add(listener);
|
|
58
|
+
return ()=>{
|
|
59
|
+
listeners.delete(listener);
|
|
60
|
+
if (0 === listeners.size) teardownObserver();
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function getSnapshot() {
|
|
64
|
+
return cachedScreens;
|
|
65
|
+
}
|
|
66
|
+
function getServerSnapshot() {
|
|
67
|
+
return EMPTY_SCREENS;
|
|
68
|
+
}
|
|
69
|
+
function useBreakpoint() {
|
|
70
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
71
|
+
}
|
|
72
|
+
function useIsMobile() {
|
|
73
|
+
return true === useBreakpoint().xs;
|
|
74
|
+
}
|
|
75
|
+
function resolveResponsiveValue(value, screens) {
|
|
76
|
+
if ('object' != typeof value || null === value) return value;
|
|
77
|
+
const map = value;
|
|
78
|
+
for (const bp of BREAKPOINTS_DESC)if (screens[bp] && void 0 !== map[bp]) return map[bp];
|
|
79
|
+
}
|
|
80
|
+
export { resolveResponsiveValue, useBreakpoint, useIsMobile };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Controlled/uncontrolled open state for overlay components
|
|
4
|
+
* (Popover/Popconfirm/Tooltip/…): `open` wins when provided, `defaultOpen`
|
|
5
|
+
* seeds the uncontrolled initial state, and `onOpenChange` observes every
|
|
6
|
+
* request either way. `canOpen: false` vetoes opening while still allowing
|
|
7
|
+
* closes (antd's `disabled` semantics for Popconfirm).
|
|
8
|
+
*/
|
|
9
|
+
export declare function useControlledOpen({ open, defaultOpen, onOpenChange, canOpen, }: {
|
|
10
|
+
open?: boolean;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
canOpen?: boolean;
|
|
14
|
+
}): [boolean, (next: boolean) => void];
|
|
15
|
+
/**
|
|
16
|
+
* Radix `Trigger asChild` requires exactly one element child — wrap plain
|
|
17
|
+
* text/fragment content in a span so triggers can accept any ReactNode.
|
|
18
|
+
*/
|
|
19
|
+
export declare function asTriggerChild(children: ReactNode): ReactElement;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { isValidElement, useState } from "react";
|
|
4
|
+
function useControlledOpen(t0) {
|
|
5
|
+
const $ = c(7);
|
|
6
|
+
const { open, defaultOpen, onOpenChange, canOpen: t1 } = t0;
|
|
7
|
+
const canOpen = void 0 === t1 ? true : t1;
|
|
8
|
+
const isControlled = null != open;
|
|
9
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);
|
|
10
|
+
const realOpen = isControlled ? open : internalOpen;
|
|
11
|
+
let t2;
|
|
12
|
+
if ($[0] !== canOpen || $[1] !== isControlled || $[2] !== onOpenChange) {
|
|
13
|
+
t2 = (next)=>{
|
|
14
|
+
if (next && !canOpen) return;
|
|
15
|
+
if (!isControlled) setInternalOpen(next);
|
|
16
|
+
onOpenChange?.(next);
|
|
17
|
+
};
|
|
18
|
+
$[0] = canOpen;
|
|
19
|
+
$[1] = isControlled;
|
|
20
|
+
$[2] = onOpenChange;
|
|
21
|
+
$[3] = t2;
|
|
22
|
+
} else t2 = $[3];
|
|
23
|
+
const setOpen = t2;
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[4] !== realOpen || $[5] !== setOpen) {
|
|
26
|
+
t3 = [
|
|
27
|
+
realOpen,
|
|
28
|
+
setOpen
|
|
29
|
+
];
|
|
30
|
+
$[4] = realOpen;
|
|
31
|
+
$[5] = setOpen;
|
|
32
|
+
$[6] = t3;
|
|
33
|
+
} else t3 = $[6];
|
|
34
|
+
return t3;
|
|
35
|
+
}
|
|
36
|
+
function asTriggerChild(children) {
|
|
37
|
+
return /*#__PURE__*/ isValidElement(children) ? children : /*#__PURE__*/ jsx("span", {
|
|
38
|
+
children: children
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { asTriggerChild, useControlledOpen };
|
package/llms.txt
CHANGED
|
@@ -21,9 +21,9 @@ Import from the package root. The package entry imports tao-ui CSS side effects
|
|
|
21
21
|
## Component Groups
|
|
22
22
|
|
|
23
23
|
- Config: TaoProvider
|
|
24
|
-
- Data Display: Collapsible, ScrollArea, Table, Tag
|
|
25
|
-
- Data Entry: Checkbox, DatePicker, FormActions, FormField, FormSection, Input, InputNumber, Radio, RangePicker, Select, Switch, Textarea
|
|
26
|
-
- Feedback: Drawer, Modal, Sonner, Spinner
|
|
24
|
+
- Data Display: Collapsible, Popover, ScrollArea, Table, Tag, Tooltip
|
|
25
|
+
- Data Entry: Checkbox, DatePicker, Form, FormActions, FormField, FormSection, Input, InputNumber, Radio, RangePicker, Select, Switch, Textarea
|
|
26
|
+
- Feedback: Alert, Drawer, Modal, Popconfirm, Sonner, Spinner
|
|
27
27
|
- General: Button
|
|
28
28
|
- Headless: HeadlessInputNumber
|
|
29
29
|
- Layout: FormLayout, Splitter, Stack
|
|
@@ -31,6 +31,19 @@ Import from the package root. The package entry imports tao-ui CSS side effects
|
|
|
31
31
|
|
|
32
32
|
## Components
|
|
33
33
|
|
|
34
|
+
### Alert
|
|
35
|
+
|
|
36
|
+
Displays important contextual feedback messages with semantic status types.
|
|
37
|
+
|
|
38
|
+
- Category: Feedback
|
|
39
|
+
- Exports: `Alert`
|
|
40
|
+
- Source: `src/components/alert/alert.tsx`
|
|
41
|
+
- Storybook: `stories/alert.stories.tsx`
|
|
42
|
+
- Tests: `tests/alert/alert.test.tsx`
|
|
43
|
+
- Semantic parts: `root`, `icon`, `title`, `description`, `action`, `close`
|
|
44
|
+
|
|
45
|
+
Use Alert for persistent, page-level feedback about a state or operation. Use Sonner toasts for transient notifications.
|
|
46
|
+
|
|
34
47
|
### Breadcrumb
|
|
35
48
|
|
|
36
49
|
Renders the user location in a hierarchy of pages or views.
|
|
@@ -135,6 +148,19 @@ Opens a menu of actions or navigation choices from a trigger.
|
|
|
135
148
|
|
|
136
149
|
Use Dropdown for compact action sets that do not need to stay visible.
|
|
137
150
|
|
|
151
|
+
### Form
|
|
152
|
+
|
|
153
|
+
Collects and validates field values with an antd-aligned API (rules, dependencies, Form.List) on top of the rc-form engine.
|
|
154
|
+
|
|
155
|
+
- Category: Data Entry
|
|
156
|
+
- Exports: `Form`
|
|
157
|
+
- Source: `src/components/form/form.tsx`
|
|
158
|
+
- Storybook: `stories/form.stories.tsx`
|
|
159
|
+
- Tests: `tests/form/form.test.tsx`
|
|
160
|
+
- Semantic parts: `root`
|
|
161
|
+
|
|
162
|
+
Use Form with Form.Item when fields need a value store, rule validation, or submit handling. Use the lighter FormField when you manage state yourself.
|
|
163
|
+
|
|
138
164
|
### FormActions
|
|
139
165
|
|
|
140
166
|
Lays out submit, cancel, and secondary actions for forms.
|
|
@@ -251,6 +277,32 @@ Moves through paged data with current page and page-size controls.
|
|
|
251
277
|
|
|
252
278
|
Use Pagination when a collection is split into pages rather than infinitely loaded.
|
|
253
279
|
|
|
280
|
+
### Popconfirm
|
|
281
|
+
|
|
282
|
+
Shows a compact confirmation popup anchored to a trigger element, with OK and Cancel actions.
|
|
283
|
+
|
|
284
|
+
- Category: Feedback
|
|
285
|
+
- Exports: `Popconfirm`
|
|
286
|
+
- Source: `src/components/popconfirm/popconfirm.tsx`
|
|
287
|
+
- Storybook: `stories/popconfirm.stories.tsx`
|
|
288
|
+
- Tests: `tests/popconfirm/popconfirm.test.tsx`
|
|
289
|
+
- Semantic parts: `content`, `title`, `description`, `footer`, `icon`
|
|
290
|
+
|
|
291
|
+
Use Popconfirm for lightweight inline confirmations such as delete actions, where a full Modal would be too heavy. Use Modal.confirm for critical or complex confirmations.
|
|
292
|
+
|
|
293
|
+
### Popover
|
|
294
|
+
|
|
295
|
+
Displays a floating card with rich content anchored to a trigger element, opened by click or hover.
|
|
296
|
+
|
|
297
|
+
- Category: Data Display
|
|
298
|
+
- Exports: `Popover`
|
|
299
|
+
- Source: `src/components/popover/popover.tsx`
|
|
300
|
+
- Storybook: `stories/popover.stories.tsx`
|
|
301
|
+
- Tests: `tests/popover/popover.test.tsx`
|
|
302
|
+
- Semantic parts: `root`, `container`, `title`, `content`, `arrow`
|
|
303
|
+
|
|
304
|
+
Use Popover for rich, non-blocking contextual content behind a click or hover. Use Tooltip for short text-only hints and Modal for blocking interactions.
|
|
305
|
+
|
|
254
306
|
### Radio
|
|
255
307
|
|
|
256
308
|
Selects exactly one option from a mutually exclusive set.
|
|
@@ -432,6 +484,19 @@ Multi-line text input with optional auto sizing.
|
|
|
432
484
|
|
|
433
485
|
Use Textarea for longer freeform content such as descriptions, notes, and comments.
|
|
434
486
|
|
|
487
|
+
### Tooltip
|
|
488
|
+
|
|
489
|
+
Shows a brief informational popup when hovering or focusing an element.
|
|
490
|
+
|
|
491
|
+
- Category: Data Display
|
|
492
|
+
- Exports: `Tooltip`
|
|
493
|
+
- Source: `src/components/tooltip/tooltip.tsx`
|
|
494
|
+
- Storybook: `stories/tooltip.stories.tsx`
|
|
495
|
+
- Tests: `tests/tooltip/tooltip.test.tsx`
|
|
496
|
+
- Semantic parts: `content`, `arrow`
|
|
497
|
+
|
|
498
|
+
Use Tooltip for short contextual hints on hover or focus. The popup is portaled and inherits the TaoProvider theme.
|
|
499
|
+
|
|
435
500
|
## Notes For Code Generation
|
|
436
501
|
|
|
437
502
|
- Prefer root imports from `@rockshin/tao-ui`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockshin/tao-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A modern React 19 component library with semantic DOM customization and OKLCH-based theming.",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"@rsbuild/plugin-babel": "^1.2.1",
|
|
75
75
|
"@rsbuild/plugin-react": "^2.0.1",
|
|
76
76
|
"@rslib/core": "^0.23.2",
|
|
77
|
-
"@rspress/core": "^2.0.
|
|
78
|
-
"@rspress/plugin-api-docgen": "^2.0.
|
|
79
|
-
"@rspress/plugin-preview": "^2.0.
|
|
77
|
+
"@rspress/core": "^2.0.19",
|
|
78
|
+
"@rspress/plugin-api-docgen": "^2.0.19",
|
|
79
|
+
"@rspress/plugin-preview": "^2.0.19",
|
|
80
80
|
"@rstest/adapter-rslib": "^0.10.6",
|
|
81
81
|
"@rstest/core": "^0.10.6",
|
|
82
82
|
"@storybook/addon-docs": "^10.5.3",
|
|
@@ -114,6 +114,8 @@
|
|
|
114
114
|
"@radix-ui/react-popover": "^1.1.15",
|
|
115
115
|
"@radix-ui/react-select": "^2.2.6",
|
|
116
116
|
"@radix-ui/react-slot": "^1.2.3",
|
|
117
|
+
"@radix-ui/react-tooltip": "^1.2.16",
|
|
118
|
+
"@rc-component/form": "~1.8.5",
|
|
117
119
|
"dayjs": "^1.11.21"
|
|
118
120
|
}
|
|
119
121
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useIsMobile(): boolean;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { c } from "react/compiler-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
const MOBILE_QUERY = '(max-width: 479px)';
|
|
4
|
-
function useIsMobile() {
|
|
5
|
-
const $ = c(2);
|
|
6
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
7
|
-
let t0;
|
|
8
|
-
let t1;
|
|
9
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10
|
-
t0 = ()=>{
|
|
11
|
-
const mql = window.matchMedia(MOBILE_QUERY);
|
|
12
|
-
const handler = (e)=>setIsMobile(e.matches);
|
|
13
|
-
setIsMobile(mql.matches);
|
|
14
|
-
mql.addEventListener("change", handler);
|
|
15
|
-
return ()=>mql.removeEventListener("change", handler);
|
|
16
|
-
};
|
|
17
|
-
t1 = [];
|
|
18
|
-
$[0] = t0;
|
|
19
|
-
$[1] = t1;
|
|
20
|
-
} else {
|
|
21
|
-
t0 = $[0];
|
|
22
|
-
t1 = $[1];
|
|
23
|
-
}
|
|
24
|
-
useEffect(t0, t1);
|
|
25
|
-
return isMobile;
|
|
26
|
-
}
|
|
27
|
-
export { useIsMobile };
|