@gemboss/ui 0.67.0 → 0.69.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +179 -4
  2. package/README.md +89 -9
  3. package/catalog/editor.html +10 -8
  4. package/catalog/index.html +615 -564
  5. package/gemboss-ui.css +3 -3
  6. package/package.json +5 -2
  7. package/parts/components.css +1 -1
  8. package/parts/core.css +1 -1
  9. package/parts/shell.css +1 -1
  10. package/src/assistant/attachments.tsx +486 -0
  11. package/src/assistant/chat-cards.tsx +343 -0
  12. package/src/assistant/chat.tsx +29 -6
  13. package/src/assistant/host.tsx +8 -11
  14. package/src/assistant/index.ts +8 -1
  15. package/src/assistant-chat.css +1 -1
  16. package/src/assistant-plain.js +1 -1
  17. package/src/assistant.css +1 -1
  18. package/src/auth-field.css +1 -1
  19. package/src/auth.tsx +4 -2
  20. package/src/chat-attachments.css +1 -0
  21. package/src/chat-cards.css +1 -0
  22. package/src/chat-plain.js +5 -5
  23. package/src/collections.tsx +8 -1
  24. package/src/dialog.tsx +68 -11
  25. package/src/editor/controls.tsx +51 -10
  26. package/src/editor/field-control.tsx +26 -51
  27. package/src/editor/field-frame.tsx +4 -10
  28. package/src/editor/field-spec.ts +4 -2
  29. package/src/editor/grow-to-text.ts +51 -0
  30. package/src/editor/index.ts +2 -4
  31. package/src/editor/inspector-frame.tsx +143 -32
  32. package/src/editor/items-field.tsx +8 -3
  33. package/src/editor/items.ts +30 -6
  34. package/src/editor/panel.tsx +4 -5
  35. package/src/editor-grow.css +1 -1
  36. package/src/editor-inspector-frame.css +1 -1
  37. package/src/editor-media.css +1 -0
  38. package/src/editor-plain.js +1 -1
  39. package/src/editor-rail.css +1 -1
  40. package/src/editor.css +1 -1
  41. package/src/email-editor/editor.tsx +96 -69
  42. package/src/email-editor.css +1 -1
  43. package/src/gem-at-work.css +1 -1
  44. package/src/gem-at-work.ts +177 -33
  45. package/src/gem-holo.css +1 -1
  46. package/src/icons.tsx +42 -0
  47. package/src/index-table-extras.css +1 -0
  48. package/src/index-table.tsx +37 -16
  49. package/src/menu.tsx +7 -3
  50. package/src/narration.css +1 -1
  51. package/src/selection.tsx +22 -12
  52. package/src/editor/chips.tsx +0 -24
  53. package/src/editor-chips.css +0 -1
package/src/selection.tsx CHANGED
@@ -8,7 +8,7 @@
8
8
  * No "use client" of its own: only the two client modules import it (a server graph never reaches its hooks).
9
9
  */
10
10
  import "./collections.css"; // its own stylesheet travels with it (0.23.0): a surface that never renders it never loads it
