@rarui/components 1.28.1 → 1.29.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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  `@rarui/components` components is a component library built with [Lit](https://lit.dev/).
4
4
 
5
+ ## 2025-10-09 `1.29.0`
6
+
7
+ #### 🎉 New features
8
+
9
+ - Added `items-after-truncate` property to the `Select` component for controlling item truncation with "+X" chip display in multiple selection mode. ([#143](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/143) by [@junior](https://git.rarolabs.com.br/junior))
10
+
5
11
  ## 2025-10-07 `1.28.1`
6
12
 
7
13
  #### 🐛 Bug fixes
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.28.0",
2
+ "version": "1.28.1",
3
3
  "tags": [
4
4
  {
5
5
  "name": "rarui-avatar",
@@ -3777,6 +3777,12 @@
3777
3777
  "description": "Specifies the default selected value(s) for the select box.\nThis can be a selectOption for single selection or an array of selectOption for multiple selections.",
3778
3778
  "values": []
3779
3779
  },
3780
+ {
3781
+ "name": "items-after-truncate",
3782
+ "description": "Maximum number of items to display before showing a \"+X\" chip with the remaining count.\nWhen set, only the specified number of selected items will be shown, followed by a chip indicating how many more items are selected.\n\n@default undefined (shows all selected items)",
3783
+ "type": "number",
3784
+ "default": "undefined (shows all selected items)"
3785
+ },
3780
3786
  {
3781
3787
  "name": "position",
3782
3788
  "description": "Position of the dropdown relative to the trigger.\n\n- bottom\n- bottom-end\n- bottom-start\n- left\n- left-end\n- left-start\n- right\n- right-end\n- right-start\n- top\n- top-end\n- top-start\n\n@default bottom-start",
package/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import { IconName } from '@rarui/icons/dist/html/types';
2
- import { BreadcrumbProps, AccordionProps } from '@rarui/typings';
3
-
4
1
  /**
5
2
  * @license
6
3
  * Copyright 2017 Google LLC
@@ -17082,6 +17079,57 @@ declare const styles$3: {
17082
17079
 
17083
17080
  type RadioButtonVariants = NonNullable<RecipeVariants<typeof styles$3.radioButton>>;
17084
17081
 
17082
+ declare const selectStyles: {
17083
+ select: RuntimeFn<{
17084
+ /**
17085
+ * Determines the visual style of the input, affecting its border
17086
+ */
17087
+ appearance: {
17088
+ success: {
17089
+ borderColor: `var(--${string})` | `var(--${string}, ${string})`;
17090
+ ":hover": {
17091
+ borderColor: `var(--${string})` | `var(--${string}, ${string})`;
17092
+ };
17093
+ ":focus": {
17094
+ borderColor: `var(--${string})` | `var(--${string}, ${string})`;
17095
+ };
17096
+ ":active": {
17097
+ backgroundColor: `var(--${string})` | `var(--${string}, ${string})`;
17098
+ };
17099
+ };
17100
+ error: {
17101
+ borderColor: `var(--${string})` | `var(--${string}, ${string})`;
17102
+ ":hover": {
17103
+ borderColor: `var(--${string})` | `var(--${string}, ${string})`;
17104
+ };
17105
+ ":focus": {
17106
+ borderColor: `var(--${string})` | `var(--${string}, ${string})`;
17107
+ };
17108
+ ":active": {
17109
+ backgroundColor: `var(--${string})` | `var(--${string}, ${string})`;
17110
+ };
17111
+ };
17112
+ };
17113
+ /**
17114
+ * Specifies the size of the badge, controlling its dimensions.
17115
+ */
17116
+ size: {
17117
+ large: {
17118
+ height: "3rem";
17119
+ };
17120
+ medium: {
17121
+ height: "2.5rem";
17122
+ };
17123
+ small: {
17124
+ height: "2rem";
17125
+ padding: `0 var(--${string})` | `0 var(--${string}, ${string})`;
17126
+ };
17127
+ };
17128
+ }>;
17129
+ list: string;
17130
+ close: string;
17131
+ };
17132
+
17085
17133
  declare const dropdownStyles: {
17086
17134
  dropdown: RuntimeFn<{
17087
17135
  /**
@@ -17124,6 +17172,9 @@ interface DropdownSprinkle extends DropdownDynamicProperties {
17124
17172
  zIndex?: AddDollar<keyof typeof zIndexProperties> | Conditions<AddDollar<keyof typeof zIndexProperties>>;
17125
17173
  }
17126
17174
 
17175
+ type SelectVariants = NonNullable<RecipeVariants<typeof selectStyles.select>>;
17176
+ type SelectSprinkle = Pick<StandardLonghandProperties, "maxHeight"> & Pick<DropdownSprinkle, "zIndex">;
17177
+
17127
17178
  declare const statusStyles: {
17128
17179
  status: RuntimeFn<{
17129
17180
  /**
@@ -18069,6 +18120,74 @@ interface RadioButtonTyping {
18069
18120
  }
18070
18121
  type RadioButtonProps = RadioButtonTyping & RadioButtonVariants;
18071
18122
 
18123
+ interface SelectOptionProps {
18124
+ /**
18125
+ * Label for the option. This is the text that will be displayed for the option.
18126
+ */
18127
+ label: string;
18128
+ /**
18129
+ * Value of the option. This is the value that will be used internally and returned when the option is selected.
18130
+ */
18131
+ value: string;
18132
+ }
18133
+ interface SelectTyping {
18134
+ /**
18135
+ * Options for the Select component. This should be an array of SelectOptionProps objects.
18136
+ */
18137
+ options: SelectOptionProps[];
18138
+ /**
18139
+ * Default selected values for the Select component.
18140
+ * This should be an array of SelectOptionProps objects representing the selected options.
18141
+ */
18142
+ value?: SelectOptionProps | SelectOptionProps[];
18143
+ /**
18144
+ * Callback function that is called when the selected values change.
18145
+ * This function receives an array of SelectOptionProps objects representing the selected options.
18146
+ */
18147
+ onChange?: (selectedOptions: SelectOptionProps | SelectOptionProps[]) => void;
18148
+ /**
18149
+ * Enables multiple selection mode.
18150
+ * @default false
18151
+ */
18152
+ multiple?: boolean;
18153
+ /**
18154
+ * Specifies the default selected value(s) for the select box.
18155
+ * This can be a selectOption for single selection or an array of selectOption for multiple selections.
18156
+ */
18157
+ defaultValue?: SelectOptionProps | SelectOptionProps[];
18158
+ /**
18159
+ * If true, the Select component is shown.
18160
+ */
18161
+ open?: boolean;
18162
+ /**
18163
+ * Placeholder text displayed when no option is selected.
18164
+ */
18165
+ placeholder?: string;
18166
+ /**
18167
+ * Disables the select component, disallowing user interaction.
18168
+ * @default false
18169
+ */
18170
+ disabled?: boolean;
18171
+ /**
18172
+ * Determines whether the select box should enable flipping the options' dropdown when there is not enough space to display it in its default direction.
18173
+ * This can help ensure the dropdown is always visible on the screen.
18174
+ * @default true
18175
+ */
18176
+ enabledFlip?: boolean;
18177
+ /**
18178
+ * Specifies the ID of the portal element where the dropdown should be rendered.
18179
+ * This can be useful for rendering the dropdown in a different part of the DOM, such as a modal or overlay.
18180
+ */
18181
+ portalId?: string;
18182
+ /**
18183
+ * Maximum number of items to display before showing a "+X" chip with the remaining count.
18184
+ * When set, only the specified number of selected items will be shown, followed by a chip indicating how many more items are selected.
18185
+ * @default undefined (shows all selected items)
18186
+ */
18187
+ itemsAfterTruncate?: number;
18188
+ }
18189
+ type SelectProps = SelectTyping & SelectVariants & SelectSprinkle;
18190
+
18072
18191
  interface TextareaProps extends TextareaVariants {
18073
18192
  /**
18074
18193
  * Number of lines to be rendered for the user to input text
@@ -18093,6 +18212,18 @@ interface ToggleTyping {
18093
18212
  }
18094
18213
  type ToggleProps = ToggleTyping & ToggleVariants;
18095
18214
 
18215
+ interface AccordionProps {
18216
+ /**
18217
+ * Informs which accordion item is open by default, this value must be the same as informed in the index of each item
18218
+ */
18219
+ selectedDefault?: string;
18220
+ /**
18221
+ * Disables the accordion, disallowing user interaction.
18222
+ * @default false
18223
+ */
18224
+ disabled?: boolean;
18225
+ }
18226
+
18096
18227
  type AccordionBodyProps = Pick<AccordionVariants, "padding">;
18097
18228
 
18098
18229
  interface AccordionHeaderTyping {
@@ -18201,6 +18332,15 @@ interface SidebarTyping {
18201
18332
  }
18202
18333
  type SidebarProps = SidebarTyping & SidebarSprinkle & SidebarVariants;
18203
18334
 
18335
+ interface BreadcrumbProps {
18336
+ /**
18337
+ * Specifies the number of breadcrumb items to display after truncation.
18338
+ * This is useful for managing the display of long breadcrumb lists.
18339
+ * @default 10
18340
+ */
18341
+ itemsAfterTruncate?: number;
18342
+ }
18343
+
18204
18344
  interface BreadcrumbItemTyping {
18205
18345
  /**
18206
18346
  * The name of the breadcrumb item. This is typically the text that is displayed for the item.
@@ -18379,6 +18519,8 @@ declare class RaruiDivider extends RaruiDivider_base {
18379
18519
  render(): TemplateResult<1>;
18380
18520
  }
18381
18521
 
18522
+ type IconName = "add-circle-filled" | "add-circle-outlined" | "alarm-filled" | "alarm-outlined" | "alternate-email" | "archive-all-filled" | "archive-all-outlined" | "archive-filled" | "archive-in-filled" | "archive-in-outlined" | "archive-outlined" | "arrow-alt-down" | "arrow-alt-left" | "arrow-alt-right" | "arrow-alt-up" | "arrow-circle-down-filled" | "arrow-circle-down-outlined" | "arrow-circle-up-filled" | "arrow-circle-up-outlined" | "arrow-circled-down-circle-outlined" | "arrow-circled-down-filled" | "arrow-circled-up-circle-outlined" | "arrow-direction-down-up" | "arrow-direction-left-right" | "arrow-direction-right-left" | "arrow-direction-up-down" | "arrow-directions" | "arrow-down" | "arrow-down-left" | "arrow-down-right" | "arrow-first-page" | "arrow-last-page" | "arrow-left" | "arrow-line-down" | "arrow-line-left" | "arrow-line-long-down" | "arrow-line-long-left" | "arrow-line-long-right" | "arrow-line-long-up" | "arrow-line-right" | "arrow-line-up" | "arrow-right" | "arrow-subdirectory-left" | "arrow-subdirectory-right" | "arrow-trending-down" | "arrow-trending-up" | "arrow-up" | "arrow-up-left" | "arrow-up-right" | "attachment" | "backspace" | "backspace-outlined" | "barley" | "barley-off" | "bolt-circle-filled" | "bolt-circle-outlined" | "bookmark-filled" | "bookmark-outlined" | "calendar-date-range-filled" | "calendar-date-range-outlined" | "calendar-event-filled" | "calendar-event-outlined" | "calendar-filled" | "calendar-outlined" | "camera-filled" | "camera-outlined" | "camera-shutter-filled" | "camera-shutter-outlined" | "cancel-circle-filled" | "cancel-circle-outlined" | "car-filled" | "car-outlined" | "chart-bars-filled" | "chart-bars-outlined" | "chat-bubble-filled" | "chat-bubble-outlined" | "chat-message-filled" | "chat-message-outlined" | "check" | "check-circle-filled" | "check-circle-outlined" | "check-small" | "chevron-big-down" | "chevron-big-left" | "chevron-big-right" | "chevron-big-up" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "clock-filled" | "clock-outlined" | "close" | "cloud-filled" | "cloud-outlined" | "contact-support-filled" | "contact-support-outlined" | "content-copy-filled" | "content-copy-outlined" | "content-paste-filled" | "content-paste-outlined" | "conversation-filled" | "conversation-outlined" | "copyright-filled" | "copyright-outlined" | "credit-card-filled" | "credit-card-outlined" | "danger-filled" | "danger-outlined" | "dashboard-filled" | "dashboard-outlined" | "document-filled" | "document-outlined" | "document-text-filled" | "document-text-outlined" | "download-filled" | "download-outlined" | "eco-filled" | "eco-outlined" | "edit-filled" | "edit-outlined" | "euro-symbol" | "exit-fullscreen" | "eye-filled" | "eye-off-filled" | "eye-off-outlined" | "eye-outlined" | "facebook-filled" | "facebook-outlined" | "file-copy-filled" | "file-copy-outlined" | "filter-alt-filled" | "filter-alt-outlined" | "filter-list" | "fingerprint" | "flag-filled" | "flag-outlined" | "flag-tour-filled" | "flag-tour-outlined" | "flower-filled" | "flower-outlined" | "folder-filled" | "folder-list-filled" | "folder-list-outlined" | "folder-open" | "folder-outlined" | "fruit-apple-filled" | "fruit-apple-outlined" | "fullscreen-filled" | "fullscreen-outlined" | "google" | "google-play" | "headphones-filled" | "headphones-outlined" | "heart-filled" | "heart-outlined" | "help-filled" | "help-outlined" | "history" | "home-filled" | "home-outlined" | "image-filled" | "image-outlined" | "info-circle-filled" | "info-circle-outlined" | "instagram" | "instagram-outlined" | "label-filled" | "label-important-filled" | "label-important-outlined" | "label-outlined" | "language" | "lightbulb-filled" | "lightbulb-outlined" | "link" | "linkedin-filled" | "linkedin-outlined" | "loader" | "loading" | "lock-filled" | "lock-open-filled" | "lock-open-outlined" | "lock-outlined" | "login" | "logout" | "mail-filled" | "mail-open-filled" | "mail-open-outlined" | "mail-outlined" | "menu" | "menu-large" | "microphone-filled" | "microphone-outlined" | "minus" | "money-filled" | "money-outlined" | "mood-bad" | "mood-bad-outlined" | "mood-filled" | "mood-outlined" | "more-horiz" | "more-vert" | "music-note-filled" | "music-note-outlined" | "notification-filled" | "notification-outlined" | "open-in-new" | "package" | "package-outlined" | "pause-filled" | "pause-outlined" | "pets-filled" | "pets-outlined" | "phone-call-filled" | "phone-call-outlined" | "phone-filled" | "phone-outlined" | "pin-filled" | "pin-outlined" | "play-arrow-filled" | "play-arrow-outlined" | "play-circle-filled" | "play-circle-outlined" | "plus" | "power-settings-new" | "printer-filled" | "printer-outlined" | "push-pin-filled" | "push-pin-outlined" | "receipt-filled" | "receipt-outlined" | "recycle" | "redeem" | "redo" | "refresh" | "refresh-alt" | "remove" | "remove-circle-filled" | "remove-circle-outlined" | "repeat" | "reply" | "save-alt" | "screen-outlined" | "search" | "send-filled" | "send-outlined" | "sentiment-dissatisfied-filled" | "sentiment-dissatisfied-outlined" | "sentiment-neutral-filled" | "sentiment-neutral-outlined" | "sentiment-satisfied-filled" | "sentiment-satisfied-outlined" | "sentiment-very-dissatisfied-filled" | "sentiment-very-dissatisfied-outlined" | "sentiment-very-satisfied-filled" | "sentiment-very-satisfied-outlined" | "settings-filled" | "settings-outlined" | "share-filled" | "share-outlined" | "shopping-bag-filled" | "shopping-bag-outlined" | "shopping-cart-add" | "shopping-cart-filled" | "shopping-cart-outlined" | "sprout" | "sprout-outline-outlined" | "star-filled" | "star-outlined" | "stay-primary-portrait" | "storefront" | "tag-filled" | "tag-outlined" | "textsms-filled" | "textsms-outlined" | "thumb-down-filled" | "thumb-down-outlined" | "thumb-up-filled" | "thumb-up-outlined" | "tiktok" | "toc" | "trash-filled" | "trash-outlined" | "truck-filled" | "truck-outlined" | "tune" | "twitter" | "undo" | "upload-filled" | "upload-outlined" | "user-circle-filled" | "user-circle-outlined" | "user-filled" | "user-outlined" | "user-square-filled" | "user-square-outlined" | "users-filled" | "users-outlined" | "view-grid-filled" | "view-grid-outlined" | "view-list-filled" | "view-list-outlined" | "warning-bubble-filled" | "warning-bubble-outlined" | "warning-filled" | "warning-outlined" | "whatsapp-filled" | "whatsapp-outlined" | "work-filled" | "work-outlined" | "wysiwyg-filled" | "youtube-filled" | "youtube-outlined" | "zoom-in" | "zoom-out";
18523
+
18382
18524
  declare global {
18383
18525
  interface HTMLElementTagNameMap {
18384
18526
  "rarui-icon": RaruiIcon;
@@ -19446,9 +19588,134 @@ declare class RaruiRadioButton extends RaruiRadioButton_base {
19446
19588
 
19447
19589
  declare global {
19448
19590
  interface HTMLElementTagNameMap {
19449
- "rarui-select": any;
19591
+ "rarui-select": RaruiSelect;
19450
19592
  }
19451
19593
  }
19594
+ /**
19595
+ * ## Rarui Select
19596
+ * ---
19597
+ * Select component for choosing options from a dropdown menu with support for single and multiple selection.
19598
+ *
19599
+ * Features:
19600
+ * - **Single Selection**: Choose one option from the list using rarui-select-option elements
19601
+ * - **Multiple Selection**: Choose multiple options with checkboxes using rarui-select-option elements
19602
+ * - **Slot-based Content**: Use rarui-select-option elements as children for flexible content
19603
+ * - **Accessibility**: Full keyboard navigation with ESC key support
19604
+ * - **Controlled Behavior**: Uses internal web components (Dropdown, Checkbox, Text, Box, Chip, Icon)
19605
+ *
19606
+ * See [a complete document](https://rarui.rarolabs.com.br/docs/components-web-components/input/select) for more details.
19607
+ */
19608
+ type SelectManifestProperties = Omit<SelectProps, "onChange" | "portalId" | "options"> & {
19609
+ /**
19610
+ * Position of the dropdown relative to the trigger.
19611
+ * @default "bottom-start"
19612
+ */
19613
+ position?: Placement;
19614
+ /**
19615
+ * CSS positioning strategy used for the dropdown.
19616
+ *
19617
+ * - `"fixed"` (default) positions the dropdown relative to the viewport,
19618
+ * so it stays in the same place even when the page is scrolled.
19619
+ * - `"absolute"` positions the dropdown relative to the nearest positioned ancestor,
19620
+ * which can be useful when you want the dropdown to move with page content.
19621
+ *
19622
+ * Use `"fixed"` for dropdowns that should remain visible on scroll,
19623
+ * and `"absolute"` when dropdowns need to be positioned within scrollable containers.
19624
+ * @default "fixed"
19625
+ */
19626
+ strategy?: "fixed" | "absolute";
19627
+ /**
19628
+ * The name of the select for form submission.
19629
+ */
19630
+ name?: string;
19631
+ /**
19632
+ * Associates the select with a form element by ID.
19633
+ */
19634
+ form?: string;
19635
+ /**
19636
+ * Whether the select is required for form validation.
19637
+ * @default false
19638
+ */
19639
+ required?: boolean;
19640
+ };
19641
+ type SelectProperties = WebComponentProperties<SelectManifestProperties>;
19642
+
19643
+ declare const RaruiSelect_base: (new (...args: any[]) => {
19644
+ ariaLabel: string | null;
19645
+ ariaLabelledBy: string | null;
19646
+ ariaDescribedBy: string | null;
19647
+ }) & (new (...args: any[]) => {
19648
+ cssProps: Record<string, any>;
19649
+ sprinkleAttrs: Record<string, any>;
19650
+ }) & typeof LitElement;
19651
+ declare class RaruiSelect extends RaruiSelect_base {
19652
+ static shadowRootOptions: {
19653
+ delegatesFocus: boolean;
19654
+ mode: ShadowRootMode;
19655
+ serializable?: boolean;
19656
+ slotAssignment?: SlotAssignmentMode;
19657
+ };
19658
+ sprinkleAttrs: Record<string, string>;
19659
+ private _internals;
19660
+ static formAssociated: boolean;
19661
+ constructor();
19662
+ size: SelectProperties["size"];
19663
+ appearance: SelectProperties["appearance"];
19664
+ placeholder?: string;
19665
+ disabled: boolean;
19666
+ multiple: SelectProperties["multiple"];
19667
+ open: SelectProperties["open"];
19668
+ enabledFlip: SelectProperties["enabled-flip"];
19669
+ position: SelectProperties["position"];
19670
+ maxHeight: SelectProperties["max-height"];
19671
+ zIndex: SelectProperties["z-index"];
19672
+ strategy: SelectProperties["strategy"];
19673
+ name: SelectProperties["name"];
19674
+ form: SelectProperties["form"];
19675
+ required: SelectProperties["required"];
19676
+ itemsAfterTruncate: SelectProperties["items-after-truncate"];
19677
+ ariaInvalid: AriaInvalid;
19678
+ get value(): SelectOptionProps | SelectOptionProps[] | undefined;
19679
+ set value(value: SelectOptionProps | SelectOptionProps[] | undefined);
19680
+ private _value;
19681
+ get defaultValue(): SelectOptionProps | SelectOptionProps[] | undefined;
19682
+ set defaultValue(value: SelectOptionProps | SelectOptionProps[] | undefined);
19683
+ private _defaultValue;
19684
+ private selectedOptions;
19685
+ private menuOpen;
19686
+ private childOptions;
19687
+ dropdown: Element;
19688
+ private _selectContext;
19689
+ private _observer?;
19690
+ static styles: CSSResult;
19691
+ connectedCallback(): void;
19692
+ private _setupMutationObserver;
19693
+ private _syncSelectedOptionsFromChildren;
19694
+ disconnectedCallback(): void;
19695
+ private _updateSelectedOptions;
19696
+ private handleSelect;
19697
+ private handleRemoveOption;
19698
+ private renderHiddenFormInputs;
19699
+ private handleResetOptions;
19700
+ private handleDropdownOpenChange;
19701
+ private _handleOptionSelect;
19702
+ private _handleContextOptionSelect;
19703
+ private _handleOptionMount;
19704
+ private _handleOptionUnmount;
19705
+ private _updateContext;
19706
+ private handleSelectClick;
19707
+ render(): TemplateResult<1>;
19708
+ private _renderTrigger;
19709
+ private _renderPlaceholder;
19710
+ private _renderSelectedOptions;
19711
+ private _renderControls;
19712
+ private _renderContent;
19713
+ private _updateFormValue;
19714
+ focus(): void;
19715
+ blur(): void;
19716
+ private _handleLabelClick;
19717
+ formResetCallback(): void;
19718
+ }
19452
19719
 
19453
19720
  declare global {
19454
19721
  interface HTMLElementTagNameMap {