@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.
- package/lib/commonjs/dialog/DialogContent.js +13 -5
- package/lib/commonjs/dialog/DialogContent.js.map +1 -1
- package/lib/commonjs/dialog/DialogPopup.js +7 -1
- package/lib/commonjs/dialog/DialogPopup.js.map +1 -1
- package/lib/commonjs/dialog/DialogRoot.js +3 -1
- package/lib/commonjs/dialog/DialogRoot.js.map +1 -1
- package/lib/commonjs/portal/portal.js +4 -2
- package/lib/commonjs/portal/portal.js.map +1 -1
- package/lib/commonjs/select/SelectContent.js +1 -0
- package/lib/commonjs/select/SelectContent.js.map +1 -1
- package/lib/module/dialog/DialogContent.js +13 -5
- package/lib/module/dialog/DialogContent.js.map +1 -1
- package/lib/module/dialog/DialogPopup.js +7 -1
- package/lib/module/dialog/DialogPopup.js.map +1 -1
- package/lib/module/dialog/DialogRoot.js +4 -2
- package/lib/module/dialog/DialogRoot.js.map +1 -1
- package/lib/module/portal/portal.js +4 -2
- package/lib/module/portal/portal.js.map +1 -1
- package/lib/module/select/SelectContent.js +2 -1
- package/lib/module/select/SelectContent.js.map +1 -1
- package/lib/typescript/breadcrumbs/types.d.ts +13 -0
- package/lib/typescript/breadcrumbs/types.d.ts.map +1 -1
- package/lib/typescript/checkbox/types.d.ts +4 -0
- package/lib/typescript/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/dialog/DialogContent.d.ts +1 -1
- package/lib/typescript/dialog/DialogContent.d.ts.map +1 -1
- package/lib/typescript/dialog/DialogPopup.d.ts.map +1 -1
- package/lib/typescript/dialog/DialogRoot.d.ts.map +1 -1
- package/lib/typescript/dialog/types.d.ts +12 -0
- package/lib/typescript/dialog/types.d.ts.map +1 -1
- package/lib/typescript/field/types.d.ts +1 -1
- package/lib/typescript/field/types.d.ts.map +1 -1
- package/lib/typescript/form/types.d.ts +6 -0
- package/lib/typescript/form/types.d.ts.map +1 -1
- package/lib/typescript/input/types.d.ts +1 -0
- package/lib/typescript/input/types.d.ts.map +1 -1
- package/lib/typescript/link/types.d.ts +2 -2
- package/lib/typescript/list-item/types.d.ts +3 -2
- package/lib/typescript/list-item/types.d.ts.map +1 -1
- package/lib/typescript/portal/portal.d.ts +13 -2
- package/lib/typescript/portal/portal.d.ts.map +1 -1
- package/lib/typescript/progress-bar/types.d.ts +9 -4
- package/lib/typescript/progress-bar/types.d.ts.map +1 -1
- package/lib/typescript/radio/types.d.ts +2 -0
- package/lib/typescript/radio/types.d.ts.map +1 -1
- package/lib/typescript/select/SelectContent.d.ts.map +1 -1
- package/lib/typescript/switch/types.d.ts +4 -4
- package/lib/typescript/tabs/types.d.ts +7 -2
- package/lib/typescript/tabs/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/breadcrumbs/types.ts +13 -0
- package/src/checkbox/types.ts +4 -0
- package/src/dialog/DialogContent.tsx +13 -5
- package/src/dialog/DialogPopup.tsx +7 -1
- package/src/dialog/DialogRoot.tsx +3 -1
- package/src/dialog/types.ts +12 -0
- package/src/field/types.tsx +1 -1
- package/src/form/types.tsx +6 -0
- package/src/input/types.ts +1 -0
- package/src/link/types.ts +2 -2
- package/src/list-item/types.ts +3 -2
- package/src/portal/portal.tsx +17 -2
- package/src/progress-bar/types.ts +9 -4
- package/src/radio/types.ts +2 -0
- package/src/select/SelectContent.tsx +2 -1
- package/src/switch/types.ts +4 -4
- 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]
|
|
9
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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;
|
package/src/radio/types.ts
CHANGED
|
@@ -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,
|
package/src/switch/types.ts
CHANGED
|
@@ -7,11 +7,11 @@ export interface IInterfaceSwitchProps {
|
|
|
7
7
|
*/
|
|
8
8
|
onValueChange?: (value: boolean) => void;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Alias for `value`. `value` takes precedence when both are set.
|
|
11
11
|
*/
|
|
12
12
|
isChecked?: boolean;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
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
|
-
*
|
|
22
|
+
* Alias for `isDisabled`. Either prop disables the switch.
|
|
23
23
|
*/
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
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
|
|
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
|
-
/**
|
|
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
|
}
|