@human-kit/ui 1.0.0-beta.9 → 1.0.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 (98) hide show
  1. package/README.md +27 -60
  2. package/dist/FOCUS_STATE_CONTRACT.md +1 -0
  3. package/dist/color-picker/README.md +78 -0
  4. package/dist/color-picker/area/color-picker-area.svelte +195 -0
  5. package/dist/color-picker/area/color-picker-area.svelte.d.ts +4 -0
  6. package/dist/color-picker/area-thumb/color-picker-area-thumb.svelte +231 -0
  7. package/dist/color-picker/area-thumb/color-picker-area-thumb.svelte.d.ts +4 -0
  8. package/dist/color-picker/channel-field/color-picker-channel-field.svelte +95 -0
  9. package/dist/color-picker/channel-field/color-picker-channel-field.svelte.d.ts +4 -0
  10. package/dist/color-picker/eye-dropper/color-picker-eye-dropper.svelte +79 -0
  11. package/dist/color-picker/eye-dropper/color-picker-eye-dropper.svelte.d.ts +4 -0
  12. package/dist/color-picker/hex-field/color-picker-hex-field.svelte +105 -0
  13. package/dist/color-picker/hex-field/color-picker-hex-field.svelte.d.ts +4 -0
  14. package/dist/color-picker/index.d.ts +16 -0
  15. package/dist/color-picker/index.js +15 -0
  16. package/dist/color-picker/index.parts.d.ts +12 -0
  17. package/dist/color-picker/index.parts.js +12 -0
  18. package/dist/color-picker/label/color-picker-label.svelte +34 -0
  19. package/dist/color-picker/label/color-picker-label.svelte.d.ts +4 -0
  20. package/dist/color-picker/preview/color-picker-preview.svelte +43 -0
  21. package/dist/color-picker/preview/color-picker-preview.svelte.d.ts +4 -0
  22. package/dist/color-picker/root/color-picker-root.svelte +365 -0
  23. package/dist/color-picker/root/color-picker-root.svelte.d.ts +4 -0
  24. package/dist/color-picker/root/color.d.ts +68 -0
  25. package/dist/color-picker/root/color.js +266 -0
  26. package/dist/color-picker/root/context.d.ts +127 -0
  27. package/dist/color-picker/root/context.js +44 -0
  28. package/dist/color-picker/slider/color-picker-slider.svelte +188 -0
  29. package/dist/color-picker/slider/color-picker-slider.svelte.d.ts +4 -0
  30. package/dist/color-picker/slider-thumb/color-picker-slider-thumb.svelte +208 -0
  31. package/dist/color-picker/slider-thumb/color-picker-slider-thumb.svelte.d.ts +4 -0
  32. package/dist/color-picker/swatch/color-picker-swatch.svelte +149 -0
  33. package/dist/color-picker/swatch/color-picker-swatch.svelte.d.ts +4 -0
  34. package/dist/color-picker/swatch-list/color-picker-swatch-list.svelte +133 -0
  35. package/dist/color-picker/swatch-list/color-picker-swatch-list.svelte.d.ts +4 -0
  36. package/dist/color-picker/types.d.ts +176 -0
  37. package/dist/color-picker/types.js +1 -0
  38. package/dist/index.d.ts +8 -0
  39. package/dist/index.js +8 -0
  40. package/dist/internal/localized-strings.d.ts +152 -0
  41. package/dist/internal/localized-strings.js +152 -0
  42. package/dist/pin-input/README.md +55 -0
  43. package/dist/pin-input/cell/pin-input-cell.svelte +210 -0
  44. package/dist/pin-input/cell/pin-input-cell.svelte.d.ts +4 -0
  45. package/dist/pin-input/index.d.ts +6 -0
  46. package/dist/pin-input/index.js +5 -0
  47. package/dist/pin-input/index.parts.d.ts +3 -0
  48. package/dist/pin-input/index.parts.js +3 -0
  49. package/dist/pin-input/label/pin-input-label.svelte +43 -0
  50. package/dist/pin-input/label/pin-input-label.svelte.d.ts +4 -0
  51. package/dist/pin-input/root/context.d.ts +70 -0
  52. package/dist/pin-input/root/context.js +15 -0
  53. package/dist/pin-input/root/pin-input-root.svelte +337 -0
  54. package/dist/pin-input/root/pin-input-root.svelte.d.ts +4 -0
  55. package/dist/pin-input/root/pin-input-utils.d.ts +18 -0
  56. package/dist/pin-input/root/pin-input-utils.js +44 -0
  57. package/dist/pin-input/types.d.ts +84 -0
  58. package/dist/pin-input/types.js +1 -0
  59. package/dist/rating/README.md +58 -0
  60. package/dist/rating/index.d.ts +7 -0
  61. package/dist/rating/index.js +6 -0
  62. package/dist/rating/index.parts.d.ts +4 -0
  63. package/dist/rating/index.parts.js +4 -0
  64. package/dist/rating/item/rating-item.svelte +177 -0
  65. package/dist/rating/item/rating-item.svelte.d.ts +4 -0
  66. package/dist/rating/label/rating-label.svelte +42 -0
  67. package/dist/rating/label/rating-label.svelte.d.ts +4 -0
  68. package/dist/rating/output/rating-output.svelte +38 -0
  69. package/dist/rating/output/rating-output.svelte.d.ts +4 -0
  70. package/dist/rating/root/context.d.ts +87 -0
  71. package/dist/rating/root/context.js +15 -0
  72. package/dist/rating/root/rating-root.svelte +521 -0
  73. package/dist/rating/root/rating-root.svelte.d.ts +4 -0
  74. package/dist/rating/root/rating-utils.d.ts +28 -0
  75. package/dist/rating/root/rating-utils.js +53 -0
  76. package/dist/rating/types.d.ts +124 -0
  77. package/dist/rating/types.js +1 -0
  78. package/dist/search-field/README.md +29 -0
  79. package/dist/search-field/clear/README.md +5 -0
  80. package/dist/search-field/clear/search-field-clear.svelte +99 -0
  81. package/dist/search-field/clear/search-field-clear.svelte.d.ts +10 -0
  82. package/dist/search-field/index.d.ts +15 -0
  83. package/dist/search-field/index.js +6 -0
  84. package/dist/search-field/index.parts.d.ts +4 -0
  85. package/dist/search-field/index.parts.js +4 -0
  86. package/dist/search-field/input/README.md +5 -0
  87. package/dist/search-field/input/search-field-input.svelte +158 -0
  88. package/dist/search-field/input/search-field-input.svelte.d.ts +14 -0
  89. package/dist/search-field/label/README.md +3 -0
  90. package/dist/search-field/label/search-field-label.svelte +27 -0
  91. package/dist/search-field/label/search-field-label.svelte.d.ts +7 -0
  92. package/dist/search-field/root/README.md +5 -0
  93. package/dist/search-field/root/context.d.ts +28 -0
  94. package/dist/search-field/root/context.js +15 -0
  95. package/dist/search-field/root/search-field-root.svelte +230 -0
  96. package/dist/search-field/root/search-field-root.svelte.d.ts +33 -0
  97. package/dist/tooltip/root/tooltip-root.svelte +16 -11
  98. package/package.json +21 -1
