@wikicasa-dev/components 2.9.1 → 2.10.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.
Files changed (95) hide show
  1. package/dist/UIKit/BaseSnackbar.vue.js +1 -1
  2. package/dist/assets/AccessibleSelect.css +1 -1
  3. package/dist/assets/BaseBadge.css +1 -1
  4. package/dist/assets/BaseComplexToggle2.css +1 -1
  5. package/dist/assets/BaseDropDown.css +1 -1
  6. package/dist/assets/BaseFloatingLabel2.css +1 -1
  7. package/dist/assets/BaseSlider2.css +1 -1
  8. package/dist/assets/BaseSnackbar.css +1 -1
  9. package/dist/assets/BaseTabs.css +1 -1
  10. package/dist/assets/BaseTextarea2.css +1 -1
  11. package/dist/assets/BaseTooltip2.css +1 -1
  12. package/dist/assets/baseAlert.css +1 -1
  13. package/dist/assets/baseComplexToggle.css +1 -1
  14. package/dist/assets/baseFloatingLabel.css +1 -1
  15. package/dist/assets/baseSlider.css +1 -1
  16. package/dist/assets/baseTextarea.css +1 -1
  17. package/dist/assets/baseTooltip.css +1 -1
  18. package/dist/assets/tailwind.css +1 -1
  19. package/dist/assets/tokens.css +1 -0
  20. package/dist/docs/AccessibleSelect.md +121 -0
  21. package/dist/docs/AccordionContentPrimitive.md +70 -0
  22. package/dist/docs/AccordionHeaderPrimitive.md +70 -0
  23. package/dist/docs/AccordionItemPrimitive.md +98 -0
  24. package/dist/docs/AccordionTriggerPrimitive.md +71 -0
  25. package/dist/docs/BaseAccordion.md +98 -0
  26. package/dist/docs/BaseAccordionItem.md +100 -0
  27. package/dist/docs/BaseAlert.md +83 -0
  28. package/dist/docs/BaseAutocomplete.md +125 -0
  29. package/dist/docs/BaseBadge.md +92 -0
  30. package/dist/docs/BaseBreadcrumb.md +83 -0
  31. package/dist/docs/BaseButton.md +129 -0
  32. package/dist/docs/BaseCard.md +110 -0
  33. package/dist/docs/BaseComplexToggle.md +99 -0
  34. package/dist/docs/BaseDropDown.md +122 -0
  35. package/dist/docs/BaseFloatingLabel.md +89 -0
  36. package/dist/docs/BaseInput.md +130 -0
  37. package/dist/docs/BaseModal.md +129 -0
  38. package/dist/docs/BasePagination.md +109 -0
  39. package/dist/docs/BaseShimmerLoader.md +86 -0
  40. package/dist/docs/BaseSlider.md +87 -0
  41. package/dist/docs/BaseSnackbar.md +120 -0
  42. package/dist/docs/BaseTab.md +84 -0
  43. package/dist/docs/BaseTabView.md +90 -0
  44. package/dist/docs/BaseTabs.md +116 -0
  45. package/dist/docs/BaseTabsContent.md +71 -0
  46. package/dist/docs/BaseTabsIndicator.md +73 -0
  47. package/dist/docs/BaseTabsList.md +76 -0
  48. package/dist/docs/BaseTabsTrigger.md +70 -0
  49. package/dist/docs/BaseTextarea.md +99 -0
  50. package/dist/docs/BaseToggle.md +88 -0
  51. package/dist/docs/BaseTooltip.md +87 -0
  52. package/dist/docs/BaseUploadFile.md +96 -0
  53. package/dist/docs/CardDescriptionPrimitive.md +73 -0
  54. package/dist/docs/CardImagePrimitive.md +73 -0
  55. package/dist/docs/CardRootPrimitive.md +99 -0
  56. package/dist/docs/CheckboxBtn.md +96 -0
  57. package/dist/docs/CheckboxButtonGroup.md +115 -0
  58. package/dist/docs/CheckboxGroup.md +102 -0
  59. package/dist/docs/CheckboxGroupItemPrimitive.md +104 -0
  60. package/dist/docs/CheckboxGroupPrimitive.md +105 -0
  61. package/dist/docs/ClearableAutocomplete.md +135 -0
  62. package/dist/docs/DoughnutChart.md +88 -0
  63. package/dist/docs/INDEX.md +133 -0
  64. package/dist/docs/IntersectionObservable.md +78 -0
  65. package/dist/docs/IntersectionObserver.md +84 -0
  66. package/dist/docs/IntersectionObserverProvider.md +98 -0
  67. package/dist/docs/IntersectionObserverTarget.md +73 -0
  68. package/dist/docs/LineChart.md +98 -0
  69. package/dist/docs/ProgressIndicatorPrimitive.md +70 -0
  70. package/dist/docs/ProgressRootPrimitive.md +106 -0
  71. package/dist/docs/RadioButton.md +86 -0
  72. package/dist/docs/RadioButtonGroup.md +107 -0
  73. package/dist/docs/RadioButtonItem.md +101 -0
  74. package/dist/docs/RadioGroup.md +95 -0
  75. package/dist/docs/RadioGroupItemPrimitive.md +102 -0
  76. package/dist/docs/SelectItem.md +100 -0
  77. package/dist/docs/ShimmerMultiLine.md +79 -0
  78. package/dist/docs/SimpleSlider.md +80 -0
  79. package/dist/docs/StaticSpinner.md +76 -0
  80. package/dist/docs/SwiperCarousel.md +126 -0
  81. package/dist/docs/SwiperNavigationPrimitive.md +83 -0
  82. package/dist/docs/SwiperPaginationPrimitive.md +80 -0
  83. package/dist/docs/SwiperPrimitive.md +77 -0
  84. package/dist/docs/SwiperRootPrimitive.md +123 -0
  85. package/dist/docs/SwiperSlide.md +75 -0
  86. package/dist/docs/SwiperSlideImagePrimitive.md +98 -0
  87. package/dist/docs/SwiperThumbnailPrimitive.md +96 -0
  88. package/dist/docs/TOKENS.md +50 -0
  89. package/dist/docs/agent-index.md +86 -0
  90. package/dist/lazyModules/Swiper/Autoplay/index.js +1 -1
  91. package/dist/lazyModules/Swiper/Controller/index.js +1 -1
  92. package/dist/lazyModules/Swiper/Keyboard/index.js +1 -1
  93. package/dist/lazyModules/Swiper/Thumbs/index.js +1 -1
  94. package/package.json +9 -8
  95. /package/dist/assets/{swiper-thumbs.css → swiper-autoplay.css} +0 -0
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: ProgressIndicatorPrimitive
3
+ status: primitive
4
+ category: Loading
5
+ summary: Unstyled fill element of a progress bar; must sit inside ProgressRootPrimitive, which you size and position yourself.
6
+ import: @wikicasa-dev/components/UIKit/ProgressBar/ProgressIndicatorPrimitive
7
+ version: 2.10.0
8
+ ---
9
+
10
+ # ProgressIndicatorPrimitive
11
+
12
+ > **Primitive.** A low-level building block. Prefer a `preferred` component; use primitives only to compose something that doesn't exist yet.
13
+
14
+ Unstyled fill element of a progress bar; must sit inside ProgressRootPrimitive, which you size and position yourself.
15
+
16
+ ```ts
17
+ import ProgressIndicatorPrimitive from "@wikicasa-dev/components/UIKit/ProgressBar/ProgressIndicatorPrimitive";
18
+ ```
19
+
20
+ The fill of a progress bar built with `ProgressRootPrimitive`. It is an unstyled `<div>` that mirrors the root's state as `data-state` (`indeterminate`, `loading`, `complete`), `data-value` and `data-max`. It does **not** move by itself: set its `transform` or `width` from the value. See `ProgressRootPrimitive` for the full progress bar recipe.
21
+
22
+ ## Usage
23
+
24
+ ```vue
25
+ <script setup lang="ts">
26
+ import ProgressRootPrimitive from "@wikicasa-dev/components/UIKit/ProgressBar/ProgressRootPrimitive";
27
+ import ProgressIndicatorPrimitive from "@wikicasa-dev/components/UIKit/ProgressBar/ProgressIndicatorPrimitive";
28
+
29
+ const uploaded = 60; // % of photos uploaded
30
+ </script>
31
+
32
+ <template>
33
+ <ProgressRootPrimitive :model-value="uploaded" style="height: 4px; overflow: hidden; background: #e9effe">
34
+ <ProgressIndicatorPrimitive :style="{ height: '100%', width: `${uploaded}%`, background: '#2b5dff' }" />
35
+ </ProgressRootPrimitive>
36
+ </template>
37
+ ```
38
+
39
+ ## Do / Don't
40
+
41
+ - Do render it only inside `ProgressRootPrimitive`; it reads the value from there and fails outside it.
42
+ - Do drive its size/position from the same value you pass to the root.
43
+ - Use `as` to render it as another element if needed.
44
+
45
+ ## API
46
+
47
+ _Generated from the component's types. Do not edit by hand._
48
+
49
+ ### Props
50
+
51
+ | Name | Type | Default | Required | Description |
52
+ | --- | --- | --- | --- | --- |
53
+ | `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
54
+ | `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
55
+
56
+ ### Events
57
+
58
+ None.
59
+
60
+ ### v-model
61
+
62
+ None.
63
+
64
+ ### Slots
65
+
66
+ None.
67
+
68
+ ### Exposed (template ref)
69
+
70
+ None.
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: ProgressRootPrimitive
3
+ status: primitive
4
+ category: Loading
5
+ summary: Unstyled accessible progress bar root (role="progressbar"); compose with ProgressIndicatorPrimitive and style it yourself.
6
+ import: @wikicasa-dev/components/UIKit/ProgressBar/ProgressRootPrimitive
7
+ version: 2.10.0
8
+ ---
9
+
10
+ # ProgressRootPrimitive
11
+
12
+ > **Primitive.** A low-level building block. Prefer a `preferred` component; use primitives only to compose something that doesn't exist yet.
13
+
14
+ Unstyled accessible progress bar root (role="progressbar"); compose with ProgressIndicatorPrimitive and style it yourself.
15
+
16
+ ```ts
17
+ import ProgressRootPrimitive from "@wikicasa-dev/components/UIKit/ProgressBar/ProgressRootPrimitive";
18
+ ```
19
+
20
+ The library has no ready-made progress bar: build one from `ProgressRootPrimitive` (the track) and `ProgressIndicatorPrimitive` (the fill). Both are unstyled `<div>`s (reka-ui Progress), so all visuals are yours. The root handles accessibility: `role="progressbar"`, `aria-valuemin="0"`, `aria-valuemax`, `aria-valuenow`, and an `aria-label` from `get-value-label` (default: the rounded percentage, e.g. "40%").
21
+
22
+ Value rules: `model-value` between 0 and `max` (default 100). `null`/`undefined` means indeterminate. Out-of-range values are logged as errors and reset to `null`.
23
+
24
+ ## Usage
25
+
26
+ A listing-completion bar (5 of 8 steps):
27
+
28
+ ```vue
29
+ <script setup lang="ts">
30
+ import { ref } from "vue";
31
+ import ProgressRootPrimitive from "@wikicasa-dev/components/UIKit/ProgressBar/ProgressRootPrimitive";
32
+ import ProgressIndicatorPrimitive from "@wikicasa-dev/components/UIKit/ProgressBar/ProgressIndicatorPrimitive";
33
+
34
+ const stepsDone = ref(5);
35
+ const totalSteps = 8;
36
+ </script>
37
+
38
+ <template>
39
+ <ProgressRootPrimitive
40
+ v-model="stepsDone"
41
+ :max="totalSteps"
42
+ :get-value-label="(value, max) => `Annuncio completato: ${value ?? 0} di ${max} passaggi`"
43
+ class="progress"
44
+ >
45
+ <ProgressIndicatorPrimitive
46
+ class="progress__fill"
47
+ :style="{ transform: `translateX(-${100 - (stepsDone / totalSteps) * 100}%)` }"
48
+ />
49
+ </ProgressRootPrimitive>
50
+ </template>
51
+
52
+ <style scoped>
53
+ .progress { position: relative; overflow: hidden; height: 8px; border-radius: 8px; background: rgb(var(--uikit-color-w-lavender)); }
54
+ .progress__fill { width: 100%; height: 100%; background: rgb(var(--uikit-color-w-primary)); transition: transform 0.3s ease; }
55
+ .progress[data-state="complete"] .progress__fill { background: #358500; }
56
+ </style>
57
+ ```
58
+
59
+ ## Do / Don't
60
+
61
+ - Do position the fill yourself (the `transform` above, or a `width` in %); the indicator never moves on its own.
62
+ - Do give the root `overflow: hidden`, a height and a background: it is the track.
63
+ - Do pass a descriptive `get-value-label`: its result is the bar's `aria-label`. Use `get-value-text` for `aria-valuetext`.
64
+ - Don't pass values above `max` or below 0.
65
+ - The default slot receives `{ modelValue }`, handy for a "62%" label inside the track.
66
+
67
+ ## Styling hooks
68
+
69
+ Both root and indicator carry `data-state` (`indeterminate`, `loading`, `complete`), `data-value` and `data-max`. Use `[data-state="indeterminate"]` for an animated "unknown duration" look and `[data-state="complete"]` for a finished color.
70
+
71
+ ## API
72
+
73
+ _Generated from the component's types. Do not edit by hand._
74
+
75
+ ### Props
76
+
77
+ | Name | Type | Default | Required | Description |
78
+ | --- | --- | --- | --- | --- |
79
+ | `modelValue` | `number \| null` | | | The progress value. Can be bind as `v-model`. |
80
+ | `max` | `number` | | | The maximum progress value. |
81
+ | `getValueLabel` | `((value: number \| null \| undefined, max: number) => string \| undefined)` | | | A function to get the accessible label text in a human-readable format. If not provided, the value label will be read as the numeric value as a percentage of the max value. |
82
+ | `getValueText` | `((value: number \| null \| undefined, max: number) => string \| undefined)` | | | A function to get the accessible value text representing the current value in a human-readable format. |
83
+ | `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
84
+ | `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
85
+
86
+ ### Events
87
+
88
+ | Name | Payload |
89
+ | --- | --- |
90
+ | `update:modelValue` | `[value: string[] \| undefined]` |
91
+ | `update:max` | `[value: number]` |
92
+
93
+ ### v-model
94
+
95
+ - `v-model` binds `modelValue` (`number \| null`)
96
+ - `v-model:max` (`number`)
97
+
98
+ ### Slots
99
+
100
+ | Name | Slot props |
101
+ | --- | --- |
102
+ | `default` | `{ modelValue: number \| null \| undefined; }` |
103
+
104
+ ### Exposed (template ref)
105
+
106
+ None.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: RadioButton
3
+ status: legacy
4
+ category: Selection
5
+ summary: Older standalone radio button with a boolean model, used by RadioGroup; not keyboard accessible.
6
+ useInstead: RadioButtonItem
7
+ import: @wikicasa-dev/components/UIKit/Radio/RadioButton
8
+ version: 2.10.0
9
+ ---
10
+
11
+ # RadioButton
12
+
13
+ > **Legacy.** Don't use in new designs. Use `RadioButtonItem` instead.
14
+
15
+ Older standalone radio button with a boolean model, used by RadioGroup; not keyboard accessible.
16
+
17
+ ```ts
18
+ import RadioButton from "@wikicasa-dev/components/UIKit/Radio/RadioButton";
19
+ ```
20
+
21
+ Kept for existing screens. In new work use `RadioButtonItem` inside a `RadioButtonGroup` (or the group's `items` prop): it is a real radio, reachable and operable with the keyboard, and the group manages which option is selected.
22
+
23
+ How it behaves, if you have to maintain one:
24
+
25
+ - `v-model` is a boolean for this single radio. Clicking an unchecked radio sets it to `true` and emits `change` with `{ id, label, name }`; clicking a checked one does nothing, so unchecking siblings is up to you.
26
+ - The native input is hidden and clicks are handled on the wrapper, so Tab, Space and arrow keys don't work.
27
+
28
+ ## Usage
29
+
30
+ ```vue
31
+ <script setup lang="ts">
32
+ import { ref } from "vue";
33
+ import RadioButton from "@wikicasa-dev/components/UIKit/Radio/RadioButton";
34
+
35
+ const selected = ref<"email" | "phone">("email");
36
+ </script>
37
+
38
+ <template>
39
+ <RadioButton id="contact-email" name="contact" label="Email" :model-value="selected === 'email'" @update:model-value="selected = 'email'" />
40
+ <RadioButton id="contact-phone" name="contact" label="Telefono" :model-value="selected === 'phone'" @update:model-value="selected = 'phone'" />
41
+ </template>
42
+ ```
43
+
44
+ ## Do / Don't
45
+
46
+ - Don't use it in new designs; use `RadioButtonItem` in a `RadioButtonGroup`.
47
+ - Do give radios of the same set the same `name`.
48
+
49
+ ## Styling hooks
50
+
51
+ - `inputClasses` styles the 16px circle (it gets the class `checked` when selected); `labelClasses` the label row.
52
+
53
+ ## API
54
+
55
+ _Generated from the component's types. Do not edit by hand._
56
+
57
+ ### Props
58
+
59
+ | Name | Type | Default | Required | Description |
60
+ | --- | --- | --- | --- | --- |
61
+ | `id` | `TID` | | | |
62
+ | `dataCy` | `string` | | | |
63
+ | `name` | `string` | | | |
64
+ | `label` | `string` | | yes | |
65
+ | `modelValue` | `boolean` | `false` | | |
66
+ | `inputClasses` | `ClassTypeProp` | | | |
67
+ | `labelClasses` | `ClassTypeProp` | | | |
68
+
69
+ ### Events
70
+
71
+ | Name | Payload |
72
+ | --- | --- |
73
+ | `update:modelValue` | `[boolean]` |
74
+ | `change` | `[{ id: NonNullable<TID>; label: string; name?: string \| undefined; }]` |
75
+
76
+ ### v-model
77
+
78
+ - `v-model` binds `modelValue` (`boolean`)
79
+
80
+ ### Slots
81
+
82
+ None.
83
+
84
+ ### Exposed (template ref)
85
+
86
+ None.
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: RadioButtonGroup
3
+ status: preferred
4
+ category: Selection
5
+ summary: Accessible single-choice radio group bound to one value, rendering items from a list or from its slot.
6
+ import: @wikicasa-dev/components/UIKit/Radio/v2/RadioButtonGroup
7
+ version: 2.10.0
8
+ ---
9
+
10
+ # RadioButtonGroup
11
+
12
+ Accessible single-choice radio group bound to one value, rendering items from a list or from its slot.
13
+
14
+ ```ts
15
+ import RadioButtonGroup from "@wikicasa-dev/components/UIKit/Radio/v2/RadioButtonGroup";
16
+ ```
17
+
18
+ Use when the user must pick exactly one of a few visible options: contract type ("Vendita" / "Affitto" / "Asta"), property condition, a locality. It renders a `role="radiogroup"` with arrow-key navigation. For long lists use `AccessibleSelect`; for exactly two modes shown as a pill use `BaseComplexToggle`.
19
+
20
+ Two ways to render:
21
+
22
+ - Simple: `items` (`{ value, label, dataCy?, required?, as? }[]`) renders a `RadioButtonItem` per entry.
23
+ - Custom: put `RadioButtonItem`s (classic radio look) or `RadioGroupItemPrimitive`s (unstyled, e.g. segmented buttons) in the default slot.
24
+
25
+ ## Usage
26
+
27
+ ```vue
28
+ <script setup lang="ts">
29
+ import { ref } from "vue";
30
+ import RadioButtonGroup from "@wikicasa-dev/components/UIKit/Radio/v2/RadioButtonGroup";
31
+ import RadioButtonItem from "@wikicasa-dev/components/UIKit/Radio/v2/RadioButtonItem";
32
+
33
+ const contract = ref("vendita");
34
+ const rooms = ref<number>();
35
+ </script>
36
+
37
+ <template>
38
+ <RadioButtonGroup
39
+ v-model="contract"
40
+ aria-label="Tipo di contratto"
41
+ data-cy="contract-type"
42
+ :items="[
43
+ { value: 'vendita', label: 'Vendita' },
44
+ { value: 'affitto', label: 'Affitto' },
45
+ { value: 'asta', label: 'Asta' },
46
+ ]"
47
+ />
48
+
49
+ <RadioButtonGroup v-model="rooms" aria-label="Numero di locali" orientation="horizontal" style="display: flex; gap: 20px">
50
+ <RadioButtonItem v-for="n in [1, 2, 3, 4]" :key="n" :value="n">{{ n }}+ locali</RadioButtonItem>
51
+ </RadioButtonGroup>
52
+ </template>
53
+ ```
54
+
55
+ ## Do / Don't
56
+
57
+ - Do name the group with `aria-label` or `aria-labelledby` (it goes on the radiogroup element), and show a visible heading above it.
58
+ - Do give each option a unique `value`; `v-model` holds the selected one (`undefined` until chosen, or `defaultValue` for an uncontrolled start).
59
+ - Do set `orientation` to match the layout and `loop` to wrap arrow-key navigation from last to first (off by default).
60
+ - Do use `name` and `required` when the group sits in a native `<form>`; `disabled` locks every option.
61
+ - Don't mix `items` and slot content: the slot replaces the generated items.
62
+
63
+ ## Styling hooks
64
+
65
+ - The root takes `class` / `style` for layout (it is a plain block by default; use flex or grid for rows).
66
+ - Generated items use `RadioButtonItem` styling (`.uikit-radio-btn { --font-size }`). For different per-item classes, render items in the slot.
67
+
68
+ ## API
69
+
70
+ _Generated from the component's types. Do not edit by hand._
71
+
72
+ ### Props
73
+
74
+ | Name | Type | Default | Required | Description |
75
+ | --- | --- | --- | --- | --- |
76
+ | `dataCy` | `string` | | | |
77
+ | `items` | `RadioButtonItem<T>[]` | `[]` | | |
78
+ | `defaultValue` | `T` | | | |
79
+ | `disabled` | `boolean` | | | When `true`, prevents the user from interacting with radio items. |
80
+ | `dir` | `Direction` | | | The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
81
+ | `orientation` | `DataOrientation` | | | The orientation of the component. |
82
+ | `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
83
+ | `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
84
+ | `required` | `boolean` | | | When `true`, indicates that the user must set the value before the owning form can be submitted. |
85
+ | `loop` | `boolean` | | | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
86
+ | `name` | `string` | | | The name of the field. Submitted with its owning form as part of a name/value pair. |
87
+ | `modelValue` | `T` | | | |
88
+
89
+ ### Events
90
+
91
+ | Name | Payload |
92
+ | --- | --- |
93
+ | `update:modelValue` | `[value: T \| undefined]` |
94
+
95
+ ### v-model
96
+
97
+ - `v-model` binds `modelValue` (`T`)
98
+
99
+ ### Slots
100
+
101
+ | Name | Slot props |
102
+ | --- | --- |
103
+ | `default` | |
104
+
105
+ ### Exposed (template ref)
106
+
107
+ None.
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: RadioButtonItem
3
+ status: preferred
4
+ category: Selection
5
+ summary: Classic radio button (circle + clickable label) used inside RadioButtonGroup.
6
+ import: @wikicasa-dev/components/UIKit/Radio/v2/RadioButtonItem
7
+ version: 2.10.0
8
+ ---
9
+
10
+ # RadioButtonItem
11
+
12
+ Classic radio button (circle + clickable label) used inside RadioButtonGroup.
13
+
14
+ ```ts
15
+ import RadioButtonItem from "@wikicasa-dev/components/UIKit/Radio/v2/RadioButtonItem";
16
+ ```
17
+
18
+ One option of a `RadioButtonGroup`, with the standard radio look. Use it in the group's slot when the simple `items` prop isn't enough: custom label content, per-item classes, `disabled` on a single option, or items interleaved with other markup. For a fully custom look (segmented buttons, cards) use `RadioGroupItemPrimitive` instead.
19
+
20
+ The default slot is the label; it is linked to the radio, so clicking the text selects it.
21
+
22
+ ## Usage
23
+
24
+ ```vue
25
+ <script setup lang="ts">
26
+ import { ref } from "vue";
27
+ import RadioButtonGroup from "@wikicasa-dev/components/UIKit/Radio/v2/RadioButtonGroup";
28
+ import RadioButtonItem from "@wikicasa-dev/components/UIKit/Radio/v2/RadioButtonItem";
29
+
30
+ const localities = [
31
+ { id: 101, name: "Milano Marittima", listings: 84 },
32
+ { id: 102, name: "Cervia", listings: 212 },
33
+ { id: 103, name: "Pinarella", listings: 0 },
34
+ ];
35
+ const locality = ref<number>();
36
+ </script>
37
+
38
+ <template>
39
+ <RadioButtonGroup v-model="locality" aria-label="Località">
40
+ <RadioButtonItem
41
+ v-for="l in localities"
42
+ :key="l.id"
43
+ :value="l.id"
44
+ :disabled="l.listings === 0"
45
+ :data-cy="`locality_${l.id}`"
46
+ >
47
+ {{ l.name }} <small>({{ l.listings }} annunci)</small>
48
+ </RadioButtonItem>
49
+ </RadioButtonGroup>
50
+ </template>
51
+ ```
52
+
53
+ ## Do / Don't
54
+
55
+ - Do always place it inside `RadioButtonGroup`; it doesn't work on its own.
56
+ - Do give it a `value` unique within the group, and label text in the default slot (no slot means no label).
57
+ - Do make the label fill the row (`label-classes`) when the whole row should be clickable.
58
+ - Don't add click handlers to select it; listen to the group's `v-model`.
59
+
60
+ ## Styling hooks
61
+
62
+ - `.uikit-radio-btn { --font-size }` (default `16px`); `class` goes on this row wrapper (flex, 8px gap).
63
+ - `itemClasses` styles the 18px circle (`.uikit-radio-group-item`, with `data-state="checked|unchecked"`); the inner dot is `.uikit-radio-group-indicator`.
64
+ - `labelClasses` styles the `<label>`.
65
+
66
+ ## API
67
+
68
+ _Generated from the component's types. Do not edit by hand._
69
+
70
+ ### Props
71
+
72
+ | Name | Type | Default | Required | Description |
73
+ | --- | --- | --- | --- | --- |
74
+ | `itemClasses` | `ClassTypeProp` | | | |
75
+ | `labelClasses` | `ClassTypeProp` | | | |
76
+ | `dataCy` | `string` | | | |
77
+ | `disabled` | `boolean` | | | When `true`, prevents the user from interacting with the radio item. |
78
+ | `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
79
+ | `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
80
+ | `required` | `boolean` | | | When `true`, indicates that the user must set the value before the owning form can be submitted. |
81
+ | `value` | `AcceptableValue` | | | The value given as data when submitted with a `name`. |
82
+ | `id` | `string` | | | |
83
+ | `name` | `string` | | | The name of the field. Submitted with its owning form as part of a name/value pair. |
84
+
85
+ ### Events
86
+
87
+ None.
88
+
89
+ ### v-model
90
+
91
+ None.
92
+
93
+ ### Slots
94
+
95
+ | Name | Slot props |
96
+ | --- | --- |
97
+ | `default` | |
98
+
99
+ ### Exposed (template ref)
100
+
101
+ None.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: RadioGroup
3
+ status: legacy
4
+ category: Selection
5
+ summary: Older radio list driven by radioValues objects, emitting the selected object.
6
+ useInstead: RadioButtonGroup
7
+ import: @wikicasa-dev/components/UIKit/Radio/RadioGroup
8
+ version: 2.10.0
9
+ ---
10
+
11
+ # RadioGroup
12
+
13
+ > **Legacy.** Don't use in new designs. Use `RadioButtonGroup` instead.
14
+
15
+ Older radio list driven by radioValues objects, emitting the selected object.
16
+
17
+ ```ts
18
+ import RadioGroup from "@wikicasa-dev/components/UIKit/Radio/RadioGroup";
19
+ ```
20
+
21
+ Kept for existing screens. In new work use `RadioButtonGroup`: it binds a plain value with `v-model`, is a real `radiogroup` with arrow-key navigation, and can be cleared by setting the model to `undefined`.
22
+
23
+ How it differs, if you have to maintain one:
24
+
25
+ - It has no `modelValue` input: the initial choice is the item with `active: true`, and it only emits `update:modelValue` with the selected `{ id, label, payload? }` object (or `null` after a reset).
26
+ - Set `v-model:resetRadio` to `true` to clear it; set `v-model:refresh` to `true` to re-read `radioValues` after changing them.
27
+ - Its `RadioButton`s are mouse-only: they can't be reached or changed with the keyboard.
28
+
29
+ ## Usage
30
+
31
+ ```vue
32
+ <script setup lang="ts">
33
+ import RadioGroup from "@wikicasa-dev/components/UIKit/Radio/RadioGroup";
34
+ import type { RadioButtonType } from "@wikicasa-dev/components";
35
+
36
+ const purposes: RadioButtonType<number>[] = [
37
+ { id: 1, label: "Voglio vendere", active: true },
38
+ { id: 2, label: "Voglio comprare" },
39
+ { id: 3, label: "Solo curiosità" },
40
+ ];
41
+ const onChange = (v: RadioButtonType<number> | null) => console.log(v?.id);
42
+ </script>
43
+
44
+ <template>
45
+ <RadioGroup :radio-values="purposes" data-cy="valuation-purpose" @update:model-value="onChange" />
46
+ </template>
47
+ ```
48
+
49
+ ## Do / Don't
50
+
51
+ - Don't use it in new designs; use `RadioButtonGroup`.
52
+ - Do keep `id`s unique; selection is matched by `id`.
53
+ - Do use the `radio_elements` slot (`handleClick`, `activeValue`, `reset`, `isActive`) only to restyle items in an existing screen.
54
+
55
+ ## Styling hooks
56
+
57
+ - `class` goes on the `.radio-group-container` wrapper; `radioContainerClasses` on each `RadioButton`.
58
+
59
+ ## API
60
+
61
+ _Generated from the component's types. Do not edit by hand._
62
+
63
+ ### Props
64
+
65
+ | Name | Type | Default | Required | Description |
66
+ | --- | --- | --- | --- | --- |
67
+ | `radioValues` | `RadioButtonType<TID, TPayload>[]` | `[]` | | |
68
+ | `dataCy` | `string` | | | |
69
+ | `radioContainerClasses` | `ClassTypeProp` | | | |
70
+ | `resetRadio` | `Optional<boolean>` | `false` | | |
71
+ | `refresh` | `boolean` | `false` | | If true, we will reinitialized the inner data of the component |
72
+
73
+ ### Events
74
+
75
+ | Name | Payload |
76
+ | --- | --- |
77
+ | `update:modelValue` | `[Nullable<RadioButtonType<TID, TPayload>>]` |
78
+ | `update:refresh` | `[value: boolean]` |
79
+ | `update:resetRadio` | `[value: Optional<boolean>]` |
80
+
81
+ ### v-model
82
+
83
+ - `v-model:resetRadio` (`Optional<boolean>`)
84
+ - `v-model:refresh` (`boolean`)
85
+
86
+ ### Slots
87
+
88
+ | Name | Slot props |
89
+ | --- | --- |
90
+ | `default` | `{ handleClick: (elem: RadioButtonType<TID, TPayload>) => void; activeValue: { id?: UnwrapRef<TID> \| undefined; label: string; payload?: UnwrapRef<TPayload> \| undefined; active?: boolean \| undefined; } \| null; reset: () => void; isActive: (elem: RadioButtonType<TID, TPayload>) => boolean; }` |
91
+ | `radio_elements` | `{ handleClick: (elem: RadioButtonType<TID, TPayload>) => void; activeValue: { id?: UnwrapRef<TID> \| undefined; label: string; payload?: UnwrapRef<TPayload> \| undefined; active?: boolean \| undefined; } \| null; reset: () => void; isActive: (elem: RadioButtonType<TID, TPayload>) => boolean; }` |
92
+
93
+ ### Exposed (template ref)
94
+
95
+ None.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: RadioGroupItemPrimitive
3
+ status: primitive
4
+ category: Selection
5
+ summary: Unstyled radio option (reka-ui RadioGroupItem) for custom segmented buttons or cards inside RadioButtonGroup.
6
+ import: @wikicasa-dev/components/UIKit/Radio/v2/RadioGroupItemPrimitive
7
+ version: 2.10.0
8
+ ---
9
+
10
+ # RadioGroupItemPrimitive
11
+
12
+ > **Primitive.** A low-level building block. Prefer a `preferred` component; use primitives only to compose something that doesn't exist yet.
13
+
14
+ Unstyled radio option (reka-ui RadioGroupItem) for custom segmented buttons or cards inside RadioButtonGroup.
15
+
16
+ ```ts
17
+ import RadioGroupItemPrimitive from "@wikicasa-dev/components/UIKit/Radio/v2/RadioGroupItemPrimitive";
18
+ ```
19
+
20
+ An option with no visuals of its own: an unstyled `<button role="radio">` whose content is your slot. Use it inside `RadioButtonGroup` when options should look like segmented tabs, pills or selectable cards (e.g. "Vendita | Affitto | Asta" tabs, condition buttons in a filter modal). For the classic circle-and-label look use `RadioButtonItem`.
21
+
22
+ The default slot receives `{ checked, required, disabled }`. `select` is emitted when the option is chosen.
23
+
24
+ ## Usage
25
+
26
+ ```vue
27
+ <script setup lang="ts">
28
+ import { ref } from "vue";
29
+ import RadioButtonGroup from "@wikicasa-dev/components/UIKit/Radio/v2/RadioButtonGroup";
30
+ import RadioGroupItemPrimitive from "@wikicasa-dev/components/UIKit/Radio/v2/RadioGroupItemPrimitive";
31
+
32
+ const contract = ref("vendita");
33
+ const options = [
34
+ { value: "vendita", label: "Vendita" },
35
+ { value: "affitto", label: "Affitto" },
36
+ { value: "asta", label: "Asta" },
37
+ ];
38
+ </script>
39
+
40
+ <template>
41
+ <RadioButtonGroup v-model="contract" aria-label="Tipo di contratto" orientation="horizontal" class="segmented">
42
+ <RadioGroupItemPrimitive v-for="o in options" :key="o.value" :value="o.value" :data-cy="`contract-${o.value}`" class="segment">
43
+ {{ o.label }}
44
+ </RadioGroupItemPrimitive>
45
+ </RadioButtonGroup>
46
+ </template>
47
+
48
+ <style scoped>
49
+ .segmented { display: grid; grid-template-columns: repeat(3, 1fr); }
50
+ .segment { padding: 6px 20px; border: 0; border-bottom: 2px solid transparent; background: transparent; }
51
+ .segment[data-state="checked"] { border-bottom-color: rgb(var(--uikit-color-w-primary)); font-weight: 600; }
52
+ .segment:focus-visible { outline: 2px solid rgb(var(--uikit-color-w-primary)); }
53
+ </style>
54
+ ```
55
+
56
+ ## Do / Don't
57
+
58
+ - Do always place it inside `RadioButtonGroup` (the library has no separate radio root primitive) and give it a unique `value`.
59
+ - Do put readable text in the slot; icon-only options need an `aria-label`.
60
+ - Do style checked and disabled looks with `[data-state="checked"]` and `[data-disabled]`, and keep a visible `:focus-visible` style.
61
+ - Don't use it when the classic radio look is fine; use `RadioButtonItem`.
62
+
63
+ ## Styling hooks
64
+
65
+ None: it is an unstyled `<button>`; `class` goes on it. Use `data-state` / `data-disabled` selectors and the design tokens.
66
+
67
+ ## API
68
+
69
+ _Generated from the component's types. Do not edit by hand._
70
+
71
+ ### Props
72
+
73
+ | Name | Type | Default | Required | Description |
74
+ | --- | --- | --- | --- | --- |
75
+ | `dataCy` | `string` | | | |
76
+ | `disabled` | `boolean` | | | When `true`, prevents the user from interacting with the radio item. |
77
+ | `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
78
+ | `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
79
+ | `required` | `boolean` | | | When `true`, indicates that the user must set the value before the owning form can be submitted. |
80
+ | `value` | `AcceptableValue` | | | The value given as data when submitted with a `name`. |
81
+ | `id` | `string` | | | |
82
+ | `name` | `string` | | | The name of the field. Submitted with its owning form as part of a name/value pair. |
83
+
84
+ ### Events
85
+
86
+ | Name | Payload |
87
+ | --- | --- |
88
+ | `select` | `[SelectEvent$2]` |
89
+
90
+ ### v-model
91
+
92
+ None.
93
+
94
+ ### Slots
95
+
96
+ | Name | Slot props |
97
+ | --- | --- |
98
+ | `default` | `{ checked: boolean; required: boolean; disabled: boolean; }` |
99
+
100
+ ### Exposed (template ref)
101
+
102
+ None.