compote-ui 0.0.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/components/button/Button.svelte +6 -6
  2. package/dist/components/checkbox/Checkbox-group.svelte +29 -0
  3. package/dist/components/checkbox/Checkbox-group.svelte.d.ts +25 -0
  4. package/dist/components/checkbox/Checkbox.svelte +16 -8
  5. package/dist/components/checkbox/Checkbox.svelte.d.ts +1 -1
  6. package/dist/components/checkbox/checkbox-group.types.d.ts +11 -0
  7. package/dist/components/checkbox/checkbox.types.js +1 -0
  8. package/dist/components/combobox/Combobox.svelte +182 -0
  9. package/dist/components/combobox/Combobox.svelte.d.ts +26 -0
  10. package/dist/components/combobox/types.d.ts +16 -0
  11. package/dist/components/combobox/types.js +1 -0
  12. package/dist/gray-oklch.min.css +1 -0
  13. package/dist/green-hsl.min.css +1 -0
  14. package/dist/icons/PhCaretDown.svelte +18 -0
  15. package/dist/icons/PhCaretDown.svelte.d.ts +5 -0
  16. package/dist/icons/PhCheck.svelte +3 -2
  17. package/dist/icons/PhMinus.svelte +15 -0
  18. package/dist/icons/PhMinus.svelte.d.ts +5 -0
  19. package/dist/icons/PhX.svelte +18 -0
  20. package/dist/icons/PhX.svelte.d.ts +5 -0
  21. package/dist/index.d.ts +3 -1
  22. package/dist/index.js +3 -1
  23. package/dist/props.colors-oklch-hues.css +14 -0
  24. package/dist/props.colors-oklch.css +19 -0
  25. package/dist/props.gray-oklch.css +18 -0
  26. package/dist/theme.css +38 -60
  27. package/package.json +1 -1
  28. package/dist/icons/CheckBold.svelte +0 -10
  29. package/dist/icons/CheckBold.svelte.d.ts +0 -5
  30. /package/dist/components/checkbox/{checkbox-props.js → checkbox-group.types.js} +0 -0
  31. /package/dist/components/checkbox/{checkbox-props.d.ts → checkbox.types.d.ts} +0 -0
@@ -3,17 +3,17 @@
3
3
  import { tv } from 'tailwind-variants';
4
4
 
