ngx-strata 0.3.0 → 0.4.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 (49) hide show
  1. package/assets/icons/check.svg +1 -0
  2. package/assets/styles/components/accordion.scss +12 -1
  3. package/assets/styles/components/action-menu.scss +1 -1
  4. package/assets/styles/components/avatar.scss +48 -9
  5. package/assets/styles/components/badge.scss +134 -0
  6. package/assets/styles/components/button.scss +45 -0
  7. package/assets/styles/components/checkbox.scss +10 -2
  8. package/assets/styles/components/file-upload.scss +113 -0
  9. package/assets/styles/components/image-cropper.scss +201 -0
  10. package/assets/styles/components/input-field.scss +39 -9
  11. package/assets/styles/components/item.scss +1 -1
  12. package/assets/styles/components/modal.scss +106 -1
  13. package/assets/styles/components/notification.scss +29 -0
  14. package/assets/styles/components/otp.scss +132 -0
  15. package/assets/styles/components/pagination.scss +13 -3
  16. package/assets/styles/components/progress.scss +2 -2
  17. package/assets/styles/components/radio.scss +3 -2
  18. package/assets/styles/components/segmented-control.scss +43 -11
  19. package/assets/styles/components/select.scss +29 -6
  20. package/assets/styles/components/slider.scss +30 -2
  21. package/assets/styles/components/stepper.scss +378 -0
  22. package/assets/styles/components/table.scss +1 -1
  23. package/assets/styles/components/tabs.scss +1 -1
  24. package/assets/styles/components/toggle.scss +1 -0
  25. package/assets/styles/components/tooltip.scss +9 -6
  26. package/assets/styles/public-api.scss +6 -1
  27. package/dist/strata/strata.css +1 -1
  28. package/fesm2022/ngx-strata.mjs +3058 -1455
  29. package/fesm2022/ngx-strata.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/skills/ngx-strata/SKILL.md +43 -18
  32. package/skills/ngx-strata/components/accordion.md +9 -7
  33. package/skills/ngx-strata/components/avatar.md +22 -10
  34. package/skills/ngx-strata/components/badge.md +54 -0
  35. package/skills/ngx-strata/components/checkbox.md +30 -5
  36. package/skills/ngx-strata/components/file-upload.md +50 -0
  37. package/skills/ngx-strata/components/icon.md +12 -7
  38. package/skills/ngx-strata/components/image-cropper.md +83 -0
  39. package/skills/ngx-strata/components/modal.md +180 -31
  40. package/skills/ngx-strata/components/notification.md +50 -14
  41. package/skills/ngx-strata/components/otp.md +68 -0
  42. package/skills/ngx-strata/components/pagination.md +6 -3
  43. package/skills/ngx-strata/components/radio.md +30 -10
  44. package/skills/ngx-strata/components/segmented-control.md +40 -19
  45. package/skills/ngx-strata/components/single-select.md +47 -15
  46. package/skills/ngx-strata/components/slider.md +35 -6
  47. package/skills/ngx-strata/components/stepper.md +64 -0
  48. package/skills/ngx-strata/components/toggle.md +27 -6
  49. package/types/ngx-strata.d.ts +707 -338
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-strata",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A simple UI framework for quickly prototyping angular applications with a bit of flair.",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
@@ -13,21 +13,30 @@ you need.
13
13
 
14
14
  ### 1. Style Setup
15
15
 
