@nesso-how/ui 1.0.0-beta.21 → 1.0.0-beta.23
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 +2 -2
- package/dist/index.d.ts +15 -26
- package/dist/index.js +33 -43
- package/dist/styles.css +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Your build must compile this CSS; it is not a precompiled stylesheet. Supply the
|
|
|
45
45
|
| Search and suggestions | `Combobox`, `ComboboxItem`, `ComboboxPopup`, `Autocomplete`, `AutocompleteClear`, `AutocompleteItem`, `AutocompletePopup` |
|
|
46
46
|
| Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog`, `BottomSheet` |
|
|
47
47
|
| Panels and disclosure | `SidePanel`, `PanelHeader`, `PluginPage`, `PluginContent`, `SectionHeading`, `Collapsible`, `Tabs` |
|
|
48
|
-
| Feedback | `Banner`, `BannerRow`, `BannerDetails`, `ToastViewport`, `Spinner`
|
|
48
|
+
| Feedback | `Banner`, `BannerRow`, `BannerDetails`, `ToastViewport`, `Spinner`, `CharacterLimitHint` |
|
|
49
49
|
| Labels and icons | `Kbd`, `ContextLabel`, `ActionIcon` |
|
|
50
50
|
|
|
51
51
|
`Button` supports `default`, `outline`, and `ghost` variants. `SidePanel` supports controlled resizing and collapse. `Spinner` accepts an accessible `label` and respects reduced motion. State, content, and event handling remain yours to provide.
|
|
@@ -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
|
@@ -55,6 +55,16 @@ export declare function useMediaQuery(query: string): boolean;
|
|
|
55
55
|
//#region src/input.d.ts
|
|
56
56
|
declare function Input({ className, type, ...props }: ComponentProps<'input'>): import("react").JSX.Element;
|
|
57
57
|
//#endregion
|
|
58
|
+
//#region src/character-limit-hint.d.ts
|
|
59
|
+
export declare function CharacterLimitHint({ id, length, maxLength, remainingText, limitText, className }: {
|
|
60
|
+
id: string;
|
|
61
|
+
length: number;
|
|
62
|
+
maxLength: number;
|
|
63
|
+
remainingText: (count: number) => string;
|
|
64
|
+
limitText: string;
|
|
65
|
+
className?: string;
|
|
66
|
+
}): import("react").JSX.Element;
|
|
67
|
+
//#endregion
|
|
58
68
|
//#region src/directory-field.d.ts
|
|
59
69
|
export declare function DirectoryField({ label, value, labels, disabled, changeDisabled, onOpen, onChange, onRestore }: {
|
|
60
70
|
label: string;
|
|
@@ -247,6 +257,7 @@ export declare function ColorPicker({ value: color, onValueChange, onCopyError,
|
|
|
247
257
|
presets: readonly {
|
|
248
258
|
label: string;
|
|
249
259
|
value: string;
|
|
260
|
+
color: string;
|
|
250
261
|
}[];
|
|
251
262
|
disabled?: boolean;
|
|
252
263
|
inputProps?: ComponentProps<'input'> & {
|
|
@@ -255,32 +266,10 @@ export declare function ColorPicker({ value: color, onValueChange, onCopyError,
|
|
|
255
266
|
}): import("react").JSX.Element;
|
|
256
267
|
//#endregion
|
|
257
268
|
//#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
|
-
}];
|
|
269
|
+
export declare const conceptColor: (value: string) => {
|
|
270
|
+
background: string;
|
|
271
|
+
color: string;
|
|
272
|
+
};
|
|
284
273
|
//#endregion
|
|
285
274
|
//#region src/combobox.d.ts
|
|
286
275
|
export declare function ComboboxPopup({ className, children, ...props }: Combobox.Popup.Props): import("react").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -237,6 +237,18 @@ function Input({ className, type, ...props }) {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
//#endregion
|
|
240
|
+
//#region src/character-limit-hint.tsx
|
|
241
|
+
function CharacterLimitHint({ id, length, maxLength, remainingText, limitText, className }) {
|
|
242
|
+
const remaining = Math.max(0, maxLength - length);
|
|
243
|
+
return /* @__PURE__ */ jsx("p", {
|
|
244
|
+
id,
|
|
245
|
+
role: "status",
|
|
246
|
+
"aria-atomic": "true",
|
|
247
|
+
className: remaining > 10 ? "sr-only" : cn("text-xs leading-4", remaining === 0 ? "text-foreground" : "text-muted-foreground", className),
|
|
248
|
+
children: remaining <= 10 ? remaining === 0 ? limitText : remainingText(remaining) : null
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
240
252
|
//#region src/directory-field.tsx
|
|
241
253
|
function DirectoryField({ label, value, labels, disabled, changeDisabled, onOpen, onChange, onRestore }) {
|
|
242
254
|
const id = useId();
|
|
@@ -635,6 +647,7 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
635
647
|
lineHeight: "inherit",
|
|
636
648
|
overflow: "visible"
|
|
637
649
|
},
|
|
650
|
+
".cm-content": { caretColor: "var(--foreground)" },
|
|
638
651
|
".cm-content, .cm-line": { padding: "0" },
|
|
639
652
|
".cm-line.nesso-markdown-list-item": {
|
|
640
653
|
paddingInlineStart: "var(--nesso-list-padding)",
|
|
@@ -1002,7 +1015,7 @@ function ToastViewport({ items, label, closeLabel, queueLabel, onDismiss, onRest
|
|
|
1002
1015
|
function DialogPopup({ className, ...props }) {
|
|
1003
1016
|
return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
1004
1017
|
forceRender: true,
|
|
1005
|
-
className: "fixed inset-0 z-50 bg-
|
|
1018
|
+
className: "fixed inset-0 z-50 bg-black/20"
|
|
1006
1019
|
}), /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
1007
1020
|
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
1021
|
...props
|
|
@@ -1339,40 +1352,13 @@ const hsvToHex = ({ h, s, v }) => {
|
|
|
1339
1352
|
};
|
|
1340
1353
|
return `#${channel(5)}${channel(3)}${channel(1)}`;
|
|
1341
1354
|
};
|
|
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
|
-
];
|
|
1355
|
+
const conceptColor = (value) => value.startsWith("#") ? {
|
|
1356
|
+
background: value,
|
|
1357
|
+
color: contrastColor(value)
|
|
1358
|
+
} : {
|
|
1359
|
+
background: `var(--preset-${value})`,
|
|
1360
|
+
color: "var(--foreground)"
|
|
1361
|
+
};
|
|
1376
1362
|
//#endregion
|
|
1377
1363
|
//#region src/color-picker.tsx
|
|
1378
1364
|
const defaultColor = "#ffffff";
|
|
@@ -1382,7 +1368,8 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1382
1368
|
const hint = `${hexId}-hint`;
|
|
1383
1369
|
const copyTimer = useRef(void 0);
|
|
1384
1370
|
const colorGroup = useRef(void 0);
|
|
1385
|
-
const
|
|
1371
|
+
const selected = presets.find((preset) => preset.value === color);
|
|
1372
|
+
const value = selected?.color ?? color ?? defaultColor;
|
|
1386
1373
|
const mixed = color === null;
|
|
1387
1374
|
const [picker, setPicker] = useState(() => ({
|
|
1388
1375
|
value,
|
|
@@ -1558,14 +1545,17 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1558
1545
|
children: presets.map((preset) => /* @__PURE__ */ jsx(IconButton, {
|
|
1559
1546
|
title: preset.label,
|
|
1560
1547
|
"aria-label": preset.label,
|
|
1561
|
-
"aria-pressed": !mixed && preset.value ===
|
|
1562
|
-
onClick: () =>
|
|
1548
|
+
"aria-pressed": !mixed && preset.value === color,
|
|
1549
|
+
onClick: () => {
|
|
1550
|
+
colorGroup.current = void 0;
|
|
1551
|
+
onValueChange(preset.value);
|
|
1552
|
+
},
|
|
1563
1553
|
className: "size-6 [&_svg]:size-3",
|
|
1564
1554
|
children: /* @__PURE__ */ jsx("span", {
|
|
1565
|
-
className: "grid size-4 place-items-center rounded-xs border border-
|
|
1566
|
-
style: { background: preset.
|
|
1555
|
+
className: "grid size-4 place-items-center rounded-xs border border-foreground/15",
|
|
1556
|
+
style: { background: preset.color },
|
|
1567
1557
|
"aria-hidden": "true",
|
|
1568
|
-
children: !mixed && preset.value ===
|
|
1558
|
+
children: !mixed && preset.value === color && /* @__PURE__ */ jsx(Check, {
|
|
1569
1559
|
className: "text-foreground",
|
|
1570
1560
|
"aria-hidden": "true"
|
|
1571
1561
|
})
|
|
@@ -1620,7 +1610,7 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1620
1610
|
}),
|
|
1621
1611
|
/* @__PURE__ */ jsx("span", {
|
|
1622
1612
|
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
|
|
1613
|
+
children: mixed ? labels.mixed : selected?.label ?? (color ? value.toUpperCase() : labels.default)
|
|
1624
1614
|
}),
|
|
1625
1615
|
/* @__PURE__ */ jsx(IconButton, {
|
|
1626
1616
|
"aria-label": labels.resetColor,
|
|
@@ -1705,4 +1695,4 @@ function ActionIcon({ name, ...props }) {
|
|
|
1705
1695
|
});
|
|
1706
1696
|
}
|
|
1707
1697
|
//#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,
|
|
1698
|
+
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, BottomSheet, Button, CharacterLimitHint, 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