@wix/site-ui 1.30.0 → 1.31.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 (173) hide show
  1. package/dist/1268.js +99 -0
  2. package/dist/1279.js +7 -0
  3. package/dist/1457.js +10 -0
  4. package/dist/1477.js +106 -0
  5. package/dist/1500.js +111 -0
  6. package/dist/167.js +6 -0
  7. package/dist/2274.js +34 -0
  8. package/dist/2287.js +17 -0
  9. package/dist/2418.js +31 -0
  10. package/dist/2801.js +20 -0
  11. package/dist/285.js +86 -0
  12. package/dist/2861.js +6 -0
  13. package/dist/3020.js +7 -0
  14. package/dist/3021.js +72 -0
  15. package/dist/3056.js +229 -0
  16. package/dist/3140.js +4 -0
  17. package/dist/3248.js +307 -0
  18. package/dist/3296.js +4 -0
  19. package/dist/3319.js +400 -0
  20. package/dist/3395.js +4 -0
  21. package/dist/3485.js +854 -0
  22. package/dist/353.js +14 -0
  23. package/dist/3670.js +418 -0
  24. package/dist/3829.js +113 -0
  25. package/dist/4026.js +12 -0
  26. package/dist/4143.js +46 -0
  27. package/dist/42.js +32 -0
  28. package/dist/4281.js +30 -0
  29. package/dist/4346.js +2 -0
  30. package/dist/4388.js +418 -0
  31. package/dist/4490.js +32 -0
  32. package/dist/4495.js +9 -0
  33. package/dist/4549.js +24 -0
  34. package/dist/4586.js +41 -0
  35. package/dist/4586.js.LICENSE.txt +19 -0
  36. package/dist/4707.js +19 -0
  37. package/dist/4723.js +7 -0
  38. package/dist/4745.js +7 -0
  39. package/dist/4768.js +35 -0
  40. package/dist/4922.js +15 -0
  41. package/dist/5036.js +17 -0
  42. package/dist/5085.js +20 -0
  43. package/dist/5299.js +597 -0
  44. package/dist/5659.js +4 -0
  45. package/dist/5778.js +10 -0
  46. package/dist/5864.js +86 -0
  47. package/dist/5992.js +913 -0
  48. package/dist/5992.js.LICENSE.txt +19 -0
  49. package/dist/6003.js +10 -0
  50. package/dist/6046.js +29 -0
  51. package/dist/6089.js +2355 -0
  52. package/dist/6107.js +10 -0
  53. package/dist/6247.js +20 -0
  54. package/dist/6270.js +487 -0
  55. package/dist/6329.js +32 -0
  56. package/dist/6330.js +30 -0
  57. package/dist/6499.js +7 -0
  58. package/dist/6535.js +71 -0
  59. package/dist/6588.js +382 -0
  60. package/dist/6706.js +16 -0
  61. package/dist/6825.js +7 -0
  62. package/dist/6882.js +1562 -0
  63. package/dist/6914.js +30 -0
  64. package/dist/7021.js +13 -0
  65. package/dist/7366.js +83 -0
  66. package/dist/7373.js +25 -0
  67. package/dist/7541.js +25 -0
  68. package/dist/7564.js +10 -0
  69. package/dist/7642.js +20 -0
  70. package/dist/7725.js +10 -0
  71. package/dist/7871.js +38 -0
  72. package/dist/8052.js +352 -0
  73. package/dist/8106.js +238 -0
  74. package/dist/8171.js +346 -0
  75. package/dist/8225.js +21 -0
  76. package/dist/8272.js +333 -0
  77. package/dist/8527.js +58 -0
  78. package/dist/8724.js +10 -0
  79. package/dist/8750.js +1920 -0
  80. package/dist/8758.js +43 -0
  81. package/dist/880.js +149 -0
  82. package/dist/8935.js +8 -0
  83. package/dist/8960.js +22 -0
  84. package/dist/8971.js +40 -0
  85. package/dist/8979.js +10 -0
  86. package/dist/8996.js +71 -0
  87. package/dist/904.js +121 -0
  88. package/dist/9048.js +52 -0
  89. package/dist/9087.js +256 -0
  90. package/dist/9189.js +158 -0
  91. package/dist/9255.js +136 -0
  92. package/dist/9352.js +148 -0
  93. package/dist/951.js +22 -0
  94. package/dist/9635.js +22 -0
  95. package/dist/9829.js +4 -0
  96. package/dist/9863.js +8 -0
  97. package/dist/Accordion/index.d.ts +569 -12
  98. package/dist/Accordion/index.js +423 -8
  99. package/dist/AlertDialog/index.d.ts +1417 -18
  100. package/dist/AlertDialog/index.js +34 -14
  101. package/dist/Autocomplete/index.d.ts +1861 -38
  102. package/dist/Autocomplete/index.js +98 -24
  103. package/dist/Avatar/index.d.ts +129 -7
  104. package/dist/Avatar/index.js +149 -6
  105. package/dist/Breadcrumbs/index.d.ts +960 -7
  106. package/dist/Breadcrumbs/index.js +5 -5
  107. package/dist/Button/index.d.ts +88 -6
  108. package/dist/Button/index.js +27 -3
  109. package/dist/Checkbox/index.d.ts +425 -5
  110. package/dist/Checkbox/index.js +45 -5
  111. package/dist/CheckboxGroup/index.d.ts +318 -3
  112. package/dist/CheckboxGroup/index.js +166 -3
  113. package/dist/Collapsible/index.d.ts +377 -7
  114. package/dist/Collapsible/index.js +160 -6
  115. package/dist/Combobox/index.d.ts +1984 -48
  116. package/dist/Combobox/index.js +352 -29
  117. package/dist/ContextMenu/index.d.ts +2340 -36
  118. package/dist/ContextMenu/index.js +197 -22
  119. package/dist/Dialog/index.d.ts +1355 -18
  120. package/dist/Dialog/index.js +16 -14
  121. package/dist/Drawer/index.d.ts +1653 -18
  122. package/dist/Drawer/index.js +2797 -20
  123. package/dist/Field/index.d.ts +655 -15
  124. package/dist/Field/index.js +677 -10
  125. package/dist/Fieldset/index.d.ts +94 -5
  126. package/dist/Fieldset/index.js +68 -5
  127. package/dist/Form/index.d.ts +331 -2
  128. package/dist/Form/index.js +106 -3
  129. package/dist/Input/index.d.ts +692 -3
  130. package/dist/Input/index.js +10 -3
  131. package/dist/Menu/index.d.ts +2301 -36
  132. package/dist/Menu/index.js +365 -26
  133. package/dist/Menubar/index.d.ts +2301 -3
  134. package/dist/Menubar/index.js +105 -3
  135. package/dist/Meter/index.d.ts +175 -11
  136. package/dist/Meter/index.js +129 -9
  137. package/dist/NavigationMenu/index.d.ts +978 -28
  138. package/dist/NavigationMenu/index.js +1034 -17
  139. package/dist/NumberField/index.d.ts +612 -15
  140. package/dist/NumberField/index.js +1409 -11
  141. package/dist/Popover/index.d.ts +1655 -20
  142. package/dist/Popover/index.js +792 -17
  143. package/dist/PreviewCard/index.d.ts +1523 -14
  144. package/dist/PreviewCard/index.js +679 -14
  145. package/dist/Progress/index.d.ts +183 -11
  146. package/dist/Progress/index.js +181 -9
  147. package/dist/Radio/index.d.ts +185 -6
  148. package/dist/Radio/index.js +253 -6
  149. package/dist/RadioGroup/index.d.ts +341 -2
  150. package/dist/RadioGroup/index.js +154 -3
  151. package/dist/ScrollArea/index.d.ts +265 -13
  152. package/dist/ScrollArea/index.js +892 -10
  153. package/dist/Select/index.d.ts +1493 -38
  154. package/dist/Select/index.js +1824 -23
  155. package/dist/Separator/index.d.ts +80 -6
  156. package/dist/Separator/index.js +3 -3
  157. package/dist/Slider/index.d.ts +678 -16
  158. package/dist/Slider/index.js +1199 -11
  159. package/dist/Switch/index.d.ts +393 -5
  160. package/dist/Switch/index.js +208 -6
  161. package/dist/Tabs/index.d.ts +523 -12
  162. package/dist/Tabs/index.js +685 -9
  163. package/dist/Toggle/index.d.ts +305 -2
  164. package/dist/Toggle/index.js +76 -3
  165. package/dist/ToggleGroup/index.d.ts +316 -2
  166. package/dist/ToggleGroup/index.js +102 -3
  167. package/dist/Toolbar/index.d.ts +282 -13
  168. package/dist/Toolbar/index.js +230 -9
  169. package/dist/Tooltip/index.d.ts +1572 -14
  170. package/dist/Tooltip/index.js +965 -14
  171. package/dist/index.d.ts +12749 -652
  172. package/dist/rslib-runtime.js +18 -0
  173. package/package.json +3 -3
