@aeolus-fleet/ui 0.38.2 → 0.38.4
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/index.d.ts
CHANGED
|
@@ -41,5 +41,6 @@ export * from './molecules/typed-confirm.js';
|
|
|
41
41
|
export * from './organisms/app-header.js';
|
|
42
42
|
export * from './organisms/command-palette.js';
|
|
43
43
|
export * from './organisms/harbour.js';
|
|
44
|
+
export * from './organisms/scope-picker.js';
|
|
44
45
|
export * from './organisms/sign-in-background.js';
|
|
45
46
|
export * from './organisms/sign-in-backgrounds.js';
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ export * from './molecules/typed-confirm.js';
|
|
|
41
41
|
export * from './organisms/app-header.js';
|
|
42
42
|
export * from './organisms/command-palette.js';
|
|
43
43
|
export * from './organisms/harbour.js';
|
|
44
|
+
export * from './organisms/scope-picker.js';
|
|
44
45
|
export * from './organisms/sign-in-background.js';
|
|
45
46
|
export * from './organisms/sign-in-backgrounds.js';
|
|
46
47
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,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CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** A scope the picker offers, with what it allows as the app's server words it. */
|
|
3
|
+
export interface ListedScope {
|
|
4
|
+
scope: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
interface ScopePickerProps {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
/** The scopes on offer, each with its description from the app's server. */
|
|
10
|
+
listed: readonly ListedScope[];
|
|
11
|
+
picked: readonly string[];
|
|
12
|
+
onPick: (scopes: string[]) => void;
|
|
13
|
+
/** While what was picked is saved. */
|
|
14
|
+
isDisabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Picks several of the listed scopes, searched by code or description; each
|
|
18
|
+
* picked scope is a chip with its code. A scope picked before that is no
|
|
19
|
+
* longer listed stays picked, so it can be seen and removed.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ScopePicker({ label, listed, picked, onPick, isDisabled }: ScopePickerProps): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Combobox } from '@base-ui/react/combobox';
|
|
4
|
+
import { Check, X } from 'lucide-react';
|
|
5
|
+
const itemOf = ({ scope, description }) => ({ value: scope, description });
|
|
6
|
+
/**
|
|
7
|
+
* Picks several of the listed scopes, searched by code or description; each
|
|
8
|
+
* picked scope is a chip with its code. A scope picked before that is no
|
|
9
|
+
* longer listed stays picked, so it can be seen and removed.
|
|
10
|
+
*/
|
|
11
|
+
export function ScopePicker({ label, listed, picked, onPick, isDisabled = false }) {
|
|
12
|
+
const { contains } = Combobox.useFilter();
|
|
13
|
+
const items = [...listed.map(itemOf), ...picked.filter((scope) => !listed.some((each) => each.scope === scope)).map((scope) => ({ value: scope, description: 'No longer defined in the fleet' }))];
|
|
14
|
+
const value = items.filter((item) => picked.includes(item.value));
|
|
15
|
+
return (_jsxs(Combobox.Root, { multiple: true, items: items, value: value, disabled: isDisabled, itemToStringLabel: (item) => item.value, isItemEqualToValue: (item, chosen) => item.value === chosen.value, onValueChange: (next, details) => {
|
|
16
|
+
// Escape closes the list; it never takes back what was picked.
|
|
17
|
+
if (details.reason === 'escape-key') {
|
|
18
|
+
details.cancel();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
onPick(next.map((item) => item.value));
|
|
22
|
+
}, filter: (item, query) => contains(item.value, query) || contains(item.description, query), children: [_jsxs("div", { className: "grid gap-1.5", "data-testid": "scope-picker", children: [_jsx(Combobox.Label, { className: "text-body font-medium text-foreground", children: label }), _jsx(Combobox.InputGroup, { className: "flex min-h-(--size-control) flex-wrap items-center gap-1 rounded-md border border-input bg-background px-2 py-1 has-disabled:opacity-50", children: _jsxs(Combobox.Chips, { className: "contents", children: [value.map((item) => (_jsxs(Combobox.Chip, { "data-testid": "scope-picker-chip", className: "inline-flex items-center gap-1 rounded-sm border border-border bg-muted px-1.5 font-mono text-id text-foreground", "aria-label": item.value, children: [item.value, _jsx(Combobox.ChipRemove, { className: "text-muted-foreground hover:text-foreground", "aria-label": `Remove ${item.value}`, children: _jsx(X, { "aria-hidden": true, className: "size-3" }) })] }, item.value))), _jsx(Combobox.Input, { "data-testid": "scope-picker-search", placeholder: value.length === 0 ? 'Search the fleet\'s scopes' : '', className: "h-6 min-w-32 flex-1 bg-transparent text-body outline-none placeholder:text-muted-foreground" })] }) })] }), _jsx(Combobox.Portal, { children: _jsx(Combobox.Positioner, { sideOffset: 4, className: "z-50", children: _jsxs(Combobox.Popup, { className: "max-h-72 w-(--anchor-width) overflow-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md", children: [_jsx(Combobox.Empty, { className: "px-2 py-1 text-meta text-muted-foreground empty:hidden", children: "No scope listed matches." }), _jsx(Combobox.List, { children: (item) => (_jsxs(Combobox.Item, { value: item, "data-testid": "scope-picker-option", className: "grid cursor-default grid-cols-[1rem_1fr] gap-x-2 rounded-sm px-2 py-1 data-highlighted:bg-accent", children: [_jsx(Combobox.ItemIndicator, { className: "row-span-2 pt-0.5", children: _jsx(Check, { "aria-hidden": true, className: "size-3.5" }) }), _jsx("span", { className: "col-start-2 font-mono text-code", children: item.value }), _jsx("span", { className: "col-start-2 text-meta text-muted-foreground", children: item.description })] }, item.value)) })] }) }) })] }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=scope-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-picker.js","sourceRoot":"","sources":["../../src/organisms/scope-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAcxC,MAAM,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAe,EAAa,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE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A4H,aACpJ,KAAC,QAAQ,CAAC,KAAK,IAAC,SAAS,EAAC,wDAAwD,yCAA0C,EAC5H,KAAC,QAAQ,CAAC,IAAI,cACX,CAAC,IAAe,EAAE,EAAE,CAAC,CACpB,MAAC,QAAQ,CAAC,IAAI,IAAkB,KAAK,EAAE,IAAI,iBAAc,qBAAqB,EAAC,SAAS,EAAC,kGAAkG,aACzL,KAAC,QAAQ,CAAC,aAAa,IAAC,SAAS,EAAC,mBAAmB,YACnD,KAAC,KAAK,yBAAa,SAAS,EAAC,UAAU,GAAG,GACnB,EACzB,eAAM,SAAS,EAAC,iCAAiC,YAAE,IAAI,CAAC,KAAK,GAAQ,EACrE,eAAM,SAAS,EAAC,6CAA6C,YAAE,IAAI,CAAC,WAAW,GAAQ,KALrE,IAAI,CAAC,KAAK,CAMd,CACjB,GACa,IACD,GACG,GACN,IACJ,CACjB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeolus-fleet/ui",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.4",
|
|
4
4
|
"description": "The UI parts every Aeolus web app shows: atoms, molecules and organisms, props only, and the design tokens.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aeolus"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"postpack": "rm LICENSE"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@aeolus-fleet/common": "0.38.
|
|
40
|
+
"@aeolus-fleet/common": "0.38.4",
|
|
41
41
|
"@base-ui/react": "^1.8.0",
|
|
42
42
|
"class-variance-authority": "^0.7.1",
|
|
43
43
|
"clsx": "^2.1.1",
|