@webx-ui/core 0.5.0 → 0.7.0
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/components/Alert/Alert.d.ts +41 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Alert/types.d.ts +29 -0
- package/dist/components/Aside/Aside.d.ts +25 -0
- package/dist/components/Aside/index.d.ts +2 -0
- package/dist/components/Aside/types.d.ts +14 -0
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +23 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/types.d.ts +13 -0
- package/dist/components/BreadcrumbItem/BreadcrumbItem.d.ts +28 -0
- package/dist/components/BreadcrumbItem/index.d.ts +2 -0
- package/dist/components/BreadcrumbItem/types.d.ts +19 -0
- package/dist/components/Cascader/Cascader.d.ts +1 -1
- package/dist/components/Col/Col.d.ts +27 -0
- package/dist/components/Col/index.d.ts +2 -0
- package/dist/components/Col/types.d.ts +24 -0
- package/dist/components/Container/Container.d.ts +22 -0
- package/dist/components/Container/index.d.ts +2 -0
- package/dist/components/Container/types.d.ts +13 -0
- package/dist/components/Dialog/Dialog.d.ts +105 -0
- package/dist/components/Dialog/index.d.ts +2 -0
- package/dist/components/Dialog/types.d.ts +60 -0
- package/dist/components/Divider/Divider.d.ts +24 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Divider/types.d.ts +16 -0
- package/dist/components/Drawer/Drawer.d.ts +98 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/types.d.ts +46 -0
- package/dist/components/Footer/Footer.d.ts +23 -0
- package/dist/components/Footer/index.d.ts +2 -0
- package/dist/components/Footer/types.d.ts +8 -0
- package/dist/components/Header/Header.d.ts +24 -0
- package/dist/components/Header/index.d.ts +2 -0
- package/dist/components/Header/types.d.ts +10 -0
- package/dist/components/Icon/icons.d.ts +1 -0
- package/dist/components/InputNumber/InputNumber.d.ts +1 -1
- package/dist/components/Kanban/Kanban.d.ts +2 -2
- package/dist/components/Main/Main.d.ts +22 -0
- package/dist/components/Main/index.d.ts +2 -0
- package/dist/components/Main/types.d.ts +8 -0
- package/dist/components/Menu/Menu.d.ts +39 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/types.d.ts +26 -0
- package/dist/components/MenuGroup/MenuGroup.d.ts +21 -0
- package/dist/components/MenuGroup/index.d.ts +2 -0
- package/dist/components/MenuGroup/types.d.ts +4 -0
- package/dist/components/MenuItem/MenuItem.d.ts +32 -0
- package/dist/components/MenuItem/index.d.ts +2 -0
- package/dist/components/MenuItem/types.d.ts +23 -0
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Row/Row.d.ts +25 -0
- package/dist/components/Row/index.d.ts +2 -0
- package/dist/components/Row/types.d.ts +17 -0
- package/dist/components/Scrollbar/Scrollbar.d.ts +39 -0
- package/dist/components/Scrollbar/index.d.ts +2 -0
- package/dist/components/Scrollbar/types.d.ts +30 -0
- package/dist/components/Space/Space.d.ts +27 -0
- package/dist/components/Space/index.d.ts +2 -0
- package/dist/components/Space/types.d.ts +23 -0
- package/dist/components/Submenu/Submenu.d.ts +31 -0
- package/dist/components/Submenu/index.d.ts +2 -0
- package/dist/components/Submenu/types.d.ts +15 -0
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/index.d.ts +19 -0
- package/dist/composables/useBreadcrumb.d.ts +13 -0
- package/dist/composables/useMenu.d.ts +49 -0
- package/dist/composables/useOverlayPanel.d.ts +22 -0
- package/dist/composables/useResponsiveShell.d.ts +59 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4441 -3020
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -2,24 +2,35 @@ export * from './Accordion';
|
|
|
2
2
|
export * from './AccordionItem';
|
|
3
3
|
export * from './Action';
|
|
4
4
|
export * from './Actions';
|
|
5
|
+
export * from './Alert';
|
|
6
|
+
export * from './Aside';
|
|
5
7
|
export * from './Autocomplete';
|
|
6
8
|
export * from './Badge';
|
|
9
|
+
export * from './Breadcrumb';
|
|
10
|
+
export * from './BreadcrumbItem';
|
|
7
11
|
export * from './Button';
|
|
8
12
|
export * from './ButtonGroup';
|
|
9
13
|
export * from './Card';
|
|
10
14
|
export * from './Cascader';
|
|
11
15
|
export * from './Checkbox';
|
|
12
16
|
export * from './CheckboxGroup';
|
|
17
|
+
export * from './Col';
|
|
13
18
|
export * from './ColorPicker';
|
|
19
|
+
export * from './Container';
|
|
14
20
|
export * from './Countdown';
|
|
15
21
|
export * from './DatePicker';
|
|
16
22
|
export * from './DateRangePicker';
|
|
17
23
|
export * from './DateTimePicker';
|
|
24
|
+
export * from './Dialog';
|
|
25
|
+
export * from './Divider';
|
|
26
|
+
export * from './Drawer';
|
|
18
27
|
export * from './Dropdown';
|
|
19
28
|
export * from './DropdownItem';
|
|
20
29
|
export * from './EntityCard';
|
|
30
|
+
export * from './Footer';
|
|
21
31
|
export * from './Form';
|
|
22
32
|
export * from './FormItem';
|
|
33
|
+
export * from './Header';
|
|
23
34
|
export * from './Heading';
|
|
24
35
|
export * from './Icon';
|
|
25
36
|
export * from './Indicator';
|
|
@@ -27,6 +38,10 @@ export * from './Input';
|
|
|
27
38
|
export * from './InputNumber';
|
|
28
39
|
export * from './Kanban';
|
|
29
40
|
export * from './Link';
|
|
41
|
+
export * from './Main';
|
|
42
|
+
export * from './Menu';
|
|
43
|
+
export * from './MenuGroup';
|
|
44
|
+
export * from './MenuItem';
|
|
30
45
|
export * from './Pagination';
|
|
31
46
|
export * from './Popover';
|
|
32
47
|
export * from './Prose';
|
|
@@ -34,9 +49,13 @@ export * from './Radio';
|
|
|
34
49
|
export * from './RadioGroup';
|
|
35
50
|
export * from './Rate';
|
|
36
51
|
export * from './RichText';
|
|
52
|
+
export * from './Row';
|
|
53
|
+
export * from './Scrollbar';
|
|
37
54
|
export * from './Select';
|
|
38
55
|
export * from './Slider';
|
|
56
|
+
export * from './Space';
|
|
39
57
|
export * from './Statistic';
|
|
58
|
+
export * from './Submenu';
|
|
40
59
|
export * from './Switch';
|
|
41
60
|
export * from './Tab';
|
|
42
61
|
export * from './Table';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
import { IconName } from '../components/Icon/types';
|
|
3
|
+
export type BreadcrumbSize = 'sm' | 'md';
|
|
4
|
+
/** What `WxBreadcrumb` hands down to the items inside it. */
|
|
5
|
+
export interface BreadcrumbContext {
|
|
6
|
+
/** The character drawn between items. */
|
|
7
|
+
separator: ComputedRef<string>;
|
|
8
|
+
/** An icon drawn instead of that character. */
|
|
9
|
+
separatorIcon: ComputedRef<IconName | undefined>;
|
|
10
|
+
size: ComputedRef<BreadcrumbSize>;
|
|
11
|
+
}
|
|
12
|
+
export declare const breadcrumbKey: InjectionKey<BreadcrumbContext>;
|
|
13
|
+
export declare function useBreadcrumb(): BreadcrumbContext | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
export type MenuMode = 'vertical' | 'horizontal';
|
|
3
|
+
export type MenuSize = 'sm' | 'md';
|
|
4
|
+
/** What identifies an entry: whatever you would put in a route table. */
|
|
5
|
+
export type MenuValue = string | number;
|
|
6
|
+
/** What `WxMenu` hands down to everything inside it. */
|
|
7
|
+
export interface MenuContext {
|
|
8
|
+
mode: ComputedRef<MenuMode>;
|
|
9
|
+
size: ComputedRef<MenuSize>;
|
|
10
|
+
/** The icon rail: labels hidden, submenus opening as flyouts. */
|
|
11
|
+
collapsed: ComputedRef<boolean>;
|
|
12
|
+
/** The entry that is currently selected. */
|
|
13
|
+
active: ComputedRef<MenuValue | undefined>;
|
|
14
|
+
/** The submenus the active entry sits in, outermost first. */
|
|
15
|
+
trail: ComputedRef<MenuValue[]>;
|
|
16
|
+
select: (value: MenuValue, event: MouseEvent) => void;
|
|
17
|
+
isOpen: (value: MenuValue) => boolean;
|
|
18
|
+
setOpen: (value: MenuValue, open: boolean, ancestors: MenuValue[]) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Bumped when every open flyout should close — an entry inside one was chosen.
|
|
21
|
+
* A panel cannot close on any click of its own: the branches inside it are opened
|
|
22
|
+
* by clicking too, and that would shut the panel before they could unfold.
|
|
23
|
+
*/
|
|
24
|
+
closeSignal: ComputedRef<number>;
|
|
25
|
+
closeFlyouts: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* An entry says where it sits so a submenu can tell it holds the active one —
|
|
28
|
+
* the highlight on a collapsed branch, and what `autoExpand` follows.
|
|
29
|
+
*/
|
|
30
|
+
register: (value: MenuValue, ancestors: MenuValue[]) => void;
|
|
31
|
+
unregister: (value: MenuValue) => void;
|
|
32
|
+
}
|
|
33
|
+
/** What a `WxSubmenu` hands down to the entries it holds. */
|
|
34
|
+
export interface SubmenuContext {
|
|
35
|
+
/** The submenus above this one, outermost first, including itself. */
|
|
36
|
+
ancestors: MenuValue[];
|
|
37
|
+
/** How deep the entries below sit — what the indent is counted from. */
|
|
38
|
+
depth: number;
|
|
39
|
+
/**
|
|
40
|
+
* Whether these entries are already inside a flyout panel. A panel is a fresh
|
|
41
|
+
* surface: the depth restarts at its edge, and the branches in it open inline
|
|
42
|
+
* rather than throwing a second panel beside the first.
|
|
43
|
+
*/
|
|
44
|
+
inFlyout: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const menuKey: InjectionKey<MenuContext>;
|
|
47
|
+
export declare const submenuKey: InjectionKey<SubmenuContext>;
|
|
48
|
+
export declare function useMenu(): MenuContext | null;
|
|
49
|
+
export declare function useSubmenu(): SubmenuContext;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pieces `WxDialog` and `WxDrawer` have in common: both take a size in pixels or
|
|
3
|
+
* per cent, both can be dragged to a new one, and both can be told to remember it.
|
|
4
|
+
*/
|
|
5
|
+
/** A number is pixels, however it arrives — `width="520"` in a template is a string. */
|
|
6
|
+
export declare function cssLength(value: number | string | undefined): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* The pixels behind a size prop, when there are any — `'60%'` has none, and a gesture
|
|
9
|
+
* that starts on such a panel has to measure it instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function pixelLength(value: number | string | undefined): number | undefined;
|
|
12
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
13
|
+
export interface PanelMemory<T> {
|
|
14
|
+
read: () => Partial<T> | null;
|
|
15
|
+
write: (value: T) => void;
|
|
16
|
+
clear: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `localStorage`, with every way it can fail treated the same way: remembering a panel's
|
|
20
|
+
* size is a convenience, and a private window or a full quota only costs the default.
|
|
21
|
+
*/
|
|
22
|
+
export declare function usePanelMemory<T>(prefix: string, key: () => string | undefined): PanelMemory<T>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
/** What shape the navigation takes at the width it has been given. */
|
|
3
|
+
export type ShellLayout = 'sidebar' | 'rail' | 'drawer';
|
|
4
|
+
export interface ResponsiveShellOptions {
|
|
5
|
+
/** Under this width the menu leaves the page for a drawer behind a burger. */
|
|
6
|
+
phone?: number;
|
|
7
|
+
/** Under this width the sidebar starts as an icon rail. */
|
|
8
|
+
tablet?: number;
|
|
9
|
+
/** Whether it starts as a rail on a screen wide enough for the full sidebar. */
|
|
10
|
+
collapsed?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Remembers a sidebar that was closed by hand, under this key in `localStorage`.
|
|
13
|
+
* Only the closing is kept: a sidebar left open goes back to following the width,
|
|
14
|
+
* so a desktop opens it and a tablet still starts with the rail.
|
|
15
|
+
*/
|
|
16
|
+
persist?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ResponsiveShell {
|
|
19
|
+
/** Width of what is being measured, in pixels. `0` until it has been measured. */
|
|
20
|
+
width: Ref<number>;
|
|
21
|
+
layout: ComputedRef<ShellLayout>;
|
|
22
|
+
/** Hand this to `WxAside` and `WxMenu` — true for both the rail and the drawer. */
|
|
23
|
+
collapsed: ComputedRef<boolean>;
|
|
24
|
+
/** Whether there is room for a sidebar at all. False on a phone. */
|
|
25
|
+
showAside: ComputedRef<boolean>;
|
|
26
|
+
drawerOpen: Ref<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* What the one button in the header does: it collapses and expands the sidebar
|
|
29
|
+
* while the sidebar is on the page, and opens the drawer once the menu is gone.
|
|
30
|
+
* The icon follows `layout` — a burger belongs to the drawer alone.
|
|
31
|
+
*/
|
|
32
|
+
toggle: () => void;
|
|
33
|
+
close: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The rule on its own, so it can be read — and tested — without a browser.
|
|
37
|
+
*
|
|
38
|
+
* `collapsed` is the answer to "is the sidebar a rail", and `null` leaves it to the
|
|
39
|
+
* width: a rail from the tablet breakpoint down. Only the phone breakpoint is
|
|
40
|
+
* absolute, because a menu that has nowhere to stand has to leave the page.
|
|
41
|
+
*
|
|
42
|
+
* A width of `0` means nothing has been measured yet: on the server, and on the very
|
|
43
|
+
* first render. The widest shape is the right guess there, since it is the one a
|
|
44
|
+
* desktop gets, and the measurement that follows corrects it before paint.
|
|
45
|
+
*/
|
|
46
|
+
export declare function shellLayoutFor(width: number, collapsed: boolean | null, options?: ResponsiveShellOptions): ShellLayout;
|
|
47
|
+
/**
|
|
48
|
+
* Drives the three shapes an admin sidebar takes — full, icon rail, drawer — from
|
|
49
|
+
* the width of the shell rather than from the viewport's. The two are the same
|
|
50
|
+
* thing on a real page, and they are not inside a preview, a split screen or the
|
|
51
|
+
* demo box on this page, which is the case that catches a viewport media query out.
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* const shell = useResponsiveShell(shellRef)
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* Pass nothing to measure the page itself.
|
|
58
|
+
*/
|
|
59
|
+
export declare function useResponsiveShell(target?: Ref<HTMLElement | null | undefined>, options?: ResponsiveShellOptions): ResponsiveShell;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
export { WebxUI, type WebxUiOptions } from './plugin';
|
|
3
3
|
export type { ControlSize, ControlStatus, ValidationErrors } from './composables/useFormField';
|
|
4
|
+
export { useResponsiveShell, shellLayoutFor, type ResponsiveShell, type ResponsiveShellOptions, type ShellLayout, } from './composables/useResponsiveShell';
|