@nesso-how/ui 1.0.0-beta.21 → 1.0.0-beta.22
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 -1
- package/dist/index.d.ts +5 -26
- package/dist/index.js +21 -43
- package/dist/styles.css +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,4 +58,4 @@ Undo/redo is local by default. Use `history={false}` for host-owned history or `
|
|
|
58
58
|
|
|
59
59
|
Cmd/Ctrl-click calls `onOpenLink`; read-only fields use a regular click. The host validates and opens destinations.
|
|
60
60
|
|
|
61
|
-
The package also exports `useMediaQuery`, `
|
|
61
|
+
The package also exports `useMediaQuery`, `conceptColor`, and the `ActionIconName` and `ToastItem` types. See the [public exports](https://github.com/nesso-how/nesso/blob/main/packages/ui/src/index.ts) and component source files for prop definitions; published TypeScript declarations provide editor completion.
|
package/dist/index.d.ts
CHANGED
|
@@ -247,6 +247,7 @@ export declare function ColorPicker({ value: color, onValueChange, onCopyError,
|
|
|
247
247
|
presets: readonly {
|
|
248
248
|
label: string;
|
|
249
249
|
value: string;
|
|
250
|
+
color: string;
|
|
250
251
|
}[];
|
|
251
252
|
disabled?: boolean;
|
|
252
253
|
inputProps?: ComponentProps<'input'> & {
|
|
@@ -255,32 +256,10 @@ export declare function ColorPicker({ value: color, onValueChange, onCopyError,
|
|
|
255
256
|
}): import("react").JSX.Element;
|
|
256
257
|
//#endregion
|
|
257
258
|
//#region src/color.d.ts
|
|
258
|
-
export declare const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}, {
|
|
263
|
-
readonly key: 'presetSand';
|
|
264
|
-
readonly value: '#f3ead5';
|
|
265
|
-
}, {
|
|
266
|
-
readonly key: 'presetPeach';
|
|
267
|
-
readonly value: '#f5e3d5';
|
|
268
|
-
}, {
|
|
269
|
-
readonly key: 'presetRose';
|
|
270
|
-
readonly value: '#f5dfe2';
|
|
271
|
-
}, {
|
|
272
|
-
readonly key: 'presetSage';
|
|
273
|
-
readonly value: '#e1ecde';
|
|
274
|
-
}, {
|
|
275
|
-
readonly key: 'presetMint';
|
|
276
|
-
readonly value: '#dceee8';
|
|
277
|
-
}, {
|
|
278
|
-
readonly key: 'presetSky';
|
|
279
|
-
readonly value: '#dfeaf5';
|
|
280
|
-
}, {
|
|
281
|
-
readonly key: 'presetLavender';
|
|
282
|
-
readonly value: '#e9e2f3';
|
|
283
|
-
}];
|
|
259
|
+
export declare const conceptColor: (value: string) => {
|
|
260
|
+
background: string;
|
|
261
|
+
color: string;
|
|
262
|
+
};
|
|
284
263
|
//#endregion
|
|
285
264
|
//#region src/combobox.d.ts
|
|
286
265
|
export declare function ComboboxPopup({ className, children, ...props }: Combobox.Popup.Props): import("react").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -635,6 +635,7 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
635
635
|
lineHeight: "inherit",
|
|
636
636
|
overflow: "visible"
|
|
637
637
|
},
|
|
638
|
+
".cm-content": { caretColor: "var(--foreground)" },
|
|
638
639
|
".cm-content, .cm-line": { padding: "0" },
|
|
639
640
|
".cm-line.nesso-markdown-list-item": {
|
|
640
641
|
paddingInlineStart: "var(--nesso-list-padding)",
|
|
@@ -1002,7 +1003,7 @@ function ToastViewport({ items, label, closeLabel, queueLabel, onDismiss, onRest
|
|
|
1002
1003
|
function DialogPopup({ className, ...props }) {
|
|
1003
1004
|
return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
1004
1005
|
forceRender: true,
|
|
1005
|
-
className: "fixed inset-0 z-50 bg-
|
|
1006
|
+
className: "fixed inset-0 z-50 bg-black/20"
|
|
1006
1007
|
}), /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
1007
1008
|
className: cn("nesso-popup fixed top-1/2 left-1/2 z-50 w-[min(400px,calc(100vw-32px))] -translate-1/2 border-0 p-6", className),
|
|
1008
1009
|
...props
|
|
@@ -1339,40 +1340,13 @@ const hsvToHex = ({ h, s, v }) => {
|
|
|
1339
1340
|
};
|
|
1340
1341
|
return `#${channel(5)}${channel(3)}${channel(1)}`;
|
|
1341
1342
|
};
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
value: "#f3ead5"
|
|
1350
|
-
},
|
|
1351
|
-
{
|
|
1352
|
-
key: "presetPeach",
|
|
1353
|
-
value: "#f5e3d5"
|
|
1354
|
-
},
|
|
1355
|
-
{
|
|
1356
|
-
key: "presetRose",
|
|
1357
|
-
value: "#f5dfe2"
|
|
1358
|
-
},
|
|
1359
|
-
{
|
|
1360
|
-
key: "presetSage",
|
|
1361
|
-
value: "#e1ecde"
|
|
1362
|
-
},
|
|
1363
|
-
{
|
|
1364
|
-
key: "presetMint",
|
|
1365
|
-
value: "#dceee8"
|
|
1366
|
-
},
|
|
1367
|
-
{
|
|
1368
|
-
key: "presetSky",
|
|
1369
|
-
value: "#dfeaf5"
|
|
1370
|
-
},
|
|
1371
|
-
{
|
|
1372
|
-
key: "presetLavender",
|
|
1373
|
-
value: "#e9e2f3"
|
|
1374
|
-
}
|
|
1375
|
-
];
|
|
1343
|
+
const conceptColor = (value) => value.startsWith("#") ? {
|
|
1344
|
+
background: value,
|
|
1345
|
+
color: contrastColor(value)
|
|
1346
|
+
} : {
|
|
1347
|
+
background: `var(--preset-${value})`,
|
|
1348
|
+
color: "var(--foreground)"
|
|
1349
|
+
};
|
|
1376
1350
|
//#endregion
|
|
1377
1351
|
//#region src/color-picker.tsx
|
|
1378
1352
|
const defaultColor = "#ffffff";
|
|
@@ -1382,7 +1356,8 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1382
1356
|
const hint = `${hexId}-hint`;
|
|
1383
1357
|
const copyTimer = useRef(void 0);
|
|
1384
1358
|
const colorGroup = useRef(void 0);
|
|
1385
|
-
const
|
|
1359
|
+
const selected = presets.find((preset) => preset.value === color);
|
|
1360
|
+
const value = selected?.color ?? color ?? defaultColor;
|
|
1386
1361
|
const mixed = color === null;
|
|
1387
1362
|
const [picker, setPicker] = useState(() => ({
|
|
1388
1363
|
value,
|
|
@@ -1558,14 +1533,17 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1558
1533
|
children: presets.map((preset) => /* @__PURE__ */ jsx(IconButton, {
|
|
1559
1534
|
title: preset.label,
|
|
1560
1535
|
"aria-label": preset.label,
|
|
1561
|
-
"aria-pressed": !mixed && preset.value ===
|
|
1562
|
-
onClick: () =>
|
|
1536
|
+
"aria-pressed": !mixed && preset.value === color,
|
|
1537
|
+
onClick: () => {
|
|
1538
|
+
colorGroup.current = void 0;
|
|
1539
|
+
onValueChange(preset.value);
|
|
1540
|
+
},
|
|
1563
1541
|
className: "size-6 [&_svg]:size-3",
|
|
1564
1542
|
children: /* @__PURE__ */ jsx("span", {
|
|
1565
|
-
className: "grid size-4 place-items-center rounded-xs border border-
|
|
1566
|
-
style: { background: preset.
|
|
1543
|
+
className: "grid size-4 place-items-center rounded-xs border border-foreground/15",
|
|
1544
|
+
style: { background: preset.color },
|
|
1567
1545
|
"aria-hidden": "true",
|
|
1568
|
-
children: !mixed && preset.value ===
|
|
1546
|
+
children: !mixed && preset.value === color && /* @__PURE__ */ jsx(Check, {
|
|
1569
1547
|
className: "text-foreground",
|
|
1570
1548
|
"aria-hidden": "true"
|
|
1571
1549
|
})
|
|
@@ -1620,7 +1598,7 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1620
1598
|
}),
|
|
1621
1599
|
/* @__PURE__ */ jsx("span", {
|
|
1622
1600
|
className: "min-w-0 flex-1 truncate font-mono text-[10px] leading-4 text-muted-foreground",
|
|
1623
|
-
children: mixed ? labels.mixed : color ? value.toUpperCase() : labels.default
|
|
1601
|
+
children: mixed ? labels.mixed : selected?.label ?? (color ? value.toUpperCase() : labels.default)
|
|
1624
1602
|
}),
|
|
1625
1603
|
/* @__PURE__ */ jsx(IconButton, {
|
|
1626
1604
|
"aria-label": labels.resetColor,
|
|
@@ -1705,4 +1683,4 @@ function ActionIcon({ name, ...props }) {
|
|
|
1705
1683
|
});
|
|
1706
1684
|
}
|
|
1707
1685
|
//#endregion
|
|
1708
|
-
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, BottomSheet, Button, Collapsible, ColorPicker, Combobox, ComboboxItem, ComboboxPopup, ConfirmDialog, ContextLabel, Dialog, DialogActions, DialogPopup, DirectoryField, Field, FieldHint, IconButton, Input, Kbd, Label, ListRow, ListRowButton, ListRowDetail, ListRowTitle, MarkdownInput, Menu, MenuItem, MenuPopup, MenuRadioItem, PanelHeader, PluginContent, PluginPage, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport,
|
|
1686
|
+
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, BottomSheet, Button, Collapsible, ColorPicker, Combobox, ComboboxItem, ComboboxPopup, ConfirmDialog, ContextLabel, Dialog, DialogActions, DialogPopup, DirectoryField, Field, FieldHint, IconButton, Input, Kbd, Label, ListRow, ListRowButton, ListRowDetail, ListRowTitle, MarkdownInput, Menu, MenuItem, MenuPopup, MenuRadioItem, PanelHeader, PluginContent, PluginPage, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport, conceptColor, useMediaQuery };
|
package/dist/styles.css
CHANGED
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
border-radius: var(--radius-object);
|
|
132
132
|
background: var(--background);
|
|
133
133
|
color: var(--foreground);
|
|
134
|
-
box-shadow: 0 8px 24px
|
|
134
|
+
box-shadow: 0 8px 24px var(--shadow);
|
|
135
135
|
outline: none;
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
border-radius: calc(var(--radius-object) * 2) calc(var(--radius-object) * 2) 0 0;
|
|
145
145
|
background: var(--background);
|
|
146
146
|
color: var(--foreground);
|
|
147
|
-
box-shadow: 0 -8px 24px
|
|
147
|
+
box-shadow: 0 -8px 24px var(--shadow);
|
|
148
148
|
outline: none;
|
|
149
149
|
transform: translateY(var(--drawer-swipe-movement-y, 0px));
|
|
150
150
|
transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
border-radius: var(--radius-control);
|
|
374
374
|
background: var(--background);
|
|
375
375
|
box-shadow:
|
|
376
|
-
0 1px 3px
|
|
376
|
+
0 1px 3px var(--shadow),
|
|
377
377
|
0 0 0 1px var(--border);
|
|
378
378
|
}
|
|
379
379
|
.panel-toggle svg {
|
|
@@ -522,7 +522,7 @@
|
|
|
522
522
|
border-radius: var(--radius-object);
|
|
523
523
|
background: var(--background);
|
|
524
524
|
color: var(--foreground);
|
|
525
|
-
box-shadow: 0 8px 24px
|
|
525
|
+
box-shadow: 0 8px 24px var(--shadow);
|
|
526
526
|
pointer-events: auto;
|
|
527
527
|
animation: toast-enter 180ms ease-out both;
|
|
528
528
|
}
|
package/package.json
CHANGED