@adea-ai/ui 0.71.6 → 0.72.1
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/components/theme/theme-picker.d.ts.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/ui/button/button.js +1 -1
- package/dist/components/ui/button/button.js.map +1 -1
- 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 +52 -13
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts +2 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +46 -13
- 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 +51 -12
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/lib/themes.d.ts +3 -0
- package/dist/lib/themes.d.ts.map +1 -1
- package/dist/lib/themes.js +6 -7
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +14 -2
- package/dist/lib/tokens.js.map +1 -1
- package/dist/r/appearance-editor.json +1 -1
- package/dist/r/lib.json +1 -1
- package/dist/r/registry.json +2 -2
- package/dist/r/src/components/theme/theme-picker.tsx +5 -2
- package/dist/r/src/components/ui/button/button.tsx +1 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +34 -9
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +22 -5
- package/dist/r/src/components/ui/switch/switch.tsx +34 -9
- package/dist/r/src/lib/themes.ts +18 -7
- package/dist/r/src/lib/tokens.ts +15 -2
- package/dist/r/src/styles/theme.css +6 -0
- package/package.json +2 -2
- package/registry.json +2 -2
- package/src/components/theme/theme-picker.tsx +5 -2
- package/src/components/ui/button/button.tsx +1 -1
- package/src/components/ui/checkbox/checkbox.tsx +34 -9
- package/src/components/ui/radio-group/radio-group.tsx +22 -5
- package/src/components/ui/switch/switch.tsx +34 -9
- package/src/lib/themes.ts +18 -7
- package/src/lib/tokens.ts +15 -2
- package/src/styles/theme.css +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-picker.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IACtD,KAAK,EAAE,YAAY,CAAA;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAQD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAgClD;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACtD,KAAK,EAAE,YAAY,CAAA;IACnB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"theme-picker.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IACtD,KAAK,EAAE,YAAY,CAAA;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAQD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAgClD;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACtD,KAAK,EAAE,YAAY,CAAA;IACnB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,kCAyCpD;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACrD,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CAC7C,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAoClD"}
|
|
@@ -33,7 +33,7 @@ function ThemeSwatch(props) {
|
|
|
33
33
|
colors().card,
|
|
34
34
|
colors().primary,
|
|
35
35
|
colors().accent,
|
|
36
|
-
colors().
|
|
36
|
+
colors().destructiveAction
|
|
37
37
|
];
|
|
38
38
|
},
|
|
39
39
|
children: (color) => (() => {
|
|
@@ -64,7 +64,7 @@ function ThemePreview(props) {
|
|
|
64
64
|
}
|
|
65
65
|
}, rest), false, true);
|
|
66
66
|
effect((_p$) => {
|
|
67
|
-
var _v$ = c().sidebar, _v$2 = c().sidebarBorder, _v$3 = c().primary, _v$4 = c().sidebarAccent, _v$5 = c().sidebarAccent, _v$6 = c().foreground, _v$7 = c().mutedForeground, _v$8 = c().mutedForeground, _v$9 = c().primary, _v$0 = c().
|
|
67
|
+
var _v$ = c().sidebar, _v$2 = c().sidebarBorder, _v$3 = c().primary, _v$4 = c().sidebarAccent, _v$5 = c().sidebarAccent, _v$6 = c().foreground, _v$7 = c().mutedForeground, _v$8 = c().mutedForeground, _v$9 = c().primary, _v$0 = c().destructiveAction, _v$1 = c().secondary;
|
|
68
68
|
_v$ !== _p$.e && setStyleProperty(_el$5, "background-color", _p$.e = _v$);
|
|
69
69
|
_v$2 !== _p$.t && setStyleProperty(_el$5, "--preview-edge", _p$.t = _v$2);
|
|
70
70
|
_v$3 !== _p$.a && setStyleProperty(_el$6, "background-color", _p$.a = _v$3);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-picker.js","names":["ComponentProps","For","Show","splitProps","cn","ThemeVariant","Button","ThemeSwatchProps","theme","size","swatchSizes","sm","md","lg","const","ThemeSwatch","props","local","rest","colors","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","background","card","primary","accent","destructive","children","color","_el$2","_tmpl$2","_$setStyleProperty","_$effect","_$className","ThemePreviewProps","selected","ThemePreview","c","_el$3","_tmpl$3","_el$4","firstChild","_el$5","_el$6","_el$7","nextSibling","_el$8","_el$9","_el$0","_el$1","_el$10","_el$11","_el$12","_el$13","_el$14","style","_p$","_v$","sidebar","_v$2","sidebarBorder","_v$3","_v$4","sidebarAccent","_v$5","_v$6","foreground","_v$7","mutedForeground","_v$8","_v$9","_v$0","_v$1","secondary","e","t","a","o","i","n","s","h","r","d","l","undefined","ThemePickerProps","themes","selectedId","onThemeSelect","ThemePicker","_el$15","_tmpl$4","as","type","variant","role","aria-checked","id","aria-label","familyLabel","label","onClick","_el$16","_tmpl$6","_el$17","when","family","_el$18","_tmpl$5","_$mergeProps","_$createComponent","_$className","_$setStyleProperty"],"sources":["../../../src/components/theme/theme-picker.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport type { ThemeVariant } from '#lib/themes'\nimport { Button } from '../ui/button/button'\n\n/**\n * ThemeSwatch.\n *\n * The colours of a theme, as a small readable strip: the canvas, a card, the\n * primary, an accent and the destructive fill. Enough to tell two dark themes\n * apart at a glance and to recognise the one you want without applying it.\n *\n * A swatch is **read from the variant object**, not from a stylesheet, so a picker\n * can show a theme that is not currently applied — which is the whole point of a\n * picker. That is also why the catalogue is data rather than CSS.\n */\nexport type ThemeSwatchProps = ComponentProps<'span'> & {\n theme: ThemeVariant\n /** Draw the swatch at the given size. */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst swatchSizes = {\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-8 w-8',\n} as const\n\nexport function ThemeSwatch(props: ThemeSwatchProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'size'])\n const colors = () => local.theme.colors\n\n return (\n <span\n data-slot=\"theme-swatch\"\n aria-hidden=\"true\"\n class={cn(\n 'border-border inline-flex shrink-0 overflow-hidden rounded-md border',\n local.class\n )}\n {...rest}\n >\n <For\n each={[\n colors().background,\n colors().card,\n colors().primary,\n colors().accent,\n colors().destructive,\n ]}\n >\n {(color) => (\n <span\n class={cn('block', swatchSizes[local.size ?? 'md'])}\n style={{ 'background-color': color }}\n />\n )}\n </For>\n </span>\n )\n}\n\n/**\n * ThemePreview.\n *\n * A miniature of the interface, painted in a theme's own colours: a rail, a panel,\n * a heading, body text, a primary button and a destructive one.\n *\n * The point is that a colour strip cannot answer the question a user actually has —\n * \"would I want to look at this all day?\" — and a real preview can. It is drawn\n * with inline colours from the variant rather than by applying the theme, so a list\n * of twenty previews costs one object read each instead of twenty theme swaps.\n */\nexport type ThemePreviewProps = ComponentProps<'div'> & {\n theme: ThemeVariant\n /** Highlight the preview as the current selection. */\n selected?: boolean\n}\n\nexport function ThemePreview(props: ThemePreviewProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'selected'])\n const c = () => local.theme.colors\n\n return (\n <div\n data-slot=\"theme-preview\"\n class={cn(\n 'w-44 overflow-hidden rounded-lg border shadow-xs',\n local.selected ? 'border-primary ring-3 ring-primary-subtle' : 'border-border',\n local.class\n )}\n style={{ 'background-color': c().background }}\n {...rest}\n >\n <div class=\"flex h-24\">\n {/* A rail and a panel: the two surfaces a user spends the day looking at. */}\n <div\n class=\"theme-preview-edge flex w-6 flex-col items-center gap-1.5 border-e py-2\"\n style={{ 'background-color': c().sidebar, '--preview-edge': c().sidebarBorder }}\n >\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n </div>\n <div class=\"flex flex-1 flex-col gap-1.5 p-2\">\n <div class=\"h-1.5 w-14 rounded-full\" style={{ 'background-color': c().foreground }} />\n <div class=\"h-1 w-20 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"h-1 w-16 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"mt-auto flex items-center gap-1\">\n <span class=\"h-3 w-9 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().destructive }} />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().secondary }} />\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * ThemePicker.\n *\n * The catalogue as a selectable grid. One appearance at a time — a light picker\n * lists light themes and a dark picker lists dark ones — because choosing a dark\n * theme while looking at a light interface is a choice nobody can evaluate.\n *\n * `onSelect` rather than an internal signal: the selection belongs to the\n * preference the provider owns, and a picker that kept its own copy could disagree\n * with what is applied.\n */\nexport type ThemePickerProps = ComponentProps<'div'> & {\n themes: readonly ThemeVariant[]\n selectedId: string\n onThemeSelect: (theme: ThemeVariant) => void\n}\n\nexport function ThemePicker(props: ThemePickerProps) {\n const [local, rest] = splitProps(props, ['class', 'themes', 'selectedId', 'onThemeSelect'])\n\n return (\n <div\n data-slot=\"theme-picker\"\n role=\"radiogroup\"\n aria-label=\"Theme\"\n class={cn('flex flex-wrap gap-3', local.class)}\n {...rest}\n >\n <For each={local.themes}>\n {(theme) => (\n <Button\n as=\"button\"\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"radio\"\n aria-checked={local.selectedId === theme.id}\n aria-label={`${theme.familyLabel} ${theme.label}`}\n class=\"h-auto flex-col gap-1.5 p-0 hover:bg-transparent\"\n onClick={() => local.onThemeSelect(theme)}\n >\n <ThemePreview theme={theme} selected={local.selectedId === theme.id} />\n <span class=\"flex flex-col items-center\">\n <span class=\"text-xs font-medium\">{theme.label}</span>\n <Show when={theme.family !== 'adea'}>\n <span class=\"text-muted-foreground text-2xs\">{theme.familyLabel}</span>\n </Show>\n </span>\n </Button>\n )}\n </For>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAMU,cAAc;CAClBC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAEA,SAAgBE,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQf,WAAWa,OAAO;EAAC;EAAS;EAAS;CAAM,CAAC;CAClE,MAAMG,eAAeF,MAAMT,MAAMW;CAEjC,cAAA;EAAA,IAAAC,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAIWnB,GACL,wEACAa,MAAMO,KACR;EAAC,EAAA,GACGN,IAAI,GAAA,OAAA,IAAA;EAAAO,OAAAL,MAAAM,gBAEPzB,KAAG;GAAA,IACF0B,OAAI;IAAA,OAAE;KACJR,OAAO,CAAC,CAACS;KACTT,OAAO,CAAC,CAACU;KACTV,OAAO,CAAC,CAACW;KACTX,OAAO,CAAC,CAACY;KACTZ,OAAO,CAAC,CAACa;IAAW;GACrB;GAAAC,WAECC,iBAAK;IAAA,IAAAC,QAAAC,QAAA;IAAAC,iBAAAF,OAAA,oBAG0BD,KAAK;IAAAI,aAAAC,UAAAJ,OAD3B/B,GAAG,SAASM,YAAYO,MAAMR,QAAQ,KAAK,CAAC,CAAA;IAAA,O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chSizes","sm","md","lg","const","ThemeSwatch","props","local","rest","colors","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","background","card","primary","accent","destructiveAction","children","color","_el$2","_tmpl$2","_$setStyleProperty","_$effect","_$className","ThemePreviewProps","selected","ThemePreview","c","_el$3","_tmpl$3","_el$4","firstChild","_el$5","_el$6","_el$7","nextSibling","_el$8","_el$9","_el$0","_el$1","_el$10","_el$11","_el$12","_el$13","_el$14","style","_p$","_v$","sidebar","_v$2","sidebarBorder","_v$3","_v$4","sidebarAccent","_v$5","_v$6","foreground","_v$7","mutedForeground","_v$8","_v$9","_v$0","_v$1","secondary","e","t","a","o","i","n","s","h","r","d","l","undefined","ThemePickerProps","themes","selectedId","onThemeSelect","ThemePicker","_el$15","_tmpl$4","as","type","variant","role","aria-checked","id","aria-label","familyLabel","label","onClick","_el$16","_tmpl$6","_el$17","when","family","_el$18","_tmpl$5","_$mergeProps","_$createComponent","_$className","_$setStyleProperty"],"sources":["../../../src/components/theme/theme-picker.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport type { ThemeVariant } from '#lib/themes'\nimport { Button } from '../ui/button/button'\n\n/**\n * ThemeSwatch.\n *\n * The colours of a theme, as a small readable strip: the canvas, a card, the\n * primary, an accent and the destructive fill. Enough to tell two dark themes\n * apart at a glance and to recognise the one you want without applying it.\n *\n * A swatch is **read from the variant object**, not from a stylesheet, so a picker\n * can show a theme that is not currently applied — which is the whole point of a\n * picker. That is also why the catalogue is data rather than CSS.\n */\nexport type ThemeSwatchProps = ComponentProps<'span'> & {\n theme: ThemeVariant\n /** Draw the swatch at the given size. */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst swatchSizes = {\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-8 w-8',\n} as const\n\nexport function ThemeSwatch(props: ThemeSwatchProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'size'])\n const colors = () => local.theme.colors\n\n return (\n <span\n data-slot=\"theme-swatch\"\n aria-hidden=\"true\"\n class={cn(\n 'border-border inline-flex shrink-0 overflow-hidden rounded-md border',\n local.class\n )}\n {...rest}\n >\n <For\n each={[\n colors().background,\n colors().card,\n colors().primary,\n colors().accent,\n colors().destructiveAction,\n ]}\n >\n {(color) => (\n <span\n class={cn('block', swatchSizes[local.size ?? 'md'])}\n style={{ 'background-color': color }}\n />\n )}\n </For>\n </span>\n )\n}\n\n/**\n * ThemePreview.\n *\n * A miniature of the interface, painted in a theme's own colours: a rail, a panel,\n * a heading, body text, a primary button and a destructive one.\n *\n * The point is that a colour strip cannot answer the question a user actually has —\n * \"would I want to look at this all day?\" — and a real preview can. It is drawn\n * with inline colours from the variant rather than by applying the theme, so a list\n * of twenty previews costs one object read each instead of twenty theme swaps.\n */\nexport type ThemePreviewProps = ComponentProps<'div'> & {\n theme: ThemeVariant\n /** Highlight the preview as the current selection. */\n selected?: boolean\n}\n\nexport function ThemePreview(props: ThemePreviewProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'selected'])\n const c = () => local.theme.colors\n\n return (\n <div\n data-slot=\"theme-preview\"\n class={cn(\n 'w-44 overflow-hidden rounded-lg border shadow-xs',\n local.selected ? 'border-primary ring-3 ring-primary-subtle' : 'border-border',\n local.class\n )}\n style={{ 'background-color': c().background }}\n {...rest}\n >\n <div class=\"flex h-24\">\n {/* A rail and a panel: the two surfaces a user spends the day looking at. */}\n <div\n class=\"theme-preview-edge flex w-6 flex-col items-center gap-1.5 border-e py-2\"\n style={{ 'background-color': c().sidebar, '--preview-edge': c().sidebarBorder }}\n >\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n </div>\n <div class=\"flex flex-1 flex-col gap-1.5 p-2\">\n <div class=\"h-1.5 w-14 rounded-full\" style={{ 'background-color': c().foreground }} />\n <div class=\"h-1 w-20 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"h-1 w-16 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"mt-auto flex items-center gap-1\">\n <span class=\"h-3 w-9 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span\n class=\"h-3 w-6 rounded-sm\"\n style={{ 'background-color': c().destructiveAction }}\n />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().secondary }} />\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * ThemePicker.\n *\n * The catalogue as a selectable grid. One appearance at a time — a light picker\n * lists light themes and a dark picker lists dark ones — because choosing a dark\n * theme while looking at a light interface is a choice nobody can evaluate.\n *\n * `onSelect` rather than an internal signal: the selection belongs to the\n * preference the provider owns, and a picker that kept its own copy could disagree\n * with what is applied.\n */\nexport type ThemePickerProps = ComponentProps<'div'> & {\n themes: readonly ThemeVariant[]\n selectedId: string\n onThemeSelect: (theme: ThemeVariant) => void\n}\n\nexport function ThemePicker(props: ThemePickerProps) {\n const [local, rest] = splitProps(props, ['class', 'themes', 'selectedId', 'onThemeSelect'])\n\n return (\n <div\n data-slot=\"theme-picker\"\n role=\"radiogroup\"\n aria-label=\"Theme\"\n class={cn('flex flex-wrap gap-3', local.class)}\n {...rest}\n >\n <For each={local.themes}>\n {(theme) => (\n <Button\n as=\"button\"\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"radio\"\n aria-checked={local.selectedId === theme.id}\n aria-label={`${theme.familyLabel} ${theme.label}`}\n class=\"h-auto flex-col gap-1.5 p-0 hover:bg-transparent\"\n onClick={() => local.onThemeSelect(theme)}\n >\n <ThemePreview theme={theme} selected={local.selectedId === theme.id} />\n <span class=\"flex flex-col items-center\">\n <span class=\"text-xs font-medium\">{theme.label}</span>\n <Show when={theme.family !== 'adea'}>\n <span class=\"text-muted-foreground text-2xs\">{theme.familyLabel}</span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AetF,MAAMgG;IAAE;IAAA,KAAA,gBAAA;KAAA,OAC/B,GAAGhG,MAAMkG,YAAW,GAAIlG,MAAMmG;IAAO;IAAA,SAAA;IAEjDC,eAAe3F,MAAM8E,cAAcvF,KAAK;IAAC,IAAAyB,WAAA;KAAA,OAAA,CAAAP,gBAExCgB,cAAY;MAAQlC;MAAK,IAAEiC,WAAQ;OAAA,OAAExB,MAAM6E,eAAetF,MAAMgG;MAAE;KAAA,CAAA,UAAA;MAAA,IAAAK,SAAAC,QAAA,GAAAC,SAAAF,OAAA9D;MAAAtB,OAAAsF,cAE9BvG,MAAMmG,KAAK;MAAAlF,OAAAoF,QAAAnF,gBAC7CxB,MAAI;OAAA,IAAC8G,OAAI;QAAA,OAAExG,MAAMyG,WAAW;OAAM;OAAA,IAAAhF,WAAA;QAAA,IAAAiF,SAAAC,QAAA;QAAA1F,OAAAyF,cACa1G,MAAMkG,WAAW;QAAA,OAAAQ;OAAA;MAAA,CAAA,GAAA,IAAA;MAAA,OAAAL;KAAA,EAAA,CAAA,CAAA;IAAA;GAAA,CAAA;EAItE,CAAA,CAAA;EAAA,OAAAZ;CAAA,EAAA,CAAA;AAIT"}
|
|
@@ -27,7 +27,7 @@ var buttonVariants = cva(`${controlInteractive} inline-flex shrink-0 items-cente
|
|
|
27
27
|
default: "bg-primary text-primary-foreground hover:bg-primary-hover",
|
|
28
28
|
secondary: "bg-secondary text-secondary-foreground hover:bg-surface-hover",
|
|
29
29
|
/** For the action that destroys something. Never the default. */
|
|
30
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive-subtle",
|
|
30
|
+
destructive: "bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle",
|
|
31
31
|
/** A bordered button for a surface that already has a fill. */
|
|
32
32
|
outline: "border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input",
|
|
33
33
|
/** No chrome until hover. The default for toolbar and row actions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["Polymorphic","PolymorphicProps","ComponentProps","splitProps","ValidComponent","cva","controlInteractive","controlSize","VariantProps","cn","buttonVariants","variants","variant","default","secondary","destructive","outline","ghost","subtle","success","link","size","xs","sm","md","lg","xl","defaultVariants","ButtonVariantProps","ButtonProps","T","class","Button","props","local","rest","_$createComponent","_$mergeProps","as","type","_$createComponent","_$mergeProps"],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, splitProps, type ValidComponent } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive-subtle',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const [local, rest] = splitProps(props as ButtonProps, ['variant', 'size', 'class'])\n\n return (\n <Polymorphic\n as=\"button\"\n type=\"button\"\n class={cn(buttonVariants({ variant: local.variant, size: local.size }), local.class)}\n {...(rest as ComponentProps<'button'>)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAaU,iBAAiBL,IAC5B,GAAGC,mBAAkB,sJACrB;CACEK,UAAU;EACRC,SAAS;;GAEPC,SAAS;GACTC,WAAW;;GAEXC,aACE;;GAEFC,SACE;;GAEFC,OAAO;;GAEPC,QAAQ;GACRC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;GACJ,OAAO,GAAGd,YAAY,OAAM;GAC5Be,IAAI,GAAGf,YAAYe,GAAE;GACrBC,IAAI,GAAGhB,YAAYgB,GAAE;GACrBC,IAAI,GAAGjB,YAAYiB,GAAE;GACrBC,IAAI,GAAGlB,YAAYkB,GAAE;GACrBC,IAAI,GAAGnB,YAAYmB,GAAE;GAKrB,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;EACb;CACF;CACAC,iBAAiB;EACff,SAAS;EACTS,MAAM;CACR;AACF,CACF;AAWA,SAAgBW,OAA4CC,OAAuB;CACjF,MAAM,CAACC,OAAOC,QAAQhC,WAAW8B,OAAsB;EAAC;EAAW;EAAQ;CAAO,CAAC;CAEnF,OAAAG,gBACGpC,aAAWqC,WAAA;EACVC,IAAE;EACFC,MAAI;EAAA,KAAA,WAAA;GAAA,OACG9B,GAAGC,eAAe;IAAEE,SAASsB,MAAMtB;IAASS,MAAMa,MAAMb;GAAK,CAAC,GAAGa,MAAMH,KAAK;EAAC;CAAA,GAC/EI,IAAgC,CAAA;AAG3C"}
|
|
1
|
+
{"version":3,"file":"button.js","names":["Polymorphic","PolymorphicProps","ComponentProps","splitProps","ValidComponent","cva","controlInteractive","controlSize","VariantProps","cn","buttonVariants","variants","variant","default","secondary","destructive","outline","ghost","subtle","success","link","size","xs","sm","md","lg","xl","defaultVariants","ButtonVariantProps","ButtonProps","T","class","Button","props","local","rest","_$createComponent","_$mergeProps","as","type","_$createComponent","_$mergeProps"],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, splitProps, type ValidComponent } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const [local, rest] = splitProps(props as ButtonProps, ['variant', 'size', 'class'])\n\n return (\n <Polymorphic\n as=\"button\"\n type=\"button\"\n class={cn(buttonVariants({ variant: local.variant, size: local.size }), local.class)}\n {...(rest as ComponentProps<'button'>)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAaU,iBAAiBL,IAC5B,GAAGC,mBAAkB,sJACrB;CACEK,UAAU;EACRC,SAAS;;GAEPC,SAAS;GACTC,WAAW;;GAEXC,aACE;;GAEFC,SACE;;GAEFC,OAAO;;GAEPC,QAAQ;GACRC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;GACJ,OAAO,GAAGd,YAAY,OAAM;GAC5Be,IAAI,GAAGf,YAAYe,GAAE;GACrBC,IAAI,GAAGhB,YAAYgB,GAAE;GACrBC,IAAI,GAAGjB,YAAYiB,GAAE;GACrBC,IAAI,GAAGlB,YAAYkB,GAAE;GACrBC,IAAI,GAAGnB,YAAYmB,GAAE;GAKrB,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;EACb;CACF;CACAC,iBAAiB;EACff,SAAS;EACTS,MAAM;CACR;AACF,CACF;AAWA,SAAgBW,OAA4CC,OAAuB;CACjF,MAAM,CAACC,OAAOC,QAAQhC,WAAW8B,OAAsB;EAAC;EAAW;EAAQ;CAAO,CAAC;CAEnF,OAAAG,gBACGpC,aAAWqC,WAAA;EACVC,IAAE;EACFC,MAAI;EAAA,KAAA,WAAA;GAAA,OACG9B,GAAGC,eAAe;IAAEE,SAASsB,MAAMtB;IAASS,MAAMa,MAAMb;GAAK,CAAC,GAAGa,MAAMH,KAAK;EAAC;CAAA,GAC/EI,IAAgC,CAAA;AAG3C"}
|
|
@@ -17,6 +17,8 @@ export type CheckboxProps = Omit<ComponentProps<typeof KobalteCheckbox>, 'childr
|
|
|
17
17
|
controlClass?: string;
|
|
18
18
|
labelClass?: string;
|
|
19
19
|
descriptionClass?: string;
|
|
20
|
+
label?: JSX.Element;
|
|
21
|
+
description?: JSX.Element;
|
|
20
22
|
/**
|
|
21
23
|
* Replaces the control and label. Omit it to get the default control beside
|
|
22
24
|
* `label` and `description`; supply it to compose the parts yourself.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,eAwE5C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,eAGhF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,eAQ5F"}
|
|
@@ -4,7 +4,7 @@ import { Check, Minus } from "lucide-solid";
|
|
|
4
4
|
import { splitProps } from "solid-js";
|
|
5
5
|
import { Checkbox } from "@kobalte/core/checkbox";
|
|
6
6
|
//#region src/components/ui/checkbox/checkbox.tsx
|
|
7
|
-
var _tmpl$ = /*#__PURE__*/ template(`<div class="grid gap-0.5
|
|
7
|
+
var _tmpl$ = /*#__PURE__*/ template(`<div class="grid gap-0.5">`);
|
|
8
8
|
function Checkbox$1(props) {
|
|
9
9
|
const [local, rest] = splitProps(props, [
|
|
10
10
|
"class",
|
|
@@ -12,13 +12,24 @@ function Checkbox$1(props) {
|
|
|
12
12
|
"labelClass",
|
|
13
13
|
"descriptionClass",
|
|
14
14
|
"children",
|
|
15
|
+
"label",
|
|
16
|
+
"description",
|
|
15
17
|
"indeterminate",
|
|
16
18
|
"aria-label",
|
|
17
|
-
"aria-labelledby"
|
|
19
|
+
"aria-labelledby",
|
|
20
|
+
"aria-describedby",
|
|
21
|
+
"aria-invalid",
|
|
22
|
+
"aria-busy",
|
|
23
|
+
"title"
|
|
18
24
|
]);
|
|
19
|
-
return createComponent(Checkbox, mergeProps({
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
return createComponent(Checkbox, mergeProps({
|
|
26
|
+
get title() {
|
|
27
|
+
return local.title;
|
|
28
|
+
},
|
|
29
|
+
get ["class"]() {
|
|
30
|
+
return cn("group/checkbox flex items-start gap-2.5", local.class);
|
|
31
|
+
}
|
|
32
|
+
}, rest, { get children() {
|
|
22
33
|
return [
|
|
23
34
|
createComponent(Checkbox.Input, {
|
|
24
35
|
get ["aria-label"]() {
|
|
@@ -26,6 +37,18 @@ function Checkbox$1(props) {
|
|
|
26
37
|
},
|
|
27
38
|
get ["aria-labelledby"]() {
|
|
28
39
|
return local["aria-labelledby"];
|
|
40
|
+
},
|
|
41
|
+
get ["aria-describedby"]() {
|
|
42
|
+
return local["aria-describedby"];
|
|
43
|
+
},
|
|
44
|
+
get ["aria-invalid"]() {
|
|
45
|
+
return local["aria-invalid"];
|
|
46
|
+
},
|
|
47
|
+
get ["aria-busy"]() {
|
|
48
|
+
return local["aria-busy"];
|
|
49
|
+
},
|
|
50
|
+
get title() {
|
|
51
|
+
return local.title;
|
|
29
52
|
}
|
|
30
53
|
}),
|
|
31
54
|
createComponent(Checkbox.Control, {
|
|
@@ -41,16 +64,32 @@ function Checkbox$1(props) {
|
|
|
41
64
|
});
|
|
42
65
|
}
|
|
43
66
|
}),
|
|
44
|
-
memo(() => local.children ?? (() => {
|
|
67
|
+
memo(() => local.children ?? (local.label || local.description ? (() => {
|
|
45
68
|
var _el$ = _tmpl$();
|
|
46
|
-
insert(_el$,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
insert(_el$, (() => {
|
|
70
|
+
var _c$ = memo(() => !!local.label);
|
|
71
|
+
return () => _c$() ? createComponent(Checkbox.Label, {
|
|
72
|
+
get ["class"]() {
|
|
73
|
+
return cn("text-sm font-medium", local.labelClass);
|
|
74
|
+
},
|
|
75
|
+
get children() {
|
|
76
|
+
return local.label;
|
|
77
|
+
}
|
|
78
|
+
}) : null;
|
|
79
|
+
})(), null);
|
|
80
|
+
insert(_el$, (() => {
|
|
81
|
+
var _c$2 = memo(() => !!local.description);
|
|
82
|
+
return () => _c$2() ? createComponent(Checkbox.Description, {
|
|
83
|
+
get ["class"]() {
|
|
84
|
+
return cn("text-muted-foreground text-sm", local.descriptionClass);
|
|
85
|
+
},
|
|
86
|
+
get children() {
|
|
87
|
+
return local.description;
|
|
88
|
+
}
|
|
89
|
+
}) : null;
|
|
90
|
+
})(), null);
|
|
52
91
|
return _el$;
|
|
53
|
-
})())
|
|
92
|
+
})() : null))
|
|
54
93
|
];
|
|
55
94
|
} }));
|
|
56
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":["Checkbox","KobalteCheckbox","Check","Minus","ComponentProps","JSX","splitProps","cn","CheckboxProps","Omit","controlClass","labelClass","descriptionClass","
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":["Checkbox","KobalteCheckbox","Check","Minus","ComponentProps","JSX","splitProps","cn","CheckboxProps","Omit","controlClass","labelClass","descriptionClass","label","Element","description","children","props","local","rest","_$createComponent","_$mergeProps","title","class","Input","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-busy","Control","Indicator","_$memo","indeterminate","_el$","_tmpl$","_$insert","_c$","Label","_c$2","Description","CheckboxLabel","CheckboxDescription","Checkbox","_$createComponent","KobalteCheckbox","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"sourcesContent":["import { Checkbox as KobalteCheckbox } from '@kobalte/core/checkbox'\nimport { Check, Minus } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Checkbox.\n *\n * Three states: unchecked, checked, and indeterminate. Indeterminate is what a\n * \"select all\" box shows when only some rows are selected; Kobalte expresses\n * it through `checked=\"indeterminate\"` rather than a second boolean, so there\n * is no way to render a box that is both.\n *\n * The paint is `Control` and the value is a real hidden `Input`, so the control\n * participates in a form submission and in native validation while looking\n * nothing like a browser checkbox. Focus is tracked by the input, which is why\n * the ring lives on the control and reads the input's focus state.\n */\nexport type CheckboxProps = Omit<ComponentProps<typeof KobalteCheckbox>, 'children'> & {\n controlClass?: string\n labelClass?: string\n descriptionClass?: string\n label?: JSX.Element\n description?: JSX.Element\n /**\n * Replaces the control and label. Omit it to get the default control beside\n * `label` and `description`; supply it to compose the parts yourself.\n */\n children?: JSX.Element\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'controlClass',\n 'labelClass',\n 'descriptionClass',\n 'children',\n 'label',\n 'description',\n 'indeterminate',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-busy',\n 'title',\n ])\n\n return (\n <KobalteCheckbox\n title={local.title}\n class={cn('group/checkbox flex items-start gap-2.5', local.class)}\n {...rest}\n >\n {/*\n * The name goes on the input, which is what carries the value and takes\n * focus. On the Root it would land on a plain div and name nothing — the\n * box would announce its state with no subject.\n */}\n <KobalteCheckbox.Input\n aria-label={local['aria-label']}\n aria-labelledby={local['aria-labelledby']}\n aria-describedby={local['aria-describedby']}\n aria-invalid={local['aria-invalid']}\n aria-busy={local['aria-busy']}\n title={local.title}\n />\n <KobalteCheckbox.Control\n class={cn(\n 'border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-sm border',\n 'transition-[color,box-shadow,border-color,background-color] ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'data-[checked]:bg-primary data-[checked]:border-primary data-[checked]:text-primary-foreground',\n 'data-[indeterminate]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:text-primary-foreground',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.controlClass\n )}\n >\n <KobalteCheckbox.Indicator class=\"flex items-center justify-center\">\n {local.indeterminate ? <Minus class=\"size-3\" /> : <Check class=\"size-3\" />}\n </KobalteCheckbox.Indicator>\n </KobalteCheckbox.Control>\n {local.children ??\n (local.label || local.description ? (\n <div class=\"grid gap-0.5\">\n {local.label ? (\n <KobalteCheckbox.Label class={cn('text-sm font-medium', local.labelClass)}>\n {local.label}\n </KobalteCheckbox.Label>\n ) : null}\n {local.description ? (\n <KobalteCheckbox.Description\n class={cn('text-muted-foreground text-sm', local.descriptionClass)}\n >\n {local.description}\n </KobalteCheckbox.Description>\n ) : null}\n </div>\n ) : null)}\n </KobalteCheckbox>\n )\n}\n\n/**\n * The box's own label. Valid only inside a `<Checkbox>`, for the same reason as\n * `SwitchLabel`: outside its root there is no control to associate with.\n */\nexport function CheckboxLabel(props: ComponentProps<typeof KobalteCheckbox.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteCheckbox.Label class={cn('text-sm font-medium', local.class)} {...rest} />\n}\n\nexport function CheckboxDescription(props: ComponentProps<typeof KobalteCheckbox.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteCheckbox.Description\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AAgCA,SAAgBA,WAASiB,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,OAAAG,gBACGnB,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KAAA,CAAA,IAEZ;IAAI,EAAA,CAAA,GAAA,IAAA;IAAAuB,OAAAF,aAAA;KAAA,IAAAK,OAAAP,WAAA,CAAA,CACPd,MAAMH,WAAW;KAAA,aAAjBwB,KAAA,IAAAnB,gBACEnB,SAAgBuC,aAAW;MAAA,KAAA,WAAA;OAAA,OACnBjC,GAAG,iCAAiCW,MAAMN,gBAAgB;MAAC;MAAA,IAAAI,WAAA;OAAA,OAEjEE,MAAMH;MAAW;KAAA,CAAA,IAElB;IAAI,EAAA,CAAA,GAAA,IAAA;IAAA,OAAAmB;GAAA,EAAA,CAAA,IAER,KAAK;EAAA;CAAA,EAAA,CAAA,CAAA;AAGjB;;;;;AAMA,SAAgBO,cAAcxB,OAAqD;CACjF,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQnB,SAAgBqC,OAAKjB,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQd,GAAG,uBAAuBW,MAAMK,KAAK;CAAC,EAAA,GAAMJ,IAAI,CAAA;AACvF;AAEA,SAAgBuB,oBAAoBzB,OAA2D;CAC7F,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGnB,SAAgBuC,aAAWnB,WAAA,EAAA,KAAA,WAAA;EAAA,OACnBd,GAAG,iCAAiCW,MAAMK,KAAK;CAAC,EAAA,GACnDJ,IAAI,CAAA;AAGd"}
|
|
@@ -17,7 +17,8 @@ export type RadioGroupItemProps = ComponentProps<typeof KobalteRadioGroup.Item>
|
|
|
17
17
|
controlClass?: string;
|
|
18
18
|
/**
|
|
19
19
|
* The option's visible label. A radio with no accessible name is unreachable
|
|
20
|
-
* by a screen reader and by voice control, so supply this
|
|
20
|
+
* by a screen reader and by voice control, so supply this, a labelled child,
|
|
21
|
+
* `aria-label`, or `aria-labelledby`.
|
|
21
22
|
*/
|
|
22
23
|
label?: string;
|
|
23
24
|
description?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/radio-group/radio-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,iBAAiB,CAAC,kCAGzE;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,GAAG;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/radio-group/radio-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,iBAAiB,CAAC,kCAGzE;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,GAAG;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,kCA4DxD"}
|
|
@@ -29,13 +29,43 @@ function RadioGroupItem(props) {
|
|
|
29
29
|
"controlClass",
|
|
30
30
|
"label",
|
|
31
31
|
"description",
|
|
32
|
-
"children"
|
|
32
|
+
"children",
|
|
33
|
+
"aria-label",
|
|
34
|
+
"aria-labelledby",
|
|
35
|
+
"aria-describedby",
|
|
36
|
+
"aria-invalid",
|
|
37
|
+
"aria-busy",
|
|
38
|
+
"title"
|
|
33
39
|
]);
|
|
34
|
-
return createComponent(RadioGroup.Item, mergeProps({
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
return createComponent(RadioGroup.Item, mergeProps({
|
|
41
|
+
get title() {
|
|
42
|
+
return local.title;
|
|
43
|
+
},
|
|
44
|
+
get ["class"]() {
|
|
45
|
+
return cn("group/radio flex items-start gap-2.5", local.class);
|
|
46
|
+
}
|
|
47
|
+
}, rest, { get children() {
|
|
37
48
|
return [
|
|
38
|
-
createComponent(RadioGroup.ItemInput, {
|
|
49
|
+
createComponent(RadioGroup.ItemInput, {
|
|
50
|
+
get ["aria-label"]() {
|
|
51
|
+
return local["aria-label"];
|
|
52
|
+
},
|
|
53
|
+
get ["aria-labelledby"]() {
|
|
54
|
+
return local["aria-labelledby"];
|
|
55
|
+
},
|
|
56
|
+
get ["aria-describedby"]() {
|
|
57
|
+
return local["aria-describedby"];
|
|
58
|
+
},
|
|
59
|
+
get ["aria-invalid"]() {
|
|
60
|
+
return local["aria-invalid"];
|
|
61
|
+
},
|
|
62
|
+
get ["aria-busy"]() {
|
|
63
|
+
return local["aria-busy"];
|
|
64
|
+
},
|
|
65
|
+
get title() {
|
|
66
|
+
return local.title;
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
39
69
|
createComponent(RadioGroup.ItemControl, {
|
|
40
70
|
get ["class"]() {
|
|
41
71
|
return cn("border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-full border", "transition-[color,box-shadow,border-color,background-color] ease-out outline-none", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle", "data-[checked]:border-primary data-[checked]:text-primary", "data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle", "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", local.controlClass);
|
|
@@ -51,15 +81,18 @@ function RadioGroupItem(props) {
|
|
|
51
81
|
}),
|
|
52
82
|
memo(() => local.children ?? (() => {
|
|
53
83
|
var _el$ = _tmpl$();
|
|
54
|
-
insert(_el$, createComponent(RadioGroup.ItemLabel, {
|
|
55
|
-
"class": "text-sm font-medium",
|
|
56
|
-
get children() {
|
|
57
|
-
return local.label;
|
|
58
|
-
}
|
|
59
|
-
}), null);
|
|
60
84
|
insert(_el$, (() => {
|
|
61
|
-
var _c$ = memo(() => !!local.
|
|
62
|
-
return () => _c$() ? createComponent(RadioGroup.
|
|
85
|
+
var _c$ = memo(() => !!local.label);
|
|
86
|
+
return () => _c$() ? createComponent(RadioGroup.ItemLabel, {
|
|
87
|
+
"class": "text-sm font-medium",
|
|
88
|
+
get children() {
|
|
89
|
+
return local.label;
|
|
90
|
+
}
|
|
91
|
+
}) : null;
|
|
92
|
+
})(), null);
|
|
93
|
+
insert(_el$, (() => {
|
|
94
|
+
var _c$2 = memo(() => !!local.description);
|
|
95
|
+
return () => _c$2() ? createComponent(RadioGroup.ItemDescription, {
|
|
63
96
|
"class": "text-muted-foreground text-sm",
|
|
64
97
|
get children() {
|
|
65
98
|
return local.description;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","names":["RadioGroup","KobalteRadioGroup","Circle","ComponentProps","splitProps","cn","props","local","rest","_$createComponent","_$mergeProps","class","RadioGroupItemProps","Item","controlClass","label","description","RadioGroupItem","children","ItemInput","ItemControl","ItemIndicator","_$memo","_el$","_tmpl$","_$insert","ItemLabel","_c$","ItemDescription","RadioGroup","_$createComponent","KobalteRadioGroup","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/radio-group/radio-group.tsx"],"sourcesContent":["import { RadioGroup as KobalteRadioGroup } from '@kobalte/core/radio-group'\nimport { Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * RadioGroup.\n *\n * A single choice from a small, visible set. The group owns the value and the\n * arrow-key navigation, so a caller sets `value` once instead of wiring a\n * `name` and a handler onto every item.\n *\n * Below about five options a Select hides the choices behind a click, which is\n * the wrong trade; above about seven, radios become a wall and the Select wins.\n * That call belongs to the caller, and both controls are drawn from the same\n * tokens so either choice sits correctly next to the other.\n */\nexport function RadioGroup(props: ComponentProps<typeof KobalteRadioGroup>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteRadioGroup class={cn('grid gap-2', local.class)} {...rest} />\n}\n\nexport type RadioGroupItemProps = ComponentProps<typeof KobalteRadioGroup.Item> & {\n controlClass?: string\n /**\n * The option's visible label. A radio with no accessible name is unreachable\n * by a screen reader and by voice control, so supply this
|
|
1
|
+
{"version":3,"file":"radio-group.js","names":["RadioGroup","KobalteRadioGroup","Circle","ComponentProps","splitProps","cn","props","local","rest","_$createComponent","_$mergeProps","class","RadioGroupItemProps","Item","controlClass","label","description","RadioGroupItem","title","children","ItemInput","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-busy","ItemControl","ItemIndicator","_$memo","_el$","_tmpl$","_$insert","_c$","ItemLabel","_c$2","ItemDescription","RadioGroup","_$createComponent","KobalteRadioGroup","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/radio-group/radio-group.tsx"],"sourcesContent":["import { RadioGroup as KobalteRadioGroup } from '@kobalte/core/radio-group'\nimport { Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * RadioGroup.\n *\n * A single choice from a small, visible set. The group owns the value and the\n * arrow-key navigation, so a caller sets `value` once instead of wiring a\n * `name` and a handler onto every item.\n *\n * Below about five options a Select hides the choices behind a click, which is\n * the wrong trade; above about seven, radios become a wall and the Select wins.\n * That call belongs to the caller, and both controls are drawn from the same\n * tokens so either choice sits correctly next to the other.\n */\nexport function RadioGroup(props: ComponentProps<typeof KobalteRadioGroup>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteRadioGroup class={cn('grid gap-2', local.class)} {...rest} />\n}\n\nexport type RadioGroupItemProps = ComponentProps<typeof KobalteRadioGroup.Item> & {\n controlClass?: string\n /**\n * The option's visible label. A radio with no accessible name is unreachable\n * by a screen reader and by voice control, so supply this, a labelled child,\n * `aria-label`, or `aria-labelledby`.\n */\n label?: string\n description?: string\n}\n\nexport function RadioGroupItem(props: RadioGroupItemProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'controlClass',\n 'label',\n 'description',\n 'children',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-busy',\n 'title',\n ])\n\n return (\n <KobalteRadioGroup.Item\n title={local.title}\n class={cn('group/radio flex items-start gap-2.5', local.class)}\n {...rest}\n >\n <KobalteRadioGroup.ItemInput\n aria-label={local['aria-label']}\n aria-labelledby={local['aria-labelledby']}\n aria-describedby={local['aria-describedby']}\n aria-invalid={local['aria-invalid']}\n aria-busy={local['aria-busy']}\n title={local.title}\n />\n <KobalteRadioGroup.ItemControl\n class={cn(\n 'border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-full border',\n 'transition-[color,box-shadow,border-color,background-color] ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'data-[checked]:border-primary data-[checked]:text-primary',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.controlClass\n )}\n >\n <KobalteRadioGroup.ItemIndicator class=\"flex items-center justify-center\">\n <Circle class=\"size-2 fill-current\" />\n </KobalteRadioGroup.ItemIndicator>\n </KobalteRadioGroup.ItemControl>\n {local.children ?? (\n <div class=\"grid gap-0.5 leading-none\">\n {local.label ? (\n <KobalteRadioGroup.ItemLabel class=\"text-sm font-medium\">\n {local.label}\n </KobalteRadioGroup.ItemLabel>\n ) : null}\n {local.description ? (\n <KobalteRadioGroup.ItemDescription class=\"text-muted-foreground text-sm\">\n {local.description}\n </Kob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,SAAA,sBAAA,CAAA;MAAA;KAAA,CAAA;IAAA;GAAA,CAAA;GAAA0B,WAGVrB,MAAMY,mBAAQ;IAAA,IAAAU,OAAAC,OAAA;IAAAC,OAAAF,aAAA;KAAA,IAAAG,MAAAJ,WAAA,CAAA,CAEVrB,MAAMQ,KAAK;KAAA,aAAXiB,IAAA,IAAAvB,gBACER,WAAkBgC,WAAS;MAAA,SAAA;MAAA,IAAAd,WAAA;OAAA,OACzBZ,MAAMQ;MAAK;KAAA,CAAA,IAEZ;IAAI,EAAA,CAAA,GAAA,IAAA;IAAAgB,OAAAF,aAAA;KAAA,IAAAK,OAAAN,WAAA,CAAA,CACPrB,MAAMS,WAAW;KAAA,aAAjBkB,KAAA,IAAAzB,gBACER,WAAkBkC,iBAAe;MAAA,SAAA;MAAA,IAAAhB,WAAA;OAAA,OAC/BZ,MAAMS;MAAW;KAAA,CAAA,IAElB;IAAI,EAAA,CAAA,GAAA,IAAA;IAAA,OAAAa;GAAA,EAAA,CAAA,CAEX;EAAA;CAAA,EAAA,CAAA,CAAA;AAGP"}
|
|
@@ -18,6 +18,8 @@ export type SwitchProps = Omit<ComponentProps<typeof KobalteSwitch>, 'children'>
|
|
|
18
18
|
thumbClass?: string;
|
|
19
19
|
labelClass?: string;
|
|
20
20
|
descriptionClass?: string;
|
|
21
|
+
label?: JSX.Element;
|
|
22
|
+
description?: JSX.Element;
|
|
21
23
|
/**
|
|
22
24
|
* Replaces the control and label. Omit it to get the default control beside
|
|
23
25
|
* `label` and `description`; supply it to compose the parts yourself.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/switch/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInD;;;;;;;;;;;;GAYG;AACH,MAAM,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AW,CAAC,eAKxF"}
|
|
@@ -12,12 +12,23 @@ function Switch$1(props) {
|
|
|
12
12
|
"labelClass",
|
|
13
13
|
"descriptionClass",
|
|
14
14
|
"children",
|
|
15
|
+
"label",
|
|
16
|
+
"description",
|
|
15
17
|
"aria-label",
|
|
16
|
-
"aria-labelledby"
|
|
18
|
+
"aria-labelledby",
|
|
19
|
+
"aria-describedby",
|
|
20
|
+
"aria-invalid",
|
|
21
|
+
"aria-busy",
|
|
22
|
+
"title"
|
|
17
23
|
]);
|
|
18
|
-
return createComponent(Switch, mergeProps({
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
return createComponent(Switch, mergeProps({
|
|
25
|
+
get title() {
|
|
26
|
+
return local.title;
|
|
27
|
+
},
|
|
28
|
+
get ["class"]() {
|
|
29
|
+
return cn("group/switch flex items-center gap-2.5", local.class);
|
|
30
|
+
}
|
|
31
|
+
}, rest, { get children() {
|
|
21
32
|
return [
|
|
22
33
|
createComponent(Switch.Input, {
|
|
23
34
|
get ["aria-label"]() {
|
|
@@ -25,6 +36,18 @@ function Switch$1(props) {
|
|
|
25
36
|
},
|
|
26
37
|
get ["aria-labelledby"]() {
|
|
27
38
|
return local["aria-labelledby"];
|
|
39
|
+
},
|
|
40
|
+
get ["aria-describedby"]() {
|
|
41
|
+
return local["aria-describedby"];
|
|
42
|
+
},
|
|
43
|
+
get ["aria-invalid"]() {
|
|
44
|
+
return local["aria-invalid"];
|
|
45
|
+
},
|
|
46
|
+
get ["aria-busy"]() {
|
|
47
|
+
return local["aria-busy"];
|
|
48
|
+
},
|
|
49
|
+
get title() {
|
|
50
|
+
return local.title;
|
|
28
51
|
}
|
|
29
52
|
}),
|
|
30
53
|
createComponent(Switch.Control, {
|
|
@@ -37,16 +60,32 @@ function Switch$1(props) {
|
|
|
37
60
|
} });
|
|
38
61
|
}
|
|
39
62
|
}),
|
|
40
|
-
memo(() => local.children ?? (() => {
|
|
63
|
+
memo(() => local.children ?? (local.label || local.description ? (() => {
|
|
41
64
|
var _el$ = _tmpl$();
|
|
42
|
-
insert(_el$,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
insert(_el$, (() => {
|
|
66
|
+
var _c$ = memo(() => !!local.label);
|
|
67
|
+
return () => _c$() ? createComponent(Switch.Label, {
|
|
68
|
+
get ["class"]() {
|
|
69
|
+
return cn("text-sm leading-none font-medium", local.labelClass);
|
|
70
|
+
},
|
|
71
|
+
get children() {
|
|
72
|
+
return local.label;
|
|
73
|
+
}
|
|
74
|
+
}) : null;
|
|
75
|
+
})(), null);
|
|
76
|
+
insert(_el$, (() => {
|
|
77
|
+
var _c$2 = memo(() => !!local.description);
|
|
78
|
+
return () => _c$2() ? createComponent(Switch.Description, {
|
|
79
|
+
get ["class"]() {
|
|
80
|
+
return cn("text-muted-foreground text-sm", local.descriptionClass);
|
|
81
|
+
},
|
|
82
|
+
get children() {
|
|
83
|
+
return local.description;
|
|
84
|
+
}
|
|
85
|
+
}) : null;
|
|
86
|
+
})(), null);
|
|
48
87
|
return _el$;
|
|
49
|
-
})())
|
|
88
|
+
})() : null))
|
|
50
89
|
];
|
|
51
90
|
} }));
|
|
52
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","names":["Switch","KobalteSwitch","ComponentProps","JSX","splitProps","cn","SwitchProps","Omit","controlClass","thumbClass","labelClass","descriptionClass","
|
|
1
|
+
{"version":3,"file":"switch.js","names":["Switch","KobalteSwitch","ComponentProps","JSX","splitProps","cn","SwitchProps","Omit","controlClass","thumbClass","labelClass","descriptionClass","label","Element","description","children","props","local","rest","_$createComponent","_$mergeProps","title","class","Input","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-busy","Control","Thumb","_$memo","_el$","_tmpl$","_$insert","_c$","Label","_c$2","Description","SwitchLabel","SwitchDescription","Switch","_$createComponent","KobalteSwitch","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/switch/switch.tsx"],"sourcesContent":["import { Switch as KobalteSwitch } from '@kobalte/core/switch'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Switch.\n *\n * For a setting that takes effect the moment it is flipped. The distinction\n * from Checkbox is behaviour, not looks: a switch applies immediately and\n * belongs in a settings row, while a checkbox is a value the user is still\n * composing and is applied when a form is submitted. A switch inside an unsaved\n * form is the mistake this split exists to prevent.\n *\n * `Switch.Input` renders a real hidden checkbox, so the control is\n * form-native, keyboard-operable, and its `aria-checked` follows the state the\n * user sees.\n */\nexport type SwitchProps = Omit<ComponentProps<typeof KobalteSwitch>, 'children'> & {\n controlClass?: string\n thumbClass?: string\n labelClass?: string\n descriptionClass?: string\n label?: JSX.Element\n description?: JSX.Element\n /**\n * Replaces the control and label. Omit it to get the default control beside\n * `label` and `description`; supply it to compose the parts yourself.\n */\n children?: JSX.Element\n}\n\nexport function Switch(props: SwitchProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'controlClass',\n 'thumbClass',\n 'labelClass',\n 'descriptionClass',\n 'children',\n 'label',\n 'description',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-busy',\n 'title',\n ])\n\n return (\n <KobalteSwitch\n title={local.title}\n class={cn('group/switch flex items-center gap-2.5', local.class)}\n {...rest}\n >\n {/* The name belongs on the input; see Checkbox for why. */}\n <KobalteSwitch.Input\n aria-label={local['aria-label']}\n aria-labelledby={local['aria-labelledby']}\n aria-describedby={local['aria-describedby']}\n aria-invalid={local['aria-invalid']}\n aria-busy={local['aria-busy']}\n title={local.title}\n />\n <KobalteSwitch.Control\n class={cn(\n 'bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'data-[checked]:bg-primary',\n 'data-[invalid]:border-destructive',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.controlClass\n )}\n >\n <KobalteSwitch.Thumb\n class={cn(\n 'bg-background pointer-events-none block size-4 rounded-full shadow-xs',\n 'transition-transform ease-out',\n 'data-[checked]:translate-x-4',\n local.thumbClass\n )}\n />\n </KobalteSwitch.Control>\n {local.children ??\n (local.label || local.description ? (\n <div class=\"grid gap-0.5\">\n {local.label ? (\n <KobalteSwitch.Label class={cn('text-sm leading-none font-medium', local.labelClass)}>\n {local.label}\n </KobalteSwitch.Label>\n ) : null}\n {local.description ? (\n <KobalteSwitch.Description\n class={cn('text-muted-foreground text-sm', local.descriptionClass)}\n >\n {local.description}\n </KobalteSwitch.Description>\n ) : null}\n </div>\n ) : null)}\n </KobalteSwitch>\n )\n}\n\n/**\n * The switch's own label. Valid only inside a `<Switch>`: it is Kobalte's label\n * for that root's control, and outside one there is nothing to associate with.\n * A label drawn *beside* a switch — a settings row with the control trailing —\n * is plain text, and the switch takes an `aria-label` instead.\n */\nexport function SwitchLabel(props: ComponentProps<typeof KobalteSwitch.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteSwitch.Label class={cn('text-sm leading-none font-medium', local.class)} {...rest} />\n )\n}\n\nexport function SwitchDescription(props: ComponentProps<typeof KobalteSwitch.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteSwitch.Description class={cn('text-muted-foreground text-sm', local.class)} {...rest} />\n )\n}\n"],"mappings":";;;;;;AAgCA,SAAgBA,SAAOgB,OAAoB;CACzC,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,OAAAG,gBACGlB,QAAamB,WAAA;EAAA,IACZC,QAAK;GAAA,OAAEJ,MAAMI;EAAK;EAAA,KAAA,WAAA;GAAA,OACXhB,GAAG,0CAA0CY,MAAMK,KAAK;EAAC;CAAA,GAC5DJ,MAAI,EAAA,IAAAH,WAA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CAAA,IAElB;IAAI,EAAA,CAAA,GAAA,IAAA;IAAA,OAAAkB;GAAA,EAAA,CAAA,IAER,KAAK;EAAA;CAAA,EAAA,CAAA,CAAA;AAGjB;;;;;;;AAQA,SAAgBO,YAAYvB,OAAmD;CAC7E,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGlB,OAAcmC,OAAKhB,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQf,GAAG,oCAAoCY,MAAMK,KAAK;CAAC,EAAA,GAAMJ,IAAI,CAAA;AAE7F;AAEA,SAAgBsB,kBAAkBxB,OAAyD;CACzF,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGlB,OAAcqC,aAAWlB,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQf,GAAG,iCAAiCY,MAAMK,KAAK;CAAC,EAAA,GAAMJ,IAAI,CAAA;AAEhG"}
|
package/dist/lib/themes.d.ts
CHANGED
|
@@ -58,6 +58,9 @@ export type ThemeColors = {
|
|
|
58
58
|
destructive: string;
|
|
59
59
|
destructiveForeground: string;
|
|
60
60
|
destructiveSubtle: string;
|
|
61
|
+
/** Contrast-safe solid-action presentation, derived from the canonical error role. */
|
|
62
|
+
destructiveAction: string;
|
|
63
|
+
destructiveActionForeground: string;
|
|
61
64
|
success: string;
|
|
62
65
|
successForeground: string;
|
|
63
66
|
successSubtle: string;
|
package/dist/lib/themes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/lib/themes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/lib/themes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAqB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