@ctrl-ui/react 0.8.20 → 0.9.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/README.md +1 -0
- package/dist/action-bar.d.ts +1 -2
- package/dist/action-bar.js +7 -8
- package/dist/blocks/design-canvas-inspector.js +4 -1
- package/dist/blocks/file-explorer.js +1 -1
- package/dist/chat-message.js +4 -13
- package/dist/hooks/use-textarea-trigger-menu.d.ts +21 -3
- package/dist/hooks/use-textarea-trigger-menu.js +36 -40
- package/dist/hooks/use-user-ask.d.ts +1 -0
- package/dist/hooks/use-user-ask.js +5 -1
- package/dist/knob-contracts/audio-recorder-knobs.d.ts +1 -1
- package/dist/knob-contracts/audio-recorder-knobs.js +2 -1
- package/dist/knob-contracts/chart-knobs.d.ts +4 -0
- package/dist/knob-contracts/chart-knobs.js +24 -0
- package/dist/knob-contracts/choice-knobs.d.ts +1 -1
- package/dist/knob-contracts/choice-knobs.js +1 -0
- package/dist/knob-contracts/dockable-panel-knobs.d.ts +1 -1
- package/dist/knob-contracts/dockable-panel-knobs.js +2 -1
- package/dist/knob-contracts/emoji-picker-knobs.d.ts +1 -1
- package/dist/knob-contracts/emoji-picker-knobs.js +1 -0
- package/dist/knob-contracts/empty-knobs.d.ts +1 -1
- package/dist/knob-contracts/empty-knobs.js +2 -1
- package/dist/knob-contracts/icon-picker-knobs.d.ts +1 -1
- package/dist/knob-contracts/icon-picker-knobs.js +3 -1
- package/dist/knob-contracts/resizable-knobs.d.ts +1 -1
- package/dist/knob-contracts/resizable-knobs.js +2 -2
- package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
- package/dist/knob-contracts/sidebar-knobs.js +3 -1
- package/dist/knob-contracts/tabs-knobs.d.ts +1 -1
- package/dist/knob-contracts/tabs-knobs.js +2 -1
- package/dist/knob-contracts/tree-knobs.d.ts +1 -1
- package/dist/knob-contracts/tree-knobs.js +2 -1
- package/dist/lib/color.d.ts +2 -6
- package/dist/lib/color.js +45 -28
- package/dist/lib/contrast.d.ts +6 -0
- package/dist/lib/contrast.js +33 -1
- package/dist/lib/gradient.d.ts +17 -0
- package/dist/lib/gradient.js +69 -0
- package/dist/markdown-editor/drag-handle.js +73 -10
- package/dist/markdown-editor/drag-preview.d.ts +3 -0
- package/dist/markdown-editor/drag-preview.js +31 -0
- package/dist/markdown-editor/extensions.d.ts +2 -2
- package/dist/markdown-editor/extensions.js +25 -3
- package/dist/markdown-editor/suggestions.js +5 -5
- package/dist/markdown-editor/task-item.d.ts +3 -0
- package/dist/markdown-editor/task-item.js +50 -0
- package/dist/markdown-editor/toolbar.js +122 -63
- package/dist/markdown-editor.js +3 -3
- package/dist/skin.d.ts +0 -1
- package/dist/styles/index.css +3 -2
- package/dist/styles/recipes/action-bar.css +1 -1
- package/dist/styles/recipes/activity.css +1 -1
- package/dist/styles/recipes/alert.css +9 -10
- package/dist/styles/recipes/app-shell-header.css +2 -2
- package/dist/styles/recipes/audio-recorder.css +15 -4
- package/dist/styles/recipes/audio-visualizer.css +4 -4
- package/dist/styles/recipes/avatar.css +3 -3
- package/dist/styles/recipes/badge.css +2 -2
- package/dist/styles/recipes/button.css +2 -5
- package/dist/styles/recipes/card.css +0 -2
- package/dist/styles/recipes/chart.css +378 -0
- package/dist/styles/recipes/chat-composer-attachment.css +3 -3
- package/dist/styles/recipes/chat-composer.css +3 -3
- package/dist/styles/recipes/chat-layout.css +2 -2
- package/dist/styles/recipes/chat-message-social.css +1 -1
- package/dist/styles/recipes/chat-message.css +1 -1
- package/dist/styles/recipes/choice.css +9 -3
- package/dist/styles/recipes/code-diff.css +1 -1
- package/dist/styles/recipes/code.css +1 -1
- package/dist/styles/recipes/color-picker-details.css +17 -11
- package/dist/styles/recipes/color-picker-values.css +17 -7
- package/dist/styles/recipes/color-picker.css +88 -70
- package/dist/styles/recipes/context.css +2 -2
- package/dist/styles/recipes/dockable-panel.css +9 -2
- package/dist/styles/recipes/dynamic-notification-motion.css +1 -55
- package/dist/styles/recipes/dynamic-notification.css +0 -1
- package/dist/styles/recipes/emoji-picker.css +35 -19
- package/dist/styles/recipes/empty.css +19 -14
- package/dist/styles/recipes/field-parts.css +2 -2
- package/dist/styles/recipes/field.css +6 -4
- package/dist/styles/recipes/filter-bar.css +10 -10
- package/dist/styles/recipes/flow.css +5 -3
- package/dist/styles/recipes/gradient-editor.css +8 -0
- package/dist/styles/recipes/icon-picker.css +45 -10
- package/dist/styles/recipes/inline-attachment.css +4 -4
- package/dist/styles/recipes/inline-citation.css +2 -2
- package/dist/styles/recipes/item.css +4 -4
- package/dist/styles/recipes/markdown-editor.css +35 -24
- package/dist/styles/recipes/markdown.css +23 -27
- package/dist/styles/recipes/page-layout.css +13 -11
- package/dist/styles/recipes/popup-controls.css +2 -2
- package/dist/styles/recipes/popup-lists.css +3 -3
- package/dist/styles/recipes/popup.css +11 -9
- package/dist/styles/recipes/range.css +4 -5
- package/dist/styles/recipes/resizable.css +15 -10
- package/dist/styles/recipes/resize-handle.css +2 -2
- package/dist/styles/recipes/scroll-area.css +1 -1
- package/dist/styles/recipes/sidebar-menu.css +5 -15
- package/dist/styles/recipes/sidebar-mobile.css +4 -4
- package/dist/styles/recipes/sidebar-parts.css +26 -1
- package/dist/styles/recipes/sidebar.css +18 -31
- package/dist/styles/recipes/skeleton.css +10 -5
- package/dist/styles/recipes/stepper.css +1 -1
- package/dist/styles/recipes/switch.css +12 -11
- package/dist/styles/recipes/table-of-contents.css +6 -8
- package/dist/styles/recipes/table.css +4 -4
- package/dist/styles/recipes/tabs.css +10 -5
- package/dist/styles/recipes/task-list.css +3 -3
- package/dist/styles/recipes/tree.css +10 -3
- package/dist/styles/recipes/user-ask-details.css +5 -4
- package/dist/styles/recipes/user-ask.css +5 -5
- package/dist/styles/theme.css +158 -177
- package/dist/ui/chart-cartesian.d.ts +801 -0
- package/dist/ui/chart-cartesian.js +420 -0
- package/dist/ui/chart-colors.d.ts +7 -0
- package/dist/ui/chart-colors.js +27 -0
- package/dist/ui/chart-curves.d.ts +7 -0
- package/dist/ui/chart-curves.js +87 -0
- package/dist/ui/chart-marks.d.ts +68 -0
- package/dist/ui/chart-marks.js +227 -0
- package/dist/ui/chart-polar.d.ts +103 -0
- package/dist/ui/chart-polar.js +124 -0
- package/dist/ui/chart-series.d.ts +36 -0
- package/dist/ui/chart-series.js +71 -0
- package/dist/ui/chart.d.ts +32 -0
- package/dist/ui/chart.js +257 -0
- package/dist/ui/color-picker-area.d.ts +16 -0
- package/dist/ui/color-picker-area.js +175 -0
- package/dist/ui/color-picker-context.d.ts +27 -0
- package/dist/ui/color-picker-context.js +87 -0
- package/dist/ui/color-picker-contrast.d.ts +20 -0
- package/dist/ui/color-picker-contrast.js +129 -0
- package/dist/ui/color-picker-sliders.d.ts +15 -0
- package/dist/ui/color-picker-sliders.js +146 -0
- package/dist/ui/color-picker-swatches.d.ts +23 -0
- package/dist/ui/color-picker-swatches.js +94 -0
- package/dist/ui/color-picker-values.d.ts +59 -0
- package/dist/ui/color-picker-values.js +244 -0
- package/dist/ui/color-picker.d.ts +15 -110
- package/dist/ui/color-picker.js +30 -759
- package/dist/ui/emoji-picker.d.ts +10 -1
- package/dist/ui/emoji-picker.js +71 -14
- package/dist/ui/flow.js +1 -1
- package/dist/ui/gradient-editor-controls.d.ts +19 -0
- package/dist/ui/gradient-editor-controls.js +75 -0
- package/dist/ui/gradient-editor.d.ts +23 -22
- package/dist/ui/gradient-editor.js +77 -123
- package/dist/ui/icon-picker.d.ts +1 -1
- package/dist/ui/icon-picker.js +11 -6
- package/dist/ui/markdown-elements.d.ts +3 -1
- package/dist/ui/markdown-elements.js +62 -22
- package/dist/ui/markdown-heading.d.ts +9 -0
- package/dist/ui/markdown-heading.js +25 -0
- package/dist/ui/resizable.js +24 -9
- package/dist/ui/sidebar-provider.js +3 -12
- package/dist/ui/typography.d.ts +1 -0
- package/dist/ui/typography.js +12 -3
- package/dist/user-ask.js +4 -8
- package/package.json +7 -3
- package/dist/ui/emoji-icon-picker.d.ts +0 -13
- package/dist/ui/emoji-icon-picker.js +0 -50
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
|
|
5
|
+
import { getChannels } from "../lib/color.js";
|
|
6
|
+
import { useColorPicker } from "./color-picker-context.js";
|
|
7
|
+
import { Input } from "./input.js";
|
|
8
|
+
import { NumberField, NumberFieldGroup, NumberFieldInput } from "./number-field.js";
|
|
9
|
+
import { useId, useState, useSyncExternalStore } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/ui/color-picker-values.tsx
|
|
12
|
+
const isColorFormat = (v) => v === "hex" || v === "rgb" || v === "hsl" || v === "oklch";
|
|
13
|
+
const CHANNEL_NAMES = {
|
|
14
|
+
r: "Red",
|
|
15
|
+
g: "Green",
|
|
16
|
+
b: "Blue",
|
|
17
|
+
h: "Hue",
|
|
18
|
+
s: "Saturation",
|
|
19
|
+
l: "Lightness",
|
|
20
|
+
okl: "OKLCH lightness",
|
|
21
|
+
okc: "OKLCH chroma",
|
|
22
|
+
okh: "OKLCH hue",
|
|
23
|
+
a: "Opacity"
|
|
24
|
+
};
|
|
25
|
+
function subscribeEyeDropper() {
|
|
26
|
+
return () => {};
|
|
27
|
+
}
|
|
28
|
+
function getEyeDropperSnapshot() {
|
|
29
|
+
return typeof window !== "undefined" && Boolean(window.EyeDropper);
|
|
30
|
+
}
|
|
31
|
+
function getEyeDropperServerSnapshot() {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
function ColorPickerInput({ size = "sm", className, invalidLabel = "Enter a hex, rgb(), hsl() or oklch() color.", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onFocus, onBlur, onKeyDown, ...props }) {
|
|
35
|
+
const { valueString, setFromString, disabled } = useColorPicker();
|
|
36
|
+
const invalidMessageId = useId();
|
|
37
|
+
const [draft, setDraft] = useState(valueString);
|
|
38
|
+
const [editing, setEditing] = useState(false);
|
|
39
|
+
const [invalid, setInvalid] = useState(false);
|
|
40
|
+
const describedBy = [ariaDescribedBy, invalid ? invalidMessageId : void 0].filter(Boolean).join(" ") || void 0;
|
|
41
|
+
const shown = editing ? draft : valueString;
|
|
42
|
+
const commit = () => {
|
|
43
|
+
const accepted = setFromString(draft);
|
|
44
|
+
setInvalid(!accepted);
|
|
45
|
+
if (accepted) setEditing(false);
|
|
46
|
+
};
|
|
47
|
+
const revert = () => {
|
|
48
|
+
setInvalid(false);
|
|
49
|
+
setEditing(false);
|
|
50
|
+
};
|
|
51
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
52
|
+
"data-control-ui": "color-picker",
|
|
53
|
+
"data-control-family": "color-picker",
|
|
54
|
+
"data-slot": "input",
|
|
55
|
+
className: "contents",
|
|
56
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
57
|
+
...props,
|
|
58
|
+
size,
|
|
59
|
+
value: shown,
|
|
60
|
+
disabled,
|
|
61
|
+
spellCheck: false,
|
|
62
|
+
autoComplete: "off",
|
|
63
|
+
"aria-label": ariaLabelledBy === void 0 ? ariaLabel ?? "Color value" : ariaLabel,
|
|
64
|
+
"aria-labelledby": ariaLabelledBy,
|
|
65
|
+
"aria-invalid": invalid || void 0,
|
|
66
|
+
"aria-describedby": describedBy,
|
|
67
|
+
className,
|
|
68
|
+
onFocus: (event) => {
|
|
69
|
+
onFocus?.(event);
|
|
70
|
+
if (editing) return;
|
|
71
|
+
setDraft(valueString);
|
|
72
|
+
setEditing(true);
|
|
73
|
+
},
|
|
74
|
+
onChange: (event) => setDraft(event.target.value),
|
|
75
|
+
onBlur: (event) => {
|
|
76
|
+
onBlur?.(event);
|
|
77
|
+
commit();
|
|
78
|
+
},
|
|
79
|
+
onKeyDown: (event) => {
|
|
80
|
+
onKeyDown?.(event);
|
|
81
|
+
if (event.defaultPrevented) return;
|
|
82
|
+
if (event.key === "Enter") commit();
|
|
83
|
+
else if (event.key === "Escape") revert();
|
|
84
|
+
}
|
|
85
|
+
}), invalid ? /* @__PURE__ */ jsx("span", {
|
|
86
|
+
id: invalidMessageId,
|
|
87
|
+
className: "sr-only",
|
|
88
|
+
children: invalidLabel
|
|
89
|
+
}) : null]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function ColorPickerFormatSelect({ formats = [
|
|
93
|
+
"hex",
|
|
94
|
+
"rgb",
|
|
95
|
+
"hsl",
|
|
96
|
+
"oklch"
|
|
97
|
+
], size = "sm", className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style }) {
|
|
98
|
+
const { format, setFormat, disabled } = useColorPicker();
|
|
99
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
100
|
+
value: format,
|
|
101
|
+
disabled,
|
|
102
|
+
onValueChange: (value) => {
|
|
103
|
+
if (isColorFormat(value)) setFormat(value);
|
|
104
|
+
},
|
|
105
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
106
|
+
size,
|
|
107
|
+
"data-control-ui": "color-picker",
|
|
108
|
+
"data-slot": "format",
|
|
109
|
+
"aria-label": ariaLabelledBy === void 0 ? ariaLabel ?? "Color format" : ariaLabel,
|
|
110
|
+
"aria-labelledby": ariaLabelledBy,
|
|
111
|
+
className,
|
|
112
|
+
style,
|
|
113
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
114
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: formats.map((f) => /* @__PURE__ */ jsx(SelectItem, {
|
|
115
|
+
value: f,
|
|
116
|
+
children: f.toUpperCase()
|
|
117
|
+
}, f)) })]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function ColorPickerChannels({ className, children, ...props }) {
|
|
121
|
+
const { hsva, format, alpha } = useColorPicker();
|
|
122
|
+
const specs = getChannels(hsva, format).filter((spec) => alpha || spec.id !== "a");
|
|
123
|
+
return /* @__PURE__ */ jsx("div", {
|
|
124
|
+
"data-control-ui": "color-picker",
|
|
125
|
+
"data-control-family": "color-picker",
|
|
126
|
+
"data-slot": "channels",
|
|
127
|
+
className: cn("grid grid-flow-col auto-cols-fr", className),
|
|
128
|
+
...props,
|
|
129
|
+
children: children ?? specs.map((spec) => /* @__PURE__ */ jsx(ColorPickerChannel, {
|
|
130
|
+
channel: spec.id,
|
|
131
|
+
label: spec.label
|
|
132
|
+
}, spec.id))
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function ColorPickerChannel({ channel, label, className, "aria-label": ariaLabel, ...props }) {
|
|
136
|
+
const { hsva, format, setChannelValue, disabled } = useColorPicker();
|
|
137
|
+
const spec = getChannels(hsva, format).find((s) => s.id === channel);
|
|
138
|
+
if (!spec) return null;
|
|
139
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
140
|
+
"data-control-ui": "color-picker",
|
|
141
|
+
"data-control-family": "color-picker",
|
|
142
|
+
"data-slot": "channel",
|
|
143
|
+
className: cn("grid grid-cols-1", className),
|
|
144
|
+
...props,
|
|
145
|
+
children: [/* @__PURE__ */ jsx(NumberField, {
|
|
146
|
+
size: "sm",
|
|
147
|
+
value: spec.value,
|
|
148
|
+
min: spec.min,
|
|
149
|
+
max: spec.max,
|
|
150
|
+
step: spec.step,
|
|
151
|
+
disabled,
|
|
152
|
+
onValueChange: (value) => {
|
|
153
|
+
if (value !== null) setChannelValue(channel, value);
|
|
154
|
+
},
|
|
155
|
+
children: /* @__PURE__ */ jsx(NumberFieldGroup, {
|
|
156
|
+
className: "w-full",
|
|
157
|
+
children: /* @__PURE__ */ jsx(NumberFieldInput, {
|
|
158
|
+
"aria-label": ariaLabel ?? `${CHANNEL_NAMES[channel]} channel`,
|
|
159
|
+
className: "px-1 text-center"
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
163
|
+
"data-control-ui": "color-picker",
|
|
164
|
+
"data-control-family": "color-picker",
|
|
165
|
+
"data-slot": "channel-label",
|
|
166
|
+
children: label ?? spec.label
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function ColorPickerEyeDropper({ className, children, ...props }) {
|
|
171
|
+
const { setFromString, disabled } = useColorPicker();
|
|
172
|
+
if (!useSyncExternalStore(subscribeEyeDropper, getEyeDropperSnapshot, getEyeDropperServerSnapshot)) return null;
|
|
173
|
+
const pick = async () => {
|
|
174
|
+
const Ctor = window.EyeDropper;
|
|
175
|
+
if (!Ctor) return;
|
|
176
|
+
try {
|
|
177
|
+
const result = await new Ctor().open();
|
|
178
|
+
setFromString(result.sRGBHex);
|
|
179
|
+
} catch {}
|
|
180
|
+
};
|
|
181
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
182
|
+
variant: "surface",
|
|
183
|
+
size: "sm",
|
|
184
|
+
iconOnly: true,
|
|
185
|
+
disabled,
|
|
186
|
+
"aria-label": "Pick a color from the screen",
|
|
187
|
+
"data-control-ui": "color-picker",
|
|
188
|
+
"data-slot": "eye-dropper",
|
|
189
|
+
className,
|
|
190
|
+
onClick: pick,
|
|
191
|
+
...props,
|
|
192
|
+
children: children ?? /* @__PURE__ */ jsx(EyeDropperIcon, {})
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function ColorPickerOutput({ className, children, renderValue, ...props }) {
|
|
196
|
+
const { valueString } = useColorPicker();
|
|
197
|
+
return /* @__PURE__ */ jsx("div", {
|
|
198
|
+
"data-control-ui": "color-picker",
|
|
199
|
+
"data-control-family": "color-picker",
|
|
200
|
+
"data-slot": "output",
|
|
201
|
+
className: cn("flex items-center", className),
|
|
202
|
+
...props,
|
|
203
|
+
children: renderValue ? renderValue({ value: valueString }) : children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
204
|
+
"data-control-ui": "color-picker",
|
|
205
|
+
"data-control-family": "color-picker",
|
|
206
|
+
"data-slot": "output-swatch",
|
|
207
|
+
className: "relative shrink-0 overflow-hidden",
|
|
208
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
209
|
+
"data-control-ui": "color-picker",
|
|
210
|
+
"data-control-family": "color-picker",
|
|
211
|
+
"data-slot": "output-checker",
|
|
212
|
+
"aria-hidden": true,
|
|
213
|
+
className: "absolute inset-0"
|
|
214
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
215
|
+
"data-control-ui": "color-picker",
|
|
216
|
+
"data-control-family": "color-picker",
|
|
217
|
+
"data-slot": "output-color",
|
|
218
|
+
"aria-hidden": true,
|
|
219
|
+
className: "absolute inset-0",
|
|
220
|
+
style: { backgroundColor: valueString }
|
|
221
|
+
})]
|
|
222
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
223
|
+
"data-control-ui": "color-picker",
|
|
224
|
+
"data-control-family": "color-picker",
|
|
225
|
+
"data-slot": "output-value",
|
|
226
|
+
children: valueString
|
|
227
|
+
})] })
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function EyeDropperIcon() {
|
|
231
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
232
|
+
viewBox: "0 0 16 16",
|
|
233
|
+
className: "size-4",
|
|
234
|
+
fill: "none",
|
|
235
|
+
stroke: "currentColor",
|
|
236
|
+
strokeWidth: "1.3",
|
|
237
|
+
strokeLinecap: "round",
|
|
238
|
+
strokeLinejoin: "round",
|
|
239
|
+
"aria-hidden": "true",
|
|
240
|
+
children: /* @__PURE__ */ jsx("path", { d: "M10.5 2.5a1.8 1.8 0 0 1 2.5 2.5l-1.3 1.3.9.9-1.1 1.1-.9-.9-4.4 4.4-2.2.6.6-2.2 4.4-4.4-.9-.9 1.1-1.1.9.9 1.3-1.3Z" })
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
export { ColorPickerChannel, ColorPickerChannels, ColorPickerEyeDropper, ColorPickerFormatSelect, ColorPickerInput, ColorPickerOutput };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { OpenChangeEventDetails } from "../control-props.js";
|
|
2
|
-
import { ControlSize } from "../control-variants.js";
|
|
3
|
-
import { ButtonKnobStyle } from "../knob-contracts/button-knobs.js";
|
|
4
2
|
import { PopupKnobStyle } from "../knob-contracts/popup-knobs.js";
|
|
5
3
|
import { ColorPickerKnobStyle } from "../knob-contracts/color-picker-knobs.js";
|
|
4
|
+
import { ColorFormat } from "../lib/color.js";
|
|
5
|
+
import { GradientInterpolation, GradientStop, GradientType, GradientValue } from "../lib/gradient.js";
|
|
6
|
+
import { ColorPickerArea, ColorPickerAreaProps, ColorPickerAreaThumb, ColorPickerAreaThumbProps, ColorPickerWheel, ColorPickerWheelProps } from "./color-picker-area.js";
|
|
7
|
+
import { ColorPickerStateProps } from "./color-picker-context.js";
|
|
8
|
+
import { ColorPickerAreaContrast, ColorPickerAreaContrastProps, ColorPickerContrast, ColorPickerContrastProps } from "./color-picker-contrast.js";
|
|
9
|
+
import { ColorPickerAlpha, ColorPickerAlphaProps, ColorPickerBrightness, ColorPickerBrightnessProps, ColorPickerHue, ColorPickerHueProps, ColorPickerSaturation, ColorPickerSaturationProps } from "./color-picker-sliders.js";
|
|
10
|
+
import { ColorPickerSwatch, ColorPickerSwatchAdd, ColorPickerSwatchAddProps, ColorPickerSwatchProps, ColorPickerSwatches, ColorPickerSwatchesProps } from "./color-picker-swatches.js";
|
|
11
|
+
import { ColorPickerChannel, ColorPickerChannelProps, ColorPickerChannels, ColorPickerChannelsProps, ColorPickerEyeDropper, ColorPickerEyeDropperProps, ColorPickerFormatSelect, ColorPickerFormatSelectProps, ColorPickerInput, ColorPickerInputProps, ColorPickerOutput, ColorPickerOutputProps } from "./color-picker-values.js";
|
|
12
|
+
import { GradientEditor, GradientEditorPreview, GradientEditorPreviewProps, GradientEditorProps, GradientEditorStop, GradientEditorStopAdd, GradientEditorStopAddProps, GradientEditorStopProps, GradientEditorTrack, GradientEditorTrackProps } from "./gradient-editor.js";
|
|
13
|
+
import { GradientEditorAngle, GradientEditorAngleProps, GradientEditorInterpolationSelect, GradientEditorInterpolationSelectProps, GradientEditorTypeSelect, GradientEditorTypeSelectProps } from "./gradient-editor-controls.js";
|
|
6
14
|
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
7
15
|
//#region src/ui/color-picker.d.ts
|
|
8
|
-
export type
|
|
9
|
-
export type ColorPickerProps = {
|
|
10
|
-
value?: string;
|
|
11
|
-
defaultValue?: string;
|
|
12
|
-
onValueChange?: (value: string) => void;
|
|
13
|
-
format?: ColorFormat;
|
|
14
|
-
defaultFormat?: ColorFormat;
|
|
15
|
-
onFormatChange?: (format: ColorFormat) => void;
|
|
16
|
-
alpha?: boolean;
|
|
17
|
-
disabled?: boolean;
|
|
16
|
+
export type ColorPickerProps = ColorPickerStateProps & {
|
|
18
17
|
open?: boolean;
|
|
19
18
|
defaultOpen?: boolean;
|
|
20
19
|
onOpenChange?: (open: boolean, eventDetails: OpenChangeEventDetails) => void;
|
|
@@ -33,107 +32,13 @@ export type ColorPickerContentProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
33
32
|
export type ColorPickerPanelProps = Omit<ComponentProps<"div">, "style"> & {
|
|
34
33
|
style?: CSSProperties & PopupKnobStyle;
|
|
35
34
|
};
|
|
36
|
-
export type
|
|
37
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
38
|
-
};
|
|
39
|
-
export type ColorPickerAreaThumbProps = Omit<ComponentProps<"div">, "style"> & {
|
|
40
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
41
|
-
};
|
|
42
|
-
export type ColorPickerHueProps = Omit<Pick<ComponentProps<"div">, "className" | "aria-label" | "aria-labelledby" | "style">, "style"> & {
|
|
43
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
44
|
-
};
|
|
45
|
-
export type ColorPickerAlphaProps = Omit<Pick<ComponentProps<"div">, "className" | "aria-label" | "aria-labelledby" | "style">, "style"> & {
|
|
46
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
47
|
-
};
|
|
48
|
-
export type ColorPickerWheelProps = Omit<ComponentProps<"div">, "style"> & {
|
|
49
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
50
|
-
};
|
|
51
|
-
export type ColorPickerEyeDropperProps = Omit<Omit<ComponentProps<"button">, "onError">, "style"> & {
|
|
52
|
-
style?: CSSProperties & ButtonKnobStyle;
|
|
53
|
-
};
|
|
54
|
-
export type ColorPickerInputProps = Omit<Omit<ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "size">, "style"> & {
|
|
55
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
56
|
-
} & {
|
|
57
|
-
size?: ControlSize;
|
|
58
|
-
invalidLabel?: string;
|
|
59
|
-
};
|
|
60
|
-
export type ColorPickerFormatSelectProps = {
|
|
61
|
-
formats?: ColorFormat[];
|
|
62
|
-
size?: ControlSize;
|
|
63
|
-
className?: string;
|
|
64
|
-
"aria-label"?: string;
|
|
65
|
-
"aria-labelledby"?: string;
|
|
66
|
-
style?: CSSProperties & ButtonKnobStyle;
|
|
67
|
-
};
|
|
68
|
-
export type ColorPickerChannelsProps = ComponentProps<"div"> & {
|
|
69
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
70
|
-
};
|
|
71
|
-
export type ColorPickerChannelProps = Omit<Omit<ComponentProps<"div">, "children" | "aria-label">, "style"> & {
|
|
72
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
73
|
-
} & {
|
|
74
|
-
channel: "r" | "g" | "b" | "h" | "s" | "l" | "okl" | "okc" | "okh" | "a";
|
|
75
|
-
label?: ReactNode;
|
|
76
|
-
"aria-label"?: string;
|
|
77
|
-
};
|
|
78
|
-
export type ColorPickerSwatchesProps = ComponentProps<"div"> & {
|
|
79
|
-
colors?: string[];
|
|
80
|
-
label?: ReactNode;
|
|
81
|
-
} & {
|
|
82
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
83
|
-
};
|
|
84
|
-
export type ColorPickerSwatchProps = Omit<Omit<ComponentProps<"button">, "color">, "style"> & {
|
|
85
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
86
|
-
} & {
|
|
87
|
-
color: string;
|
|
88
|
-
};
|
|
89
|
-
export type ColorPickerSwatchAddProps = Omit<Omit<ComponentProps<"button">, "onClick">, "style"> & {
|
|
90
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
91
|
-
} & {
|
|
92
|
-
onAdd?: (value: string) => void;
|
|
93
|
-
};
|
|
94
|
-
export type ColorPickerContrastProps = Omit<Omit<ComponentProps<"div">, "children">, "style"> & {
|
|
95
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
96
|
-
} & {
|
|
97
|
-
background?: string;
|
|
98
|
-
passLabel?: string;
|
|
99
|
-
failLabel?: string;
|
|
100
|
-
};
|
|
101
|
-
export type ColorPickerOutputProps = Omit<Omit<ComponentProps<"div">, "children">, "style"> & {
|
|
102
|
-
style?: CSSProperties & ColorPickerKnobStyle;
|
|
103
|
-
} & {
|
|
35
|
+
export type GradientEditorStopColorProps = {
|
|
104
36
|
children?: ReactNode;
|
|
105
|
-
renderValue?: (state: {
|
|
106
|
-
value: string;
|
|
107
|
-
}) => ReactNode;
|
|
108
37
|
};
|
|
109
38
|
export declare function ColorPicker({ open, defaultOpen, onOpenChange, children, ...state }: ColorPickerProps): import("react").JSX.Element;
|
|
110
39
|
export declare function ColorPickerTrigger({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerTriggerProps): import("react").JSX.Element;
|
|
111
40
|
export declare function ColorPickerContent({ className, children, side, align, sideOffset, ...props }: ColorPickerContentProps): import("react").JSX.Element;
|
|
112
41
|
export declare function ColorPickerPanel({ className, children, ...props }: ColorPickerPanelProps): import("react").JSX.Element;
|
|
113
|
-
export declare function
|
|
114
|
-
|
|
115
|
-
export
|
|
116
|
-
export declare function ColorPickerAlpha({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerAlphaProps): import("react").JSX.Element | null;
|
|
117
|
-
export declare function ColorPickerWheel({ className, style, ...props }: ColorPickerWheelProps): import("react").JSX.Element;
|
|
118
|
-
export declare function ColorPickerInput({ size, className, invalidLabel, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onFocus, onBlur, onKeyDown, ...props }: ColorPickerInputProps): import("react").JSX.Element;
|
|
119
|
-
export declare function ColorPickerFormatSelect({ formats, size, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style }: ColorPickerFormatSelectProps): import("react").JSX.Element;
|
|
120
|
-
export declare function ColorPickerChannels({ className, children, ...props }: ColorPickerChannelsProps): import("react").JSX.Element;
|
|
121
|
-
export declare function ColorPickerChannel({ channel, label, className, "aria-label": ariaLabel, ...props }: ColorPickerChannelProps): import("react").JSX.Element | null;
|
|
122
|
-
declare global {
|
|
123
|
-
interface Window {
|
|
124
|
-
EyeDropper?: {
|
|
125
|
-
new (): {
|
|
126
|
-
open: () => Promise<{
|
|
127
|
-
sRGBHex: string;
|
|
128
|
-
}>;
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
export declare function ColorPickerEyeDropper({ className, children, ...props }: ColorPickerEyeDropperProps): import("react").JSX.Element | null;
|
|
134
|
-
export declare function ColorPickerSwatches({ colors, label, className, children, ...props }: ColorPickerSwatchesProps): import("react").JSX.Element;
|
|
135
|
-
export declare function ColorPickerSwatch({ color, className, "aria-label": ariaLabel, ...props }: ColorPickerSwatchProps): import("react").JSX.Element;
|
|
136
|
-
export declare function ColorPickerSwatchAdd({ onAdd, className, children, ...props }: ColorPickerSwatchAddProps): import("react").JSX.Element;
|
|
137
|
-
export declare function ColorPickerContrast({ background, passLabel, failLabel, className, ...props }: ColorPickerContrastProps): import("react").JSX.Element | null;
|
|
138
|
-
export declare function ColorPickerOutput({ className, children, renderValue, ...props }: ColorPickerOutputProps): import("react").JSX.Element;
|
|
139
|
-
//#endregion
|
|
42
|
+
export declare function GradientEditorStopColor({ children }: GradientEditorStopColorProps): import("react").JSX.Element | null;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { type ColorFormat, ColorPickerAlpha, type ColorPickerAlphaProps, ColorPickerArea, ColorPickerAreaContrast, type ColorPickerAreaContrastProps, type ColorPickerAreaProps, ColorPickerAreaThumb, type ColorPickerAreaThumbProps, ColorPickerBrightness, type ColorPickerBrightnessProps, ColorPickerChannel, type ColorPickerChannelProps, ColorPickerChannels, type ColorPickerChannelsProps, ColorPickerContrast, type ColorPickerContrastProps, ColorPickerEyeDropper, type ColorPickerEyeDropperProps, ColorPickerFormatSelect, type ColorPickerFormatSelectProps, ColorPickerHue, type ColorPickerHueProps, ColorPickerInput, type ColorPickerInputProps, ColorPickerOutput, type ColorPickerOutputProps, ColorPickerSaturation, type ColorPickerSaturationProps, ColorPickerSwatch, ColorPickerSwatchAdd, type ColorPickerSwatchAddProps, type ColorPickerSwatchProps, ColorPickerSwatches, type ColorPickerSwatchesProps, ColorPickerWheel, type ColorPickerWheelProps, GradientEditor, GradientEditorAngle, type GradientEditorAngleProps, GradientEditorInterpolationSelect, type GradientEditorInterpolationSelectProps, GradientEditorPreview, type GradientEditorPreviewProps, type GradientEditorProps, GradientEditorStop, GradientEditorStopAdd, type GradientEditorStopAddProps, type GradientEditorStopProps, GradientEditorTrack, type GradientEditorTrackProps, GradientEditorTypeSelect, type GradientEditorTypeSelectProps, type GradientInterpolation, type GradientStop, type GradientType, type GradientValue };
|