@alulore/kumiko 0.0.0-stage → 0.14.2

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 (194) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -2
  3. package/dist/badge/badge.css +287 -0
  4. package/dist/badge/badge.d.ts +40 -0
  5. package/dist/badge/badge.js +51 -0
  6. package/dist/badge/index.d.ts +1 -0
  7. package/dist/badge/index.js +1 -0
  8. package/dist/board/board-api.d.ts +147 -0
  9. package/dist/board/board-api.js +139 -0
  10. package/dist/board/board-card-menu.d.ts +17 -0
  11. package/dist/board/board-card-menu.js +53 -0
  12. package/dist/board/board-drag-events.d.ts +12 -0
  13. package/dist/board/board-drag-events.js +86 -0
  14. package/dist/board/board-fold.d.ts +10 -0
  15. package/dist/board/board-fold.js +30 -0
  16. package/dist/board/board-group.d.ts +10 -0
  17. package/dist/board/board-group.js +28 -0
  18. package/dist/board/board-keys.d.ts +16 -0
  19. package/dist/board/board-keys.js +65 -0
  20. package/dist/board/board-locked-rows.d.ts +23 -0
  21. package/dist/board/board-locked-rows.js +77 -0
  22. package/dist/board/board-motion.d.ts +7 -0
  23. package/dist/board/board-motion.js +102 -0
  24. package/dist/board/board-primitive.d.ts +53 -0
  25. package/dist/board/board-primitive.js +66 -0
  26. package/dist/board/board-pull.d.ts +6 -0
  27. package/dist/board/board-pull.js +94 -0
  28. package/dist/board/board-selection.d.ts +42 -0
  29. package/dist/board/board-selection.js +130 -0
  30. package/dist/board/board-slots.d.ts +1003 -0
  31. package/dist/board/board-slots.js +250 -0
  32. package/dist/board/board-types.d.ts +99 -0
  33. package/dist/board/board-types.js +1 -0
  34. package/dist/board/board.css +343 -0
  35. package/dist/board/board.d.ts +290 -0
  36. package/dist/board/board.js +23 -0
  37. package/dist/board/card-menu.d.ts +21 -0
  38. package/dist/board/card-menu.js +79 -0
  39. package/dist/board/cell-key.d.ts +6 -0
  40. package/dist/board/cell-key.js +16 -0
  41. package/dist/board/index.d.ts +6 -0
  42. package/dist/board/index.js +5 -0
  43. package/dist/board/interactive.d.ts +18 -0
  44. package/dist/board/interactive.js +51 -0
  45. package/dist/board/keep-capture.d.ts +16 -0
  46. package/dist/board/keep-capture.js +57 -0
  47. package/dist/board/landing.d.ts +5 -0
  48. package/dist/board/landing.js +10 -0
  49. package/dist/board/press-to-drop.d.ts +9 -0
  50. package/dist/board/press-to-drop.js +28 -0
  51. package/dist/board/refused-home.d.ts +16 -0
  52. package/dist/board/refused-home.js +50 -0
  53. package/dist/board/repeat-gate.d.ts +4 -0
  54. package/dist/board/repeat-gate.js +12 -0
  55. package/dist/board/scrollbar-gutter.d.ts +1 -0
  56. package/dist/board/scrollbar-gutter.js +27 -0
  57. package/dist/board/touch-hold.d.ts +19 -0
  58. package/dist/board/touch-hold.js +103 -0
  59. package/dist/button/button.css +576 -0
  60. package/dist/button/button.d.ts +50 -0
  61. package/dist/button/button.js +70 -0
  62. package/dist/button/index.d.ts +2 -0
  63. package/dist/button/index.js +1 -0
  64. package/dist/checkbox/checkbox-mark.d.ts +8 -0
  65. package/dist/checkbox/checkbox-mark.js +17 -0
  66. package/dist/checkbox/checkbox-marks.d.ts +33 -0
  67. package/dist/checkbox/checkbox-marks.js +30 -0
  68. package/dist/checkbox/checkbox.css +201 -0
  69. package/dist/checkbox/checkbox.d.ts +26 -0
  70. package/dist/checkbox/checkbox.js +11 -0
  71. package/dist/checkbox/index.d.ts +3 -0
  72. package/dist/checkbox/index.js +3 -0
  73. package/dist/chip/chip.css +251 -0
  74. package/dist/chip/chip.d.ts +39 -0
  75. package/dist/chip/chip.js +25 -0
  76. package/dist/chip/index.d.ts +1 -0
  77. package/dist/chip/index.js +1 -0
  78. package/dist/dialog/dialog.css +247 -0
  79. package/dist/dialog/index.d.ts +3 -0
  80. package/dist/dialog/index.js +3 -0
  81. package/dist/hover-card/hover-card.css +149 -0
  82. package/dist/hover-card/hover-card.d.ts +3 -0
  83. package/dist/hover-card/hover-card.js +8 -0
  84. package/dist/hover-card/index.d.ts +2 -0
  85. package/dist/hover-card/index.js +2 -0
  86. package/dist/input/index.d.ts +5 -0
  87. package/dist/input/index.js +5 -0
  88. package/dist/input/input-attributes.d.ts +12 -0
  89. package/dist/input/input-attributes.js +9 -0
  90. package/dist/input/input.css +752 -0
  91. package/dist/input/input.d.ts +28 -0
  92. package/dist/input/input.js +9 -0
  93. package/dist/input/search-input.d.ts +41 -0
  94. package/dist/input/search-input.js +47 -0
  95. package/dist/kbd/index.d.ts +1 -0
  96. package/dist/kbd/index.js +1 -0
  97. package/dist/kbd/kbd.css +77 -0
  98. package/dist/kbd/kbd.d.ts +21 -0
  99. package/dist/kbd/kbd.js +37 -0
  100. package/dist/label/index.d.ts +1 -0
  101. package/dist/label/index.js +1 -0
  102. package/dist/label/label.css +37 -0
  103. package/dist/label/label.d.ts +13 -0
  104. package/dist/label/label.js +10 -0
  105. package/dist/menu/index.d.ts +3 -0
  106. package/dist/menu/index.js +3 -0
  107. package/dist/menu/menu.css +349 -0
  108. package/dist/menu/menu.d.ts +11 -0
  109. package/dist/menu/menu.js +86 -0
  110. package/dist/menu/point-menu.d.ts +26 -0
  111. package/dist/menu/point-menu.js +51 -0
  112. package/dist/motion/flip-math.d.ts +19 -0
  113. package/dist/motion/flip-math.js +33 -0
  114. package/dist/motion/flip.d.ts +40 -0
  115. package/dist/motion/flip.js +203 -0
  116. package/dist/motion/index.d.ts +2 -0
  117. package/dist/motion/index.js +2 -0
  118. package/dist/motion/motion.css +169 -0
  119. package/dist/popover/index.d.ts +1 -0
  120. package/dist/popover/index.js +1 -0
  121. package/dist/popover/popover.css +208 -0
  122. package/dist/progress/index.d.ts +2 -0
  123. package/dist/progress/index.js +2 -0
  124. package/dist/progress/progress.css +390 -0
  125. package/dist/progress/progress.d.ts +36 -0
  126. package/dist/progress/progress.js +107 -0
  127. package/dist/select/index.d.ts +3 -0
  128. package/dist/select/index.js +2 -0
  129. package/dist/select/select-labels.d.ts +6 -0
  130. package/dist/select/select-labels.js +64 -0
  131. package/dist/select/select-search.d.ts +18 -0
  132. package/dist/select/select-search.js +10 -0
  133. package/dist/select/select.css +470 -0
  134. package/dist/select/select.d.ts +44 -0
  135. package/dist/select/select.js +92 -0
  136. package/dist/separator/index.d.ts +2 -0
  137. package/dist/separator/index.js +1 -0
  138. package/dist/separator/separator.css +32 -0
  139. package/dist/separator/separator.d.ts +17 -0
  140. package/dist/separator/separator.js +10 -0
  141. package/dist/slider/index.d.ts +2 -0
  142. package/dist/slider/index.js +2 -0
  143. package/dist/slider/slider-bubble.css +203 -0
  144. package/dist/slider/slider-feel.d.ts +33 -0
  145. package/dist/slider/slider-feel.js +153 -0
  146. package/dist/slider/slider-format.d.ts +13 -0
  147. package/dist/slider/slider-format.js +15 -0
  148. package/dist/slider/slider-marks.d.ts +16 -0
  149. package/dist/slider/slider-marks.js +32 -0
  150. package/dist/slider/slider.css +335 -0
  151. package/dist/slider/slider.d.ts +34 -0
  152. package/dist/slider/slider.js +94 -0
  153. package/dist/smooth-caret/caret-box.d.ts +7 -0
  154. package/dist/smooth-caret/caret-box.js +8 -0
  155. package/dist/smooth-caret/caret-controller.d.ts +7 -0
  156. package/dist/smooth-caret/caret-controller.js +222 -0
  157. package/dist/smooth-caret/caret-geometry.d.ts +11 -0
  158. package/dist/smooth-caret/caret-geometry.js +230 -0
  159. package/dist/smooth-caret/caret-glide.d.ts +13 -0
  160. package/dist/smooth-caret/caret-glide.js +76 -0
  161. package/dist/smooth-caret/caret-host.d.ts +5 -0
  162. package/dist/smooth-caret/caret-host.js +40 -0
  163. package/dist/smooth-caret/index.d.ts +7 -0
  164. package/dist/smooth-caret/index.js +7 -0
  165. package/dist/smooth-caret/remote-carets.d.ts +40 -0
  166. package/dist/smooth-caret/remote-carets.js +130 -0
  167. package/dist/smooth-caret/smooth-caret.css +157 -0
  168. package/dist/smooth-caret/smooth-caret.d.ts +5 -0
  169. package/dist/smooth-caret/smooth-caret.js +9 -0
  170. package/dist/smooth-caret/use-smooth-caret.d.ts +5 -0
  171. package/dist/smooth-caret/use-smooth-caret.js +9 -0
  172. package/dist/switch/index.d.ts +2 -0
  173. package/dist/switch/index.js +2 -0
  174. package/dist/switch/switch-drag.d.ts +21 -0
  175. package/dist/switch/switch-drag.js +23 -0
  176. package/dist/switch/switch-gesture.d.ts +28 -0
  177. package/dist/switch/switch-gesture.js +131 -0
  178. package/dist/switch/switch.css +189 -0
  179. package/dist/switch/switch.d.ts +15 -0
  180. package/dist/switch/switch.js +24 -0
  181. package/dist/textarea/index.d.ts +2 -0
  182. package/dist/textarea/index.js +2 -0
  183. package/dist/textarea/textarea.css +37 -0
  184. package/dist/textarea/textarea.d.ts +35 -0
  185. package/dist/textarea/textarea.js +11 -0
  186. package/dist/toast/index.d.ts +2 -0
  187. package/dist/toast/index.js +2 -0
  188. package/dist/toast/toast.css +293 -0
  189. package/dist/tooltip/index.d.ts +2 -0
  190. package/dist/tooltip/index.js +2 -0
  191. package/dist/tooltip/tooltip.css +143 -0
  192. package/dist/tooltip/tooltip.d.ts +14 -0
  193. package/dist/tooltip/tooltip.js +13 -0
  194. package/package.json +243 -5