@@ -1,7 +1,81 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Autocomplete } from "@base-ui/react/autocomplete";
3
2
  import clsx from "clsx";
3
+ import { ComboboxArrow_ComboboxArrow, ComboboxPositioner_ComboboxPositioner, ComboboxRow_ComboboxRow, ComboboxInputGroup_ComboboxInputGroup, AriaCombobox, ComboboxCollection, ComboboxBackdrop_ComboboxBackdrop, ComboboxClear_ComboboxClear, ComboboxIcon_ComboboxIcon, ComboboxTrigger_ComboboxTrigger, ComboboxGroup_ComboboxGroup, ComboboxGroupLabel_ComboboxGroupLabel, ComboboxPopup_ComboboxPopup, useCoreFilter, ComboboxStatus_ComboboxStatus, ComboboxInput_ComboboxInput, ComboboxEmpty_ComboboxEmpty, ComboboxPortal_ComboboxPortal, useComboboxInputValueContext, ComboboxItem_ComboboxItem, ComboboxList_ComboboxList } from "../6089.js";
4
+ import { pointer } from "../2418.js";
5
+ import { stringifyAsLabel } from "../7366.js";
6
+ import { Separator } from "../9635.js";
4
7
  import * as __rspack_external_react from "react";
8
+ const AutocompleteInputGroup = ComboboxInputGroup_ComboboxInputGroup;
9
+ const AutocompleteItem = ComboboxItem_ComboboxItem;
10
+ const AutocompleteTrigger = ComboboxTrigger_ComboboxTrigger;
11
+ function AutocompleteRoot(props) {
12
+ const { openOnInputClick = false, value, defaultValue, onValueChange, mode = 'list', itemToStringValue, ...other } = props;
13
+ const enableInline = 'inline' === mode || 'both' === mode;
14
+ const staticItems = 'inline' === mode || 'none' === mode;
15
+ const isControlled = void 0 !== value;
16
+ const [internalValue, setInternalValue] = __rspack_external_react.useState(defaultValue ?? '');
17
+ const [inlineInputValue, setInlineInputValue] = __rspack_external_react.useState('');
18
+ __rspack_external_react.useEffect(()=>{
19
+ if (isControlled) setInlineInputValue('');
20
+ }, [
21
+ value,
22
+ isControlled
23
+ ]);
24
+ let resolvedInputValue;
25
+ resolvedInputValue = enableInline && '' !== inlineInputValue ? inlineInputValue : isControlled ? value ?? '' : internalValue;
26
+ const collator = useCoreFilter();
27
+ const baseFilter = __rspack_external_react.useMemo(()=>{
28
+ if (void 0 !== other.filter) return other.filter;
29
+ return collator.contains;
30
+ }, [
31
+ other.filter,
32
+ collator
33
+ ]);
34
+ const resolvedQuery = String(isControlled ? value : internalValue).trim();
35
+ const resolvedFilter = __rspack_external_react.useMemo(()=>{
36
+ if ('both' !== mode) return staticItems ? null : baseFilter;
37
+ if (null === baseFilter) return null;
38
+ return (item, _query, toString)=>baseFilter(item, resolvedQuery, toString);
39
+ }, [
40
+ baseFilter,
41
+ mode,
42
+ resolvedQuery,
43
+ staticItems
44
+ ]);
45
+ function handleValueChange(nextValue, eventDetails) {
46
+ setInlineInputValue('');
47
+ if (!isControlled) setInternalValue(nextValue);
48
+ onValueChange?.(nextValue, eventDetails);
49
+ }
50
+ function handleItemHighlighted(highlightedValue, eventDetails) {
51
+ props.onItemHighlighted?.(highlightedValue, eventDetails);
52
+ if (eventDetails.reason === pointer) return;
53
+ if (enableInline) null == highlightedValue ? setInlineInputValue('') : setInlineInputValue(stringifyAsLabel(highlightedValue, itemToStringValue));
54
+ else setInlineInputValue('');
55
+ }
56
+ return /*#__PURE__*/ jsx(AriaCombobox, {
57
+ ...other,
58
+ itemToStringLabel: itemToStringValue,
59
+ openOnInputClick: openOnInputClick,
60
+ selectionMode: "none",
61
+ fillInputOnItemPress: true,
62
+ filter: resolvedFilter,
63
+ autoComplete: mode,
64
+ inputValue: resolvedInputValue,
65
+ defaultInputValue: defaultValue,
66
+ onInputValueChange: handleValueChange,
67
+ onItemHighlighted: handleItemHighlighted
68
+ });
69
+ }
70
+ function AutocompleteValue(props) {
71
+ const { children } = props;
72
+ const inputValue = useComboboxInputValueContext();
73
+ let returnValue = null;
74
+ returnValue = 'function' == typeof children ? children(String(inputValue)) : null != children ? children : inputValue;
75
+ return /*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
76
+ children: returnValue
77
+ });
78
+ }
5
79
  const Autocomplete_module = {
6
80
  inputGroup: "inputGroup-II6FAN",
7
81
  input: "input-k82Te5",
@@ -11,88 +85,88 @@ const Autocomplete_module = {
11
85
  item: "item-MXqW1H",
12
86
  empty: "empty-P2WjlU"
13
87
  };
14
- const InputGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.InputGroup, {
88
+ const InputGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AutocompleteInputGroup, {
15
89
  ref: ref,
16
90
  className: clsx(Autocomplete_module.inputGroup, className),
17
91
  ...props
18
92
  }));
19
- const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Item, {
93
+ const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AutocompleteItem, {
20
94
  ref: ref,
21
95
  className: clsx(Autocomplete_module.item, className),
22
96
  ...props
23
97
  }));
24
- const Input = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Input, {
98
+ const Input = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxInput_ComboboxInput, {
25
99
  ref: ref,
26
100
  className: clsx(Autocomplete_module.input, className),
27
101
  ...props
28
102
  }));
29
- const Icon = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Icon, {
103
+ const Icon = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxIcon_ComboboxIcon, {
30
104
  ref: ref,
31
105
  className: clsx(Autocomplete_module.icon, className),
32
106
  ...props
33
107
  }));
34
- const Clear = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Clear, {
108
+ const Clear = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxClear_ComboboxClear, {
35
109
  ref: ref,
36
110
  className: clsx(Autocomplete_module.clear, className),
37
111
  ...props
38
112
  }));
39
- const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.List, {
113
+ const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxList_ComboboxList, {
40
114
  ref: ref,
41
115
  className: clsx(Autocomplete_module.list, className),
42
116
  ...props
43
117
  }));
44
- const Status = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Status, {
118
+ const Status = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxStatus_ComboboxStatus, {
45
119
  ref: ref,
46
120
  className: clsx(Autocomplete_module.status, className),
47
121
  ...props
48
122
  }));
49
- const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Backdrop, {
123
+ const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxBackdrop_ComboboxBackdrop, {
50
124
  ref: ref,
51
125
  className: clsx(Autocomplete_module.backdrop, className),
52
126
  ...props
53
127
  }));
54
- const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Positioner, {
128
+ const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxPositioner_ComboboxPositioner, {
55
129
  ref: ref,
56
130
  className: clsx(Autocomplete_module.positioner, className),
57
131
  ...props
58
132
  }));
59
- const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Popup, {
133
+ const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxPopup_ComboboxPopup, {
60
134
  ref: ref,
61
135
  className: clsx(Autocomplete_module.popup, className),
62
136
  ...props
63
137
  }));
64
- const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Arrow, {
138
+ const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxArrow_ComboboxArrow, {
65
139
  ref: ref,
66
140
  className: clsx(Autocomplete_module.arrow, className),
67
141
  ...props
68
142
  }));
69
- const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Group, {
143
+ const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxGroup_ComboboxGroup, {
70
144
  ref: ref,
71
145
  className: clsx(Autocomplete_module.group, className),
72
146
  ...props
73
147
  }));
74
- const GroupLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.GroupLabel, {
148
+ const GroupLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxGroupLabel_ComboboxGroupLabel, {
75
149
  ref: ref,
76
150
  className: clsx(Autocomplete_module.groupLabel, className),
77
151
  ...props
78
152
  }));
79
- const Row = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Row, {
153
+ const Row = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxRow_ComboboxRow, {
80
154
  ref: ref,
81
155
  className: clsx(Autocomplete_module.row, className),
82
156
  ...props
83
157
  }));
84
- const Empty = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Autocomplete.Empty, {
158
+ const Empty = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxEmpty_ComboboxEmpty, {
85
159
  ref: ref,
86
160
  className: clsx(Autocomplete_module.empty, className),
87
161
  ...props
88
162
  }));
89
163
  function Trigger({ className, ...props }) {
90
- return /*#__PURE__*/ jsx(Autocomplete.Trigger, {
164
+ return /*#__PURE__*/ jsx(AutocompleteTrigger, {
91
165
  ...props,
92
166
  className: clsx(Autocomplete_module.trigger, className)
93
167
  });
94
168
  }
95
- const Autocomplete_Autocomplete = {
169
+ const Autocomplete = {
96
170
  InputGroup: InputGroup,
97
171
  Item: Item,
98
172
  Input: Input,
@@ -107,12 +181,12 @@ const Autocomplete_Autocomplete = {
107
181
  Group: Group,
108
182
  GroupLabel: GroupLabel,
109
183
  Row: Row,
110
- Collection: Autocomplete.Collection,
184
+ Collection: ComboboxCollection,
111
185
  Empty: Empty,
112
- Root: Autocomplete.Root,
186
+ Root: AutocompleteRoot,
113
187
  Trigger: Trigger,
114
- Value: Autocomplete.Value,
115
- Portal: Autocomplete.Portal,
116
- Separator: Autocomplete.Separator
188
+ Value: AutocompleteValue,
189
+ Portal: ComboboxPortal_ComboboxPortal,
190
+ Separator: Separator
117
191
  };
118
- export { Autocomplete_Autocomplete as Autocomplete };
192
+ export { Autocomplete };
@@ -1,22 +1,93 @@
1
- import { AvatarFallbackProps } from '@base-ui/react/avatar';
2
- import { AvatarImageProps } from '@base-ui/react/avatar';
3
- import { AvatarRootProps } from '@base-ui/react/avatar';
1
+ import { AvatarFallbackProps as AvatarFallbackProps_2 } from '@base-ui/react/avatar';
2
+ import { AvatarImageProps as AvatarImageProps_2 } from '@base-ui/react/avatar';
3
+ import { AvatarRootProps as AvatarRootProps_2 } from '@base-ui/react/avatar';
4
4
  import * as React_2 from 'react';
5
5
 
6
6
  export declare const Avatar: {
7
- Root: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<AvatarRootProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
7
+ Root: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<AvatarRootProps_2, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
8
8
  className?: string | undefined;
9
9
  } & {
10
10
  size?: string | number | undefined;
11
11
  } & React_2.RefAttributes<HTMLSpanElement>>;
12
- Image: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<AvatarImageProps, "ref"> & React_2.RefAttributes<HTMLImageElement>, "ref">, "className"> & {
12
+ Image: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<AvatarImageProps_2, "ref"> & React_2.RefAttributes<HTMLImageElement>, "ref">, "className"> & {
13
13
  className?: string | undefined;
14
14
  } & React_2.RefAttributes<HTMLImageElement>>;
15
- Fallback: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<AvatarFallbackProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
15
+ Fallback: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<AvatarFallbackProps_2, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
16
16
  className?: string | undefined;
17
17
  } & React_2.RefAttributes<HTMLSpanElement>>;
18
18
  };
19
19
 
20
+ /**
21
+ * Rendered when the image fails to load or when no image is provided.
22
+ * Renders a `<span>` element.
23
+ *
24
+ * Documentation: [Base UI Avatar](https://base-ui.com/react/components/avatar)
25
+ */
26
+ export declare const AvatarFallback: React_2.ForwardRefExoticComponent<Omit<AvatarFallbackProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
27
+
28
+ export declare namespace AvatarFallback {
29
+ export type State = AvatarFallbackState;
30
+ export type Props = AvatarFallbackProps;
31
+ }
32
+
33
+ export declare interface AvatarFallbackProps extends BaseUIComponentProps<'span', AvatarFallbackState> {
34
+ /**
35
+ * How long to wait before showing the fallback. Specified in milliseconds.
36
+ */
37
+ delay?: number | undefined;
38
+ }
39
+
40
+ export declare interface AvatarFallbackState extends AvatarRootState {}
41
+
42
+ /**
43
+ * The image to be displayed in the avatar.
44
+ * Renders an `<img>` element.
45
+ *
46
+ * Documentation: [Base UI Avatar](https://base-ui.com/react/components/avatar)
47
+ */
48
+ export declare const AvatarImage: React_2.ForwardRefExoticComponent<Omit<AvatarImageProps, "ref"> & React_2.RefAttributes<HTMLImageElement>>;
49
+
50
+ export declare namespace AvatarImage {
51
+ export type State = AvatarImageState;
52
+ export type Props = AvatarImageProps;
53
+ }
54
+
55
+ export declare interface AvatarImageProps extends BaseUIComponentProps<'img', AvatarImageState> {
56
+ /**
57
+ * Callback fired when the loading status changes.
58
+ */
59
+ onLoadingStatusChange?: ((status: ImageLoadingStatus_2) => void) | undefined;
60
+ }
61
+
62
+ export declare interface AvatarImageState extends AvatarRootState {
63
+ /**
64
+ * The transition status of the component.
65
+ */
66
+ transitionStatus: TransitionStatus;
67
+ }
68
+
69
+ /**
70
+ * Displays a user's profile picture, initials, or fallback icon.
71
+ * Renders a `<span>` element.
72
+ *
73
+ * Documentation: [Base UI Avatar](https://base-ui.com/react/components/avatar)
74
+ */
75
+ export declare const AvatarRoot: React_2.ForwardRefExoticComponent<Omit<AvatarRootProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
76
+
77
+ export declare namespace AvatarRoot {
78
+ export type State = AvatarRootState;
79
+ export type Props = AvatarRootProps;
80
+ }
81
+
82
+ export declare interface AvatarRootProps extends BaseUIComponentProps<'span', AvatarRootState> {}
83
+
84
+ export declare interface AvatarRootState {
85
+ /**
86
+ * The image loading status.
87
+ */
88
+ imageLoadingStatus: ImageLoadingStatus;
89
+ }
90
+
20
91
  export declare const AvatarSize: {
21
92
  readonly xxSmall: 16;
22
93
  readonly xSmall: 20;
@@ -26,7 +97,58 @@ export declare const AvatarSize: {
26
97
  readonly xLarge: 60;
27
98
  };
28
99
 
100
+ /**
101
+ * Props shared by all Base UI components.
102
+ * Contains `className` (string or callback taking the component's state as an argument) and `render` (function to customize rendering).
103
+ */
104
+ declare type BaseUIComponentProps<ElementType extends React_2.ElementType, State, RenderFunctionProps = HTMLProps> = Omit<WithBaseUIEvent<React_2.ComponentPropsWithRef<ElementType>>, 'className' | 'color' | 'defaultValue' | 'defaultChecked' | 'style'> & {
105
+ /**
106
+ * CSS class applied to the element, or a function that
107
+ * returns a class based on the component's state.
108
+ */
109
+ className?: string | ((state: State) => string | undefined) | undefined;
110
+ /**
111
+ * Allows you to replace the component's HTML element
112
+ * with a different tag, or compose it with another component.
113
+ *
114
+ * Accepts a `ReactElement` or a function that returns the element to render.
115
+ */
116
+ render?: React_2.ReactElement | ComponentRenderFn<RenderFunctionProps, State> | undefined;
117
+ /**
118
+ * Style applied to the element, or a function that
119
+ * returns a style object based on the component's state.
120
+ */
121
+ style?: React_2.CSSProperties | ((state: State) => React_2.CSSProperties | undefined) | undefined;
122
+ };
123
+
124
+ declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E & {
125
+ preventBaseUIHandler: () => void;
126
+ readonly baseUIHandlerPrevented?: boolean | undefined;
127
+ };
128
+
129
+ /**
130
+ * Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element.
131
+ *
132
+ * @template Props Props to be spread on the rendered element.
133
+ * @template State Component's internal state.
134
+ */
135
+ declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
136
+
137
+ declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
138
+ ref?: React_2.Ref<T> | undefined;
139
+ };
140
+
141
+ export declare type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
142
+
143
+ declare type ImageLoadingStatus_2 = 'idle' | 'loading' | 'loaded' | 'error';
144
+
145
+ declare type TransitionStatus = 'starting' | 'ending' | 'idle' | undefined;
146
+
147
+ /**
148
+ * Adds a `preventBaseUIHandler` method to all event handlers.
149
+ */
150
+ declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K]> };
29
151
 
30
- export * from "@base-ui/react/avatar";
152
+ declare type WithPreventBaseUIHandler<T> = T extends ((event: infer E) => any) ? E extends React_2.SyntheticEvent<Element, Event> ? (event: BaseUIEvent<E>) => ReturnType<T> : T : T extends undefined ? undefined : T;
31
153
 
32
154
  export { }
@@ -1,13 +1,156 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Avatar } from "@base-ui/react/avatar";
3
2
  import clsx from "clsx";
