@egose/shadcn-theme-ng-tw 0.0.28 → 0.2.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 +130 -13
- package/accordion/README.md +376 -34
- package/accordion/fesm2022/accordion.mjs +20 -20
- package/alert/README.md +343 -34
- package/alert/fesm2022/alert.mjs +18 -18
- package/alert-dialog/README.md +471 -5
- package/alert-dialog/fesm2022/alert-dialog.mjs +48 -48
- package/alert-dialog/types/alert-dialog.d.ts +1 -1
- package/aspect-ratio/README.md +272 -5
- package/aspect-ratio/fesm2022/aspect-ratio.mjs +9 -9
- package/autocomplete/README.md +473 -34
- package/autocomplete/fesm2022/autocomplete.mjs +54 -54
- package/autocomplete/types/autocomplete.d.ts +1 -1
- package/avatar/README.md +357 -5
- package/avatar/fesm2022/avatar.mjs +32 -32
- package/badge/README.md +289 -34
- package/badge/fesm2022/badge.mjs +4 -4
- package/basic-alert/README.md +324 -34
- package/basic-alert/fesm2022/basic-alert.mjs +4 -4
- package/basic-alert/types/basic-alert.d.ts +1 -1
- package/breadcrumb/README.md +406 -5
- package/breadcrumb/fesm2022/breadcrumb.mjs +34 -34
- package/button/README.md +453 -34
- package/button/fesm2022/button.mjs +96 -118
- package/button/types/button.d.ts +7 -10
- package/button-group/README.md +318 -5
- package/button-group/fesm2022/button-group.mjs +20 -20
- package/calendar/README.md +328 -34
- package/calendar/fesm2022/calendar.mjs +154 -154
- package/card/README.md +331 -5
- package/card/fesm2022/card.mjs +33 -33
- package/carousel/README.md +333 -5
- package/carousel/fesm2022/carousel.mjs +47 -44
- package/carousel/types/carousel.d.ts +1 -1
- package/checkbox/README.md +291 -34
- package/checkbox/fesm2022/checkbox.mjs +22 -20
- package/checkbox/types/checkbox.d.ts +5 -4
- package/collapsible/README.md +332 -5
- package/collapsible/fesm2022/collapsible.mjs +15 -15
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +95 -92
- package/combobox/types/combobox.d.ts +1 -1
- package/command/README.md +435 -5
- package/command/fesm2022/command.mjs +56 -56
- package/confirmation-dialog/README.md +272 -34
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs +13 -12
- package/confirmation-dialog/types/confirmation-dialog.d.ts +9 -5
- package/context-menu/README.md +366 -5
- package/context-menu/fesm2022/context-menu.mjs +9 -9
- package/date-picker/README.md +436 -34
- package/date-picker/fesm2022/date-picker.mjs +79 -68
- package/date-picker/types/date-picker.d.ts +8 -4
- package/dialog/README.md +419 -34
- package/dialog/fesm2022/dialog.mjs +48 -48
- package/drawer/README.md +395 -5
- package/drawer/fesm2022/drawer.mjs +45 -45
- package/dropdown-menu/README.md +417 -5
- package/dropdown-menu/fesm2022/dropdown-menu.mjs +85 -73
- package/dropdown-menu/types/dropdown-menu.d.ts +4 -0
- package/empty/README.md +329 -5
- package/empty/fesm2022/empty.mjs +31 -31
- package/field/README.md +385 -5
- package/field/fesm2022/field.mjs +59 -59
- package/field/types/field.d.ts +1 -1
- package/form-checkbox/README.md +283 -34
- package/form-checkbox/fesm2022/form-checkbox.mjs +37 -19
- package/form-checkbox/types/form-checkbox.d.ts +7 -1
- package/form-date-picker/README.md +293 -34
- package/form-date-picker/fesm2022/form-date-picker.mjs +59 -24
- package/form-date-picker/types/form-date-picker.d.ts +7 -1
- package/form-field/README.md +327 -34
- package/form-field/fesm2022/form-field.mjs +30 -16
- package/form-field/types/form-field.d.ts +28 -20
- package/form-field-simple/README.md +311 -34
- package/form-field-simple/fesm2022/form-field-simple.mjs +4 -4
- package/form-searchable-multiselect/README.md +332 -34
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +41 -21
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +8 -2
- package/form-select/README.md +321 -34
- package/form-select/fesm2022/form-select.mjs +62 -29
- package/form-select/types/form-select.d.ts +7 -1
- package/form-text-input/README.md +342 -34
- package/form-text-input/fesm2022/form-text-input.mjs +43 -55
- package/form-text-input/types/form-text-input.d.ts +9 -12
- package/form-textarea/README.md +318 -34
- package/form-textarea/fesm2022/form-textarea.mjs +42 -23
- package/form-textarea/types/form-textarea.d.ts +8 -1
- package/hover-card/README.md +256 -5
- package/hover-card/fesm2022/hover-card.mjs +19 -19
- package/icon/README.md +210 -34
- package/icon/fesm2022/icon.mjs +8 -8
- package/input/README.md +240 -34
- package/input/fesm2022/input.mjs +17 -12
- package/input/types/input.d.ts +2 -1
- package/input-group/README.md +335 -5
- package/input-group/fesm2022/input-group.mjs +37 -37
- package/input-group/types/input-group.d.ts +3 -3
- package/input-otp/README.md +375 -5
- package/input-otp/fesm2022/input-otp.mjs +27 -27
- package/item/README.md +385 -5
- package/item/fesm2022/item.mjs +54 -54
- package/kbd/README.md +291 -5
- package/kbd/fesm2022/kbd.mjs +13 -13
- package/label/README.md +243 -34
- package/label/fesm2022/label.mjs +9 -9
- package/label/types/label.d.ts +1 -1
- package/layout-simple/README.md +174 -44
- package/layout-simple/fesm2022/layout-simple.mjs +917 -398
- package/layout-simple/types/layout-simple.d.ts +180 -129
- package/menu/README.md +418 -0
- package/menu/fesm2022/menu.mjs +461 -0
- package/menu/package.json +24 -0
- package/menu/types/menu.d.ts +137 -0
- package/menubar/README.md +343 -5
- package/menubar/fesm2022/menubar.mjs +13 -13
- package/native-select/README.md +323 -5
- package/native-select/fesm2022/native-select.mjs +19 -19
- package/navigation-menu/README.md +369 -5
- package/navigation-menu/fesm2022/navigation-menu.mjs +37 -37
- package/package.json +183 -154
- package/pagination/README.md +388 -5
- package/pagination/fesm2022/pagination.mjs +63 -63
- package/popover/README.md +302 -34
- package/popover/fesm2022/popover.mjs +30 -30
- package/progress/README.md +311 -5
- package/progress/fesm2022/progress.mjs +13 -13
- package/radio-group/README.md +335 -34
- package/radio-group/fesm2022/radio-group.mjs +26 -19
- package/resizable/README.md +269 -5
- package/resizable/fesm2022/resizable.mjs +19 -19
- package/scroll-area/README.md +233 -5
- package/scroll-area/fesm2022/scroll-area.mjs +9 -9
- package/searchable-multiselect/README.md +294 -34
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs +63 -16
- package/searchable-multiselect/types/searchable-multiselect.d.ts +8 -2
- package/select/README.md +408 -34
- package/select/fesm2022/select.mjs +80 -72
- package/select/types/select.d.ts +3 -1
- package/separator/README.md +193 -34
- package/separator/fesm2022/separator.mjs +9 -9
- package/separator/types/separator.d.ts +1 -1
- package/sheet/README.md +282 -34
- package/sheet/fesm2022/sheet.mjs +30 -30
- package/sidebar/README.md +457 -5
- package/sidebar/fesm2022/sidebar.mjs +136 -134
- package/sidebar/types/sidebar.d.ts +3 -3
- package/skeleton/README.md +217 -5
- package/skeleton/fesm2022/skeleton.mjs +9 -9
- package/slider/README.md +273 -5
- package/slider/fesm2022/slider.mjs +29 -25
- package/sonner/README.md +317 -34
- package/sonner/fesm2022/sonner.mjs +9 -9
- package/spinner/README.md +255 -34
- package/spinner/fesm2022/spinner.mjs +8 -8
- package/switch/README.md +281 -34
- package/switch/fesm2022/switch.mjs +12 -14
- package/table/README.md +423 -5
- package/table/fesm2022/table.mjs +41 -41
- package/tabs/README.md +382 -34
- package/tabs/fesm2022/tabs.mjs +48 -38
- package/textarea/README.md +282 -5
- package/textarea/fesm2022/textarea.mjs +9 -9
- package/toggle/README.md +270 -5
- package/toggle/fesm2022/toggle.mjs +14 -14
- package/toggle-group/README.md +340 -5
- package/toggle-group/fesm2022/toggle-group.mjs +13 -13
- package/toggle-group/types/toggle-group.d.ts +13 -7
- package/tooltip/README.md +240 -34
- package/tooltip/fesm2022/tooltip.mjs +14 -14
- package/typography/README.md +271 -5
- package/typography/fesm2022/typography.mjs +53 -53
- package/typography/types/typography.d.ts +12 -12
- package/utils/README.md +274 -34
- package/utils/fesm2022/utils.mjs +68 -44
- package/accordion/fesm2022/accordion.mjs.map +0 -1
- package/alert/fesm2022/alert.mjs.map +0 -1
- package/alert-dialog/fesm2022/alert-dialog.mjs.map +0 -1
- package/aspect-ratio/fesm2022/aspect-ratio.mjs.map +0 -1
- package/autocomplete/fesm2022/autocomplete.mjs.map +0 -1
- package/avatar/fesm2022/avatar.mjs.map +0 -1
- package/badge/fesm2022/badge.mjs.map +0 -1
- package/basic-alert/fesm2022/basic-alert.mjs.map +0 -1
- package/breadcrumb/fesm2022/breadcrumb.mjs.map +0 -1
- package/button/fesm2022/button.mjs.map +0 -1
- package/button-group/fesm2022/button-group.mjs.map +0 -1
- package/calendar/fesm2022/calendar.mjs.map +0 -1
- package/card/fesm2022/card.mjs.map +0 -1
- package/carousel/fesm2022/carousel.mjs.map +0 -1
- package/checkbox/fesm2022/checkbox.mjs.map +0 -1
- package/collapsible/fesm2022/collapsible.mjs.map +0 -1
- package/combobox/fesm2022/combobox.mjs.map +0 -1
- package/command/fesm2022/command.mjs.map +0 -1
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs.map +0 -1
- package/context-menu/fesm2022/context-menu.mjs.map +0 -1
- package/date-picker/fesm2022/date-picker.mjs.map +0 -1
- package/dialog/fesm2022/dialog.mjs.map +0 -1
- package/drawer/fesm2022/drawer.mjs.map +0 -1
- package/dropdown-menu/fesm2022/dropdown-menu.mjs.map +0 -1
- package/empty/fesm2022/empty.mjs.map +0 -1
- package/field/fesm2022/field.mjs.map +0 -1
- package/form-checkbox/fesm2022/form-checkbox.mjs.map +0 -1
- package/form-date-picker/fesm2022/form-date-picker.mjs.map +0 -1
- package/form-field/fesm2022/form-field.mjs.map +0 -1
- package/form-field-simple/fesm2022/form-field-simple.mjs.map +0 -1
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs.map +0 -1
- package/form-select/fesm2022/form-select.mjs.map +0 -1
- package/form-text-input/fesm2022/form-text-input.mjs.map +0 -1
- package/form-textarea/fesm2022/form-textarea.mjs.map +0 -1
- package/hover-card/fesm2022/hover-card.mjs.map +0 -1
- package/icon/fesm2022/icon.mjs.map +0 -1
- package/input/fesm2022/input.mjs.map +0 -1
- package/input-group/fesm2022/input-group.mjs.map +0 -1
- package/input-otp/fesm2022/input-otp.mjs.map +0 -1
- package/item/fesm2022/item.mjs.map +0 -1
- package/kbd/fesm2022/kbd.mjs.map +0 -1
- package/label/fesm2022/label.mjs.map +0 -1
- package/layout-simple/fesm2022/layout-simple.mjs.map +0 -1
- package/menubar/fesm2022/menubar.mjs.map +0 -1
- package/native-select/fesm2022/native-select.mjs.map +0 -1
- package/navigation-menu/fesm2022/navigation-menu.mjs.map +0 -1
- package/pagination/fesm2022/pagination.mjs.map +0 -1
- package/popover/fesm2022/popover.mjs.map +0 -1
- package/progress/fesm2022/progress.mjs.map +0 -1
- package/radio-group/fesm2022/radio-group.mjs.map +0 -1
- package/resizable/fesm2022/resizable.mjs.map +0 -1
- package/scroll-area/fesm2022/scroll-area.mjs.map +0 -1
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs.map +0 -1
- package/select/fesm2022/select.mjs.map +0 -1
- package/separator/fesm2022/separator.mjs.map +0 -1
- package/sheet/fesm2022/sheet.mjs.map +0 -1
- package/sidebar/fesm2022/sidebar.mjs.map +0 -1
- package/skeleton/fesm2022/skeleton.mjs.map +0 -1
- package/slider/fesm2022/slider.mjs.map +0 -1
- package/sonner/fesm2022/sonner.mjs.map +0 -1
- package/spinner/fesm2022/spinner.mjs.map +0 -1
- package/switch/fesm2022/switch.mjs.map +0 -1
- package/table/fesm2022/table.mjs.map +0 -1
- package/tabs/fesm2022/tabs.mjs.map +0 -1
- package/textarea/fesm2022/textarea.mjs.map +0 -1
- package/toggle/fesm2022/toggle.mjs.map +0 -1
- package/toggle-group/fesm2022/toggle-group.mjs.map +0 -1
- package/tooltip/fesm2022/tooltip.mjs.map +0 -1
- package/typography/fesm2022/typography.mjs.map +0 -1
- package/utils/fesm2022/utils.mjs.map +0 -1
package/checkbox/README.md
CHANGED
|
@@ -1,64 +1,321 @@
|
|
|
1
|
-
# Checkbox
|
|
1
|
+
# Checkbox (`@egose/shadcn-theme-ng/checkbox`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A shadcn/ui-style checkbox — the Angular port of shadcn/ui `Checkbox`. A single standalone `hlm-checkbox` component wraps `BrnCheckbox` from `@spartan-ng/brain/checkbox`, renders the `lucideCheck` icon when checked, and fully implements `ControlValueAccessor`, so it works with `[(checked)]`, `[(ngModel)]`, and reactive `FormControl`s. Supports the tri-state `boolean | 'indeterminate'` model, separate `disabled` (form-aware) vs `wrapperDisabled` (visual-only) locks, and a `changed` output.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Ships as `@egose/shadcn-theme-ng/checkbox` and `@egose/shadcn-theme-ng-tw/checkbox` (the `tw:`-prefixed variant). See the [package README](../../README.md) for install, peer dependencies, and Tailwind setup. Do not publish this project directory independently — it is consumed via the published subpath only.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
# Plain Tailwind (no prefix):
|
|
11
|
+
npm install @egose/shadcn-theme-ng
|
|
12
|
+
|
|
13
|
+
# Or the tw:-prefixed variant:
|
|
14
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Peers are listed in the [package README](../../README.md). This subpath declares `@angular/common` and `@angular/core` as peers (see `projects/checkbox/package.json`); `FormsModule`/`ReactiveFormsModule` come from your app when you use form bindings.
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
## Imports
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
HlmCheckbox,
|
|
24
|
+
HlmCheckboxImports,
|
|
25
|
+
HlmCheckboxModule,
|
|
26
|
+
HLM_CHECKBOX_VALUE_ACCESSOR,
|
|
27
|
+
} from '@egose/shadcn-theme-ng/checkbox';
|
|
28
|
+
// tw variant:
|
|
29
|
+
// import { ... } from '@egose/shadcn-theme-ng-tw/checkbox';
|
|
17
30
|
```
|
|
18
31
|
|
|
19
|
-
|
|
32
|
+
Standalone:
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
```ts
|
|
35
|
+
import { Component } from '@angular/core';
|
|
36
|
+
import { HlmCheckboxImports } from '@egose/shadcn-theme-ng/checkbox';
|
|
22
37
|
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
@Component({
|
|
39
|
+
selector: 'app-demo',
|
|
40
|
+
standalone: true,
|
|
41
|
+
imports: [...HlmCheckboxImports],
|
|
42
|
+
template: `<hlm-checkbox />`,
|
|
43
|
+
})
|
|
44
|
+
export class DemoComponent {}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
NgModule:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { NgModule } from '@angular/core';
|
|
51
|
+
import { HlmCheckboxModule } from '@egose/shadcn-theme-ng/checkbox';
|
|
52
|
+
|
|
53
|
+
@NgModule({ imports: [HlmCheckboxModule] })
|
|
54
|
+
export class DemoModule {}
|
|
25
55
|
```
|
|
26
56
|
|
|
27
|
-
|
|
57
|
+
## Anatomy / Structure
|
|
28
58
|
|
|
29
|
-
|
|
59
|
+
```html
|
|
60
|
+
<!-- Two-way model binding -->
|
|
61
|
+
<hlm-checkbox [(checked)]="accept" aria-label="Accept terms" />
|
|
30
62
|
|
|
31
|
-
|
|
63
|
+
<!-- With visible label -->
|
|
64
|
+
<div class="flex items-center gap-2">
|
|
65
|
+
<hlm-checkbox id="marketing" [(checked)]="marketing" />
|
|
66
|
+
<label for="marketing">Email me product updates</label>
|
|
67
|
+
</div>
|
|
32
68
|
|
|
33
|
-
|
|
69
|
+
<!-- Reactive form -->
|
|
70
|
+
<hlm-checkbox formControlName="accept" />
|
|
34
71
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
72
|
+
<!-- Template-driven -->
|
|
73
|
+
<hlm-checkbox name="accept" [(ngModel)]="accept" />
|
|
74
|
+
```
|
|
38
75
|
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm publish
|
|
42
|
-
```
|
|
76
|
+
Real selector: `hlm-checkbox` (element only). The host renders `class="contents peer"` so sibling label/description selectors (`peer-*`) keep working; `id` / `aria-*` attributes are nulled on the host and forwarded to the inner `brn-checkbox` instead. Set a visible label with a native `<label for>` — the component does not render label text itself.
|
|
43
77
|
|
|
44
|
-
##
|
|
78
|
+
## API reference
|
|
45
79
|
|
|
46
|
-
|
|
80
|
+
### `HlmCheckbox` (`hlm-checkbox`)
|
|
47
81
|
|
|
48
|
-
|
|
49
|
-
|
|
82
|
+
| Input | Type | Default | Description |
|
|
83
|
+
| -------------------------------------- | ----------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
84
|
+
| `checked` | `model<boolean \| 'indeterminate'>` | `false` | Checked state. Two-way bindable (`[(checked)]`). `'indeterminate'` renders the checked icon; clicking it resolves to `true`. |
|
|
85
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra classes merged into the box. |
|
|
86
|
+
| `id` | `string \| null` | `null` | Forwarded to inner `brn-checkbox`. Pair with `<label for>`. |
|
|
87
|
+
| `aria-label` (`ariaLabel`) | `string \| null` | `null` | Forwarded aria-label. |
|
|
88
|
+
| `aria-labelledby` (`ariaLabelledby`) | `string \| null` | `null` | Forwarded aria-labelledby. |
|
|
89
|
+
| `aria-describedby` (`ariaDescribedby`) | `string \| null` | `null` | Forwarded aria-describedby. |
|
|
90
|
+
| `name` | `string \| null` | `null` | Forwarded `name`. |
|
|
91
|
+
| `required` | `boolean` | `false` | Forwarded `required` (boolean-coerced). |
|
|
92
|
+
| `disabled` | `boolean` | `false` | Visual + interaction lock (boolean-coerced). Clicks are ignored. |
|
|
93
|
+
| `wrapperDisabled` | `boolean` | `false` | Additional visual/interaction lock that does **not** write to a reactive form control (unlike `setDisabledState`). Useful for preview-only states. |
|
|
94
|
+
|
|
95
|
+
| Signal | Type | Description |
|
|
96
|
+
| --------------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
97
|
+
| `disabledState` | `Signal<boolean>` | `disabled() \|\| wrapperDisabled() \|\| formDisabled()` — the effective lock. Host reflects `data-disabled`. |
|
|
98
|
+
|
|
99
|
+
| Output | Payload | Description |
|
|
100
|
+
| --------- | --------- | -------------------------------------------------------------------------------------------------------------- |
|
|
101
|
+
| `changed` | `boolean` | Emitted on user toggle with the new boolean (`!previous`). Note: toggling from `'indeterminate'` emits `true`. |
|
|
102
|
+
|
|
103
|
+
ControlValueAccessor: `writeValue(value)`, `registerOnChange`, `registerOnTouched`, `setDisabledState(isDisabled)` (writes `formDisabled`, hence `disabledState`). `HLM_CHECKBOX_VALUE_ACCESSOR` (`NG_VALUE_ACCESSOR`, `forwardRef(HlmCheckbox)`, `multi: true`) is provided on the component.
|
|
104
|
+
|
|
105
|
+
## Examples
|
|
106
|
+
|
|
107
|
+
### 1. Basic with label
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { Component, signal } from '@angular/core';
|
|
111
|
+
import { HlmCheckboxImports } from '@egose/shadcn-theme-ng/checkbox';
|
|
112
|
+
|
|
113
|
+
@Component({
|
|
114
|
+
selector: 'app-basic-checkbox',
|
|
115
|
+
standalone: true,
|
|
116
|
+
imports: [...HlmCheckboxImports],
|
|
117
|
+
template: `
|
|
118
|
+
<div class="flex items-center gap-2">
|
|
119
|
+
<hlm-checkbox id="terms" [(checked)]="accept" />
|
|
120
|
+
<label for="terms" class="text-sm">Accept terms and conditions</label>
|
|
121
|
+
</div>
|
|
122
|
+
<p class="mt-2 text-sm">Value: {{ accept() }}</p>
|
|
123
|
+
`,
|
|
124
|
+
})
|
|
125
|
+
export class BasicCheckboxComponent {
|
|
126
|
+
readonly accept = signal<boolean | 'indeterminate'>(false);
|
|
127
|
+
}
|
|
50
128
|
```
|
|
51
129
|
|
|
52
|
-
|
|
130
|
+
### 2. Reactive form with validation
|
|
53
131
|
|
|
54
|
-
|
|
132
|
+
`hlm-checkbox` is a `ControlValueAccessor` — `formControlName` just works, including `disable()`.
|
|
55
133
|
|
|
56
|
-
```
|
|
57
|
-
|
|
134
|
+
```ts
|
|
135
|
+
import { Component } from '@angular/core';
|
|
136
|
+
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
137
|
+
import { HlmCheckboxImports } from '@egose/shadcn-theme-ng/checkbox';
|
|
138
|
+
|
|
139
|
+
@Component({
|
|
140
|
+
selector: 'app-reactive-checkbox',
|
|
141
|
+
standalone: true,
|
|
142
|
+
imports: [ReactiveFormsModule, ...HlmCheckboxImports],
|
|
143
|
+
template: `
|
|
144
|
+
<form [formGroup]="form" (ngSubmit)="submit()" class="space-y-3">
|
|
145
|
+
<div class="flex items-center gap-2">
|
|
146
|
+
<hlm-checkbox id="accept" formControlName="accept" />
|
|
147
|
+
<label for="accept" class="text-sm">I agree to the privacy policy</label>
|
|
148
|
+
</div>
|
|
149
|
+
@if (form.controls.accept.touched && form.controls.accept.invalid) {
|
|
150
|
+
<p class="text-destructive text-sm">You must accept to continue.</p>
|
|
151
|
+
}
|
|
152
|
+
<button type="submit" [disabled]="form.invalid">Continue</button>
|
|
153
|
+
<button type="button" (click)="form.controls.accept.disable()">Disable via form</button>
|
|
154
|
+
</form>
|
|
155
|
+
`,
|
|
156
|
+
})
|
|
157
|
+
export class ReactiveCheckboxComponent {
|
|
158
|
+
readonly form = new FormGroup({
|
|
159
|
+
accept: new FormControl(false, { validators: Validators.requiredTrue, nonNullable: true }),
|
|
160
|
+
});
|
|
161
|
+
submit() {
|
|
162
|
+
console.log(this.form.getRawValue());
|
|
163
|
+
}
|
|
164
|
+
}
|
|
58
165
|
```
|
|
59
166
|
|
|
60
|
-
|
|
167
|
+
### 3. Template-driven (`ngModel`)
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import { Component } from '@angular/core';
|
|
171
|
+
import { FormsModule } from '@angular/forms';
|
|
172
|
+
import { HlmCheckboxImports } from '@egose/shadcn-theme-ng/checkbox';
|
|
173
|
+
|
|
174
|
+
@Component({
|
|
175
|
+
selector: 'app-ngmodel-checkbox',
|
|
176
|
+
standalone: true,
|
|
177
|
+
imports: [FormsModule, ...HlmCheckboxImports],
|
|
178
|
+
template: `
|
|
179
|
+
<div class="flex items-center gap-2">
|
|
180
|
+
<hlm-checkbox id="news" name="news" [(ngModel)]="subscribed" aria-label="Subscribe to newsletter" />
|
|
181
|
+
<label for="news" class="text-sm">Subscribe to newsletter</label>
|
|
182
|
+
</div>
|
|
183
|
+
`,
|
|
184
|
+
})
|
|
185
|
+
export class NgModelCheckboxComponent {
|
|
186
|
+
subscribed = true;
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 4. Indeterminate + select-all pattern
|
|
191
|
+
|
|
192
|
+
Parent shows `'indeterminate'` when some (not all) children are checked — the classic bulk-select header.
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
import { Component, computed, signal } from '@angular/core';
|
|
196
|
+
import { HlmCheckboxImports } from '@egose/shadcn-theme-ng/checkbox';
|
|
197
|
+
|
|
198
|
+
@Component({
|
|
199
|
+
selector: 'app-select-all',
|
|
200
|
+
standalone: true,
|
|
201
|
+
imports: [...HlmCheckboxImports],
|
|
202
|
+
template: `
|
|
203
|
+
<div class="flex items-center gap-2 border-b pb-2">
|
|
204
|
+
<hlm-checkbox id="all" [checked]="parentState()" (changed)="toggleAll($event)" aria-label="Select all files" />
|
|
205
|
+
<label for="all" class="text-sm font-medium">Select all</label>
|
|
206
|
+
</div>
|
|
207
|
+
@for (f of files(); track f.id) {
|
|
208
|
+
<div class="flex items-center gap-2 py-1">
|
|
209
|
+
<hlm-checkbox [id]="f.id" [checked]="f.done" (changed)="toggleOne(f.id, $event)" />
|
|
210
|
+
<label [for]="f.id" class="text-sm">{{ f.name }}</label>
|
|
211
|
+
</div>
|
|
212
|
+
}
|
|
213
|
+
`,
|
|
214
|
+
})
|
|
215
|
+
export class SelectAllComponent {
|
|
216
|
+
readonly files = signal([
|
|
217
|
+
{ id: 'f1', name: 'invoice.pdf', done: true },
|
|
218
|
+
{ id: 'f2', name: 'photo.png', done: false },
|
|
219
|
+
{ id: 'f3', name: 'notes.md', done: false },
|
|
220
|
+
]);
|
|
221
|
+
readonly parentState = computed<boolean | 'indeterminate'>(() => {
|
|
222
|
+
const all = this.files();
|
|
223
|
+
if (all.every((f) => f.done)) return true;
|
|
224
|
+
if (all.some((f) => f.done)) return 'indeterminate';
|
|
225
|
+
return false;
|
|
226
|
+
});
|
|
227
|
+
toggleAll(next: boolean) {
|
|
228
|
+
this.files.update((fs) => fs.map((f) => ({ ...f, done: next })));
|
|
229
|
+
}
|
|
230
|
+
toggleOne(id: string, next: boolean) {
|
|
231
|
+
this.files.update((fs) => fs.map((f) => (f.id === id ? { ...f, done: next } : f)));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 5. Disabled / wrapper-disabled / required states
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
import { Component, signal } from '@angular/core';
|
|
240
|
+
import { HlmCheckboxImports } from '@egose/shadcn-theme-ng/checkbox';
|
|
241
|
+
|
|
242
|
+
@Component({
|
|
243
|
+
selector: 'app-states-checkbox',
|
|
244
|
+
standalone: true,
|
|
245
|
+
imports: [...HlmCheckboxImports],
|
|
246
|
+
template: `
|
|
247
|
+
<div class="space-y-2">
|
|
248
|
+
<div class="flex items-center gap-2">
|
|
249
|
+
<hlm-checkbox id="d1" [disabled]="true" aria-label="Disabled unchecked" />
|
|
250
|
+
<label for="d1" class="text-sm opacity-70">Disabled (unchecked)</label>
|
|
251
|
+
</div>
|
|
252
|
+
<div class="flex items-center gap-2">
|
|
253
|
+
<hlm-checkbox id="d2" [checked]="true" [disabled]="true" aria-label="Disabled checked" />
|
|
254
|
+
<label for="d2" class="text-sm opacity-70">Disabled (checked)</label>
|
|
255
|
+
</div>
|
|
256
|
+
<div class="flex items-center gap-2">
|
|
257
|
+
<hlm-checkbox id="w1" [wrapperDisabled]="preview()" aria-label="Preview lock" />
|
|
258
|
+
<label for="w1" class="text-sm">Preview lock (visual only — form value untouched)</label>
|
|
259
|
+
</div>
|
|
260
|
+
<div class="flex items-center gap-2">
|
|
261
|
+
<hlm-checkbox id="r1" [(checked)]="v" [required]="true" aria-label="Required" />
|
|
262
|
+
<label for="r1" class="text-sm">Required</label>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
`,
|
|
266
|
+
})
|
|
267
|
+
export class StatesCheckboxComponent {
|
|
268
|
+
readonly preview = signal(true);
|
|
269
|
+
v = false;
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 6. Listening to `changed` + custom styling
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
import { Component } from '@angular/core';
|
|
277
|
+
import { HlmCheckboxImports } from '@egose/shadcn-theme-ng/checkbox';
|
|
278
|
+
|
|
279
|
+
@Component({
|
|
280
|
+
selector: 'app-changed-checkbox',
|
|
281
|
+
standalone: true,
|
|
282
|
+
imports: [...HlmCheckboxImports],
|
|
283
|
+
template: `
|
|
284
|
+
<div class="flex items-center gap-2">
|
|
285
|
+
<hlm-checkbox
|
|
286
|
+
id="audit"
|
|
287
|
+
class="data-[state=checked]:border-emerald-600 data-[state=checked]:bg-emerald-600"
|
|
288
|
+
aria-label="Enable audit log"
|
|
289
|
+
(changed)="onChanged($event)"
|
|
290
|
+
/>
|
|
291
|
+
<label for="audit" class="text-sm">Enable audit log</label>
|
|
292
|
+
</div>
|
|
293
|
+
<p class="mt-1 text-sm">Last event: {{ lastChanged === null ? 'none' : lastChanged }}</p>
|
|
294
|
+
`,
|
|
295
|
+
})
|
|
296
|
+
export class ChangedCheckboxComponent {
|
|
297
|
+
lastChanged: boolean | null = null;
|
|
298
|
+
onChanged(next: boolean) {
|
|
299
|
+
this.lastChanged = next;
|
|
300
|
+
console.log('checkbox changed →', next);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Accessibility notes
|
|
306
|
+
|
|
307
|
+
- The component renders a native-checkbox-equivalent `brn-checkbox` with `aria-label`/`labelledby`/`describedby` forwarding — always provide one: visible `<label for>` preferred, `aria-label` for icon-only rows.
|
|
308
|
+
- `disabledState` adds `data-disabled`, `cursor-not-allowed`, and `opacity-50`; disabled boxes are skipped correctly because clicks early-return.
|
|
309
|
+
- The check glyph is decorative (`lucideCheck` icon, no text) — state is exposed via `data-[state]` / native semantics, not the icon.
|
|
310
|
+
- Tri-state: `'indeterminate'` is a visual/model state, not `aria-checked="mixed"` — if you need mixed semantics for a tree, add `aria-checked` handling at your own level and test with a screen reader.
|
|
311
|
+
|
|
312
|
+
## Theming / CSS variables
|
|
313
|
+
|
|
314
|
+
No component-specific CSS variables. The box uses `border-input`, `data-[state=checked]:bg-primary` / `text-primary-foreground`, `focus-visible:ring-ring/50`, `aria-invalid:border-destructive`, `size-4 rounded-[4px]`. Invalid-form styling integrates via `aria-invalid` ring tokens. Pass `class` to extend (merged with `hlm()`).
|
|
61
315
|
|
|
62
|
-
##
|
|
316
|
+
## Related subpaths
|
|
63
317
|
|
|
64
|
-
|
|
318
|
+
- `@egose/shadcn-theme-ng/form-checkbox` — labeled + described + validated field composition.
|
|
319
|
+
- `@egose/shadcn-theme-ng/label` — accessible labels for the `for`/`id` pair.
|
|
320
|
+
- `@egose/shadcn-theme-ng/field` — form layout rows that host checkboxes.
|
|
321
|
+
- `@egose/shadcn-theme-ng/icon` — `HlmIcon` sizing used by the inner check glyph.
|
|
@@ -14,7 +14,7 @@ const HLM_CHECKBOX_VALUE_ACCESSOR = {
|
|
|
14
14
|
};
|
|
15
15
|
class HlmCheckbox {
|
|
16
16
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
17
|
-
_computedClass = computed(() => hlm('tw:border-input tw:dark:bg-input/30 tw:data-[state=checked]:bg-primary tw:data-[state=checked]:text-primary-foreground tw:dark:data-[state=checked]:bg-primary tw:data-[state=checked]:border-primary tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:aria-invalid:ring-destructive/20 tw:dark:aria-invalid:ring-destructive/40 tw:aria-invalid:border-destructive tw:shadow-xs tw:peer tw:size-4 tw:shrink-0 tw:cursor-default tw:rounded-[4px] tw:border tw:outline-none tw:transition-shadow tw:focus-visible:ring-[3px] tw:disabled:cursor-not-allowed tw:disabled:opacity-50', this.userClass(), this.
|
|
17
|
+
_computedClass = computed(() => hlm('tw:border-input tw:dark:bg-input/30 tw:data-[state=checked]:bg-primary tw:data-[state=checked]:text-primary-foreground tw:dark:data-[state=checked]:bg-primary tw:data-[state=checked]:border-primary tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:aria-invalid:ring-destructive/20 tw:dark:aria-invalid:ring-destructive/40 tw:aria-invalid:border-destructive tw:shadow-xs tw:peer tw:size-4 tw:shrink-0 tw:cursor-default tw:rounded-[4px] tw:border tw:outline-none tw:transition-shadow tw:focus-visible:ring-[3px] tw:disabled:cursor-not-allowed tw:disabled:opacity-50', this.userClass(), this.disabledState() ? 'tw:cursor-not-allowed tw:opacity-50' : ''), /* @ts-ignore */
|
|
18
18
|
...(ngDevMode ? [{ debugName: "_computedClass" }] : /* istanbul ignore next */ []));
|
|
19
19
|
/** Used to set the id on the underlying brn element. */
|
|
20
20
|
id = input(null, /* @ts-ignore */
|
|
@@ -35,15 +35,17 @@ class HlmCheckbox {
|
|
|
35
35
|
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
36
36
|
/** Whether the checkbox is disabled. */
|
|
37
37
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...(ngDevMode ? [{ debugName: "
|
|
38
|
+
/** Additional visual/interaction lock that does not write to a reactive form control. */
|
|
39
|
+
wrapperDisabled = input(false, { ...(ngDevMode ? { debugName: "wrapperDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
40
|
+
formDisabled = signal(false, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
|
|
42
|
+
disabledState = computed(() => this.disabled() || this.wrapperDisabled() || this.formDisabled(), /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
42
44
|
changed = output();
|
|
43
45
|
_onChange;
|
|
44
46
|
_onTouched;
|
|
45
47
|
_handleChange() {
|
|
46
|
-
if (this.
|
|
48
|
+
if (this.disabledState())
|
|
47
49
|
return;
|
|
48
50
|
const previousChecked = this.checked();
|
|
49
51
|
this.checked.set(previousChecked === 'indeterminate' ? true : !previousChecked);
|
|
@@ -61,16 +63,16 @@ class HlmCheckbox {
|
|
|
61
63
|
this._onTouched = fn;
|
|
62
64
|
}
|
|
63
65
|
setDisabledState(isDisabled) {
|
|
64
|
-
this.
|
|
66
|
+
this.formDisabled.set(isDisabled);
|
|
65
67
|
}
|
|
66
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
67
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
68
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
69
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmCheckbox, isStandalone: true, selector: "hlm-checkbox", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, wrapperDisabled: { classPropertyName: "wrapperDisabled", publicName: "wrapperDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", changed: "changed" }, host: { properties: { "attr.id": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.aria-describedby": "null", "attr.data-disabled": "disabledState() ? \"\" : null" }, classAttribute: "contents peer" }, providers: [HLM_CHECKBOX_VALUE_ACCESSOR], ngImport: i0, template: `
|
|
68
70
|
<brn-checkbox
|
|
69
71
|
[id]="id()"
|
|
70
72
|
[name]="name()"
|
|
71
73
|
[class]="_computedClass()"
|
|
72
74
|
[checked]="checked()"
|
|
73
|
-
[disabled]="
|
|
75
|
+
[disabled]="disabledState()"
|
|
74
76
|
[required]="required()"
|
|
75
77
|
[aria-label]="ariaLabel()"
|
|
76
78
|
[aria-labelledby]="ariaLabelledby()"
|
|
@@ -86,7 +88,7 @@ class HlmCheckbox {
|
|
|
86
88
|
</brn-checkbox>
|
|
87
89
|
`, isInline: true, dependencies: [{ kind: "component", type: BrnCheckbox, selector: "brn-checkbox", inputs: ["checked", "indeterminate", "id", "name", "class", "hostStyles", "aria-label", "aria-labelledby", "aria-describedby", "required", "disabled", "forceInvalid"], outputs: ["checkedChange", "indeterminateChange", "touched"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }], viewProviders: [provideIcons({ lucideCheck })], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
88
90
|
}
|
|
89
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCheckbox, decorators: [{
|
|
90
92
|
type: Component,
|
|
91
93
|
args: [{
|
|
92
94
|
selector: 'hlm-checkbox',
|
|
@@ -97,7 +99,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
97
99
|
[name]="name()"
|
|
98
100
|
[class]="_computedClass()"
|
|
99
101
|
[checked]="checked()"
|
|
100
|
-
[disabled]="
|
|
102
|
+
[disabled]="disabledState()"
|
|
101
103
|
[required]="required()"
|
|
102
104
|
[aria-label]="ariaLabel()"
|
|
103
105
|
[aria-labelledby]="ariaLabelledby()"
|
|
@@ -113,29 +115,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
113
115
|
</brn-checkbox>
|
|
114
116
|
`,
|
|
115
117
|
host: {
|
|
116
|
-
class:
|
|
118
|
+
class: "tw:contents tw:peer",
|
|
117
119
|
'[attr.id]': 'null',
|
|
118
120
|
'[attr.aria-label]': 'null',
|
|
119
121
|
'[attr.aria-labelledby]': 'null',
|
|
120
122
|
'[attr.aria-describedby]': 'null',
|
|
121
|
-
'[attr.data-disabled]': '
|
|
123
|
+
'[attr.data-disabled]': 'disabledState() ? "" : null',
|
|
122
124
|
},
|
|
123
125
|
providers: [HLM_CHECKBOX_VALUE_ACCESSOR],
|
|
124
126
|
viewProviders: [provideIcons({ lucideCheck })],
|
|
125
127
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
126
128
|
}]
|
|
127
|
-
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], changed: [{ type: i0.Output, args: ["changed"] }] } });
|
|
129
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], wrapperDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrapperDisabled", required: false }] }], changed: [{ type: i0.Output, args: ["changed"] }] } });
|
|
128
130
|
|
|
129
131
|
/*
|
|
130
132
|
* Public API Surface of checkbox
|
|
131
133
|
*/
|
|
132
134
|
const HlmCheckboxImports = [HlmCheckbox];
|
|
133
135
|
class HlmCheckboxModule {
|
|
134
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
135
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.
|
|
136
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.
|
|
136
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
137
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: HlmCheckboxModule, imports: [HlmCheckbox], exports: [HlmCheckbox] });
|
|
138
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCheckboxModule, imports: [HlmCheckboxImports] });
|
|
137
139
|
}
|
|
138
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCheckboxModule, decorators: [{
|
|
139
141
|
type: NgModule,
|
|
140
142
|
args: [{
|
|
141
143
|
imports: [...HlmCheckboxImports],
|
|
@@ -148,4 +150,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
148
150
|
*/
|
|
149
151
|
|
|
150
152
|
export { HLM_CHECKBOX_VALUE_ACCESSOR, HlmCheckbox, HlmCheckboxImports, HlmCheckboxModule };
|
|
151
|
-
|
|
153
|
+
|
|
@@ -28,9 +28,10 @@ declare class HlmCheckbox implements ControlValueAccessor {
|
|
|
28
28
|
readonly required: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
29
29
|
/** Whether the checkbox is disabled. */
|
|
30
30
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
/** Additional visual/interaction lock that does not write to a reactive form control. */
|
|
32
|
+
readonly wrapperDisabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
33
|
+
private readonly formDisabled;
|
|
34
|
+
readonly disabledState: _angular_core.Signal<boolean>;
|
|
34
35
|
readonly changed: _angular_core.OutputEmitterRef<boolean>;
|
|
35
36
|
protected _onChange?: ChangeFn<CheckboxValue>;
|
|
36
37
|
protected _onTouched?: TouchFn;
|
|
@@ -41,7 +42,7 @@ declare class HlmCheckbox implements ControlValueAccessor {
|
|
|
41
42
|
registerOnTouched(fn: TouchFn): void;
|
|
42
43
|
setDisabledState(isDisabled: boolean): void;
|
|
43
44
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmCheckbox, never>;
|
|
44
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HlmCheckbox, "hlm-checkbox", never, { "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "changed": "changed"; }, never, never, true, never>;
|
|
45
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HlmCheckbox, "hlm-checkbox", never, { "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "wrapperDisabled": { "alias": "wrapperDisabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "changed": "changed"; }, never, never, true, never>;
|
|
45
46
|
}
|
|
46
47
|
type CheckboxValue = boolean | 'indeterminate';
|
|
47
48
|
|