@gecko-ui-kit/vue 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/README.md CHANGED
@@ -63,6 +63,40 @@ function book() { open.value = false; toast('Booked!') }
63
63
  **Plain Vue (Vite):** import the same CSS files in `main.ts` and call `app.use(GeckoUI)`, or import each component
64
64
  where you use it: `import { Button, Modal } from '@gecko-ui-kit/vue'`.
65
65
 
66
+ ## Fit it into an app that already has its own look
67
+
68
+ - **Nothing clashes.** Every class Gecko draws starts with `gk-` (`gk-btn`, `gk-card`, `gk-is-open`) and every CSS
69
+ variable with `--gk-` (`--gk-accent`), so your own `.btn`, `.card` or `--accent` keep working as before.
70
+ - **The reset stays inside Gecko.** `tokens/style.css` only resets Gecko's own elements; your `body`, links and buttons
71
+ are left alone. Want Gecko to set the page font, background and focus ring too? Add `@gecko-ui-kit/tokens/page.css`.
72
+ - **Match your theme** by setting variables after the imports (e.g. in `~/assets/main.css`):
73
+
74
+ ```css
75
+ :root {
76
+ --gk-font: 'Prompt', system-ui, sans-serif;
77
+ --gk-bg: #eef1f6; --gk-card: #ffffff; --gk-line: #e2e6ee; --gk-ink: #1a1a1a; --gk-muted: #595959;
78
+ --gk-accent: #006ce4; --gk-accent-2: #0057b8; --gk-accent-soft: #ebf3ff; /* main buttons, links, focus */
79
+ --gk-selected: #ffb700; --gk-selected-ink: #1a1a1a; /* the chosen segment, chip, tab line and page */
80
+ --gk-r-card: 14px; --gk-r-btn: 10px; --gk-r-field: 10px; --gk-r-tag: 6px; --gk-r-badge: 6px; --gk-r-pill: 10px;
81
+ --gk-w-strong: 500; --gk-w-semibold: 600; /* lighter buttons and labels */
82
+ }
83
+ ```
84
+ Corners: `--gk-r-btn`, `--gk-r-iconbtn`, `--gk-r-field`, `--gk-r-chip`, `--gk-r-check`, `--gk-r-tag`, `--gk-r-badge`,
85
+ `--gk-r-pill` (segmented), `--gk-r-card`, `--gk-r-kpi`, `--gk-r-pop`, `--gk-r-toast`. Weights: `--gk-w-light` 300,
86
+ `--gk-w-medium` 500, `--gk-w-label` 550, `--gk-w-semibold` 600, `--gk-w-strong` 650, `--gk-w-bold` 700, `--gk-w-heavy` 750,
87
+ `--gk-w-black` 800. `--gk-selected` / `--gk-selected-ink` are unset by default (each piece keeps its own look).
88
+
89
+ ## Phone apps (PWA, Capacitor)
90
+
91
+ The kit works in a phone app made from your Nuxt site: a PWA, or the site wrapped by Capacitor. Let the page run
92
+ under the notch and home bar, and the app frame, phone sheets, toasts and tab bar keep clear of them on their own:
93
+ ```js
94
+ // nuxt.config.ts
95
+ app: { head: { meta: [{ name: 'viewport', content: 'width=device-width, initial-scale=1, viewport-fit=cover' }] } }
96
+ ```
97
+ The room comes from `--gk-safe-t`, `--gk-safe-r`, `--gk-safe-b`, `--gk-safe-l` (0 on desktop); set them yourself if
98
+ your native shell already pads for the notch. NativeScript-Vue does not draw with HTML and CSS, so the kit does not run there.
99
+
66
100
  ## How the components behave
67
101
 
68
102
  - **Same look as the vanilla kit.** Each component draws the same HTML (same classes) as its vanilla piece, or runs the
@@ -189,7 +223,7 @@ A white panel with an optional head (title, small line, things on the right); `l
189
223
  ### Kpi
190
224
  A number tile: a caption, a big value and a small line.
191
225
  ```vue
192
- <div class="kpis">
226
+ <div class="gk-kpis">
193
227
  <Kpi label="Bikes out" :value="12" sub="of 20" />
194
228
  <Kpi label="Revenue" value="฿48,250" sub="This month" tone="good" />
195
229
  </div>
@@ -206,7 +240,7 @@ What to show when a list has nothing in it.
206
240
  - `icon` (default `inbox`), `title`, `body`: props or `#title` / `#body` slots · `#action`: a button under the text
207
241
 
208
242
  ### Table
