@cdx-ui/primitives 0.1.6 → 0.1.7

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/lib/commonjs/dialog/DialogContent.js +13 -5
  2. package/lib/commonjs/dialog/DialogContent.js.map +1 -1
  3. package/lib/commonjs/dialog/DialogPopup.js +7 -1
  4. package/lib/commonjs/dialog/DialogPopup.js.map +1 -1
  5. package/lib/commonjs/dialog/DialogRoot.js +3 -1
  6. package/lib/commonjs/dialog/DialogRoot.js.map +1 -1
  7. package/lib/commonjs/portal/portal.js +4 -2
  8. package/lib/commonjs/portal/portal.js.map +1 -1
  9. package/lib/commonjs/select/SelectContent.js +1 -0
  10. package/lib/commonjs/select/SelectContent.js.map +1 -1
  11. package/lib/module/dialog/DialogContent.js +13 -5
  12. package/lib/module/dialog/DialogContent.js.map +1 -1
  13. package/lib/module/dialog/DialogPopup.js +7 -1
  14. package/lib/module/dialog/DialogPopup.js.map +1 -1
  15. package/lib/module/dialog/DialogRoot.js +4 -2
  16. package/lib/module/dialog/DialogRoot.js.map +1 -1
  17. package/lib/module/portal/portal.js +4 -2
  18. package/lib/module/portal/portal.js.map +1 -1
  19. package/lib/module/select/SelectContent.js +2 -1
  20. package/lib/module/select/SelectContent.js.map +1 -1
  21. package/lib/typescript/breadcrumbs/types.d.ts +13 -0
  22. package/lib/typescript/breadcrumbs/types.d.ts.map +1 -1
  23. package/lib/typescript/checkbox/types.d.ts +4 -0
  24. package/lib/typescript/checkbox/types.d.ts.map +1 -1
  25. package/lib/typescript/dialog/DialogContent.d.ts +1 -1
  26. package/lib/typescript/dialog/DialogContent.d.ts.map +1 -1
  27. package/lib/typescript/dialog/DialogPopup.d.ts.map +1 -1
  28. package/lib/typescript/dialog/DialogRoot.d.ts.map +1 -1
  29. package/lib/typescript/dialog/types.d.ts +12 -0
  30. package/lib/typescript/dialog/types.d.ts.map +1 -1
  31. package/lib/typescript/field/types.d.ts +1 -1
  32. package/lib/typescript/field/types.d.ts.map +1 -1
  33. package/lib/typescript/form/types.d.ts +6 -0
  34. package/lib/typescript/form/types.d.ts.map +1 -1
  35. package/lib/typescript/input/types.d.ts +1 -0
  36. package/lib/typescript/input/types.d.ts.map +1 -1
  37. package/lib/typescript/link/types.d.ts +2 -2
  38. package/lib/typescript/list-item/types.d.ts +3 -2
  39. package/lib/typescript/list-item/types.d.ts.map +1 -1
  40. package/lib/typescript/portal/portal.d.ts +13 -2
  41. package/lib/typescript/portal/portal.d.ts.map +1 -1
  42. package/lib/typescript/progress-bar/types.d.ts +9 -4
  43. package/lib/typescript/progress-bar/types.d.ts.map +1 -1
  44. package/lib/typescript/radio/types.d.ts +2 -0
  45. package/lib/typescript/radio/types.d.ts.map +1 -1
  46. package/lib/typescript/select/SelectContent.d.ts.map +1 -1
  47. package/lib/typescript/switch/types.d.ts +4 -4
  48. package/lib/typescript/tabs/types.d.ts +7 -2
  49. package/lib/typescript/tabs/types.d.ts.map +1 -1
  50. package/package.json +3 -3
  51. package/src/breadcrumbs/types.ts +13 -0
  52. package/src/checkbox/types.ts +4 -0
  53. package/src/dialog/DialogContent.tsx +13 -5
  54. package/src/dialog/DialogPopup.tsx +7 -1
  55. package/src/dialog/DialogRoot.tsx +3 -1
  56. package/src/dialog/types.ts +12 -0
  57. package/src/field/types.tsx +1 -1
  58. package/src/form/types.tsx +6 -0
  59. package/src/input/types.ts +1 -0
  60. package/src/link/types.ts +2 -2
  61. package/src/list-item/types.ts +3 -2
  62. package/src/portal/portal.tsx +17 -2
  63. package/src/progress-bar/types.ts +9 -4
  64. package/src/radio/types.ts +2 -0
  65. package/src/select/SelectContent.tsx +2 -1
  66. package/src/switch/types.ts +4 -4
  67. package/src/tabs/types.ts +7 -2
@@ -5,17 +5,22 @@ export type ProgressDataState = 'complete' | 'indeterminate' | 'loading';
5
5
 
