@cosborn2/ui 0.4.6 → 0.4.8

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.
@@ -1,10 +1,34 @@
1
1
  @layer components {
2
2
  .bnh-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-family: var(--bnh-font-sans, inherit); }
3
3
  .bnh-switch-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
4
- .bnh-switch-track { box-sizing: border-box; position: relative; width: var(--bnh-switch-width, 36px); height: var(--bnh-switch-height, 20px); flex-shrink: 0; border: 0; border-radius: var(--bnh-radius-pill); background: var(--bnh-switch-inactive, var(--bnh-surface-2)); transition: background .15s; }
5
- .bnh-switch-track::after { content: ""; position: absolute; top: var(--bnh-switch-inset, 2px); left: var(--bnh-switch-inset, 2px); width: var(--bnh-switch-thumb, 16px); height: var(--bnh-switch-thumb, 16px); border-radius: var(--bnh-radius-pill); background: var(--bnh-switch-thumb-color, white); box-shadow: var(--bnh-switch-thumb-shadow, 0 1px 3px rgb(0 0 0 / 20%)); transition: transform .15s; }
4
+ /* The thumb (::after) sits `inset` inside the frame, so it travels
5
+ width − 2 × border − thumb − 2 × inset. The frame, track shadow, grip
6
+ ridges and I/O marks (::before) are off by default; their tokens turn the
7
+ pill into a slide switch. */
8
+ .bnh-switch-track { box-sizing: border-box; position: relative; width: var(--bnh-switch-width, 36px); height: var(--bnh-switch-height, 20px); flex-shrink: 0; border: var(--bnh-switch-border-width, 0px) solid var(--bnh-switch-border-color, var(--bnh-border-strong)); border-radius: var(--bnh-radius-pill); background: var(--bnh-switch-inactive, var(--bnh-surface-2)); box-shadow: var(--bnh-switch-shadow, none); transition: background .15s; }
9
+ .bnh-switch-track::after {
10
+ content: ""; box-sizing: border-box; position: absolute; top: var(--bnh-switch-inset, 2px); left: var(--bnh-switch-inset, 2px);
11
+ width: var(--bnh-switch-thumb, 16px); height: var(--bnh-switch-thumb, 16px);
12
+ border: var(--bnh-switch-border-width, 0px) solid var(--bnh-switch-border-color, var(--bnh-border-strong));
13
+ border-radius: max(0px, calc(var(--bnh-radius-pill) - var(--bnh-switch-inset, 2px)));
14
+ background-color: var(--bnh-switch-thumb-color, white);
15
+ /* Three centred grip ridges, drawn only when --bnh-switch-grip is set. */
16
+ background-image: linear-gradient(var(--bnh-switch-grip, transparent), var(--bnh-switch-grip, transparent)), linear-gradient(var(--bnh-switch-grip, transparent), var(--bnh-switch-grip, transparent)), linear-gradient(var(--bnh-switch-grip, transparent), var(--bnh-switch-grip, transparent));
17
+ background-size: 2px 8px; background-position: calc(50% - 4px) 50%, 50% 50%, calc(50% + 4px) 50%; background-repeat: no-repeat;
18
+ box-shadow: var(--bnh-switch-thumb-shadow, 0 1px 3px rgb(0 0 0 / 20%)); transition: transform .15s;
19
+ }
20
+ /* State mark, centred on the bare track: an O beside the thumb when off, an
21
+ I when on. Drawn only when --bnh-switch-mark-off / --bnh-switch-mark-on are set. */
22
+ .bnh-switch-track::before {
23
+ content: ""; box-sizing: border-box; position: absolute;
24
+ width: calc(var(--bnh-switch-thumb, 16px) - 8px); height: calc(var(--bnh-switch-thumb, 16px) - 8px);
25
+ top: calc(50% - (var(--bnh-switch-thumb, 16px) - 8px) / 2);
26
+ left: calc((var(--bnh-switch-width, 36px) - 2 * var(--bnh-switch-border-width, 0px) + var(--bnh-switch-inset, 2px) + var(--bnh-switch-thumb, 16px)) / 2 - (var(--bnh-switch-thumb, 16px) - 8px) / 2);
27
+ border: 2px solid var(--bnh-switch-mark-off, transparent); border-radius: 50%;
28
+ }
6
29
  .bnh-switch-input:checked + .bnh-switch-track { background: var(--bnh-switch-active, var(--bnh-accent)); }
7
- .bnh-switch-input:checked + .bnh-switch-track::after { transform: translateX(calc(var(--bnh-switch-width, 36px) - var(--bnh-switch-thumb, 16px) - 2 * var(--bnh-switch-inset, 2px))); }
30
+ .bnh-switch-input:checked + .bnh-switch-track::after { transform: translateX(calc(var(--bnh-switch-width, 36px) - 2 * var(--bnh-switch-border-width, 0px) - var(--bnh-switch-thumb, 16px) - 2 * var(--bnh-switch-inset, 2px))); }
31
+ .bnh-switch-input:checked + .bnh-switch-track::before { left: calc((var(--bnh-switch-width, 36px) - 2 * var(--bnh-switch-border-width, 0px) - var(--bnh-switch-thumb, 16px) - var(--bnh-switch-inset, 2px)) / 2 - 1px); width: 2px; border: 0; border-radius: 0; background: var(--bnh-switch-mark-on, transparent); }
8
32
  .bnh-switch-input:focus-visible + .bnh-switch-track { outline: var(--bnh-focus-ring-width) solid var(--bnh-focus-ring-color); outline-offset: 3px; }
9
33
  .bnh-switch-input:disabled ~ span { opacity: .5; cursor: not-allowed; }
10
34
  .bnh-switch-copy { display: flex; flex-direction: column; gap: 2px; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosborn2/ui",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Lightweight React UI components.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -184,20 +184,20 @@
184
184
  "@types/react-dom": "^19.3.0",
185
185
  "@types/semver": "7.8.0",
186
186
  "@vitejs/plugin-react": "^6.1.2",
187
- "@vitest/browser-playwright": "5.0.5",
188
- "@vitest/coverage-v8": "5.0.5",
187
+ "@vitest/browser-playwright": "5.1.0",
188
+ "@vitest/coverage-v8": "5.1.0",
189
189
  "eslint": "^10.13.0",
190
190
  "jsdom": "^30.1.3",
191
191
  "playwright": "1.64.1",
192
192
  "react": "19.3.1",
193
193
  "react-dom": "19.3.1",
194
194
  "release-it": "21.1.2",
195
- "semver": "7.8.5",
195
+ "semver": "7.8.6",
196
196
  "storybook": "10.6.5",
197
197
  "typescript": "^6.0.3",
198
198
  "typescript-eslint": "^8.72.0",
199
199
  "vite": "^8.3.5",
200
- "vitest": "5.0.5"
200
+ "vitest": "5.1.0"
201
201
  },
202
202
  "packageManager": "bun@1.4.4",
203
203
  "overrides": {