@rarui/components 1.15.0 → 1.16.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-06-30 `1.16.0`
6
+
7
+ #### 🎉 New features
8
+
9
+ - Added new input `Dropdown` component. ([#124](https://git.rarolabs.com.br/frontend/rarui/-/merge_requests/124) by [@junior](https://git.rarolabs.com.br/junior))
10
+
5
11
  ## 2025-06-27 `1.15.0`
6
12
 
7
13
  #### 🎉 New features
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.14.0",
2
+ "version": "1.15.0",
3
3
  "tags": [
4
4
  {
5
5
  "name": "rarui-avatar",
@@ -2091,7 +2091,7 @@
2091
2091
  {
2092
2092
  "name": "position",
2093
2093
  "default": "bottom",
2094
- "description": "Position of the popover.\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",
2094
+ "description": "Position of the tooltip.\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",
2095
2095
  "type": "string",
2096
2096
  "values": [
2097
2097
  {
@@ -2691,6 +2691,223 @@
2691
2691
  }
2692
2692
  ]
2693
2693
  },
2694
+ {
2695
+ "name": "rarui-dropdown",
2696
+ "description": "## Rarui Dropdown\n---\nAn suspended menu displays a list of options on a temporary surface.\n\nSee [a complete document](https://rarui.rarolabs.com.br/docs/components-web-components/input/dropdown) for more details.",
2697
+ "attributes": [
2698
+ {
2699
+ "name": "padding",
2700
+ "default": "base",
2701
+ "description": "Specifies the padding inside the dropdown menu. This prop accepts one of the following values: \"base\" or \"none\".\n\n- base\n- none",
2702
+ "type": "string",
2703
+ "values": [
2704
+ {
2705
+ "name": "base",
2706
+ "description": "(default)"
2707
+ },
2708
+ {
2709
+ "name": "none"
2710
+ }
2711
+ ]
2712
+ },
2713
+ {
2714
+ "name": "width",
2715
+ "description": "The **`width`** CSS property sets an element's width. By default, it sets the width of the content area, but if `box-sizing` is set to `border-box`, it sets the width of the border area. It is also possible to pass a specific value.\n\n\n**Initial value**: `auto`\n\nThis property supports responsive values. You can pass a single value like `\"auto\"`.\n\n Or an object like:\n \n ```\n{\n \"xs\": \"auto\",\n \"md\": \"fit-content\",\n \"lg\": \"intrinsic\",\n \"xl\": \"max-content\"\n}\n```\n\n- auto\n- fit-content\n- intrinsic\n- max-content\n- min-content\n- min-intrinsic\n- stretch",
2716
+ "values": [
2717
+ {
2718
+ "name": "auto"
2719
+ },
2720
+ {
2721
+ "name": "fit-content"
2722
+ },
2723
+ {
2724
+ "name": "intrinsic"
2725
+ },
2726
+ {
2727
+ "name": "max-content"
2728
+ },
2729
+ {
2730
+ "name": "min-content"
2731
+ },
2732
+ {
2733
+ "name": "min-intrinsic"
2734
+ },
2735
+ {
2736
+ "name": "stretch"
2737
+ }
2738
+ ]
2739
+ },
2740
+ {
2741
+ "name": "max-width",
2742
+ "description": "The **`max-width`** CSS property sets the maximum width of an element. It prevents the used value of the `width` property from becoming larger than the value specified by `max-width`. It is also possible to pass a specific value.\n\n\n**Initial value**: `none`\n\nThis property supports responsive values. You can pass a single value like `\"fit-content\"`.\n\n Or an object like:\n \n ```\n{\n \"xs\": \"fit-content\",\n \"md\": \"intrinsic\",\n \"lg\": \"max-content\",\n \"xl\": \"min-content\"\n}\n```\n\n- fit-content\n- intrinsic\n- max-content\n- min-content\n- none\n- stretch",
2743
+ "values": [
2744
+ {
2745
+ "name": "fit-content"
2746
+ },
2747
+ {
2748
+ "name": "intrinsic"
2749
+ },
2750
+ {
2751
+ "name": "max-content"
2752
+ },
2753
+ {
2754
+ "name": "min-content"
2755
+ },
2756
+ {
2757
+ "name": "none"
2758
+ },
2759
+ {
2760
+ "name": "stretch"
2761
+ }
2762
+ ]
2763
+ },
2764
+ {
2765
+ "name": "match-reference-width",
2766
+ "default": false,
2767
+ "description": "A common feature of select dropdowns is that the dropdown matches the width of the reference regardless of its contents.",
2768
+ "type": "boolean"
2769
+ },
2770
+ {
2771
+ "name": "enabled-dismiss",
2772
+ "default": true,
2773
+ "description": "Adds listeners that dismiss (close) the floating element.",
2774
+ "type": "boolean"
2775
+ },
2776
+ {
2777
+ "name": "enabled-click",
2778
+ "default": true,
2779
+ "description": "Adds click event listeners that change the open state.",
2780
+ "type": "boolean"
2781
+ },
2782
+ {
2783
+ "name": "enabled-flip",
2784
+ "default": true,
2785
+ "description": "Determines whether the dropdown should enable flipping the options' dropdown when there is not enough space to display it in its default direction.\nThis can help ensure the dropdown is always visible on the screen.",
2786
+ "type": "boolean"
2787
+ },
2788
+ {
2789
+ "name": "offset",
2790
+ "default": 10,
2791
+ "description": "Offest displaces the floating element from its core placement along the specified axes.",
2792
+ "type": "number"
2793
+ },
2794
+ {
2795
+ "name": "visible",
2796
+ "description": "If true, the component is shown.",
2797
+ "type": "boolean"
2798
+ },
2799
+ {
2800
+ "name": "z-index",
2801
+ "description": "The zIndex property specifies the stack order of the box.\n\nThis property supports responsive values. You can pass a single value like `\"$100\"`.\n\n Or an object like:\n \n ```\n{\n \"xs\": \"$100\",\n \"md\": \"$200\",\n \"lg\": \"$300\",\n \"xl\": \"$400\"\n}\n```\n\n- $100\n- $200\n- $300\n- $400\n- $500\n- $600\n- $700\n- $800\n- $900",
2802
+ "values": [
2803
+ {
2804
+ "name": "$100"
2805
+ },
2806
+ {
2807
+ "name": "$200"
2808
+ },
2809
+ {
2810
+ "name": "$300"
2811
+ },
2812
+ {
2813
+ "name": "$400"
2814
+ },
2815
+ {
2816
+ "name": "$500"
2817
+ },
2818
+ {
2819
+ "name": "$600"
2820
+ },
2821
+ {
2822
+ "name": "$700"
2823
+ },
2824
+ {
2825
+ "name": "$800"
2826
+ },
2827
+ {
2828
+ "name": "$900"
2829
+ }
2830
+ ]
2831
+ },
2832
+ {
2833
+ "name": "position",
2834
+ "default": "bottom-start",
2835
+ "description": "Position of the dropdown.\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",
2836
+ "type": "string",
2837
+ "values": [
2838
+ {
2839
+ "name": "bottom"
2840
+ },
2841
+ {
2842
+ "name": "bottom-end"
2843
+ },
2844
+ {
2845
+ "name": "bottom-start",
2846
+ "description": "(default)"
2847
+ },
2848
+ {
2849
+ "name": "left"
2850
+ },
2851
+ {
2852
+ "name": "left-end"
2853
+ },
2854
+ {
2855
+ "name": "left-start"
2856
+ },
2857
+ {
2858
+ "name": "right"
2859
+ },
2860
+ {
2861
+ "name": "right-end"
2862
+ },
2863
+ {
2864
+ "name": "right-start"
2865
+ },
2866
+ {
2867
+ "name": "top"
2868
+ },
2869
+ {
2870
+ "name": "top-end"
2871
+ },
2872
+ {
2873
+ "name": "top-start"
2874
+ }
2875
+ ]
2876
+ },
2877
+ {
2878
+ "name": "strategy",
2879
+ "default": "fixed",
2880
+ "description": "CSS positioning strategy used for the tooltip.\n\n- `\"fixed\"` (default) positions the tooltip relative to the viewport,\n so it stays in the same place even when the page is scrolled.\n- `\"absolute\"` positions the tooltip relative to the nearest positioned ancestor,\n which can be useful when you want the tooltip to move with page content.\n\nUse `\"fixed\"` for tooltips that should remain visible on scroll,\nand `\"absolute\"` when tooltips need to be positioned within scrollable containers.\n\n- absolute\n- fixed",
2881
+ "type": "string",
2882
+ "values": [
2883
+ {
2884
+ "name": "absolute"
2885
+ },
2886
+ {
2887
+ "name": "fixed",
2888
+ "description": "(default)"
2889
+ }
2890
+ ]
2891
+ }
2892
+ ]
2893
+ },
2894
+ {
2895
+ "name": "rarui-dropdown-item",
2896
+ "description": "## Rarui Dropdown Item\n---\nAn suspended menu displays a list of options on a temporary surface.\n\nSee [a complete document](https://rarui.rarolabs.com.br/docs/components-web-components/surface/dropdown) for more details.",
2897
+ "attributes": [
2898
+ {
2899
+ "name": "selected",
2900
+ "default": false,
2901
+ "description": "Indicates if the item is selected.\nThis affects the visual style, such as highlight or marking.",
2902
+ "type": "boolean"
2903
+ },
2904
+ {
2905
+ "name": "name",
2906
+ "description": "The name of the dropdown item. This is typically the text that is displayed for the item.",
2907
+ "type": "string"
2908
+ }
2909
+ ]
2910
+ },
2694
2911
  {
2695
2912
  "name": "rarui-icon-button",
2696
2913
  "description": "## Rarui Icon Button\n---\nButton allows the user to perform actions, such as sending a file, advancing a form, sharing a document, or making a comment.\n\nSee [a complete document](https://rarui.rarolabs.com.br/docs/components-web-components/input/button) for more details.",
package/dist/index.d.ts CHANGED
@@ -16141,6 +16141,17 @@ declare const fontWeightProperties: {
16141
16141
  semiBold: `var(--${string})` | `var(--${string}, ${string})`;
16142
16142
  bold: `var(--${string})` | `var(--${string}, ${string})`;
16143
16143
  };
16144
+ declare const zIndexProperties: {
16145
+ "100": `var(--${string})` | `var(--${string}, ${string})`;
16146
+ "200": `var(--${string})` | `var(--${string}, ${string})`;
16147
+ "300": `var(--${string})` | `var(--${string}, ${string})`;
16148
+ "400": `var(--${string})` | `var(--${string}, ${string})`;
16149
+ "500": `var(--${string})` | `var(--${string}, ${string})`;
16150
+ "600": `var(--${string})` | `var(--${string}, ${string})`;
16151
+ "700": `var(--${string})` | `var(--${string}, ${string})`;
16152
+ "800": `var(--${string})` | `var(--${string}, ${string})`;
16153
+ "900": `var(--${string})` | `var(--${string}, ${string})`;
16154
+ };
16144
16155
  declare const colorProperties: {
16145
16156
  currentColor: string;
16146
16157
  brand: `var(--${string})` | `var(--${string}, ${string})`;
@@ -16967,6 +16978,48 @@ declare const styles$3: {
16967
16978
 
16968
16979
  type RadioButtonVariants = NonNullable<RecipeVariants<typeof styles$3.radioButton>>;
16969
16980
 
16981
+ declare const dropdownStyles: {
16982
+ dropdown: RuntimeFn<{
16983
+ /**
16984
+ * Specifies the padding inside the dropdown menu. This prop accepts one of the following values: "base" or "none".
16985
+ * @default base
16986
+ */
16987
+ padding: {
16988
+ base: {
16989
+ padding: `var(--${string})` | `var(--${string}, ${string})`;
16990
+ };
16991
+ none: {
16992
+ padding: number;
16993
+ };
16994
+ };
16995
+ }>;
16996
+ item: RuntimeFn<{
16997
+ /**
16998
+ * Indicates if the item is selected.
16999
+ * This affects the visual style, such as highlight or marking.
17000
+ *
17001
+ * @default false
17002
+ */
17003
+ selected: {
17004
+ true: {
17005
+ backgroundColor: `var(--${string})` | `var(--${string}, ${string})`;
17006
+ ":hover": {
17007
+ backgroundColor: `var(--${string})` | `var(--${string}, ${string})`;
17008
+ };
17009
+ };
17010
+ };
17011
+ }>;
17012
+ };
17013
+
17014
+ type DropdownVariants = NonNullable<RecipeVariants<typeof dropdownStyles.dropdown> & RecipeVariants<typeof dropdownStyles.item>>;
17015
+ type DropdownDynamicProperties = Pick<StandardLonghandProperties, "width" | "maxWidth">;
17016
+ interface DropdownSprinkle extends DropdownDynamicProperties {
17017
+ /**
17018
+ * The zIndex property specifies the stack order of the box.
17019
+ */
17020
+ zIndex?: AddDollar<keyof typeof zIndexProperties> | Conditions<AddDollar<keyof typeof zIndexProperties>>;
17021
+ }
17022
+
16970
17023
  declare const statusStyles: {
16971
17024
  status: RuntimeFn<{
16972
17025
  /**
@@ -17621,6 +17674,58 @@ interface ChipTyping extends ChipSprinkle {
17621
17674
  }
17622
17675
  type ChipProps = ChipTyping & ChipVariants;
17623
17676
 
17677
+ interface DropdownTyping {
17678
+ /**
17679
+ * A common feature of select dropdowns is that the dropdown matches the width of the reference regardless of its contents.
17680
+ * @default false
17681
+ */
17682
+ matchReferenceWidth?: boolean;
17683
+ /**
17684
+ * Adds listeners that dismiss (close) the floating element.
17685
+ * @default true
17686
+ */
17687
+ enabledDismiss?: boolean;
17688
+ /**
17689
+ * Adds click event listeners that change the open state.
17690
+ * @default true
17691
+ */
17692
+ enabledClick?: boolean;
17693
+ /**
17694
+ * Determines whether the dropdown should enable flipping the options' dropdown when there is not enough space to display it in its default direction.
17695
+ * This can help ensure the dropdown is always visible on the screen.
17696
+ * @default true
17697
+ */
17698
+ enabledFlip?: boolean;
17699
+ /**
17700
+ * Offest displaces the floating element from its core placement along the specified axes.
17701
+ * @default 10
17702
+ */
17703
+ offset?: number;
17704
+ /**
17705
+ * Specifies the ID of the portal element where the dropdown should be rendered.
17706
+ * This can be useful for rendering the dropdown in a different part of the DOM, such as a modal or overlay.
17707
+ */
17708
+ portalId?: string;
17709
+ /**
17710
+ * If true, the component is shown.
17711
+ */
17712
+ visible?: boolean;
17713
+ /**
17714
+ * Function to control dropdown opening and closing.
17715
+ * @TJS-type (visible: boolean) => void;
17716
+ */
17717
+ onVisibility?: (visible: boolean) => void;
17718
+ }
17719
+ type DropdownProps = DropdownTyping & DropdownSprinkle & Pick<DropdownVariants, "padding">;
17720
+
17721
+ interface DropdownItemTyping {
17722
+ /**
17723
+ * The name of the dropdown item. This is typically the text that is displayed for the item.
17724
+ */
17725
+ name?: string;
17726
+ }
17727
+ type DropdownItemProps = DropdownItemTyping & Pick<DropdownVariants, "selected">;
17728
+
17624
17729
  interface IconButtonTyping {
17625
17730
  /**
17626
17731
  * Disables the button, disallowing user interaction.
@@ -17969,7 +18074,7 @@ declare global {
17969
18074
  */
17970
18075
  type TooltipProperties = Partial<Omit<TooltipProps, "visible" | "onVisibility" | "portalId">> & {
17971
18076
  /**
17972
- * Position of the popover.
18077
+ * Position of the tooltip.
17973
18078
  * @default bottom
17974
18079
  */
17975
18080
  position?: Placement;
@@ -18181,6 +18286,91 @@ declare class RaruiChip extends LitElement {
18181
18286
  render(): TemplateResult<1>;
18182
18287
  }
18183
18288
 
18289
+ declare global {
18290
+ interface HTMLElementTagNameMap {
18291
+ "rarui-dropdown": RaruiDropdown;
18292
+ }
18293
+ }
18294
+ /**
18295
+ * ## Rarui Dropdown
18296
+ * ---
18297
+ * An suspended menu displays a list of options on a temporary surface.
18298
+ *
18299
+ See [a complete document](https://rarui.rarolabs.com.br/docs/components-web-components/input/dropdown) for more details.
18300
+ */
18301
+ type DropdownProperties = Omit<Partial<DropdownProps>, "onVisibility" | "portalId"> & {
18302
+ /**
18303
+ * Position of the dropdown.
18304
+ * @default bottom-start
18305
+ */
18306
+ position?: Placement;
18307
+ /**
18308
+ * CSS positioning strategy used for the tooltip.
18309
+ *
18310
+ * - `"fixed"` (default) positions the tooltip relative to the viewport,
18311
+ * so it stays in the same place even when the page is scrolled.
18312
+ * - `"absolute"` positions the tooltip relative to the nearest positioned ancestor,
18313
+ * which can be useful when you want the tooltip to move with page content.
18314
+ *
18315
+ * Use `"fixed"` for tooltips that should remain visible on scroll,
18316
+ * and `"absolute"` when tooltips need to be positioned within scrollable containers.
18317
+ * @default fixed
18318
+ */
18319
+ strategy?: "fixed" | "absolute";
18320
+ };
18321
+
18322
+ declare class RaruiDropdown extends LitElement {
18323
+ sprinkleAttrs: Record<string, string>;
18324
+ offset: DropdownProperties["offset"];
18325
+ padding: DropdownProperties["padding"];
18326
+ position: DropdownProperties["position"];
18327
+ strategy: DropdownProperties["strategy"];
18328
+ matchReferenceWidth?: DropdownProperties["matchReferenceWidth"];
18329
+ enabledFlip?: DropdownProperties["enabledFlip"];
18330
+ enabledClick: DropdownProperties["enabledClick"];
18331
+ enabledDismiss: DropdownProperties["enabledDismiss"];
18332
+ open: boolean;
18333
+ set visible(value: boolean | undefined);
18334
+ get visible(): boolean | undefined;
18335
+ private _visible?;
18336
+ reference: HTMLElement;
18337
+ floating: HTMLElement;
18338
+ static styles: CSSResult;
18339
+ cleanupAutoUpdate?: () => void;
18340
+ private updatePositionDebounceId;
18341
+ connectedCallback(): void;
18342
+ disconnectedCallback(): void;
18343
+ updated(changed: Map<string, any>): void;
18344
+ private scheduleUpdatePosition;
18345
+ private handleClickOutside;
18346
+ private handleClick;
18347
+ updatePosition(): Promise<void>;
18348
+ private getMiddleware;
18349
+ computePosition(): Promise<void>;
18350
+ render(): TemplateResult<1>;
18351
+ }
18352
+
18353
+ declare global {
18354
+ interface HTMLElementTagNameMap {
18355
+ "rarui-dropdown-item": RaruiDropdownItem;
18356
+ }
18357
+ }
18358
+ /**
18359
+ * ## Rarui Dropdown Item
18360
+ * ---
18361
+ * An suspended menu displays a list of options on a temporary surface.
18362
+ *
18363
+ See [a complete document](https://rarui.rarolabs.com.br/docs/components-web-components/surface/dropdown) for more details.
18364
+ */
18365
+ type DropdownItemProperties = Omit<DropdownItemProps, "icon">;
18366
+
18367
+ declare class RaruiDropdownItem extends LitElement {
18368
+ name: DropdownItemProperties["name"];
18369
+ selected: DropdownItemProperties["selected"];
18370
+ static styles: CSSResult;
18371
+ render(): TemplateResult<1>;
18372
+ }
18373
+
18184
18374
  declare global {
18185
18375
  interface HTMLElementTagNameMap {
18186
18376
  "rarui-icon-button": RaruiIconButton;