16
- Ensure the core Strata CSS is included in your global styles (e.g.,
17
- \`styles.scss\` or \`angular.json\`): \`\`\`scss @import
18
- 'ngx-strata/strata.css'; \`\`\`
16
+ Ensure the core Strata CSS is included in your global styles (e.g., `styles.scss` or `angular.json`):
17
+
18
+ ```scss
19
+ @use 'ngx-strata/style';
20
+ ```
19
21
 
20
22
  ### 2. Provider Setup
21
23
 
22
- The application should be configured with Strata. Use the global provider in
23
- \`app.config.ts\`:
24
+ The application should be configured with Strata. Use the global provider in `app.config.ts`:
24
25
 
25
- \`\`\`typescript import { provideStrata } from 'ngx-strata';
26
+ ```typescript
27
+ import { ApplicationConfig } from '@angular/core';
28
+ import { provideStrata } from 'ngx-strata';
26
29
 
27
- export const appConfig: ApplicationConfig = { providers: [ provideStrata({
28
- includeBaseIcons: true, tooltipDelayMs: 500 }) ] };
30
+ export const appConfig: ApplicationConfig = {
31
+ providers: [
32
+ provideStrata({
33
+ includeBaseIcons: true,
34
+ tooltipDelayMs: 500
35
+ })
36
+ ]
37
+ };
38
+ ```
29
39
 
30
- ````
31
40
  Custom icons should be registered using the `provideIcons()` provider during bootstrap.
32
41
 
33
42
  ### 3. Application Shell
@@ -38,7 +47,7 @@ Wrap your root application component (usually `app.component.html`) in the Strat
38
47
  <!-- Main Content -->
39
48
  <router-outlet></router-outlet>
40
49
  </st-shell>
41
- ````
50
+ ```
42
51
 
43
52
  ---
44
53
 
@@ -49,16 +58,25 @@ variables to ensure the app matches the active theme (light/dark mode).
49
58
 
50
59
  **Key Color Variables:**
51
60
 
52
- - `--st-color-bg-default`: Standard background.
53
- - `--st-color-bg-raised`: Slightly elevated background (cards, modals).
54
- - `--st-color-text-primary`: Standard text.
61
+ - `--st-color-bg-default`: Standard background (default for page canvas and standard modals).
62
+ - `--st-color-bg-raised`: Elevated background (cards, alerts, raised modals, dropdowns).
63
+ - `--st-color-bg-subtle`: Subtle background surface.
64
+ - `--st-color-bg-inverse`: High-contrast / inverted background (tooltips, active segments).
65
+ - `--st-color-border-default`: Standard border.
66
+ - `--st-color-border-subtle`: Subtle divider / inner border.
67
+ - `--st-color-text-primary`: Primary body and heading text.
55
68
  - `--st-color-text-secondary`: Muted/secondary text.
56
- - `--st-color-text-tertiary`: Disabled/faded text.
57
- - `--st-color-accent-default`: Primary brand accent color.
69
+ - `--st-color-text-tertiary`: Disabled/placeholder text.
70
+ - `--st-color-text-inverse`: Inverted text on inverse surfaces.
71
+ - `--st-color-text-on-accent`: Text on accent-colored elements.
72
+ - `--st-color-accent-default`: Primary brand / interactive accent color.
73
+ - `--st-color-accent-hover`: Hover state for accent actions.
74
+ - `--st-color-control-bg`: Secondary control / button background.
75
+ - `--st-color-control-primary-bg`: Primary control / button background.
58
76
 
59
- **Key Spacing Variables:**
77
+ **Key Spacing Variables (4px base grid):**
60
78
 
61
- - `--st-space-1` (4px) to `--st-space-10` (40px)
79
+ - `--st-space-1` (4px) to `--st-space-16` (64px)
62
80
 
63
81
  ---
64
82
 
@@ -75,6 +93,7 @@ for each component are stored in separate files.
75
93
  [`components/action-menu.md`](components/action-menu.md)
76
94
  - **Alert** (`st-alert`): Read [`components/alert.md`](components/alert.md)
77
95
  - **Avatar** (`st-avatar`): Read [`components/avatar.md`](components/avatar.md)
96
+ - **Badge** (`st-badge`): Read [`components/badge.md`](components/badge.md)
78
97
  - **Breadcrumb** (`st-breadcrumb`): Read
79
98
  [`components/breadcrumb.md`](components/breadcrumb.md)
80
99
  - **Button** (`[stButton]`): Read [`components/button.md`](components/button.md)
@@ -83,14 +102,18 @@ for each component are stored in separate files.
83
102
  [`components/checkbox.md`](components/checkbox.md)
84
103
  - **Divider** (`st-divider`): Read
85
104
  [`components/divider.md`](components/divider.md)
105
+ - **File-upload** (`st-file-upload`): Read
106
+ [`components/file-upload.md`](components/file-upload.md)
86
107
  - **Icon** (`st-icon`): Read [`components/icon.md`](components/icon.md)
108
+ - **Image-cropper** (`st-image-cropper`): Read
109
+ [`components/image-cropper.md`](components/image-cropper.md)
87
110
  - **Input-field** (`[stAutoResize]`): Read
88
111
  [`components/input-field.md`](components/input-field.md)
89
112
  - **Item** (`st-item`): Read [`components/item.md`](components/item.md)
90
113
  - **Kbd** (`st-kbd`): Read [`components/kbd.md`](components/kbd.md)
91
114
  - **Message-state** (`st-message-state`): Read
92
115
  [`components/message-state.md`](components/message-state.md)
93
- - **Modal** (`st-alert-content`): Read
116
+ - **Modal** (`ModalService`, `st-modal-footer`): Read
94
117
  [`components/modal.md`](components/modal.md)
95
118
  - **Notification** (`st-notification`): Read
96
119
  [`components/notification.md`](components/notification.md)
@@ -98,6 +121,7 @@ for each component are stored in separate files.
98
121
  [`components/number-display.md`](components/number-display.md)
99
122
  - **Overlay** (`[stOverlay]`): Read
100
123
  [`components/overlay.md`](components/overlay.md)
124
+ - **Otp** (`st-otp`): Read [`components/otp.md`](components/otp.md)
101
125
  - **Pagination** (`st-pagination`): Read
102
126
  [`components/pagination.md`](components/pagination.md)
103
127
  - **Progress** (`st-progress-linear`): Read
@@ -113,6 +137,7 @@ for each component are stored in separate files.
113
137
  - **Slider** (`st-slider`): Read [`components/slider.md`](components/slider.md)
114
138
  - **Spinner** (`st-spinner`): Read
115
139
  [`components/spinner.md`](components/spinner.md)
140
+ - **Stepper** (`st-stepper`): Read [`components/stepper.md`](components/stepper.md)
116
141
  - **Tabs** (`st-tab-item`): Read [`components/tabs.md`](components/tabs.md)
117
142
  - **Tag** (`st-tag`): Read [`components/tag.md`](components/tag.md)
118
143
  - **Testing** (`ngx-strata/testing`): Read [`components/testing.md`](components/testing.md)
@@ -6,22 +6,24 @@ This file contains the AI documentation for the `accordion` feature and its rela
6
6
  - **Selector**: `st-accordion-group`
7
7
  - **Imports**: `StrataAccordionGroupComponent`
8
8
  - **Inputs**:
9
- - `[allowMultipleOpen] (boolean)`
9
+ - `[allowMultipleOpen] (boolean)`: Whether multiple accordion items can be open simultaneously. Defaults to `false`.
10
10
 
11
11
  ## AccordionItem (`<st-accordion-item>`)
12
12
  - **Selector**: `st-accordion-item`
13
13
  - **Imports**: `StrataAccordionItemComponent`
14
- - **Inputs**:
15
- - `[title] (string)`
14
+ - **Inputs / Models**:
15
+ - `[title] (string, required)`: Header title for the item.
16
+ - `[(open)] (model<boolean>)`: Two-way state for whether the accordion is expanded. Defaults to `false`.
16
17
  - **Outputs**:
17
- - `(toggled)`
18
+ - `(toggled) (boolean)`: Emitted when expansion state changes.
19
+ - **Accessibility**: Header uses an accessible native `<button type="button">` with `aria-expanded` and `aria-controls`. Content container has `role="region"` and `aria-labelledby`. Keyboard interaction (`Enter`, `Space`) is supported natively.
18
20
 
19
21
  ## Usage Example
20
22
 
21
23
  ```html
22
- <!-- Single Accordion -->
23
- <st-accordion-item title="Single accordion">
24
- <p>With some excellent content to be revealed</p>
24
+ <!-- Single Accordion with two-way open binding -->
25
+ <st-accordion-item title="Details" [(open)]="isOpen">
26
+ <p>Expanded details content.</p>
25
27
  </st-accordion-item>
26
28
 
27
29
  <!-- Accordion Group -->
@@ -6,27 +6,39 @@ This file contains the AI documentation for the `avatar` feature and its related
6
6
  - **Selector**: `st-avatar`
7
7
  - **Imports**: `StrataAvatarComponent`
8
8
  - **Inputs**:
9
- - `[text] (string | null)`
9
+ - `[src] (string | null)`: Image URL to display. If loading fails, automatically falls back to `text` initials.
10
+ - `[alt] (string)`: Accessible alt description for the image.
11
+ - `[text] (string | null)`: Initials or text fallback.
12
+ - `[size] (model<AvatarSize>)`: `'xs' | 'sm' | 'md' | 'lg'`. Defaults to `'md'`.
13
+ - `[stTheme] (Theme)`: Optional theme variant (`brand`, `success`, `info`, `warning`, `danger`).
10
14
 
11
15
  ## AvatarStack (`<st-avatar-stack>`)
12
16
  - **Selector**: `st-avatar-stack`
13
17
  - **Imports**: `StrataAvatarStackComponent`
14
18
  - **Inputs**:
15
- - `[size] (AvatarSize)`
16
- - `[spacing] ('loose' | 'mid' | 'tight')`
17
- - `[firstOnFront] (boolean)`
19
+ - `[size] (AvatarSize)`: `'xs' | 'sm' | 'md' | 'lg'`. Defaults to `'md'`.
20
+ - `[spacing] ('loose' | 'mid' | 'tight')`: Defaults to `'mid'`.
21
+ - `[firstOnFront] (boolean)`: When true, stacks earlier avatars on top. Defaults to `false`.
18
22
 
19
- ## Usage Example
23
+ ## Usage Examples
20
24
 
21
25
  ```html
22
- <!-- Single Avatar -->
23
- <st-avatar text="John Doe"></st-avatar>
26
+ <!-- Direct Image with Alt and Fallback Text -->
27
+ <st-avatar [src]="user.avatarUrl" [alt]="user.name" [text]="user.initials"></st-avatar>
28
+
29
+ <!-- Text Initials Only -->
30
+ <st-avatar text="JD" size="md" stTheme="brand"></st-avatar>
31
+
32
+ <!-- Projected Icon Avatar -->
33
+ <st-avatar size="sm">
34
+ <st-icon name="question"></st-icon>
35
+ </st-avatar>
24
36
 
25
37
  <!-- Avatar Stack -->
26
38
  <st-avatar-stack size="md" spacing="mid" [firstOnFront]="true">
27
- <st-avatar text="John Doe"></st-avatar>
28
- <st-avatar text="Jane Smith"></st-avatar>
29
- <st-avatar text="Bob Ross"></st-avatar>
39
+ <st-avatar [src]="avatar1" alt="User 1" text="U1"></st-avatar>
40
+ <st-avatar [src]="avatar2" alt="User 2" text="U2"></st-avatar>
41
+ <st-avatar text="+3"></st-avatar>
30
42
  </st-avatar-stack>
31
43
  ```
32
44
 
@@ -0,0 +1,54 @@
1
+ # ngx-strata: badge Feature
2
+
3
+ This file contains the AI documentation for the `badge` feature and its related components.
4
+
5
+ ## Badge (`<st-badge>`)
6
+ - **Selector**: `st-badge`
7
+ - **Imports**: `StrataBadgeComponent`
8
+ - **Inputs**:
9
+ - `[value] (string | number | undefined)`: Value displayed in badge. When undefined and no icon is passed, badge renders as a dot indicator.
10
+ - `[variant] (BadgeVariant)`: `'accent' | 'neutral' | 'success' | 'warning' | 'error' | 'info'` (default `'accent'`)
11
+ - `[size] (BadgeSize)`: `'xs' | 'sm' | 'md'` (default `'md'`). Note: `'xs'` (8px) exclusively supports status dots.
12
+ - `[placement] (BadgePlacement)`: `'inline' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'` (default `'inline'`)
13
+ - `[max] (number)`: Max numeric count before displaying `{max}+` (default `99`)
14
+ - `[showZero] (boolean)`: Whether to render when `value === 0` (default `false`)
15
+ - `[icon] (string | undefined)`: Icon name rendered via `<st-icon [name]="icon()">`. Renders as a circular badge when no text value is set.
16
+ - `[ariaLabel] (string | undefined)`: Accessible label for assistive tech
17
+
18
+ ## Usage Examples
19
+
20
+ ### Numeric Counter
21
+ ```html
22
+ <st-badge [value]="5"></st-badge>
23
+ <st-badge [value]="120" [max]="99" variant="error"></st-badge>
24
+ ```
25
+
26
+ ### Status Dot
27
+ ```html
28
+ <st-badge variant="success"></st-badge>
29
+ <st-badge variant="warning"></st-badge>
30
+ ```
31
+
32
+ ### Text Label
33
+ ```html
34
+ <st-badge value="NEW" variant="accent"></st-badge>
35
+ ```
36
+
37
+ ### Icon Badge
38
+ ```html
39
+ <st-badge icon="star" variant="warning"></st-badge>
40
+ ```
41
+
42
+ ### Anchored to Buttons or Avatars
43
+ ```html
44
+ <button stButton variant="secondary">
45
+ Notifications
46
+ <st-badge placement="top-right" [value]="3" variant="error"></st-badge>
47
+ </button>
48
+
49
+ <st-avatar text="AM">
50
+ <st-badge placement="bottom-right" variant="success"></st-badge>
51
+ </st-avatar>
52
+ ```
53
+
54
+ > **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
@@ -5,13 +5,21 @@ This file contains the AI documentation for the `checkbox` feature and its relat
5
5
  ## Checkbox (`<st-checkbox>`)
6
6
  - **Selector**: `st-checkbox`
7
7
  - **Imports**: `StrataCheckboxComponent`
8
- - **Inputs**:
9
- - `[(value)] (boolean | undefined)`
10
- - `[label] (string | undefined)`
11
- - `[name] (string | undefined)`
8
+ - **Inputs & Models**:
9
+ - `[(value)] (model<boolean>)`: Whether the checkbox is checked (default `false`).
10
+ - `[label] (string | undefined)`: Label text displayed next to the checkbox.
11
+ - `[name] (string | undefined)`: Form field name.
12
+ - `[disabled] (boolean)`: Disables user interaction.
13
+ - `[id] (string | undefined)`: Optional custom HTML id; an accessible unique id is auto-generated if omitted.
14
+ - **Outputs**:
15
+ - `(valueChange)`: Emitted whenever the checked state changes.
12
16
 
13
- ## Usage Example
17
+ ## Form Integration
18
+ Implements `ControlValueAccessor` (CVA). Compatible with Reactive Forms (`formControlName`, `[formControl]`) and template-driven forms (`[(ngModel)]`).
14
19
 
20
+ ## Usage Examples
21
+
22
+ ### 1. Basic Two-Way Binding
15
23
  ```html
16
24
  <st-checkbox
17
25
  label="I agree to the terms and conditions"
@@ -20,5 +28,22 @@ This file contains the AI documentation for the `checkbox` feature and its relat
20
28
  </st-checkbox>
21
29
  ```
22
30
 
31
+ ### 2. Reactive Forms Integration
32
+ ```html
33
+ <st-checkbox
34
+ label="Subscribe to newsletter"
35
+ [formControl]="newsletterControl">
36
+ </st-checkbox>
37
+ ```
38
+
39
+ ### 3. Disabled State
40
+ ```html
41
+ <st-checkbox
42
+ label="Option unavailable"
43
+ [disabled]="true"
44
+ [value]="false">
45
+ </st-checkbox>
46
+ ```
23
47
 
24
48
  > **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
49
+
@@ -0,0 +1,50 @@
1
+ # File Upload (`st-file-upload`)
2
+
3
+ The File Upload component provides a stylish, accessible dropzone for selecting files via file browser or drag-and-drop.
4
+
5
+ ## Usage
6
+
7
+ ```html
8
+ <st-file-upload
9
+ accept="image/*"
10
+ hint="PNG, JPG or WEBP up to 5MB"
11
+ (fileSelect)="onFileSelected($event)"
12
+ ></st-file-upload>
13
+ ```
14
+
15
+ ### Multiple Files
16
+
17
+ ```html
18
+ <st-file-upload
19
+ [multiple]="true"
20
+ accept=".pdf,.docx,.txt"
21
+ label="Upload documents"
22
+ (filesSelect)="onFilesSelected($event)"
23
+ ></st-file-upload>
24
+ ```
25
+
26
+ ## API
27
+
28
+ ### Inputs
29
+
30
+ | Input | Type | Default | Description |
31
+ |---|---|---|---|
32
+ | `accept` | `input<string>` | `'*'` | Accepted MIME types or file extensions |
33
+ | `multiple` | `input<boolean>` | `false` | Whether multiple files can be selected |
34
+ | `maxFileSize` | `input<number \| undefined>` | `undefined` | Maximum allowed file size in bytes |
35
+ | `disabled` | `input<boolean>` | `false` | Disable interactions |
36
+ | `label` | `input<string>` | `'Choose a file or drag & drop it here'` | Primary prompt text |
37
+ | `hint` | `input<string \| undefined>` | `undefined` | Secondary help text |
38
+
39
+ ### Outputs
40
+
41
+ | Output | Type | Description |
42
+ |---|---|---|
43
+ | `fileSelect` | `output<File>` | Emitted when a single valid file is selected |
44
+ | `filesSelect` | `output<File[]>` | Emitted when valid files are selected |
45
+ | `fileRejected` | `output<{ file: File; reason: 'type' \| 'size' }>` | Emitted when a file fails validation |
46
+
47
+ ### Methods
48
+
49
+ - `browse()`: Opens the system file selection dialog.
50
+ - `clear()`: Clears the native input value.
@@ -6,16 +6,21 @@ This file contains the AI documentation for the `icon` feature and its related c
6
6
  - **Selector**: `st-icon`
7
7
  - **Imports**: `StrataIconComponent`
8
8
  - **Inputs**:
9
- - `[name] (string)`
9
+ - `[name] (string)`: Name of the registered icon. Defaults to `'question'`.
10
+ - `[size] (model<IconSize>)`: `'xs' | 'sm' | 'md' | 'lg'`. Defaults to `'md'`.
11
+ - `[ariaLabel] (string | undefined)`: Optional accessible label. When omitted, `st-icon` automatically applies `aria-hidden="true"` so decorative icons are ignored by screen readers. When provided, sets `role="img"` and `aria-label`.
10
12
 
11
- ## Usage Example
13
+ ## Usage Examples
12
14
 
13
- \`\`\`html
14
- <st-icon name="search" size="md"></st-icon>
15
- <st-icon name="info" size="lg"></st-icon>
16
- \`\`\`
15
+ ```html
16
+ <!-- Decorative icon (default: aria-hidden="true") -->
17
+ <st-icon name="close" size="sm"></st-icon>
18
+
19
+ <!-- Semantic icon with accessible label -->
20
+ <st-icon name="info" size="md" ariaLabel="Information notice"></st-icon>
21
+ ```
17
22
 
18
23
  > **CRITICAL RULE FOR AI AGENTS regarding Icons:**
19
- > NEVER guess an icon name. Before using an \`<st-icon>\`, you MUST verify that the icon is registered in the host application (usually located in \`src/app/shared/icon.config.ts\`). Alternatively, you may use one of the **ngx-strata Base Icons**: <!-- BASE_ICONS_START -->`question`, `arrow-right`, `arrow-left`, `arrow-up`, `arrow-down`, `close`, `expand-up-down`, `clipboard`, or `more`<!-- BASE_ICONS_END -->. If the icon you want to use is NOT registered, you must STOP and ask the user to add it.
24
+ > NEVER guess an icon name. Before using an `<st-icon>`, you MUST verify that the icon is registered in the host application (usually located in `src/app/shared/icon.config.ts`). Alternatively, you may use one of the **ngx-strata Base Icons**: <!-- BASE_ICONS_START -->`question`, `arrow-right`, `arrow-left`, `arrow-up`, `arrow-down`, `close`, `expand-up-down`, `clipboard`, `more`, or `check`<!-- BASE_ICONS_END -->. If the icon you want to use is NOT registered, you must STOP and ask the user to add it.
20
25
 
21
26
  > **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
@@ -0,0 +1,83 @@
1
+ # Image Cropper (`st-image-cropper`)
2
+
3
+ The Image Cropper component provides an interactive workspace for cropping images to circle (avatar) or square masks with pan, zoom, and rotation controls.
4
+
5
+ ## Usage
6
+
7
+ ### Standalone with Image URL
8
+
9
+ ```html
10
+ <st-image-cropper
11
+ [image]="userPhotoUrl"
12
+ shape="circle"
13
+ [maskSize]="240"
14
+ (crop)="onCropped($event)"
15
+ ></st-image-cropper>
16
+ ```
17
+
18
+ ### Combined with Projected `st-file-upload`
19
+
20
+ ```html
21
+ <st-image-cropper #cropper shape="circle" (crop)="onCropped($event)">
22
+ <st-file-upload
23
+ accept="image/*"
24
+ hint="Choose a profile photo"
25
+ (fileSelect)="cropper.setImage($event)"
26
+ ></st-file-upload>
27
+ </st-image-cropper>
28
+ ```
29
+
30
+ ## CropResult Interface
31
+
32
+ ```typescript
33
+ export interface CropResult {
34
+ blob: Blob;
35
+ dataUrl: string;
36
+ file?: File;
37
+ width: number;
38
+ height: number;
39
+ }
40
+ ```
41
+
42
+ ## API
43
+
44
+ ### Inputs & Models
45
+
46
+ | Property | Type | Default | Description |
47
+ |---|---|---|---|
48
+ | `image` | `input<string \| File \| Blob \| null>` | `null` | Image source to crop |
49
+ | `shape` | `input<'circle' \| 'square'>` | `'circle'` | Crop mask shape and canvas clip |
50
+ | `maskSize` | `input<number>` | `240` | Viewport mask size in pixels |
51
+ | `outputWidth` | `input<number>` | `400` | Width of output canvas |
52
+ | `outputHeight` | `input<number>` | `400` | Height of output canvas |
53
+ | `outputFormat` | `input<'image/png' \| 'image/jpeg' \| 'image/webp'>` | `'image/png'` | Export format |
54
+ | `outputQuality` | `input<number>` | `0.92` | Quality for lossy formats |
55
+ | `zoom` | `model<number>` | `1` | Two-way bound zoom multiplier |
56
+ | `rotation` | `model<number>` | `0` | Two-way bound rotation degrees |
57
+ | `minZoom` | `input<number>` | `1` | Minimum zoom |
58
+ | `maxZoom` | `input<number>` | `3` | Maximum zoom |
59
+ | `showZoom` | `input<boolean>` | `true` | Show zoom slider controls |
60
+ | `showRotate` | `input<boolean>` | `true` | Show rotate 90° buttons |
61
+ | `showClear` | `input<boolean>` | `true` | Show clear/remove button |
62
+ | `clearLabel` | `input<string>` | `'Remove'` | Button label text for clear action |
63
+ | `autoCrop` | `input<boolean>` | `true` | Automatically emit crop output on changes |
64
+ | `disabled` | `input<boolean>` | `false` | Disable interactions |
65
+
66
+ ### Outputs
67
+
68
+ | Output | Type | Description |
69
+ |---|---|---|
70
+ | `crop` | `output<CropResult>` | Emitted with cropped blob and dataUrl |
71
+ | `imageLoaded` | `output<{ width: number; height: number; src: string }>` | Emitted when image loads |
72
+ | `imageError` | `output<string>` | Emitted on image load failure |
73
+ | `imageCleared` | `output<void>` | Emitted when image is cleared |
74
+
75
+ ### Methods
76
+
77
+ - `cropImage(): Promise<CropResult>`: Generates canvas output and resolves with CropResult.
78
+ - `setImage(source: string | File | Blob | null)`: Programmatically sets the image source.
79
+ - `rotateRight()`: Rotates image 90° clockwise.
80
+ - `rotateLeft()`: Rotates image 90° counter-clockwise.
81
+ - `center()`: Realigns pan to center (0, 0) without resetting zoom or rotation.
82
+ - `reset()`: Resets pan, zoom, and rotation.
83
+ - `clear()`: Clears the loaded image.