@ptlm-azulejo/segmented-control 0.0.1-alpha.21
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/CHANGELOG.md +10 -0
- package/README.md +56 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5776 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/src/index.vue.d.ts +99 -0
- package/dist/src/index.vue.d.ts.map +1 -0
- package/dist/src/types.d.ts +19 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/useSegmentedControl.d.ts +17 -0
- package/dist/src/useSegmentedControl.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +48 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Add `AzSegmentedControl` — ADS2 segmented control (toggle group) with `v-model`, `items`, `size` (`s` / `m`), `fullWidth`, per-segment `disabled`, typed `:ui` overrides, keyboard navigation (arrows, Home/End), and motion-v `layout` selection indicator (bundled — no extra install).
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# SegmentedControl
|
|
2
|
+
|
|
3
|
+
A Segmented Control allows users to switch between multiple options or views within a single container. Also known as toggle group, option selector, button segments, or view selector.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ptlm-azulejo/segmented-control @ptlm-azulejo/themes
|
|
9
|
+
# or
|
|
10
|
+
yarn add @ptlm-azulejo/segmented-control @ptlm-azulejo/themes
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Styles & theming
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import "@ptlm-azulejo/themes/presets/leroy-merlin.css";
|
|
17
|
+
import "@ptlm-azulejo/segmented-control/style.css";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<html class="preset-lm" data-theme="dark"></html>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Name | Type | Default | Description |
|
|
27
|
+
| ------------ | ------------------------ | ------- | --------------------------------------------------- |
|
|
28
|
+
| `items` | `SegmentedControlItem[]` | — | Segments with `label`, `value`, optional `disabled` |
|
|
29
|
+
| `modelValue` | `string` | — | Selected value (`v-model`) |
|
|
30
|
+
| `size` | `'s' \| 'm'` | `'m'` | `m` = 3rem (`h-12`), `s` = 2rem (`h-8`) |
|
|
31
|
+
| `fullWidth` | `boolean` | `false` | Equal-width segments |
|
|
32
|
+
| `disabled` | `boolean` | `false` | Disables the whole control |
|
|
33
|
+
| `ui` | `SegmentedControlUi` | `{}` | Per-part Tailwind class overrides |
|
|
34
|
+
| `ariaLabel` | `string` | — | Accessible name for the radiogroup |
|
|
35
|
+
|
|
36
|
+
## Basic usage
|
|
37
|
+
|
|
38
|
+
```vue
|
|
39
|
+
<script setup>
|
|
40
|
+
import { ref } from "vue";
|
|
41
|
+
import { AzSegmentedControl } from "@ptlm-azulejo/segmented-control";
|
|
42
|
+
|
|
43
|
+
const view = ref("list");
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<AzSegmentedControl
|
|
48
|
+
v-model="view"
|
|
49
|
+
aria-label="Display mode"
|
|
50
|
+
:items="[
|
|
51
|
+
{ label: 'List', value: 'list' },
|
|
52
|
+
{ label: 'Grid', value: 'grid' },
|
|
53
|
+
]"
|
|
54
|
+
/>
|
|
55
|
+
</template>
|
|
56
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC/D,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAA"}
|