@@ -0,0 +1,149 @@
1
+ <script lang="ts">
2
+ import { parseColor, toCssColor } from '../root/color';
3
+ import { getColorPickerSwatchListContext, useColorPickerContext } from '../root/context';
4
+ import { watchFocusVisible } from '../../primitives/focus-visible.svelte';
5
+ import {
6
+ shouldShowFocusVisible,
7
+ trackInteractionModality
8
+ } from '../../primitives/input-modality';
9
+ import type { ColorPickerSwatchProps } from '../types';
10
+
11
+ /**
12
+ * ColorPicker.Swatch — one color to choose.
13
+ *
14
+ * In a `ColorPicker.SwatchList` the swatch is an option of that list: it takes the color at a
15
+ * press, at `Enter` and at the space bar. Outside a list the swatch shows a color and answers
16
+ * nothing. The color is in `--color-picker-swatch-color`, thus your CSS paints it.
17
+ */
18
+ let {
19
+ color,
20
+ children,
21
+ class: className = '',
22
+ element = $bindable<HTMLDivElement | null>(null),
23
+ 'aria-label': ariaLabel,
24
+ style,
25
+ onclick,
26
+ onkeydown,
27
+ onfocus,
28
+ onblur,
29
+ ...restProps
30
+ }: ColorPickerSwatchProps = $props();
31
+
32
+ const ctx = useColorPickerContext('ColorPicker.Swatch');
33
+ const list = getColorPickerSwatchListContext();
34
+
35
+ let swatchRef: HTMLDivElement | null = $state(null);
36
+ let focused = $state(false);
37
+ let focusVisible = $state(false);
38
+
39
+ const registration = list?.register({ elementRef: () => swatchRef, color: () => color });
40
+ const index = registration?.index ?? 0;
41
+
42
+ $effect(() => {
43
+ element = swatchRef;
44
+ });
45
+
46
+ $effect(() => registration?.unregister);
47
+
48
+ const parsed = $derived(parseColor(color));
49
+ const cssColor = $derived(parsed ? toCssColor(parsed) : color);
50
+ const selected = $derived(list ? list.isSelected(color) : false);
51
+ const tabIndex = $derived(list && !ctx.isDisabled && list.isTabStop(index) ? 0 : -1);
52
+
53
+ watchFocusVisible({
54
+ isFocused: () => focused,
55
+ element: () => swatchRef,
56
+ set: (visible) => {
57
+ focusVisible = visible;
58
+ }
59
+ });
60
+
61
+ function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }) {
62
+ onclick?.(event);
63
+ if (event.defaultPrevented || !list) return;
64
+ list.select(color, event);
65
+ }
66
+
67
+ function handleKeyDown(event: KeyboardEvent & { currentTarget: EventTarget & HTMLDivElement }) {
68
+ onkeydown?.(event);
69
+ if (event.defaultPrevented || !list) return;
70
+
71
+ switch (event.key) {
72
+ case 'Enter':
73
+ case ' ':
74
+ event.preventDefault();
75
+ list.select(color, event);
76
+ break;
77
+ case 'ArrowRight':
78
+ event.preventDefault();
79
+ list.moveFocus(index, 1);
80
+ break;
81
+ case 'ArrowLeft':
82
+ event.preventDefault();
83
+ list.moveFocus(index, -1);
84
+ break;
85
+ case 'ArrowDown':
86
+ event.preventDefault();
87
+ list.moveFocus(index, 1);
88
+ break;
89
+ case 'ArrowUp':
90
+ event.preventDefault();
91
+ list.moveFocus(index, -1);
92
+ break;
93
+ case 'Home':
94
+ event.preventDefault();
95
+ list.moveFocus(index, 'first');
96
+ break;
97
+ case 'End':
98
+ event.preventDefault();
99
+ list.moveFocus(index, 'last');
100
+ break;
101
+ default:
102
+ break;
103
+ }
104
+ }
105
+
106
+ function handleFocus(event: FocusEvent & { currentTarget: EventTarget & HTMLDivElement }) {
107
+ onfocus?.(event);
108
+ trackInteractionModality(event, swatchRef);
109
+ focused = true;
110
+ focusVisible = shouldShowFocusVisible(swatchRef);
111
+ }
112
+
113
+ function handleBlur(event: FocusEvent & { currentTarget: EventTarget & HTMLDivElement }) {
114
+ onblur?.(event);
115
+ focused = false;
116
+ focusVisible = false;
117
+ }
118
+
119
+ const inlineStyle = $derived(
120
+ `--color-picker-swatch-color: ${cssColor};${style ? ` ${style}` : ''}`
121
+ );
122
+ </script>
123
+
124
+ <!-- The swatch is an option of a listbox, and the checker cannot read a role that the context
125
+ decides. Outside a list it takes no tabindex at all. -->
126
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
127
+ <div
128
+ {...restProps}
129
+ bind:this={swatchRef}
130
+ role={list ? 'option' : undefined}
131
+ tabindex={list ? tabIndex : undefined}
132
+ aria-selected={list ? selected : undefined}
133
+ aria-label={list ? (ariaLabel ?? color) : undefined}
134
+ aria-disabled={list && ctx.isDisabled ? true : undefined}
135
+ class={className}
136
+ style={inlineStyle}
137
+ data-color-picker-swatch="true"
138
+ data-color={color}
139
+ data-selected={selected || undefined}
140
+ data-disabled={ctx.isDisabled || undefined}
141
+ data-focused={focused || undefined}
142
+ data-focus-visible={focusVisible || undefined}
143
+ onclick={handleClick}
144
+ onkeydown={handleKeyDown}
145
+ onfocus={handleFocus}
146
+ onblur={handleBlur}
147
+ >
148
+ {@render children?.()}
149
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ColorPickerSwatchProps } from '../types';
2
+ declare const ColorPickerSwatch: import("svelte").Component<ColorPickerSwatchProps, {}, "element">;
3
+ type ColorPickerSwatch = ReturnType<typeof ColorPickerSwatch>;
4
+ export default ColorPickerSwatch;
@@ -0,0 +1,133 @@
1
+ <script lang="ts">
2
+ import { readable } from 'svelte/store';
3
+ import { SvelteMap } from 'svelte/reactivity';
4
+ import { resolveLocalizedString } from '../../internal/localized-strings';
5
+ import { isRtl } from '../../internal/rtl';
6
+ import { getLocaleContext } from '../../locale-provider/context';
7
+ import { focusWithModality } from '../../primitives/input-modality';
8
+ import { colorsAreEqual, parseColor } from '../root/color';
9
+ import { setColorPickerSwatchListContext, useColorPickerContext } from '../root/context';
10
+ import type { ColorPickerSwatchListProps } from '../types';
11
+
12
+ /**
13
+ * ColorPicker.SwatchList — a set of colors to choose from.
14
+ *
15
+ * The list is a `role="listbox"`, and each `ColorPicker.Swatch` in it is an option. The tab
16
+ * order holds one swatch, the arrows move between them, and `Enter` or the space bar takes
17
+ * the color. A press takes it at once.
18
+ */
19
+ let {
20
+ children,
21
+ class: className = '',
22
+ element = $bindable<HTMLDivElement | null>(null),
23
+ 'aria-label': ariaLabel,
24
+ ...restProps
25
+ }: ColorPickerSwatchListProps = $props();
26
+
27
+ const ctx = useColorPickerContext('ColorPicker.SwatchList');
28
+ const localeStore = getLocaleContext()?.locale ?? readable<string | undefined>(undefined);
29
+
30
+ let listRef: HTMLDivElement | null = $state(null);
31
+ let focusedIndex = $state<number | null>(null);
32
+
33
+ type SwatchRegistration = { elementRef: () => HTMLElement | null; color: () => string };
34
+ const swatches = new SvelteMap<number, SwatchRegistration>();
35
+
36
+ const listId = $derived(ctx.getPartId('swatches'));
37
+ const defaultLabel = $derived(resolveLocalizedString($localeStore, 'colorPicker.swatches'));
38
+
39
+ $effect(() => {
40
+ element = listRef;
41
+ });
42
+
43
+ function isSelected(color: string): boolean {
44
+ const parsed = parseColor(color);
45
+ if (!parsed) return false;
46
+ return colorsAreEqual(parsed, ctx.hasAlpha ? ctx.color : { ...ctx.color, a: parsed.a });
47
+ }
48
+
49
+ /** The swatch of the color, or the first one: the tab order holds one swatch. */
50
+ const selectedIndex = $derived.by(() => {
51
+ for (const [index, swatch] of swatches) {
52
+ if (isSelected(swatch.color())) return index;
53
+ }
54
+ return null;
55
+ });
56
+
57
+ function focusIndex(index: number) {
58
+ const node = swatches.get(index)?.elementRef();
59
+ if (!node) return;
60
+ focusedIndex = index;
61
+ focusWithModality(node, 'keyboard');
62
+ }
63
+
64
+ setColorPickerSwatchListContext({
65
+ get listId() {
66
+ return listId;
67
+ },
68
+ register(options) {
69
+ let index = 0;
70
+ while (swatches.has(index)) index += 1;
71
+ swatches.set(index, options);
72
+ const registeredIndex = index;
73
+ return {
74
+ index: registeredIndex,
75
+ unregister: () => {
76
+ if (swatches.get(registeredIndex)?.elementRef === options.elementRef) {
77
+ swatches.delete(registeredIndex);
78
+ }
79
+ }
80
+ };
81
+ },
82
+ isTabStop(index) {
83
+ const stop = focusedIndex ?? selectedIndex ?? Math.min(...swatches.keys());
84
+ return index === stop;
85
+ },
86
+ moveFocus(from, step) {
87
+ const indexes = [...swatches.keys()].sort((a, b) => a - b);
88
+ if (indexes.length === 0) return;
89
+ if (step === 'first') {
90
+ focusIndex(indexes[0]);
91
+ return;
92
+ }
93
+ if (step === 'last') {
94
+ focusIndex(indexes[indexes.length - 1]);
95
+ return;
96
+ }
97
+ const direction = isRtl(listRef) ? -step : step;
98
+ const at = indexes.indexOf(from);
99
+ const next = Math.min(Math.max(at + direction, 0), indexes.length - 1);
100
+ focusIndex(indexes[next]);
101
+ },
102
+ select(color, event) {
103
+ if (ctx.isDisabled || ctx.isReadOnly) return;
104
+ if (!ctx.setText(color, { reason: 'swatch', event })) return;
105
+ ctx.commit({ reason: 'swatch', event });
106
+ },
107
+ isSelected
108
+ });
109
+
110
+ function handleFocusOut(event: FocusEvent & { currentTarget: EventTarget & HTMLDivElement }) {
111
+ const next = event.relatedTarget;
112
+ if (next instanceof Node && event.currentTarget.contains(next)) return;
113
+ // The tab order goes back to the swatch of the color when the focus leaves the list.
114
+ focusedIndex = null;
115
+ }
116
+ </script>
117
+
118
+ <div
119
+ {...restProps}
120
+ bind:this={listRef}
121
+ id={listId}
122
+ role="listbox"
123
+ aria-label={ariaLabel ?? defaultLabel}
124
+ aria-orientation="horizontal"
125
+ aria-disabled={ctx.isDisabled || undefined}
126
+ class={className}
127
+ data-color-picker-swatch-list="true"
128
+ data-disabled={ctx.isDisabled || undefined}
129
+ data-readonly={ctx.isReadOnly || undefined}
130
+ onfocusout={handleFocusOut}
131
+ >
132
+ {@render children?.()}
133
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ColorPickerSwatchListProps } from '../types';
2
+ declare const ColorPickerSwatchList: import("svelte").Component<ColorPickerSwatchListProps, {}, "element">;
3
+ type ColorPickerSwatchList = ReturnType<typeof ColorPickerSwatchList>;
4
+ export default ColorPickerSwatchList;
@@ -0,0 +1,176 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes, HTMLButtonAttributes, HTMLInputAttributes } from 'svelte/elements';
3
+ import type { Color, ColorChannel, ColorFormat, ColorPickerChangeDetails, ColorPickerContext, ColorPickerSliderOrientation } from './root/context';
4
+ export type { Color, ColorChannel, ColorFormat, ColorPickerChangeDetails, ColorPickerContext, ColorPickerSliderOrientation };
5
+ export type ColorPickerRootProps = {
6
+ /** A stable id, from which the component makes its internal ARIA ids. Give one on a server. */
7
+ id?: string;
8
+ /**
9
+ * The color, as text: a hex color, `rgb()`, `hsl()` or `hsb()`. You can bind it with
10
+ * `bind:value`. The component answers in the format of `format`.
11
+ */
12
+ value?: string;
13
+ /** The color at the start, for when you give no `value`. The default is `#000000`. */
14
+ defaultValue?: string;
15
+ /**
16
+ * Give your own code full control of the color. The component stops to write back to `value`,
17
+ * and it reports only through `onChange`. Thus the parent can refuse a change.
18
+ */
19
+ controlledValue?: boolean;
20
+ /** The component calls it on each change, also on each move of a drag. */
21
+ onChange?: (value: string, details: ColorPickerChangeDetails) => void;
22
+ /**
23
+ * The component calls it when a sequence of changes ends: at the release of a key, and at the
24
+ * end of a drag. Use it for work that must not run on each move.
25
+ */
26
+ onChangeEnd?: (value: string, details: ColorPickerChangeDetails) => void;
27
+ /** The text format of the value. The default is `hex`. */
28
+ format?: ColorFormat;
29
+ /**
30
+ * Keeps an alpha in the color. The value then holds a fourth number, and `ColorPicker.Slider`
31
+ * accepts the `alpha` channel. The default is off.
32
+ */
33
+ alpha?: boolean;
34
+ /** Disables each control of the picker. The controls leave the tab order. */
35
+ disabled?: boolean;
36
+ /** Keeps the controls in the tab order, but the color does not change. */
37
+ readonly?: boolean;
38
+ /** Marks the color as invalid. Each control gets `aria-invalid`. */
39
+ invalid?: boolean;
40
+ /** The name of the hidden input that carries the color in a form. */
41
+ name?: string;
42
+ /** The id of the form that the hidden input belongs to, when the picker is outside it. */
43
+ form?: string;
44
+ /** The accessible name of the picker, for when there is no `ColorPicker.Label`. */
45
+ 'aria-label'?: string;
46
+ /** The id of the element that gives the picker its name, in place of `ColorPicker.Label`. */
47
+ 'aria-labelledby'?: string;
48
+ /** The id of the element that describes the picker, for example an error message. */
49
+ 'aria-describedby'?: string;
50
+ /** The content: the label, the area, the sliders and the fields. */
51
+ children?: Snippet;
52
+ /** The CSS class names of the root element. */
53
+ class?: string;
54
+ /** A bindable reference to the root element. */
55
+ element?: HTMLDivElement | null;
56
+ /** A bindable reference to the context, for a composition of your own. */
57
+ context?: ColorPickerContext;
58
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children' | 'id' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'onchange'>;
59
+ export type ColorPickerLabelProps = Omit<HTMLAttributes<HTMLSpanElement>, 'class'> & {
60
+ /** The CSS class names of the label. */
61
+ class?: string;
62
+ };
63
+ export type ColorPickerAreaProps = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
64
+ /** The channel of the horizontal axis. The default is `saturation`. */
65
+ xChannel?: ColorChannel;
66
+ /** The channel of the vertical axis, which counts from the bottom. The default is `brightness`. */
67
+ yChannel?: ColorChannel;
68
+ /** The content: a `ColorPicker.AreaThumb`. */
69
+ children?: Snippet;
70
+ /** The CSS class names of the area. */
71
+ class?: string;
72
+ /** A bindable reference to the area element. */
73
+ element?: HTMLDivElement | null;
74
+ };
75
+ export type ColorPickerAreaThumbRenderState = {
76
+ /** The position of the thumb on the horizontal axis, from 0 to 100. */
77
+ xPercent: number;
78
+ /** The position of the thumb on the vertical axis, from 0 to 100, from the bottom. */
79
+ yPercent: number;
80
+ /** Whether a pointer moves the thumb. */
81
+ dragging: boolean;
82
+ /** Whether one of the two inputs of the thumb has the focus. */
83
+ focused: boolean;
84
+ };
85
+ export type ColorPickerAreaThumbProps = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> & {
86
+ /**
87
+ * The content. As a snippet with one argument, it receives the render state: `xPercent`,
88
+ * `yPercent`, `dragging` and `focused`.
89
+ */
90
+ children?: Snippet<[ColorPickerAreaThumbRenderState]> | Snippet;
91
+ /** The CSS class names of the thumb. */
92
+ class?: string;
93
+ /** A bindable reference to the thumb element. */
94
+ element?: HTMLDivElement | null;
95
+ };
96
+ export type ColorPickerSliderProps = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
97
+ /** The channel the slider moves, for example `hue` or `alpha`. */
98
+ channel: ColorChannel;
99
+ /** The direction of the track. The default is horizontal. */
100
+ orientation?: ColorPickerSliderOrientation;
101
+ /** The content: a `ColorPicker.SliderThumb`. */
102
+ children?: Snippet;
103
+ /** The CSS class names of the track. */
104
+ class?: string;
105
+ /** A bindable reference to the track element. */
106
+ element?: HTMLDivElement | null;
107
+ };
108
+ export type ColorPickerSliderThumbRenderState = {
109
+ /** The position of the thumb on the track, from 0 to 100. */
110
+ percent: number;
111
+ /** The value of the channel. */
112
+ value: number;
113
+ /** Whether a pointer moves the thumb. */
114
+ dragging: boolean;
115
+ /** Whether the input of the thumb has the focus. */
116
+ focused: boolean;
117
+ };
118
+ export type ColorPickerSliderThumbProps = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> & {
119
+ /**
120
+ * The content. As a snippet with one argument, it receives the render state: `percent`,
121
+ * `value`, `dragging` and `focused`.
122
+ */
123
+ children?: Snippet<[ColorPickerSliderThumbRenderState]> | Snippet;
124
+ /** The CSS class names of the thumb. */
125
+ class?: string;
126
+ /** A bindable reference to the thumb element. */
127
+ element?: HTMLDivElement | null;
128
+ };
129
+ export type ColorPickerHexFieldProps = Omit<HTMLInputAttributes, 'class' | 'children' | 'value' | 'type'> & {
130
+ /** The CSS class names of the field. */
131
+ class?: string;
132
+ /** A bindable reference to the input element. */
133
+ element?: HTMLInputElement | null;
134
+ };
135
+ export type ColorPickerChannelFieldProps = Omit<HTMLInputAttributes, 'class' | 'children' | 'value' | 'type' | 'min' | 'max' | 'step'> & {
136
+ /** The channel the field holds, for example `red`. */
137
+ channel: ColorChannel;
138
+ /** The CSS class names of the field. */
139
+ class?: string;
140
+ /** A bindable reference to the input element. */
141
+ element?: HTMLInputElement | null;
142
+ };
143
+ export type ColorPickerSwatchListProps = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
144
+ /** The content: one `ColorPicker.Swatch` for each color. */
145
+ children?: Snippet;
146
+ /** The CSS class names of the list. */
147
+ class?: string;
148
+ /** A bindable reference to the list element. */
149
+ element?: HTMLDivElement | null;
150
+ };
151
+ export type ColorPickerSwatchProps = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children' | 'aria-label'> & {
152
+ /** The color of the swatch, as text. */
153
+ color: string;
154
+ /** The name of the swatch, for the screen reader. The default is the text of its color. */
155
+ 'aria-label'?: string;
156
+ /** The content. Without it, the swatch is an empty element that your CSS paints. */
157
+ children?: Snippet;
158
+ /** The CSS class names of the swatch. */
159
+ class?: string;
160
+ /** A bindable reference to the swatch element. */
161
+ element?: HTMLDivElement | null;
162
+ };
163
+ export type ColorPickerPreviewProps = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
164
+ /** The content. Without it, the preview is an empty element that your CSS paints. */
165
+ children?: Snippet;
166
+ /** The CSS class names of the preview. */
167
+ class?: string;
168
+ /** A bindable reference to the preview element. */
169
+ element?: HTMLDivElement | null;
170
+ };
171
+ export type ColorPickerEyeDropperProps = Omit<HTMLButtonAttributes, 'class' | 'type'> & {
172
+ /** The CSS class names of the button. */
173
+ class?: string;
174
+ /** A bindable reference to the button element. */
175
+ element?: HTMLButtonElement | null;
176
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { Button } from './button/index.js';
6
6
  export { Checkbox } from './checkbox/index.js';
7
7
  export { CheckboxGroup } from './checkbox-group/index.js';
8
8
  export { Collapsible } from './collapsible/index.js';
9
+ export { ColorPicker } from './color-picker/index.js';
9
10
  export { ComboBox } from './combobox/index.js';
10
11
  export { Calendar } from './calendar/index.js';
11
12
  export { Clock } from './clock/index.js';
@@ -17,9 +18,12 @@ export { Drawer } from './drawer/index.js';
17
18
  export { ListBox } from './listbox/index.js';
18
19
  export { Menu } from './menu/index.js';
19
20
  export { NumberField } from './numberfield/index.js';
21
+ export { PinInput } from './pin-input/index.js';
20
22
  export { Popover } from './popover/index.js';
21
23
  export { Progress } from './progress/index.js';
22
24
  export { RadioGroup } from './radio-group/index.js';
25
+ export { Rating } from './rating/index.js';
26
+ export { SearchField } from './search-field/index.js';
23
27
  export { Select } from './select/index.js';
24
28
  export { Slider } from './slider/index.js';
25
29
  export { Switch } from './switch/index.js';
@@ -49,6 +53,7 @@ export * from './checkbox-group/index.js';
49
53
  export * from './avatar/index.js';
50
54
  export * from './breadcrumbs/index.js';
51
55
  export * from './collapsible/index.js';
56
+ export * from './color-picker/index.js';
52
57
  export * from './combobox/index.js';
53
58
  export * from './calendar/index.js';
54
59
  export * from './clock/index.js';
@@ -61,9 +66,12 @@ export * from './drawer/index.js';
61
66
  export * from './listbox/index.js';
62
67
  export * from './menu/index.js';
63
68
  export * from './numberfield/index.js';
69
+ export * from './pin-input/index.js';
64
70
  export * from './popover/index.js';
65
71
  export * from './progress/index.js';
66
72
  export * from './radio-group/index.js';
73
+ export * from './rating/index.js';
74
+ export * from './search-field/index.js';
67
75
  export * from './select/index.js';
68
76
  export * from './slider/index.js';
69
77
  export * from './switch/index.js';
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export { Button } from './button/index.js';
8
8
  export { Checkbox } from './checkbox/index.js';
9
9
  export { CheckboxGroup } from './checkbox-group/index.js';
10
10
  export { Collapsible } from './collapsible/index.js';
11
+ export { ColorPicker } from './color-picker/index.js';
11
12
  export { ComboBox } from './combobox/index.js';
12
13
  export { Calendar } from './calendar/index.js';
13
14
  export { Clock } from './clock/index.js';
@@ -19,9 +20,12 @@ export { Drawer } from './drawer/index.js';
19
20
  export { ListBox } from './listbox/index.js';
20
21
  export { Menu } from './menu/index.js';
21
22
  export { NumberField } from './numberfield/index.js';
23
+ export { PinInput } from './pin-input/index.js';
22
24
  export { Popover } from './popover/index.js';
23
25
  export { Progress } from './progress/index.js';
24
26
  export { RadioGroup } from './radio-group/index.js';
27
+ export { Rating } from './rating/index.js';
28
+ export { SearchField } from './search-field/index.js';
25
29
  export { Select } from './select/index.js';
26
30
  export { Slider } from './slider/index.js';
27
31
  export { Switch } from './switch/index.js';
@@ -52,6 +56,7 @@ export * from './checkbox-group/index.js';
52
56
  export * from './avatar/index.js';
53
57
  export * from './breadcrumbs/index.js';
54
58
  export * from './collapsible/index.js';
59
+ export * from './color-picker/index.js';
55
60
  export * from './combobox/index.js';
56
61
  export * from './calendar/index.js';
57
62
  export * from './clock/index.js';
@@ -64,9 +69,12 @@ export * from './drawer/index.js';
64
69
  export * from './listbox/index.js';
65
70
  export * from './menu/index.js';
66
71
  export * from './numberfield/index.js';
72
+ export * from './pin-input/index.js';
67
73
  export * from './popover/index.js';
68
74
  export * from './progress/index.js';
69
75
  export * from './radio-group/index.js';
76
+ export * from './rating/index.js';
77
+ export * from './search-field/index.js';
70
78
  export * from './select/index.js';
71
79
  export * from './slider/index.js';
72
80
  export * from './switch/index.js';