@parallelworks/ui 0.54.0 → 0.56.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 (50) hide show
  1. package/README.md +65 -26
  2. package/dist/access/AccessDrawer.d.ts +30 -19
  3. package/dist/access/AccessDrawer.js +92 -67
  4. package/dist/access/AccessList.d.ts +17 -16
  5. package/dist/access/AccessList.js +218 -114
  6. package/dist/access/GrantView.d.ts +9 -8
  7. package/dist/access/GrantView.js +34 -36
  8. package/dist/access/PrincipalPicker.d.ts +38 -0
  9. package/dist/access/{GroupPicker.js → PrincipalPicker.js} +173 -80
  10. package/dist/access/index.d.ts +1 -1
  11. package/dist/access/model.d.ts +67 -24
  12. package/dist/access/model.js +111 -47
  13. package/dist/access/strings.d.ts +63 -39
  14. package/dist/access/strings.js +114 -84
  15. package/dist/access/types.d.ts +32 -14
  16. package/dist/ai/adapter/mock/mockAdapter.js +1 -1
  17. package/dist/ai/core/useSSEStream.d.ts +1 -1
  18. package/dist/components/Checkbox.js +1 -1
  19. package/dist/components/Combobox.js +25 -20
  20. package/dist/components/DatePicker.js +62 -58
  21. package/dist/components/Drawer.js +3 -1
  22. package/dist/components/Field.d.ts +8 -3
  23. package/dist/components/Field.js +32 -12
  24. package/dist/components/HoverCard.js +15 -10
  25. package/dist/components/InfoTip.d.ts +3 -1
  26. package/dist/components/InfoTip.js +2 -1
  27. package/dist/components/Menu.js +3 -0
  28. package/dist/components/Modal.js +32 -27
  29. package/dist/components/Popover.d.ts +4 -1
  30. package/dist/components/Popover.js +31 -26
  31. package/dist/components/Radio.js +1 -1
  32. package/dist/components/Select.js +47 -42
  33. package/dist/components/Slider.js +3 -3
  34. package/dist/components/Switch.js +1 -1
  35. package/dist/components/Tooltip.js +16 -11
  36. package/dist/components/fieldBox.js +1 -1
  37. package/dist/components/fullscreen.d.ts +4 -0
  38. package/dist/components/fullscreen.js +18 -0
  39. package/dist/editor/EditorField.js +1 -2
  40. package/dist/editor/Monaco.js +26 -2
  41. package/dist/editor/themes.js +1 -1
  42. package/dist/graph/GraphEditorDialogs.d.ts +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.js +2 -2
  45. package/dist/styles/theme.css +10 -10
  46. package/dist/styles.css +1 -1
  47. package/dist/theme/derive.d.ts +2 -0
  48. package/dist/theme/derive.js +25 -14
  49. package/package.json +2 -2
  50. package/dist/access/GroupPicker.d.ts +0 -35
@@ -17,6 +17,8 @@ export interface DeriveOptions {
17
17
  /** The surfaces placeholder and disabled text sit on: field boxes, and the bare inputs of
18
18
  * search bars, menus and dialogs that take their surface's background. */
19
19
  export declare const PLACEHOLDER_ON: ThemeToken[];
20
+ /** The surfaces a control's edge sits on: the page, panels, and the control's own fill. */
21
+ export declare const CONTROL_ON: ThemeToken[];
20
22
  /** Every token as sRGB, plus display-p3 overrides that keep every contrast the sRGB output meets. */
21
23
  export declare function generateTheme(scheme: Scheme, options?: DeriveOptions): GeneratedTheme;
22
24
  /** Every `--theme-*` token for a scheme, in sRGB. */
@@ -107,6 +107,13 @@ var PLACEHOLDER_ON = [
107
107
  "--theme-panel-bg",
108
108
  "--theme-muted-panel-bg"
109
109
  ];
110
+ /** The surfaces a control's edge sits on: the page, panels, and the control's own fill. */
111
+ var CONTROL_ON = [
112
+ "--theme-app-bg",
113
+ "--theme-panel-bg",
114
+ "--theme-muted-panel-bg",
115
+ "--theme-input-bg"
116
+ ];
110
117
  /** The roles' targets at a contrast. WCAG AA is the floor at every contrast. */
111
118
  function targets(k) {
112
119
  const at = (wcag, apca) => ({
@@ -146,11 +153,6 @@ function targets(k) {
146
153
  3,
147
154
  4.5
148
155
  ]) },
149
- control: { wcag: byContrast(k, [
150
- 1.6,
151
- 2.2,
152
- 3
153
- ]) },
154
156
  label: { wcag: 4.5 }
155
157
  };
156
158
  }
@@ -159,6 +161,12 @@ var WHITE = {
159
161
  c: 0,
160
162
  h: 0
161
163
  };
