@arc-ui/components 11.8.0 → 11.9.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 (42) hide show
  1. package/dist/Badge/Badge.cjs.d.ts +4 -0
  2. package/dist/Badge/Badge.cjs.js +3 -3
  3. package/dist/Badge/Badge.esm.d.ts +4 -0
  4. package/dist/Badge/Badge.esm.js +3 -3
  5. package/dist/ProgressStepper/ProgressStepper.cjs.d.ts +1 -89
  6. package/dist/ProgressStepper/ProgressStepper.cjs.js +10 -144
  7. package/dist/ProgressStepper/ProgressStepper.esm.d.ts +1 -89
  8. package/dist/ProgressStepper/ProgressStepper.esm.js +9 -143
  9. package/dist/Tabs/Tabs.cjs.d.ts +1 -75
  10. package/dist/Tabs/Tabs.cjs.js +11 -505
  11. package/dist/Tabs/Tabs.esm.d.ts +1 -75
  12. package/dist/Tabs/Tabs.esm.js +10 -504
  13. package/dist/TextArea/TextArea.cjs.js +20 -8
  14. package/dist/TextArea/TextArea.esm.js +20 -8
  15. package/dist/Toast/Toast.cjs.d.ts +1 -52
  16. package/dist/Toast/Toast.cjs.js +14 -734
  17. package/dist/Toast/Toast.esm.d.ts +1 -52
  18. package/dist/Toast/Toast.esm.js +13 -733
  19. package/dist/_shared/cjs/MediaCard-9483ad5f.d.ts +60 -0
  20. package/dist/_shared/cjs/ProgressStepper-f740d7bb.d.ts +89 -0
  21. package/dist/_shared/cjs/ProgressStepper-f740d7bb.js +149 -0
  22. package/dist/_shared/cjs/Tabs-fda49692.d.ts +75 -0
  23. package/dist/_shared/cjs/Tabs-fda49692.js +510 -0
  24. package/dist/_shared/cjs/Toast-0cb23cae.d.ts +52 -0
  25. package/dist/_shared/cjs/Toast-0cb23cae.js +739 -0
  26. package/dist/_shared/esm/MediaCard-9483ad5f.d.ts +60 -0
  27. package/dist/_shared/esm/ProgressStepper-7ab88f4c.d.ts +89 -0
  28. package/dist/_shared/esm/ProgressStepper-7ab88f4c.js +143 -0
  29. package/dist/_shared/esm/Tabs-5af0b940.d.ts +75 -0
  30. package/dist/_shared/esm/Tabs-5af0b940.js +504 -0
  31. package/dist/_shared/esm/Toast-43795e91.d.ts +52 -0
  32. package/dist/_shared/esm/Toast-43795e91.js +733 -0
  33. package/dist/index.es.js +2312 -407
  34. package/dist/index.es.js.map +1 -1
  35. package/dist/index.js +2667 -751
  36. package/dist/index.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/dist/types/components/Badge/Badge.d.ts +4 -0
  39. package/dist/types/components/Toast/Toast.d.ts +2 -2
  40. package/dist/types/components/Toast/ToastNotification.d.ts +1 -1
  41. package/dist/types/components/index.d.ts +17 -6
  42. package/package.json +4 -4
