@gecko-ui-kit/react 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/basics.js CHANGED
@@ -23,13 +23,13 @@ export const Spinner = forwardRef(function Spinner({ size, tone = 'accent', spee
23
23
  const t = SPIN_TONES.includes(tone) ? tone : 'accent';
24
24
  const st = { ...style };
25
25
  if (has(size)) st.fontSize = typeof size === 'number' ? size + 'px' : size;
26
- if (+speed && +speed !== 1) st['--orb-speed'] = +speed + 's';
27
- const text = has(label) ? h('span', { className: 'orb__label' }, label)
28
- : decorative ? null : h('span', { className: 'orb__sr' }, words?.loading ?? 'Loading…');
26
+ if (+speed && +speed !== 1) st['--gk-orb-speed'] = +speed + 's';
27
+ const text = has(label) ? h('span', { className: 'gk-orb__label' }, label)
28
+ : decorative ? null : h('span', { className: 'gk-orb__sr' }, words?.loading ?? 'Loading…');
29
29
  return h('span', {
30
30
  ref, ...(decorative ? { 'aria-hidden': true } : { role: 'status' }), ...rest, style: st,
31
- className: cx('orb', 'orb--' + t, track === false && 'orb--bare', stack && has(label) && 'orb--stack', still && 'orb--still', className),
32
- }, h('span', { className: 'orb__dial', 'aria-hidden': true }, h('span', { className: 'orb__spin' })), text);
31
+ className: cx('gk-orb', 'gk-orb--' + t, track === false && 'gk-orb--bare', stack && has(label) && 'gk-orb--stack', still && 'gk-orb--still', className),
32
+ }, h('span', { className: 'gk-orb__dial', 'aria-hidden': true }, h('span', { className: 'gk-orb__spin' })), text);
33
33
  });
34
34
 
35
35
  /* ---------------- buttons ---------------- */
