@crewlethq/ui 0.48.3 → 0.49.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/README.md +56 -0
- package/dist/AgentHandoffPanel/index.js +3 -3
- package/dist/ArrangeList/index.js +2 -2
- package/dist/ArtifactBar/index.js +4 -4
- package/dist/{ArtifactBar-6PGWGKN2.css → ArtifactBar-UMZCTARR.css} +9 -0
- package/dist/ArtifactCard/ArtifactCard.d.ts +30 -1
- package/dist/ArtifactCard/index.js +10 -3
- package/dist/{ArtifactCard-OGTMO2KI.css → ArtifactCard-SOB63NV5.css} +72 -1
- package/dist/ArtifactCover/index.js +2 -2
- package/dist/ArtifactIcon/index.js +2 -2
- package/dist/ArtifactKindGlyph/ArtifactKindGlyph.d.ts +7 -3
- package/dist/ArtifactKindGlyph/index.js +1 -1
- package/dist/ArtifactKindIllustration/ArtifactKindIllustration.d.ts +4 -3
- package/dist/ArtifactKindIllustration/index.js +1 -1
- package/dist/{ArtifactKinds-CVD3FCYO.css → ArtifactKinds-O3CALPVX.css} +1 -0
- package/dist/ArtifactMakeRow/index.js +2 -2
- package/dist/ArtifactNameCell/ArtifactNameCell.d.ts +14 -1
- package/dist/ArtifactNameCell/index.d.ts +1 -1
- package/dist/ArtifactNameCell/index.js +2 -2
- package/dist/{ArtifactNameCell-RTVP4LO4.css → ArtifactNameCell-3AHLUSE5.css} +12 -0
- package/dist/BrandChip/BrandChip.d.ts +26 -0
- package/dist/BrandChip/index.d.ts +3 -0
- package/dist/BrandChip/index.js +2 -0
- package/dist/BrandChip-SQWBC2WU.css +81 -0
- package/dist/BrandSample/BrandSample.d.ts +75 -0
- package/dist/BrandSample/index.d.ts +3 -0
- package/dist/BrandSample/index.js +5 -0
- package/dist/BrandSample-G5V7GKR2.css +185 -0
- package/dist/BrandScope/BrandScope.d.ts +61 -0
- package/dist/BrandScope/index.d.ts +4 -0
- package/dist/BrandScope/index.js +4 -0
- package/dist/BrandScope-H2KZHGT7.css +29 -0
- package/dist/Checkbox/Checkbox.d.ts +8 -0
- package/dist/Checkbox/index.js +1 -1
- package/dist/{Checkbox-ALWG3WV2.css → Checkbox-MB22OW6P.css} +18 -0
- package/dist/ColorField/ColorField.d.ts +63 -0
- package/dist/ColorField/index.d.ts +3 -0
- package/dist/ColorField/index.js +11 -0
- package/dist/ColorField-2OIOWT3Z.css +68 -0
- package/dist/ColorSwatch/ColorSwatch.d.ts +43 -0
- package/dist/ColorSwatch/index.d.ts +3 -0
- package/dist/ColorSwatch/index.js +9 -0
- package/dist/ColorSwatch-DNMUFHNS.css +83 -0
- package/dist/Combobox/Combobox.d.ts +45 -4
- package/dist/Combobox/index.d.ts +1 -1
- package/dist/Combobox/index.js +1 -1
- package/dist/Combobox-GBCWXWEB.css +163 -0
- package/dist/CommandPalette/index.js +3 -3
- package/dist/CommentThread/index.js +3 -3
- package/dist/Composer/index.js +2 -2
- package/dist/ContrastBadge/ContrastBadge.d.ts +63 -0
- package/dist/ContrastBadge/index.d.ts +3 -0
- package/dist/ContrastBadge/index.js +6 -0
- package/dist/ContrastBadge-CBZPGG3G.css +47 -0
- package/dist/DataGrid/DataGrid.d.ts +28 -1
- package/dist/DataGrid/index.js +8 -1
- package/dist/{DataGrid-AQKPJD7W.css → DataGrid-VNGQESJA.css} +15 -0
- package/dist/DataTable/index.js +3 -3
- package/dist/DataView/index.js +8 -8
- package/dist/DateTimePicker/index.js +2 -2
- package/dist/FolderTile/FolderTile.d.ts +91 -0
- package/dist/FolderTile/index.d.ts +3 -0
- package/dist/FolderTile/index.js +7 -0
- package/dist/FolderTile-FDT5Y63Z.css +231 -0
- package/dist/LinkInterstitial/index.js +2 -2
- package/dist/ListInput/index.js +2 -2
- package/dist/LogoSlot/LogoSlot.d.ts +84 -0
- package/dist/LogoSlot/index.d.ts +3 -0
- package/dist/LogoSlot/index.js +9 -0
- package/dist/LogoSlot-T2UFOJXU.css +159 -0
- package/dist/Modal/Modal.d.ts +13 -0
- package/dist/Modal/index.js +1 -1
- package/dist/{Modal-TOEWHDCQ.css → Modal-3HMP7WAZ.css} +30 -0
- package/dist/PresenterView/index.js +2 -2
- package/dist/PrincipalPicker/index.js +2 -2
- package/dist/SelectionBar/SelectionBar.d.ts +50 -0
- package/dist/SelectionBar/index.d.ts +3 -0
- package/dist/SelectionBar/index.js +9 -0
- package/dist/SelectionBar-XPWKUOSC.css +61 -0
- package/dist/ShareDialog/index.js +3 -3
- package/dist/SheetColumnEditor/index.js +3 -3
- package/dist/SheetGrid/index.js +2 -2
- package/dist/Switcher/index.js +2 -2
- package/dist/ThemeGallery/ThemeGallery.d.ts +13 -2
- package/dist/ThemeGallery/index.js +3 -1
- package/dist/{ThemeGallery-X35Y25EX.css → ThemeGallery-UEFZRT6W.css} +21 -0
- package/dist/TimeWindowPicker/index.js +2 -2
- package/dist/TypeSpecimen/TypeSpecimen.d.ts +49 -0
- package/dist/TypeSpecimen/index.d.ts +3 -0
- package/dist/TypeSpecimen/index.js +3 -0
- package/dist/TypeSpecimen-WK6YNHL7.css +96 -0
- package/dist/chunk-5SGHW42B.js +23 -0
- package/dist/{chunk-ILDNJHRU.js → chunk-AVL52EME.js} +1 -1
- package/dist/chunk-B235ANDO.js +66 -0
- package/dist/{chunk-2MYSESZF.js → chunk-FB5CFQTG.js} +82 -12
- package/dist/{chunk-DY4DQ7EB.js → chunk-GP4YWZFO.js} +1 -1
- package/dist/{chunk-LIJQT74Y.js → chunk-H55D66IK.js} +1 -1
- package/dist/{chunk-6EBGPCAW.js → chunk-H7NMJ5AI.js} +1 -1
- package/dist/chunk-ITI2Z44C.js +139 -0
- package/dist/{chunk-P5VGSVWG.js → chunk-J24Q4HTD.js} +17 -8
- package/dist/{chunk-5EBDOE3C.js → chunk-JFDIMO3A.js} +1 -1
- package/dist/chunk-JKAFEFFC.js +44 -0
- package/dist/{chunk-32TGEMQQ.js → chunk-KHZYAEGZ.js} +1 -1
- package/dist/chunk-M4QM477B.js +80 -0
- package/dist/{chunk-TWZEWXNW.js → chunk-MIEBOO7Y.js} +2 -2
- package/dist/{chunk-SMOFYZJ5.js → chunk-NAWUXCBC.js} +3 -3
- package/dist/{chunk-F57N6ZJG.js → chunk-NCHKKYPQ.js} +5 -2
- package/dist/chunk-OCRVY42T.js +50 -0
- package/dist/chunk-OEEYL2CM.js +73 -0
- package/dist/chunk-P3OIM6OC.js +38 -0
- package/dist/{chunk-FWBKMPNR.js → chunk-P3QWT5VR.js} +1 -1
- package/dist/chunk-P5JBDHWC.js +206 -0
- package/dist/{chunk-OKE5YSLD.js → chunk-Q44X36QC.js} +79 -35
- package/dist/{chunk-R2IBCEU6.js → chunk-R3BA3C4Y.js} +2 -2
- package/dist/{chunk-CE2THTQR.js → chunk-RSKW25Y5.js} +4 -3
- package/dist/{chunk-UBZDYOCA.js → chunk-RV6XB5UV.js} +12 -1
- package/dist/{chunk-E4BOVKNJ.js → chunk-UTESMBPL.js} +5 -3
- package/dist/chunk-UZMNR366.js +9 -0
- package/dist/{chunk-CWKWMIIJ.js → chunk-V7GOOXPK.js} +1 -1
- package/dist/{chunk-7JED2NYP.js → chunk-VBIM6HFC.js} +1 -1
- package/dist/{chunk-U4HOKU6P.js → chunk-VN47PYUF.js} +5 -5
- package/dist/{chunk-MUQJCH2Y.js → chunk-VTSJMDGP.js} +2 -2
- package/dist/chunk-W6FOEBIL.js +119 -0
- package/dist/chunk-WLSEAIVC.js +48 -0
- package/dist/{chunk-AS2BMY3E.js → chunk-WQ7S7CKZ.js} +2 -2
- package/dist/{chunk-6AKG2VLR.js → chunk-YCC2S7DF.js} +4 -1
- package/dist/chunk-ZH77BXMA.js +14 -0
- package/dist/generated/index.d.ts +10 -0
- package/dist/generated/index.js +80 -68
- package/dist/index.js +80 -68
- package/dist/styles.css +1414 -85
- package/dist/utils/fontFamily.d.ts +29 -0
- package/dist/utils/hexColour.d.ts +12 -0
- package/package.json +3 -3
- package/scripts/check-css-variables.mjs +18 -2
- package/dist/Combobox-YDONYDTM.css +0 -81
- package/dist/chunk-OOJTPR7N.js +0 -137
- package/dist/{chunk-245IXG5P.js → chunk-3WMOEGEL.js} +0 -0
- package/dist/{chunk-ISDEXIXH.js → chunk-E6HXFFWO.js} +1 -1
- package/dist/{chunk-6R5BSA36.js → chunk-GHY63X4C.js} +1 -1
- package/dist/{chunk-ICVS3U4S.js → chunk-PGR2PKH6.js} +1 -1
- package/dist/{chunk-VKFG4FLE.js → chunk-R6R2UHVG.js} +1 -1
- package/dist/{chunk-OO7QJCJQ.js → chunk-WXOYHVWG.js} +1 -1
- package/dist/{chunk-UFXLNC2N.js → chunk-ZFM5L7M4.js} +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A font-family list somebody chose, as the one grammar every brand part
|
|
3
|
+
* accepts before it reaches a style: up to MAX_NAMES comma-separated family
|
|
4
|
+
* names, each a quoted name (no quotes, back slashes or line breaks inside),
|
|
5
|
+
* a run of plain CSS identifiers (`Segoe UI`, `-apple-system`), or one of the
|
|
6
|
+
* package's own family tokens (`var(--font-family-sans)` and its siblings).
|
|
7
|
+
*
|
|
8
|
+
* WHY A GRAMMAR AND NOT A SANITISER. A family list is drawn into a custom
|
|
9
|
+
* property, where nothing a person typed can break out of the declaration,
|
|
10
|
+
* but a value that is not a list of names (a `var()` of something else, a
|
|
11
|
+
* CSS-wide keyword, a stray function) still changes what the page draws.
|
|
12
|
+
* Anything that does not read as names is refused whole, and the caller
|
|
13
|
+
* falls back to the package's face, rather than half of it being kept.
|
|
14
|
+
*
|
|
15
|
+
* IT TAKES EVERY LIST THE ENGINE WRITES. The engine resolves a brand's face to
|
|
16
|
+
* one list (brandformat `FaceFamilies`, mirrored in the dashboard contract as
|
|
17
|
+
* `BRAND_FACE_FAMILIES`): a kit face or a curated system stack of bare
|
|
18
|
+
* identifiers, `-apple-system` among them, or an uploaded family quoted in
|
|
19
|
+
* front of the system sans stack. The suite walks those lists verbatim.
|
|
20
|
+
*/
|
|
21
|
+
/** The list, trimmed, when it reads as family names; null for anything else. */
|
|
22
|
+
export declare function safeFontFamily(value: string | null | undefined): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* A family list that always ends in a face the page has: the chosen list
|
|
25
|
+
* when it reads as names, then `fallback` (a package family token), so a face
|
|
26
|
+
* still loading or never uploaded draws as the package's type rather than as
|
|
27
|
+
* the browser's default.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fontStack(value: string | null | undefined, fallback: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour somebody chose, as the one spelling every brand part stores and
|
|
3
|
+
* draws: `#` and six lowercase hex digits, or null for anything else.
|
|
4
|
+
*
|
|
5
|
+
* WHY ONE FUNCTION. A brand's colours are data, typed or pasted by a person
|
|
6
|
+
* and drawn into a custom property, so every part that takes one reads it
|
|
7
|
+
* through the same gate: the tokens package's `parseHex`, which accepts
|
|
8
|
+
* `#rrggbb` alone (any case, surrounding space trimmed) and nothing a
|
|
9
|
+
* stylesheet would read as something else. The lowercase form is the one the
|
|
10
|
+
* engine stores, so a value read back compares equal to the value written.
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeHex(value: string | null | undefined): string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewlethq/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "Crewlet shared React components built on @crewlethq/tokens and @crewlethq/icons.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"clean": "rm -rf dist src/generated"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@crewlethq/icons": "0.
|
|
46
|
-
"@crewlethq/tokens": "0.
|
|
45
|
+
"@crewlethq/icons": "0.49.0",
|
|
46
|
+
"@crewlethq/tokens": "0.49.0",
|
|
47
47
|
"prosemirror-commands": "1.7.2",
|
|
48
48
|
"prosemirror-gapcursor": "1.4.1",
|
|
49
49
|
"prosemirror-history": "1.5.1",
|
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
// name quietly renders `x` forever.
|
|
16
16
|
// 2. Every other name belongs to a component and is namespaced --crewlet-*,
|
|
17
17
|
// both where it is read and where it is declared, so a component never
|
|
18
|
-
// claims a name an application stylesheet may already use.
|
|
18
|
+
// claims a name an application stylesheet may already use. The one
|
|
19
|
+
// exception is the brand mapping's inputs (`--brand-primary` and the
|
|
20
|
+
// rest), which a component may DECLARE because @crewlethq/tokens'
|
|
21
|
+
// css/brand reads them by those names: exactly the inputs that sheet
|
|
22
|
+
// reads, and no other `--brand-*` name.
|
|
19
23
|
// 3. A --crewlet-* name read without a fallback must be declared somewhere
|
|
20
24
|
// in the scanned source.
|
|
21
25
|
// 4. No glyph is drawn as a Material Symbols ligature. A component that
|
|
@@ -97,8 +101,20 @@ function tokenNames() {
|
|
|
97
101
|
return names;
|
|
98
102
|
}
|
|
99
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The brand mapping's inputs: every `--brand-*` name @crewlethq/tokens'
|
|
106
|
+
* css/brand reads. A component that brands a region (BrandScope) sets them,
|
|
107
|
+
* and nothing else outside its namespace.
|
|
108
|
+
*/
|
|
109
|
+
function brandInputs() {
|
|
110
|
+
const require = createRequire(import.meta.url);
|
|
111
|
+
const text = withoutComments(readFileSync(require.resolve('@crewlethq/tokens/css/brand'), 'utf8'), true);
|
|
112
|
+
return new Set([...text.matchAll(REFERENCE)].map((match) => match[1]).filter((name) => name.startsWith('--brand-')));
|
|
113
|
+
}
|
|
114
|
+
|
|
100
115
|
export async function findings(roots, base = packageRoot) {
|
|
101
116
|
const tokens = tokenNames();
|
|
117
|
+
const inputs = brandInputs();
|
|
102
118
|
const files = readSources(roots, base);
|
|
103
119
|
const declared = new Set();
|
|
104
120
|
const references = [];
|
|
@@ -111,7 +127,7 @@ export async function findings(roots, base = packageRoot) {
|
|
|
111
127
|
for (const match of text.matchAll(isStylesheet ? CSS_DECLARATION : SCRIPT_DECLARATION)) {
|
|
112
128
|
const name = match[1];
|
|
113
129
|
declared.add(name);
|
|
114
|
-
if (!name.startsWith(COMPONENT_PREFIX)) {
|
|
130
|
+
if (!name.startsWith(COMPONENT_PREFIX) && !inputs.has(name)) {
|
|
115
131
|
problems.push(
|
|
116
132
|
`${where(match.index)}: declares ${name}; a component declares only ${COMPONENT_PREFIX}* names (token values belong in @crewlethq/tokens)`,
|
|
117
133
|
);
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Combobox: a field that offers completions.
|
|
3
|
-
*
|
|
4
|
-
* The panel is anchored inside the field's own box rather than portalled or
|
|
5
|
-
* laid out in the flow. In the flow it pushed every field under it down the
|
|
6
|
-
* form as somebody typed; portalled, it would have to be placed, followed and
|
|
7
|
-
* given a layer of its own for a list that never leaves its field's side.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
.crewlet-combobox {
|
|
11
|
-
position: relative;
|
|
12
|
-
width: 100%;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.crewlet-combobox__panel {
|
|
16
|
-
/* Six rows and a scroll, as every list this package offers from a field. */
|
|
17
|
-
--crewlet-combobox-panel-max-height: 12rem;
|
|
18
|
-
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: calc(100% + var(--spacing-1));
|
|
21
|
-
left: 0;
|
|
22
|
-
right: 0;
|
|
23
|
-
max-height: var(--crewlet-combobox-panel-max-height);
|
|
24
|
-
overflow-y: auto;
|
|
25
|
-
overscroll-behavior: contain;
|
|
26
|
-
padding: var(--spacing-1);
|
|
27
|
-
--crewlet-listbox-gap: 1px;
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
gap: var(--crewlet-listbox-gap);
|
|
31
|
-
/*
|
|
32
|
-
* OPAQUE, and the product's own panel surface: a translucent list over a
|
|
33
|
-
* form puts two sets of words in the same place, and the words underneath
|
|
34
|
-
* are a label and a value somebody is in the middle of typing.
|
|
35
|
-
*/
|
|
36
|
-
background: var(--color-surface-subtle);
|
|
37
|
-
border: 1px solid var(--color-border-default);
|
|
38
|
-
border-radius: var(--radius-md);
|
|
39
|
-
box-shadow: var(--shadow-md);
|
|
40
|
-
/* Above the fields below it, and nothing more: it never leaves its form. */
|
|
41
|
-
z-index: var(--z-index-dropdown);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/* Names read exactly rather than for sense: a secret reference, a path, a key. */
|
|
45
|
-
.crewlet-combobox__panel.is-mono .crewlet-combobox__label {
|
|
46
|
-
font-family: var(--font-family-mono);
|
|
47
|
-
font-size: var(--font-size-compact);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.crewlet-combobox__label {
|
|
51
|
-
overflow: hidden;
|
|
52
|
-
text-overflow: ellipsis;
|
|
53
|
-
white-space: nowrap;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/*
|
|
57
|
-
* The row the arrows or the pointer are on, in the hover tint. The accent is
|
|
58
|
-
* what "here, this is the current one" means elsewhere in the product; a
|
|
59
|
-
* completion list has no current one, only the row about to be taken.
|
|
60
|
-
*
|
|
61
|
-
* Scoped to the panel rather than written on the row class, because the
|
|
62
|
-
* shared listbox register paints [aria-selected] itself and the stylesheets
|
|
63
|
-
* are bundled in hash order: a rule of equal weight would win or lose by the
|
|
64
|
-
* name of a build artefact.
|
|
65
|
-
*/
|
|
66
|
-
.crewlet-combobox__panel .crewlet-listbox__option {
|
|
67
|
-
border-radius: var(--radius-xs);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.crewlet-combobox__panel .crewlet-listbox__option[aria-selected='true'],
|
|
71
|
-
.crewlet-combobox__panel .crewlet-listbox__option.is-highlight,
|
|
72
|
-
.crewlet-combobox__panel .crewlet-listbox__option:hover {
|
|
73
|
-
background: var(--color-surface-hover);
|
|
74
|
-
color: var(--color-text-primary);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.crewlet-combobox__panel .crewlet-listbox__option.is-disabled {
|
|
78
|
-
background: transparent;
|
|
79
|
-
color: var(--color-text-tertiary);
|
|
80
|
-
cursor: not-allowed;
|
|
81
|
-
}
|
package/dist/chunk-OOJTPR7N.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { useListbox } from './chunk-7KHM2FZH.js';
|
|
2
|
-
import { Input } from './chunk-EXRRTKWT.js';
|
|
3
|
-
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
4
|
-
import { cx } from './chunk-ODEQTPFM.js';
|
|
5
|
-
import './HitArea-QUOS6ZDJ.css';
|
|
6
|
-
import './Combobox-YDONYDTM.css';
|
|
7
|
-
import { forwardRef, useId, useMemo, useRef, useCallback } from 'react';
|
|
8
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
|
-
|
|
10
|
-
var Combobox = forwardRef(function Combobox2({
|
|
11
|
-
value,
|
|
12
|
-
onValueChange,
|
|
13
|
-
options,
|
|
14
|
-
renderList,
|
|
15
|
-
onCommit,
|
|
16
|
-
open,
|
|
17
|
-
onOpenChange,
|
|
18
|
-
label,
|
|
19
|
-
tabCommits = false,
|
|
20
|
-
commitOn = "mousedown",
|
|
21
|
-
mono = false,
|
|
22
|
-
emptyMessage,
|
|
23
|
-
id,
|
|
24
|
-
className,
|
|
25
|
-
containerClassName,
|
|
26
|
-
...rest
|
|
27
|
-
}, ref) {
|
|
28
|
-
const generatedId = useId();
|
|
29
|
-
const fieldId = id ?? generatedId;
|
|
30
|
-
const offered = useMemo(() => options ?? [], [options]);
|
|
31
|
-
const showing = open && (offered.length > 0 || renderList !== void 0 || emptyMessage !== void 0);
|
|
32
|
-
const lists = open && (offered.length > 0 || renderList !== void 0);
|
|
33
|
-
const box = useRef(null);
|
|
34
|
-
const commit = useCallback(
|
|
35
|
-
(index) => {
|
|
36
|
-
const option = offered[index];
|
|
37
|
-
if (!option || option.disabled) return;
|
|
38
|
-
if (onCommit) onCommit(option, index);
|
|
39
|
-
else onValueChange(option.value);
|
|
40
|
-
onOpenChange(false);
|
|
41
|
-
},
|
|
42
|
-
[offered, onCommit, onOpenChange, onValueChange]
|
|
43
|
-
);
|
|
44
|
-
const listbox = useListbox({
|
|
45
|
-
id: fieldId,
|
|
46
|
-
// A list that is showing with nothing in it still owns Escape: the reader
|
|
47
|
-
// can see it, so dismissing it is what Escape means there too.
|
|
48
|
-
open: showing,
|
|
49
|
-
count: offered.length,
|
|
50
|
-
onCommit: commit,
|
|
51
|
-
onClose: () => onOpenChange(false),
|
|
52
|
-
tabCommits
|
|
53
|
-
});
|
|
54
|
-
function onKeyDown(event) {
|
|
55
|
-
if (listbox.onKeyDown(event)) return;
|
|
56
|
-
if (!showing && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
57
|
-
event.preventDefault();
|
|
58
|
-
onOpenChange(true);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const handlers = (index) => {
|
|
62
|
-
const { onMouseDown, onMouseEnter } = listbox.optionHandlers(index);
|
|
63
|
-
if (commitOn === "click") {
|
|
64
|
-
return {
|
|
65
|
-
onMouseEnter,
|
|
66
|
-
// The press is still swallowed, so the field keeps focus and the value
|
|
67
|
-
// being completed keeps its caret; only what TAKES the row moves.
|
|
68
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
69
|
-
onClick: () => commit(index)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
return { onMouseDown, onMouseEnter };
|
|
73
|
-
};
|
|
74
|
-
return /* @__PURE__ */ jsxs("div", { className: cx("crewlet-combobox", containerClassName), ref: listbox.anchorRef, children: [
|
|
75
|
-
/* @__PURE__ */ jsx(
|
|
76
|
-
Input,
|
|
77
|
-
{
|
|
78
|
-
...rest,
|
|
79
|
-
ref: (el) => {
|
|
80
|
-
box.current = el;
|
|
81
|
-
if (typeof ref === "function") ref(el);
|
|
82
|
-
else if (ref) ref.current = el;
|
|
83
|
-
},
|
|
84
|
-
id: fieldId,
|
|
85
|
-
className,
|
|
86
|
-
value,
|
|
87
|
-
role: "combobox",
|
|
88
|
-
"aria-autocomplete": "list",
|
|
89
|
-
"aria-expanded": lists,
|
|
90
|
-
"aria-controls": lists ? listbox.listId : void 0,
|
|
91
|
-
"aria-activedescendant": lists && offered.length > 0 ? listbox.optionId(listbox.active) : void 0,
|
|
92
|
-
autoComplete: "off",
|
|
93
|
-
spellCheck: false,
|
|
94
|
-
onChange: (event) => onValueChange(event.target.value),
|
|
95
|
-
onKeyDown
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
showing ? /* @__PURE__ */ jsx(
|
|
99
|
-
"div",
|
|
100
|
-
{
|
|
101
|
-
ref: listbox.listRef,
|
|
102
|
-
className: cx("crewlet-combobox__panel", mono && "is-mono"),
|
|
103
|
-
role: lists ? "listbox" : void 0,
|
|
104
|
-
id: lists ? listbox.listId : void 0,
|
|
105
|
-
"aria-label": lists ? label : void 0,
|
|
106
|
-
children: renderList ? renderList({
|
|
107
|
-
listId: listbox.listId,
|
|
108
|
-
active: listbox.active,
|
|
109
|
-
optionId: listbox.optionId,
|
|
110
|
-
optionHandlers: handlers
|
|
111
|
-
}) : offered.length > 0 ? offered.map((option, index) => /* @__PURE__ */ jsxs(
|
|
112
|
-
"div",
|
|
113
|
-
{
|
|
114
|
-
id: listbox.optionId(index),
|
|
115
|
-
role: "option",
|
|
116
|
-
"aria-selected": index === listbox.active,
|
|
117
|
-
"aria-disabled": option.disabled || void 0,
|
|
118
|
-
className: cx(
|
|
119
|
-
"crewlet-listbox__option",
|
|
120
|
-
HIT_AREA_CLASS,
|
|
121
|
-
index === listbox.active && "is-highlight",
|
|
122
|
-
option.disabled && "is-disabled"
|
|
123
|
-
),
|
|
124
|
-
...option.disabled ? {} : handlers(index),
|
|
125
|
-
children: [
|
|
126
|
-
/* @__PURE__ */ jsx("span", { className: "crewlet-combobox__label", children: option.label ?? option.value }),
|
|
127
|
-
option.hint ? /* @__PURE__ */ jsx("span", { className: "crewlet-listbox__hint", children: option.hint }) : null
|
|
128
|
-
]
|
|
129
|
-
},
|
|
130
|
-
option.value
|
|
131
|
-
)) : /* @__PURE__ */ jsx("div", { className: "crewlet-listbox__empty", children: emptyMessage })
|
|
132
|
-
}
|
|
133
|
-
) : null
|
|
134
|
-
] });
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
export { Combobox };
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SlideStage, SLIDE_WIDTH, SLIDE_HEIGHT } from './chunk-RMEBFYL7.js';
|
|
2
1
|
import { SlideNav } from './chunk-RRO7UEYU.js';
|
|
2
|
+
import { SlideStage, SLIDE_WIDTH, SLIDE_HEIGHT } from './chunk-RMEBFYL7.js';
|
|
3
3
|
import { Eyebrow } from './chunk-RK4XPHVG.js';
|
|
4
4
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
5
5
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useReorder } from './chunk-XJ2QEBMM.js';
|
|
2
|
+
import { Kbd } from './chunk-SMBKXWML.js';
|
|
2
3
|
import { FormField, Textarea } from './chunk-EXRRTKWT.js';
|
|
3
4
|
import { characterCountState, CharacterCount, countCharacters } from './chunk-XCUUI7E7.js';
|
|
4
|
-
import { Kbd } from './chunk-SMBKXWML.js';
|
|
5
5
|
import { announce } from './chunk-RSAQOKH3.js';
|
|
6
6
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
7
7
|
import { isComposing } from './chunk-H5XTJ7GJ.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Select } from './chunk-XQZ6EWOE.js';
|
|
2
|
-
import { Popover } from './chunk-KHJIEPZV.js';
|
|
3
2
|
import { today, shiftMonth, CalendarGrid, compareDays } from './chunk-GXQ3B46I.js';
|
|
3
|
+
import { Popover } from './chunk-KHJIEPZV.js';
|
|
4
4
|
import { Input } from './chunk-EXRRTKWT.js';
|
|
5
5
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
6
6
|
import { isComposing } from './chunk-H5XTJ7GJ.js';
|
|
@@ -6,8 +6,8 @@ import { ChangeMark } from './chunk-66X5WDKE.js';
|
|
|
6
6
|
import { isEmptyValue, displayText, ratingMax, findPerson, findOption, statusTone, editText, textMax, sheetLabels, normalizeValue, sameValue, spokenText, drawnColumns, fitSamples, fittedWidth, columnWidth, SHEET_COLUMN_BOUNDS, sortRows, SHEET_ROW_HEIGHT, cellKey, columnOffsets, SHEET_ROW_NUMBER_WIDTH, rangeOf, presenceByCell, presenceByRow, presenceByColumn, scrollToRow, planClear, visibleRows, cellDescription, nextSort, rowName, inRange, hasPrevious, flagText, toTSV, planPaste, parseTSV, isMod, moveFrom, isTypingKey, editorSide, optionHue, parseText, liveOptions, checkValue } from './chunk-LFSIKGRQ.js';
|
|
7
7
|
import { presenceLabels } from './chunk-Z7JYG5TF.js';
|
|
8
8
|
import { Popover } from './chunk-KHJIEPZV.js';
|
|
9
|
-
import { StatusDot } from './chunk-WIATRXEJ.js';
|
|
10
9
|
import { Tooltip } from './chunk-I33UIUZD.js';
|
|
10
|
+
import { StatusDot } from './chunk-WIATRXEJ.js';
|
|
11
11
|
import { Avatar } from './chunk-PZKHBB7D.js';
|
|
12
12
|
import { Menu } from './chunk-TMM32U7D.js';
|
|
13
13
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Popover } from './chunk-KHJIEPZV.js';
|
|
2
1
|
import { today, CalendarGrid, shiftMonth, compareDays } from './chunk-GXQ3B46I.js';
|
|
2
|
+
import { Popover } from './chunk-KHJIEPZV.js';
|
|
3
3
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
4
4
|
import { IconButton } from './chunk-LACA4JGC.js';
|
|
5
5
|
import { useFocusModality } from './chunk-NUZHC6MM.js';
|