@parallelworks/ui 0.55.0 → 0.57.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 (43) hide show
  1. package/README.md +60 -24
  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 +58 -53
  21. package/dist/components/Drawer.js +3 -1
  22. package/dist/components/HoverCard.js +15 -10
  23. package/dist/components/Menu.js +3 -0
  24. package/dist/components/Modal.js +32 -27
  25. package/dist/components/Popover.js +30 -25
  26. package/dist/components/Radio.js +1 -1
  27. package/dist/components/Select.js +47 -42
  28. package/dist/components/Slider.js +3 -3
  29. package/dist/components/Switch.js +1 -1
  30. package/dist/components/ThemeEditor.js +1 -1
  31. package/dist/components/Tooltip.js +16 -11
  32. package/dist/components/fieldBox.js +3 -3
  33. package/dist/components/fullscreen.d.ts +4 -0
  34. package/dist/components/fullscreen.js +18 -0
  35. package/dist/graph/GraphEditorDialogs.d.ts +1 -1
  36. package/dist/icons.d.ts +2 -0
  37. package/dist/icons.js +22 -2
  38. package/dist/styles/theme.css +2 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/theme/derive.d.ts +3 -1
  41. package/dist/theme/derive.js +17 -11
  42. package/package.json +1 -1
  43. package/dist/access/GroupPicker.d.ts +0 -35
@@ -1,5 +1,5 @@
1
1
  import { type CodeStyle, type Mode, type Scheme } from './model.js';
2
- export declare const THEME_TOKENS: readonly ['--theme-app-bg', '--theme-panel-bg', '--theme-panel-hover', '--theme-muted-panel-bg', '--theme-hover', '--theme-input-bg', '--theme-input-disabled-bg', '--theme-app', '--theme-muted-text-color', '--theme-placeholder', '--theme-link', '--theme-border', '--theme-border-strong', '--theme-accent', '--theme-accent-text', '--theme-accent-hover', '--theme-accent-subtle', '--theme-focus', '--theme-focus-ring', '--theme-success', '--theme-success-text', '--theme-success-solid', '--theme-success-muted', '--theme-error', '--theme-error-text', '--theme-error-solid', '--theme-error-muted', '--theme-warning', '--theme-warning-text', '--theme-warning-solid', '--theme-warning-muted', '--theme-info', '--theme-info-text', '--theme-info-solid', '--theme-info-muted', '--theme-favorite', '--theme-favorite-text', '--theme-favorite-solid', '--theme-favorite-muted', '--theme-shadow-sm', '--theme-shadow', '--theme-shadow-lg', '--theme-shadow-xl', '--theme-sidebar-bg', '--theme-sidebar-text', '--theme-sidebar-hover', '--theme-sidebar-active-bg', '--theme-sidebar-active-text', '--theme-code-bg', '--theme-code-text', '--theme-code-comment', '--theme-code-keyword', '--theme-code-string', '--theme-code-number', '--theme-code-function', '--theme-code-type', '--theme-code-property', '--theme-ansi-black', '--theme-ansi-red', '--theme-ansi-green', '--theme-ansi-yellow', '--theme-ansi-blue', '--theme-ansi-magenta', '--theme-ansi-cyan', '--theme-ansi-white'];
2
+ export declare const THEME_TOKENS: readonly ['--theme-app-bg', '--theme-panel-bg', '--theme-panel-hover', '--theme-muted-panel-bg', '--theme-hover', '--theme-input-bg', '--theme-input-disabled-bg', '--theme-app', '--theme-muted-text-color', '--theme-placeholder', '--theme-link', '--theme-border', '--theme-border-field', '--theme-border-strong', '--theme-accent', '--theme-accent-text', '--theme-accent-hover', '--theme-accent-subtle', '--theme-focus', '--theme-focus-ring', '--theme-success', '--theme-success-text', '--theme-success-solid', '--theme-success-muted', '--theme-error', '--theme-error-text', '--theme-error-solid', '--theme-error-muted', '--theme-warning', '--theme-warning-text', '--theme-warning-solid', '--theme-warning-muted', '--theme-info', '--theme-info-text', '--theme-info-solid', '--theme-info-muted', '--theme-favorite', '--theme-favorite-text', '--theme-favorite-solid', '--theme-favorite-muted', '--theme-shadow-sm', '--theme-shadow', '--theme-shadow-lg', '--theme-shadow-xl', '--theme-sidebar-bg', '--theme-sidebar-text', '--theme-sidebar-hover', '--theme-sidebar-active-bg', '--theme-sidebar-active-text', '--theme-code-bg', '--theme-code-text', '--theme-code-comment', '--theme-code-keyword', '--theme-code-string', '--theme-code-number', '--theme-code-function', '--theme-code-type', '--theme-code-property', '--theme-ansi-black', '--theme-ansi-red', '--theme-ansi-green', '--theme-ansi-yellow', '--theme-ansi-blue', '--theme-ansi-magenta', '--theme-ansi-cyan', '--theme-ansi-white'];
3
3
  export type ThemeToken = (typeof THEME_TOKENS)[number];