@@ -45,7 +45,7 @@ export const Button = forwardRef(function Button({ variant, size, icon, iconRigh
45
45
  const spin = busy ? h(Spinner, { size: '1.15em', tone: 'current', decorative: true }) : null;
46
46
  return h('button', {
47
47
  ref: setRef, type, ...rest, disabled: disabled || busy || undefined, 'aria-busy': busy || undefined,
48
- className: cx('btn', variant && 'btn--' + variant, size && 'btn--' + size, block && 'btn--block', magnetic && 'magnetic', className),
48
+ className: cx('gk-btn', variant && 'gk-btn--' + variant, size && 'gk-btn--' + size, block && 'gk-btn--block', magnetic && 'gk-magnetic', className),
49
49
  }, busy ? (icon || !iconRight ? spin : null) : iconNode(icon),
50
50
  label != null && label !== false ? h('span', null, label) : null,
51
51
  busy && !icon && iconRight ? spin : iconNode(iconRight));
@@ -62,7 +62,7 @@ export const IconButton = forwardRef(function IconButton({ icon, label, size, pr
62
62
  const on = pressed !== undefined ? !!pressed : inner;
63
63
  return h('button', {
64
64
  ref, type, 'aria-label': label, ...(toggle ? { 'aria-pressed': on } : null), ...rest,
65
- className: cx('iconbtn', size && 'iconbtn--' + size, className),
65
+ className: cx('gk-iconbtn', size && 'gk-iconbtn--' + size, className),
66
66
  onClick: (e) => {
67
67
  onClick?.(e);
68
68
  if (!toggle || e.defaultPrevented) return;
@@ -75,12 +75,12 @@ export const IconButton = forwardRef(function IconButton({ icon, label, size, pr
75
75
  /* ---------------- labels ---------------- */
76
76
  /** <Tag tone="good">Paid</Tag> — same as tag('Paid', 'good', dot). tone: good | warn | bad | accent | plain */
77
77
  export const Tag = forwardRef(function Tag({ tone = 'plain', dot = true, icon, className, children, ...rest }, ref) {
78
- return h('span', { ref, ...rest, className: cx('tag', 'tag--' + (tone || 'plain'), className) }, dot && !icon ? h('i') : null, iconNode(icon), children);
78
+ return h('span', { ref, ...rest, className: cx('gk-tag', 'gk-tag--' + (tone || 'plain'), className) }, dot && !icon ? h('i') : null, iconNode(icon), children);
79
79
  });
80
80
 
81
81
  /** <Badge tone="accent">3</Badge> — same as badge(3, 'accent'). */
82
82
  export const Badge = forwardRef(function Badge({ tone, className, children, ...rest }, ref) {
83
- return h('span', { ref, ...rest, className: cx('badge', tone && 'badge--' + tone, className) }, children);
83
+ return h('span', { ref, ...rest, className: cx('gk-badge', tone && 'gk-badge--' + tone, className) }, children);
84
84
  });
85
85
 
86
86
  /* ---------------- people ---------------- */
@@ -89,60 +89,60 @@ export const Badge = forwardRef(function Badge({ tone, className, children, ...r
89
89
  * Same as av({ name, ini, tone }, size, online). No name and no ini: an empty "open slot" circle with a plus.
90
90
  */
91
91
  export const Avatar = forwardRef(function Avatar({ name, ini, tone, size, online = false, className, ...rest }, ref) {
92
- if (!has(name) && !has(ini)) return h('span', { ref, ...rest, className: cx('av', 'av--open', size && 'av--' + size, className) }, iconNode('plus'));
93
- return h('span', { ref, title: name, ...rest, className: cx('av', 'av--' + (tone || 'indigo'), size && 'av--' + size, className) },
94
- ini ?? C.initials(name || ''), online ? h('i', { className: 'av__on' }) : null);
92
+ if (!has(name) && !has(ini)) return h('span', { ref, ...rest, className: cx('gk-av', 'gk-av--open', size && 'gk-av--' + size, className) }, iconNode('plus'));
93
+ return h('span', { ref, title: name, ...rest, className: cx('gk-av', 'gk-av--' + (tone || 'indigo'), size && 'gk-av--' + size, className) },
94
+ ini ?? C.initials(name || ''), online ? h('i', { className: 'gk-av__on' }) : null);
95
95
  });
96
96
 
97
97
  /** <AvatarGroup people={team} max={4} /> — same as avs(people, max): small overlapping avatars, then "+N". */
98
98
  export const AvatarGroup = forwardRef(function AvatarGroup({ people = [], max = 4, className, ...rest }, ref) {
99
- return h('span', { ref, ...rest, className: cx('avs', className) },
99
+ return h('span', { ref, ...rest, className: cx('gk-avs', className) },
100
100
  people.slice(0, max).map((p, i) => h(Avatar, { key: p.id ?? p.name ?? i, name: p.name, ini: p.ini, tone: p.tone, size: 'sm' })),
101
- people.length > max ? h('span', { className: 'av av--sm av--more' }, '+' + (people.length - max)) : null);
101
+ people.length > max ? h('span', { className: 'gk-av gk-av--sm gk-av--more' }, '+' + (people.length - max)) : null);
102
102
  });
103
103
 
104
104
  /** <Cell name="Pim Wong" tone="teal" sub="Mechanic" online /> — same as cell(person, sub): avatar + name + small line. */
105
105
  export const Cell = forwardRef(function Cell({ name, ini, tone, sub, online = false, className, ...rest }, ref) {
106
- return h('span', { ref, ...rest, className: cx('cell', className) },
106
+ return h('span', { ref, ...rest, className: cx('gk-cell', className) },
107
107
  h(Avatar, { name, ini, tone, online }),
108
- h('span', { className: 'cell__text' }, h('b', null, name ?? ''), sub !== undefined && sub !== null ? h('small', null, sub) : null));
108
+ h('span', { className: 'gk-cell__text' }, h('b', null, name ?? ''), sub !== undefined && sub !== null ? h('small', null, sub) : null));
109
109
  });
110
110
 
111
111
  /* ---------------- cards ---------------- */
112
112
  /** <CardHead title="Today" sub="12 bookings" right={<Button size="sm">See all</Button>} /> — same as chead(title, sub, right). */
113
113
  export const CardHead = forwardRef(function CardHead({ title, sub, right, className, ...rest }, ref) {
114
- return h('div', { ref, ...rest, className: cx('chead', className) },
115
- h('div', { className: 'chead__text' }, h('h2', null, title), has(sub) ? h('p', null, sub) : null),
116
- has(right) ? h('div', { className: 'chead__right' }, right) : null);
114
+ return h('div', { ref, ...rest, className: cx('gk-chead', className) },
115
+ h('div', { className: 'gk-chead__text' }, h('h2', null, title), has(sub) ? h('p', null, sub) : null),
116
+ has(right) ? h('div', { className: 'gk-chead__right' }, right) : null);
117
117
  });
118
118
 
119
119
  /**
120
120
  * <Card title="Today" sub="12 bookings" right={…} lift flush>…body…</Card>
121
- * Same as card({ title, sub, right, body, flush, lift }): a <section class="card">; the head shows when title is set.
121
+ * Same as card({ title, sub, right, body, flush, lift }): a <section class="gk-card">; the head shows when title is set.
122
122
  */
123
123
  export const Card = forwardRef(function Card({ title, sub, right, flush = false, lift = false, className, children, ...rest }, ref) {
124
124
  const el = useMotion((n) => (lift ? M.lift(n) : undefined), [lift]);
125
125
  return h('section', {
126
126
  ref: (n) => { el.current = n; assignRef(ref, n); }, ...(lift ? { 'data-lift': '' } : null), ...rest,
127
- className: cx('card', flush && 'card--flush', className),
127
+ className: cx('gk-card', flush && 'gk-card--flush', className),
128
128
  }, has(title) ? h(CardHead, { title, sub, right }) : null, children);
129
129
  });
130
130
 
131
131
  /** <Kpi label="Revenue" value="฿48,250" sub="This month" tone="good" /> — same as kpi(label, value, sub, cls). */
132
132
  export const Kpi = forwardRef(function Kpi({ label, value, sub, tone, className, ...rest }, ref) {
133
- return h('div', { ref, ...rest, className: cx('kpi', tone && 'kpi--' + tone, className) },
134
- h('small', null, label), h('b', null, value), has(sub) ? h('span', { className: 'kpi__sub' }, sub) : null);
133
+ return h('div', { ref, ...rest, className: cx('gk-kpi', tone && 'gk-kpi--' + tone, className) },
134
+ h('small', null, label), h('b', null, value), has(sub) ? h('span', { className: 'gk-kpi__sub' }, sub) : null);
135
135
  });
136
136
 
137
137
  /** <Empty icon="inbox" title="No bookings yet" body="New ones show up here." action={<Button>New booking</Button>} /> — same as empty(icon, title, body, action). */
138
138
  export const Empty = forwardRef(function Empty({ icon = 'inbox', title, body, action, className, children, ...rest }, ref) {
139
- return h('div', { ref, ...rest, className: cx('empty', className) },
140
- h('span', { className: 'empty__icon' }, iconNode(icon)), h('b', null, title), has(body) ? h('p', null, body) : null, action ?? null, children);
139
+ return h('div', { ref, ...rest, className: cx('gk-empty', className) },
140
+ h('span', { className: 'gk-empty__icon' }, iconNode(icon)), h('b', null, title), has(body) ? h('p', null, body) : null, action ?? null, children);
141
141
  });
142
142
 
143
143
  /* ---------------- table ---------------- */
144
144
  /**
145
- * A table styled by .table, inside .table-wrap (scrolls sideways on small screens).
145
+ * A table styled by .gk-table, inside .gk-table-wrap (scrolls sideways on small screens).
146
146
  * Data: <Table columns={[{ key: 'bike', title: 'Bike' }, { key: 'days', title: 'Days', align: 'right' }]} rows={bookings} rowKey="id" />
147
147
  * Your own: <Table><thead>…</thead><tbody>…</tbody></Table>
148
148
  * slideRows: rows slide in when they first appear (also rows added later).
@@ -158,15 +158,15 @@ export const Table = forwardRef(function Table({ columns, rows, rowKey = 'id', f
158
158
  });
159
159
  useIsoLayoutEffect(() => () => { tweens.current.forEach((t) => t.progress(1).kill()); tweens.current = []; seen.current = null; }, []);
160
160
  const key = (r, i) => (typeof rowKey === 'function' ? rowKey(r, i) : r?.[rowKey] ?? i);
161
- const al = (c) => (c.align === 'right' ? 'r' : undefined);
161
+ const al = (c) => (c.align === 'right' ? 'gk-r' : undefined);
162
162
  const body = columns ? [
163
163
  h('thead', { key: 'h' }, h('tr', null, columns.map((c) => h('th', { key: c.key, className: cx(al(c), c.className) || undefined }, c.title ?? c.key)))),
164
164
  h('tbody', { key: 'b' }, (rows || []).map((r, i) => h('tr', { key: key(r, i) },
165
165
  columns.map((c) => h('td', { key: c.key, className: cx(al(c), c.className) || undefined }, c.render ? c.render(r, i) : r?.[c.key]))))),
166
166
  foot ? h('tfoot', { key: 'f' }, foot) : null,
167
167
  ] : children;
168
- const table = h('table', { ref: (n) => { el.current = n; assignRef(ref, n); }, ...rest, className: cx('table', className) }, body);
169
- return wrap ? h('div', { className: 'table-wrap' }, table) : table;
168
+ const table = h('table', { ref: (n) => { el.current = n; assignRef(ref, n); }, ...rest, className: cx('gk-table', className) }, body);
169
+ return wrap ? h('div', { className: 'gk-table-wrap' }, table) : table;
170
170
  });
171
171
 
172
172
  /* ---------------- progress ---------------- */
@@ -183,7 +183,7 @@ export const Meter = forwardRef(function Meter({ value = 0, tone, delay = 0.15,
183
183
  return () => { tw?.progress(1); tw?.kill(); };
184
184
  }, [f]);
185
185
  useIsoLayoutEffect(() => () => { prev.current = null; }, []);
186
- return h('span', { ref, ...rest, className: cx('meter', tone && 'is-' + tone, className) },
186
+ return h('span', { ref, ...rest, className: cx('gk-meter', tone && 'gk-is-' + tone, className) },
187
187
  h('i', { ref: bar, 'data-f': f, style: { transform: 'scaleX(0)' } }));
188
188
  });
189
189
 
@@ -200,10 +200,10 @@ export const Ring = forwardRef(function Ring({ value = 0, size = 56, stroke = 6,
200
200
  return () => { tw?.progress(1); tw?.kill(); };
201
201
  }, [f, len]);
202
202
  useIsoLayoutEffect(() => () => { prev.current = null; }, []);
203
- return h('span', { ref, ...rest, className: cx('ring', className), style: { width: size, height: size, ...style } },
203
+ return h('span', { ref, ...rest, className: cx('gk-ring', className), style: { width: size, height: size, ...style } },
204
204
  h('svg', { viewBox: `0 0 ${size} ${size}` },
205
- h('circle', { cx: c, cy: c, r, strokeWidth: stroke, className: 'ring__bg' }),
206
- h('circle', { ref: fg, cx: c, cy: c, r, strokeWidth: stroke, className: 'ring__fg', 'data-len': len, 'data-f': f, strokeDasharray: len, strokeDashoffset: len })),
205
+ h('circle', { cx: c, cy: c, r, strokeWidth: stroke, className: 'gk-ring__bg' }),
206
+ h('circle', { ref: fg, cx: c, cy: c, r, strokeWidth: stroke, className: 'gk-ring__fg', 'data-len': len, 'data-f': f, strokeDasharray: len, strokeDashoffset: len })),
207
207
  h('b', null, label));
208
208
  });
209
209
 
@@ -216,14 +216,14 @@ export const Steps = forwardRef(function Steps({ labels = [], now = 0, className
216
216
  useIsoLayoutEffect(() => {
217
217
  const p = prev.current === null ? now : prev.current; prev.current = now;
218
218
  M.steps(el.current, now, p);
219
- const parts = el.current ? [...el.current.querySelectorAll('.steps__fill, .steps__dot')] : [];
219
+ const parts = el.current ? [...el.current.querySelectorAll('.gk-steps__fill, .gk-steps__dot')] : [];
220
220
  return () => { M.g.getTweensOf(parts).forEach((t) => t.progress(1).kill()); };
221
221
  }, [now, labels.length]);
222
222
  useIsoLayoutEffect(() => () => { prev.current = null; }, []);
223
- return h('ol', { ref: (n) => { el.current = n; assignRef(ref, n); }, ...rest, className: cx('steps', className) },
224
- labels.map((l, i) => h('li', { key: i, className: i < now ? 'is-done' : i === now ? 'is-now' : undefined, 'aria-current': i === now ? 'step' : undefined },
225
- h('span', { className: 'steps__dot' }, iconNode('check')),
226
- i < labels.length - 1 ? h('span', { className: 'steps__bar' }, h('i', { className: 'steps__fill', style: { transform: 'scaleX(0)' } })) : null,
223
+ return h('ol', { ref: (n) => { el.current = n; assignRef(ref, n); }, ...rest, className: cx('gk-steps', className) },
224
+ labels.map((l, i) => h('li', { key: i, className: i < now ? 'gk-is-done' : i === now ? 'gk-is-now' : undefined, 'aria-current': i === now ? 'step' : undefined },
225
+ h('span', { className: 'gk-steps__dot' }, iconNode('check')),
226
+ i < labels.length - 1 ? h('span', { className: 'gk-steps__bar' }, h('i', { className: 'gk-steps__fill', style: { transform: 'scaleX(0)' } })) : null,
227
227
  h('small', null, l))));
228
228
  });
229
229
 
@@ -234,8 +234,8 @@ const BAR_S = {
234
234
  col: { flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 6 },
235
235
  track: { position: 'relative', flex: 1, width: '100%' },
236
236
  bar: { position: 'absolute', inset: 0, borderRadius: '7px 7px 3px 3px', transform: 'scaleY(0)', transformOrigin: '50% 100%', transition: 'background .4s' },
237
- v: { position: 'absolute', left: 0, right: 0, paddingBottom: 4, textAlign: 'center', fontSize: 11, fontWeight: 700, color: 'var(--ink-2)', fontVariantNumeric: 'tabular-nums', transition: 'bottom .75s var(--ease-in-out, ease)' },
238
- label: { color: 'var(--muted)', fontSize: 11, fontWeight: 600, maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
237
+ v: { position: 'absolute', left: 0, right: 0, paddingBottom: 4, textAlign: 'center', fontSize: 11, fontWeight: 'var(--gk-w-bold)', color: 'var(--gk-ink-2)', fontVariantNumeric: 'tabular-nums', transition: 'bottom .75s var(--gk-ease-in-out, ease)' },
238
+ label: { color: 'var(--gk-muted)', fontSize: 11, fontWeight: 'var(--gk-w-semibold)', maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
239
239
  };
240
240
  /**
241
241
  * <Bars values={[12, 30, 22]} labels={['Mon', 'Tue', 'Wed']} max={40} showValues />
@@ -247,38 +247,38 @@ export const Bars = forwardRef(function Bars({ values = [], max, labels, showVal
247
247
  const m = max ?? (top || 1);
248
248
  const key = values.join(',') + '|' + m;
249
249
  useIsoLayoutEffect(() => {
250
- const bars = el.current ? [...el.current.querySelectorAll('.bars__bar')] : [];
250
+ const bars = el.current ? [...el.current.querySelectorAll('.gk-bars__bar')] : [];
251
251
  M.bars(bars, values, m, { first: first.current }); first.current = false;
252
252
  return () => { M.g.getTweensOf(bars).forEach((t) => t.progress(1).kill()); };
253
253
  }, [key]);
254
254
  useIsoLayoutEffect(() => () => { first.current = true; }, []);
255
255
  return h('div', {
256
256
  ref: (n) => { el.current = n; assignRef(ref, n); }, role: 'img', 'aria-label': label ?? values.map((v, i) => (labels?.[i] != null ? `${labels[i]}: ${v}` : v)).join(', '), ...rest,
257
- className: cx('bars', className), style: { ...BAR_S.root, height, ...style },
257
+ className: cx('gk-bars', className), style: { ...BAR_S.root, height, ...style },
258
258
  }, values.map((v, i) => {
259
259
  const isTop = highlightTop && +v === top && top > 0;
260
- return h('div', { key: i, className: cx('bars__col', isTop && 'is-top'), style: BAR_S.col },
261
- h('span', { className: 'bars__track', style: BAR_S.track },
262
- h('i', { className: 'bars__bar', style: { ...BAR_S.bar, background: isTop || !highlightTop ? 'var(--accent)' : 'color-mix(in oklab, var(--accent) 35%, var(--card))' } }),
263
- showValues ? h('b', { className: 'bars__v', 'aria-hidden': true, style: { ...BAR_S.v, bottom: Math.min(100, ((+v || 0) / m) * 100) + '%' } }, format(v, i)) : null),
264
- labels?.[i] != null ? h('small', { className: 'bars__label', style: BAR_S.label }, labels[i]) : null);
260
+ return h('div', { key: i, className: cx('gk-bars__col', isTop && 'gk-is-top'), style: BAR_S.col },
261
+ h('span', { className: 'gk-bars__track', style: BAR_S.track },
262
+ h('i', { className: 'gk-bars__bar', style: { ...BAR_S.bar, background: isTop || !highlightTop ? 'var(--gk-accent)' : 'color-mix(in oklab, var(--gk-accent) 35%, var(--gk-card))' } }),
263
+ showValues ? h('b', { className: 'gk-bars__v', 'aria-hidden': true, style: { ...BAR_S.v, bottom: Math.min(100, ((+v || 0) / m) * 100) + '%' } }, format(v, i)) : null),
264
+ labels?.[i] != null ? h('small', { className: 'gk-bars__label', style: BAR_S.label }, labels[i]) : null);
265
265
  }));
266
266
  });
267
267
 
268
268
  /* ---------------- form fields ---------------- */
269
269
  /** <Field label="Email" hint="We only use it for reminders."><Input type="email" /></Field> — same as field(label, control, hint). invalid: red border + red hint. */
270
270
  export const Field = forwardRef(function Field({ label, hint, invalid = false, className, children, ...rest }, ref) {
271
- return h('label', { ref, ...rest, className: cx('field', invalid && 'is-bad', className) },
272
- h('span', null, label), children, has(hint) ? h('small', { className: 'field__hint' }, hint) : null);
271
+ return h('label', { ref, ...rest, className: cx('gk-field', invalid && 'gk-is-bad', className) },
272
+ h('span', null, label), children, has(hint) ? h('small', { className: 'gk-field__hint' }, hint) : null);
273
273
  });
274
274
 
275
- /** <Input type="email" placeholder="you@shop.com" size="sm" /> — same as input({ type, value, placeholder }): an <input class="input">. Every <input> prop works. */
275
+ /** <Input type="email" placeholder="you@shop.com" size="sm" /> — same as input({ type, value, placeholder }): an <input class="gk-input">. Every <input> prop works. */
276
276
  export const Input = forwardRef(function Input({ size, type = 'text', className, ...rest }, ref) {
277
- return h('input', { ref, type, ...rest, className: cx('input', size && 'input--' + size, className) });
277
+ return h('input', { ref, type, ...rest, className: cx('gk-input', size && 'gk-input--' + size, className) });
278
278
  });
279
279
 
280
280
  /**
281
- * <Textarea rows={3} autoGrow={6} /> — a <textarea class="input">. autoGrow: the box gets taller with each line,
281
+ * <Textarea rows={3} autoGrow={6} /> — a <textarea class="gk-input">. autoGrow: the box gets taller with each line,
282
282
  * up to that many lines (true = 6), then scrolls.
283
283
  */
284
284
  export const Textarea = forwardRef(function Textarea({ autoGrow = false, size, className, style, onInput, ...rest }, ref) {
@@ -303,6 +303,6 @@ export const Textarea = forwardRef(function Textarea({ autoGrow = false, size, c
303
303
  ref: (n) => { el.current = n; assignRef(ref, n); }, ...rest,
304
304
  style: maxLines ? { resize: 'none', ...style } : style,
305
305
  onInput: (e) => { onInput?.(e); fit(); },
306
- className: cx('input', size && 'input--' + size, className),
306
+ className: cx('gk-input', size && 'gk-input--' + size, className),
307
307
  });
308
308
  });
package/src/controls.d.ts CHANGED
@@ -4,9 +4,9 @@ import type { IconLike } from './core.js';
4
4
  type ButtonAttrs = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'value' | 'defaultValue'>;
5
5
  type DivAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>;
6
6
 
7
- /** An option: [value, label, icon?], { value, label, icon, disabled } or a plain string. */
8
- export type Option<V extends string = string> = [V, React.ReactNode?, IconLike?] | { value: V; label?: React.ReactNode; icon?: IconLike; disabled?: boolean } | V;
9
- export function normOption<V extends string>(o: Option<V>): { value: V; label: React.ReactNode; icon?: IconLike; disabled?: boolean };
7
+ /** An option: [value, label, icon?, count?], { value, label, icon, count, disabled } or a plain string. count: a number shown after the label (Segmented). */
8
+ export type Option<V extends string = string> = [V, React.ReactNode?, IconLike?, (number | string)?] | { value: V; label?: React.ReactNode; icon?: IconLike; count?: number | string; disabled?: boolean } | V;
9
+ export function normOption<V extends string>(o: Option<V>): { value: V; label: React.ReactNode; icon?: IconLike; count?: number | string; disabled?: boolean };
10
10
 
11
11
  export interface SwitchProps extends ButtonAttrs {
12
12
  checked?: boolean;
@@ -153,7 +153,7 @@ export interface OtpProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
153
153
  /** Put the cursor in the first box. */
154
154
  autoFocus?: boolean;
155
155
  }
156
- /** <Otp length={6} split onComplete={(code) => verify(code)} /> — ref is the .otp element. */
156
+ /** <Otp length={6} split onComplete={(code) => verify(code)} /> — ref is the .gk-otp element. */
157
157
  export const Otp: React.ForwardRefExoticComponent<OtpProps & React.RefAttributes<HTMLDivElement>>;
158
158
 
159
159
  export {};
package/src/controls.js CHANGED
@@ -22,7 +22,7 @@ export const Switch = forwardRef(function Switch({ checked, defaultChecked = fal
22
22
  useIsoLayoutEffect(() => { M.switchKnob(el.current, !!on, !first.current); first.current = false; }, [on]);
23
23
  return h('button', {
24
24
  ref: (n) => { el.current = n; assignRef(ref, n); }, type: 'button', role: 'switch', 'aria-checked': !!on, 'aria-label': label, ...rest,
25
- className: cx('switch', className),
25
+ className: cx('gk-switch', className),
26
26
  onClick: (e) => { onClick?.(e); if (!e.defaultPrevented) setOn(!on, e); },
27
27
  }, h('i'));
28
28
  });
@@ -30,25 +30,25 @@ export const Switch = forwardRef(function Switch({ checked, defaultChecked = fal
30
30
  /**
31
31
  * <Segmented value={view} onChange={setView} options={[['list', 'List', 'list'], ['grid', 'Grid', 'cards']]} />
32
32
  * Same as seg(name, options, value, { size }): the thumb stretches to the pressed button.
33
- * options: [id, label, icon?] arrays, { value, label, icon } objects or plain strings. onChange(value, event)
33
+ * options: [id, label, icon?, count?] arrays, { value, label, icon, count } objects or plain strings. onChange(value, event)
34
34
  */
35
35
  export const Segmented = forwardRef(function Segmented({ options = [], value, defaultValue, onChange, size, name, className, ...rest }, ref) {
36
36
  const list = options.map(normOption);
37
37
  const [v, setV] = useControllable(value, defaultValue ?? list[0]?.value, onChange);
38
38
  const root = useRef(null), thumb = useRef(null), first = useRef(true);
39
39
  const current = () => root.current?.querySelector('button[aria-pressed="true"]');
40
- useIsoLayoutEffect(() => { M.indicator(thumb.current, current(), { animate: !first.current, radius: 99 }); first.current = false; }, [v, list.length]);
41
- useEffect(() => M.trackIndicator(thumb.current, current, { radius: 99 }), []);
42
- return h('div', { ref: (n) => { root.current = n; assignRef(ref, n); }, role: 'group', 'data-seg': name, ...rest, className: cx('seg', size && 'seg--' + size, className) },
43
- h('span', { className: 'seg__thumb', ref: thumb }),
40
+ useIsoLayoutEffect(() => { M.indicator(thumb.current, current(), { animate: !first.current, radius: 'auto' }); first.current = false; }, [v, list.length]);
41
+ useEffect(() => M.trackIndicator(thumb.current, current, { radius: 'auto' }), []);
42
+ return h('div', { ref: (n) => { root.current = n; assignRef(ref, n); }, role: 'group', 'data-seg': name, ...rest, className: cx('gk-seg', size && 'gk-seg--' + size, className) },
43
+ h('span', { className: 'gk-seg__thumb', ref: thumb }),
44
44
  list.map((o) => h('button', {
45
45
  key: o.value, type: 'button', 'data-v': o.value, 'aria-pressed': o.value === v, disabled: o.disabled,
46
46
  onClick: (e) => { if (o.value === v) return; M.pop(e.currentTarget); setV(o.value, e); },
47
- }, iconNode(o.icon), o.label)));
47
+ }, iconNode(o.icon), o.label, o.count != null && o.count !== '' && h('span', { className: 'gk-seg__count' }, o.count))));
48
48
  });
49
49
 
50
50
  /** [id, label, icon] | { value, label, icon, disabled } | 'id' → { value, label, icon, disabled } */
51
- export const normOption = (o) => Array.isArray(o) ? { value: o[0], label: o[1] ?? o[0], icon: o[2] }
51
+ export const normOption = (o) => Array.isArray(o) ? { value: o[0], label: o[1] ?? o[0], icon: o[2], count: o[3] }
52
52
  : o && typeof o === 'object' ? { label: o.value, ...o } : { value: o, label: o };
53
53
 
54
54
  /**
@@ -60,7 +60,7 @@ export const Checkbox = forwardRef(function Checkbox({ checked, defaultChecked =
60
60
  const [on, setOn] = useControllable(checked, defaultChecked, onChange);
61
61
  return h('button', {
62
62
  ref, type: 'button', role: 'checkbox', 'aria-checked': !!on, 'aria-label': label, ...rest,
63
- className: cx('check', className),
63
+ className: cx('gk-check', className),
64
64
  onClick: (e) => { onClick?.(e); if (e.defaultPrevented) return; M.pop(e.currentTarget); setOn(!on, e); },
65
65
  }, iconNode('check'));
66
66
  });
@@ -81,12 +81,12 @@ export const Tabs = forwardRef(function Tabs({ items = [], value, defaultValue,
81
81
  const current = () => root.current?.querySelector('[aria-selected="true"]');
82
82
  useIsoLayoutEffect(() => { M.indicator(line.current, current(), { animate: !first.current, radius: 2, line: true }); first.current = false; }, [v, list.length]);
83
83
  useEffect(() => M.trackIndicator(line.current, current, { radius: 2, line: true }), []);
84
- return h('div', { ref: (n) => { root.current = n; assignRef(ref, n); }, role: 'tablist', 'data-tabs': name, ...rest, className: cx('tabs', className) },
85
- h('span', { className: 'tabs__line', ref: line }),
84
+ return h('div', { ref: (n) => { root.current = n; assignRef(ref, n); }, role: 'tablist', 'data-tabs': name, ...rest, className: cx('gk-tabs', className) },
85
+ h('span', { className: 'gk-tabs__line', ref: line }),
86
86
  list.map((o) => h('button', {
87
87
  key: o.value, type: 'button', role: 'tab', 'data-v': o.value, 'aria-selected': o.value === v, disabled: o.disabled,
88
88
  onClick: (e) => { if (o.value !== v) setV(o.value, e); },
89
- }, o.label, o.count ? h('span', { className: 'badge' }, o.count) : null)));
89
+ }, o.label, o.count ? h('span', { className: 'gk-badge' }, o.count) : null)));
90
90
  });
91
91
 
92
92
  /**
@@ -98,9 +98,9 @@ export const Chips = forwardRef(function Chips({ options = [], value, defaultVal
98
98
  const list = options.map(normOption);
99
99
  const [v, setV] = useControllable(value, defaultValue ?? (multi ? [] : list[0]?.value), onChange);
100
100
  const isOn = (id) => (multi ? (v || []).includes(id) : id === v);
101
- return h('div', { ref, 'data-chips': name, ...(multi ? { 'data-multi': '' } : null), ...rest, className: cx('chips', className) },
101
+ return h('div', { ref, 'data-chips': name, ...(multi ? { 'data-multi': '' } : null), ...rest, className: cx('gk-chips', className) },
102
102
  list.map((o) => h('button', {
103
- key: o.value, type: 'button', className: 'chip', 'data-v': o.value, 'aria-pressed': isOn(o.value), disabled: o.disabled,
103
+ key: o.value, type: 'button', className: 'gk-chip', 'data-v': o.value, 'aria-pressed': isOn(o.value), disabled: o.disabled,
104
104
  onClick: (e) => {
105
105
  if (multi) { const cur = v || []; M.pop(e.currentTarget); setV(isOn(o.value) ? cur.filter((x) => x !== o.value) : list.map((x) => x.value).filter((x) => x === o.value || cur.includes(x)), e); return; }
106
106
  if (o.value === v) return; M.pop(e.currentTarget); setV(o.value, e);
@@ -119,13 +119,13 @@ export const Range = forwardRef(function Range({ value, defaultValue, onChange,
119
119
  const p = ((+v - +min) / ((+max - +min) || 1)) * 100 + '%';
120
120
  useIsoLayoutEffect(() => {
121
121
  const r = el.current; if (!r || M.RM()) return;
122
- const tw = M.g.fromTo(r, { '--p': '0%' }, { '--p': r.style.getPropertyValue('--p'), duration: 0.9, ease: 'expo.out' });
122
+ const tw = M.g.fromTo(r, { '--gk-p': '0%' }, { '--gk-p': r.style.getPropertyValue('--gk-p'), duration: 0.9, ease: 'expo.out' });
123
123
  return () => { tw.kill(); };
124
124
  }, []);
125
- useIsoLayoutEffect(() => { const r = el.current; if (!r) return; M.g.killTweensOf(r); r.style.setProperty('--p', p); }, [p]);
125
+ useIsoLayoutEffect(() => { const r = el.current; if (!r) return; M.g.killTweensOf(r); r.style.setProperty('--gk-p', p); }, [p]);
126
126
  return h('input', {
127
127
  ref: (n) => { el.current = n; assignRef(ref, n); }, type: 'range', min, max, step, ...rest, value: v,
128
- className: cx('range', className), style: { ...style, '--p': p },
128
+ className: cx('gk-range', className), style: { ...style, '--gk-p': p },
129
129
  onChange: (e) => { M.g.killTweensOf(e.currentTarget); setV(+e.currentTarget.value, e); },
130
130
  });
131
131
  });
@@ -141,7 +141,7 @@ export const Swatch = forwardRef(function Swatch({ value, defaultValue = '#5b4cf
141
141
  useEffect(() => { const s = el.current; const pop = () => M.pop(s); s.addEventListener('change', pop); return () => s.removeEventListener('change', pop); }, []);
142
142
  return h('input', {
143
143
  ref: (n) => { el.current = n; assignRef(ref, n); }, type: 'color', ...rest, value: v,
144
- className: cx('swatch', className), onChange: (e) => setV(e.currentTarget.value, e),
144
+ className: cx('gk-swatch', className), onChange: (e) => setV(e.currentTarget.value, e),
145
145
  });
146
146
  });
147
147
 
@@ -153,11 +153,11 @@ export const Swatch = forwardRef(function Swatch({ value, defaultValue = '#5b4cf
153
153
  export const SearchBox = forwardRef(function SearchBox({ placeholder = 'Search…', value, defaultValue = '', onChange, onSearch, onKeyDown, size, className, style, ...rest }, ref) {
154
154
  const [v, setV] = useControllable(value, defaultValue, onChange);
155
155
  const box = useRef(null);
156
- return h('label', { ref: box, className: cx('searchbox', className), style },
156
+ return h('label', { ref: box, className: cx('gk-searchbox', className), style },
157
157
  iconNode('search'),
158
158
  h('input', {
159
159
  ref, 'aria-label': placeholder, ...rest, placeholder, value: v ?? '',
160
- className: cx('input', size && 'input--' + size),
160
+ className: cx('gk-input', size && 'gk-input--' + size),
161
161
  onChange: (e) => setV(e.currentTarget.value, e),
162
162
  onKeyDown: (e) => {
163
163
  onKeyDown?.(e);
@@ -174,7 +174,7 @@ const firstValue = (list) => { for (const o of list) { if (o.options) { const f
174
174
 
175
175
  /**
176
176
  * <Select options={[['scooter', 'Scooter 125', 'moto'], ['ebike', 'E-bike', 'bike']]} value={bike} onChange={setBike} />
177
- * A real <select class="input"> (forms, FormData and labels keep working) that dropdown() from
177
+ * A real <select class="gk-input"> (forms, FormData and labels keep working) that dropdown() from
178
178
  * @gecko-ui-kit/overlays turns into the animated dropdown: the list pops out of the button, a highlight follows
179
179
  * the mouse and ↑ ↓, and the chosen text rolls in. Options: [value, label, icon?], { value, label, icon, disabled },
180
180
  * 'value', or a group { group: 'Bikes', options: [...] }. onChange(value, event). ref → the <select>.
@@ -190,11 +190,11 @@ export const Select = forwardRef(function Select({ options = [], value, defaultV
190
190
  }, []);
191
191
  useIsoLayoutEffect(() => { dd.current?.sync(); });
192
192
  const opt = (o) => h('option', { key: o.value, value: o.value, disabled: o.disabled, 'data-icon': typeof o.icon === 'string' ? o.icon : undefined }, o.label);
193
- return h('span', { className: 'dd-host', style: { display: 'contents' } },
193
+ return h('span', { className: 'gk-dd-host', style: { display: 'contents' } },
194
194
  h('select', {
195
195
  ref: (n) => { sel.current = n; assignRef(ref, n); }, ...rest, value: v ?? '',
196
196
  tabIndex: up ? -1 : tabIndex, 'aria-hidden': up || undefined,
197
- className: cx('input', size && 'input--' + size, up && 'dd__native', className),
197
+ className: cx('gk-input', size && 'gk-input--' + size, up && 'gk-dd__native', className),
198
198
  onChange: (e) => setV(e.currentTarget.value, e),
199
199
  }, list.map((o, i) => (o.options ? h('optgroup', { key: 'g' + i, label: o.group }, o.options.map(opt)) : opt(o)))));
200
200
  });
@@ -208,7 +208,7 @@ const ANSWER = { true: 'good', good: 'good', false: 'bad', bad: 'bad' };
208
208
  * Same as otp({ length, split, mask, letters, label, name }) wired by bindOtp: one box per character, typing moves on,
209
209
  * Backspace goes back, paste / the phone's code autofill fills every box. onComplete(code, el) runs when the last box
210
210
  * is filled; return (or resolve) true / 'good' to play the green wave (and gather into a tick), false / 'bad' to shake
211
- * and clear. onChange(code) runs as it is typed; value / defaultValue fill the boxes. ref → the .otp element
211
+ * and clear. onChange(code) runs as it is typed; value / defaultValue fill the boxes. ref → the .gk-otp element
212
212
  * (otpState / otpClear from @gecko-ui-kit/components work on it).
213
213
  */
214
214
  export const Otp = forwardRef(function Otp({ length = 6, split = false, mask = false, letters = false, label = 'Verification code', name = '', value, defaultValue, onChange, onComplete, gather = true, clear = true, disabled, autoFocus, className, ...rest }, ref) {
@@ -216,7 +216,7 @@ export const Otp = forwardRef(function Otp({ length = 6, split = false, mask = f
216
216
  const write = (code) => {
217
217
  const box = el.current; if (!box) return;
218
218
  const chars = [...cleanCode(code, letters)];
219
- box.querySelectorAll('.otp__box').forEach((b, i) => { b.value = chars[i] ?? ''; b.classList.toggle('is-filled', !!b.value); });
219
+ box.querySelectorAll('.gk-otp__box').forEach((b, i) => { b.value = chars[i] ?? ''; b.classList.toggle('gk-is-filled', !!b.value); });
220
220
  last.current = C.otpValue(box);
221
221
  };
222
222
  useIsoLayoutEffect(() => {
@@ -235,7 +235,7 @@ export const Otp = forwardRef(function Otp({ length = 6, split = false, mask = f
235
235
  C.bindOtp(box, done);
236
236
  const evs = ['input', 'paste', 'keydown'];
237
237
  evs.forEach((t) => box.addEventListener(t, report));
238
- if (autoFocus) box.querySelector('.otp__box')?.focus();
238
+ if (autoFocus) box.querySelector('.gk-otp__box')?.focus();
239
239
  return () => {
240
240
  alive = false; tl?.kill();
241
241
  const i = box.__otpDone?.indexOf(done); if (i > -1) box.__otpDone.splice(i, 1);
@@ -246,16 +246,16 @@ export const Otp = forwardRef(function Otp({ length = 6, split = false, mask = f
246
246
  const half = split ? Math.ceil(length / 2) : -1;
247
247
  const boxes = [];
248
248
  for (let i = 0; i < length; i++) {
249
- if (i === half) boxes.push(h('span', { key: 'dash', className: 'otp__dash', 'aria-hidden': true }));
249
+ if (i === half) boxes.push(h('span', { key: 'dash', className: 'gk-otp__dash', 'aria-hidden': true }));
250
250
  boxes.push(h('input', {
251
- key: i, className: 'otp__box', type: mask ? 'password' : 'text', inputMode: letters ? 'text' : 'numeric', pattern: letters ? undefined : '[0-9]*',
251
+ key: i, className: 'gk-otp__box', type: mask ? 'password' : 'text', inputMode: letters ? 'text' : 'numeric', pattern: letters ? undefined : '[0-9]*',
252
252
  autoComplete: i === 0 ? 'one-time-code' : 'off', autoCapitalize: 'characters', spellCheck: false, disabled,
253
253
  'aria-label': `${label}, ${i + 1} of ${length}`,
254
254
  }));
255
255
  }
256
256
  return h('div', {
257
257
  ref: (n) => { el.current = n; assignRef(ref, n); }, role: 'group', 'aria-label': label, 'data-otp': name || 'code', 'data-len': length,
258
- ...(letters ? { 'data-letters': '' } : null), ...rest, className: cx('otp', letters && 'otp--letters', className),
259
- }, boxes, h('span', { className: 'otp__done', 'aria-hidden': true },
258
+ ...(letters ? { 'data-letters': '' } : null), ...rest, className: cx('gk-otp', letters && 'gk-otp--letters', className),
259
+ }, boxes, h('span', { className: 'gk-otp__done', 'aria-hidden': true },
260
260
  h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2.6, strokeLinecap: 'round', strokeLinejoin: 'round' }, h('path', { d: 'M5.5 12.5l4 4L18.5 7.5' }))));
261
261
  });
package/src/core.d.ts CHANGED
@@ -66,7 +66,7 @@ export interface IconProps extends Omit<React.SVGProps<SVGSVGElement>, 'name' |
66
66
  size?: number;
67
67
  stroke?: number;
68
68
  }
69
- /** <Icon name="search" /> — 24×24 stroke icon as an <svg class="ico">. */
69
+ /** <Icon name="search" /> — 24×24 stroke icon as an <svg class="gk-ico">. */
70
70
  export function Icon(props: IconProps): React.ReactElement;
71
71
  /** An icon name or any React node. */
72
72
  export type IconLike = string | React.ReactNode;
package/src/core.js CHANGED
@@ -198,7 +198,7 @@ export function changedOnly(next, prev, keys) {
198
198
  * Turn a motion `fn(el, options) → handle | tween | stop()` into a wrapper component around children.
199
199
  *
200
200
  * export const Tilt = enhancer('Tilt', tilt, { options: ['max', 'scale', 'glare', 'perspective'] });
201
- * <Tilt max={10} className="card"><h3>Lamp</h3></Tilt>
201
+ * <Tilt max={10} className="gk-card"><h3>Lamp</h3></Tilt>
202
202
  *
203
203
  * spec:
204
204
  * tag element to render (default 'div'; the `as` prop overrides it)
@@ -270,11 +270,11 @@ export function useMotion(fn, optsOrDeps, deps) {
270
270
 
271
271
  /**
272
272
  * <Icon name="search" /> — the same 24×24 stroke icon as icon('search') from @gecko-ui-kit/icons,
273
- * as a real <svg> (class "ico"), so `.btn > svg` style rules keep working.
273
+ * as a real <svg> (class "ico"), so `.gk-btn > svg` style rules keep working.
274
274
  */
275
275
  export function Icon({ name, className, size, stroke = 1.7, style, ...rest }) {
276
276
  return h('svg', {
277
- className: cx('ico', className), viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: stroke,
277
+ className: cx('gk-ico', className), viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: stroke,
278
278
  strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true,
279
279
  ...(size ? { width: size, height: size, style: { width: size, height: size, ...style } } : { style }),
280
280
  ...rest, dangerouslySetInnerHTML: { __html: PATHS[name] ?? PATHS.sparkle },
package/src/data.js CHANGED
@@ -74,9 +74,9 @@ const AccordionInner = mounted('Accordion', (el, o) => {
74
74
  },
75
75
  });
76
76
  note(acc);
77
- o.slots?.(slotMap(acc.root ? [...acc.root.querySelectorAll(':scope > .acc__item')].flatMap((it) => [
78
- [`b:${it.dataset.id}`, it.querySelector('.acc__body')],
79
- ...(o.nodeTitles?.includes(it.dataset.id) ? [[`t:${it.dataset.id}`, it.querySelector('.acc__title')]] : []),
77
+ o.slots?.(slotMap(acc.root ? [...acc.root.querySelectorAll(':scope > .gk-acc__item')].flatMap((it) => [
78
+ [`b:${it.dataset.id}`, it.querySelector('.gk-acc__body')],
79
+ ...(o.nodeTitles?.includes(it.dataset.id) ? [[`t:${it.dataset.id}`, it.querySelector('.gk-acc__title')]] : []),
80
80
  ]) : []));
81
81
  const destroy = acc.destroy;
82
82
  return Object.assign(acc, { destroy() { note(acc).dead = true; destroy(); } });
@@ -125,7 +125,7 @@ const CarouselInner = mounted('Carousel', (el, o) => {
125
125
  onChange: (i, h2) => { if (!isQuiet(h2)) o.onChange?.(i, h2); },
126
126
  });
127
127
  note(c);
128
- o.slots?.(slotMap(c ? [...c.root.querySelectorAll('.cr__slide')].map((s, i) => [String(i), s]) : []));
128
+ o.slots?.(slotMap(c ? [...c.root.querySelectorAll('.gk-cr__slide')].map((s, i) => [String(i), s]) : []));
129
129
  return c;
130
130
  }, {
131
131
  update(c, next, prev) {
@@ -153,7 +153,7 @@ export const Carousel = forwardRef(function Carousel({ children, ...rest }, ref)
153
153
 
154
154
  const BeforeAfterInner = mounted('BeforeAfter', (el, o) => {
155
155
  const ba = C.beforeAfter(el, { ...without(o, ['slots', 'value', 'defaultValue']), before: '', after: '', start: o.value ?? o.defaultValue ?? o.start ?? 50 });
156
- o.slots?.(slotMap(ba ? [['before', ba.root.querySelector('.ba__before')], ['after', ba.root.querySelector('.ba__after')]] : []));
156
+ o.slots?.(slotMap(ba ? [['before', ba.root.querySelector('.gk-ba__before')], ['after', ba.root.querySelector('.gk-ba__after')]] : []));
157
157
  return ba;
158
158
  }, {
159
159
  update(ba, next, prev) {
@@ -253,7 +253,7 @@ const VirtualListInner = mounted('VirtualList', (el, o) => {
253
253
  opts.render = (item, index) => {
254
254
  const k = vlKey(o, item, index);
255
255
  let b = boxes.get(k);
256
- if (!b) { const d = document.createElement('div'); d.className = 'vl__r'; d.style.display = 'contents'; b = { el: d }; }
256
+ if (!b) { const d = document.createElement('div'); d.className = 'gk-vl__r'; d.style.display = 'contents'; b = { el: d }; }
257
257
  boxes.set(k, { el: b.el, item, index });
258
258
  if (!queued) { queued = true; queueMicrotask(flush); }
259
259
  return b.el;
@@ -349,9 +349,9 @@ export const Calendar = mounted('Calendar', (el, o) => C.calendar(el, { ...witho
349
349
 
350
350
  const SWIPE_TONES = new Set(['good', 'bad', 'warn', 'accent', 'neutral']);
351
351
  const swipeAct = (a) => h('button', {
352
- key: a.id, type: 'button', className: `swp__act swp__act--${SWIPE_TONES.has(a.tone) ? a.tone : 'neutral'}`,
352
+ key: a.id, type: 'button', className: `gk-swp__act gk-swp__act--${SWIPE_TONES.has(a.tone) ? a.tone : 'neutral'}`,
353
353
  'data-act': a.id, 'data-remove': a.remove ? '' : undefined, tabIndex: -1,
354
- }, h('span', { className: 'swp__in' }, iconNode(a.icon), h('span', { className: 'swp__lb' }, a.label ?? a.id)));
354
+ }, h('span', { className: 'gk-swp__in' }, iconNode(a.icon), h('span', { className: 'gk-swp__lb' }, a.label ?? a.id)));
355
355
 
356
356
  /**
357
357
  * <SwipeItem id={b.id} end={[{ id: 'cancel', label: 'Cancel', icon: 'trash', tone: 'bad', remove: true }]}>…your row…</SwipeItem>
@@ -361,16 +361,16 @@ const swipeAct = (a) => h('button', {
361
361
  export const SwipeItem = forwardRef(function SwipeItem({ id, start = [], end = [], look = 'both', label, children, className, ...rest }, ref) {
362
362
  return h('div', {
363
363
  ref, ...rest, 'data-id': id != null && id !== '' ? String(id) : undefined,
364
- className: cx('swp', (look === 'icons' || look === 'labels') && 'swp--' + look, className),
364
+ className: cx('gk-swp', (look === 'icons' || look === 'labels') && 'gk-swp--' + look, className),
365
365
  },
366
- h('div', { className: 'swp__main', tabIndex: 0, 'aria-label': label || undefined, 'aria-keyshortcuts': 'ArrowLeft ArrowRight' }, children),
367
- h('div', { className: 'swp__acts swp__acts--start' }, start.map(swipeAct)),
368
- h('div', { className: 'swp__acts swp__acts--end' }, [...end].reverse().map(swipeAct)));
366
+ h('div', { className: 'gk-swp__main', tabIndex: 0, 'aria-label': label || undefined, 'aria-keyshortcuts': 'ArrowLeft ArrowRight' }, children),
367
+ h('div', { className: 'gk-swp__acts gk-swp__acts--start' }, start.map(swipeAct)),
368
+ h('div', { className: 'gk-swp__acts gk-swp__acts--end' }, [...end].reverse().map(swipeAct)));
369
369
  });
370
370
 
371
371
  const SWIPE_OPTS = ['full', 'fullAt', 'single', 'haptic', 'keepRows', 'onAction', 'onOpen', 'onClose'];
372
372
  /**
373
- * <SwipeActions className="card card--flush" onAction={(action, ctx) => …}>{rows.map((r) => <SwipeItem key={r.id} …/>)}</SwipeActions>
373
+ * <SwipeActions className="gk-card gk-card--flush" onAction={(action, ctx) => …}>{rows.map((r) => <SwipeItem key={r.id} …/>)}</SwipeActions>
374
374
  * Same as swipeActions(list, options) on the element it renders. A row whose action has remove: true slides off and
375
375
  * is hidden (React still owns it: drop it from your list when you are done, or call ctx.undo() to bring it back).
376
376
  * onAction(action, ctx, sw) — ctx: { row, id, action, undo() }; return false to keep the row. onOpen(row, side) · onClose(row).
@@ -400,7 +400,7 @@ export const SwipeActions = forwardRef(function SwipeActions({ as, children, ...
400
400
 
401
401
  const KanbanInner = mounted('Kanban', (el, o) => {
402
402
  const opts = without(o, ['slots', 'react']);
403
- if (o.react) opts.render = (c) => `<div class="kb__r" data-kb-r="${C.esc(String(c.id))}" style="display:contents"></div>`;
403
+ if (o.react) opts.render = (c) => `<div class="gk-kb__r" data-kb-r="${C.esc(String(c.id))}" style="display:contents"></div>`;
404
404
  const kb = C.kanban(el, opts);
405
405
  note(kb).scan = () => o.slots?.(slotMap([...kb.el.querySelectorAll('[data-kb-r]')].map((x) => [x.dataset.kbR, x])));
406
406
  if (o.react) note(kb).scan();
@@ -573,7 +573,7 @@ export const Skeleton = forwardRef(function Skeleton({ children, loading = true,
573
573
 
574
574
  const AlertInner = mounted('Alert', (el, o) => {
575
575
  const box = document.createElement('div');
576
- box.className = 'al__node'; box.style.display = 'contents';
576
+ box.className = 'gk-al__node'; box.style.display = 'contents';
577
577
  const a = C.alert(el, { ...takeTitle(without(o, ['slots', 'hasBody'])), body: o.hasBody ? box : '' });
578
578
  note(a).box = box;
579
579
  o.slots?.(slotMap([['body', box]]));