6
6
  export interface InterfaceProgressProps extends Omit<ViewProps, 'children'> {
7
7
  /**
8
- * Current value in the range [0, max], or `null` for indeterminate progress.
9
- * Omit or use a number for determinate progress; default is `0`.
8
+ * Current value in the range `[0, max]`, or `null` for indeterminate progress.
9
+ * Values below `0` clamp to `0`; values above `max` clamp to `max`.
10
+ * Non-finite values (such as `NaN`) are treated as `0`.
11
+ * @default 0
10
12
  */
11
13
  readonly value?: number | null;
12
14
  /**
13
- * Maximum value (minimum is always 0).
15
+ * Maximum value. The minimum is always `0`.
16
+ * A `max` of `0` or less is treated as complete.
14
17
  * @default 100
15
18
  */
16
19
  readonly max?: number;
17
20
  /**
18
- * Optional label for `accessibilityValue.text` when determinate.
21
+ * Screen-reader text for determinate progress (`accessibilityValue.text`).
22
+ * Defaults to a rounded percentage of `max`, such as `"45%"`.
23
+ * No effect when `value` is `null`, or when `accessibilityValue` is set.
19
24
  */
20
25
  readonly getValueLabel?: (value: number, max: number) => string;
21
26
  readonly children?: ReactNode;
@@ -3,8 +3,10 @@ import type { PressableProps } from 'react-native';
3
3
  export interface IRadioProps extends PressableProps {
4
4
  /** Required — identifies this item's value within a Radio.Group. */
5
5
  value: string;
6
+ /** Disables this item without disabling the rest of the group. */
6
7
  isDisabled?: boolean;
7
8
  isInvalid?: boolean;
9
+ /** Focusable, but the selection cannot be changed. */
8
10
  isReadOnly?: boolean;
9
11
  isHovered?: boolean;
10
12
  isFocused?: boolean;
@@ -2,7 +2,7 @@ import React, { forwardRef, useCallback, useRef, type ComponentRef } from 'react
2
2
  import { Platform, View } from 'react-native';
3
3
  import { FadeIn, FadeOut } from 'react-native-reanimated';
4
4
  import { composeEventHandlers, mergeRefs } from '@cdx-ui/utils';
5
- import { OverlayContainer, useAnchoredOverlay, useDismissOverlay } from '../overlay';
5
+ import { OverlayContainer, useAnchoredOverlay, useDismissOverlay, useEscapeKey } from '../overlay';
6
6
  import { Slot } from '../slot';
7
7
  import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
8
8
  import { useSelectContext } from './context';
@@ -76,6 +76,7 @@ export const SelectContent = forwardRef<ComponentRef<typeof View>, SelectContent
76
76
  const mergedRef = mergeRefs(ref, focusOnMount as unknown as React.Ref<View>, floatingRef);
77
77
 
78
78
  useDismissOverlay(overlayOpen, contentRef, [triggerRef], dismiss);
79
+ useEscapeKey(overlayOpen, dismiss);
79
80
 
80
81
  const { handleKeyDown } = useListboxNavigation({
81
82
  items,
@@ -7,11 +7,11 @@ export interface IInterfaceSwitchProps {
7
7
  */
8
8
  onValueChange?: (value: boolean) => void;
9
9
  /**
10
- * If true, set the Switch to the checked state.
10
+ * Alias for `value`. `value` takes precedence when both are set.
11
11
  */
12
12
  isChecked?: boolean;
13
13
  /**
14
- * The current value of the switch.
14
+ * Controlled on/off state. Takes precedence over `isChecked`.
15
15
  */
16
16
  value?: boolean;
17
17
  /**
@@ -19,11 +19,11 @@ export interface IInterfaceSwitchProps {
19
19
  */
20
20
  isDisabled?: boolean;
21
21
  /**
22
- * If true, the switch will be disabled.
22
+ * Alias for `isDisabled`. Either prop disables the switch.
23
23
  */
24
24
  disabled?: boolean;
25
25
  /**
26
- * If true, the switch will be initially checked.
26
+ * Initial state when uncontrolled. No effect when `value` or `isChecked` is set.
27
27
  */
28
28
  defaultValue?: boolean;
29
29
  /**
package/src/tabs/types.ts CHANGED
@@ -13,7 +13,8 @@ export interface ITabsProps {
13
13
  onValueChange?: (value: string) => void;
14
14
  /**
15
15
  * `automatic` (default) selects a tab as soon as it receives focus via arrow keys.
16
- * `manual` only moves focus on arrow keys — the consumer must press Enter/Space to select.
16
+ * `manual` only moves focus — press Enter or Space to select. Web only; native
17
+ * selection follows press. Use `manual` when rendering the next panel is expensive.
17
18
  */
18
19
  activationMode?: TabsActivationMode;
19
20
  /**
@@ -21,6 +22,7 @@ export interface ITabsProps {
21
22
  * `vertical` uses ArrowUp/ArrowDown, per the ARIA APG tabs pattern.
22
23
  */
23
24
  orientation?: TabsOrientation;
25
+ /** Disables every tab. Disable a single tab with `disabled` on that `Tabs.Tab`. */
24
26
  disabled?: boolean;
25
27
  children?: ReactNode;
26
28
  }
@@ -63,7 +65,10 @@ export interface ITabProps extends PressableProps {
63
65
  export interface ITabPanelProps extends ViewProps {
64
66
  /** Required — correlates this panel with its `Tabs.Tab` counterpart. */
65
67
  value: string;
66
- /** Unmount when inactive instead of keeping the panel hidden in the DOM. */
68
+ /**
69
+ * Unmount when inactive instead of keeping the panel mounted and hidden.
70
+ * The default keeps it mounted so the tab's `aria-controls` target stays in the tree.
71
+ */
67
72
  unmountWhenInactive?: boolean;
68
73
  children?: ReactNode;
69
74
  }