@@ -0,0 +1,2 @@
1
+ export { Button, type ButtonProps, type ButtonSize, type ButtonStatus, type ButtonVariant, type LoadingStyle } from "./button";
2
+ export type { ButtonActionDetails, ButtonApi, ButtonOptions, ButtonPrimitive, ButtonState } from "@ui-sdk/react/button";
@@ -0,0 +1 @@
1
+ export { Button } from "./button";
@@ -0,0 +1,8 @@
1
+ import { type Mark } from "./checkbox-marks";
2
+ type Kind = "tick" | "dash";
3
+ /** One mark of a checkbox, a tick or a dash. CSS draws it in or out as the checkbox's state asks. */
4
+ export declare function CheckboxMark({ mark, kind }: {
5
+ mark: Mark;
6
+ kind: Kind;
7
+ }): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,17 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { boxOf, isMarkPath } from "./checkbox-marks";
4
+ /** A shape revealed through a mask of its stroke, so a brushed mark is drawn in along its centre-line. */
5
+ function Brushed({ mark, viewBox }) {
6
+ const maskId = useId();
7
+ const box = boxOf(viewBox);
8
+ return (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsx("mask", { id: maskId, maskUnits: "userSpaceOnUse", x: box.x, y: box.y, width: box.width, height: box.height, style: { maskType: "alpha" }, children: _jsx("path", { "data-draw": "", d: mark.stroke, pathLength: 1, stroke: "currentColor", fill: "none" }) }) }), _jsx("path", { "data-shape": "", d: mark.shape, mask: `url(#${maskId})` })] }));
9
+ }
10
+ /** One mark of a checkbox, a tick or a dash. CSS draws it in or out as the checkbox's state asks. */
11
+ export function CheckboxMark({ mark, kind }) {
12
+ if (!isMarkPath(mark)) {
13
+ return (_jsx("span", { "data-slot": "checkbox-mark", "data-kind": kind, "data-mark": "node", children: mark }));
14
+ }
15
+ const viewBox = mark.viewBox ?? "0 0 24 24";
16
+ return (_jsx("svg", { "data-slot": "checkbox-mark", "data-kind": kind, "data-mark": mark.shape ? "brush" : "line", viewBox: viewBox, "aria-hidden": "true", children: mark.shape === undefined ? (_jsx("path", { "data-draw": "", d: mark.stroke, pathLength: 1, fill: "none" })) : (_jsx(Brushed, { mark: { ...mark, shape: mark.shape }, viewBox: viewBox })) }));
17
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A mark drawn as a path. `stroke` is the centre-line, drawn in with a dash reveal. With a `shape` the stroke
3
+ * is instead the mask that reveals that filled path, which gives a brushed look.
4
+ */
5
+ export interface MarkPath {
6
+ /** The centre-line of the mark, an SVG path. */
7
+ stroke: string;
8
+ /** A filled path revealed through a mask of `stroke`. Without it the stroke itself is drawn. */
9
+ shape?: string;
10
+ /**
11
+ * The coordinate box the paths are drawn in.
12
+ * @defaultValue "0 0 24 24"
13
+ */
14
+ viewBox?: string;
15
+ }
16
+ /** What a checkbox shows for a tick or a dash: a path that draws in, or any node, which fades in. */
17
+ export type Mark = MarkPath | React.ReactNode;
18
+ /** A plain tick, drawn as one clean line. */
19
+ export declare const cleanTick: MarkPath;
20
+ /** Alulore's brushed tick: a tapered brush shape, drawn in along its centre-line. */
21
+ export declare const brushTick: MarkPath;
22
+ /** A plain dash, drawn as one clean line. */
23
+ export declare const cleanDash: MarkPath;
24
+ /** A brushed dash in the spirit of the brushed tick: a stroke that swells in the middle and tapers at the ends. */
25
+ export declare const brushDash: MarkPath;
26
+ export declare function isMarkPath(mark: Mark): mark is MarkPath;
27
+ /** The width and height of a viewBox, for the mask that covers it. */
28
+ export declare function boxOf(viewBox: string): {
29
+ x: number;
30
+ y: number;
31
+ width: number;
32
+ height: number;
33
+ };
@@ -0,0 +1,30 @@
1
+ /** A plain tick, drawn as one clean line. */
2
+ export const cleanTick = { stroke: "M5.2 12.6 10 17.2 18.8 6.8" };
3
+ /** Alulore's brushed tick: a tapered brush shape, drawn in along its centre-line. */
4
+ export const brushTick = {
5
+ stroke: "M5.6 12.8 10.4 17.2 19.8 5.6",
6
+ shape: "M4.8 12.8C6.2 11.6 8.5 12.9 10.6 15.1C13.8 10.7 17 7.5 20.7 4.3C18 9.4 14.7 14.5 10.8 19.5C9 16.7 6.7 14.2 4.8 12.8Z"
7
+ };
8
+ /** A plain dash, drawn as one clean line. */
9
+ export const cleanDash = { stroke: "M6 12H18" };
10
+ /** A brushed dash in the spirit of the brushed tick: a stroke that swells in the middle and tapers at the ends. */
11
+ export const brushDash = {
12
+ stroke: "M5.2 12.6 19.2 11.4",
13
+ shape: "M4.6 13C6.9 11.5 11 11.7 15 11C17 10.7 18.9 10.3 20 10.9C19.9 12.1 17.4 12.8 14.8 13.3C11.3 14 8 13.6 5.6 14.2C4.8 14.2 4.4 13.5 4.6 13Z"
14
+ };
15
+ export function isMarkPath(mark) {
16
+ return (typeof mark === "object" &&
17
+ mark !== null &&
18
+ !Array.isArray(mark) &&
19
+ !("$$typeof" in mark) &&
20
+ "stroke" in mark &&
21
+ typeof mark.stroke === "string");
22
+ }
23
+ /** The width and height of a viewBox, for the mask that covers it. */
24
+ export function boxOf(viewBox) {
25
+ const [x = 0, y = 0, width = 24, height = 24] = viewBox
26
+ .trim()
27
+ .split(/[\s,]+/u)
28
+ .map(Number);
29
+ return { x, y, width, height };
30
+ }
@@ -0,0 +1,201 @@
1
+ @import "../motion/motion.css";
2
+
3
+ @layer kumiko {
4
+ :where(:root) {
5
+ --kumiko-touch-target: 2.75rem;
6
+ --kumiko-checkbox-size: 1.25rem;
7
+ --kumiko-checkbox-size-sm: 1.125rem;
8
+ --kumiko-checkbox-radius: 30%;
9
+ --kumiko-checkbox-border-width: 1.5px;
10
+ --kumiko-checkbox-bg: Canvas;
11
+ --kumiko-checkbox-border: color-mix(in oklab, CanvasText 45%, transparent);
12
+ --kumiko-checkbox-checked-bg: Highlight;
13
+ --kumiko-checkbox-checked-fg: HighlightText;
14
+ --kumiko-checkbox-mark-size: 70%;
15
+ --kumiko-checkbox-line-width: 2.6;
16
+ --kumiko-checkbox-brush-width: 5.6;
17
+ --kumiko-checkbox-focus-ring: Highlight;
18
+ --kumiko-checkbox-disabled-opacity: 0.5;
19
+ }
20
+
21
+ [data-slot="checkbox"] {
22
+ --_size: var(--kumiko-checkbox-size);
23
+
24
+ position: relative;
25
+ display: inline-grid;
26
+ box-sizing: border-box;
27
+ inline-size: var(--_size);
28
+ block-size: var(--_size);
29
+ flex: none;
30
+ place-items: center;
31
+ padding: 0;
32
+ border: var(--kumiko-checkbox-border-width) solid var(--kumiko-checkbox-border);
33
+ border-radius: var(--kumiko-checkbox-radius);
34
+ background: var(--kumiko-checkbox-bg);
35
+ color: var(--kumiko-checkbox-checked-fg);
36
+ font: inherit;
37
+ cursor: var(--kumiko-press-cursor, pointer);
38
+ transition:
39
+ background-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
40
+ border-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
41
+ rotate var(--kumiko-lift-duration) var(--kumiko-lift-ease),
42
+ scale var(--kumiko-lift-duration) var(--kumiko-lift-ease);
43
+ }
44
+
45
+ [data-slot="checkbox"][data-size="sm"] {
46
+ --_size: var(--kumiko-checkbox-size-sm);
47
+ }
48
+
49
+ [data-slot="checkbox"]:is([data-checked], [data-indeterminate]) {
50
+ border-color: var(--kumiko-checkbox-checked-border, var(--kumiko-checkbox-checked-bg));
51
+ background: var(--kumiko-checkbox-checked-bg);
52
+ }
53
+
54
+ [data-slot="checkbox"]:focus-visible {
55
+ outline: 2px solid var(--kumiko-checkbox-focus-ring);
56
+ outline-offset: 2px;
57
+ }
58
+
59
+ [data-slot="checkbox"][data-disabled] {
60
+ opacity: var(--kumiko-checkbox-disabled-opacity);
61
+ cursor: not-allowed;
62
+ }
63
+
64
+ /* Read-only is a status, not a control: no fill, just an outline, and the state is told by colour alone. It is not dimmed, so it never looks like disabled. */
65
+ [data-slot="checkbox"][data-readonly] {
66
+ border-color: var(--kumiko-checkbox-readonly-border, var(--kumiko-checkbox-border));
67
+ background: var(--kumiko-checkbox-readonly-bg, transparent);
68
+ cursor: default;
69
+ }
70
+
71
+ [data-slot="checkbox"][data-readonly][data-disabled] {
72
+ cursor: not-allowed;
73
+ }
74
+
75
+ [data-slot="checkbox"][data-readonly]:is([data-checked], [data-indeterminate]) {
76
+ border-color: var(
77
+ --kumiko-checkbox-readonly-checked-border,
78
+ var(--kumiko-checkbox-checked-bg)
79
+ );
80
+ color: var(--kumiko-checkbox-readonly-checked-fg, var(--kumiko-checkbox-checked-bg));
81
+ }
82
+
83
+ [data-slot="checkbox"]:not([data-disabled], [data-readonly]):active {
84
+ rotate: 0deg;
85
+ scale: var(--kumiko-press-scale);
86
+ transition-duration:
87
+ var(--kumiko-fade-duration), var(--kumiko-fade-duration), var(--kumiko-press-duration),
88
+ var(--kumiko-press-duration);
89
+ transition-timing-function:
90
+ var(--kumiko-fade-ease), var(--kumiko-fade-ease), var(--kumiko-press-ease),
91
+ var(--kumiko-press-ease);
92
+ }
93
+
94
+ @media (hover: hover) and (pointer: fine) {
95
+ [data-slot="checkbox"]:not([data-disabled], [data-readonly]):hover:not(:active) {
96
+ rotate: var(--kumiko-hover-tilt);
97
+ scale: var(--kumiko-hover-scale);
98
+ }
99
+ }
100
+
101
+ /* On a finger, an invisible area around the box reaches the touch target, and the box itself does not grow. */
102
+ @media (pointer: coarse) {
103
+ [data-slot="checkbox"]::after {
104
+ content: "";
105
+ position: absolute;
106
+ inset-block-start: 50%;
107
+ inset-inline-start: 50%;
108
+ inline-size: max(100%, var(--kumiko-touch-target));
109
+ block-size: max(100%, var(--kumiko-touch-target));
110
+ translate: -50% -50%;
111
+ }
112
+
113
+ [data-slot="checkbox"]:dir(rtl)::after {
114
+ translate: 50% -50%;
115
+ }
116
+ }
117
+
118
+ /* Forced colours replace colours that are not system colours, so the checked state keeps to the system palette. */
119
+ @media (forced-colors: active) {
120
+ [data-slot="checkbox"] {
121
+ border-color: ButtonText;
122
+ background: Canvas;
123
+ }
124
+
125
+ [data-slot="checkbox"]:is([data-checked], [data-indeterminate]) {
126
+ border-color: Highlight;
127
+ background: Highlight;
128
+ color: HighlightText;
129
+ }
130
+
131
+ [data-slot="checkbox"][data-readonly] {
132
+ border-color: ButtonText;
133
+ background: Canvas;
134
+ }
135
+
136
+ [data-slot="checkbox"][data-readonly]:is([data-checked], [data-indeterminate]) {
137
+ border-color: Highlight;
138
+ background: Canvas;
139
+ color: Highlight;
140
+ }
141
+ }
142
+
143
+ [data-slot="checkbox-indicator"] {
144
+ display: grid;
145
+ inline-size: var(--kumiko-checkbox-mark-size);
146
+ block-size: var(--kumiko-checkbox-mark-size);
147
+ place-items: center;
148
+ pointer-events: none;
149
+ }
150
+
151
+ [data-slot="checkbox-mark"] {
152
+ grid-area: 1 / 1;
153
+ inline-size: 100%;
154
+ block-size: 100%;
155
+ overflow: visible;
156
+ }
157
+
158
+ /* A node mark fades; a path mark draws in along its stroke. */
159
+ [data-slot="checkbox-mark"][data-mark="node"] {
160
+ display: grid;
161
+ place-items: center;
162
+ opacity: 0;
163
+ transition: opacity var(--kumiko-fade-duration) var(--kumiko-exit-ease);
164
+ }
165
+
166
+ [data-slot="checkbox-indicator"][data-checked] [data-kind="tick"][data-mark="node"],
167
+ [data-slot="checkbox-indicator"][data-indeterminate] [data-kind="dash"][data-mark="node"] {
168
+ opacity: 1;
169
+ transition-timing-function: var(--kumiko-enter-ease);
170
+ }
171
+
172
+ [data-slot="checkbox-mark"] [data-shape] {
173
+ fill: currentColor;
174
+ }
175
+
176
+ [data-slot="checkbox-mark"] [data-draw] {
177
+ stroke: currentColor;
178
+ stroke-linecap: round;
179
+ stroke-linejoin: round;
180
+ stroke-dasharray: 1;
181
+ stroke-dashoffset: 1;
182
+ transition: stroke-dashoffset calc(var(--kumiko-move-duration) * 0.75)
183
+ var(--kumiko-exit-ease);
184
+ }
185
+
186
+ [data-slot="checkbox-mark"][data-mark="line"] [data-draw] {
187
+ stroke-width: var(--kumiko-checkbox-line-width);
188
+ }
189
+
190
+ [data-slot="checkbox-mark"][data-mark="brush"] [data-draw] {
191
+ stroke-width: var(--kumiko-checkbox-brush-width);
192
+ }
193
+
194
+ [data-slot="checkbox-indicator"][data-checked] [data-kind="tick"] [data-draw],
195
+ [data-slot="checkbox-indicator"][data-indeterminate] [data-kind="dash"] [data-draw] {
196
+ stroke-dashoffset: 0;
197
+ transition-duration: var(--kumiko-move-duration);
198
+ transition-timing-function: var(--kumiko-enter-ease);
199
+ transition-delay: calc(var(--kumiko-move-duration) * 0.2);
200
+ }
201
+ }
@@ -0,0 +1,26 @@
1
+ import { Checkbox as SdkCheckbox } from "@ui-sdk/react/checkbox";
2
+ import { type Mark } from "./checkbox-marks";
3
+ type SdkCheckboxProps = Parameters<typeof SdkCheckbox>[0];
4
+ export type CheckboxProps = Omit<SdkCheckboxProps, "children"> & {
5
+ /**
6
+ * The size of the box.
7
+ * @defaultValue "md"
8
+ */
9
+ size?: "sm" | "md";
10
+ /**
11
+ * The mark shown while checked: a path that draws in, or any node that fades in.
12
+ * @defaultValue cleanTick
13
+ */
14
+ tick?: Mark;
15
+ /**
16
+ * The mark shown while indeterminate: a path that draws in, or any node that fades in.
17
+ * @defaultValue cleanDash
18
+ */
19
+ dash?: Mark;
20
+ };
21
+ /**
22
+ * The ui-sdk checkbox with Kumiko's look and motion. Both marks stay in the page, so unchecking draws the mark
23
+ * out. Give it a label with a wrapping `<label>` or an `aria-label`.
24
+ */
25
+ export declare function Checkbox({ size, tick, dash, ...props }: CheckboxProps): React.JSX.Element;
26
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Checkbox as SdkCheckbox, CheckboxIndicator } from "@ui-sdk/react/checkbox";
3
+ import { CheckboxMark } from "./checkbox-mark";
4
+ import { cleanDash, cleanTick } from "./checkbox-marks";
5
+ /**
6
+ * The ui-sdk checkbox with Kumiko's look and motion. Both marks stay in the page, so unchecking draws the mark
7
+ * out. Give it a label with a wrapping `<label>` or an `aria-label`.
8
+ */
9
+ export function Checkbox({ size = "md", tick = cleanTick, dash = cleanDash, ...props }) {
10
+ return (_jsx(SdkCheckbox, { "data-size": size, ...props, children: _jsxs(CheckboxIndicator, { keepMounted: true, children: [_jsx(CheckboxMark, { mark: tick, kind: "tick" }), _jsx(CheckboxMark, { mark: dash, kind: "dash" })] }) }));
11
+ }
@@ -0,0 +1,3 @@
1
+ export { Checkbox, type CheckboxProps } from "./checkbox";
2
+ export { brushDash, brushTick, cleanDash, cleanTick, type Mark, type MarkPath } from "./checkbox-marks";
3
+ export { CheckboxGroup, CheckboxIndicator, createCheckboxController, createCheckboxGroupController, type CheckboxApi, type CheckboxChangeOptions, type CheckboxCheckedChangeReason, type CheckboxController, type CheckboxGroupApi, type CheckboxGroupChangeOptions, type CheckboxGroupController, type CheckboxGroupOptions, type CheckboxGroupPrimitive, type CheckboxGroupState, type CheckboxGroupValueChangeReason, type CheckboxIndicatorProps, type CheckboxIndicatorState, type CheckboxOptions, type CheckboxPrimitive, type CheckboxState, type CheckedState } from "@ui-sdk/react/checkbox";
@@ -0,0 +1,3 @@
1
+ export { Checkbox } from "./checkbox";
2
+ export { brushDash, brushTick, cleanDash, cleanTick } from "./checkbox-marks";
3
+ export { CheckboxGroup, CheckboxIndicator, createCheckboxController, createCheckboxGroupController } from "@ui-sdk/react/checkbox";
@@ -0,0 +1,251 @@
1
+ @import "../motion/motion.css";
2
+
3
+ @layer kumiko {
4
+ :where(:root) {
5
+ --kumiko-touch-target: 2.75rem;
6
+ --kumiko-chip-height-sm: 1.5rem;
7
+ --kumiko-chip-height: 1.875rem;
8
+ --kumiko-chip-font-size-sm: 0.75rem;
9
+ --kumiko-chip-font-size: 0.875rem;
10
+ --kumiko-chip-font-weight: 500;
11
+ --kumiko-chip-gap: 0.4em;
12
+ --kumiko-chip-padding: 0.85em;
13
+ --kumiko-chip-icon-size: 1.1em;
14
+ --kumiko-chip-border-width: 1px;
15
+ --kumiko-chip-bg: Canvas;
16
+ --kumiko-chip-fg: CanvasText;
17
+ --kumiko-chip-border: color-mix(in oklab, CanvasText 30%, transparent);
18
+ --kumiko-chip-pressed-color: Highlight;
19
+ --kumiko-chip-pressed-bg: Highlight;
20
+ --kumiko-chip-pressed-fg: HighlightText;
21
+ --kumiko-chip-tint: 18%;
22
+ --kumiko-chip-tint-fg: color-mix(in oklab, Highlight 70%, CanvasText);
23
+ --kumiko-chip-outline-width: 2px;
24
+ --kumiko-chip-focus-ring: Highlight;
25
+ --kumiko-chip-disabled-opacity: 0.5;
26
+ }
27
+
28
+ [data-chip] {
29
+ --_h: var(--kumiko-chip-height);
30
+ --_fs: var(--kumiko-chip-font-size);
31
+ --_dir: 1;
32
+
33
+ position: relative;
34
+ display: inline-flex;
35
+ box-sizing: border-box;
36
+ flex: none;
37
+ gap: var(--kumiko-chip-gap);
38
+ align-items: center;
39
+ justify-content: center;
40
+ max-inline-size: 100%;
41
+ block-size: var(--_h);
42
+ padding: 0 var(--kumiko-chip-padding);
43
+ border: var(--kumiko-chip-border-width) solid var(--kumiko-chip-border);
44
+ border-radius: 999px;
45
+ background: var(--kumiko-chip-bg);
46
+ color: var(--kumiko-chip-fg);
47
+ font: inherit;
48
+ font-size: var(--_fs);
49
+ font-weight: var(--kumiko-chip-font-weight);
50
+ line-height: 1;
51
+ white-space: nowrap;
52
+ cursor: default;
53
+ transition:
54
+ background-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
55
+ border-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
56
+ color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
57
+ scale var(--kumiko-lift-duration) var(--kumiko-lift-ease);
58
+ }
59
+
60
+ [data-chip]:dir(rtl) {
61
+ --_dir: -1;
62
+ }
63
+
64
+ [data-chip][data-size="sm"] {
65
+ --_h: var(--kumiko-chip-height-sm);
66
+ --_fs: var(--kumiko-chip-font-size-sm);
67
+ }
68
+
69
+ [data-slot="chip-label"] {
70
+ overflow: hidden;
71
+ text-overflow: ellipsis;
72
+ }
73
+
74
+ [data-slot="chip-icon"] {
75
+ display: inline-grid;
76
+ flex: none;
77
+ place-items: center;
78
+ inline-size: var(--kumiko-chip-icon-size);
79
+ block-size: var(--kumiko-chip-icon-size);
80
+ }
81
+
82
+ [data-slot="chip-icon"] > svg {
83
+ inline-size: 100%;
84
+ block-size: 100%;
85
+ }
86
+
87
+ /* The tick takes no room until the tint look asks for it. */
88
+ [data-slot="chip-tick"] {
89
+ display: none;
90
+ }
91
+
92
+ [data-slot="chip-tick"] > svg {
93
+ display: block;
94
+ inline-size: 1em;
95
+ block-size: 1em;
96
+ }
97
+
98
+ /* Toggles and actions are controls: a pointer, hover, press and a focus ring. */
99
+ [data-chip]:is([data-kind="toggle"], [data-kind="action"]) {
100
+ cursor: var(--kumiko-press-cursor, pointer);
101
+ user-select: none;
102
+ }
103
+
104
+ [data-chip]:is([data-kind="toggle"], [data-kind="action"]):focus-visible {
105
+ outline: 2px solid var(--kumiko-chip-focus-ring);
106
+ outline-offset: 2px;
107
+ }
108
+
109
+ [data-chip]:is([data-kind="toggle"], [data-kind="action"]):is([data-disabled], :disabled) {
110
+ opacity: var(--kumiko-chip-disabled-opacity);
111
+ cursor: not-allowed;
112
+ }
113
+
114
+ /* Pressing squashes the chip: wider and flatter. */
115
+ [data-chip]:is([data-kind="toggle"], [data-kind="action"]):not(
116
+ [data-disabled],
117
+ :disabled
118
+ ):active {
119
+ scale: calc(var(--kumiko-press-scale) * var(--kumiko-squash-x))
120
+ calc(var(--kumiko-press-scale) * var(--kumiko-squash-y));
121
+ transition-duration:
122
+ var(--kumiko-fade-duration), var(--kumiko-fade-duration), var(--kumiko-fade-duration),
123
+ var(--kumiko-press-duration);
124
+ transition-timing-function:
125
+ var(--kumiko-fade-ease), var(--kumiko-fade-ease), var(--kumiko-fade-ease),
126
+ var(--kumiko-press-ease);
127
+ }
128
+
129
+ @media (hover: hover) and (pointer: fine) {
130
+ [data-chip]:is([data-kind="toggle"], [data-kind="action"]):not(
131
+ [data-disabled],
132
+ :disabled
133
+ ):hover:not(:active) {
134
+ scale: var(--kumiko-hover-scale);
135
+ }
136
+ }
137
+
138
+ /* On a finger, an invisible area around the chip reaches the touch target. */
139
+ @media (pointer: coarse) {
140
+ [data-chip]:is([data-kind="toggle"], [data-kind="action"])::after {
141
+ content: "";
142
+ position: absolute;
143
+ inset-block-start: 50%;
144
+ inset-inline-start: 50%;
145
+ inline-size: max(100%, var(--kumiko-touch-target));
146
+ block-size: max(100%, var(--kumiko-touch-target));
147
+ translate: calc(-50% * var(--_dir)) -50%;
148
+ }
149
+ }
150
+
151
+ /* The pressed look. Outline is the default: an accent outline and accent text, with no fill. */
152
+ [data-chip][data-kind="toggle"][data-pressed] {
153
+ border-color: var(--kumiko-chip-pressed-color);
154
+ box-shadow: inset 0 0 0
155
+ calc(var(--kumiko-chip-outline-width) - var(--kumiko-chip-border-width))
156
+ var(--kumiko-chip-pressed-color);
157
+ color: var(--kumiko-chip-pressed-color);
158
+ }
159
+
160
+ /* Fill: the accent colour fills the chip. A prop on the chip wins; without one, a word on the chip or any container picks. */
161
+ [data-chip][data-kind="toggle"][data-pressed]:is(
162
+ [data-pressed-look="fill"],
163
+ :not([data-pressed-look]):is(
164
+ [data-kumiko-chip~="pressed-fill"],
165
+ [data-kumiko-chip~="pressed-fill"] *
166
+ )
167
+ ) {
168
+ border-color: var(--kumiko-chip-pressed-bg);
169
+ background: var(--kumiko-chip-pressed-bg);
170
+ box-shadow: none;
171
+ color: var(--kumiko-chip-pressed-fg);
172
+ }
173
+
174
+ /* Tint: a soft accent tint, and a tick slides in before the label. */
175
+ [data-chip][data-kind="toggle"][data-pressed]:is(
176
+ [data-pressed-look="tint"],
177
+ :not([data-pressed-look]):is(
178
+ [data-kumiko-chip~="pressed-tint"],
179
+ [data-kumiko-chip~="pressed-tint"] *
180
+ )
181
+ ) {
182
+ background: color-mix(
183
+ in oklab,
184
+ var(--kumiko-chip-pressed-color) var(--kumiko-chip-tint),
185
+ var(--kumiko-chip-bg)
186
+ );
187
+ box-shadow: none;
188
+ color: var(--kumiko-chip-tint-fg);
189
+ }
190
+
191
+ [data-chip][data-kind="toggle"]:is(
192
+ [data-pressed-look="tint"],
193
+ :not([data-pressed-look]):is(
194
+ [data-kumiko-chip~="pressed-tint"],
195
+ [data-kumiko-chip~="pressed-tint"] *
196
+ )
197
+ )
198
+ [data-slot="chip-tick"] {
199
+ display: inline-grid;
200
+ inline-size: 0;
201
+ margin-inline-end: calc(var(--kumiko-chip-gap) * -1);
202
+ overflow: hidden;
203
+ opacity: 0;
204
+ translate: calc(-0.5em * var(--_dir)) 0;
205
+ transition:
206
+ inline-size var(--kumiko-move-duration) var(--kumiko-move-ease),
207
+ margin-inline-end var(--kumiko-move-duration) var(--kumiko-move-ease),
208
+ opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease),
209
+ translate var(--kumiko-move-duration) var(--kumiko-move-ease);
210
+ }
211
+
212
+ [data-chip][data-kind="toggle"][data-pressed]:is(
213
+ [data-pressed-look="tint"],
214
+ :not([data-pressed-look]):is(
215
+ [data-kumiko-chip~="pressed-tint"],
216
+ [data-kumiko-chip~="pressed-tint"] *
217
+ )
218
+ )
219
+ [data-slot="chip-tick"] {
220
+ inline-size: 1em;
221
+ margin-inline-end: 0;
222
+ opacity: 1;
223
+ translate: 0 0;
224
+ }
225
+
226
+ /* Forced colours keep the edge, and pressed uses the selection colour. */
227
+ @media (forced-colors: active) {
228
+ [data-chip] {
229
+ border-color: ButtonText;
230
+ background: Canvas;
231
+ color: CanvasText;
232
+ }
233
+
234
+ [data-chip][data-kind="toggle"][data-pressed] {
235
+ border-color: Highlight;
236
+ color: Highlight;
237
+ box-shadow: inset 0 0 0 1px Highlight;
238
+ }
239
+
240
+ [data-chip][data-kind="toggle"][data-pressed]:is(
241
+ [data-pressed-look="fill"],
242
+ :not([data-pressed-look]):is(
243
+ [data-kumiko-chip~="pressed-fill"],
244
+ [data-kumiko-chip~="pressed-fill"] *
245
+ )
246
+ ) {
247
+ background: Highlight;
248
+ color: HighlightText;
249
+ }
250
+ }
251
+ }
@@ -0,0 +1,39 @@
1
+ import { Toggle } from "@ui-sdk/react/toggle";
2
+ type SdkToggleProps = Parameters<typeof Toggle>[0];
3
+ /** How a pressed toggle looks. */
4
+ export type PressedLook = "outline" | "fill" | "tint";
5
+ /** How big a chip is. */
6
+ export type ChipSize = "sm" | "md";
7
+ interface ChipLook {
8
+ /** A small icon before the label. It is hidden from screen readers. */
9
+ icon?: React.ReactNode;
10
+ /** @defaultValue "md" */
11
+ size?: ChipSize;
12
+ children?: React.ReactNode;
13
+ }
14
+ /** A label that only informs. It has no hover, press or pointer cursor. */
15
+ export type InfoChipProps = ChipLook & Omit<React.ComponentPropsWithoutRef<"span">, "children"> & {
16
+ kind?: "info";
17
+ };
18
+ /** A chip that stays pressed, built on the ui-sdk toggle, so it reports `aria-pressed`. */
19
+ export type ToggleChipProps = ChipLook & Omit<SdkToggleProps, "children"> & {
20
+ kind: "toggle";
21
+ /**
22
+ * How a pressed toggle looks: an accent outline and text, a fill, or a soft tint with a tick that slides in.
23
+ * The prop is `pressedLook` because `pressed` is ui-sdk's controlled state.
24
+ * Without it, `data-kumiko-chip="pressed-fill"` or `"pressed-tint"` on any container picks, and the default is an outline.
25
+ * @defaultValue "outline"
26
+ */
27
+ pressedLook?: PressedLook;
28
+ };
29
+ /** A plain button that runs one action. */
30
+ export type ActionChipProps = ChipLook & Omit<React.ComponentPropsWithoutRef<"button">, "children"> & {
31
+ kind: "action";
32
+ };
33
+ export type ChipProps = InfoChipProps | ToggleChipProps | ActionChipProps;
34
+ /**
35
+ * A pill label in three kinds. `info` is static, `toggle` stays pressed and `action` is a button.
36
+ * A pressed toggle shows an accent outline and accent text, or a fill or a tint with `pressedLook`.
37
+ */
38
+ export declare function Chip(props: ChipProps): React.JSX.Element;
39
+ export {};
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Toggle } from "@ui-sdk/react/toggle";
3
+ /** The tick of the tint look. It takes no room in the other looks. */
4
+ function Tick() {
5
+ return (_jsx("span", { "data-slot": "chip-tick", "aria-hidden": "true", children: _jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: _jsx("path", { d: "M3 8.5 6.5 12 13 4.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }));
6
+ }
7
+ function Icon({ icon }) {
8
+ return icon ? (_jsx("span", { "data-slot": "chip-icon", "aria-hidden": "true", children: icon })) : null;
9
+ }
10
+ /**
11
+ * A pill label in three kinds. `info` is static, `toggle` stays pressed and `action` is a button.
12
+ * A pressed toggle shows an accent outline and accent text, or a fill or a tint with `pressedLook`.
13
+ */
14
+ export function Chip(props) {
15
+ if (props.kind === "toggle") {
16
+ const { kind, icon, size = "md", pressedLook, children, ...rest } = props;
17
+ return (_jsxs(Toggle, { "data-chip": "", "data-kind": kind, "data-size": size, "data-pressed-look": pressedLook, ...rest, children: [_jsx(Icon, { icon: icon }), _jsx(Tick, {}), _jsx("span", { "data-slot": "chip-label", children: children })] }));
18
+ }
19
+ if (props.kind === "action") {
20
+ const { kind, icon, size = "md", children, ...rest } = props;
21
+ return (_jsxs("button", { type: "button", "data-chip": "", "data-kind": kind, "data-size": size, "data-disabled": rest.disabled ? "" : undefined, ...rest, children: [_jsx(Icon, { icon: icon }), _jsx("span", { "data-slot": "chip-label", children: children })] }));
22
+ }
23
+ const { kind = "info", icon, size = "md", children, ...rest } = props;
24
+ return (_jsxs("span", { "data-chip": "", "data-kind": kind, "data-size": size, ...rest, children: [_jsx(Icon, { icon: icon }), _jsx("span", { "data-slot": "chip-label", children: children })] }));
25
+ }
@@ -0,0 +1 @@
1
+ export { Chip, type ActionChipProps, type ChipProps, type ChipSize, type PressedLook, type InfoChipProps, type ToggleChipProps } from "./chip";
@@ -0,0 +1 @@
1
+ export { Chip } from "./chip";