209
- A table styled by `.table`, inside `.table-wrap` so it scrolls sideways on phones. Give it columns and rows (and draw cells with slots), or write the `<thead>`/`<tbody>` yourself.
243
+ A table styled by `.gk-table`, inside `.gk-table-wrap` so it scrolls sideways on phones. Give it columns and rows (and draw cells with slots), or write the `<thead>`/`<tbody>` yourself.
210
244
  ```vue
211
245
  <script setup>
212
246
  const columns = [{ key: 'rider', title: 'Rider' }, { key: 'status', title: 'Status' }, { key: 'days', title: 'Days', align: 'right' }];
@@ -216,7 +250,7 @@ const columns = [{ key: 'rider', title: 'Rider' }, { key: 'status', title: 'Stat
216
250
  <Table :rows="bookings" :columns="columns" row-key="id" slide-rows>
217
251
  <template #cell-rider="{ row }"><Cell :name="row.rider" :sub="row.phone" /></template>
218
252
  <template #cell-status="{ row }"><Tag :tone="row.paid ? 'good' : 'warn'">{{ row.paid ? 'Paid' : 'Unpaid' }}</Tag></template>
219
- <template #foot><tr><td>Total</td><td></td><td class="r">{{ totalDays }}</td></tr></template>
253
+ <template #foot><tr><td>Total</td><td></td><td class="gk-r">{{ totalDays }}</td></tr></template>
220
254
  </Table>
221
255
  </Card>
222
256
  </template>
@@ -264,7 +298,7 @@ A label above a control and a small hint under it.
264
298
  - `label`, `hint`: text props or `#label` / `#hint` slots · `invalid`: red border and hint · default slot: the control
265
299
 
266
300
  ### Input
267
- A text box with the kit's look: an `<input class="input">`.
301
+ A text box with the kit's look: an `<input class="gk-input">`.
268
302
  ```vue
269
303
  <Input v-model.trim="email" type="email" placeholder="you@shop.com" size="sm" @blur="checkEmail" />
270
304
  ```
@@ -292,7 +326,8 @@ A row of options where exactly one is picked; the thumb stretches to the new cho
292
326
  ```vue
293
327
  <Segmented v-model="view" :options="[['list', 'List', 'list'], ['board', 'Board', 'cards']]" />
294
328
  ```
295
- - `options`: `[value, label, icon?]`, `{ value, label, icon, disabled }` or strings · `v-model` / `default-value` · `@change(value, event)` · `size: 'sm'`
329
+ - `options`: `[value, label, icon?, count?]`, `{ value, label, icon, count, disabled }` or strings · `v-model` / `default-value` · `@change(value, event)` · `size: 'sm'`
330
+ - `count` — a number after the label, e.g. `['free', 'Free', null, 4]` shows **Free 4**
296
331
 
297
332
  ### normOption
298
333
  Turns any option form (`['id', 'Label', 'icon']`, `{ value, label }`, `'id'`) into `{ value, label, icon, disabled }`, for your own option lists.
@@ -365,7 +400,7 @@ A code field with one box per character: typing moves on, Backspace goes back, p
365
400
  ```
366
401
  - `length` (6), `split`, `mask` (PIN dots), `letters` (A–Z too), `label`, `name`
367
402
  - `@complete(code, el)`: return / resolve `true` (green wave, then a tick) or `false` (shake, then clear) · `gather`, `clear`
368
- - `v-model` / `default-value`, `@change(code)` as it is typed · `disabled` · `autofocus` · the template ref's `$el` is the `.otp` element (`otpState` / `otpClear` work on it)
403
+ - `v-model` / `default-value`, `@change(code)` as it is typed · `disabled` · `autofocus` · the template ref's `$el` is the `.gk-otp` element (`otpState` / `otpClear` work on it)
369
404
 
370
405
  ## Forms
371
406
 
@@ -462,7 +497,7 @@ async function join(email) {
462
497
  ### PasswordMeter
463
498
  A password field with the strength meter after it: bars, a checklist that ticks off and a padlock.
464
499
  ```vue
465
- <div class="field">
500
+ <div class="gk-field">
466
501
  <label for="team-pw">Password for the team account</label>
467
502
  <PasswordMeter id="team-pw" v-model="pw" reveal :min="10" @change="(s) => (canSave = s.valid)" />
468
503
  </div>
