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