3
+ import { NOOP, useRenderElement, esm_formatErrorMessage } from "../8272.js";
4
+ import { useIsoLayoutEffect } from "../6499.js";
5
+ import { transitionStatusMapping, useOpenChangeComplete, useTransitionStatus } from "../880.js";
6
+ import { useStableCallback } from "../7541.js";
7
+ import { useTimeout } from "../42.js";
4
8
  import * as __rspack_external_react from "react";
9
+ const AvatarRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
10
+ if ("production" !== process.env.NODE_ENV) AvatarRootContext.displayName = "AvatarRootContext";
11
+ function useAvatarRootContext() {
12
+ const context = __rspack_external_react.useContext(AvatarRootContext);
13
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: AvatarRootContext is missing. Avatar parts must be placed within <Avatar.Root>.' : esm_formatErrorMessage(13));
14
+ return context;
15
+ }
16
+ const avatarStateAttributesMapping = {
17
+ imageLoadingStatus: ()=>null
18
+ };
19
+ const AvatarRoot_AvatarRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
20
+ const { className, render, style, ...elementProps } = componentProps;
21
+ const [imageLoadingStatus, setImageLoadingStatus] = __rspack_external_react.useState('idle');
22
+ const state = {
23
+ imageLoadingStatus
24
+ };
25
+ const contextValue = __rspack_external_react.useMemo(()=>({
26
+ imageLoadingStatus,
27
+ setImageLoadingStatus
28
+ }), [
29
+ imageLoadingStatus,
30
+ setImageLoadingStatus
31
+ ]);
32
+ const element = useRenderElement('span', componentProps, {
33
+ state,
34
+ ref: forwardedRef,
35
+ props: elementProps,
36
+ stateAttributesMapping: avatarStateAttributesMapping
37
+ });
38
+ return /*#__PURE__*/ jsx(AvatarRootContext.Provider, {
39
+ value: contextValue,
40
+ children: element
41
+ });
42
+ });
43
+ if ("production" !== process.env.NODE_ENV) AvatarRoot_AvatarRoot.displayName = "AvatarRoot";
44
+ function useImageLoadingStatus(src, { referrerPolicy, crossOrigin }) {
45
+ const [loadingStatus, setLoadingStatus] = __rspack_external_react.useState('idle');
46
+ useIsoLayoutEffect(()=>{
47
+ if (!src) {
48
+ setLoadingStatus('error');
49
+ return NOOP;
50
+ }
51
+ let isMounted = true;
52
+ const image = new window.Image();
53
+ const updateStatus = (status)=>()=>{
54
+ if (!isMounted) return;
55
+ setLoadingStatus(status);
56
+ };
57
+ setLoadingStatus('loading');
58
+ image.onload = updateStatus('loaded');
59
+ image.onerror = updateStatus('error');
60
+ if (referrerPolicy) image.referrerPolicy = referrerPolicy;
61
+ image.crossOrigin = crossOrigin ?? null;
62
+ image.src = src;
63
+ if (image.complete) setLoadingStatus(image.naturalWidth > 0 ? 'loaded' : 'error');
64
+ return ()=>{
65
+ isMounted = false;
66
+ };
67
+ }, [
68
+ src,
69
+ crossOrigin,
70
+ referrerPolicy
71
+ ]);
72
+ return loadingStatus;
73
+ }
74
+ const stateAttributesMapping = {
75
+ ...avatarStateAttributesMapping,
76
+ ...transitionStatusMapping
77
+ };
78
+ const AvatarImage_AvatarImage = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
79
+ const { className, render, onLoadingStatusChange: onLoadingStatusChangeProp, referrerPolicy, crossOrigin, style, ...elementProps } = componentProps;
80
+ const context = useAvatarRootContext();
81
+ const imageLoadingStatus = useImageLoadingStatus(componentProps.src, {
82
+ referrerPolicy,
83
+ crossOrigin
84
+ });
85
+ const isVisible = 'loaded' === imageLoadingStatus;
86
+ const { mounted, transitionStatus, setMounted } = useTransitionStatus(isVisible);
87
+ const imageRef = __rspack_external_react.useRef(null);
88
+ const handleLoadingStatusChange = useStableCallback((status)=>{
89
+ onLoadingStatusChangeProp?.(status);
90
+ context.setImageLoadingStatus(status);
91
+ });
92
+ useIsoLayoutEffect(()=>{
93
+ if ('idle' !== imageLoadingStatus) handleLoadingStatusChange(imageLoadingStatus);
94
+ }, [
95
+ imageLoadingStatus,
96
+ handleLoadingStatusChange
97
+ ]);
98
+ useOpenChangeComplete({
99
+ open: isVisible,
100
+ ref: imageRef,
101
+ onComplete () {
102
+ if (!isVisible) setMounted(false);
103
+ }
104
+ });
105
+ const state = {
106
+ imageLoadingStatus,
107
+ transitionStatus
108
+ };
109
+ const element = useRenderElement('img', componentProps, {
110
+ state,
111
+ ref: [
112
+ forwardedRef,
113
+ imageRef
114
+ ],
115
+ props: elementProps,
116
+ stateAttributesMapping: stateAttributesMapping,
117
+ enabled: mounted
118
+ });
119
+ if (!mounted) return null;
120
+ return element;
121
+ });
122
+ if ("production" !== process.env.NODE_ENV) AvatarImage_AvatarImage.displayName = "AvatarImage";
123
+ const AvatarFallback_AvatarFallback = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
124
+ const { className, render, delay, style, ...elementProps } = componentProps;
125
+ const { imageLoadingStatus } = useAvatarRootContext();
126
+ const [delayPassed, setDelayPassed] = __rspack_external_react.useState(void 0 === delay);
127
+ const timeout = useTimeout();
128
+ __rspack_external_react.useEffect(()=>{
129
+ if (void 0 !== delay) timeout.start(delay, ()=>setDelayPassed(true));
130
+ return timeout.clear;
131
+ }, [
132
+ timeout,
133
+ delay
134
+ ]);
135
+ const state = {
136
+ imageLoadingStatus
137
+ };
138
+ const element = useRenderElement('span', componentProps, {
139
+ state,
140
+ ref: forwardedRef,
141
+ props: elementProps,
142
+ stateAttributesMapping: avatarStateAttributesMapping,
143
+ enabled: 'loaded' !== imageLoadingStatus && delayPassed
144
+ });
145
+ return element;
146
+ });
147
+ if ("production" !== process.env.NODE_ENV) AvatarFallback_AvatarFallback.displayName = "AvatarFallback";
5
148
  const Avatar_module = {
6
149
  root: "root-uFk_6F",
7
150
  image: "image-i3BrFP",
8
151
  fallback: "fallback-r0pagw"
9
152
  };
