@newtone-dev/ui-react-web 0.43.0 → 0.44.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/app-frame/app-frame.css +16 -67
- package/dist/app-frame/control/control.d.ts +1 -0
- package/dist/app-frame/control/control.d.ts.map +1 -1
- package/dist/app-frame/control/control.js +3 -2
- package/dist/app-frame/control/control.js.map +1 -1
- package/dist/app-frame/launcher/launcher.d.ts +6 -2
- package/dist/app-frame/launcher/launcher.d.ts.map +1 -1
- package/dist/app-frame/launcher/launcher.js +12 -11
- package/dist/app-frame/launcher/launcher.js.map +1 -1
- package/dist/app-frame/main-menu/main-menu.js +2 -2
- package/dist/app-frame/main-menu/main-menu.js.map +1 -1
- package/dist/app-frame/menu/menu.d.ts +1 -0
- package/dist/app-frame/menu/menu.d.ts.map +1 -1
- package/dist/app-frame/menu/menu.js +3 -1
- package/dist/app-frame/menu/menu.js.map +1 -1
- package/dist/app-frame/parts.d.ts +3 -1
- package/dist/app-frame/parts.d.ts.map +1 -1
- package/dist/app-frame/parts.js +12 -4
- package/dist/app-frame/parts.js.map +1 -1
- package/dist/ask-button/ask-button.css +37 -0
- package/dist/ask-button/ask-button.d.ts +24 -0
- package/dist/ask-button/ask-button.d.ts.map +1 -0
- package/dist/ask-button/ask-button.js +19 -0
- package/dist/ask-button/ask-button.js.map +1 -0
- package/dist/ask-button/index.d.ts +3 -0
- package/dist/ask-button/index.d.ts.map +1 -0
- package/dist/ask-button/index.js +2 -0
- package/dist/ask-button/index.js.map +1 -0
- package/dist/badge/badge.css +44 -0
- package/dist/badge/badge.d.ts +16 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/badge.js +15 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/badge/index.js +2 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/below/below.css +8 -10
- package/dist/below/below.d.ts +3 -4
- package/dist/below/below.d.ts.map +1 -1
- package/dist/below/below.js +10 -52
- package/dist/below/below.js.map +1 -1
- package/dist/below/grip.d.ts +20 -0
- package/dist/below/grip.d.ts.map +1 -0
- package/dist/below/grip.js +78 -0
- package/dist/below/grip.js.map +1 -0
- package/dist/canvas/box/box.d.ts +9 -2
- package/dist/canvas/box/box.d.ts.map +1 -1
- package/dist/canvas/box/box.js +2 -2
- package/dist/canvas/box/box.js.map +1 -1
- package/dist/canvas/canvas.css +105 -34
- package/dist/canvas/canvas.d.ts +9 -2
- package/dist/canvas/canvas.d.ts.map +1 -1
- package/dist/canvas/canvas.js +19 -6
- package/dist/canvas/canvas.js.map +1 -1
- package/dist/canvas/cells/cells.d.ts +3 -3
- package/dist/canvas/cells/cells.js +10 -9
- package/dist/canvas/cells/cells.js.map +1 -1
- package/dist/canvas/cells/grid.d.ts +32 -0
- package/dist/canvas/cells/grid.d.ts.map +1 -1
- package/dist/canvas/cells/grid.js +93 -1
- package/dist/canvas/cells/grid.js.map +1 -1
- package/dist/canvas/dock/dock.d.ts +6 -1
- package/dist/canvas/dock/dock.d.ts.map +1 -1
- package/dist/canvas/dock/dock.js +19 -3
- package/dist/canvas/dock/dock.js.map +1 -1
- package/dist/canvas/frame/frame.d.ts.map +1 -1
- package/dist/canvas/frame/frame.js +1 -7
- package/dist/canvas/frame/frame.js.map +1 -1
- package/dist/canvas/index.d.ts +2 -1
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/insert/insert.d.ts +18 -0
- package/dist/canvas/insert/insert.d.ts.map +1 -0
- package/dist/canvas/insert/insert.js +40 -0
- package/dist/canvas/insert/insert.js.map +1 -0
- package/dist/canvas/pin/pin.d.ts.map +1 -1
- package/dist/canvas/pin/pin.js +2 -1
- package/dist/canvas/pin/pin.js.map +1 -1
- package/dist/chat/chat.css +2 -7
- package/dist/chat/chat.d.ts +5 -3
- package/dist/chat/chat.d.ts.map +1 -1
- package/dist/chat/chat.js +17 -24
- package/dist/chat/chat.js.map +1 -1
- package/dist/data-grid/data-grid.css +128 -0
- package/dist/data-grid/data-grid.d.ts +45 -0
- package/dist/data-grid/data-grid.d.ts.map +1 -0
- package/dist/data-grid/data-grid.js +50 -0
- package/dist/data-grid/data-grid.js.map +1 -0
- package/dist/data-grid/index.d.ts +3 -0
- package/dist/data-grid/index.d.ts.map +1 -0
- package/dist/data-grid/index.js +2 -0
- package/dist/data-grid/index.js.map +1 -0
- package/dist/discover/discover.css +60 -0
- package/dist/discover/discover.d.ts +33 -0
- package/dist/discover/discover.d.ts.map +1 -0
- package/dist/discover/discover.js +13 -0
- package/dist/discover/discover.js.map +1 -0
- package/dist/discover/index.d.ts +4 -0
- package/dist/discover/index.d.ts.map +1 -0
- package/dist/discover/index.js +3 -0
- package/dist/discover/index.js.map +1 -0
- package/dist/file-grid/file-grid.css +5 -0
- package/dist/file-grid/file-grid.d.ts +9 -2
- package/dist/file-grid/file-grid.d.ts.map +1 -1
- package/dist/file-grid/file-grid.js +5 -4
- package/dist/file-grid/file-grid.js.map +1 -1
- package/dist/floating-bar/floating-bar.css +20 -1
- package/dist/floating-bar/floating-bar.d.ts +16 -1
- package/dist/floating-bar/floating-bar.d.ts.map +1 -1
- package/dist/floating-bar/floating-bar.js +51 -46
- package/dist/floating-bar/floating-bar.js.map +1 -1
- package/dist/floating-bar/menu.d.ts +1 -0
- package/dist/floating-bar/menu.d.ts.map +1 -1
- package/dist/floating-bar/menu.js +12 -1
- package/dist/floating-bar/menu.js.map +1 -1
- package/dist/font-picker/font-picker.css +39 -0
- package/dist/font-picker/font-picker.d.ts +29 -0
- package/dist/font-picker/font-picker.d.ts.map +1 -0
- package/dist/font-picker/font-picker.js +119 -0
- package/dist/font-picker/font-picker.js.map +1 -0
- package/dist/font-picker/index.d.ts +3 -0
- package/dist/font-picker/index.d.ts.map +1 -0
- package/dist/font-picker/index.js +2 -0
- package/dist/font-picker/index.js.map +1 -0
- package/dist/hint/hint.css +55 -0
- package/dist/hint/hint.d.ts +33 -0
- package/dist/hint/hint.d.ts.map +1 -0
- package/dist/hint/hint.js +80 -0
- package/dist/hint/hint.js.map +1 -0
- package/dist/hint/index.d.ts +4 -0
- package/dist/hint/index.d.ts.map +1 -0
- package/dist/hint/index.js +3 -0
- package/dist/hint/index.js.map +1 -0
- package/dist/index.d.ts +27 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/inspector/inspector.css +27 -0
- package/dist/inspector/inspector.d.ts +12 -1
- package/dist/inspector/inspector.d.ts.map +1 -1
- package/dist/inspector/inspector.js +6 -3
- package/dist/inspector/inspector.js.map +1 -1
- package/dist/look-picker/index.d.ts +3 -0
- package/dist/look-picker/index.d.ts.map +1 -0
- package/dist/look-picker/index.js +2 -0
- package/dist/look-picker/index.js.map +1 -0
- package/dist/look-picker/look-picker.css +90 -0
- package/dist/look-picker/look-picker.d.ts +40 -0
- package/dist/look-picker/look-picker.d.ts.map +1 -0
- package/dist/look-picker/look-picker.js +82 -0
- package/dist/look-picker/look-picker.js.map +1 -0
- package/dist/look-thumb/index.d.ts +3 -0
- package/dist/look-thumb/index.d.ts.map +1 -0
- package/dist/look-thumb/index.js +2 -0
- package/dist/look-thumb/index.js.map +1 -0
- package/dist/look-thumb/look-thumb.css +7 -0
- package/dist/look-thumb/look-thumb.d.ts +27 -0
- package/dist/look-thumb/look-thumb.d.ts.map +1 -0
- package/dist/look-thumb/look-thumb.js +15 -0
- package/dist/look-thumb/look-thumb.js.map +1 -0
- package/dist/material/index.d.ts +3 -0
- package/dist/material/index.d.ts.map +1 -0
- package/dist/material/index.js +2 -0
- package/dist/material/index.js.map +1 -0
- package/dist/material/material.css +306 -0
- package/dist/material/material.d.ts +43 -0
- package/dist/material/material.d.ts.map +1 -0
- package/dist/material/material.js +27 -0
- package/dist/material/material.js.map +1 -0
- package/dist/on-media/on-media.css +6 -6
- package/dist/prompt-field/index.d.ts +3 -0
- package/dist/prompt-field/index.d.ts.map +1 -0
- package/dist/prompt-field/index.js +2 -0
- package/dist/prompt-field/index.js.map +1 -0
- package/dist/prompt-field/prompt-field.css +203 -0
- package/dist/prompt-field/prompt-field.d.ts +72 -0
- package/dist/prompt-field/prompt-field.d.ts.map +1 -0
- package/dist/prompt-field/prompt-field.js +91 -0
- package/dist/prompt-field/prompt-field.js.map +1 -0
- package/dist/quick-action/index.d.ts +1 -1
- package/dist/quick-action/index.d.ts.map +1 -1
- package/dist/quick-action/quick-action.css +60 -17
- package/dist/quick-action/quick-action.d.ts +34 -28
- package/dist/quick-action/quick-action.d.ts.map +1 -1
- package/dist/quick-action/quick-action.js +25 -21
- package/dist/quick-action/quick-action.js.map +1 -1
- package/dist/row-list/row-list.css +3 -0
- package/dist/seed-color-field/index.d.ts +3 -0
- package/dist/seed-color-field/index.d.ts.map +1 -0
- package/dist/seed-color-field/index.js +2 -0
- package/dist/seed-color-field/index.js.map +1 -0
- package/dist/seed-color-field/seed-color-field.css +105 -0
- package/dist/seed-color-field/seed-color-field.d.ts +36 -0
- package/dist/seed-color-field/seed-color-field.d.ts.map +1 -0
- package/dist/seed-color-field/seed-color-field.js +103 -0
- package/dist/seed-color-field/seed-color-field.js.map +1 -0
- package/dist/skeleton/index.d.ts +3 -0
- package/dist/skeleton/index.d.ts.map +1 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/skeleton/skeleton.css +84 -0
- package/dist/skeleton/skeleton.d.ts +50 -0
- package/dist/skeleton/skeleton.d.ts.map +1 -0
- package/dist/skeleton/skeleton.js +25 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/slide-list/index.d.ts +1 -1
- package/dist/slide-list/index.d.ts.map +1 -1
- package/dist/slide-list/slide-list.css +259 -22
- package/dist/slide-list/slide-list.d.ts +78 -1
- package/dist/slide-list/slide-list.d.ts.map +1 -1
- package/dist/slide-list/slide-list.js +264 -18
- package/dist/slide-list/slide-list.js.map +1 -1
- package/dist/split/split.css +8 -10
- package/dist/thread/thread.css +7 -39
- package/dist/thread/thread.d.ts.map +1 -1
- package/dist/thread/thread.js +44 -45
- package/dist/thread/thread.js.map +1 -1
- package/dist/tile-picker/tile-picker.css +18 -0
- package/dist/tile-picker/tile-picker.d.ts +12 -2
- package/dist/tile-picker/tile-picker.d.ts.map +1 -1
- package/dist/tile-picker/tile-picker.js +19 -4
- package/dist/tile-picker/tile-picker.js.map +1 -1
- package/dist/workbench/workbench.css +55 -16
- package/dist/workbench/workbench.d.ts +7 -2
- package/dist/workbench/workbench.d.ts.map +1 -1
- package/dist/workbench/workbench.js +8 -2
- package/dist/workbench/workbench.js.map +1 -1
- package/package.json +61 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What a part is made of (Joshua 2026-11-11). Three materials:
|
|
4
|
+
* glass the translucent control layer: bars, menus, the prompt field, the raised primary button
|
|
5
|
+
* crystal an inset screen with bezels that content sits on (Show's slide area, Workbench C2)
|
|
6
|
+
* solid plain, the default: no boundary above means solid
|
|
7
|
+
*/
|
|
8
|
+
export type MaterialKind = 'glass' | 'crystal' | 'solid';
|
|
9
|
+
export type MaterialProps = ({
|
|
10
|
+
glass: true;
|
|
11
|
+
crystal?: never;
|
|
12
|
+
solid?: never;
|
|
13
|
+
} | {
|
|
14
|
+
crystal: true;
|
|
15
|
+
glass?: never;
|
|
16
|
+
solid?: never;
|
|
17
|
+
} | {
|
|
18
|
+
solid: true;
|
|
19
|
+
glass?: never;
|
|
20
|
+
crystal?: never;
|
|
21
|
+
}) & {
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
/** The nearest material boundary's kind: for client parts, for native and for anything moved out of the DOM tree. */
|
|
26
|
+
export declare const MaterialContext: import("react").Context<MaterialKind | null>;
|
|
27
|
+
/**
|
|
28
|
+
* The material its contents wear. Like Surface it is an attribute (`data-newtone-material`) the stylesheet reads, and
|
|
29
|
+
* unlike Surface it is also a React context, so a part rendered elsewhere still knows. The wrapper takes no room
|
|
30
|
+
* (`display: contents`), so it is safe in a flex row. The nearest boundary wins; a `solid` one ends the glass above
|
|
31
|
+
* it. Blueprint components/material.md.
|
|
32
|
+
*/
|
|
33
|
+
export declare function Material(props: MaterialProps): import("react").JSX.Element;
|
|
34
|
+
/** The material of the nearest boundary above, or null when there is none (solid). */
|
|
35
|
+
export declare function useMaterial(): MaterialKind | null;
|
|
36
|
+
/**
|
|
37
|
+
* For a part that is a boundary by what it is (Canvas.Dock, a Workbench foot): the attribute it stamps on its own root.
|
|
38
|
+
* Internal: not exported from the index.
|
|
39
|
+
*/
|
|
40
|
+
export declare function materialRoot(kind: MaterialKind | null): {
|
|
41
|
+
'data-newtone-material'?: MaterialKind;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=material.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material.d.ts","sourceRoot":"","sources":["../../src/material/material.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAExD,MAAM,MAAM,aAAa,GAAG,CACtB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/C;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/C;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CACpD,GAAG;IACA,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qHAAqH;AACrH,eAAO,MAAM,eAAe,8CAA2C,CAAA;AAEvE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAS5C;AAED,sFAAsF;AACtF,wBAAgB,WAAW,IAAI,YAAY,GAAG,IAAI,CAEjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,GAAG;IAAE,uBAAuB,CAAC,EAAE,YAAY,CAAA;CAAE,CAElG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
/** The nearest material boundary's kind: for client parts, for native and for anything moved out of the DOM tree. */
|
|
5
|
+
export const MaterialContext = createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* The material its contents wear. Like Surface it is an attribute (`data-newtone-material`) the stylesheet reads, and
|
|
8
|
+
* unlike Surface it is also a React context, so a part rendered elsewhere still knows. The wrapper takes no room
|
|
9
|
+
* (`display: contents`), so it is safe in a flex row. The nearest boundary wins; a `solid` one ends the glass above
|
|
10
|
+
* it. Blueprint components/material.md.
|
|
11
|
+
*/
|
|
12
|
+
export function Material(props) {
|
|
13
|
+
const kind = props.glass ? 'glass' : props.crystal ? 'crystal' : 'solid';
|
|
14
|
+
return (_jsx(MaterialContext.Provider, { value: kind, children: _jsx("div", { className: ['newtone-material', props.className].filter(Boolean).join(' '), "data-newtone-material": kind, children: props.children }) }));
|
|
15
|
+
}
|
|
16
|
+
/** The material of the nearest boundary above, or null when there is none (solid). */
|
|
17
|
+
export function useMaterial() {
|
|
18
|
+
return useContext(MaterialContext);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* For a part that is a boundary by what it is (Canvas.Dock, a Workbench foot): the attribute it stamps on its own root.
|
|
22
|
+
* Internal: not exported from the index.
|
|
23
|
+
*/
|
|
24
|
+
export function materialRoot(kind) {
|
|
25
|
+
return kind ? { 'data-newtone-material': kind } : {};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=material.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material.js","sourceRoot":"","sources":["../../src/material/material.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAA;AAmBjE,qHAAqH;AACrH,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAsB,IAAI,CAAC,CAAA;AAEvE;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoB;IACzC,MAAM,IAAI,GAAiB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAA;IACtF,OAAO,CACH,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YACjC,cAAK,SAAS,EAAE,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,2BAAyB,IAAI,YACvG,KAAK,CAAC,QAAQ,GACb,GACiB,CAC9B,CAAA;AACL,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,WAAW;IACvB,OAAO,UAAU,CAAC,eAAe,CAAC,CAAA;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAyB;IAClD,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACxD,CAAC"}
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
* 20px glyph inside a 24px leading -- the exact defect Control shipped with on 2026-09-16. The 48 is
|
|
95
95
|
* `size="xl"`, a rung, and the rung carries the glyph with it. components/control.md.
|
|
96
96
|
*
|
|
97
|
-
* THE BLUR
|
|
98
|
-
* trade travels with it: a photograph carries high-frequency detail and a translucent plate inherits
|
|
97
|
+
* THE BLUR is `blur.regular` (16px), a token since 2026-11-11 (Joshua). It is load-bearing
|
|
98
|
+
* rather than decorative and the trade travels with it: a photograph carries high-frequency detail and a translucent plate inherits
|
|
99
99
|
* it straight through, so blurring the backdrop removes the frequency and keeps the colour, and that
|
|
100
100
|
* is what lets the fill sit at 45% instead of the ~100% an unblurred plate would need. **Where
|
|
101
101
|
* `backdrop-filter` is unsupported this degrades to a black glyph on a flat 45% wash**, which is
|
|
@@ -143,8 +143,8 @@
|
|
|
143
143
|
/* The ring's gradient, by state, from 0.15.0: rest here, hover and pressed below. */
|
|
144
144
|
--_on-media-rim: var(--newtone-on-media-control-rest-border);
|
|
145
145
|
|
|
146
|
-
-webkit-backdrop-filter: blur(
|
|
147
|
-
backdrop-filter: blur(
|
|
146
|
+
-webkit-backdrop-filter: blur(var(--newtone-blur-regular));
|
|
147
|
+
backdrop-filter: blur(var(--newtone-blur-regular));
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
.newtone-on-media-control:hover {
|
|
@@ -216,8 +216,8 @@
|
|
|
216
216
|
color: var(--newtone-on-media-control-rest-text);
|
|
217
217
|
border: 1px solid transparent;
|
|
218
218
|
border-radius: 50%;
|
|
219
|
-
-webkit-backdrop-filter: blur(
|
|
220
|
-
backdrop-filter: blur(
|
|
219
|
+
-webkit-backdrop-filter: blur(var(--newtone-blur-regular));
|
|
220
|
+
backdrop-filter: blur(var(--newtone-blur-regular));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/* The filled action, and it is three declarations because it is PAINT and not a box.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompt-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompt-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/* PromptField -- blueprint components/prompt-field.md, contract contracts/prompt-field.md. The major input (Joshua
|
|
2
|
+
* 2026-11-11): a pill one line tall that grows into a rounded panel, its words, then its send.
|
|
3
|
+
*
|
|
4
|
+
* THIS SHEET DRAWS THE SOLID FIELD. On glass (the default) material.css paints it: the regular glass at rest, solid
|
|
5
|
+
* while focused, its words at rest.text and its hint and glyphs at hint.text. Solid, it is a recess: the secondary
|
|
6
|
+
* surface, the primary text role.
|
|
7
|
+
*
|
|
8
|
+
* THE HEIGHT COMES FROM THE SEND. The send stands in the pill's end as a disc concentric with it, so the room round
|
|
9
|
+
* it is the same on every side; the words' line is centred on the send's height. One line is the rung exactly, with or
|
|
10
|
+
* without a send.
|
|
11
|
+
*
|
|
12
|
+
* LENGTHS IT DECIDES:
|
|
13
|
+
* 40px / 32px `sm`, the pill and its send (Show's notes)
|
|
14
|
+
* 44px / 36px `md` (a thread's comment box)
|
|
15
|
+
* 48px / 36px `lg` (a chat's composer)
|
|
16
|
+
* 56px / 40px `xl` (the launcher's field)
|
|
17
|
+
* 1px the edge, transparent unless glass paints it
|
|
18
|
+
* half the rung its corners, kept as it grows, so one line is a pill and many a rounded panel
|
|
19
|
+
* 12px the grip's strip across the top (`resize`), and in it a 2.5rem by 4px bar, 4px down: above the
|
|
20
|
+
* first line's words on the smallest rung */
|
|
21
|
+
|
|
22
|
+
.newtone-prompt-field {
|
|
23
|
+
--_prompt-field-box: 48px;
|
|
24
|
+
--_prompt-field-send: 36px;
|
|
25
|
+
/* The room round the send, inside the 1px edge. */
|
|
26
|
+
--_prompt-field-pad: calc((var(--_prompt-field-box) - var(--_prompt-field-send)) / 2 - 1px);
|
|
27
|
+
position: relative;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: flex-end;
|
|
30
|
+
gap: var(--newtone-space-1);
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
inline-size: 100%;
|
|
33
|
+
min-inline-size: 0;
|
|
34
|
+
min-block-size: var(--_prompt-field-box);
|
|
35
|
+
padding: var(--_prompt-field-pad);
|
|
36
|
+
border: 1px solid transparent;
|
|
37
|
+
border-radius: calc(var(--_prompt-field-box) / 2);
|
|
38
|
+
background: var(--newtone-role-surface-secondary);
|
|
39
|
+
color: var(--newtone-role-text-primary);
|
|
40
|
+
font-family: var(--newtone-text-scale-body-family);
|
|
41
|
+
font-variation-settings: var(--newtone-text-scale-body-variation);
|
|
42
|
+
font-size: var(--newtone-text-scale-body-size);
|
|
43
|
+
line-height: var(--newtone-text-scale-body-leading);
|
|
44
|
+
letter-spacing: var(--newtone-text-scale-body-tracking);
|
|
45
|
+
}
|
|
46
|
+
.newtone-prompt-field[data-size='sm'],
|
|
47
|
+
.newtone-prompt-field[data-size='md'] {
|
|
48
|
+
font-family: var(--newtone-text-scale-body-sm-family);
|
|
49
|
+
font-variation-settings: var(--newtone-text-scale-body-sm-variation);
|
|
50
|
+
font-size: var(--newtone-text-scale-body-sm-size);
|
|
51
|
+
line-height: var(--newtone-text-scale-body-sm-leading);
|
|
52
|
+
letter-spacing: var(--newtone-text-scale-body-sm-tracking);
|
|
53
|
+
}
|
|
54
|
+
.newtone-prompt-field[data-size='sm'] {
|
|
55
|
+
--_prompt-field-box: 40px;
|
|
56
|
+
--_prompt-field-send: 32px;
|
|
57
|
+
}
|
|
58
|
+
.newtone-prompt-field[data-size='md'] {
|
|
59
|
+
--_prompt-field-box: 44px;
|
|
60
|
+
--_prompt-field-send: 36px;
|
|
61
|
+
}
|
|
62
|
+
.newtone-prompt-field[data-size='xl'] {
|
|
63
|
+
--_prompt-field-box: 56px;
|
|
64
|
+
--_prompt-field-send: 40px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* The words: one line centred on the send's height; multiline, growing to `lines` (and no taller than its room), then
|
|
68
|
+
* scrolling. */
|
|
69
|
+
.newtone-prompt-field-input {
|
|
70
|
+
flex: 1 1 auto;
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
min-inline-size: 0;
|
|
73
|
+
min-block-size: var(--_prompt-field-send);
|
|
74
|
+
margin: 0;
|
|
75
|
+
padding: calc((var(--_prompt-field-send) - 1lh) / 2) var(--newtone-space-2);
|
|
76
|
+
border: 0;
|
|
77
|
+
outline: none;
|
|
78
|
+
resize: none;
|
|
79
|
+
background: transparent;
|
|
80
|
+
color: inherit;
|
|
81
|
+
font: inherit;
|
|
82
|
+
letter-spacing: inherit;
|
|
83
|
+
}
|
|
84
|
+
textarea.newtone-prompt-field-input {
|
|
85
|
+
field-sizing: content;
|
|
86
|
+
max-block-size: min(
|
|
87
|
+
calc(var(--_prompt-field-lines, 8) * 1lh + var(--_prompt-field-send) - 1lh),
|
|
88
|
+
calc(var(--_prompt-field-room, 100vh) - var(--_prompt-field-box) + var(--_prompt-field-send))
|
|
89
|
+
);
|
|
90
|
+
overflow-y: auto;
|
|
91
|
+
}
|
|
92
|
+
/* Dragged to a height: the words fill it and scroll. */
|
|
93
|
+
textarea.newtone-prompt-field-input[data-sized] {
|
|
94
|
+
align-self: stretch;
|
|
95
|
+
field-sizing: fixed;
|
|
96
|
+
block-size: auto;
|
|
97
|
+
max-block-size: none;
|
|
98
|
+
}
|
|
99
|
+
.newtone-prompt-field-input::placeholder,
|
|
100
|
+
.newtone-prompt-field-hint {
|
|
101
|
+
color: var(--newtone-role-text-secondary);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Folded (`fold`): its first line, cut with an ellipsis, as a button that opens it. */
|
|
105
|
+
.newtone-prompt-field-folded {
|
|
106
|
+
all: unset;
|
|
107
|
+
flex: 1 1 auto;
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
min-inline-size: 0;
|
|
112
|
+
min-block-size: var(--_prompt-field-send);
|
|
113
|
+
padding-inline: var(--newtone-space-2);
|
|
114
|
+
cursor: text;
|
|
115
|
+
}
|
|
116
|
+
.newtone-prompt-field-folded:focus-visible {
|
|
117
|
+
outline: 2px solid var(--newtone-role-text-accent);
|
|
118
|
+
outline-offset: -2px;
|
|
119
|
+
border-radius: calc(var(--_prompt-field-send) / 2);
|
|
120
|
+
}
|
|
121
|
+
.newtone-prompt-field-words {
|
|
122
|
+
display: block;
|
|
123
|
+
min-inline-size: 0;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
text-overflow: ellipsis;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* What stands before and after the words: centred on the send's height, so they stay on the last line's level. */
|
|
130
|
+
.newtone-prompt-field-slot {
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
flex: none;
|
|
134
|
+
gap: var(--newtone-space-1);
|
|
135
|
+
min-block-size: var(--_prompt-field-send);
|
|
136
|
+
color: var(--newtone-role-text-secondary);
|
|
137
|
+
}
|
|
138
|
+
.newtone-prompt-field-end {
|
|
139
|
+
color: inherit;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* The built-in send: a disc the send's size. With words, a primary Button's fill (on glass, raised: material.css);
|
|
143
|
+
* empty or working, no fill and the disabled ink. Hover and press are written under `:where` so the glass, when it
|
|
144
|
+
* raises it, wins. */
|
|
145
|
+
.newtone-prompt-field-send {
|
|
146
|
+
all: unset;
|
|
147
|
+
flex: none;
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
display: inline-grid;
|
|
150
|
+
place-items: center;
|
|
151
|
+
inline-size: var(--_prompt-field-send);
|
|
152
|
+
block-size: var(--_prompt-field-send);
|
|
153
|
+
border: 1px solid transparent;
|
|
154
|
+
border-radius: 50%;
|
|
155
|
+
background: var(--newtone-button-primary-rest-fill);
|
|
156
|
+
color: var(--newtone-button-primary-rest-text);
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
.newtone-prompt-field-send:where(:hover) {
|
|
160
|
+
background: var(--newtone-button-primary-hover-fill);
|
|
161
|
+
}
|
|
162
|
+
.newtone-prompt-field-send:where(:active) {
|
|
163
|
+
background: var(--newtone-button-primary-pressed-fill);
|
|
164
|
+
}
|
|
165
|
+
.newtone-prompt-field-send:where(:disabled) {
|
|
166
|
+
background: transparent;
|
|
167
|
+
color: var(--newtone-role-text-disabled);
|
|
168
|
+
cursor: default;
|
|
169
|
+
}
|
|
170
|
+
.newtone-prompt-field-send:focus-visible {
|
|
171
|
+
outline: 2px solid var(--newtone-role-text-accent);
|
|
172
|
+
outline-offset: 2px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* `resize`: the grip across its top, always shown. */
|
|
176
|
+
.newtone-prompt-field-grip {
|
|
177
|
+
position: absolute;
|
|
178
|
+
inset-block-start: 0;
|
|
179
|
+
inset-inline: 0;
|
|
180
|
+
z-index: 1;
|
|
181
|
+
block-size: 12px;
|
|
182
|
+
cursor: ns-resize;
|
|
183
|
+
touch-action: none;
|
|
184
|
+
outline: none;
|
|
185
|
+
}
|
|
186
|
+
.newtone-prompt-field-grip::after {
|
|
187
|
+
content: '';
|
|
188
|
+
position: absolute;
|
|
189
|
+
inset-block-start: 4px;
|
|
190
|
+
inset-inline-start: 50%;
|
|
191
|
+
inline-size: 2.5rem;
|
|
192
|
+
block-size: 4px;
|
|
193
|
+
margin-inline-start: -1.25rem;
|
|
194
|
+
border-radius: 999px;
|
|
195
|
+
background: var(--newtone-role-divider-primary);
|
|
196
|
+
}
|
|
197
|
+
.newtone-prompt-field-grip:hover::after,
|
|
198
|
+
.newtone-prompt-field-grip[data-dragging]::after {
|
|
199
|
+
background: var(--newtone-role-text-secondary);
|
|
200
|
+
}
|
|
201
|
+
.newtone-prompt-field-grip:focus-visible::after {
|
|
202
|
+
background: var(--newtone-role-text-accent);
|
|
203
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type KeyboardEvent, type ReactNode, type Ref, type TextareaHTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Four rungs (Joshua 2026-11-11), each the height one line of it keeps today: `sm` 40 (Show's notes), `md` 44 (a
|
|
4
|
+
* thread's comment box), `lg` 48 (a chat's composer), `xl` 56 (the launcher's field).
|
|
5
|
+
*/
|
|
6
|
+
export type PromptFieldSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
/** The built-in send: a round button with an arrow, named. */
|
|
8
|
+
export interface PromptFieldSend {
|
|
9
|
+
/** Its accessible name: "Send". */
|
|
10
|
+
label: string;
|
|
11
|
+
/** An `Icon` name in place of the arrow (`arrow_upward`). */
|
|
12
|
+
icon?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PromptFieldProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue' | 'onChange' | 'onSubmit' | 'onKeyDown' | 'children' | 'rows' | 'cols' | 'wrap' | 'placeholder' | 'aria-label'> {
|
|
15
|
+
/** Its accessible name, always: the field has no visible label. */
|
|
16
|
+
label: string;
|
|
17
|
+
value: string;
|
|
18
|
+
/** Each change, with where the caret stands after it (a mention list reads the words before it). */
|
|
19
|
+
onValueChange: (value: string, caret: number) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Enter (not with Shift, not while an input method composes, not on a touch screen's return key in a multiline
|
|
22
|
+
* field) and the built-in send: the words trimmed. Empty words, or `busy`, send nothing. Left out, Enter is a new
|
|
23
|
+
* line in a multiline field.
|
|
24
|
+
*/
|
|
25
|
+
onSubmit?: (value: string) => void;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
/** A field that grows from one line to `lines`, then scrolls. Left out, one line (an `<input>`). */
|
|
28
|
+
multiline?: boolean;
|
|
29
|
+
/** How many lines a multiline field grows to before it scrolls. 8 by default. */
|
|
30
|
+
lines?: number;
|
|
31
|
+
/** `lg` (48) by default. */
|
|
32
|
+
size?: PromptFieldSize;
|
|
33
|
+
/** Before the words: a glyph, an attach button, chips. */
|
|
34
|
+
leading?: ReactNode;
|
|
35
|
+
/** After the words, before the send: other controls. */
|
|
36
|
+
trailing?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* The send at its end. An object gives the built-in round send; a node is used as given (an `AskButton`, whose
|
|
39
|
+
* `onClick` the caller wires).
|
|
40
|
+
*/
|
|
41
|
+
send?: PromptFieldSend | ReactNode;
|
|
42
|
+
/** Working: the send waits and Enter sends nothing; the words stay editable. */
|
|
43
|
+
busy?: boolean;
|
|
44
|
+
/** Multiline: at rest its first line only, cut with an ellipsis; pressed or focused, it opens. */
|
|
45
|
+
fold?: boolean;
|
|
46
|
+
/** Multiline: a grip on its top to drag its height (below/grip.ts). Its words: the grip's name ("Resize notes"). */
|
|
47
|
+
resize?: {
|
|
48
|
+
label: string;
|
|
49
|
+
};
|
|
50
|
+
/** The height dragged to, in px, or null (one line). Left out, the field keeps its own. */
|
|
51
|
+
height?: number | null;
|
|
52
|
+
onHeight?: (px: number | null) => void;
|
|
53
|
+
/** The `<input>` or `<textarea>`. */
|
|
54
|
+
inputRef?: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
55
|
+
/**
|
|
56
|
+
* Runs first. `e.preventDefault()` skips the field's own Enter (a mention list, a launcher's listbox that takes the
|
|
57
|
+
* key itself).
|
|
58
|
+
*/
|
|
59
|
+
onKeyDown?: (e: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The major input (Joshua 2026-11-11): the sentence a person came to say, to the assistant, a thread, a chat. **Glass at
|
|
63
|
+
* rest and solid while focused**, so what passes behind it softens to colour and what is typed reads on a plain fill.
|
|
64
|
+
* Its words on glass are pure black or white, quieter at rest (75%), the hint and glyphs at 50%. A property value
|
|
65
|
+
* ("4px") goes in a TextField or NumberField, never here. It is not a `<form>`, so it sits inside one.
|
|
66
|
+
*
|
|
67
|
+
* It wears the material above it (`useMaterial()`): solid inside a solid boundary (a thread card that holds comments),
|
|
68
|
+
* glass anywhere else, crystal included (a field over the screen is on the glass). Blueprint components/prompt-field.md,
|
|
69
|
+
* contract contracts/prompt-field.md.
|
|
70
|
+
*/
|
|
71
|
+
export declare function PromptField({ label, value, onValueChange, onSubmit, placeholder, multiline, lines, size, leading, trailing, send, busy, fold, resize, height, onHeight, inputRef, onKeyDown, onBlur, className, style, readOnly, ...rest }: PromptFieldProps): import("react").JSX.Element;
|
|
72
|
+
//# sourceMappingURL=prompt-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-field.d.ts","sourceRoot":"","sources":["../../src/prompt-field/prompt-field.tsx"],"names":[],"mappings":"AAEA,OAAO,EAUH,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,sBAAsB,EAC9B,MAAM,OAAO,CAAA;AAMd;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvD,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC5B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,gBACb,SAAQ,IAAI,CACR,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,CAC1I;IACD,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,oGAAoG;I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Z,IAAY,EACZ,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,gBAAgB,+BA6HlB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { isValidElement, useContext, useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { Icon } from '../icon/icon.js';
|
|
5
|
+
import { MaterialContext, useMaterial } from '../material/material.js';
|
|
6
|
+
import { BelowRoom } from '../below/room.js';
|
|
7
|
+
import { useGrip } from '../below/grip.js';
|
|
8
|
+
const SEND_GLYPH = 'arrow_upward';
|
|
9
|
+
/**
|
|
10
|
+
* The major input (Joshua 2026-11-11): the sentence a person came to say, to the assistant, a thread, a chat. **Glass at
|
|
11
|
+
* rest and solid while focused**, so what passes behind it softens to colour and what is typed reads on a plain fill.
|
|
12
|
+
* Its words on glass are pure black or white, quieter at rest (75%), the hint and glyphs at 50%. A property value
|
|
13
|
+
* ("4px") goes in a TextField or NumberField, never here. It is not a `<form>`, so it sits inside one.
|
|
14
|
+
*
|
|
15
|
+
* It wears the material above it (`useMaterial()`): solid inside a solid boundary (a thread card that holds comments),
|
|
16
|
+
* glass anywhere else, crystal included (a field over the screen is on the glass). Blueprint components/prompt-field.md,
|
|
17
|
+
* contract contracts/prompt-field.md.
|
|
18
|
+
*/
|
|
19
|
+
export function PromptField({ label, value, onValueChange, onSubmit, placeholder, multiline = false, lines = 8, size = 'lg', leading, trailing, send, busy = false, fold = false, resize, height, onHeight, inputRef, onKeyDown, onBlur, className, style, readOnly, ...rest }) {
|
|
20
|
+
const material = useMaterial() === 'solid' ? 'solid' : 'glass';
|
|
21
|
+
const root = useRef(null);
|
|
22
|
+
const own = useRef(null);
|
|
23
|
+
const room = useContext(BelowRoom);
|
|
24
|
+
const g = useGrip({ size: height, onSize: onHeight, box: root });
|
|
25
|
+
const sized = multiline && resize ? g.sized : null;
|
|
26
|
+
const [open, setOpen] = useState(false);
|
|
27
|
+
// Folded: one quiet line until pressed or focused, unless dragged open.
|
|
28
|
+
const folded = multiline && fold && !open && sized === null;
|
|
29
|
+
const words = value.trim();
|
|
30
|
+
const setRef = (el) => {
|
|
31
|
+
own.current = el;
|
|
32
|
+
if (typeof inputRef === 'function')
|
|
33
|
+
inputRef(el);
|
|
34
|
+
else if (inputRef)
|
|
35
|
+
inputRef.current = el;
|
|
36
|
+
};
|
|
37
|
+
// Opened from its folded line, the field takes the focus.
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (open)
|
|
40
|
+
own.current?.focus({ preventScroll: true });
|
|
41
|
+
}, [open]);
|
|
42
|
+
// A browser without `field-sizing` grows the field by its scroll height, as Thread's field did.
|
|
43
|
+
useLayoutEffect(() => {
|
|
44
|
+
const t = own.current;
|
|
45
|
+
if (!multiline || sized !== null || !t || typeof CSS === 'undefined' || CSS.supports('field-sizing', 'content'))
|
|
46
|
+
return;
|
|
47
|
+
t.style.blockSize = 'auto';
|
|
48
|
+
t.style.blockSize = `${t.scrollHeight}px`;
|
|
49
|
+
}, [value, multiline, sized, folded]);
|
|
50
|
+
const submit = () => {
|
|
51
|
+
if (!words || busy || readOnly)
|
|
52
|
+
return;
|
|
53
|
+
onSubmit?.(words);
|
|
54
|
+
};
|
|
55
|
+
const keys = (e) => {
|
|
56
|
+
onKeyDown?.(e);
|
|
57
|
+
// With nothing to send to (Show's notes), Enter is a new line, as in any field of words.
|
|
58
|
+
if (!onSubmit || e.defaultPrevented || e.key !== 'Enter' || e.shiftKey || e.nativeEvent.isComposing || e.keyCode === 229)
|
|
59
|
+
return;
|
|
60
|
+
// On a touch screen a multiline field's return key is a new line, and the send sends.
|
|
61
|
+
if (multiline && typeof window !== 'undefined' && window.matchMedia?.('(hover: none) and (pointer: coarse)').matches)
|
|
62
|
+
return;
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
submit();
|
|
65
|
+
};
|
|
66
|
+
const builtIn = send != null && typeof send === 'object' && !isValidElement(send) && 'label' in send;
|
|
67
|
+
const sendEl = builtIn ? (_jsx("button", { type: "button", className: ['newtone-prompt-field-send', words && !busy && !readOnly ? 'newtone-glass--action' : null].filter(Boolean).join(' '), "aria-label": send.label, title: send.label, disabled: !words || busy || readOnly, onClick: submit, children: _jsx(Icon, { name: send.icon ?? SEND_GLYPH, size: "sm" }) })) : send != null && send !== false ? (_jsx("span", { className: "newtone-prompt-field-slot newtone-prompt-field-end", children: send })) : null;
|
|
68
|
+
const first = value.split('\n').find((l) => l.trim()) ?? '';
|
|
69
|
+
const common = {
|
|
70
|
+
...rest,
|
|
71
|
+
className: 'newtone-prompt-field-input',
|
|
72
|
+
'aria-label': label,
|
|
73
|
+
value,
|
|
74
|
+
placeholder,
|
|
75
|
+
readOnly,
|
|
76
|
+
onKeyDown: keys,
|
|
77
|
+
onBlur: (e) => {
|
|
78
|
+
setOpen(false);
|
|
79
|
+
onBlur?.(e);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
const field = folded ? (_jsx("button", { type: "button", className: "newtone-prompt-field-folded", "aria-label": first ? `${label}: ${first}` : label, onClick: () => setOpen(true), children: _jsx("span", { className: first ? 'newtone-prompt-field-words' : 'newtone-prompt-field-words newtone-prompt-field-hint', children: first || placeholder }) })) : multiline ? (_jsx("textarea", { ...common, ref: setRef, rows: 1, "data-sized": sized !== null ? '' : undefined, onChange: (e) => onValueChange(e.target.value, e.target.selectionStart) })) : (_jsx("input", { ...common, ref: setRef, type: "text", onChange: (e) => onValueChange(e.target.value, e.target.selectionStart ?? e.target.value.length) }));
|
|
83
|
+
const vars = {
|
|
84
|
+
'--_prompt-field-lines': lines,
|
|
85
|
+
...(room != null ? { '--_prompt-field-room': `${room}px` } : {}),
|
|
86
|
+
...(sized !== null ? { blockSize: sized } : {}),
|
|
87
|
+
...style,
|
|
88
|
+
};
|
|
89
|
+
return (_jsx(MaterialContext.Provider, { value: material, children: _jsxs("div", { ref: root, className: ['newtone-prompt-field', 'newtone-glass--field', className].filter(Boolean).join(' '), "data-newtone-material": material, "data-size": size, "data-multiline": multiline ? '' : undefined, "data-folded": folded ? '' : undefined, "data-sized": sized !== null ? '' : undefined, "data-resizable": multiline && resize ? '' : undefined, "data-busy": busy ? '' : undefined, style: vars, children: [multiline && resize ? _jsx("div", { className: "newtone-prompt-field-grip", "aria-label": resize.label, ...g.props }) : null, leading ? _jsx("span", { className: "newtone-prompt-field-slot", children: leading }) : null, field, trailing ? _jsx("span", { className: "newtone-prompt-field-slot", children: trailing }) : null, sendEl] }) }));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=prompt-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-field.js","sourceRoot":"","sources":["../../src/prompt-field/prompt-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EACH,cAAc,EACd,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GAQX,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAkE1C,MAAM,UAAU,GAAG,cAAc,CAAA;AAEjC;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,EACxB,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,EACR,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,CAAC,EACT,IAAI,GAAG,IAAI,EACX,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,IAAI,GAAG,KAAK,EACZ,IAAI,GAAG,KAAK,EACZ,MAAM,EAC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
|
-
export type { QuickActionProps } from './quick-action.js';
|
|
3
|
+
export type { QuickActionProps, QuickActionSize, QuickActionVariant } from './quick-action.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quick-action/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quick-action/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA"}
|