@@ -0,0 +1,510 @@
1
+ 'use strict';
2
+
3
+ var filterDataAttrs = require('./filter-data-attrs-a30dcf5f.js');
4
+ var React$2 = require('react');
5
+ var _extends = require('./extends-bb8ffacd.js');
6
+ var index$1 = require('./index-952918c9.js');
7
+ var index = require('./index-27b53d49.js');
8
+ var index$2 = require('./index-fb4b8fda.js');
9
+ var Icon = require('./Icon-e1dd45eb.js');
10
+ var Surface = require('./Surface-b7c51b2b.js');
11
+ var index$3 = require('./index-45bfb67b.js');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React$2);
16
+
17
+ const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ React$2.createContext(undefined);
18
+ /* -----------------------------------------------------------------------------------------------*/ function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
19
+ const globalDir = React$2.useContext($f631663db3294ace$var$DirectionContext);
20
+ return localDir || globalDir || 'ltr';
21
+ }
22
+
23
+ const $d7bdfb9eb0fdf311$var$ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';
24
+ const $d7bdfb9eb0fdf311$var$EVENT_OPTIONS = {
25
+ bubbles: false,
26
+ cancelable: true
27
+ };
28
+ /* -------------------------------------------------------------------------------------------------
29
+ * RovingFocusGroup
30
+ * -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$GROUP_NAME = 'RovingFocusGroup';
31
+ const [$d7bdfb9eb0fdf311$var$Collection, $d7bdfb9eb0fdf311$var$useCollection, $d7bdfb9eb0fdf311$var$createCollectionScope] = index.$e02a7d9cb1dc128c$export$c74125a8e3af6bb2($d7bdfb9eb0fdf311$var$GROUP_NAME);
32
+ const [$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext, $d7bdfb9eb0fdf311$export$c7109489551a4f4] = index$1.$c512c27ab02ef895$export$50c7b4e9d9f19c1($d7bdfb9eb0fdf311$var$GROUP_NAME, [
33
+ $d7bdfb9eb0fdf311$var$createCollectionScope
34
+ ]);
35
+ const [$d7bdfb9eb0fdf311$var$RovingFocusProvider, $d7bdfb9eb0fdf311$var$useRovingFocusContext] = $d7bdfb9eb0fdf311$var$createRovingFocusGroupContext($d7bdfb9eb0fdf311$var$GROUP_NAME);
36
+ const $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
37
+ return /*#__PURE__*/ React$2.createElement($d7bdfb9eb0fdf311$var$Collection.Provider, {
38
+ scope: props.__scopeRovingFocusGroup
39
+ }, /*#__PURE__*/ React$2.createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {
40
+ scope: props.__scopeRovingFocusGroup
41
+ }, /*#__PURE__*/ React$2.createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends._extends({}, props, {
42
+ ref: forwardedRef
43
+ }))));
44
+ });
45
+ /* -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
46
+ const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , orientation: orientation , loop: loop = false , dir: dir , currentTabStopId: currentTabStopIdProp , defaultCurrentTabStopId: defaultCurrentTabStopId , onCurrentTabStopIdChange: onCurrentTabStopIdChange , onEntryFocus: onEntryFocus , ...groupProps } = props;
47
+ const ref = React$2.useRef(null);
48
+ const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
49
+ const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
50
+ const [currentTabStopId = null, setCurrentTabStopId] = index$1.$71cd76cc60e0454e$export$6f32135080cb4c3({
51
+ prop: currentTabStopIdProp,
52
+ defaultProp: defaultCurrentTabStopId,
53
+ onChange: onCurrentTabStopIdChange
54
+ });
55
+ const [isTabbingBackOut, setIsTabbingBackOut] = React$2.useState(false);
56
+ const handleEntryFocus = index$1.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEntryFocus);
57
+ const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);
58
+ const isClickFocusRef = React$2.useRef(false);
59
+ const [focusableItemsCount, setFocusableItemsCount] = React$2.useState(0);
60
+ React$2.useEffect(()=>{
61
+ const node = ref.current;
62
+ if (node) {
63
+ node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);
64
+ return ()=>node.removeEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus)
65
+ ;
66
+ }
67
+ }, [
68
+ handleEntryFocus
69
+ ]);
70
+ return /*#__PURE__*/ React$2.createElement($d7bdfb9eb0fdf311$var$RovingFocusProvider, {
71
+ scope: __scopeRovingFocusGroup,
72
+ orientation: orientation,
73
+ dir: direction,
74
+ loop: loop,
75
+ currentTabStopId: currentTabStopId,
76
+ onItemFocus: React$2.useCallback((tabStopId)=>setCurrentTabStopId(tabStopId)
77
+ , [
78
+ setCurrentTabStopId
79
+ ]),
80
+ onItemShiftTab: React$2.useCallback(()=>setIsTabbingBackOut(true)
81
+ , []),
82
+ onFocusableItemAdd: React$2.useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount + 1
83
+ )
84
+ , []),
85
+ onFocusableItemRemove: React$2.useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount - 1
86
+ )
87
+ , [])
88
+ }, /*#__PURE__*/ React$2.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
89
+ tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
90
+ "data-orientation": orientation
91
+ }, groupProps, {
92
+ ref: composedRefs,
93
+ style: {
94
+ outline: 'none',
95
+ ...props.style
96
+ },
97
+ onMouseDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, ()=>{
98
+ isClickFocusRef.current = true;
99
+ }),
100
+ onFocus: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, (event)=>{
101
+ // We normally wouldn't need this check, because we already check
102
+ // that the focus is on the current target and not bubbling to it.
103
+ // We do this because Safari doesn't focus buttons when clicked, and
104
+ // instead, the wrapper will get focused and not through a bubbling event.
105
+ const isKeyboardFocus = !isClickFocusRef.current;
106
+ if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
107
+ const entryFocusEvent = new CustomEvent($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, $d7bdfb9eb0fdf311$var$EVENT_OPTIONS);
108
+ event.currentTarget.dispatchEvent(entryFocusEvent);
109
+ if (!entryFocusEvent.defaultPrevented) {
110
+ const items = getItems().filter((item)=>item.focusable
111
+ );
112
+ const activeItem = items.find((item)=>item.active
113
+ );
114
+ const currentItem = items.find((item)=>item.id === currentTabStopId
115
+ );
116
+ const candidateItems = [
117
+ activeItem,
118
+ currentItem,
119
+ ...items
120
+ ].filter(Boolean);
121
+ const candidateNodes = candidateItems.map((item)=>item.ref.current
122
+ );
123
+ $d7bdfb9eb0fdf311$var$focusFirst(candidateNodes);
124
+ }
125
+ }
126
+ isClickFocusRef.current = false;
127
+ }),
128
+ onBlur: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, ()=>setIsTabbingBackOut(false)
129
+ )
130
+ })));
131
+ });
132
+ /* -------------------------------------------------------------------------------------------------
133
+ * RovingFocusGroupItem
134
+ * -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$ITEM_NAME = 'RovingFocusGroupItem';
135
+ const $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
136
+ const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , focusable: focusable = true , active: active = false , tabStopId: tabStopId , ...itemProps } = props;
137
+ const autoId = index$2.$1746a345f3d73bb7$export$f680877a34711e37();
138
+ const id = tabStopId || autoId;
139
+ const context = $d7bdfb9eb0fdf311$var$useRovingFocusContext($d7bdfb9eb0fdf311$var$ITEM_NAME, __scopeRovingFocusGroup);
140
+ const isCurrentTabStop = context.currentTabStopId === id;
141
+ const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);
142
+ const { onFocusableItemAdd: onFocusableItemAdd , onFocusableItemRemove: onFocusableItemRemove } = context;
143
+ React$2.useEffect(()=>{
144
+ if (focusable) {
145
+ onFocusableItemAdd();
146
+ return ()=>onFocusableItemRemove()
147
+ ;
148
+ }
149
+ }, [
150
+ focusable,
151
+ onFocusableItemAdd,
152
+ onFocusableItemRemove
153
+ ]);
154
+ return /*#__PURE__*/ React$2.createElement($d7bdfb9eb0fdf311$var$Collection.ItemSlot, {
155
+ scope: __scopeRovingFocusGroup,
156
+ id: id,
157
+ focusable: focusable,
158
+ active: active
159
+ }, /*#__PURE__*/ React$2.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({
160
+ tabIndex: isCurrentTabStop ? 0 : -1,
161
+ "data-orientation": context.orientation
162
+ }, itemProps, {
163
+ ref: forwardedRef,
164
+ onMouseDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, (event)=>{
165
+ // We prevent focusing non-focusable items on `mousedown`.
166
+ // Even though the item has tabIndex={-1}, that only means take it out of the tab order.
167
+ if (!focusable) event.preventDefault(); // Safari doesn't focus a button when clicked so we run our logic on mousedown also
168
+ else context.onItemFocus(id);
169
+ }),
170
+ onFocus: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, ()=>context.onItemFocus(id)
171
+ ),
172
+ onKeyDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
173
+ if (event.key === 'Tab' && event.shiftKey) {
174
+ context.onItemShiftTab();
175
+ return;
176
+ }
177
+ if (event.target !== event.currentTarget) return;
178
+ const focusIntent = $d7bdfb9eb0fdf311$var$getFocusIntent(event, context.orientation, context.dir);
179
+ if (focusIntent !== undefined) {
180
+ event.preventDefault();
181
+ const items = getItems().filter((item)=>item.focusable
182
+ );
183
+ let candidateNodes = items.map((item)=>item.ref.current
184
+ );
185
+ if (focusIntent === 'last') candidateNodes.reverse();
186
+ else if (focusIntent === 'prev' || focusIntent === 'next') {
187
+ if (focusIntent === 'prev') candidateNodes.reverse();
188
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
189
+ candidateNodes = context.loop ? $d7bdfb9eb0fdf311$var$wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
190
+ }
191
+ /**
192
+ * Imperative focus during keydown is risky so we prevent React's batching updates
193
+ * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
194
+ */ setTimeout(()=>$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes)
195
+ );
196
+ }
197
+ })
198
+ })));
199
+ });
200
+ /* -----------------------------------------------------------------------------------------------*/ // prettier-ignore
201
+ const $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT = {
202
+ ArrowLeft: 'prev',
203
+ ArrowUp: 'prev',
204
+ ArrowRight: 'next',
205
+ ArrowDown: 'next',
206
+ PageUp: 'first',
207
+ Home: 'first',
208
+ PageDown: 'last',
209
+ End: 'last'
210
+ };
211
+ function $d7bdfb9eb0fdf311$var$getDirectionAwareKey(key, dir) {
212
+ if (dir !== 'rtl') return key;
213
+ return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;
214
+ }
215
+ function $d7bdfb9eb0fdf311$var$getFocusIntent(event, orientation, dir) {
216
+ const key = $d7bdfb9eb0fdf311$var$getDirectionAwareKey(event.key, dir);
217
+ if (orientation === 'vertical' && [
218
+ 'ArrowLeft',
219
+ 'ArrowRight'
220
+ ].includes(key)) return undefined;
221
+ if (orientation === 'horizontal' && [
222
+ 'ArrowUp',
223
+ 'ArrowDown'
224
+ ].includes(key)) return undefined;
225
+ return $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT[key];
226
+ }
227
+ function $d7bdfb9eb0fdf311$var$focusFirst(candidates) {
228
+ const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
229
+ for (const candidate of candidates){
230
+ // if focus is already where we want to go, we don't want to keep going through the candidates
231
+ if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
232
+ candidate.focus();
233
+ if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
234
+ }
235
+ }
236
+ /**
237
+ * Wraps an array around itself at a given start index
238
+ * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
239
+ */ function $d7bdfb9eb0fdf311$var$wrapArray(array, startIndex) {
240
+ return array.map((_, index)=>array[(startIndex + index) % array.length]
241
+ );
242
+ }
243
+ const $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 = $d7bdfb9eb0fdf311$export$8699f7c8af148338;
244
+ const $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 = $d7bdfb9eb0fdf311$export$ab9df7c53fe8454;
245
+
246
+ /* -------------------------------------------------------------------------------------------------
247
+ * Tabs
248
+ * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TABS_NAME = 'Tabs';
249
+ const [$69cb30bb0017df05$var$createTabsContext, $69cb30bb0017df05$export$355f5bd209d7b13a] = index$1.$c512c27ab02ef895$export$50c7b4e9d9f19c1($69cb30bb0017df05$var$TABS_NAME, [
250
+ $d7bdfb9eb0fdf311$export$c7109489551a4f4
251
+ ]);
252
+ const $69cb30bb0017df05$var$useRovingFocusGroupScope = $d7bdfb9eb0fdf311$export$c7109489551a4f4();
253
+ const [$69cb30bb0017df05$var$TabsProvider, $69cb30bb0017df05$var$useTabsContext] = $69cb30bb0017df05$var$createTabsContext($69cb30bb0017df05$var$TABS_NAME);
254
+ const $69cb30bb0017df05$export$b2539bed5023c21c = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
255
+ const { __scopeTabs: __scopeTabs , value: valueProp , onValueChange: onValueChange , defaultValue: defaultValue , orientation: orientation = 'horizontal' , dir: dir , activationMode: activationMode = 'automatic' , ...tabsProps } = props;
256
+ const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
257
+ const [value, setValue] = index$1.$71cd76cc60e0454e$export$6f32135080cb4c3({
258
+ prop: valueProp,
259
+ onChange: onValueChange,
260
+ defaultProp: defaultValue
261
+ });
262
+ return /*#__PURE__*/ React$2.createElement($69cb30bb0017df05$var$TabsProvider, {
263
+ scope: __scopeTabs,
264
+ baseId: index$2.$1746a345f3d73bb7$export$f680877a34711e37(),
265
+ value: value,
266
+ onValueChange: setValue,
267
+ orientation: orientation,
268
+ dir: direction,
269
+ activationMode: activationMode
270
+ }, /*#__PURE__*/ React$2.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
271
+ dir: direction,
272
+ "data-orientation": orientation
273
+ }, tabsProps, {
274
+ ref: forwardedRef
275
+ })));
276
+ });
277
+ /* -------------------------------------------------------------------------------------------------
278
+ * TabsList
279
+ * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TAB_LIST_NAME = 'TabsList';
280
+ const $69cb30bb0017df05$export$9712d22edc0d78c1 = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
281
+ const { __scopeTabs: __scopeTabs , loop: loop = true , ...listProps } = props;
282
+ const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
283
+ const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
284
+ return /*#__PURE__*/ React$2.createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends._extends({
285
+ asChild: true
286
+ }, rovingFocusGroupScope, {
287
+ orientation: context.orientation,
288
+ dir: context.dir,
289
+ loop: loop
290
+ }), /*#__PURE__*/ React$2.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
291
+ role: "tablist",
292
+ "aria-orientation": context.orientation
293
+ }, listProps, {
294
+ ref: forwardedRef
295
+ })));
296
+ });
297
+ /* -------------------------------------------------------------------------------------------------
298
+ * TabsTrigger
299
+ * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TRIGGER_NAME = 'TabsTrigger';
300
+ const $69cb30bb0017df05$export$8114b9fdfdf9f3ba = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
301
+ const { __scopeTabs: __scopeTabs , value: value , disabled: disabled = false , ...triggerProps } = props;
302
+ const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TRIGGER_NAME, __scopeTabs);
303
+ const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
304
+ const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
305
+ const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
306
+ const isSelected = value === context.value;
307
+ return /*#__PURE__*/ React$2.createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends._extends({
308
+ asChild: true
309
+ }, rovingFocusGroupScope, {
310
+ focusable: !disabled,
311
+ active: isSelected
312
+ }), /*#__PURE__*/ React$2.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends._extends({
313
+ type: "button",
314
+ role: "tab",
315
+ "aria-selected": isSelected,
316
+ "aria-controls": contentId,
317
+ "data-state": isSelected ? 'active' : 'inactive',
318
+ "data-disabled": disabled ? '' : undefined,
319
+ disabled: disabled,
320
+ id: triggerId
321
+ }, triggerProps, {
322
+ ref: forwardedRef,
323
+ onMouseDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, (event)=>{
324
+ // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
325
+ // but not when the control key is pressed (avoiding MacOS right click)
326
+ if (!disabled && event.button === 0 && event.ctrlKey === false) context.onValueChange(value);
327
+ else // prevent focus to avoid accidental activation
328
+ event.preventDefault();
329
+ }),
330
+ onKeyDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
331
+ if ([
332
+ ' ',
333
+ 'Enter'
334
+ ].includes(event.key)) context.onValueChange(value);
335
+ }),
336
+ onFocus: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, ()=>{
337
+ // handle "automatic" activation if necessary
338
+ // ie. activate tab following focus
339
+ const isAutomaticActivation = context.activationMode !== 'manual';
340
+ if (!isSelected && !disabled && isAutomaticActivation) context.onValueChange(value);
341
+ })
342
+ })));
343
+ });
344
+ /* -------------------------------------------------------------------------------------------------
345
+ * TabsContent
346
+ * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$CONTENT_NAME = 'TabsContent';
347
+ const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
348
+ const { __scopeTabs: __scopeTabs , value: value , forceMount: forceMount , children: children , ...contentProps } = props;
349
+ const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$CONTENT_NAME, __scopeTabs);
350
+ const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
351
+ const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
352
+ const isSelected = value === context.value;
353
+ const isMountAnimationPreventedRef = React$2.useRef(isSelected);
354
+ React$2.useEffect(()=>{
355
+ const rAF = requestAnimationFrame(()=>isMountAnimationPreventedRef.current = false
356
+ );
357
+ return ()=>cancelAnimationFrame(rAF)
358
+ ;
359
+ }, []);
360
+ return /*#__PURE__*/ React$2.createElement(index$1.$921a889cee6df7e8$export$99c2b779aa4e8b8b, {
361
+ present: forceMount || isSelected
362
+ }, ({ present: present })=>/*#__PURE__*/ React$2.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
363
+ "data-state": isSelected ? 'active' : 'inactive',
364
+ "data-orientation": context.orientation,
365
+ role: "tabpanel",
366
+ "aria-labelledby": triggerId,
367
+ hidden: !present,
368
+ id: contentId,
369
+ tabIndex: 0
370
+ }, contentProps, {
371
+ ref: forwardedRef,
372
+ style: {
373
+ ...props.style,
374
+ animationDuration: isMountAnimationPreventedRef.current ? '0s' : undefined
375
+ }
376
+ }), present && children)
377
+ );
378
+ });
379
+ /* ---------------------------------------------------------------------------------------------- */ function $69cb30bb0017df05$var$makeTriggerId(baseId, value) {
380
+ return `${baseId}-trigger-${value}`;
381
+ }
382
+ function $69cb30bb0017df05$var$makeContentId(baseId, value) {
383
+ return `${baseId}-content-${value}`;
384
+ }
385
+ const $69cb30bb0017df05$export$be92b6f5f03c0fe9 = $69cb30bb0017df05$export$b2539bed5023c21c;
386
+ const $69cb30bb0017df05$export$54c2e3dc7acea9f5 = $69cb30bb0017df05$export$9712d22edc0d78c1;
387
+ const $69cb30bb0017df05$export$41fb9f06171c75f4 = $69cb30bb0017df05$export$8114b9fdfdf9f3ba;
388
+ const $69cb30bb0017df05$export$7c6e2c02157bb7d2 = $69cb30bb0017df05$export$bd905d70e8fd2ebb;
389
+
390
+ var Tab = function (_a) {
391
+ var label = _a.label, value = _a.value, icon = _a.icon, iconActive = _a.iconActive, props = filterDataAttrs.__rest(_a, ["label", "value", "icon", "iconActive"]);
392
+ var surface = React$2.useContext(Surface.Context).surface;
393
+ return (React__default["default"].createElement($69cb30bb0017df05$export$41fb9f06171c75f4, filterDataAttrs.__assign({ className: index$3.classNames("arc-Tab-trigger", {
394
+ "arc-Tab-trigger--onDarkSurface": surface === "dark",
395
+ "arc-Tab-trigger--hasIcon": icon || iconActive
396
+ }), value: value }, filterDataAttrs.filterDataAttrs(props)),
397
+ icon && (React__default["default"].createElement("div", { className: "arc-Tab-triggerIcon", "data-testid": "arc-Tab-TriggerIcon" },
398
+ React__default["default"].createElement(Icon.Icon, { icon: icon }))),
399
+ iconActive && (React__default["default"].createElement("div", { className: "arc-Tab-triggerIcon arc-Tab-triggerIcon--active", "data-testid": "arc-Tab-TriggerIconActive" },
400
+ React__default["default"].createElement(Icon.Icon, { icon: iconActive }))),
401
+ label));
402
+ };
403
+
404
+ var TabContent = function (_a) {
405
+ var children = _a.children, value = _a.value;
406
+ return (React__default["default"].createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2, { className: "arc-Tab-content", value: value }, children));
407
+ };
408
+
409
+ const React$1 = React__default["default"];
410
+ const BtIconArrowRightFill = props =>
411
+ /*#__PURE__*/ React$1.createElement(
412
+ "svg",
413
+ Object.assign(
414
+ {
415
+ xmlns: "http://www.w3.org/2000/svg",
416
+ viewBox: "0 0 32 32"
417
+ },
418
+ props
419
+ ),
420
+ /*#__PURE__*/ React$1.createElement("defs", null),
421
+ /*#__PURE__*/ React$1.createElement("path", {
422
+ d:
423
+ "M2,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm16.85352-4.35352L23.207,16l-4.35351,4.35352a.5.5,0,0,1-.707-.707L21.293,16.5H9.5a.5.5,0,0,1,0-1H21.293l-3.14649-3.14648a.5.5,0,0,1,.707-.707Z",
424
+ fill: "currentColor"
425
+ })
426
+ );
427
+ var BtIconArrowRightFill_2 = BtIconArrowRightFill;
428
+
429
+ const React = React__default["default"];
430
+ const BtIconArrowLeftFill = props =>
431
+ /*#__PURE__*/ React.createElement(
432
+ "svg",
433
+ Object.assign(
434
+ {
435
+ xmlns: "http://www.w3.org/2000/svg",
436
+ viewBox: "0 0 32 32"
437
+ },
438
+ props
439
+ ),
440
+ /*#__PURE__*/ React.createElement("defs", null),
441
+ /*#__PURE__*/ React.createElement("path", {
442
+ d:
443
+ "M30,16A14,14,0,1,0,16,30,14,14,0,0,0,30,16ZM13.14648,20.35352,8.793,16l4.35351-4.35352a.5.5,0,0,1,.707.707L10.707,15.5H22.5a.5.5,0,0,1,0,1H10.707l3.14649,3.14648a.5.5,0,0,1-.707.707Z",
444
+ fill: "currentColor"
445
+ })
446
+ );
447
+ var BtIconArrowLeftFill_2 = BtIconArrowLeftFill;
448
+
449
+ var TabsList = function (_a) {
450
+ var children = _a.children, type = _a.type, isJustified = _a.isJustified, ariaLabel = _a.ariaLabel, props = filterDataAttrs.__rest(_a, ["children", "type", "isJustified", "ariaLabel"]);
451
+ var surface = React$2.useContext(Surface.Context).surface;
452
+ var tabsRef = React$2.useRef(null);
453
+ var _b = React$2.useState(false), rightOverflow = _b[0], setRightOverflow = _b[1];
454
+ var _c = React$2.useState(false), leftOverflow = _c[0], setLeftOverflow = _c[1];
455
+ var checkOverflow = function (element) {
456
+ if (element) {
457
+ if (element.scrollWidth > element.clientWidth) {
458
+ setRightOverflow(true);
459
+ }
460
+ if (element.scrollLeft + 10 >=
461
+ element.scrollWidth - element.clientWidth) {
462
+ setRightOverflow(false);
463
+ }
464
+ if (element.scrollLeft >= 1) {
465
+ setLeftOverflow(true);
466
+ }
467
+ else {
468
+ setLeftOverflow(false);
469
+ }
470
+ }
471
+ };
472
+ React$2.useEffect(function () {
473
+ checkOverflow(tabsRef.current);
474
+ }, []);
475
+ var scrollTabs = function (scrollAmount) {
476
+ if (tabsRef.current) {
477
+ tabsRef.current.scrollLeft += scrollAmount;
478
+ }
479
+ };
480
+ var onScroll = function (event) {
481
+ checkOverflow(event.currentTarget);
482
+ };
483
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
484
+ React__default["default"].createElement($69cb30bb0017df05$export$54c2e3dc7acea9f5, filterDataAttrs.__assign({ onScroll: onScroll, className: index$3.classNames("arc-Tabs", {
485
+ "arc-Tabs--contained": type === "contained",
486
+ "arc-Tabs--isJustified": isJustified,
487
+ "arc-Tabs--onDarkSurface": surface === "dark"
488
+ }), ref: tabsRef, "aria-label": ariaLabel }, filterDataAttrs.filterDataAttrs(props)), children),
489
+ leftOverflow && (React__default["default"].createElement("button", { className: index$3.classNames("arc-Tabs-overflowIcon arc-Tabs-overflowIcon--left", {
490
+ "arc-Tabs-overflowIcon--onDarkSurface": surface === "dark"
491
+ }), onClick: function () { return scrollTabs(-300); }, "aria-label": "Scroll Tabs Left", "data-testid": "arc-Tabs-overflowIconLeft" },
492
+ React__default["default"].createElement(Icon.Icon, { icon: BtIconArrowLeftFill_2, size: 40, color: "brand" }))),
493
+ rightOverflow && (React__default["default"].createElement("button", { className: index$3.classNames("arc-Tabs-overflowIcon", {
494
+ "arc-Tabs-overflowIcon--onDarkSurface": surface === "dark"
495
+ }), onClick: function () { return scrollTabs(300); }, "aria-label": "Scroll Tabs Right", "data-testid": "arc-Tabs-overflowIconRight" },
496
+ React__default["default"].createElement(Icon.Icon, { icon: BtIconArrowRightFill_2, size: 40, color: "brand" })))));
497
+ };
498
+
499
+ var Tabs = function (_a) {
500
+ var children = _a.children, defaultValue = _a.defaultValue, onValueChange = _a.onValueChange, activationMode = _a.activationMode, props = filterDataAttrs.__rest(_a, ["children", "defaultValue", "onValueChange", "activationMode"]);
501
+ return (React__default["default"].createElement($69cb30bb0017df05$export$be92b6f5f03c0fe9, filterDataAttrs.__assign({ className: "arc-Tabs-root", defaultValue: defaultValue, onValueChange: onValueChange, activationMode: activationMode }, filterDataAttrs.filterDataAttrs(props)), children));
502
+ };
503
+ Tab.displayName = "Tabs.Tab";
504
+ TabsList.displayName = "Tabs.List";
505
+ TabContent.displayName = "Tabs.Content";
506
+ Tabs.Tab = Tab;
507
+ Tabs.List = TabsList;
508
+ Tabs.Content = TabContent;
509
+
510
+ exports.Tabs = Tabs;
@@ -0,0 +1,52 @@
1
+ /// <reference types="react" />
2
+ import React from "react";
3
+ import { FC } from "react";
4
+ declare const ToastNotification: FC<ToastNotificationProps>;
5
+ type ToastStatus = "general" | "error" | "warning" | "success";
6
+ interface ToastNotificationProps {
7
+ /**
8
+ * Title for `<Toast />`
9
+ */
10
+ title: string;
11
+ /**
12
+ * Set open state for `<Toast />`
13
+ */
14
+ isOpen: boolean;
15
+ /**
16
+ * Function to call when the open state of `<Toast />` changes. This needs to be supplied in order for the auto dismiss and the close button to work.
17
+ */
18
+ onOpenChange: (isOpen: boolean) => void;
19
+ /**
20
+ * Set whether close button shows
21
+ */
22
+ isCloseButtonVisible?: boolean;
23
+ /**
24
+ * Set whether to include a status icon
25
+ */
26
+ isStatusIconVisible?: boolean;
27
+ /**
28
+ * Link for `<Toast />`
29
+ */
30
+ link?: {
31
+ text: string;
32
+ ariaLabel?: string;
33
+ href?: string;
34
+ onClick?: () => void;
35
+ };
36
+ /**
37
+ * Status of `<Toast />`
38
+ */
39
+ status?: ToastStatus;
40
+ }
41
+ /** Use `Toast` to display temporary messages at the bottom of the viewport. */
42
+ declare const Toast: FC<ToastProps> & {
43
+ Notification: typeof ToastNotification;
44
+ };
45
+ interface ToastProps {
46
+ children: React.ReactNode;
47
+ /**
48
+ * Colour scheme for `Toast` - Use 'default' in almost all cases.
49
+ */
50
+ colorScheme?: "default" | "alternative";
51
+ }
52
+ export { ToastNotification, ToastNotificationProps, Toast };