4
4
  export type ThemeVariables = Record<ThemeToken, string>;
5
5
  /** The tokens the sidebar owns. A host's chrome may supply its own fallbacks, so the stylesheet gives them no defaults. */
@@ -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. */
@@ -15,6 +15,7 @@ var THEME_TOKENS = [
15
15
  "--theme-placeholder",
16
16
  "--theme-link",
17
17
  "--theme-border",
18
+ "--theme-border-field",
18
19
  "--theme-border-strong",
19
20
  "--theme-accent",
20
21
  "--theme-accent-text",
@@ -107,6 +108,13 @@ var PLACEHOLDER_ON = [
107
108
  "--theme-panel-bg",
108
109
  "--theme-muted-panel-bg"
109
110
  ];
111
+ /** The surfaces a control's edge sits on: the page, panels, and the control's own fill. */
112
+ var CONTROL_ON = [
113
+ "--theme-app-bg",
114
+ "--theme-panel-bg",
115
+ "--theme-muted-panel-bg",
116
+ "--theme-input-bg"
117
+ ];
110
118
  /** The roles' targets at a contrast. WCAG AA is the floor at every contrast. */
111
119
  function targets(k) {
112
120
  const at = (wcag, apca) => ({
@@ -146,9 +154,9 @@ function targets(k) {
146
154
  3,
147
155
  4.5
148
156
  ]) },
149
- control: { wcag: byContrast(k, [
150
- 1.6,
151
- 2.2,
157
+ field: { wcag: byContrast(k, [
158
+ 1.3,
159
+ 1.5,
152
160
  3
153
161
  ]) },
154
162
  label: { wcag: 4.5 }
@@ -310,16 +318,14 @@ function build(scheme, options) {
310
318
  "--theme-muted-panel-bg",
311
319
  "--theme-hover"
312
320
  ], t.secondary);
313
- set("--theme-focus-ring", solved("--theme-focus", accent, [
321
+ const focusOn = [
314
322
  "--theme-app-bg",
315
323
  "--theme-panel-bg",
316
324
  "--theme-input-bg"
317
- ], t.graphic), dark ? .35 : .25);
318
- solved("--theme-border-strong", border, [
319
- "--theme-app-bg",
320
- "--theme-panel-bg",
321
- "--theme-input-bg"
322
- ], t.control);
325
+ ];
326
+ 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);
327
+ solved("--theme-border-strong", border, CONTROL_ON, t.graphic);
328
+ solved("--theme-border-field", border, CONTROL_ON, t.field);
323
329
  set("--theme-accent", accent);
324
330
  const white = contrastRatio("#ffffff", toHex(accent)) >= 4.5;
325
331
  set("--theme-accent-hover", {
@@ -571,4 +577,4 @@ function themeStylesheet(selector, scheme, options = {}) {
571
577
  return `${selector} {\n${block(srgb, " ")}\n}\n${wide ? `\n@media (color-gamut: p3) {\n ${selector} {\n${wide}\n }\n}\n` : ""}`;
572
578
  }
573
579
  //#endregion
574
- export { PLACEHOLDER_ON, SIDEBAR_TOKENS, THEME_TOKENS, deriveTheme, generateTheme, themeStylesheet };
580
+ 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.55.0",
3
+ "version": "0.57.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": {
@@ -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 {};