@arc-ui/components 11.24.2 → 11.26.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 (67) hide show
  1. package/dist/Button/Button.cjs.js +1 -1
  2. package/dist/Button/Button.esm.js +1 -1
  3. package/dist/DatePicker/DatePicker.cjs.js +1276 -22
  4. package/dist/DatePicker/DatePicker.esm.js +1245 -10
  5. package/dist/InformationCard/InformationCard.cjs.js +1 -1
  6. package/dist/InformationCard/InformationCard.esm.js +1 -1
  7. package/dist/Modal/Modal.cjs.js +438 -225
  8. package/dist/Modal/Modal.esm.js +420 -225
  9. package/dist/PaginationSimple/PaginationSimple.cjs.js +23 -2
  10. package/dist/PaginationSimple/PaginationSimple.esm.js +23 -2
  11. package/dist/Select/Select.cjs.js +1514 -1065
  12. package/dist/Select/Select.esm.js +1496 -1066
  13. package/dist/SiteHeader/SiteHeader.cjs.js +2 -2
  14. package/dist/SiteHeader/SiteHeader.esm.js +2 -2
  15. package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +2 -2
  16. package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +2 -2
  17. package/dist/Tabs/Tabs.cjs.js +4 -6
  18. package/dist/Tabs/Tabs.esm.js +4 -6
  19. package/dist/TextArea/TextArea.cjs.js +10 -13
  20. package/dist/TextArea/TextArea.esm.js +10 -13
  21. package/dist/Toast/Toast.cjs.js +4 -6
  22. package/dist/Toast/Toast.esm.js +4 -6
  23. package/dist/UniversalHeader/UniversalHeader.cjs.js +2 -2
  24. package/dist/UniversalHeader/UniversalHeader.esm.js +2 -2
  25. package/dist/_shared/cjs/{Button-6ba21d3b.js → Button-5b28f0ce.js} +3 -3
  26. package/dist/_shared/cjs/{SiteHeader.rehydrator-9d8f3dad.js → SiteHeader.rehydrator-8fa9d174.js} +1 -1
  27. package/dist/_shared/cjs/{SiteHeaderV2-ce1c8737.js → SiteHeaderV2-ca2f13a8.js} +1 -1
  28. package/dist/_shared/cjs/{Tabs-bc9fac46.js → Tabs-89455281.js} +19 -15
  29. package/dist/_shared/cjs/{Toast-26207fef.js → Toast-c760c89d.js} +32 -14
  30. package/dist/_shared/cjs/{UniversalHeader-b8389447.js → UniversalHeader-73e154eb.js} +6 -2
  31. package/dist/_shared/cjs/component-4979b2e7.js +409 -0
  32. package/dist/_shared/cjs/{index-77ab5c6a.js → floating-ui.react-dom-08b8b87c.js} +12 -284
  33. package/dist/_shared/cjs/index-1efbba95.js +1252 -0
  34. package/dist/_shared/cjs/{index-74004a9c.js → index-4edec793.js} +1 -1
  35. package/dist/_shared/cjs/{index-dd1d18ea.js → index-7641213c.js} +127 -2
  36. package/dist/_shared/cjs/{index-9f99d686.js → index-af744fa9.js} +1 -1
  37. package/dist/_shared/cjs/{index-6eb396a3.js → index-fb0cad18.js} +1 -1
  38. package/dist/_shared/esm/{Button-a7d134c6.js → Button-5b48b7ce.js} +3 -3
  39. package/dist/_shared/esm/{SiteHeader.rehydrator-2ec02ee7.js → SiteHeader.rehydrator-8f3c5d6e.js} +1 -1
  40. package/dist/_shared/esm/{SiteHeaderV2-a7c1b1cb.js → SiteHeaderV2-cb081752.js} +1 -1
  41. package/dist/_shared/esm/{Tabs-9485cab6.js → Tabs-959e885d.js} +10 -6
  42. package/dist/_shared/esm/{Toast-fcbfc194.js → Toast-a590067d.js} +25 -7
  43. package/dist/_shared/esm/{UniversalHeader-80c7313f.js → UniversalHeader-96bfbacc.js} +6 -2
  44. package/dist/_shared/esm/component-d7b471ff.js +382 -0
  45. package/dist/_shared/esm/{index-b84a20c6.js → floating-ui.react-dom-1bb71aae.js} +4 -281
  46. package/dist/_shared/esm/{index-7b531fa7.js → index-0ae23b06.js} +126 -2
  47. package/dist/_shared/esm/index-307f1bbc.js +1212 -0
  48. package/dist/_shared/esm/{index-044da8d0.js → index-9e54cc7d.js} +1 -1
  49. package/dist/_shared/esm/{index-efa9be1a.js → index-af7b6e55.js} +1 -1
  50. package/dist/_shared/esm/{index-2cfab9f2.js → index-ebe72f34.js} +1 -1
  51. package/dist/index.es.js +3608 -2938
  52. package/dist/index.es.js.map +1 -1
  53. package/dist/index.js +3591 -2921
  54. package/dist/index.js.map +1 -1
  55. package/dist/styles.css +2 -2
  56. package/dist/types/components/Button/Button.d.ts +12 -0
  57. package/dist/types/components/PaginationSimple/PaginationSimple.d.ts +28 -0
  58. package/dist/types/components/UniversalHeader/UniversalHeader.d.ts +4 -0
  59. package/package.json +3 -3
  60. package/dist/_shared/cjs/Combination-9974f2e2.js +0 -1330
  61. package/dist/_shared/cjs/index-a31e64a9.js +0 -27
  62. package/dist/_shared/cjs/index-d38f1bd0.js +0 -131
  63. package/dist/_shared/cjs/index-dcfdd5da.js +0 -11
  64. package/dist/_shared/esm/Combination-e9f7e64e.js +0 -1301
  65. package/dist/_shared/esm/index-25a5b393.js +0 -25
  66. package/dist/_shared/esm/index-a624de47.js +0 -9
  67. package/dist/_shared/esm/index-ca72c9d5.js +0 -129