164
+ /** The WCAG contrast a dark mode's hover keeps against the page at contrast 0, 30 and 100. */
165
+ var HOVER_STEP = [
166
+ 1.45,
167
+ 1.6,
168
+ 1.9
169
+ ];
162
170
  var STATUS = {
163
171
  success: 150,
164
172
  error: 27,
@@ -271,7 +279,13 @@ function build(scheme, options) {
271
279
  set("--theme-app-bg", base);
272
280
  set("--theme-panel-hover", neutral(set("--theme-panel-bg", raised(.85, .035)).l + dir * (dark ? .04 : .025) * s, 1));
273
281
  const mutedPanel = set("--theme-muted-panel-bg", step(.03, .065));
274
- set("--theme-hover", step(.045, .08));
282
+ const hoverStep = step(.045, .08);
283
+ const hoverGoal = dark ? solve(hoverStep, [toHex(base)], { wcag: byContrast(k, HOVER_STEP) }) : hoverStep;
284
+ const hoverAt = (share) => ({
285
+ ...hoverStep,
286
+ l: hoverStep.l + (hoverGoal.l - hoverStep.l) * share
287
+ });
288
+ set("--theme-hover", hoverAt(roomFor(hoverAt, { wcag: t.primary.wcag })));
275
289
  set("--theme-input-bg", raised(.7, .05));
276
290
  set("--theme-input-disabled-bg", step(.02, .025));
277
291
  set("--theme-accent-subtle", {
@@ -298,16 +312,13 @@ function build(scheme, options) {
298
312
  "--theme-muted-panel-bg",
299
313
  "--theme-hover"
300
314
  ], t.secondary);
301
- set("--theme-focus-ring", solved("--theme-focus", accent, [
315
+ const focusOn = [
302
316
  "--theme-app-bg",
303
317
  "--theme-panel-bg",
304
318
  "--theme-input-bg"
305
- ], t.graphic), dark ? .35 : .25);
306
- solved("--theme-border-strong", border, [
307
- "--theme-app-bg",
308
- "--theme-panel-bg",
309
- "--theme-input-bg"
310
- ], t.control);
319
+ ];
320
+ set("--theme-focus-ring", solved("--theme-focus", accent, focusOn, meets(toHex(accent), focusOn.map(hexOf), t.graphic) ? t.graphic : { wcag: t.secondary.wcag }), dark ? .35 : .25);
321
+ solved("--theme-border-strong", border, CONTROL_ON, t.graphic);
311
322
  set("--theme-accent", accent);
312
323
  const white = contrastRatio("#ffffff", toHex(accent)) >= 4.5;
313
324
  set("--theme-accent-hover", {
@@ -559,4 +570,4 @@ function themeStylesheet(selector, scheme, options = {}) {
559
570
  return `${selector} {\n${block(srgb, " ")}\n}\n${wide ? `\n@media (color-gamut: p3) {\n ${selector} {\n${wide}\n }\n}\n` : ""}`;
560
571
  }
561
572
  //#endregion
562
- export { PLACEHOLDER_ON, SIDEBAR_TOKENS, THEME_TOKENS, deriveTheme, generateTheme, themeStylesheet };
573
+ export { CONTROL_ON, PLACEHOLDER_ON, SIDEBAR_TOKENS, THEME_TOKENS, deriveTheme, generateTheme, themeStylesheet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/ui",
3
- "version": "0.54.0",
3
+ "version": "0.56.0",
4
4
  "description": "React UI components: a theme contract, icons, brand logos, primitives, lists, forms, a job graph, a code editor, a log viewer, a file explorer and an AI chat, each on its own subpath",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -102,7 +102,7 @@
102
102
  "clsx": "^2.1.1",
103
103
  "css-tree": "^3.2.1",
104
104
  "dequal": "^2.0.3",
105
- "katex": "^0.16.27",
105
+ "katex": "^0.19.0",
106
106
  "lucide-react": "1.52.0",
107
107
  "luxon": "^3.7.2",
108
108
  "react-zoom-pan-pinch": "^4.2.0",
@@ -1,35 +0,0 @@
1
- import { type AccessModel } from './model.js';
2
- import type { AccessStrings } from './strings.js';
3
- import type { AccessGroup, AccessGroupDetails, AccessRole } from './types.js';
4
- export type DescribeGroup = (groupId: string, signal: AbortSignal) => Promise<AccessGroupDetails>;
5
- export type SearchGroups = (query: string, signal: AbortSignal) => Promise<readonly AccessGroup[]>;
6
- /** Details already loaded, kept for as long as the drawer is open. */
7
- export type DetailsCache = Map<string, AccessGroupDetails>;
8
- export declare function GroupTile({ everyone, className }: {
9
- everyone: boolean;
10
- className?: string;
11
- }): import("react").JSX.Element;
12
- interface GroupPickerProps {
13
- model: AccessModel;
14
- value: readonly string[];
15
- onValueChange: (ids: string[]) => void;
16
- /** The roles being granted, which the details weigh against what the group holds. */
17
- granting: readonly AccessRole[];
18
- resourceName: string;
19
- describeGroup?: DescribeGroup | undefined;
20
- searchGroups?: SearchGroups | undefined;
21
- groupCount?: number | undefined;
22
- recentGroupIds?: readonly string[] | undefined;
23
- cache: DetailsCache;
24
- /** Every group the picker has seen, by id, so a chosen one found by a search keeps its name. */
25
- seen: Map<string, AccessGroup>;
26
- id: string;
27
- describedBy: string;
28
- /** The drawer's body, above its footer, which the open list fills. */
29
- boundary: Element | null;
30
- t: AccessStrings;
31
- }
32
- /** The groups field: everyone pinned first, then recent groups, then all of them; a pane beside
33
- * the list says who is in the highlighted group and what it holds here. */
34
- export declare function GroupPicker({ model, value, onValueChange, granting, resourceName, describeGroup, searchGroups, groupCount, recentGroupIds, cache, seen, id, describedBy, boundary, t, }: GroupPickerProps): import("react").JSX.Element;
35
- export {};