@adea-ai/ui 0.84.0 → 0.87.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 +90 -1
- package/dist/NOTICE +60 -0
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.d.ts +20 -0
- package/dist/components/composites/catalog-browser/catalog-browser-group.d.ts.map +1 -0
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +195 -0
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -0
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts +3 -0
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -0
- package/dist/components/composites/catalog-browser/catalog-browser.js +378 -0
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -0
- package/dist/components/composites/catalog-browser/catalog-detail.d.ts +21 -0
- package/dist/components/composites/catalog-browser/catalog-detail.d.ts.map +1 -0
- package/dist/components/composites/catalog-browser/catalog-detail.js +92 -0
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -0
- package/dist/components/composites/catalog-browser/catalog-types.d.ts +78 -0
- package/dist/components/composites/catalog-browser/catalog-types.d.ts.map +1 -0
- package/dist/components/composites/catalog-browser/index.d.ts +4 -0
- package/dist/components/composites/catalog-browser/index.d.ts.map +1 -0
- package/dist/components/composites/catalog-browser/index.js +3 -0
- package/dist/components/composites/list-row/list-row.d.ts +6 -3
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +69 -7
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts +9 -11
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +48 -33
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/conversation/message-composer.js +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +95 -15
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/layout/app-shell/index.d.ts +1 -0
- package/dist/components/layout/app-shell/index.d.ts.map +1 -1
- package/dist/components/layout/app-shell/index.js +2 -1
- package/dist/components/layout/app-shell/skip-link.d.ts +11 -0
- package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -0
- package/dist/components/layout/app-shell/skip-link.js +44 -0
- package/dist/components/layout/app-shell/skip-link.js.map +1 -0
- package/dist/components/layout/floating-preview/floating-preview.d.ts +12 -0
- package/dist/components/layout/floating-preview/floating-preview.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/floating-preview.js +283 -0
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -0
- package/dist/components/layout/floating-preview/index.d.ts +3 -0
- package/dist/components/layout/floating-preview/index.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/index.js +3 -0
- package/dist/components/layout/floating-preview/model.d.ts +74 -0
- package/dist/components/layout/floating-preview/model.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/model.js +146 -0
- package/dist/components/layout/floating-preview/model.js.map +1 -0
- package/dist/components/theme/index.d.ts +1 -0
- package/dist/components/theme/index.d.ts.map +1 -1
- package/dist/components/theme/index.js +2 -1
- package/dist/components/theme/theme-mode-toggle.d.ts +10 -0
- package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -0
- package/dist/components/theme/theme-mode-toggle.js +82 -0
- package/dist/components/theme/theme-mode-toggle.js.map +1 -0
- package/dist/components/ui/checkbox/checkbox.d.ts +2 -0
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +24 -3
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +41 -4
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/index.d.ts +1 -0
- package/dist/components/ui/combobox/index.d.ts.map +1 -1
- package/dist/components/ui/combobox/index.js +2 -1
- package/dist/components/ui/combobox/value-combobox.d.ts +19 -0
- package/dist/components/ui/combobox/value-combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox/value-combobox.js +42 -0
- package/dist/components/ui/combobox/value-combobox.js.map +1 -0
- package/dist/components/ui/empty/empty-state.d.ts +15 -0
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty/empty-state.js +96 -0
- package/dist/components/ui/empty/empty-state.js.map +1 -0
- package/dist/components/ui/empty/index.d.ts +1 -0
- package/dist/components/ui/empty/index.d.ts.map +1 -1
- package/dist/components/ui/empty/index.js +2 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts +4 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +37 -13
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts +36 -13
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +146 -24
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/index.d.ts +3 -1
- package/dist/components/ui/field/index.d.ts.map +1 -1
- package/dist/components/ui/field/index.js +3 -2
- package/dist/components/ui/field/number-field.d.ts +19 -0
- package/dist/components/ui/field/number-field.d.ts.map +1 -0
- package/dist/components/ui/field/number-field.js +76 -0
- package/dist/components/ui/field/number-field.js.map +1 -0
- package/dist/components/ui/input/index.d.ts +1 -0
- package/dist/components/ui/input/index.d.ts.map +1 -1
- package/dist/components/ui/input/index.js +2 -1
- package/dist/components/ui/input/input-control.d.ts +11 -0
- package/dist/components/ui/input/input-control.d.ts.map +1 -0
- package/dist/components/ui/input/input-control.js +24 -0
- package/dist/components/ui/input/input-control.js.map +1 -0
- package/dist/components/ui/input/input.d.ts.map +1 -1
- package/dist/components/ui/input/input.js +56 -28
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/index.d.ts +1 -0
- package/dist/components/ui/input-group/index.d.ts.map +1 -1
- package/dist/components/ui/input-group/index.js +2 -1
- package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group/input-group.js +42 -5
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.d.ts +11 -0
- package/dist/components/ui/input-group/secret-input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group/secret-input-group.js +67 -0
- package/dist/components/ui/input-group/secret-input-group.js.map +1 -0
- package/dist/components/ui/native-select/native-select.d.ts.map +1 -1
- package/dist/components/ui/native-select/native-select.js +39 -4
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +30 -18
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +41 -4
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts +2 -0
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +24 -3
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +1 -1
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/index.d.ts +2 -0
- package/dist/components/ui/text-link/index.d.ts.map +1 -0
- package/dist/components/ui/text-link/index.js +2 -0
- package/dist/components/ui/text-link/text-link.d.ts +9 -0
- package/dist/components/ui/text-link/text-link.d.ts.map +1 -0
- package/dist/components/ui/text-link/text-link.js +30 -0
- package/dist/components/ui/text-link/text-link.js.map +1 -0
- package/dist/components/ui/textarea/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea/textarea.js +41 -4
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -8
- package/dist/lib/clipboard.d.ts +3 -0
- package/dist/lib/clipboard.d.ts.map +1 -0
- package/dist/lib/clipboard.js +35 -0
- package/dist/lib/clipboard.js.map +1 -0
- package/dist/lib/download.d.ts +3 -0
- package/dist/lib/download.d.ts.map +1 -0
- package/dist/lib/download.js +31 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/form-field.d.ts +37 -0
- package/dist/lib/form-field.d.ts.map +1 -0
- package/dist/lib/form-field.js +47 -0
- package/dist/lib/form-field.js.map +1 -0
- package/dist/r/app-shell.json +5 -0
- package/dist/r/catalog-browser.json +47 -0
- package/dist/r/combobox.json +5 -0
- package/dist/r/empty.json +10 -1
- package/dist/r/field.json +7 -0
- package/dist/r/floating-preview.json +30 -0
- package/dist/r/input-group.json +6 -0
- package/dist/r/input.json +5 -0
- package/dist/r/lib.json +15 -0
- package/dist/r/list-row.json +1 -0
- package/dist/r/registry.json +159 -1
- package/dist/r/src/components/composites/action-button/action-button.tsx +5 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser-group.tsx +148 -0
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +258 -0
- package/dist/r/src/components/composites/catalog-browser/catalog-detail.tsx +64 -0
- package/dist/r/src/components/composites/catalog-browser/catalog-types.ts +83 -0
- package/dist/r/src/components/composites/catalog-browser/index.ts +10 -0
- package/dist/r/src/components/composites/list-row/list-row.tsx +81 -8
- package/dist/r/src/components/composites/settings/settings.tsx +67 -37
- package/dist/r/src/components/conversation/scroll-follow.ts +109 -15
- package/dist/r/src/components/layout/app-shell/index.ts +1 -0
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +35 -0
- package/dist/r/src/components/layout/floating-preview/floating-preview.tsx +260 -0
- package/dist/r/src/components/layout/floating-preview/index.ts +2 -0
- package/dist/r/src/components/layout/floating-preview/model.ts +285 -0
- package/dist/r/src/components/theme/index.ts +1 -0
- package/dist/r/src/components/theme/theme-mode-toggle.tsx +56 -0
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +20 -3
- package/dist/r/src/components/ui/combobox/combobox.tsx +24 -1
- package/dist/r/src/components/ui/combobox/index.ts +1 -0
- package/dist/r/src/components/ui/combobox/value-combobox.tsx +38 -0
- package/dist/r/src/components/ui/empty/empty-state.tsx +71 -0
- package/dist/r/src/components/ui/empty/index.ts +1 -0
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +33 -2
- package/dist/r/src/components/ui/field/field.tsx +102 -5
- package/dist/r/src/components/ui/field/index.ts +5 -0
- package/dist/r/src/components/ui/field/number-field.tsx +71 -0
- package/dist/r/src/components/ui/input/index.ts +1 -0
- package/dist/r/src/components/ui/input/input-control.tsx +38 -0
- package/dist/r/src/components/ui/input/input.tsx +32 -20
- package/dist/r/src/components/ui/input-group/index.ts +1 -0
- package/dist/r/src/components/ui/input-group/input-group.tsx +25 -2
- package/dist/r/src/components/ui/input-group/secret-input-group.tsx +58 -0
- package/dist/r/src/components/ui/native-select/native-select.tsx +27 -1
- package/dist/r/src/components/ui/progress/progress.tsx +12 -8
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +30 -2
- package/dist/r/src/components/ui/switch/switch.tsx +20 -3
- package/dist/r/src/components/ui/tabs/tabs.tsx +1 -1
- package/dist/r/src/components/ui/text-link/index.ts +2 -0
- package/dist/r/src/components/ui/text-link/text-link.tsx +28 -0
- package/dist/r/src/components/ui/textarea/textarea.tsx +24 -1
- package/dist/r/src/lib/clipboard.ts +41 -0
- package/dist/r/src/lib/download.ts +29 -0
- package/dist/r/src/lib/form-field.ts +93 -0
- package/dist/r/text-link.json +22 -0
- package/dist/r/theming.json +6 -0
- package/package.json +1 -1
- package/registry.json +159 -1
- package/src/components/composites/action-button/action-button.tsx +5 -1
- package/src/components/composites/catalog-browser/catalog-browser-group.tsx +148 -0
- package/src/components/composites/catalog-browser/catalog-browser.tsx +258 -0
- package/src/components/composites/catalog-browser/catalog-detail.tsx +64 -0
- package/src/components/composites/catalog-browser/catalog-types.ts +83 -0
- package/src/components/composites/catalog-browser/index.ts +10 -0
- package/src/components/composites/list-row/list-row.tsx +81 -8
- package/src/components/composites/settings/settings.tsx +67 -37
- package/src/components/conversation/scroll-follow.ts +109 -15
- package/src/components/layout/app-shell/index.ts +1 -0
- package/src/components/layout/app-shell/skip-link.tsx +35 -0
- package/src/components/layout/floating-preview/floating-preview.tsx +260 -0
- package/src/components/layout/floating-preview/index.ts +2 -0
- package/src/components/layout/floating-preview/model.ts +285 -0
- package/src/components/theme/index.ts +1 -0
- package/src/components/theme/theme-mode-toggle.tsx +56 -0
- package/src/components/ui/checkbox/checkbox.tsx +20 -3
- package/src/components/ui/combobox/combobox.tsx +24 -1
- package/src/components/ui/combobox/index.ts +1 -0
- package/src/components/ui/combobox/value-combobox.tsx +38 -0
- package/src/components/ui/empty/empty-state.tsx +71 -0
- package/src/components/ui/empty/index.ts +1 -0
- package/src/components/ui/entity-icon/entity-icon.tsx +33 -2
- package/src/components/ui/field/field.tsx +102 -5
- package/src/components/ui/field/index.ts +5 -0
- package/src/components/ui/field/number-field.tsx +71 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/input/input-control.tsx +38 -0
- package/src/components/ui/input/input.tsx +32 -20
- package/src/components/ui/input-group/index.ts +1 -0
- package/src/components/ui/input-group/input-group.tsx +25 -2
- package/src/components/ui/input-group/secret-input-group.tsx +58 -0
- package/src/components/ui/native-select/native-select.tsx +27 -1
- package/src/components/ui/progress/progress.tsx +12 -8
- package/src/components/ui/radio-group/radio-group.tsx +30 -2
- package/src/components/ui/switch/switch.tsx +20 -3
- package/src/components/ui/tabs/tabs.tsx +1 -1
- package/src/components/ui/text-link/index.ts +2 -0
- package/src/components/ui/text-link/text-link.tsx +28 -0
- package/src/components/ui/textarea/textarea.tsx +24 -1
- package/src/index.ts +4 -0
- package/src/lib/clipboard.ts +41 -0
- package/src/lib/download.ts +29 -0
- package/src/lib/form-field.ts +93 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Combobox, ComboboxContent, ComboboxInput, ComboboxItem } from "./combobox.js";
|
|
2
|
+
import { createComponent } from "solid-js/web";
|
|
3
|
+
import { splitProps } from "solid-js";
|
|
4
|
+
//#region src/components/ui/combobox/value-combobox.tsx
|
|
5
|
+
/** A single-choice combobox for a controlled string value and labelled choices. */
|
|
6
|
+
function ValueCombobox(props) {
|
|
7
|
+
const [local, rest] = splitProps(props, [
|
|
8
|
+
"value",
|
|
9
|
+
"choices",
|
|
10
|
+
"onValueChange"
|
|
11
|
+
]);
|
|
12
|
+
return createComponent(Combobox, {
|
|
13
|
+
get options() {
|
|
14
|
+
return local.choices;
|
|
15
|
+
},
|
|
16
|
+
optionValue: "value",
|
|
17
|
+
optionTextValue: (choice) => choice.textValue ?? textFromLabel(choice.label),
|
|
18
|
+
optionLabel: (choice) => choice.textValue ?? textFromLabel(choice.label),
|
|
19
|
+
get value() {
|
|
20
|
+
return local.choices.find((choice) => String(choice.value) === local.value) ?? null;
|
|
21
|
+
},
|
|
22
|
+
onChange: (option) => option && local.onValueChange(String(option.value)),
|
|
23
|
+
itemComponent: (itemProps) => createComponent(ComboboxItem, {
|
|
24
|
+
get item() {
|
|
25
|
+
return itemProps.item;
|
|
26
|
+
},
|
|
27
|
+
get children() {
|
|
28
|
+
return itemProps.item.rawValue.label;
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
get children() {
|
|
32
|
+
return [createComponent(ComboboxInput, rest), createComponent(ComboboxContent, {})];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function textFromLabel(label) {
|
|
37
|
+
return typeof label === "string" || typeof label === "number" ? String(label) : "";
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ValueCombobox };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=value-combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-combobox.js","names":["splitProps","ComponentProps","JSX","Combobox","ComboboxContent","ComboboxInput","ComboboxItem","ValueComboboxChoice","value","label","textValue","Element","ValueComboboxProps","Omit","choices","onValueChange","ValueCombobox","props","local","rest","_$createComponent","options","optionValue","optionTextValue","choice","textFromLabel","optionLabel","find","String","onChange","option","itemComponent","itemProps","item","children","rawValue","_$createComponent"],"sources":["../../../../src/components/ui/combobox/value-combobox.tsx"],"sourcesContent":["import { splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { Combobox, ComboboxContent, ComboboxInput, ComboboxItem } from './combobox'\n\nexport type ValueComboboxChoice =\n | { value: string; label: string | number; textValue?: string }\n | { value: string; label: JSX.Element; textValue: string }\n\nexport type ValueComboboxProps = Omit<ComponentProps<typeof ComboboxInput>, 'value'> & {\n value: string\n choices: ValueComboboxChoice[]\n onValueChange: (value: string) => void\n}\n\n/** A single-choice combobox for a controlled string value and labelled choices. */\nexport function ValueCombobox(props: ValueComboboxProps) {\n const [local, rest] = splitProps(props, ['value', 'choices', 'onValueChange'])\n\n return (\n <Combobox\n options={local.choices}\n optionValue=\"value\"\n optionTextValue={(choice) => choice.textValue ?? textFromLabel(choice.label)}\n optionLabel={(choice) => choice.textValue ?? textFromLabel(choice.label)}\n value={local.choices.find((choice) => String(choice.value) === local.value) ?? null}\n onChange={(option) => option && local.onValueChange(String(option.value))}\n itemComponent={(itemProps) => (\n <ComboboxItem item={itemProps.item}>{itemProps.item.rawValue.label}</ComboboxItem>\n )}\n >\n <ComboboxInput {...rest} />\n <ComboboxContent />\n </Combobox>\n )\n}\n\nfunction textFromLabel(label: JSX.Element) {\n return typeof label === 'string' || typeof label === 'number' ? String(label) : ''\n}\n"],"mappings":";;;;;AAcA,SAAgBgB,cAAcC,OAA2B;CACvD,MAAM,CAACC,OAAOC,QAAQnB,WAAWiB,OAAO;EAAC;EAAS;EAAW;CAAe,CAAC;CAE7E,OAAAG,gBACGjB,UAAQ;EAAA,IACPkB,UAAO;GAAA,OAAEH,MAAMJ;EAAO;EACtBQ,aAAW;EACXC,kBAAkBC,WAAWA,OAAOd,aAAae,cAAcD,OAAOf,KAAK;EAC3EiB,cAAcF,WAAWA,OAAOd,aAAae,cAAcD,OAAOf,KAAK;EAAC,IACxED,QAAK;GAAA,OAAEU,MAAMJ,QAAQa,MAAMH,WAAWI,OAAOJ,OAAOhB,KAAK,MAAMU,MAAMV,KAAK,KAAK;EAAI;EACnFqB,WAAWC,WAAWA,UAAUZ,MAAMH,cAAca,OAAOE,OAAOtB,KAAK,CAAC;EACxEuB,gBAAgBC,cAASZ,gBACtBd,cAAY;GAAA,IAAC2B,OAAI;IAAA,OAAED,UAAUC;GAAI;GAAA,IAAAC,WAAA;IAAA,OAAGF,UAAUC,KAAKE,SAAS1B;GAAK;EAAA,CAAA;EACnE,IAAAyB,WAAA;GAAA,OAAA,CAAAd,gBAEAf,eAAkBc,IAAI,GAAAC,gBACtBhB,iBAAe,CAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAGtB;AAEA,SAASqB,cAAchB,OAAoB;CACzC,OAAO,OAAOA,UAAU,YAAY,OAAOA,UAAU,WAAWmB,OAAOnB,KAAK,IAAI;AAClF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentProps, JSX } from 'solid-js';
|
|
2
|
+
export type EmptyStateProps = Omit<ComponentProps<'div'>, 'children' | 'role' | 'aria-live'> & {
|
|
3
|
+
title: string;
|
|
4
|
+
detail: string;
|
|
5
|
+
busy?: boolean;
|
|
6
|
+
icon?: JSX.Element;
|
|
7
|
+
announceAs?: 'alert' | 'status';
|
|
8
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
9
|
+
action?: () => void;
|
|
10
|
+
actionLabel?: string;
|
|
11
|
+
actionTooltip?: string;
|
|
12
|
+
};
|
|
13
|
+
/** A semantic empty, loading, or error state built from the shared empty parts. */
|
|
14
|
+
export declare function EmptyState(props: EmptyStateProps): JSX.Element;
|
|
15
|
+
//# sourceMappingURL=empty-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/empty-state.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAMnD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC,GAAG;IAC7F,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC/B,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAkDhD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
|
|
2
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
3
|
+
import { ActionButton } from "../../composites/action-button/action-button.js";
|
|
4
|
+
import { createComponent, memo, mergeProps } from "solid-js/web";
|
|
5
|
+
import { Search } from "lucide-solid";
|
|
6
|
+
import { Show, splitProps } from "solid-js";
|
|
7
|
+
//#region src/components/ui/empty/empty-state.tsx
|
|
8
|
+
/** A semantic empty, loading, or error state built from the shared empty parts. */
|
|
9
|
+
function EmptyState(props) {
|
|
10
|
+
const [local, rest] = splitProps(props, [
|
|
11
|
+
"title",
|
|
12
|
+
"detail",
|
|
13
|
+
"busy",
|
|
14
|
+
"icon",
|
|
15
|
+
"announceAs",
|
|
16
|
+
"headingLevel",
|
|
17
|
+
"action",
|
|
18
|
+
"actionLabel",
|
|
19
|
+
"actionTooltip",
|
|
20
|
+
"class"
|
|
21
|
+
]);
|
|
22
|
+
return createComponent(Empty, mergeProps(rest, {
|
|
23
|
+
get ["class"]() {
|
|
24
|
+
return local.class;
|
|
25
|
+
},
|
|
26
|
+
get role() {
|
|
27
|
+
return local.announceAs;
|
|
28
|
+
},
|
|
29
|
+
get ["aria-live"]() {
|
|
30
|
+
return local.announceAs === "status" ? "polite" : void 0;
|
|
31
|
+
},
|
|
32
|
+
get ["aria-busy"]() {
|
|
33
|
+
return local.busy || void 0;
|
|
34
|
+
},
|
|
35
|
+
get children() {
|
|
36
|
+
return [createComponent(EmptyHeader, { get children() {
|
|
37
|
+
return [
|
|
38
|
+
createComponent(Show, {
|
|
39
|
+
get when() {
|
|
40
|
+
return local.busy || local.icon;
|
|
41
|
+
},
|
|
42
|
+
get children() {
|
|
43
|
+
return createComponent(EmptyMedia, {
|
|
44
|
+
variant: "icon",
|
|
45
|
+
get children() {
|
|
46
|
+
return memo(() => !!local.busy)() ? createComponent(Spinner, {
|
|
47
|
+
label: false,
|
|
48
|
+
"aria-hidden": "true"
|
|
49
|
+
}) : local.icon ?? createComponent(Search, { "aria-hidden": "true" });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
createComponent(EmptyTitle, {
|
|
55
|
+
role: "heading",
|
|
56
|
+
get ["aria-level"]() {
|
|
57
|
+
return local.headingLevel ?? 1;
|
|
58
|
+
},
|
|
59
|
+
get children() {
|
|
60
|
+
return local.title;
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
createComponent(EmptyDescription, { get children() {
|
|
64
|
+
return local.detail;
|
|
65
|
+
} })
|
|
66
|
+
];
|
|
67
|
+
} }), createComponent(Show, {
|
|
68
|
+
get when() {
|
|
69
|
+
return local.action;
|
|
70
|
+
},
|
|
71
|
+
get children() {
|
|
72
|
+
return createComponent(EmptyContent, { get children() {
|
|
73
|
+
return createComponent(ActionButton, {
|
|
74
|
+
get tooltip() {
|
|
75
|
+
return local.actionTooltip ?? local.actionLabel ?? "Try again";
|
|
76
|
+
},
|
|
77
|
+
get ["aria-label"]() {
|
|
78
|
+
return local.actionLabel ?? "Try again";
|
|
79
|
+
},
|
|
80
|
+
get onClick() {
|
|
81
|
+
return local.action;
|
|
82
|
+
},
|
|
83
|
+
get children() {
|
|
84
|
+
return local.actionLabel ?? "Try again";
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
} });
|
|
88
|
+
}
|
|
89
|
+
})];
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { EmptyState };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=empty-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":["Search","ComponentProps","JSX","Show","splitProps","ActionButton","Spinner","Empty","EmptyContent","EmptyDescription","EmptyHeader","EmptyMedia","EmptyTitle","EmptyStateProps","Omit","title","detail","busy","icon","Element","announceAs","headingLevel","action","actionLabel","actionTooltip","EmptyState","props","local","rest","_$createComponent","_$mergeProps","class","role","aria-live","undefined","aria-busy","children","when","variant","_$memo","label","aria-level","tooltip","aria-label","onClick","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/empty/empty-state.tsx"],"sourcesContent":["import { Search } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { ActionButton } from '../../composites/action-button'\nimport { Spinner } from '../spinner'\nimport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './empty'\n\nexport type EmptyStateProps = Omit<ComponentProps<'div'>, 'children' | 'role' | 'aria-live'> & {\n title: string\n detail: string\n busy?: boolean\n icon?: JSX.Element\n announceAs?: 'alert' | 'status'\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6\n action?: () => void\n actionLabel?: string\n actionTooltip?: string\n}\n\n/** A semantic empty, loading, or error state built from the shared empty parts. */\nexport function EmptyState(props: EmptyStateProps) {\n const [local, rest] = splitProps(props, [\n 'title',\n 'detail',\n 'busy',\n 'icon',\n 'announceAs',\n 'headingLevel',\n 'action',\n 'actionLabel',\n 'actionTooltip',\n 'class',\n ])\n\n return (\n <Empty\n {...rest}\n class={local.class}\n role={local.announceAs}\n aria-live={local.announceAs === 'status' ? 'polite' : undefined}\n aria-busy={local.busy || undefined}\n >\n <EmptyHeader>\n <Show when={local.busy || local.icon}>\n <EmptyMedia variant=\"icon\">\n {local.busy ? (\n <Spinner label={false} aria-hidden=\"true\" />\n ) : (\n (local.icon ?? <Search aria-hidden=\"true\" />)\n )}\n </EmptyMedia>\n </Show>\n <EmptyTitle role=\"heading\" aria-level={local.headingLevel ?? 1}>\n {local.title}\n </EmptyTitle>\n <EmptyDescription>{local.detail}</EmptyDescription>\n </EmptyHeader>\n <Show when={local.action}>\n <EmptyContent>\n <ActionButton\n tooltip={local.actionTooltip ?? local.actionLabel ?? 'Try again'}\n aria-label={local.actionLabel ?? 'Try again'}\n onClick={local.action}\n >\n {local.actionLabel ?? 'Try again'}\n </ActionButton>\n </EmptyContent>\n </Show>\n </Empty>\n )\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgByB,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQxB,WAAWsB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,OAAAG,gBACGtB,OAAKuB,WACAF,MAAI;EAAA,KAAA,WAAA;GAAA,OACDD,MAAMI;EAAK;EAAA,IAClBC,OAAI;GAAA,OAAEL,MAAMP;EAAU;EAAA,KAAA,eAAA;GAAA,OACXO,MAAMP,eAA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AAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA,CAAA;AAM7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
|
|
2
|
-
|
|
2
|
+
import { EmptyState } from "./empty-state.js";
|
|
3
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle };
|
|
@@ -13,7 +13,8 @@ import { type VariantProps } from '#lib/variants';
|
|
|
13
13
|
*
|
|
14
14
|
* 1. **A glyph is always present.** A brand with no logo gets a monogram, not an
|
|
15
15
|
* empty box. `fallback` takes the name and returns the glyph, so a caller can
|
|
16
|
-
* choose initials, a domain letter, or a kind icon.
|
|
16
|
+
* choose initials, a domain letter, or a kind icon. When `src` is supplied,
|
|
17
|
+
* its contained image overlays that glyph and failure reveals the glyph below.
|
|
17
18
|
* 2. **The tile owns its own contrast.** `tone` tints the background while
|
|
18
19
|
* monogram text keeps the body foreground; vector glyphs retain the status
|
|
19
20
|
* colour. A caller never picks a colour pair or ships a glyph that disappears.
|
|
@@ -34,6 +35,8 @@ type EntityIconVariantProps = VariantProps<typeof entityIconVariants>;
|
|
|
34
35
|
export type EntityIconProps = Omit<ComponentProps<'span'>, 'children'> & EntityIconVariantProps & {
|
|
35
36
|
/** The entity's name. Used for the accessible label and, via `fallback`, the monogram. */
|
|
36
37
|
name: string;
|
|
38
|
+
/** Optional image URL. The image is decorative; `name` remains the accessible label. */
|
|
39
|
+
src?: string;
|
|
37
40
|
/**
|
|
38
41
|
* A logo or icon — a Lucide icon reference (`icon={Wrench}`) or an element
|
|
39
42
|
* (`icon={<Wrench />}`). Both are accepted because both are what a caller
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-icon.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/entity-icon/entity-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"entity-icon.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/entity-icon/entity-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,GAAG,EACT,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,kBAAkB;;;;8EA+B9B,CAAA;AAED,KAAK,sBAAsB,GAAG,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAErE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GACpE,sBAAsB,GAAG;IACvB,0FAA0F;IAC1F,IAAI,EAAE,MAAM,CAAA;IACZ,wFAAwF;IACxF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAAA;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,OAAO,CAAA;IACxC,wEAAwE;IACxE,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACnB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAEH;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI7C;AAkCD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eA+ChD"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
2
|
import { cva } from "../../../lib/variants.js";
|
|
3
|
-
import { Dynamic, createComponent, insert, memo, mergeProps, spread, template } from "solid-js/web";
|
|
4
|
-
import { Show, splitProps } from "solid-js";
|
|
3
|
+
import { Dynamic, createComponent, effect, insert, memo, mergeProps, setAttribute, spread, template } from "solid-js/web";
|
|
4
|
+
import { Show, createSignal, splitProps } from "solid-js";
|
|
5
5
|
//#region src/components/ui/entity-icon/entity-icon.tsx
|
|
6
|
-
var _tmpl$ = /*#__PURE__*/ template(`<
|
|
7
|
-
var _tmpl$2 = /*#__PURE__*/ template(`<span
|
|
6
|
+
var _tmpl$ = /*#__PURE__*/ template(`<img data-slot=entity-icon-image alt aria-hidden=true class="pointer-events-none absolute inset-0 size-full object-contain">`);
|
|
7
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<span class="absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4">`);
|
|
8
|
+
var _tmpl$3 = /*#__PURE__*/ template(`<span role=img>`);
|
|
8
9
|
/**
|
|
9
10
|
* EntityIcon.
|
|
10
11
|
*
|
|
@@ -18,7 +19,8 @@ var _tmpl$2 = /*#__PURE__*/ template(`<span role=img>`);
|
|
|
18
19
|
*
|
|
19
20
|
* 1. **A glyph is always present.** A brand with no logo gets a monogram, not an
|
|
20
21
|
* empty box. `fallback` takes the name and returns the glyph, so a caller can
|
|
21
|
-
* choose initials, a domain letter, or a kind icon.
|
|
22
|
+
* choose initials, a domain letter, or a kind icon. When `src` is supplied,
|
|
23
|
+
* its contained image overlays that glyph and failure reveals the glyph below.
|
|
22
24
|
* 2. **The tile owns its own contrast.** `tone` tints the background while
|
|
23
25
|
* monogram text keeps the body foreground; vector glyphs retain the status
|
|
24
26
|
* colour. A caller never picks a colour pair or ships a glyph that disappears.
|
|
@@ -78,9 +80,24 @@ function Glyph(props) {
|
|
|
78
80
|
return props.glyph.value;
|
|
79
81
|
} }) : props.glyph.value;
|
|
80
82
|
}
|
|
83
|
+
function EntityIconImage(props) {
|
|
84
|
+
const [failed, setFailed] = createSignal(false);
|
|
85
|
+
return createComponent(Show, {
|
|
86
|
+
get when() {
|
|
87
|
+
return !failed();
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
var _el$ = _tmpl$();
|
|
91
|
+
_el$.addEventListener("error", () => setFailed(true));
|
|
92
|
+
effect(() => setAttribute(_el$, "src", props.src));
|
|
93
|
+
return _el$;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
81
97
|
function EntityIcon(props) {
|
|
82
98
|
const [local, rest] = splitProps(props, [
|
|
83
99
|
"name",
|
|
100
|
+
"src",
|
|
84
101
|
"icon",
|
|
85
102
|
"fallback",
|
|
86
103
|
"badge",
|
|
@@ -102,8 +119,8 @@ function EntityIcon(props) {
|
|
|
102
119
|
};
|
|
103
120
|
};
|
|
104
121
|
return (() => {
|
|
105
|
-
var _el$ = _tmpl$
|
|
106
|
-
spread(_el
|
|
122
|
+
var _el$2 = _tmpl$3();
|
|
123
|
+
spread(_el$2, mergeProps({
|
|
107
124
|
get ["class"]() {
|
|
108
125
|
return cn(entityIconVariants({
|
|
109
126
|
shape: local.shape,
|
|
@@ -115,7 +132,7 @@ function EntityIcon(props) {
|
|
|
115
132
|
return local.name;
|
|
116
133
|
}
|
|
117
134
|
}, rest), false, true);
|
|
118
|
-
insert(_el
|
|
135
|
+
insert(_el$2, createComponent(Show, {
|
|
119
136
|
get when() {
|
|
120
137
|
return glyph();
|
|
121
138
|
},
|
|
@@ -126,17 +143,24 @@ function EntityIcon(props) {
|
|
|
126
143
|
return value();
|
|
127
144
|
} })
|
|
128
145
|
}), null);
|
|
129
|
-
insert(_el
|
|
146
|
+
insert(_el$2, createComponent(Show, {
|
|
147
|
+
get when() {
|
|
148
|
+
return local.src;
|
|
149
|
+
},
|
|
150
|
+
keyed: true,
|
|
151
|
+
children: (src) => createComponent(EntityIconImage, { src })
|
|
152
|
+
}), null);
|
|
153
|
+
insert(_el$2, createComponent(Show, {
|
|
130
154
|
get when() {
|
|
131
155
|
return local.badge;
|
|
132
156
|
},
|
|
133
157
|
get children() {
|
|
134
|
-
var _el$
|
|
135
|
-
insert(_el$
|
|
136
|
-
return _el$
|
|
158
|
+
var _el$3 = _tmpl$2();
|
|
159
|
+
insert(_el$3, () => local.badge);
|
|
160
|
+
return _el$3;
|
|
137
161
|
}
|
|
138
162
|
}), null);
|
|
139
|
-
return _el
|
|
163
|
+
return _el$2;
|
|
140
164
|
})();
|
|
141
165
|
}
|
|
142
166
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-icon.js","names":["Show","splitProps","Component","ComponentProps","JSX","Dynamic","cva","VariantProps","cn","entityIconVariants","variants","shape","rounded","circle","square","size","xs","sm","md","lg","xl","tone","neutral","primary","bare","success","warning","danger","info","defaultVariants","EntityIconVariantProps","EntityIconProps","Omit","name","icon","Element","fallback","badge","ring","monogram","words","trim","split","filter","Boolean","length","toUpperCase","slice","Glyph","kind","value","props","glyph","_$createComponent","component","EntityIcon","local","rest","undefined","_el$","_tmpl$2","_$spread","_$mergeProps","class","aria-label","_$insert","when","_$memo","children","_el$2","_tmpl$","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/entity-icon/entity-icon.tsx"],"sourcesContent":["import { Show, splitProps, type Component, type ComponentProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * EntityIcon.\n *\n * A tile that stands for a thing: a room, a project, an agent, an installed\n * plugin, a workspace. Its job is to be identifiable in a column of its\n * siblings, which is a different job from `Avatar`'s (identifying a *person*) and\n * the reason the two are separate components rather than one with a `round` prop.\n *\n * Three decisions are baked in because getting them wrong is what makes icon\n * grids look messy:\n *\n * 1. **A glyph is always present.** A brand with no logo gets a monogram, not an\n * empty box. `fallback` takes the name and returns the glyph, so a caller can\n * choose initials, a domain letter, or a kind icon.\n * 2. **The tile owns its own contrast.** `tone` tints the background while\n * monogram text keeps the body foreground; vector glyphs retain the status\n * colour. A caller never picks a colour pair or ships a glyph that disappears.\n * 3. **Size is on the control ladder**, not arbitrary. A tile in a rail and a\n * tile in a detail header are the same two or three sizes every other\n * interactive element uses.\n *\n * `shape=\"rounded\"` is the default because a rounded square reads as an object\n * and a circle reads as a person; use `circle` only when the tile really does\n * hold a face.\n */\nexport const entityIconVariants = cva(\n 'relative inline-flex shrink-0 items-center justify-center overflow-hidden border font-semibold select-none [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n shape: {\n rounded: 'rounded-lg',\n circle: 'rounded-full',\n square: 'rounded-none',\n },\n size: {\n xs: 'size-5 text-2xs [&_svg]:size-3',\n sm: 'size-6 text-2xs [&_svg]:size-3.5',\n md: 'size-8 text-xs [&_svg]:size-4',\n lg: 'size-10 text-sm [&_svg]:size-5',\n xl: 'size-12 text-base [&_svg]:size-6',\n },\n tone: {\n /** Neutral: an inset tile with a hairline edge — the default. */\n neutral: 'border-border bg-muted text-muted-foreground',\n /** On the brand: for a thing the application itself owns. */\n primary: 'border-transparent bg-primary-subtle text-primary',\n /** Bare: no fill and no edge, for a tile that already sits on a surface. */\n bare: 'border-transparent bg-transparent text-foreground',\n success: 'border-transparent bg-success-subtle text-foreground [&_svg]:text-success',\n warning: 'border-transparent bg-warning-subtle text-foreground [&_svg]:text-warning',\n danger: 'border-transparent bg-destructive-subtle text-foreground [&_svg]:text-destructive',\n info: 'border-transparent bg-info-subtle text-foreground [&_svg]:text-info',\n },\n },\n defaultVariants: { shape: 'rounded', size: 'md', tone: 'neutral' },\n }\n)\n\ntype EntityIconVariantProps = VariantProps<typeof entityIconVariants>\n\nexport type EntityIconProps = Omit<ComponentProps<'span'>, 'children'> &\n EntityIconVariantProps & {\n /** The entity's name. Used for the accessible label and, via `fallback`, the monogram. */\n name: string\n /**\n * A logo or icon — a Lucide icon reference (`icon={Wrench}`) or an element\n * (`icon={<Wrench />}`). Both are accepted because both are what a caller\n * naturally writes, and the difference is an implementation detail they should\n * not have to know.\n */\n icon?: Component | JSX.Element\n /** Glyph for an entity with no icon. Defaults to the name's first two letters. */\n fallback?: (name: string) => JSX.Element\n /** A corner badge: a status dot, an unread count, an installed tick. */\n badge?: JSX.Element\n /** A second edge, drawn outside the tile — an active or selected ring. */\n ring?: boolean\n }\n\n/**\n * Two letters from a name, chosen so the result is stable and readable: the\n * first letter of the first two words when there are two (\"Agent HQ\" → \"AH\"),\n * otherwise the first two characters (\"Kitchen\" → \"Ki\").\n */\nexport function monogram(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length >= 2) return (words[0]![0]! + words[1]![0]!).toUpperCase()\n return name.trim().slice(0, 2)\n}\n\n/**\n * A glyph is either a component reference or an element, and the two render\n * differently — `Dynamic` for the first, the element itself for the second. The\n * union is discriminated so the branch is checked rather than cast.\n */\ntype Glyph = { kind: 'component'; value: Component } | { kind: 'element'; value: JSX.Element }\n\nfunction Glyph(props: { glyph: Glyph }) {\n return props.glyph.kind === 'component' ? (\n <Dynamic component={props.glyph.value} />\n ) : (\n props.glyph.value\n )\n}\n\nexport function EntityIcon(props: EntityIconProps) {\n const [local, rest] = splitProps(props, [\n 'name',\n 'icon',\n 'fallback',\n 'badge',\n 'ring',\n 'shape',\n 'size',\n 'tone',\n 'class',\n ])\n\n const glyph = (): Glyph | undefined => {\n const icon = local.icon\n if (!icon) return undefined\n return typeof icon === 'function'\n ? { kind: 'component', value: icon as Component }\n : { kind: 'element', value: icon as JSX.Element }\n }\n\n return (\n <span\n class={cn(\n entityIconVariants({ shape: local.shape, size: local.size, tone: local.tone }),\n local.ring && 'ring-2 ring-ring ring-offset-2 ring-offset-background',\n local.class\n )}\n role=\"img\"\n aria-label={local.name}\n {...rest}\n >\n <Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>\n <Show when={local.badge}>\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">{local.badge}</span>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAaS,qBAAqBH,IAChC,2JACA;CACEI,UAAU;EACRC,OAAO;GACLC,SAAS;GACTC,QAAQ;GACRC,QAAQ;EACV;EACAC,MAAM;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;EACN;EACAC,MAAM;;GAEJC,SAAS;;GAETC,SAAS;;GAETC,MAAM;GACNC,SAAS;GACTC,SAAS;GACTC,QAAQ;GACRC,MAAM;EACR;CACF;CACAC,iBAAiB;EAAElB,OAAO;EAAWI,MAAM;EAAMM,MAAM;CAAU;AACnE,CACF;;;;;;AA4BA,SAAgBkB,SAASN,MAAsB;CAC7C,MAAMO,QAAQP,KAAKQ,KAAK,CAAC,CAACC,MAAM,KAAK,CAAC,CAACC,OAAOC,OAAO;CACrD,IAAIJ,MAAMK,UAAU,GAAG,QAAQL,MAAM,EAAE,CAAE,KAAMA,MAAM,EAAE,CAAE,GAAA,CAAKM,YAAY;CAC1E,OAAOb,KAAKQ,KAAK,CAAC,CAACM,MAAM,GAAG,CAAC;AAC/B;AASA,SAASC,MAAMG,OAAyB;CACtC,OAAOA,MAAMC,MAAMH,SAAS,cAAWI,gBACpChD,SAAO,EAA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AA,IAAAC,QAAAC,OAAA;IAAAL,OAAAI,aACoDb,MAAMnB,KAAK;IAAA,OAAAgC;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAV;CAAA,EAAA,CAAA;AAI5F"}
|
|
1
|
+
{"version":3,"file":"entity-icon.js","names":["createSignal","Show","splitProps","Component","ComponentProps","JSX","Dynamic","cva","VariantProps","cn","entityIconVariants","variants","shape","rounded","circle","square","size","xs","sm","md","lg","xl","tone","neutral","primary","bare","success","warning","danger","info","defaultVariants","EntityIconVariantProps","EntityIconProps","Omit","name","src","icon","Element","fallback","badge","ring","monogram","words","trim","split","filter","Boolean","length","toUpperCase","slice","Glyph","kind","value","props","glyph","_$createComponent","component","EntityIconImage","failed","setFailed","when","children","_el$","_tmpl$","addEventListener","_$effect","_$setAttribute","EntityIcon","local","rest","undefined","_el$2","_tmpl$3","_$spread","_$mergeProps","class","aria-label","_$insert","_$memo","keyed","_el$3","_tmpl$2","_$createComponent","_$setAttribute","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/entity-icon/entity-icon.tsx"],"sourcesContent":["import {\n createSignal,\n Show,\n splitProps,\n type Component,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * EntityIcon.\n *\n * A tile that stands for a thing: a room, a project, an agent, an installed\n * plugin, a workspace. Its job is to be identifiable in a column of its\n * siblings, which is a different job from `Avatar`'s (identifying a *person*) and\n * the reason the two are separate components rather than one with a `round` prop.\n *\n * Three decisions are baked in because getting them wrong is what makes icon\n * grids look messy:\n *\n * 1. **A glyph is always present.** A brand with no logo gets a monogram, not an\n * empty box. `fallback` takes the name and returns the glyph, so a caller can\n * choose initials, a domain letter, or a kind icon. When `src` is supplied,\n * its contained image overlays that glyph and failure reveals the glyph below.\n * 2. **The tile owns its own contrast.** `tone` tints the background while\n * monogram text keeps the body foreground; vector glyphs retain the status\n * colour. A caller never picks a colour pair or ships a glyph that disappears.\n * 3. **Size is on the control ladder**, not arbitrary. A tile in a rail and a\n * tile in a detail header are the same two or three sizes every other\n * interactive element uses.\n *\n * `shape=\"rounded\"` is the default because a rounded square reads as an object\n * and a circle reads as a person; use `circle` only when the tile really does\n * hold a face.\n */\nexport const entityIconVariants = cva(\n 'relative inline-flex shrink-0 items-center justify-center overflow-hidden border font-semibold select-none [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n shape: {\n rounded: 'rounded-lg',\n circle: 'rounded-full',\n square: 'rounded-none',\n },\n size: {\n xs: 'size-5 text-2xs [&_svg]:size-3',\n sm: 'size-6 text-2xs [&_svg]:size-3.5',\n md: 'size-8 text-xs [&_svg]:size-4',\n lg: 'size-10 text-sm [&_svg]:size-5',\n xl: 'size-12 text-base [&_svg]:size-6',\n },\n tone: {\n /** Neutral: an inset tile with a hairline edge — the default. */\n neutral: 'border-border bg-muted text-muted-foreground',\n /** On the brand: for a thing the application itself owns. */\n primary: 'border-transparent bg-primary-subtle text-primary',\n /** Bare: no fill and no edge, for a tile that already sits on a surface. */\n bare: 'border-transparent bg-transparent text-foreground',\n success: 'border-transparent bg-success-subtle text-foreground [&_svg]:text-success',\n warning: 'border-transparent bg-warning-subtle text-foreground [&_svg]:text-warning',\n danger: 'border-transparent bg-destructive-subtle text-foreground [&_svg]:text-destructive',\n info: 'border-transparent bg-info-subtle text-foreground [&_svg]:text-info',\n },\n },\n defaultVariants: { shape: 'rounded', size: 'md', tone: 'neutral' },\n }\n)\n\ntype EntityIconVariantProps = VariantProps<typeof entityIconVariants>\n\nexport type EntityIconProps = Omit<ComponentProps<'span'>, 'children'> &\n EntityIconVariantProps & {\n /** The entity's name. Used for the accessible label and, via `fallback`, the monogram. */\n name: string\n /** Optional image URL. The image is decorative; `name` remains the accessible label. */\n src?: string\n /**\n * A logo or icon — a Lucide icon reference (`icon={Wrench}`) or an element\n * (`icon={<Wrench />}`). Both are accepted because both are what a caller\n * naturally writes, and the difference is an implementation detail they should\n * not have to know.\n */\n icon?: Component | JSX.Element\n /** Glyph for an entity with no icon. Defaults to the name's first two letters. */\n fallback?: (name: string) => JSX.Element\n /** A corner badge: a status dot, an unread count, an installed tick. */\n badge?: JSX.Element\n /** A second edge, drawn outside the tile — an active or selected ring. */\n ring?: boolean\n }\n\n/**\n * Two letters from a name, chosen so the result is stable and readable: the\n * first letter of the first two words when there are two (\"Agent HQ\" → \"AH\"),\n * otherwise the first two characters (\"Kitchen\" → \"Ki\").\n */\nexport function monogram(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length >= 2) return (words[0]![0]! + words[1]![0]!).toUpperCase()\n return name.trim().slice(0, 2)\n}\n\n/**\n * A glyph is either a component reference or an element, and the two render\n * differently — `Dynamic` for the first, the element itself for the second. The\n * union is discriminated so the branch is checked rather than cast.\n */\ntype Glyph = { kind: 'component'; value: Component } | { kind: 'element'; value: JSX.Element }\n\nfunction Glyph(props: { glyph: Glyph }) {\n return props.glyph.kind === 'component' ? (\n <Dynamic component={props.glyph.value} />\n ) : (\n props.glyph.value\n )\n}\n\nfunction EntityIconImage(props: { src: string }) {\n const [failed, setFailed] = createSignal(false)\n\n return (\n <Show when={!failed()}>\n <img\n data-slot=\"entity-icon-image\"\n src={props.src}\n alt=\"\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 size-full object-contain\"\n onError={() => setFailed(true)}\n />\n </Show>\n )\n}\n\nexport function EntityIcon(props: EntityIconProps) {\n const [local, rest] = splitProps(props, [\n 'name',\n 'src',\n 'icon',\n 'fallback',\n 'badge',\n 'ring',\n 'shape',\n 'size',\n 'tone',\n 'class',\n ])\n\n const glyph = (): Glyph | undefined => {\n const icon = local.icon\n if (!icon) return undefined\n return typeof icon === 'function'\n ? { kind: 'component', value: icon as Component }\n : { kind: 'element', value: icon as JSX.Element }\n }\n\n return (\n <span\n class={cn(\n entityIconVariants({ shape: local.shape, size: local.size, tone: local.tone }),\n local.ring && 'ring-2 ring-ring ring-offset-2 ring-offset-background',\n local.class\n )}\n role=\"img\"\n aria-label={local.name}\n {...rest}\n >\n <Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>\n <Show when={local.src} keyed>\n {(src) => <EntityIconImage src={src} />}\n </Show>\n <Show when={local.badge}>\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">{local.badge}</span>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAaU,qBAAqBH,IAChC,2JACA;CACEI,UAAU;EACRC,OAAO;GACLC,SAAS;GACTC,QAAQ;GACRC,QAAQ;EACV;EACAC,MAAM;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;EACN;EACAC,MAAM;;GAEJC,SAAS;;GAETC,SAAS;;GAETC,MAAM;GACNC,SAAS;GACTC,SAAS;GACTC,QAAQ;GACRC,MAAM;EACR;CACF;CACAC,iBAAiB;EAAElB,OAAO;EAAWI,MAAM;EAAMM,MAAM;CAAU;AACnE,CACF;;;;;;AA8BA,SAAgBmB,SAASP,MAAsB;CAC7C,MAAMQ,QAAQR,KAAKS,KAAK,CAAC,CAACC,MAAM,KAAK,CAAC,CAACC,OAAOC,OAAO;CACrD,IAAIJ,MAAMK,UAAU,GAAG,QAAQL,MAAM,EAAE,CAAE,KAAMA,MAAM,EAAE,CAAE,GAAA,CAAKM,YAAY;CAC1E,OAAOd,KAAKS,KAAK,CAAC,CAACM,MAAM,GAAG,CAAC;AAC/B;AASA,SAASC,MAAMG,OAAyB;CACtC,OAAOA,MAAMC,MAAMH,SAAS,cAAWI,gBACpCjD,SAAO,EAAA,IAACkD,YAAS;EAAA,OAAEH,MAAMC,MAAMF;CAAK,EAAA,CAAA,IAErCC,MAAMC,MAAMF;AAEhB;AAEA,SAASK,gBAAgBJ,OAAwB;CAC/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AC;GAAA2B,WAE1ET,UAAKG,gBAAML,OAAK,EAAA,IAACI,QAAK;IAAA,OAAEF,MAAM;GAAC,EAAA,CAAA;EAAI,CAAA,GAAA,IAAA;EAAAyB,OAAAN,OAAAhB,gBAEtCtD,MAAI;GAAA,IAAC2D,OAAI;IAAA,OAAEQ,MAAMjC;GAAG;GAAE4C,OAAK;GAAAlB,WACxB1B,QAAGoB,gBAAME,iBAAe,EAAMtB,IAAG,CAAA;EAAI,CAAA,GAAA,IAAA;EAAA0C,OAAAN,OAAAhB,gBAExCtD,MAAI;GAAA,IAAC2D,OAAI;IAAA,OAAEQ,MAAM7B;GAAK;GAAA,IAAAsB,WAAA;IAAA,IAAAmB,QAAAC,QAAA;IAAAJ,OAAAG,aACoDZ,MAAM7B,KAAK;IAAA,OAAAyC;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAT;CAAA,EAAA,CAAA;AAI5F"}
|
|
@@ -1,39 +1,62 @@
|
|
|
1
1
|
import { TextField as KobalteTextField } from '@kobalte/core/text-field';
|
|
2
|
-
import type { ComponentProps } from 'solid-js';
|
|
2
|
+
import type { ComponentProps, JSX } from 'solid-js';
|
|
3
3
|
/**
|
|
4
4
|
* Field.
|
|
5
5
|
*
|
|
6
6
|
* The wrapper that makes a form control describable and validatable: a label,
|
|
7
7
|
* a description, an error message, and the ARIA relationships between them.
|
|
8
8
|
*
|
|
9
|
+
* This Kobalte TextField composition is for its own `FieldLabel`, `FieldInput`
|
|
10
|
+
* and `FieldTextArea` parts. Use `FormField` to wire the standalone shared
|
|
11
|
+
* controls, including checkboxes, switches and comboboxes.
|
|
12
|
+
*
|
|
9
13
|
* It is built on Kobalte's TextField specifically so `aria-describedby`,
|
|
10
14
|
* `aria-invalid` and `aria-errormessage` are wired by construction. Those three
|
|
11
15
|
* attributes are the difference between "this field is required and empty" and
|
|
12
16
|
* a red border that only a sighted user can perceive — and they are also the
|
|
13
17
|
* first thing a hand-rolled form drops.
|
|
14
18
|
*
|
|
15
|
-
* `Field` owns the description and the error slot, so
|
|
16
|
-
*
|
|
17
|
-
|
|
19
|
+
* `Field` owns the description and the error slot, so its controls line up and
|
|
20
|
+
* its messages land in the same place regardless of which TextField part is used.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Field(props: ComponentProps<typeof KobalteTextField>): JSX.Element;
|
|
23
|
+
export type FormFieldProps = Omit<ComponentProps<'div'>, 'children' | 'ref'> & {
|
|
24
|
+
label: string;
|
|
25
|
+
hint?: string;
|
|
26
|
+
error?: string;
|
|
27
|
+
controlId?: string;
|
|
28
|
+
group?: boolean;
|
|
29
|
+
children: JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* FormField.
|
|
33
|
+
*
|
|
34
|
+
* A shared label, help and validation wrapper for any one shared control. Its
|
|
35
|
+
* context is consumed by Input, Textarea, NativeSelect, Checkbox, Switch,
|
|
36
|
+
* RadioGroup and ComboboxInput, so the actual focusable element receives the
|
|
37
|
+
* generated ID and description relationships. Set `group` when the label names
|
|
38
|
+
* a set of controls; the wrapper then uses fieldset and legend semantics.
|
|
18
39
|
*/
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function FieldLabel(props: ComponentProps<typeof KobalteTextField.Label>):
|
|
21
|
-
export declare function FieldDescription(props: ComponentProps<typeof KobalteTextField.Description>):
|
|
22
|
-
export declare function FieldError(props: ComponentProps<typeof KobalteTextField.ErrorMessage>):
|
|
23
|
-
export declare function FieldInput(props: ComponentProps<typeof KobalteTextField.Input>):
|
|
24
|
-
export declare function FieldTextArea(props: ComponentProps<typeof KobalteTextField.TextArea>):
|
|
40
|
+
export declare function FormField(props: FormFieldProps): JSX.Element;
|
|
41
|
+
export declare function FieldLabel(props: ComponentProps<typeof KobalteTextField.Label>): JSX.Element;
|
|
42
|
+
export declare function FieldDescription(props: ComponentProps<typeof KobalteTextField.Description>): JSX.Element;
|
|
43
|
+
export declare function FieldError(props: ComponentProps<typeof KobalteTextField.ErrorMessage>): JSX.Element;
|
|
44
|
+
export declare function FieldInput(props: ComponentProps<typeof KobalteTextField.Input>): JSX.Element;
|
|
45
|
+
export declare function FieldTextArea(props: ComponentProps<typeof KobalteTextField.TextArea>): JSX.Element;
|
|
25
46
|
/**
|
|
26
47
|
* A labelled group of fields with a single legend, for a real `<fieldset>`.
|
|
27
48
|
* Grouping is what lets a screen reader announce "Shipping address, group"
|
|
28
49
|
* before reading the four fields inside it.
|
|
29
50
|
*/
|
|
30
|
-
export declare function FieldSet(props: ComponentProps<'fieldset'>):
|
|
51
|
+
export declare function FieldSet(props: ComponentProps<'fieldset'>): JSX.Element;
|
|
52
|
+
/** A visual stack for related controls that does not imply fieldset semantics. */
|
|
53
|
+
export declare function FieldGroup(props: ComponentProps<'div'>): JSX.Element;
|
|
31
54
|
export declare function FieldLegend(props: ComponentProps<'legend'> & {
|
|
32
55
|
variant?: 'legend' | 'label';
|
|
33
|
-
}):
|
|
56
|
+
}): JSX.Element;
|
|
34
57
|
/** A horizontal rule with a word in it, for "or continue with" separators. */
|
|
35
58
|
export declare function FieldSeparator(props: {
|
|
36
59
|
class?: string;
|
|
37
60
|
children?: ComponentProps<'span'>['children'];
|
|
38
|
-
}):
|
|
61
|
+
}): JSX.Element;
|
|
39
62
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/field/field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/field/field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;A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