@bysages/solid 0.4.2 → 0.4.4
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/avatar/index.d.mts +16 -4
- package/dist/components/avatar/index.mjs +60 -3
- package/dist/components/banner/index.d.mts +17 -1
- package/dist/components/banner/index.mjs +78 -2
- package/dist/components/breadcrumb/index.d.mts +14 -1
- package/dist/components/breadcrumb/index.mjs +51 -2
- package/dist/components/color-picker/index.d.mts +4 -0
- package/dist/components/color-picker/index.mjs +65 -31
- package/dist/components/float-button/index.d.mts +24 -1
- package/dist/components/float-button/index.mjs +73 -2
- package/dist/components/tag/index.mjs +39 -26
- package/dist/components/user/index.mjs +8 -2
- package/dist/generative/index.d.mts +47 -0
- package/dist/generative/index.mjs +959 -0
- package/dist/index.d.mts +5 -5
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps } from "solid-js";
|
|
1
|
+
import { ComponentProps, JSX } from "solid-js";
|
|
2
2
|
import { Avatar as Avatar$1 } from "@ark-ui/solid/avatar";
|
|
3
3
|
//#region src/components/avatar/index.d.ts
|
|
4
4
|
/** Avatar, dressed in the paper-and-ink system: a circular seal on
|
|
@@ -9,15 +9,27 @@ import { Avatar as Avatar$1 } from "@ark-ui/solid/avatar";
|
|
|
9
9
|
export type AvatarSize = "sm" | "md" | "lg";
|
|
10
10
|
export interface AvatarProps extends ComponentProps<typeof Avatar$1.Root> {
|
|
11
11
|
/** Seal diameter: the small, medium, or large control rung. The
|
|
12
|
-
* default (
|
|
12
|
+
* default (medium) stands as tall as the biggest control so an avatar
|
|
13
13
|
* rides a row without stretching it. */
|
|
14
14
|
size?: AvatarSize;
|
|
15
15
|
/** The corner: round by default; square cuts it sharp, a stamp
|
|
16
16
|
* beside a round portrait. */
|
|
17
17
|
shape?: "circle" | "square";
|
|
18
18
|
}
|
|
19
|
-
declare function AvatarRoot(props: AvatarProps):
|
|
20
|
-
export
|
|
19
|
+
declare function AvatarRoot(props: AvatarProps): JSX.Element;
|
|
20
|
+
export interface AvatarFacadeProps extends Omit<AvatarProps, "children" | "shape" | "size"> {
|
|
21
|
+
/** The person's name — the fallback initials and image description. */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** The portrait source, loaded above the initials fallback. */
|
|
24
|
+
src?: string;
|
|
25
|
+
size?: AvatarSize;
|
|
26
|
+
shape?: "circle" | "square";
|
|
27
|
+
children?: JSX.Element;
|
|
28
|
+
}
|
|
29
|
+
/** The shorthand: a complete avatar from a name and image, with the
|
|
30
|
+
* anatomy still there when a consumer needs to compose its own. */
|
|
31
|
+
declare function AvatarFacade(props: AvatarFacadeProps): JSX.Element;
|
|
32
|
+
export declare const Avatar: typeof AvatarFacade & Omit<typeof Avatar$1, "Root"> & {
|
|
21
33
|
Root: typeof AvatarRoot;
|
|
22
34
|
};
|
|
23
35
|
//#endregion
|
|
@@ -2,7 +2,7 @@ import { t as defineFamily } from "../../family-Cmd8HEyK.mjs";
|
|
|
2
2
|
import { t as useElementId } from "../../id-2ygNzPHF.mjs";
|
|
3
3
|
import { createComponent, mergeProps } from "@solidjs/web";
|
|
4
4
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
|
-
import { splitProps } from "solid-js";
|
|
5
|
+
import { Show, splitProps } from "solid-js";
|
|
6
6
|
import { Avatar as Avatar$1 } from "@ark-ui/solid/avatar";
|
|
7
7
|
//#region src/components/avatar/index.tsx
|
|
8
8
|
function AvatarRoot(props) {
|
|
@@ -13,14 +13,71 @@ function AvatarRoot(props) {
|
|
|
13
13
|
return id();
|
|
14
14
|
},
|
|
15
15
|
get "data-size"() {
|
|
16
|
-
return own.size;
|
|
16
|
+
return own.size ?? "md";
|
|
17
17
|
},
|
|
18
18
|
get "data-shape"() {
|
|
19
19
|
return own.shape ?? "circle";
|
|
20
20
|
}
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
function initials(name) {
|
|
24
|
+
return name?.trim().split(/\s+/).slice(0, 2).map((word) => word.charAt(0).toUpperCase()).join("") ?? "";
|
|
25
|
+
}
|
|
26
|
+
/** The shorthand: a complete avatar from a name and image, with the
|
|
27
|
+
* anatomy still there when a consumer needs to compose its own. */
|
|
28
|
+
function AvatarFacade(props) {
|
|
29
|
+
const [own, rest] = splitProps(props, [
|
|
30
|
+
"name",
|
|
31
|
+
"shape",
|
|
32
|
+
"size",
|
|
33
|
+
"src"
|
|
34
|
+
]);
|
|
35
|
+
return createComponent(AvatarRoot, mergeProps(rest, {
|
|
36
|
+
get shape() {
|
|
37
|
+
return own.shape ?? "circle";
|
|
38
|
+
},
|
|
39
|
+
get size() {
|
|
40
|
+
return own.size ?? "md";
|
|
41
|
+
},
|
|
42
|
+
get children() {
|
|
43
|
+
return createComponent(Show, {
|
|
44
|
+
get when() {
|
|
45
|
+
return props.children;
|
|
46
|
+
},
|
|
47
|
+
get fallback() {
|
|
48
|
+
return [createComponent(Show, {
|
|
49
|
+
get when() {
|
|
50
|
+
return own.src;
|
|
51
|
+
},
|
|
52
|
+
get children() {
|
|
53
|
+
return createComponent(Avatar$1.Image, {
|
|
54
|
+
get alt() {
|
|
55
|
+
return own.name;
|
|
56
|
+
},
|
|
57
|
+
get src() {
|
|
58
|
+
return own.src;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}), createComponent(Show, {
|
|
63
|
+
get when() {
|
|
64
|
+
return own.name;
|
|
65
|
+
},
|
|
66
|
+
get children() {
|
|
67
|
+
return createComponent(Avatar$1.Fallback, { get children() {
|
|
68
|
+
return initials(own.name);
|
|
69
|
+
} });
|
|
70
|
+
}
|
|
71
|
+
})];
|
|
72
|
+
},
|
|
73
|
+
get children() {
|
|
74
|
+
return props.children;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
const Avatar = defineFamily(AvatarFacade, {
|
|
24
81
|
...Avatar$1,
|
|
25
82
|
Root: AvatarRoot
|
|
26
83
|
});
|
|
@@ -12,7 +12,23 @@ declare function Root(props: BannerRootProps): JSX.Element;
|
|
|
12
12
|
/** The quiet close: a plain square-cut button; dismissal stays the
|
|
13
13
|
* consumer's state. */
|
|
14
14
|
declare function Close(props: JSX.ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
|
|
15
|
-
export
|
|
15
|
+
export interface BannerFacadeProps extends Omit<BannerRootProps, "status" | "title"> {
|
|
16
|
+
/** The status pigment; ink is the neutral register. */
|
|
17
|
+
status?: BannerStatus;
|
|
18
|
+
/** What the notice says at a glance. */
|
|
19
|
+
title?: string;
|
|
20
|
+
/** The supporting line, in the quiet register. */
|
|
21
|
+
message?: string;
|
|
22
|
+
/** Give the reader a way to fold the notice. */
|
|
23
|
+
dismissible?: boolean;
|
|
24
|
+
/** Where the reader answers — a row of buttons. */
|
|
25
|
+
actions?: JSX.Element;
|
|
26
|
+
children?: JSX.Element;
|
|
27
|
+
}
|
|
28
|
+
/** The shorthand: a complete notice from text, with actions and the
|
|
29
|
+
* close folded away until asked for. Once closed, it stays closed. */
|
|
30
|
+
declare function BannerFacade(props: BannerFacadeProps): JSX.Element;
|
|
31
|
+
export declare const Banner: typeof BannerFacade & {
|
|
16
32
|
Root: typeof Root;
|
|
17
33
|
Icon: (props: JSX.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
18
34
|
Body: (props: JSX.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { r as iconNode } from "../../icon-DTqmJCd5.mjs";
|
|
|
2
2
|
import { n as useComponentMessages } from "../../use-component-messages-C4SCVYjD.mjs";
|
|
3
3
|
import { createComponent, insert, mergeProps, spread, template } from "@solidjs/web";
|
|
4
4
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
|
-
import { splitProps } from "solid-js";
|
|
5
|
+
import { Show, createSignal, splitProps } from "solid-js";
|
|
6
6
|
//#region src/components/banner/index.tsx
|
|
7
7
|
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
8
8
|
var _tmpl$2 = /* @__PURE__ */ template(`<button>`);
|
|
@@ -59,7 +59,83 @@ function Close(props) {
|
|
|
59
59
|
});
|
|
60
60
|
return _el$2;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
/** The shorthand: a complete notice from text, with actions and the
|
|
63
|
+
* close folded away until asked for. Once closed, it stays closed. */
|
|
64
|
+
function BannerFacade(props) {
|
|
65
|
+
const [own, rest] = splitProps(props, [
|
|
66
|
+
"actions",
|
|
67
|
+
"children",
|
|
68
|
+
"dismissible",
|
|
69
|
+
"message",
|
|
70
|
+
"status",
|
|
71
|
+
"title"
|
|
72
|
+
]);
|
|
73
|
+
const [visible, setVisible] = createSignal(true);
|
|
74
|
+
return createComponent(Show, {
|
|
75
|
+
get when() {
|
|
76
|
+
return visible();
|
|
77
|
+
},
|
|
78
|
+
get children() {
|
|
79
|
+
return createComponent(Root, mergeProps(rest, {
|
|
80
|
+
get status() {
|
|
81
|
+
return own.status;
|
|
82
|
+
},
|
|
83
|
+
get children() {
|
|
84
|
+
return [createComponent(Body, { get children() {
|
|
85
|
+
return [
|
|
86
|
+
createComponent(Show, {
|
|
87
|
+
get when() {
|
|
88
|
+
return own.title;
|
|
89
|
+
},
|
|
90
|
+
get children() {
|
|
91
|
+
return createComponent(Title, { get children() {
|
|
92
|
+
return own.title;
|
|
93
|
+
} });
|
|
94
|
+
}
|
|
95
|
+
}),
|
|
96
|
+
createComponent(Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return own.message;
|
|
99
|
+
},
|
|
100
|
+
get children() {
|
|
101
|
+
return createComponent(Description, { get children() {
|
|
102
|
+
return own.message;
|
|
103
|
+
} });
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
createComponent(Show, {
|
|
107
|
+
get when() {
|
|
108
|
+
return own.children;
|
|
109
|
+
},
|
|
110
|
+
get children() {
|
|
111
|
+
return own.children;
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
createComponent(Show, {
|
|
115
|
+
get when() {
|
|
116
|
+
return own.actions;
|
|
117
|
+
},
|
|
118
|
+
get children() {
|
|
119
|
+
return createComponent(Actions, { get children() {
|
|
120
|
+
return own.actions;
|
|
121
|
+
} });
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
];
|
|
125
|
+
} }), createComponent(Show, {
|
|
126
|
+
get when() {
|
|
127
|
+
return own.dismissible;
|
|
128
|
+
},
|
|
129
|
+
get children() {
|
|
130
|
+
return createComponent(Close, { onClick: () => setVisible(false) });
|
|
131
|
+
}
|
|
132
|
+
})];
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const Banner = Object.assign(BannerFacade, {
|
|
63
139
|
Root,
|
|
64
140
|
Icon,
|
|
65
141
|
Body,
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { Component, JSX } from "solid-js";
|
|
2
2
|
//#region src/components/breadcrumb/index.d.ts
|
|
3
|
-
export
|
|
3
|
+
export type BreadcrumbItem = string | {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
};
|
|
7
|
+
export interface BreadcrumbFacadeProps extends Omit<JSX.HTMLAttributes<HTMLElement>, "children"> {
|
|
8
|
+
/** The waymarks, in walking order. */
|
|
9
|
+
items: BreadcrumbItem[];
|
|
10
|
+
/** The trail's name, when the default is not enough. */
|
|
11
|
+
label?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The shorthand: the whole trail from plain labels and destinations,
|
|
14
|
+
* with the last waymark set down as the current page. */
|
|
15
|
+
declare function BreadcrumbFacade(props: BreadcrumbFacadeProps): JSX.Element;
|
|
16
|
+
export declare const Breadcrumb: typeof BreadcrumbFacade & {
|
|
4
17
|
Root: Component<Record<string, unknown>>;
|
|
5
18
|
List: Component<Record<string, unknown>>;
|
|
6
19
|
Item: Component<Record<string, unknown>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as useComponentMessages } from "../../use-component-messages-C4SCVYjD.mjs";
|
|
2
2
|
import { createComponent, mergeProps, spread, template } from "@solidjs/web";
|
|
3
3
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
4
|
-
import { mergeProps as mergeProps$1 } from "solid-js";
|
|
4
|
+
import { For, Show, mergeProps as mergeProps$1, splitProps } from "solid-js";
|
|
5
5
|
//#region src/components/breadcrumb/index.tsx
|
|
6
6
|
var _tmpl$ = /* @__PURE__ */ template(`<span>`);
|
|
7
7
|
function part(name, tag, extra = {}) {
|
|
@@ -32,7 +32,56 @@ const Separator = (props) => (() => {
|
|
|
32
32
|
}], false);
|
|
33
33
|
return _el$;
|
|
34
34
|
})();
|
|
35
|
-
|
|
35
|
+
/** The shorthand: the whole trail from plain labels and destinations,
|
|
36
|
+
* with the last waymark set down as the current page. */
|
|
37
|
+
function BreadcrumbFacade(props) {
|
|
38
|
+
const [own, rest] = splitProps(props, ["items", "label"]);
|
|
39
|
+
return createComponent(Root, mergeProps(rest, () => {
|
|
40
|
+
return own.label ? { "aria-label": own.label } : {};
|
|
41
|
+
}, { get children() {
|
|
42
|
+
return createComponent(List, { get children() {
|
|
43
|
+
return createComponent(For, {
|
|
44
|
+
get each() {
|
|
45
|
+
return own.items;
|
|
46
|
+
},
|
|
47
|
+
children: (item, index) => {
|
|
48
|
+
const entry = typeof item === "string" ? { label: item } : item;
|
|
49
|
+
const current = () => index() === own.items.length - 1;
|
|
50
|
+
return [createComponent(Item, { get children() {
|
|
51
|
+
return createComponent(Show, {
|
|
52
|
+
get when() {
|
|
53
|
+
return !current();
|
|
54
|
+
},
|
|
55
|
+
get fallback() {
|
|
56
|
+
return createComponent(Current, { get children() {
|
|
57
|
+
return entry.label;
|
|
58
|
+
} });
|
|
59
|
+
},
|
|
60
|
+
get children() {
|
|
61
|
+
return createComponent(Link, {
|
|
62
|
+
get href() {
|
|
63
|
+
return entry.href;
|
|
64
|
+
},
|
|
65
|
+
get children() {
|
|
66
|
+
return entry.label;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
} }), createComponent(Show, {
|
|
72
|
+
get when() {
|
|
73
|
+
return !current();
|
|
74
|
+
},
|
|
75
|
+
get children() {
|
|
76
|
+
return createComponent(Separator, {});
|
|
77
|
+
}
|
|
78
|
+
})];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
} });
|
|
82
|
+
} }));
|
|
83
|
+
}
|
|
84
|
+
const Breadcrumb = Object.assign(BreadcrumbFacade, {
|
|
36
85
|
Root,
|
|
37
86
|
List,
|
|
38
87
|
Item,
|
|
@@ -12,6 +12,8 @@ import { Color, ColorPicker as ColorPicker$1, ColorPickerRootProps } from "@ark-
|
|
|
12
12
|
type ColorPickerOwnProps = {
|
|
13
13
|
/** One rung of the control-height ladder for the swatch seal. */
|
|
14
14
|
size?: "sm" | "md" | "lg";
|
|
15
|
+
/** Saved colors rendered as a flat swatch row. */
|
|
16
|
+
swatches?: string[];
|
|
15
17
|
};
|
|
16
18
|
declare function ColorPickerRoot(props: ColorPickerRootProps & ColorPickerOwnProps): import("solid-js").JSX.Element;
|
|
17
19
|
type ColorPickerFacadeProps = Omit<ComponentProps<typeof ColorPickerRoot>, "children" | "defaultValue" | "disabled" | "invalid" | "label" | "onValueChange" | "required" | "value"> & {
|
|
@@ -21,6 +23,8 @@ type ColorPickerFacadeProps = Omit<ComponentProps<typeof ColorPickerRoot>, "chil
|
|
|
21
23
|
invalid?: boolean;
|
|
22
24
|
required?: boolean;
|
|
23
25
|
label?: string;
|
|
26
|
+
/** Saved colors rendered as a flat swatch row. */
|
|
27
|
+
swatches?: string[];
|
|
24
28
|
onValueChange?: (value: unknown) => void;
|
|
25
29
|
};
|
|
26
30
|
declare function ColorPickerFacade(props: ColorPickerFacadeProps): import("solid-js").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { r as iconNode } from "../../icon-DTqmJCd5.mjs";
|
|
|
3
3
|
import { t as useElementId } from "../../id-2ygNzPHF.mjs";
|
|
4
4
|
import { createComponent, insert, mergeProps, template } from "@solidjs/web";
|
|
5
5
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
6
|
-
import { Show, splitProps } from "solid-js";
|
|
6
|
+
import { For, Show, splitProps } from "solid-js";
|
|
7
7
|
import { ColorPicker as ColorPicker$1, parseColor } from "@ark-ui/solid/color-picker";
|
|
8
8
|
//#region src/components/color-picker/index.tsx
|
|
9
9
|
var _tmpl$ = /* @__PURE__ */ template(`<div data-scope=color-picker data-part=channel-controls><div data-scope=color-picker data-part=channel-sliders><!><!>`);
|
|
@@ -21,8 +21,9 @@ function ColorPickerRoot(props) {
|
|
|
21
21
|
}
|
|
22
22
|
function ColorPickerFacade(props) {
|
|
23
23
|
injectComponentStyle("color-picker");
|
|
24
|
+
const [own, rootProps] = splitProps(props, ["size", "swatches"]);
|
|
24
25
|
const toColor = (color) => typeof color === "string" ? parseColor(color) : color;
|
|
25
|
-
return createComponent(ColorPickerRoot, mergeProps(
|
|
26
|
+
return createComponent(ColorPickerRoot, mergeProps(rootProps, {
|
|
26
27
|
get value() {
|
|
27
28
|
return toColor(props.value);
|
|
28
29
|
},
|
|
@@ -58,37 +59,70 @@ function ColorPickerFacade(props) {
|
|
|
58
59
|
} }),
|
|
59
60
|
createComponent(ColorPicker$1.Positioner, { get children() {
|
|
60
61
|
return createComponent(ColorPicker$1.Content, { get children() {
|
|
61
|
-
return [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
return [
|
|
63
|
+
createComponent(ColorPicker$1.Area, { get children() {
|
|
64
|
+
return [createComponent(ColorPicker$1.AreaBackground, {}), createComponent(ColorPicker$1.AreaThumb, {})];
|
|
65
|
+
} }),
|
|
66
|
+
(() => {
|
|
67
|
+
var _el$ = _tmpl$();
|
|
68
|
+
var _el$2 = _el$.firstChild;
|
|
69
|
+
var _el$3 = _el$2.firstChild;
|
|
70
|
+
var _el$4 = _el$3.nextSibling;
|
|
71
|
+
insert(_el$, createComponent(ColorPicker$1.EyeDropperTrigger, { get children() {
|
|
72
|
+
return iconNode("pipette", {
|
|
73
|
+
width: 14,
|
|
74
|
+
height: 14
|
|
75
|
+
});
|
|
76
|
+
} }), _el$2);
|
|
77
|
+
insert(_el$2, createComponent(ColorPicker$1.ChannelSlider, {
|
|
78
|
+
channel: "hue",
|
|
79
|
+
get children() {
|
|
80
|
+
return [createComponent(ColorPicker$1.ChannelSliderTrack, {}), createComponent(ColorPicker$1.ChannelSliderThumb, {})];
|
|
81
|
+
}
|
|
82
|
+
}), _el$3);
|
|
83
|
+
insert(_el$2, createComponent(ColorPicker$1.ChannelSlider, {
|
|
84
|
+
channel: "alpha",
|
|
85
|
+
get children() {
|
|
86
|
+
return [
|
|
87
|
+
createComponent(ColorPicker$1.TransparencyGrid, {}),
|
|
88
|
+
createComponent(ColorPicker$1.ChannelSliderTrack, {}),
|
|
89
|
+
createComponent(ColorPicker$1.ChannelSliderThumb, {})
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
}), _el$4);
|
|
93
|
+
return _el$;
|
|
94
|
+
})(),
|
|
95
|
+
createComponent(Show, {
|
|
96
|
+
get when() {
|
|
97
|
+
return (own.swatches ?? []).length > 0;
|
|
98
|
+
},
|
|
76
99
|
get children() {
|
|
77
|
-
return
|
|
100
|
+
return createComponent(ColorPicker$1.SwatchGroup, { get children() {
|
|
101
|
+
return createComponent(For, {
|
|
102
|
+
get each() {
|
|
103
|
+
return own.swatches;
|
|
104
|
+
},
|
|
105
|
+
children: (color) => createComponent(ColorPicker$1.SwatchTrigger, {
|
|
106
|
+
value: color,
|
|
107
|
+
get children() {
|
|
108
|
+
return createComponent(ColorPicker$1.Swatch, {
|
|
109
|
+
value: color,
|
|
110
|
+
get children() {
|
|
111
|
+
return createComponent(ColorPicker$1.SwatchIndicator, { get children() {
|
|
112
|
+
return iconNode("check", {
|
|
113
|
+
width: "12",
|
|
114
|
+
height: "12"
|
|
115
|
+
});
|
|
116
|
+
} });
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
} });
|
|
78
123
|
}
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
channel: "alpha",
|
|
82
|
-
get children() {
|
|
83
|
-
return [
|
|
84
|
-
createComponent(ColorPicker$1.TransparencyGrid, {}),
|
|
85
|
-
createComponent(ColorPicker$1.ChannelSliderTrack, {}),
|
|
86
|
-
createComponent(ColorPicker$1.ChannelSliderThumb, {})
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
}), _el$4);
|
|
90
|
-
return _el$;
|
|
91
|
-
})()];
|
|
124
|
+
})
|
|
125
|
+
];
|
|
92
126
|
} });
|
|
93
127
|
} }),
|
|
94
128
|
createComponent(ColorPicker$1.HiddenInput, {})
|
|
@@ -53,7 +53,30 @@ export interface FloatButtonItemProps extends Omit<JSX.HTMLAttributes<HTMLDivEle
|
|
|
53
53
|
onClick?: (event: MouseEvent) => void;
|
|
54
54
|
}
|
|
55
55
|
declare function FloatButtonItem(props: FloatButtonItemProps): JSX.Element;
|
|
56
|
-
export
|
|
56
|
+
export interface FloatButtonAction {
|
|
57
|
+
label: string;
|
|
58
|
+
/** A curated core icon; pencil is the fallback mark. */
|
|
59
|
+
icon?: string;
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
/** The action fires before the fan folds. */
|
|
62
|
+
onClick?: () => void;
|
|
63
|
+
}
|
|
64
|
+
export interface FloatButtonFacadeProps extends Omit<FloatButtonRootProps, "open"> {
|
|
65
|
+
/** Controlled openness; leave unset for the facade to hold it. */
|
|
66
|
+
open?: boolean;
|
|
67
|
+
/** The accessible name for the floating trigger. */
|
|
68
|
+
label?: string;
|
|
69
|
+
/** The fanned-out actions, in reading order. */
|
|
70
|
+
actions?: FloatButtonAction[];
|
|
71
|
+
placement?: FloatButtonPlacement;
|
|
72
|
+
size?: FloatButtonSize;
|
|
73
|
+
/** Open the dial when it mounts. */
|
|
74
|
+
defaultOpen?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** The shorthand: a speed dial from plain actions; the trigger and
|
|
77
|
+
* openness stay inside the family. */
|
|
78
|
+
declare function FloatButtonFacade(props: FloatButtonFacadeProps): JSX.Element;
|
|
79
|
+
export declare const FloatButton: typeof FloatButtonFacade & {
|
|
57
80
|
Root: typeof FloatButtonRoot;
|
|
58
81
|
Trigger: typeof FloatButtonTrigger;
|
|
59
82
|
Item: typeof FloatButtonItem;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { r as iconNode } from "../../icon-DTqmJCd5.mjs";
|
|
1
2
|
import { Button } from "../button/index.mjs";
|
|
2
3
|
import { n as useComponentMessages } from "../../use-component-messages-C4SCVYjD.mjs";
|
|
3
4
|
import { createComponent, insert, mergeProps, spread, template } from "@solidjs/web";
|
|
4
5
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
|
-
import { createContext, createSignal, splitProps, useContext } from "solid-js";
|
|
6
|
+
import { For, Show, createContext, createSignal, splitProps, useContext } from "solid-js";
|
|
6
7
|
//#region src/components/float-button/index.tsx
|
|
7
8
|
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
8
9
|
var _tmpl$2 = /* @__PURE__ */ template(`<div><span data-scope=float-button data-part=item-label aria-hidden=true>`);
|
|
@@ -121,7 +122,77 @@ function FloatButtonItem(props) {
|
|
|
121
122
|
});
|
|
122
123
|
return _el$2;
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
/** The shorthand: a speed dial from plain actions; the trigger and
|
|
126
|
+
* openness stay inside the family. */
|
|
127
|
+
function FloatButtonFacade(props) {
|
|
128
|
+
const [own, rest] = splitProps(props, [
|
|
129
|
+
"actions",
|
|
130
|
+
"children",
|
|
131
|
+
"defaultOpen",
|
|
132
|
+
"label",
|
|
133
|
+
"onOpenChange",
|
|
134
|
+
"open",
|
|
135
|
+
"placement",
|
|
136
|
+
"size"
|
|
137
|
+
]);
|
|
138
|
+
const [inner, setInner] = createSignal(own.defaultOpen ?? false);
|
|
139
|
+
const open = () => own.open ?? inner();
|
|
140
|
+
const setOpen = (value) => {
|
|
141
|
+
setInner(value);
|
|
142
|
+
own.onOpenChange?.(value);
|
|
143
|
+
};
|
|
144
|
+
return createComponent(FloatButtonRoot, mergeProps(rest, {
|
|
145
|
+
onOpenChange: setOpen,
|
|
146
|
+
get open() {
|
|
147
|
+
return open();
|
|
148
|
+
},
|
|
149
|
+
get placement() {
|
|
150
|
+
return own.placement;
|
|
151
|
+
},
|
|
152
|
+
get size() {
|
|
153
|
+
return own.size;
|
|
154
|
+
},
|
|
155
|
+
get children() {
|
|
156
|
+
return createComponent(Show, {
|
|
157
|
+
get when() {
|
|
158
|
+
return own.children;
|
|
159
|
+
},
|
|
160
|
+
get fallback() {
|
|
161
|
+
return [createComponent(FloatButtonTrigger, {
|
|
162
|
+
get label() {
|
|
163
|
+
return own.label;
|
|
164
|
+
},
|
|
165
|
+
get children() {
|
|
166
|
+
return iconNode("plus");
|
|
167
|
+
}
|
|
168
|
+
}), createComponent(For, {
|
|
169
|
+
get each() {
|
|
170
|
+
return own.actions ?? [];
|
|
171
|
+
},
|
|
172
|
+
children: (action) => createComponent(FloatButtonItem, {
|
|
173
|
+
get disabled() {
|
|
174
|
+
return action.disabled;
|
|
175
|
+
},
|
|
176
|
+
get label() {
|
|
177
|
+
return action.label;
|
|
178
|
+
},
|
|
179
|
+
get onClick() {
|
|
180
|
+
return action.onClick;
|
|
181
|
+
},
|
|
182
|
+
get children() {
|
|
183
|
+
return iconNode(action.icon ?? "pencil");
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
})];
|
|
187
|
+
},
|
|
188
|
+
get children() {
|
|
189
|
+
return own.children;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
const FloatButton = Object.assign(FloatButtonFacade, {
|
|
125
196
|
Root: FloatButtonRoot,
|
|
126
197
|
Trigger: FloatButtonTrigger,
|
|
127
198
|
Item: FloatButtonItem
|