@rarui/components 1.31.0 → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  `@rarui/components` components is a component library built with [Lit](https://lit.dev/).
4
4
 
5
+ ## 2025-11-26 `1.31.1`
6
+
7
+ #### 🎉 New features
8
+
9
+ - **IconButton `as` Property**: Added `as` property to IconButton component allowing it to render as either `button` (default) or `a` elements. When `as="a"` is used, the component accepts `href` and `target` properties for link behavior while maintaining the same visual styling and click event handling. Form-related functionality (submit/reset) is only active when `as="button"`. Also added `PassThroughAttributesMixin` for data-* attribute support and improved property bindings with `reflect: true` for better debugging. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
10
+ - **RadioButton Screen Reader Group Announcement**: Enhanced RadioButton component with ARIA group position attributes (`aria-setsize`, `aria-posinset`) for proper screen reader announcements. Radio buttons now correctly announce their position within the group (e.g., "option 1 of 4" instead of "option 1 of 1"). Includes automatic group detection via MutationObserver for dynamic DOM updates. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
11
+
12
+ #### 🐛 Bug fixes
13
+
14
+ - **Select Keyboard Navigation**: Fixed Select component keyboard navigation where Enter key on options was not closing the menu. Moved `@keydown` handler from dropdown to trigger element only, preventing option events from propagating and triggering menu toggle. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
15
+ - **Checkbox Readonly Focus Ring**: Fixed Checkbox component showing focus ring when in readonly state. Added `:focus-within:not(:read-only)` CSS selector to prevent focus ring, set `tabindex="-1"` to make readonly checkboxes non-focusable, and added `aria-readonly` attribute for screen readers. Updated hover overlay styles to exclude readonly state. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
16
+ - **Select Clear Button Keyboard Navigation**: Fixed Select multiple clear options button not working with Space key. Added `stopPropagation()` for Space/Enter keyboard events on the clear button to prevent the events from bubbling up to parent trigger's keydown handler which was opening the menu instead of clearing options. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
17
+
18
+ #### 💡 Others
19
+
20
+ - **Toggle Property Binding Improvements**: Enhanced Toggle component property bindings following Lit best practices. Added `reflect: true` to all visual and state properties (size, error, selected, disabled, required) for better CSS styling support and debugging visibility. Removed unnecessary boolean converters as Lit handles boolean attributes automatically. Added explicit default values for `selected` and `disabled` properties for consistency. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
21
+ - **RadioButton Property Binding Improvements**: Enhanced RadioButton component property bindings following Lit best practices. Added `reflect: true` to all visual and state properties (disabled, size, error, selected, required, readonly) for better CSS styling support and debugging visibility. Removed unnecessary boolean converters and optional types on properties with default values. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
22
+ - **Screen Reader Improvements**: Added `aria-hidden="true"` to decorative text elements (Toggle label, Checkbox label, RadioButton label) to prevent duplicate screen reader announcements. Labels are now properly announced via `aria-label` on input elements only. ([#150](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/150) by [@junior](https://git.rarolabs.com.br/junior))
23
+
5
24
  ## 2025-11-25 `1.31.0`
6
25
 
7
26
  #### 🎉 New features
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.30.3",
2
+ "version": "1.31.0",
3
3
  "tags": [
4
4
  {
5
5
  "name": "rarui-avatar",
@@ -3212,9 +3212,24 @@
3212
3212
  "type": "boolean",
3213
3213
  "default": false
3214
3214
  },
3215
+ {
3216
+ "name": "as",
3217
+ "description": "Defines the HTML element type to render.\n\n- a\n- button\n\n@default button",
3218
+ "type": "string",
3219
+ "values": [
3220
+ {
3221
+ "name": "a"
3222
+ },
3223
+ {
3224
+ "name": "button",
3225
+ "description": "(default)"
3226
+ }
3227
+ ],
3228
+ "default": "button"
3229
+ },
3215
3230
  {
3216
3231
  "name": "type",
3217
- "description": "Defines the native button type.\n\n- button\n- reset\n- submit\n\n@default button",
3232
+ "description": "Defines the native button type. Only applies when as=\"button\".\n\n- button\n- reset\n- submit\n\n@default button",
3218
3233
  "type": "string",
3219
3234
  "values": [
3220
3235
  {
@@ -3232,18 +3247,42 @@
3232
3247
  },
3233
3248
  {
3234
3249
  "name": "name",
3235
- "description": "The name of the button for form submission.",
3250
+ "description": "The name of the button for form submission. Only applies when as=\"button\".",
3236
3251
  "type": "string"
3237
3252
  },
3238
3253
  {
3239
3254
  "name": "value",
3240
- "description": "The value of the button for form submission.",
3255
+ "description": "The value of the button for form submission. Only applies when as=\"button\".",
3241
3256
  "type": "string"
3242
3257
  },
3243
3258
  {
3244
3259
  "name": "form",
3245
- "description": "Associates the button with a form element by ID.",
3260
+ "description": "Associates the button with a form element by ID. Only applies when as=\"button\".",
3261
+ "type": "string"
3262
+ },
3263
+ {
3264
+ "name": "href",
3265
+ "description": "The URL to navigate to. Only applies when as=\"a\".",
3246
3266
  "type": "string"
3267
+ },
3268
+ {
3269
+ "name": "target",
3270
+ "description": "Specifies where to open the linked document. Only applies when as=\"a\".\n\n- _blank\n- _parent\n- _self\n- _top",
3271
+ "type": "string",
3272
+ "values": [
3273
+ {
3274
+ "name": "_blank"
3275
+ },
3276
+ {
3277
+ "name": "_parent"
3278
+ },
3279
+ {
3280
+ "name": "_self"
3281
+ },
3282
+ {
3283
+ "name": "_top"
3284
+ }
3285
+ ]
3247
3286
  }
3248
3287
  ]
3249
3288
  },
package/dist/index.d.ts CHANGED
@@ -19370,26 +19370,44 @@ declare global {
19370
19370
  */
19371
19371
  type IconButtonManifestProperties = IconButtonProps & {
19372
19372
  /**
19373
- * Defines the native button type.
19373
+ * Defines the HTML element type to render.
19374
+ * @default button
19375
+ */
19376
+ as?: "button" | "a";
19377
+ /**
19378
+ * Defines the native button type. Only applies when as="button".
19374
19379
  * @default button
19375
19380
  */
19376
19381
  type?: "button" | "submit" | "reset";
19377
19382
  /**
19378
- * The name of the button for form submission.
19383
+ * The name of the button for form submission. Only applies when as="button".
19379
19384
  */
19380
19385
  name?: string;
19381
19386
  /**
19382
- * The value of the button for form submission.
19387
+ * The value of the button for form submission. Only applies when as="button".
19383
19388
  */
19384
19389
  value?: string;
19385
19390
  /**
19386
- * Associates the button with a form element by ID.
19391
+ * Associates the button with a form element by ID. Only applies when as="button".
19387
19392
  */
19388
19393
  form?: string;
19394
+ /**
19395
+ * The URL to navigate to. Only applies when as="a".
19396
+ */
19397
+ href?: string;
19398
+ /**
19399
+ * Specifies where to open the linked document. Only applies when as="a".
19400
+ */
19401
+ target?: "_blank" | "_self" | "_parent" | "_top";
19389
19402
  };
19390
19403
  type IconButtonProperties = WebComponentProperties<IconButtonManifestProperties>;
19391
19404
 
19392
19405
  declare const RaruiIconButton_base: (new (...args: any[]) => {
19406
+ getPassThroughAttributes(allowedPrefixes?: string[], excludedAttributes?: string[]): Record<string, string>;
19407
+ isManagedAttribute(attrName: string, additionalManagedAttrs?: string[]): boolean;
19408
+ getDataAttributes(excludedAttributes?: string[]): Record<string, string>;
19409
+ getDataAndAriaAttributes(excludedAttributes?: string[]): Record<string, string>;
19410
+ }) & (new (...args: any[]) => {
19393
19411
  ariaLabel: string | null;
19394
19412
  ariaLabelledBy: string | null;
19395
19413
  ariaDescribedBy: string | null;
@@ -19401,20 +19419,24 @@ declare class RaruiIconButton extends RaruiIconButton_base {
19401
19419
  serializable?: boolean;
19402
19420
  slotAssignment?: SlotAssignmentMode;
19403
19421
  };
19422
+ type: IconButtonProperties["type"];
19404
19423
  size: IconButtonProperties["size"];
19405
19424
  variant: IconButtonProperties["variant"];
19406
19425
  appearance: IconButtonProperties["appearance"];
19407
19426
  disabled: IconButtonProperties["disabled"];
19408
19427
  rounded: IconButtonProperties["rounded"];
19409
- type: IconButtonProperties["type"];
19410
19428
  name: IconButtonProperties["name"];
19411
19429
  value: IconButtonProperties["value"];
19412
19430
  form: IconButtonProperties["form"];
19431
+ as: IconButtonProperties["as"];
19432
+ href: IconButtonProperties["href"];
19433
+ target: IconButtonProperties["target"];
19413
19434
  ariaPressed: "true" | "false" | "mixed" | null;
19414
19435
  ariaExpanded: "true" | "false" | null;
19415
19436
  static styles: CSSResult;
19416
- private handleClick;
19437
+ private renderContent;
19417
19438
  render(): TemplateResult<1>;
19439
+ private _handleClick;
19418
19440
  }
19419
19441
 
19420
19442
  declare global {
@@ -19581,17 +19603,20 @@ declare const RaruiRadioButton_base: (new (...args: any[]) => {
19581
19603
  }) & typeof LitElement;
19582
19604
  declare class RaruiRadioButton extends RaruiRadioButton_base {
19583
19605
  id: string;
19584
- disabled: boolean;
19606
+ disabled: RadioButtonProperties["disabled"];
19585
19607
  name?: string;
19586
19608
  label?: RadioButtonProperties["label"];
19587
- size?: RadioButtonProperties["size"];
19588
- error?: RadioButtonProperties["error"];
19589
- selected?: RadioButtonProperties["selected"];
19609
+ size: RadioButtonProperties["size"];
19610
+ error: RadioButtonProperties["error"];
19611
+ selected: RadioButtonProperties["selected"];
19590
19612
  value: RadioButtonProperties["value"];
19591
19613
  form: RadioButtonProperties["form"];
19592
19614
  required: RadioButtonProperties["required"];
19593
19615
  readonly: RadioButtonProperties["readonly"];
19594
19616
  private _internals;
19617
+ private _groupSize;
19618
+ private _positionInGroup;
19619
+ private _groupObserver?;
19595
19620
  static formAssociated: boolean;
19596
19621
  constructor();
19597
19622
  connectedCallback(): void;
@@ -19602,6 +19627,8 @@ declare class RaruiRadioButton extends RaruiRadioButton_base {
19602
19627
  private _onChange;
19603
19628
  private _handleRadioGroupChange;
19604
19629
  private _notifyRadioGroupSelection;
19630
+ private _updateGroupInfo;
19631
+ private _setupGroupObserver;
19605
19632
  focus(): void;
19606
19633
  blur(): void;
19607
19634
  formResetCallback(): void;
@@ -19932,10 +19959,10 @@ declare class RaruiToggle extends RaruiToggle_base {
19932
19959
  };
19933
19960
  name: ToggleProperties["name"];
19934
19961
  label: ToggleProperties["label"];
19935
- size?: ToggleProperties["size"];
19962
+ size: ToggleProperties["size"];
19936
19963
  error: ToggleProperties["error"];
19937
- selected?: ToggleProperties["selected"];
19938
- disabled?: ToggleProperties["disabled"];
19964
+ selected: ToggleProperties["selected"];
19965
+ disabled: ToggleProperties["disabled"];
19939
19966
  value: ToggleProperties["value"];
19940
19967
  form: ToggleProperties["form"];
19941
19968
  required: ToggleProperties["required"];