10
- const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, size, style, ...props }, ref)=>/*#__PURE__*/ jsx(Avatar.Root, {
153
+ const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, size, style, ...props }, ref)=>/*#__PURE__*/ jsx(AvatarRoot_AvatarRoot, {
11
154
  ref: ref,
12
155
  className: clsx(Avatar_module.root, className),
13
156
  style: {
@@ -16,12 +159,12 @@ const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, size
16
159
  },
17
160
  ...props
18
161
  }));
19
- const Image = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Avatar.Image, {
162
+ const Image = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AvatarImage_AvatarImage, {
20
163
  ref: ref,
21
164
  className: clsx(Avatar_module.image, className),
22
165
  ...props
23
166
  }));
24
- const Fallback = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Avatar.Fallback, {
167
+ const Fallback = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AvatarFallback_AvatarFallback, {
25
168
  ref: ref,
26
169
  className: clsx(Avatar_module.fallback, className),
27
170
  ...props
@@ -34,9 +177,9 @@ const AvatarSize = {
34
177
  large: 52,
35
178
  xLarge: 60
36
179
  };
37
- const Avatar_Avatar = {
180
+ const Avatar = {
38
181
  Root: Root,
39
182
  Image: Image,
40
183
  Fallback: Fallback
41
184
  };
42
- export { AvatarSize, Avatar_Avatar as Avatar };
185
+ export { Avatar, AvatarSize };