11
- import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
11
+ import React, { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
12
12
  import { Icon } from "./icons";
13
13
  import { Menu, MenuItem } from "./menu";
14
14
 
@@ -83,11 +83,17 @@ const btnClass = (b: BulkAction) => (b.tone === "critical" ? "ui-btn ui-btn--sm
83
83
  * short actions stay buttons at 320 and five long ones fold at 768. Before, the bar wrapped: talent-radar /pool's five
84
84
  * actions made it three rows (~150px) at 390, every row of the list pushed down by it (10/10/2026). Until the first
85
85
  * measure (a server render, before hydration) the row does not wrap either; what does not fit is clipped for that
86
- * moment instead of pushing the list down and back up. */
87
- export function BulkBar({ actions, chosen, all, some, onToggleAll, selectedLabel, selectAllLabel, idle, boxDisabled, moreActionsLabel = "More actions" }: {
86
+ * moment instead of pushing the list down and back up.
87
+ *
88
+ * `idle="fold"`: as "hide" while the table has its header, but where it folds (and the header is gone) the bar stays, as the
89
+ * box and its words, so everything can be ticked before anything is. `busy`: a press is running, so the box and every action
90
+ * are off and the count says so. */
91
+ export function BulkBar({ actions, chosen, all, some, onToggleAll, selectedLabel, selectAllLabel, idle, boxDisabled, moreActionsLabel = "More actions", busy, busyLabel = "Working…" }: {
88
92
  actions: BulkAction[]; chosen: string[]; all: boolean; some: boolean; onToggleAll: (on: boolean) => void;
89
- selectedLabel: (n: number) => React.ReactNode; selectAllLabel: string; idle: "hide" | "disable"; boxDisabled?: boolean; moreActionsLabel?: string }) {
93
+ selectedLabel: (n: number) => React.ReactNode; selectAllLabel: string; idle: "hide" | "disable" | "fold"; boxDisabled?: boolean; moreActionsLabel?: string;
94
+ busy?: boolean; busyLabel?: React.ReactNode }) {
90
95
  const box = useRef<HTMLInputElement>(null);
96
+ const boxId = useId();
91
97
  const bar = useRef<HTMLDivElement>(null), measure = useRef<HTMLSpanElement>(null);
92
98
  // How many actions are buttons; null = not measured yet. One action never folds (a menu of one is a button in a box).
93
99
  const [shown, setShown] = useState<number | null>(null);
@@ -113,25 +119,29 @@ export function BulkBar({ actions, chosen, all, some, onToggleAll, selectedLabel
113
119
  ro.observe(el);
114
120
  ro.observe(m);
115
121
  return () => ro.disconnect();
116
- }, [n, actions.length, folds]);
117
- const off = idle === "disable" && n === 0;
122
+ }, [n, actions.length, folds, busy]);
123
+ const off = (idle === "disable" && n === 0) || !!busy;
124
+ // "fold" with nothing ticked is only the way to tick everything: there is nothing yet for an action to act on.
125
+ const onlyBox = idle === "fold" && n === 0;
118
126
  const k = folds ? shown ?? actions.length : actions.length;
119
127
  return (
120
- <div className="ui-bulkbar" ref={bar} hidden={idle === "hide" && n === 0} data-fit={folds && shown === null ? "pending" : undefined}>
121
- <label className="ui-table__checkbox"><input ref={box} type="checkbox" checked={all} aria-label={selectAllLabel} disabled={boxDisabled} onChange={(e) => onToggleAll(e.target.checked)} /></label>
122
- <span className="ui-bulkbar__count" aria-live="polite">{selectedLabel(n)}</span>
123
- <span className="ui-bulkbar__actions">
128
+ <div className="ui-bulkbar" ref={bar} hidden={idle === "hide" && n === 0} data-idle={onlyBox ? "fold" : undefined} data-fit={folds && shown === null ? "pending" : undefined}>
129
+ <label className="ui-table__checkbox"><input ref={box} id={boxId} type="checkbox" checked={all} aria-label={selectAllLabel} disabled={boxDisabled || busy} onChange={(e) => onToggleAll(e.target.checked)} /></label>
130
+ {/* Alone in the bar these words are the box's label: pressing them does what they say. */}
131
+ {onlyBox ? <label className="ui-bulkbar__count" htmlFor={boxId}>{selectAllLabel}</label>
132
+ : <span className="ui-bulkbar__count" aria-live="polite">{selectedLabel(n)}{busy ? <> · {busyLabel}</> : null}</span>}
133
+ {onlyBox ? null : <span className="ui-bulkbar__actions">
124
134
  {actions.slice(0, k).map((b, i) => (
125
135
  <button key={i} type="button" className={btnClass(b)} disabled={off} onClick={() => b.onAction(chosen)}>{b.content}</button>
126
136
  ))}
127
137
  {k < actions.length ? (
128
- <Menu label={moreActionsLabel} end className="ui-bulkbar__more">
138
+ <Menu label={moreActionsLabel} end className="ui-bulkbar__more" disabled={busy}>
129
139
  {actions.slice(k).map((b, i) => (
130
140
  <MenuItem key={k + i} danger={b.tone === "critical"} disabled={off} onClick={() => b.onAction(chosen)}>{b.content}</MenuItem>
131
141
  ))}
132
142
  </Menu>
133
143
  ) : null}
134
- </span>
144
+ </span>}
135
145
  {folds ? (
136
146
  // The ruler: every action as a button plus the ⋯ trigger, invisible, out of the flow and of the tab order.
137
147
  <span className="ui-bulkbar__measure" ref={measure} aria-hidden="true">
@@ -1,24 +0,0 @@
1
- // GROUPS AS CHIPS (Control UI C32 slice 3, 31/10/2026; Chris chose "cả hai: gộp + lối tắt"). An element's settings are one long list
2
- // (C32), and the shared groups that hold nothing (Size, Shape, Effects, Align folded; Background, Hover not added) stacked one 37px
3
- // line each above Spacing. In a run of groups, a group the caller marks `data-chip` is drawn as a chip: its own first line (a folded
4
- // group's header, a + line's button) as a pill, side by side with the others, wrapping; every other group keeps the full width.
5
- //
6
- // · `div.gemboss-ei-chips` › the groups, in their own order › `.gemboss-ei-grp[data-chip]` › its head as the pill (no chevron).
7
- // · Pressed, a chip does what its line does (opens the group, adds it); the caller takes the mark off and the group draws whole
8
- // IN ITS PLACE. The group stays the same element under the same parent, so it is not drawn again from nothing and the focus stays
9
- // on it: a row of chips in a box of its own made every chip pressed a new element, and the focus fell to the page.
10
- // · 28px under a mouse, 44px under a finger; 8px apart.
11
- // Its own part (`editor-chips.css`): only a surface that draws chips loads it.
12
- import "../editor-chips.css";
13
- import type React from "react";
14
-
15
- export interface InspectorChipsProps {
16
- /** `data-*` attributes on the run itself: what a page finds it by. */
17
- attrs?: Record<`data-${string}`, string>;
18
- /** Inspector groups (`InspectorGroup`, or a line of the caller's that is a `.gemboss-ei-grp`); `data-chip` on one draws it as a chip. */
19
- children?: React.ReactNode;
20
- }
21
-
22
- export function InspectorChips({ attrs, children }: InspectorChipsProps) {
23
- return <div className="gemboss-ei-chips" {...attrs}>{children}</div>;
24
- }
@@ -1 +0,0 @@
1
- .gemboss-ei-chips{display:flex;flex-wrap:wrap;align-items:flex-start;column-gap:8px}.gemboss-ei-chips>*{flex:1 0 100%;min-width:0}.gemboss-ei-chips>.gemboss-ei-grp:last-child:not([data-chip]){border-bottom:1px solid var(--gemboss-divider-soft,#eceef2)}.gemboss-ei-chips>[data-chip]{flex:none;margin:8px 0 0;padding:0;border:0}.gemboss-ei-chips>[data-chip]:last-child{margin-bottom:8px}.gemboss-ei-chips>[data-chip]>:first-child{display:inline-flex;align-items:center;gap:4px;width:auto;min-height:28px;margin:0;padding:0 12px;border:1px solid var(--gemboss-divider,#e5e7ea);border-radius:999px;background:var(--gemboss-surface,#fff);color:var(--gemboss-text,#1b1c1e);font-size:13px;line-height:16px;font-weight:400}.gemboss-ei-chips>[data-chip]>:first-child:hover:not(:disabled){background:var(--gemboss-hover,#eceef2)}.gemboss-ei-chips>[data-chip] .gemboss-ei-chev{display:none}@media (pointer: coarse),(max-width:47.9975em){.gemboss-ei-chips>[data-chip]>:first-child{min-height:44px}}