5
5
  const button = tv({
6
- base: 'inline-flex items-center justify-center font-medium transition-colors cursor-pointer bg-transparent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50 disabled:pointer-events-none',
6
+ base: 'focus-visible:outline-ring inline-flex cursor-pointer items-center justify-center rounded bg-transparent font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50',
7
7
  variants: {
8
8
  variant: {
9
- solid: 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80',
10
- outline: 'border border-border text-foreground hover:bg-muted',
9
+ solid: 'text-primary-foreground bg-primary hover:bg-primary/90 active:bg-primary/80',
10
+ outline: 'border-border text-foreground hover:bg-muted border',
11
11
  ghost: 'text-foreground hover:bg-muted'
12
12
  },
13
13
  size: {
14
- sm: 'h-8 px-3 text-sm rounded-sm gap-1.5',
15
- md: 'h-10 px-4 text-base rounded-md gap-2',
16
- lg: 'h-12 px-6 text-lg rounded-lg gap-2.5'
14
+ sm: 'h-8 gap-1.5 px-2 text-sm',
15
+ md: 'h-9 gap-2 px-3 text-base',
16
+ lg: 'h-10 gap-2.5 px-4 text-lg'
17
17
  }
18
18
  },
19
19
  defaultVariants: { variant: 'solid', size: 'md' }
@@ -0,0 +1,29 @@
1
+ <script lang="ts" generics="T extends string | number">
2
+ import { Checkbox } from '@ark-ui/svelte/checkbox';
3
+ import type { CheckboxGroupProps } from './checkbox-group.types';
4
+ import CheckboxItem from './Checkbox.svelte';
5
+
6
+ let {
7
+ items,
8
+ value = $bindable([]),
9
+ onValueChange,
10
+ orientation = 'horizontal',
11
+ ...rest
12
+ }: CheckboxGroupProps<T> = $props();
13
+
14
+ const arkValue = $derived(value.map(String));
15
+ </script>
16
+
17
+ <Checkbox.Group
18
+ value={arkValue}
19
+ onValueChange={(newValue) => {
20
+ value = items.filter((item) => newValue.includes(String(item.value))).map((item) => item.value);
21
+ onValueChange?.(newValue);
22
+ }}
23
+ {...rest}
24
+ class={orientation === 'vertical' ? 'flex flex-col gap-0.5' : 'flex flex-wrap gap-4'}
25
+ >
26
+ {#each items as item (item.value)}
27
+ <CheckboxItem value={String(item.value)} label={item.label} />
28
+ {/each}
29
+ </Checkbox.Group>
@@ -0,0 +1,25 @@
1
+ import type { CheckboxGroupProps } from './checkbox-group.types';
2
+ declare function $$render<T extends string | number>(): {
3
+ props: CheckboxGroupProps<T>;
4
+ exports: {};
5
+ bindings: "value";
6
+ slots: {};
7
+ events: {};
8
+ };
9
+ declare class __sveltets_Render<T extends string | number> {
10
+ props(): ReturnType<typeof $$render<T>>['props'];
11
+ events(): ReturnType<typeof $$render<T>>['events'];
12
+ slots(): ReturnType<typeof $$render<T>>['slots'];
13
+ bindings(): "value";
14
+ exports(): {};
15
+ }
16
+ interface $$IsomorphicComponent {
17
+ new <T extends string | number>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
18
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
19
+ } & ReturnType<__sveltets_Render<T>['exports']>;
20
+ <T extends string | number>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
21
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
22
+ }
23
+ declare const CheckboxGroup: $$IsomorphicComponent;
24
+ type CheckboxGroup<T extends string | number> = InstanceType<typeof CheckboxGroup<T>>;
25
+ export default CheckboxGroup;
@@ -1,14 +1,20 @@
1
1
  <script lang="ts">
2
2
  import { Checkbox } from '@ark-ui/svelte/checkbox';
3
- import type { CheckboxProps as Props } from './checkbox-props.js';
4
- import PhCheck from '../../icons/CheckBold.svelte';
3
+ import type { CheckboxProps as Props } from './checkbox.types.js';
4
+ import PhCheck from '../../icons/PhCheck.svelte';
5
5
 
6
6
  let { checked = $bindable(), label, children, ...rest }: Props = $props();
7
7
  </script>
8
8
 
9
- <Checkbox.Root bind:checked class="inline-flex cursor-pointer items-start gap-2" {...rest}>
9
+ <Checkbox.Root
10
+ bind:checked
11
+ class="inline-flex cursor-pointer gap-2 {children ? 'items-start' : 'items-center'}"
12
+ {...rest}
13
+ >
10
14
  <Checkbox.Control
11
- class="mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-sm border border-border bg-transparent transition-colors data-disabled:pointer-events-none data-disabled:opacity-50 data-focus-visible:outline-2 data-focus-visible:outline-offset-2 data-focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-primary"
15
+ class="{children
16
+ ? 'mt-0.5'
17
+ : ''} flex size-5 shrink-0 items-center justify-center rounded-sm border border-border bg-transparent transition-colors data-disabled:pointer-events-none data-disabled:opacity-50 data-focus-visible:outline-2 data-focus-visible:outline-offset-2 data-focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-primary"
12
18
  >
13
19
  <Checkbox.Indicator>
14
20
  <PhCheck class="size-3.5 text-primary-foreground" />
@@ -16,11 +22,13 @@
16
22
  </Checkbox.Control>
17
23
  {#if label}
18
24
  <div class="flex flex-col gap-0.5">
19
- <Checkbox.Label class="text-base text-foreground select-none data-disabled:opacity-50"
20
- >{label}</Checkbox.Label
21
- >
25
+ <Checkbox.Label class="text-base select-none data-disabled:opacity-50">
26
+ {label}
27
+ </Checkbox.Label>
22
28
  {#if children}
23
- <span class="text-sm text-foreground/60">{@render children()}</span>
29
+ <span class="text-sm text-ink-dim">
30
+ {@render children()}
31
+ </span>
24
32
  {/if}
25
33
  </div>
26
34
  {/if}
@@ -1,5 +1,5 @@
1
1
  import { Checkbox } from '@ark-ui/svelte/checkbox';
2
- import type { CheckboxProps as Props } from './checkbox-props.ts';
2
+ import type { CheckboxProps as Props } from './checkbox.types.ts';
3
3
  declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
4
4
  type Checkbox = ReturnType<typeof Checkbox>;
5
5
  export default Checkbox;
@@ -0,0 +1,11 @@
1
+ import type { CheckboxGroupBaseProps } from '@ark-ui/svelte/checkbox';
2
+ export interface CheckboxGroupProps<T = string | number> extends Omit<CheckboxGroupBaseProps, 'value'> {
3
+ label?: string;
4
+ description?: string;
5
+ items: {
6
+ value: T;
7
+ label: string;
8
+ }[];
9
+ value: T[];
10
+ orientation?: 'horizontal' | 'vertical';
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,182 @@
1
+ <script lang="ts" generics="T extends ComboboxItem">
2
+ import { Combobox, createListCollection } from '@ark-ui/svelte/combobox';
3
+ import { Field } from '@ark-ui/svelte/field';
4
+ import { useFilter } from '@ark-ui/svelte/locale';
5
+ import { Portal } from '@ark-ui/svelte/portal';
6
+ import type { ComboboxItem, ComboboxProps } from './types';
7
+ import { cn } from 'tailwind-variants';
8
+ import PhCaretDown from '../../icons/PhCaretDown.svelte';
9
+ import PhCheck from '../../icons/PhCheck.svelte';
10
+ import PhX from '../../icons/PhX.svelte';
11
+
12
+ let {
13
+ value = $bindable(),
14
+ items,
15
+ label,
16
+ placeholder,
17
+ layout = 'vertical',
18
+ name,
19
+ readonly,
20
+ multiple,
21
+ ...restProps
22
+ }: ComboboxProps<T> = $props();
23
+
24
+ // Client-side filtering state
25
+ let filterText = $state('');
26
+ const filters = useFilter({ sensitivity: 'base' });
27
+
28
+ // Base collection — only rebuilds when items prop changes
29
+ const baseCollection = $derived(
30
+ createListCollection({
31
+ items,
32
+ itemToString: (item) => item?.label ?? '',
33
+ itemToValue: (item) => item?.value?.toString() ?? ''
34
+ })
35
+ );
36
+
37
+ // Filtered view — lightweight .filter() on keystroke, full collection when empty
38
+ const collection = $derived(
39
+ filterText
40
+ ? baseCollection.filter((itemString) => filters().contains(itemString, filterText))
41
+ : baseCollection
42
+ );
43
+
44
+ // Handle input change — only filter on actual user typing, not on selection/clear events
45
+ function handleInputChange(details: Combobox.InputValueChangeDetails) {
46
+ if (details.reason === 'input-change') {
47
+ filterText = details.inputValue;
48
+ } else {
49
+ filterText = '';
50
+ }
51
+ }
52
+
53
+ // Compute display label for current value — handles async-loaded items
54
+ const displayValue = $derived.by(() => {
55
+ if (value == null || multiple) return undefined;
56
+ const v = Array.isArray(value) ? value[0] : value;
57
+ const found = items.find((item) => item.value.toString() === v?.toString());
58
+ return found ? found.label : undefined;
59
+ });
60
+
61
+ // Memoize value/inputValue props to prevent reactive cascade (new array/object refs cause Zag loops)
62
+ const valueProp = $derived(
63
+ value != null
64
+ ? Array.isArray(value)
65
+ ? value.map((v) => v.toString())
66
+ : [value.toString()]
67
+ : []
68
+ );
69
+ const controlledInputValue = $derived(multiple ? undefined : (displayValue ?? ''));
70
+
71
+ // Handle value change - look up typed value from items prop by string match
72
+ function handleValueChange(details: Combobox.ValueChangeDetails<T>) {
73
+ if (details.value.length === 0) {
74
+ value = multiple ? [] : null;
75
+ } else if (multiple) {
76
+ value = details.value
77
+ .map((v) => items.find((item) => item.value.toString() === v)?.value)
78
+ .filter((v) => v !== undefined);
79
+ } else {
80
+ const found = items.find((item) => item.value.toString() === details.value[0]);
81
+ value = found?.value ?? null;
82
+ }
83
+ }
84
+ </script>
85
+
86
+ <Combobox.Root
87
+ {collection}
88
+ value={valueProp}
89
+ inputValue={controlledInputValue}
90
+ onValueChange={handleValueChange}
91
+ onInputValueChange={handleInputChange}
92
+ openOnClick
93
+ {multiple}
94
+ readOnly={readonly}
95
+ {...restProps}
96
+ class={cn(layout === 'horizontal' ? 'flex items-center gap-1.5' : 'grid gap-1.5')}
97
+ >
98
+ {#if label}
99
+ <Combobox.Label>
100
+ {label}
101
+ <Field.RequiredIndicator />
102
+ </Combobox.Label>
103
+ {/if}
104
+
105
+ <Combobox.Control
106
+ class={cn(
107
+ 'rounded-ark flex min-h-9 items-center gap-1 border px-3 shadow-sm',
108
+ 'focus-within:ring-1 focus-within:ring-(--ark-ring)',
109
+ multiple && 'flex-wrap py-1'
110
+ )}
111
+ >
112
+ {#if multiple && Array.isArray(value) && value.length > 0}
113
+ <div class="flex flex-wrap gap-1">
114
+ {#each value as v (v)}
115
+ {@const item = items.find((i) => i.value === v)}
116
+ {#if item}
117
+ <span
118
+ class="inline-flex items-center gap-1 rounded bg-(--ark-hover-bg) px-2 py-0.5 text-xs"
119
+ >
120
+ {item.label}
121
+ {#if !readonly}
122
+ <button
123
+ type="button"
124
+ onclick={() => {
125
+ value = (value as (number | string)[]).filter((x) => x !== v);
126
+ }}
127
+ class="hover:text-(--ark-error)"
128
+ >
129
+ <PhX class="size-3" />
130
+ </button>
131
+ {/if}
132
+ </span>
133
+ {/if}
134
+ {/each}
135
+ </div>
136
+ {/if}
137
+ <Combobox.Input
138
+ placeholder={placeholder ?? 'Search...'}
139
+ class="flex-1 bg-transparent text-sm outline-none placeholder:text-ink-dim disabled:cursor-not-allowed disabled:opacity-50"
140
+ />
141
+ {#if value != null && !readonly && !multiple}
142
+ <Combobox.ClearTrigger class="text-ink-dim transition-colors hover:text-ink">
143
+ <PhX class="size-4" />
144
+ </Combobox.ClearTrigger>
145
+ {/if}
146
+ <Combobox.Trigger class="text-ink-dim">
147
+ <PhCaretDown class="size-4 opacity-50" />
148
+ </Combobox.Trigger>
149
+ </Combobox.Control>
150
+
151
+ <Portal>
152
+ <Combobox.Positioner class="data-[state=closed]:pointer-events-none">
153
+ <Combobox.Content
154
+ class="data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 z-50 max-h-60 min-w-(--reference-width) overflow-auto rounded-md border bg-surface-1 p-1 shadow-md"
155
+ >
156
+ <Combobox.Empty class="py-2 text-center text-sm text-ink-dim">
157
+ No results found
158
+ </Combobox.Empty>
159
+
160
+ {#each collection.items as item (item.value)}
161
+ <Combobox.Item
162
+ {item}
163
+ class="relative flex cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm text-(--ark-accent-fg) select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-surface-2 data-[state=checked]:bg-surface-2"
164
+ >
165
+ <Combobox.ItemText>{item.label}</Combobox.ItemText>
166
+ <Combobox.ItemIndicator class="absolute right-2 items-center justify-center">
167
+ <PhCheck class="size-3.5" />
168
+ </Combobox.ItemIndicator>
169
+ </Combobox.Item>
170
+ {/each}
171
+ </Combobox.Content>
172
+ </Combobox.Positioner>
173
+ </Portal>
174
+
175
+ {#if multiple && Array.isArray(value)}
176
+ {#each value as v, i (v)}
177
+ <input type="hidden" name="{name}[{i}]" value={v ?? ''} />
178
+ {/each}
179
+ {:else if value != null}
180
+ <input type="hidden" {name} {value} />
181
+ {/if}
182
+ </Combobox.Root>
@@ -0,0 +1,26 @@
1
+ import { Combobox } from '@ark-ui/svelte/combobox';
2
+ import type { ComboboxItem, ComboboxProps } from './types';
3
+ declare function $$render<T extends ComboboxItem>(): {
4
+ props: ComboboxProps<T>;
5
+ exports: {};
6
+ bindings: "value";
7
+ slots: {};
8
+ events: {};
9
+ };
10
+ declare class __sveltets_Render<T extends ComboboxItem> {
11
+ props(): ReturnType<typeof $$render<T>>['props'];
12
+ events(): ReturnType<typeof $$render<T>>['events'];
13
+ slots(): ReturnType<typeof $$render<T>>['slots'];
14
+ bindings(): "value";
15
+ exports(): {};
16
+ }
17
+ interface $$IsomorphicComponent {
18
+ new <T extends ComboboxItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
19
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
20
+ } & ReturnType<__sveltets_Render<T>['exports']>;
21
+ <T extends ComboboxItem>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
22
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
23
+ }
24
+ declare const Combobox: $$IsomorphicComponent;
25
+ type Combobox<T extends ComboboxItem> = InstanceType<typeof Combobox<T>>;
26
+ export default Combobox;
@@ -0,0 +1,16 @@
1
+ import type { ComboboxRootBaseProps } from '@ark-ui/svelte/combobox';
2
+ export interface ComboboxItem<T = number | string> {
3
+ value: T;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface ComboboxProps<T extends ComboboxItem> extends Omit<ComboboxRootBaseProps<T>, 'value' | 'collection'> {
8
+ value?: number | string | null | (number | string)[];
9
+ items: T[];
10
+ label?: string;
11
+ placeholder?: string;
12
+ readonly?: boolean;
13
+ name?: string;
14
+ multiple?: boolean;
15
+ layout?: 'vertical' | 'horizontal';
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ :where(*){--gray-0:oklch(99% var(--gray-chroma,none) var(--gray-hue,none));--gray-1:oklch(95% var(--gray-chroma,none) var(--gray-hue,none));--gray-2:oklch(88% var(--gray-chroma,none) var(--gray-hue,none));--gray-3:oklch(80% var(--gray-chroma,none) var(--gray-hue,none));--gray-4:oklch(74% var(--gray-chroma,none) var(--gray-hue,none));--gray-5:oklch(68% var(--gray-chroma,none) var(--gray-hue,none));--gray-6:oklch(63% var(--gray-chroma,none) var(--gray-hue,none));--gray-7:oklch(58% var(--gray-chroma,none) var(--gray-hue,none));--gray-8:oklch(53% var(--gray-chroma,none) var(--gray-hue,none));--gray-9:oklch(49% var(--gray-chroma,none) var(--gray-hue,none));--gray-10:oklch(43% var(--gray-chroma,none) var(--gray-hue,none));--gray-11:oklch(37% var(--gray-chroma,none) var(--gray-hue,none));--gray-12:oklch(31% var(--gray-chroma,none) var(--gray-hue,none));--gray-13:oklch(25% var(--gray-chroma,none) var(--gray-hue,none));--gray-14:oklch(18% var(--gray-chroma,none) var(--gray-hue,none));--gray-15:oklch(10% var(--gray-chroma,none) var(--gray-hue,none))}
@@ -0,0 +1 @@
1
+ :where(html){--green-0-hsl:131 67% 95%;--green-1-hsl:128 76% 90%;--green-2-hsl:128 71% 82%;--green-3-hsl:129 68% 73%;--green-4-hsl:130 61% 64%;--green-5-hsl:130 57% 56%;--green-6-hsl:131 50% 50%;--green-7-hsl:131 53% 46%;--green-8-hsl:131 54% 40%;--green-9-hsl:132 52% 35%;--green-10-hsl:132 52% 29%;--green-11-hsl:132 53% 22%;--green-12-hsl:131 53% 16%}
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ let { class: className = '', ...restProps } = $props();
3
+ </script>
4
+
5
+ <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width="1em"
9
+ height="1em"
10
+ viewBox="0 0 256 256"
11
+ class={className}
12
+ {...restProps}
13
+ >
14
+ <path
15
+ fill="currentColor"
16
+ d="m213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32"
17
+ />
18
+ </svg>
@@ -0,0 +1,5 @@
1
+ declare const PhCaretDown: import("svelte").Component<{
2
+ class?: string;
3
+ } & Record<string, any>, {}, "">;
4
+ type PhCaretDown = ReturnType<typeof PhCaretDown>;
5
+ export default PhCaretDown;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- let { class: cls = '', ...restProps } = $props();
2
+ let { class: className = '', ...restProps } = $props();
3
3
  </script>
4
4
 
5
5
  <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
@@ -8,10 +8,11 @@
8
8
  width="1em"
9
9
  height="1em"
10
10
  viewBox="0 0 256 256"
11
+ class={className}
11
12
  {...restProps}
12
13
  >
13
14
  <path
14
- fill="#888888"
15
+ fill="currentColor"
15
16
  d="m229.66 77.66l-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69L218.34 66.34a8 8 0 0 1 11.32 11.32"
16
17
  />
17
18
  </svg>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ let { class: className = '', ...restProps } = $props();
3
+ </script>
4
+
5
+ <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width="1em"
9
+ height="1em"
10
+ viewBox="0 0 256 256"
11
+ class={className}
12
+ {...restProps}
13
+ >
14
+ <path fill="currentColor" d="M224 128a8 8 0 0 1-8 8H40a8 8 0 0 1 0-16h176a8 8 0 0 1 8 8" />
15
+ </svg>
@@ -0,0 +1,5 @@
1
+ declare const PhMinus: import("svelte").Component<{
2
+ class?: string;
3
+ } & Record<string, any>, {}, "">;
4
+ type PhMinus = ReturnType<typeof PhMinus>;
5
+ export default PhMinus;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ let { class: className = '', ...restProps } = $props();
3
+ </script>
4
+
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ width="1em"
8
+ height="1em"
9
+ viewBox="0 0 256 256"
10
+ class={className}
11
+ {...restProps}
12
+ >
13
+ <path
14
+ fill="currentColor"
15
+ d="M205.66 194.34a8 8 0 0 1-11.32 11.32L128 139.31l-66.34 66.35a8 8 0 0 1-11.32-11.32L116.69 128L50.34 61.66a8 8 0 0 1 11.32-11.32L128 116.69l66.34-66.35a8 8 0 0 1 11.32 11.32L139.31 128Z"
16
+ />
17
+ </svg>
18
+ <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
@@ -0,0 +1,5 @@
1
+ declare const PhX: import("svelte").Component<{
2
+ class?: string;
3
+ } & Record<string, any>, {}, "">;
4
+ type PhX = ReturnType<typeof PhX>;
5
+ export default PhX;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export { default as Checkbox } from './components/checkbox/Checkbox.svelte';
2
1
  export { default as Button } from './components/button/Button.svelte';
2
+ export { default as Checkbox } from './components/checkbox/Checkbox.svelte';
3
+ export { default as CheckboxGroup } from './components/checkbox/Checkbox-group.svelte';
4
+ export { default as Combobox } from './components/combobox/Combobox.svelte';
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  // Reexport your entry components here
2
- export { default as Checkbox } from './components/checkbox/Checkbox.svelte';
3
2
  export { default as Button } from './components/button/Button.svelte';
3
+ export { default as Checkbox } from './components/checkbox/Checkbox.svelte';
4
+ export { default as CheckboxGroup } from './components/checkbox/Checkbox-group.svelte';
5
+ export { default as Combobox } from './components/combobox/Combobox.svelte';
@@ -0,0 +1,14 @@
1
+ :where(html) {
2
+ --hue-red: 25;
3
+ --hue-pink: 350;
4
+ --hue-purple: 310;
5
+ --hue-violet: 290;
6
+ --hue-indigo: 270;
7
+ --hue-blue: 240;
8
+ --hue-cyan: 210;
9
+ --hue-teal: 185;
10
+ --hue-green: 145;
11
+ --hue-lime: 125;
12
+ --hue-yellow: 100;
13
+ --hue-orange: 75;
14
+ }
@@ -0,0 +1,19 @@
1
+ :where(*) {
2
+ --color-0: oklch(99% .03 var(--color-hue, 0));
3
+ --color-1: oklch(95% .06 var(--color-hue, 0));
4
+ --color-2: oklch(88% .12 var(--color-hue, 0));
5
+ --color-3: oklch(80% .14 var(--color-hue, 0));
6
+ --color-4: oklch(74% .16 var(--color-hue, 0));
7
+ --color-5: oklch(68% .19 var(--color-hue, 0));
8
+ --color-6: oklch(63% .20 var(--color-hue, 0));
9
+ --color-7: oklch(58% .21 var(--color-hue, 0));
10
+ --color-8: oklch(53% .20 var(--color-hue, 0));
11
+ --color-9: oklch(49% .19 var(--color-hue, 0));
12
+ --color-10: oklch(42% .17 var(--color-hue, 0));
13
+ --color-11: oklch(35% .15 var(--color-hue, 0));
14
+ --color-12: oklch(27% .12 var(--color-hue, 0));
15
+ --color-13: oklch(20% .09 var(--color-hue, 0));
16
+ --color-14: oklch(14% .07 var(--color-hue, 0));
17
+ --color-15: oklch(11% .05 var(--color-hue, 0));
18
+ --color-bright: oklch(65% .3 var(--color-hue, 0));
19
+ }
@@ -0,0 +1,18 @@
1
+ :where(*) {
2
+ --gray-0: oklch(99% var(--gray-chroma, none) var(--gray-hue, none));
3
+ --gray-1: oklch(95% var(--gray-chroma, none) var(--gray-hue, none));
4
+ --gray-2: oklch(88% var(--gray-chroma, none) var(--gray-hue, none));
5
+ --gray-3: oklch(80% var(--gray-chroma, none) var(--gray-hue, none));
6
+ --gray-4: oklch(74% var(--gray-chroma, none) var(--gray-hue, none));
7
+ --gray-5: oklch(68% var(--gray-chroma, none) var(--gray-hue, none));
8
+ --gray-6: oklch(63% var(--gray-chroma, none) var(--gray-hue, none));
9
+ --gray-7: oklch(58% var(--gray-chroma, none) var(--gray-hue, none));
10
+ --gray-8: oklch(53% var(--gray-chroma, none) var(--gray-hue, none));
11
+ --gray-9: oklch(49% var(--gray-chroma, none) var(--gray-hue, none));
12
+ --gray-10: oklch(43% var(--gray-chroma, none) var(--gray-hue, none));
13
+ --gray-11: oklch(37% var(--gray-chroma, none) var(--gray-hue, none));
14
+ --gray-12: oklch(31% var(--gray-chroma, none) var(--gray-hue, none));
15
+ --gray-13: oklch(25% var(--gray-chroma, none) var(--gray-hue, none));
16
+ --gray-14: oklch(18% var(--gray-chroma, none) var(--gray-hue, none));
17
+ --gray-15: oklch(10% var(--gray-chroma, none) var(--gray-hue, none));
18
+ }
package/dist/theme.css CHANGED
@@ -1,74 +1,52 @@
1
+ @import './props.colors-oklch-hues.css';
2
+ @import './props.colors-oklch.css';
3
+ @import './props.gray-oklch.css';
4
+
1
5
  :root {
6
+ --dim: 0.3;
2
7
  --radius: 6px;
3
-
4
- --background: oklch(0.9885 0.0057 84.5659);
5
- --foreground: oklch(0.366 0.0251 49.6085);
6
- --card: oklch(0.9686 0.0091 78.2818);
7
- --card-foreground: oklch(0.366 0.0251 49.6085);
8
- --popover: oklch(0.9686 0.0091 78.2818);
9
- --popover-foreground: oklch(0.366 0.0251 49.6085);
10
- --primary: oklch(0.5553 0.1455 48.9975);
11
- --primary-foreground: oklch(1 0 0);
12
- --secondary: oklch(0.8276 0.0752 74.44);
13
- --secondary-foreground: oklch(0.4444 0.0096 73.639);
14
- --muted: oklch(0.9363 0.0218 83.2637);
15
- --muted-foreground: oklch(0.5534 0.0116 58.0708);
16
- --accent: oklch(0.9 0.05 74.9889);
17
- --accent-foreground: oklch(0.4444 0.0096 73.639);
18
- --destructive: oklch(0.4437 0.1613 26.8994);
19
- --destructive-foreground: oklch(1 0 0);
20
- --border: oklch(0.8866 0.0404 89.6994);
21
- --input: oklch(0.8866 0.0404 89.6994);
22
- --ring: oklch(0.5553 0.1455 48.9975);
23
8
  --font-sans: 'Wix Madefor Text Variable', sans-serif;
24
9
  --font-serif: Merriweather, serif;
25
10
  --font-mono: Fira Code, monospace;
11
+
12
+ --color-hue: var(--hue-orange);
13
+ --gray-hue: 250;
14
+
15
+ --compote-ink: var(--gray-15);
16
+ --compote-ink-dim: var(--gray-11);
17
+ --compote-surface-3: var(--gray-5);
18
+ --compote-surface-2: var(--gray-4);
19
+ --compote-surface-1: var(--gray-3);
20
+ --compote-surface-document: var(--gray-2);
21
+ --compote-well: var(--gray-1);
22
+
23
+ --compote-primary: var(--color-7);
26
24
  }
27
25
 
28
26
  @media (prefers-color-scheme: dark) {
29
27
  :root {
30
- --background: oklch(26.21% 0.009 248.19);
31
- --foreground: oklch(0.9699 0.0013 106.4238);
32
- --card: oklch(34.51% 0.013 248.21);
33
- --card-foreground: oklch(0.9699 0.0013 106.4238);
34
- --popover: oklch(0.2685 0.0063 34.2976);
35
- --popover-foreground: oklch(0.9699 0.0013 106.4238);
36
- --primary: oklch(0.7049 0.1867 47.6044);
37
- --primary-foreground: oklch(1 0 0);
38
- --secondary: oklch(0.4444 0.0096 73.639);
39
- --secondary-foreground: oklch(0.9232 0.0026 48.7171);
40
- --muted: oklch(0.233 0.0073 67.4563);
41
- --muted-foreground: oklch(0.7161 0.0091 56.259);
42
- --accent: oklch(0.3598 0.0497 229.3202);
43
- --accent-foreground: oklch(0.9232 0.0026 48.7171);
44
- --destructive: oklch(0.5771 0.2152 27.325);
45
- --destructive-foreground: oklch(1 0 0);
46
- --border: oklch(42.76% 0.015 248.17);
47
- --input: oklch(0.3741 0.0087 67.5582);
48
- --ring: oklch(0.7049 0.1867 47.6044);
28
+ --compote-ink: var(--gray-1);
29
+ --compote-ink-dim: var(--gray-5);
30
+ --compote-surface-3: var(--gray-11);
31
+ --compote-surface-2: var(--gray-12);
32
+ --compote-surface-1: var(--gray-13);
33
+ --compote-surface-document: var(--gray-14);
34
+ --compote-well: var(--gray-15);
35
+
36
+ --compote-primary: var(--color-7);
49
37
  }
50
38
  }
51
39
 
52
40
  @theme inline {
53
- --color-background: var(--background);
54
- --color-foreground: var(--foreground);
55
- --color-card: var(--card);
56
- --color-card-foreground: var(--card-foreground);
57
- --color-popover: var(--popover);
58
- --color-popover-foreground: var(--popover-foreground);
59
- --color-primary: var(--primary);
60
- --color-primary-foreground: var(--primary-foreground);
61
- --color-secondary: var(--secondary);
62
- --color-secondary-foreground: var(--secondary-foreground);
63
- --color-muted: var(--muted);
64
- --color-muted-foreground: var(--muted-foreground);
65
- --color-accent: var(--accent);
66
- --color-accent-foreground: var(--accent-foreground);
67
- --color-destructive: var(--destructive);
68
- --color-destructive-foreground: var(--destructive-foreground);
69
- --color-border: var(--border);
70
- --color-input: var(--input);
71
- --color-ring: var(--ring);
41
+ --color-ink: var(--compote-ink);
42
+ --color-ink-dim: var(--compote-ink-dim);
43
+ --color-surface-3: var(--compote-surface-3);
44
+ --color-surface-2: var(--compote-surface-2);
45
+ --color-surface-1: var(--compote-surface-1);
46
+ --color-surface-document: var(--compote-surface-document);
47
+ --color-well: var(--compote-well);
48
+
49
+ --color-primary: var(--compote-primary);
72
50
 
73
51
  --font-sans: var(--font-sans);
74
52
  --font-mono: var(--font-mono);
@@ -82,9 +60,9 @@
82
60
 
83
61
  @layer base {
84
62
  * {
85
- @apply border-border outline-ring/50;
63
+ @apply border-surface-3;
86
64
  }
87
65
  body {
88
- @apply bg-background text-foreground;
66
+ @apply bg-surface-document text-ink;
89
67
  }
90
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.0.6",
3
+ "version": "0.2.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -1,10 +0,0 @@
1
- <script lang="ts">
2
- let { class: cls = '', ...rest } = $props();
3
- </script>
4
-
5
- <svg class={cls} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" {...rest}>
6
- <path
7
- fill="currentColor"
8
- d="m232.49 80.49l-128 128a12 12 0 0 1-17 0l-56-56a12 12 0 1 1 17-17L96 183L215.51 63.51a12 12 0 0 1 17 17Z"
9
- />
10
- </svg>
@@ -1,5 +0,0 @@
1
- declare const CheckBold: import("svelte").Component<{
2
- class?: string;
3
- } & Record<string, any>, {}, "">;
4
- type CheckBold = ReturnType<typeof CheckBold>;
5
- export default CheckBold;