@@ -1,4 +1,4 @@
1
- import { useCallback, createContext, useMemo, createElement, useContext, forwardRef, Children, isValidElement, cloneElement, Fragment, useEffect, useRef, useLayoutEffect, useState } from 'react';
1
+ import { useCallback, createContext, useMemo, createElement, useContext, forwardRef, Children, isValidElement, cloneElement, Fragment, useEffect, useRef, useLayoutEffect, useState, useReducer } from 'react';
2
2
  import { _ as _extends } from './extends-8cc61aad.js';
3
3
  import { flushSync } from 'react-dom';
4
4
 
@@ -309,6 +309,130 @@ const $8927f6f2acc4f386$var$NODES = [
309
309
  * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
310
310
  */ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? useLayoutEffect : ()=>{};
311
311
 
312
+ function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
313
+ return useReducer((state, event)=>{
314
+ const nextState = machine[state][event];
315
+ return nextState !== null && nextState !== void 0 ? nextState : state;
316
+ }, initialState);
317
+ }
318
+
319
+
320
+ const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props)=>{
321
+ const { present: present , children: children } = props;
322
+ const presence = $921a889cee6df7e8$var$usePresence(present);
323
+ const child = typeof children === 'function' ? children({
324
+ present: presence.isPresent
325
+ }) : Children.only(children);
326
+ const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
327
+ const forceMount = typeof children === 'function';
328
+ return forceMount || presence.isPresent ? /*#__PURE__*/ cloneElement(child, {
329
+ ref: ref
330
+ }) : null;
331
+ };
332
+ $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence';
333
+ /* -------------------------------------------------------------------------------------------------
334
+ * usePresence
335
+ * -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$usePresence(present) {
336
+ const [node1, setNode] = useState();
337
+ const stylesRef = useRef({});
338
+ const prevPresentRef = useRef(present);
339
+ const prevAnimationNameRef = useRef('none');
340
+ const initialState = present ? 'mounted' : 'unmounted';
341
+ const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
342
+ mounted: {
343
+ UNMOUNT: 'unmounted',
344
+ ANIMATION_OUT: 'unmountSuspended'
345
+ },
346
+ unmountSuspended: {
347
+ MOUNT: 'mounted',
348
+ ANIMATION_END: 'unmounted'
349
+ },
350
+ unmounted: {
351
+ MOUNT: 'mounted'
352
+ }
353
+ });
354
+ useEffect(()=>{
355
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
356
+ prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';
357
+ }, [
358
+ state
359
+ ]);
360
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
361
+ const styles = stylesRef.current;
362
+ const wasPresent = prevPresentRef.current;
363
+ const hasPresentChanged = wasPresent !== present;
364
+ if (hasPresentChanged) {
365
+ const prevAnimationName = prevAnimationNameRef.current;
366
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
367
+ if (present) send('MOUNT');
368
+ else if (currentAnimationName === 'none' || (styles === null || styles === void 0 ? void 0 : styles.display) === 'none') // If there is no exit animation or the element is hidden, animations won't run
369
+ // so we unmount instantly
370
+ send('UNMOUNT');
371
+ else {
372
+ /**
373
+ * When `present` changes to `false`, we check changes to animation-name to
374
+ * determine whether an animation has started. We chose this approach (reading
375
+ * computed styles) because there is no `animationrun` event and `animationstart`
376
+ * fires after `animation-delay` has expired which would be too late.
377
+ */ const isAnimating = prevAnimationName !== currentAnimationName;
378
+ if (wasPresent && isAnimating) send('ANIMATION_OUT');
379
+ else send('UNMOUNT');
380
+ }
381
+ prevPresentRef.current = present;
382
+ }
383
+ }, [
384
+ present,
385
+ send
386
+ ]);
387
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
388
+ if (node1) {
389
+ /**
390
+ * Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`
391
+ * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we
392
+ * make sure we only trigger ANIMATION_END for the currently active animation.
393
+ */ const handleAnimationEnd = (event)=>{
394
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
395
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
396
+ if (event.target === node1 && isCurrentAnimation) // With React 18 concurrency this update is applied
397
+ // a frame after the animation ends, creating a flash of visible content.
398
+ // By manually flushing we ensure they sync within a frame, removing the flash.
399
+ flushSync(()=>send('ANIMATION_END')
400
+ );
401
+ };
402
+ const handleAnimationStart = (event)=>{
403
+ if (event.target === node1) // if animation occurred, store its name as the previous animation.
404
+ prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
405
+ };
406
+ node1.addEventListener('animationstart', handleAnimationStart);
407
+ node1.addEventListener('animationcancel', handleAnimationEnd);
408
+ node1.addEventListener('animationend', handleAnimationEnd);
409
+ return ()=>{
410
+ node1.removeEventListener('animationstart', handleAnimationStart);
411
+ node1.removeEventListener('animationcancel', handleAnimationEnd);
412
+ node1.removeEventListener('animationend', handleAnimationEnd);
413
+ };
414
+ } else // Transition to the unmounted state if the node is removed prematurely.
415
+ // We avoid doing so during cleanup as the node may change but still exist.
416
+ send('ANIMATION_END');
417
+ }, [
418
+ node1,
419
+ send
420
+ ]);
421
+ return {
422
+ isPresent: [
423
+ 'mounted',
424
+ 'unmountSuspended'
425
+ ].includes(state),
426
+ ref: useCallback((node)=>{
427
+ if (node) stylesRef.current = getComputedStyle(node);
428
+ setNode(node);
429
+ }, [])
430
+ };
431
+ }
432
+ /* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$getAnimationName(styles) {
433
+ return (styles === null || styles === void 0 ? void 0 : styles.animationName) || 'none';
434
+ }
435
+
312
436
  function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
313
437
  const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
314
438
  defaultProp: defaultProp,
@@ -352,4 +476,4 @@ function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp ,
352
476
  return uncontrolledState;
353
477
  }
354
478
 
355
- export { $c512c27ab02ef895$export$50c7b4e9d9f19c1 as $, $71cd76cc60e0454e$export$6f32135080cb4c3 as a, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as b, $5e63c961fc1ce211$export$8c6ed5c666ac1360 as c, $e42e1063c40fb3ef$export$b9ecd428b558ff10 as d, $8927f6f2acc4f386$export$250ffa63cdc0d034 as e, $b1b2314f5f9a1d84$export$25bec8c6f54ee79a as f, $8927f6f2acc4f386$export$6d1a0317bde7de7f as g, $9f79659886946c16$export$e5c5a5f917a5871c as h };
479
+ export { $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as $, $8927f6f2acc4f386$export$250ffa63cdc0d034 as a, $e42e1063c40fb3ef$export$b9ecd428b558ff10 as b, $b1b2314f5f9a1d84$export$25bec8c6f54ee79a as c, $8927f6f2acc4f386$export$6d1a0317bde7de7f as d, $9f79659886946c16$export$e5c5a5f917a5871c as e, $c512c27ab02ef895$export$50c7b4e9d9f19c1 as f, $71cd76cc60e0454e$export$6f32135080cb4c3 as g, $921a889cee6df7e8$export$99c2b779aa4e8b8b as h, $5e63c961fc1ce211$export$8c6ed5c666ac1360 as i };