@@ -578,7 +613,7 @@ const steps = [
578
613
  <template>
579
614
  <Wizard :steps="steps" :words="{ finish: 'Book' }" @finish="(values) => book(values)">
580
615
  <template #bike><BikePicker /></template>
581
- <template #rider><label class="field"><span>Phone</span><input class="input" name="phone" required /></label></template>
616
+ <template #rider><label class="gk-field"><span>Phone</span><input class="gk-input" name="phone" required /></label></template>
582
617
  <template #pay><PaymentStep /></template>
583
618
  </Wizard>
584
619
  </template>
@@ -589,7 +624,7 @@ const steps = [
589
624
  - Without `validate`, the browser's own checks run on the step's fields (`required`, `type="email"`…)
590
625
 
591
626
  ### useValidation
592
- The red-field pattern from the Validation page (`.field.is-bad`, the reason in `.field__hint`, a small shake) as a composable.
627
+ The red-field pattern from the Validation page (`.gk-field.gk-is-bad`, the reason in `.gk-field__hint`, a small shake) as a composable.
593
628
  It is a pattern, not a piece: you draw the fields, the composable keeps the messages.
594
629
  ```vue
595
630
  <script setup>
@@ -602,8 +637,8 @@ const v = useValidation({
602
637
  <template>
603
638
  <label :class="['field', { 'is-bad': v.errors.email }]">
604
639
  <span>Email</span>
605
- <input class="input" type="email" v-bind="v.field('email')" />
606
- <small class="field__hint">{{ v.errors.email || 'We send one email when we launch.' }}</small>
640
+ <input class="gk-input" type="email" v-bind="v.field('email')" />
641
+ <small class="gk-field__hint">{{ v.errors.email || 'We send one email when we launch.' }}</small>
607
642
  </label>
608
643
  <Button variant="primary" @click="v.validate() && join(v.values())">Join the waitlist</Button>
609
644
  </template>
@@ -744,7 +779,7 @@ A month of days with your events on them. Drag an event to another day.
744
779
  Rows you swipe left or right to show actions behind them, like a phone's mail app.
745
780
 
746
781
  ```vue
747
- <SwipeActions class="card card--flush" @action="(action, ctx) => action === 'cancel' && cancelBooking(ctx.id)">
782
+ <SwipeActions class="gk-card gk-card--flush" @action="(action, ctx) => action === 'cancel' && cancelBooking(ctx.id)">
748
783
  <SwipeItem v-for="b in bookings" :key="b.id" :id="b.id"
749
784
  :start="[{ id: 'call', label: 'Call', icon: 'phone', tone: 'accent' }]"
750
785
  :end="[{ id: 'cancel', label: 'Cancel', icon: 'trash', tone: 'bad', remove: true }]">
@@ -1089,7 +1124,7 @@ A slanted band of light sweeps across the letters, like light on a shiny sign. T
1089
1124
 
1090
1125
  - `look` (`'gradient'` | `'ink'` | `'color'`), `trigger` (`'loop'` | `'view'` | `'hover'`).
1091
1126
  - `duration` (1.4), `repeat-delay` (1.8), `delay`, `ease`, `angle` (110°), `width` (12), `color`, `as` (`'span'`).
1092
- - CSS only, no Vue needed: `<span class="shine shine--ink shine--loop">…</span>`.
1127
+ - CSS only, no Vue needed: `<span class="gk-shine gk-shine--ink gk-shine--loop">…</span>`.
1093
1128
 
1094
1129
  ### Highlighter
1095
1130
 
@@ -1161,7 +1196,7 @@ const read = ref(0);
1161
1196
  ```
1162
1197
 
1163
1198
  - `root` — the scrolling box (element, template ref or selector; default the page). `@change(progress)` with 0…1.
1164
- - Colour and height: `--scroll-progress-c`, `--scroll-progress-h`.
1199
+ - Colour and height: `--gk-scroll-progress-c`, `--gk-scroll-progress-h`.
1165
1200
 
1166
1201
  ### Odometer
1167
1202
 
@@ -1183,7 +1218,7 @@ A number that counts up on mount, and from the number on screen to the new one w
1183
1218
 
1184
1219
  ```vue
1185
1220
  <template>
1186
- <div class="kpi"><small>Revenue today</small><b><CountUp :value="stats.revenue" prefix="฿" tick /></b></div>
1221
+ <div class="gk-kpi"><small>Revenue today</small><b><CountUp :value="stats.revenue" prefix="฿" tick /></b></div>
1187
1222
  <CountUp :value="4.8" :decimals="1" suffix=" / 5" />
1188
1223
  </template>
1189
1224
  ```
@@ -1200,7 +1235,7 @@ Children that arrive one after another: they fade in and float up (or slide, or
1200
1235
 
1201
1236
  ```vue
1202
1237
  <template>
1203
- <Rise class="grid" :stagger="0.05">
1238
+ <Rise class="gk-grid" :stagger="0.05">
1204
1239
  <BikeCard v-for="bike in bikes" :key="bike.id" :bike="bike" />
1205
1240
  </Rise>
1206
1241
 
@@ -1228,7 +1263,7 @@ The element leans toward the pointer and springs back when it leaves (mouse and
1228
1263
  ```
1229
1264
 
1230
1265
  - `strength` (0.2) and `strength-y` (0.28): how far it follows the pointer; `magnet` multiplies it for this element.
1231
- - It renders an inline-block `<span class="magnetic">` around your content; `as="a"` makes the element itself magnetic.
1266
+ - It renders an inline-block `<span class="gk-magnetic">` around your content; `as="a"` makes the element itself magnetic.
1232
1267
 
1233
1268
  ### Lift
1234
1269
 
@@ -1236,7 +1271,7 @@ The element rises a few pixels while the pointer is over it (mouse and trackpad
1236
1271
 
1237
1272
  ```vue
1238
1273
  <template>
1239
- <Lift as="article" :y="-6" class="card">
1274
+ <Lift as="article" :y="-6" class="gk-card">
1240
1275
  <h3>Old town tour</h3>
1241
1276
  <p>2 hours · 3 stops</p>
1242
1277
  </Lift>
@@ -1251,7 +1286,7 @@ A card that leans toward the pointer in 3D, with a soft glare; children with `da
1251
1286
 
1252
1287
  ```vue
1253
1288
  <template>
1254
- <Tilt :max="10" glare as="article" class="card">
1289
+ <Tilt :max="10" glare as="article" class="gk-card">
1255
1290
  <img data-depth="40" :src="bike.photo" :alt="bike.name" />
1256
1291
  <h3 data-depth="20">{{ bike.name }}</h3>
1257
1292
  </Tilt>
@@ -1268,7 +1303,7 @@ A soft light follows the pointer across a group of cards and lights up their edg
1268
1303
  ```vue
1269
1304
  <template>
1270
1305
  <Spotlight class="plans" :size="300">
1271
- <div v-for="plan in plans" :key="plan.id" class="card">
1306
+ <div v-for="plan in plans" :key="plan.id" class="gk-card">
1272
1307
  <h3>{{ plan.name }}</h3>
1273
1308
  <p>{{ plan.price }} ฿ / day</p>
1274
1309
  </div>
@@ -1294,7 +1329,7 @@ const strip = ref(null); // strip.value.pause(), .play(), .toggle(), .pause
1294
1329
  <Marquee ref="strip" aria-label="Shops that ride with us" :speed="50" :gap="48" :button="pause">
1295
1330
  <img v-for="p in partners" :key="p.id" :src="p.logo" :alt="p.name" height="28" />
1296
1331
  </Marquee>
1297
- <button ref="pause" class="btn btn--sm">⏸</button>
1332
+ <button ref="pause" class="gk-btn gk-btn--sm">⏸</button>
1298
1333
  </template>
1299
1334
  ```
1300
1335
 
@@ -1316,14 +1351,14 @@ const page = ref('bikes');
1316
1351
  </script>
1317
1352
 
1318
1353
  <template>
1319
- <Indicator as="nav" :active="page" :radius="99" class="menu" style="display: flex; gap: 4px">
1354
+ <Indicator as="nav" :active="page" :radius="99" class="gk-menu" style="display: flex; gap: 4px">
1320
1355
  <button v-for="p in ['today', 'bikes', 'returns']" :key="p" type="button"
1321
1356
  :aria-current="page === p ? 'page' : undefined" @click="page = p">{{ p }}</button>
1322
1357
  </Indicator>
1323
1358
  </template>
1324
1359
  ```
1325
1360
 
1326
- - The active item is the child with `aria-current`, `aria-selected="true"`, `aria-pressed="true"` or `.is-active` (`selector` to change).
1361
+ - The active item is the child with `aria-current`, `aria-selected="true"`, `aria-pressed="true"` or `.gk-is-active` (`selector` to change).
1327
1362
  - `radius` (13; 99 = round ends), `line` (an underline), `lead` / `trail` / `cross` (seconds per edge).
1328
1363
  - `pill-class` / `pill-style` style the pill (with `pill-class` the accent background is left off).
1329
1364
 
@@ -1340,8 +1375,8 @@ const pill = useIndicator(view, { radius: 99 });
1340
1375
  </script>
1341
1376
 
1342
1377
  <template>
1343
- <nav class="menu">
1344
- <span ref="pill" class="menu__pill" />
1378
+ <nav class="gk-menu">
1379
+ <span ref="pill" class="gk-menu__pill" />
1345
1380
  <button v-for="v in ['day', 'week', 'month']" :key="v" :aria-pressed="String(view === v)" @click="view = v">{{ v }}</button>
1346
1381
  </nav>
1347
1382
  </template>
@@ -1355,14 +1390,14 @@ A page transition: when `swap-key` changes, the old page steps back and fades, t
1355
1390
 
1356
1391
  ```vue
1357
1392
  <template>
1358
- <PageSwap :swap-key="route.path" :dir="forward ? 1 : -1" @swap="(view) => rise(view.querySelectorAll('.card'))">
1393
+ <PageSwap :swap-key="route.path" :dir="forward ? 1 : -1" @swap="(view) => rise(view.querySelectorAll('.gk-card'))">
1359
1394
  <RouterView />
1360
1395
  </PageSwap>
1361
1396
  </template>
1362
1397
  ```
1363
1398
 
1364
1399
  - `dir` — 1 forward (new page from the right), -1 back.
1365
- - `leave` — blocks that fade and drop on the way out (`.card, .kpi, .lane, [data-swap]`); `head` — header parts that lift away.
1400
+ - `leave` — blocks that fade and drop on the way out (`.gk-card, .gk-kpi, .lane, [data-swap]`); `head` — header parts that lift away.
1366
1401
  - `timing` — `{ out, in, shift, enter }` for this swap only. `@swap(view)` runs once the new page is in.
1367
1402
 
1368
1403
  ### useFeedback · useFlash · useTick
@@ -1587,6 +1622,7 @@ const editBtn = ref(null);
1587
1622
  - `v-model:open`, `@close` — closing from inside (✕, scrim, Esc) sets `open` to false, then calls `@close`.
1588
1623
  - `title`, `sub` — text props, or `#title` / `#sub` slots for richer content; they may change while it is open.
1589
1624
  - `size` — `''`, `'sm'` or `'lg'`. `anchor` — element, template ref or component it zooms out of.
1625
+ - `words` — `{ close }`, the ✕ button's label for screen readers (default `'Close'`), e.g. `:words="{ close: 'ปิด' }"`.
1590
1626
  - Slots: default (the body), `#footer` (buttons at the bottom), `#title`, `#sub`.
1591
1627
 
1592
1628
  ### Drawer
@@ -1595,13 +1631,13 @@ A panel that slides in from the side (a bottom sheet on phones); its content dri
1595
1631
 
1596
1632
  ```vue
1597
1633
  <Drawer v-model:open="riderOpen" :title="rider.name" :sub="'Rider since ' + rider.since" side="right">
1598
- <template #head><span class="av av--teal">{{ rider.initials }}</span></template>
1634
+ <template #head><span class="gk-av gk-av--teal">{{ rider.initials }}</span></template>
1599
1635
  <RiderBookings :id="rider.id" />
1600
1636
  <template #footer><Button variant="primary">Message</Button></template>
1601
1637
  </Drawer>
1602
1638
  ```
1603
1639
 
1604
- - `v-model:open`, `@close`, `title`, `sub` — as in Modal.
1640
+ - `v-model:open`, `@close`, `title`, `sub`, `words` — as in Modal.
1605
1641
  - `head` — something before the title (text prop, or the `#head` slot for an avatar). `side` — `'right'` (default) or `'left'`.
1606
1642
  - Opening a drawer closes any other drawer (its `open` turns false and its `@close` runs).
1607
1643
  - Slots: default (the body), `#head`, `#title`, `#sub`, `#footer`.
@@ -1706,7 +1742,7 @@ A small label that fades in under (or beside) an element on hover or keyboard fo
1706
1742
  <Tooltip text="Edit booking"><IconButton icon="edit" label="Edit booking" /></Tooltip>
1707
1743
  <Tooltip side="right">
1708
1744
  <template #text>Somchai K.<br />Mechanic</template>
1709
- <span class="av av--teal" tabindex="0">SK</span>
1745
+ <span class="gk-av gk-av--teal" tabindex="0">SK</span>
1710
1746
  </Tooltip>
1711
1747
  ```
1712
1748
 
@@ -1761,7 +1797,7 @@ import { useLoadingBar } from '@gecko-ui-kit/vue';
1761
1797
  const saving = ref(false);
1762
1798
 
1763
1799
  // or by hand
1764
- const bar = useLoadingBar({ color: 'var(--good)' });
1800
+ const bar = useLoadingBar({ color: 'var(--gk-good)' });
1765
1801
  async function save() { bar.start(); try { await api.save(booking); bar.done(); } catch { bar.fail(); } }
1766
1802
  </script>
1767
1803
 
@@ -1812,7 +1848,7 @@ const steps = [
1812
1848
  </script>
1813
1849
 
1814
1850
  <template>
1815
- <button ref="searchBtn" class="btn">Search</button>
1851
+ <button ref="searchBtn" class="gk-btn">Search</button>
1816
1852
  <Tour v-model:open="touring" :steps="steps" @end="(finished) => finished && markTourSeen()">
1817
1853
  <template #drag><p>Drag a booking to <b>move</b> it to another bike.</p></template>
1818
1854
  </Tour>
@@ -1864,7 +1900,7 @@ The no-state version: wrap links to big images and clicking one opens its whole
1864
1900
 
1865
1901
  ### AppShell
1866
1902
 
1867
- The whole frame around your pages: Sidebar, Topbar, the page in `<main class="view">`, the phone tab bar, the ⌘K
1903
+ The whole frame around your pages: Sidebar, Topbar, the page in `<main class="gk-view">`, the phone tab bar, the ⌘K
1868
1904
  palette, keyboard shortcuts and the opening animation. When the path changes, the new page slides in from the
1869
1905
  direction of travel. It works with Nuxt and vue-router: give it the current path and a way to navigate.
1870
1906
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gecko-ui-kit/vue",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Every Gecko UI Kit piece as a Vue 3 component (Nuxt ready): buttons, forms, pickers, data display, charts, motion, overlays and the app shell.",
5
5
  "keywords": [
6
6
  "vue",
@@ -33,12 +33,12 @@
33
33
  "README.md"
34
34
  ],
35
35
  "dependencies": {
36
- "@gecko-ui-kit/tokens": "^0.1.0",
37
- "@gecko-ui-kit/icons": "^0.3.0",
38
- "@gecko-ui-kit/motion": "^0.9.1",
39
- "@gecko-ui-kit/components": "^0.21.1",
40
- "@gecko-ui-kit/overlays": "^0.6.1",
41
- "@gecko-ui-kit/shell": "^0.2.3"
36
+ "@gecko-ui-kit/tokens": "^0.3.0",
37
+ "@gecko-ui-kit/icons": "^0.4.0",
38
+ "@gecko-ui-kit/motion": "^0.10.0",
39
+ "@gecko-ui-kit/components": "^0.23.0",
40
+ "@gecko-ui-kit/overlays": "^0.8.0",
41
+ "@gecko-ui-kit/shell": "^0.4.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "gsap": "^3.12.0",
package/src/actions.d.ts CHANGED
@@ -136,7 +136,7 @@ export interface SpeedDialProps {
136
136
  side?: 'right' | 'left';
137
137
  /** false = icons only (default true). */
138
138
  labels?: boolean;
139
- /** Pinned to the corner of the screen (--sd-x / --sd-y set the gap). */
139
+ /** Pinned to the corner of the screen (--gk-sd-x / --gk-sd-y set the gap). */
140
140
  fixed?: boolean;
141
141
  /** The main button's icon (default 'plus'; it turns into an ×). */
142
142
  icon?: string;
package/src/actions.js CHANGED
@@ -22,9 +22,9 @@ function handleOf(cur) {
22
22
  });
23
23
  }
24
24
 
25
- const TONES = { accent: 'var(--accent)', good: 'var(--good)', warn: 'var(--warn)', bad: 'var(--bad)' };
25
+ const TONES = { accent: 'var(--gk-accent)', good: 'var(--gk-good)', warn: 'var(--gk-warn)', bad: 'var(--gk-bad)' };
26
26
  const HUES = ['indigo', 'teal', 'rose', 'amber', 'violet', 'green', 'slate', 'sky'];
27
- const toColor = (t) => (!t ? '' : TONES[t] || (HUES.includes(t) ? `var(--hue-${t})` : String(t)));
27
+ const toColor = (t) => (!t ? '' : TONES[t] || (HUES.includes(t) ? `var(--gk-hue-${t})` : String(t)));
28
28
  const wordsKey = (w) => JSON.stringify(snap(w) || {}); // the text words (functions are read live or ignored)
29
29
  const isThenable = (r) => !!r && typeof r.then === 'function';
30
30
  /* After a promise from onChange fails, the vanilla piece switches back: tell v-model about it too. */
@@ -122,20 +122,20 @@ export const LikeButton = defineComponent({
122
122
  const c = toColor(props.tone);
123
123
  return h('button', {
124
124
  key: shape, ref: btn, type: 'button',
125
- class: ['lk', 'lk--' + k, iconOnly && 'lk--icon', props.size && 'lk--' + props.size],
125
+ class: ['gk-lk', 'gk-lk--' + k, iconOnly && 'gk-lk--icon', props.size && 'gk-lk--' + props.size],
126
126
  'aria-pressed': String(st.on), 'data-kind': k, 'data-label': L, 'data-on-label': OL || undefined, 'data-count': hasCount ? st.n : undefined,
127
- style: c ? { '--lk-c': c } : undefined,
127
+ style: c ? { '--gk-lk-c': c } : undefined,
128
128
  ...(iconOnly ? { 'aria-label': st.aria } : null),
129
129
  }, [
130
- h('span', { class: 'lk__icon', 'aria-hidden': 'true' }, [
131
- k === 'bookmark' ? null : h('span', { class: 'lk__ring' }),
132
- h('span', { class: 'lk__bits' }, Array.from({ length: k === 'bookmark' ? 4 : 8 }, () => h('i'))),
133
- h('span', { class: 'lk__glyph' }, [h('span', { class: 'lk__line' }, [lkSvg(k)]), h('span', { class: 'lk__solid' }, [lkSvg(k)])]),
130
+ h('span', { class: 'gk-lk__icon', 'aria-hidden': 'true' }, [
131
+ k === 'bookmark' ? null : h('span', { class: 'gk-lk__ring' }),
132
+ h('span', { class: 'gk-lk__bits' }, Array.from({ length: k === 'bookmark' ? 4 : 8 }, () => h('i'))),
133
+ h('span', { class: 'gk-lk__glyph' }, [h('span', { class: 'gk-lk__line' }, [lkSvg(k)]), h('span', { class: 'gk-lk__solid' }, [lkSvg(k)])]),
134
134
  ].filter(Boolean)),
135
135
  ...(iconOnly ? [] : [
136
- swap ? h('span', { class: 'lk__sr' }, L) : null,
137
- h('span', { class: 'lk__label', 'aria-hidden': swap ? 'true' : undefined }, st.on && swap ? OL : L),
138
- hasCount ? h('span', { class: 'lk__count' }, [h('span', { class: 'lk__num' }, st.num)]) : null,
136
+ swap ? h('span', { class: 'gk-lk__sr' }, L) : null,
137
+ h('span', { class: 'gk-lk__label', 'aria-hidden': swap ? 'true' : undefined }, st.on && swap ? OL : L),
138
+ hasCount ? h('span', { class: 'gk-lk__count' }, [h('span', { class: 'gk-lk__num' }, st.num)]) : null,
139
139
  ].filter(Boolean)),
140
140
  ]);
141
141
  };
@@ -206,16 +206,16 @@ export const BellSwitch = defineComponent({
206
206
  const name = props.label ?? w.label;
207
207
  return h('button', {
208
208
  key: st.shape, ref: btn, type: 'button', role: 'switch',
209
- class: ['nbell', iconOnly && 'nbell--icon'],
209
+ class: ['gk-nbell', iconOnly && 'gk-nbell--icon'],
210
210
  'aria-checked': String(st.on),
211
211
  ...(iconOnly ? { 'aria-label': name } : { 'aria-labelledby': id }),
212
212
  'data-on-text': w.on, 'data-off-text': w.off,
213
- style: c ? { '--nb-c': c } : undefined,
213
+ style: c ? { '--gk-nb-c': c } : undefined,
214
214
  }, [
215
- h('span', { class: 'nbell__icon', innerHTML: bellSvg(st.on) }),
216
- iconOnly ? null : h('span', { class: 'nbell__text' }, [
217
- h('b', { class: 'nbell__label', id }, slots.label ? slots.label() : name),
218
- h('small', { class: 'nbell__state', 'aria-hidden': 'true' }, [h('span', null, st.on ? w.on : w.off)]),
215
+ h('span', { class: 'gk-nbell__icon', innerHTML: bellSvg(st.on) }),
216
+ iconOnly ? null : h('span', { class: 'gk-nbell__text' }, [
217
+ h('b', { class: 'gk-nbell__label', id }, slots.label ? slots.label() : name),
218
+ h('small', { class: 'gk-nbell__state', 'aria-hidden': 'true' }, [h('span', null, st.on ? w.on : w.off)]),
219
219
  ]),
220
220
  ].filter(Boolean));
221
221
  };
@@ -226,7 +226,7 @@ export const BellButton = BellSwitch;
226
226
 
227
227
  /* ------------------------------------------------------------------ PayButton */
228
228
  const PAY_WORDS = { label: 'Pay now', busy: 'Processing', done: 'Paid', retry: 'Try again' };
229
- const PAY_STATES = ['is-busy', 'is-done', 'is-failed'];
229
+ const PAY_STATES = ['gk-is-busy', 'gk-is-done', 'gk-is-failed'];
230
230
 
231
231
  /**
232
232
  * <PayButton block @pay="() => checkout(cart)" @done="(receipt) => show(receipt)" @fail="(e) => …">Pay <b>฿{{ total }}</b></PayButton>
@@ -246,13 +246,13 @@ export const PayButton = defineComponent({
246
246
  const proxy = handleOf(cur);
247
247
  expose(proxy);
248
248
  const W = computed(() => ({ ...PAY_WORDS, ...snap(props.words) }));
249
- const cls = () => normalizeClass(['btn', props.variant && 'btn--' + props.variant, props.size && 'btn--' + props.size, props.block && 'btn--block', 'pay']);
249
+ const cls = () => normalizeClass(['gk-btn', props.variant && 'gk-btn--' + props.variant, props.size && 'gk-btn--' + props.size, props.block && 'gk-btn--block', 'gk-pay']);
250
250
 
251
251
  /* the vanilla code's state classes (is-busy…), put back after Vue wrote a new class list */
252
252
  const states = () => {
253
253
  const x = cur.current, b = btn.value; if (!x || !b) return;
254
- PAY_STATES.forEach((c) => b.classList.toggle(c, c === 'is-' + (x.state === 'failed' ? 'failed' : x.state)));
255
- b.classList.toggle('is-still', x.state === 'busy' && M.RM());
254
+ PAY_STATES.forEach((c) => b.classList.toggle(c, c === 'gk-is-' + (x.state === 'failed' ? 'failed' : x.state)));
255
+ b.classList.toggle('gk-is-still', x.state === 'busy' && M.RM());
256
256
  };
257
257
  const wire = () => {
258
258
  cur.current = C.payButton(btn.value, {
@@ -281,16 +281,16 @@ export const PayButton = defineComponent({
281
281
  const w = W.value;
282
282
  const label = slots.label ? slots.label() : slots.default ? slots.default() : props.label ?? w.label;
283
283
  return h('button', { ref: btn, type: 'button', class: cls() }, [
284
- h('span', { class: 'pay__face pay__idle' }, [iconNode(props.icon || null), h('span', { class: 'pay__label' }, label)].filter(Boolean)),
285
- h('span', { class: 'pay__face pay__busy', 'aria-hidden': 'true' }, [h('span', null, w.busy), h('span', { class: 'pay__dots' }, [h('i'), h('i'), h('i')])]),
286
- h('span', { class: 'pay__face pay__done', 'aria-hidden': 'true' }, [
287
- h('svg', { class: 'pay__tick', viewBox: '0 0 24 24', 'aria-hidden': 'true', focusable: 'false' },
284
+ h('span', { class: 'gk-pay__face gk-pay__idle' }, [iconNode(props.icon || null), h('span', { class: 'gk-pay__label' }, label)].filter(Boolean)),
285
+ h('span', { class: 'gk-pay__face gk-pay__busy', 'aria-hidden': 'true' }, [h('span', null, w.busy), h('span', { class: 'gk-pay__dots' }, [h('i'), h('i'), h('i')])]),
286
+ h('span', { class: 'gk-pay__face gk-pay__done', 'aria-hidden': 'true' }, [
287
+ h('svg', { class: 'gk-pay__tick', viewBox: '0 0 24 24', 'aria-hidden': 'true', focusable: 'false' },
288
288
  [h('path', { d: 'm5 12.5 4.5 4.5L19 7.5', pathLength: 1, 'stroke-dasharray': '1 2', 'stroke-dashoffset': 1 })]),
289
289
  h('span', null, w.done),
290
290
  ]),
291
- h('span', { class: 'pay__face pay__fail', 'aria-hidden': 'true' }, [h(Icon, { name: 'alert' }), h('span', null, w.retry)]),
292
- h('span', { class: 'pay__slot', 'aria-hidden': 'true' }, [h('i')]),
293
- h('span', { class: 'pay__card', 'aria-hidden': 'true' }),
291
+ h('span', { class: 'gk-pay__face gk-pay__fail', 'aria-hidden': 'true' }, [h(Icon, { name: 'alert' }), h('span', null, w.retry)]),
292
+ h('span', { class: 'gk-pay__slot', 'aria-hidden': 'true' }, [h('i')]),
293
+ h('span', { class: 'gk-pay__card', 'aria-hidden': 'true' }),
294
294
  ]);
295
295
  };
296
296
  },
package/src/basics.d.ts CHANGED
@@ -188,7 +188,7 @@ export interface TableProps<R = any> {
188
188
  rows?: R[];
189
189
  /** A field name or function giving each row a stable key (default 'id'). */
190
190
  rowKey?: string | ((row: R, index: number) => string | number);
191
- /** Wrap in .table-wrap so it scrolls sideways on small screens (default true). */
191
+ /** Wrap in .gk-table-wrap so it scrolls sideways on small screens (default true). */
192
192
  wrap?: boolean;
193
193
  /** Rows slide in when they first appear (also rows added later). */
194
194
  slideRows?: boolean;