@limonify/zest-ui 0.1.4 → 0.2.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.
- package/lib/accordion/root/AccordionRoot.d.ts +4 -2
- package/lib/accordion/root/AccordionRoot.d.ts.map +1 -1
- package/lib/accordion/root/AccordionRoot.js +12 -3
- package/lib/accordion/root/AccordionRoot.js.map +1 -1
- package/lib/avatar/root/AvatarRoot.d.ts.map +1 -1
- package/lib/avatar/root/AvatarRoot.js +1 -1
- package/lib/avatar/root/AvatarRoot.js.map +1 -1
- package/lib/button/Button.d.ts.map +1 -1
- package/lib/button/Button.js +1 -1
- package/lib/button/Button.js.map +1 -1
- package/lib/checkbox-group/CheckboxGroup.d.ts.map +1 -1
- package/lib/checkbox-group/CheckboxGroup.js +1 -1
- package/lib/checkbox-group/CheckboxGroup.js.map +1 -1
- package/lib/collapsible/panel/useCollapsiblePanel.d.ts.map +1 -1
- package/lib/collapsible/panel/useCollapsiblePanel.js +2 -0
- package/lib/collapsible/panel/useCollapsiblePanel.js.map +1 -1
- package/lib/dialog/popup/DialogPopup.d.ts +6 -0
- package/lib/dialog/popup/DialogPopup.d.ts.map +1 -1
- package/lib/dialog/popup/DialogPopup.js +2 -2
- package/lib/dialog/popup/DialogPopup.js.map +1 -1
- package/lib/dialog/popup/useDialogPopupProps.d.ts +1 -0
- package/lib/dialog/popup/useDialogPopupProps.d.ts.map +1 -1
- package/lib/dialog/popup/useDialogPopupProps.js +3 -0
- package/lib/dialog/popup/useDialogPopupProps.js.map +1 -1
- package/lib/dialog/root/DialogTransitionContext.d.ts +8 -0
- package/lib/dialog/root/DialogTransitionContext.d.ts.map +1 -0
- package/lib/dialog/root/DialogTransitionContext.js +44 -0
- package/lib/dialog/root/DialogTransitionContext.js.map +1 -0
- package/lib/dialog/root/useRenderDialogRoot.d.ts.map +1 -1
- package/lib/dialog/root/useRenderDialogRoot.js +40 -1
- package/lib/dialog/root/useRenderDialogRoot.js.map +1 -1
- package/lib/drawer/popup/DrawerPopup.d.ts +6 -0
- package/lib/drawer/popup/DrawerPopup.d.ts.map +1 -1
- package/lib/drawer/popup/DrawerPopup.js +2 -1
- package/lib/drawer/popup/DrawerPopup.js.map +1 -1
- package/lib/input/Input.d.ts +2 -1
- package/lib/input/Input.d.ts.map +1 -1
- package/lib/input/Input.js +35 -2
- package/lib/input/Input.js.map +1 -1
- package/lib/internals/useTransitionStatus.d.ts.map +1 -1
- package/lib/internals/useTransitionStatus.js +11 -13
- package/lib/internals/useTransitionStatus.js.map +1 -1
- package/lib/menu/item/MenuItem.d.ts.map +1 -1
- package/lib/menu/item/MenuItem.js +1 -1
- package/lib/menu/item/MenuItem.js.map +1 -1
- package/lib/menu/popup/MenuPopup.d.ts +15 -0
- package/lib/menu/popup/MenuPopup.d.ts.map +1 -1
- package/lib/menu/popup/MenuPopup.js +4 -1
- package/lib/menu/popup/MenuPopup.js.map +1 -1
- package/lib/menu/root/MenuRoot.d.ts +1 -1
- package/lib/menu/root/MenuRoot.d.ts.map +1 -1
- package/lib/menu/root/MenuRoot.js +40 -1
- package/lib/menu/root/MenuRoot.js.map +1 -1
- package/lib/menu/root/MenuTransitionContext.d.ts +8 -0
- package/lib/menu/root/MenuTransitionContext.d.ts.map +1 -0
- package/lib/menu/root/MenuTransitionContext.js +44 -0
- package/lib/menu/root/MenuTransitionContext.js.map +1 -0
- package/lib/popover/popup/PopoverPopup.d.ts +6 -0
- package/lib/popover/popup/PopoverPopup.d.ts.map +1 -1
- package/lib/popover/popup/PopoverPopup.js +4 -1
- package/lib/popover/popup/PopoverPopup.js.map +1 -1
- package/lib/popover/root/PopoverRoot.d.ts +1 -1
- package/lib/popover/root/PopoverRoot.d.ts.map +1 -1
- package/lib/popover/root/PopoverRoot.js +40 -1
- package/lib/popover/root/PopoverRoot.js.map +1 -1
- package/lib/popover/root/PopoverTransitionContext.d.ts +8 -0
- package/lib/popover/root/PopoverTransitionContext.d.ts.map +1 -0
- package/lib/popover/root/PopoverTransitionContext.js +44 -0
- package/lib/popover/root/PopoverTransitionContext.js.map +1 -0
- package/lib/radio-group/RadioGroup.d.ts.map +1 -1
- package/lib/radio-group/RadioGroup.js +1 -1
- package/lib/radio-group/RadioGroup.js.map +1 -1
- package/lib/select/list/SelectList.d.ts.map +1 -1
- package/lib/select/list/SelectList.js +9 -1
- package/lib/select/list/SelectList.js.map +1 -1
- package/lib/select/popup/SelectPopup.d.ts +15 -0
- package/lib/select/popup/SelectPopup.d.ts.map +1 -1
- package/lib/select/popup/SelectPopup.js +4 -1
- package/lib/select/popup/SelectPopup.js.map +1 -1
- package/lib/select/root/SelectRoot.d.ts +1 -1
- package/lib/select/root/SelectRoot.d.ts.map +1 -1
- package/lib/select/root/SelectRoot.js +40 -1
- package/lib/select/root/SelectRoot.js.map +1 -1
- package/lib/select/root/SelectTransitionContext.d.ts +8 -0
- package/lib/select/root/SelectTransitionContext.d.ts.map +1 -0
- package/lib/select/root/SelectTransitionContext.js +44 -0
- package/lib/select/root/SelectTransitionContext.js.map +1 -0
- package/lib/separator/Separator.d.ts +2 -1
- package/lib/separator/Separator.d.ts.map +1 -1
- package/lib/separator/Separator.js +35 -1
- package/lib/separator/Separator.js.map +1 -1
- package/lib/slider/thumb/SliderThumb.d.ts +4 -0
- package/lib/slider/thumb/SliderThumb.d.ts.map +1 -1
- package/lib/slider/thumb/SliderThumb.js +1 -1
- package/lib/slider/thumb/SliderThumb.js.map +1 -1
- package/lib/tabs/tab/TabsTab.d.ts.map +1 -1
- package/lib/tabs/tab/TabsTab.js +1 -1
- package/lib/tabs/tab/TabsTab.js.map +1 -1
- package/lib/toggle/Toggle.d.ts +2 -1
- package/lib/toggle/Toggle.d.ts.map +1 -1
- package/lib/toggle/Toggle.js +35 -1
- package/lib/toggle/Toggle.js.map +1 -1
- package/lib/toggle-group/ToggleGroup.d.ts.map +1 -1
- package/lib/toggle-group/ToggleGroup.js +1 -1
- package/lib/toggle-group/ToggleGroup.js.map +1 -1
- package/lib/tooltip/popup/TooltipPopup.d.ts +15 -0
- package/lib/tooltip/popup/TooltipPopup.d.ts.map +1 -1
- package/lib/tooltip/popup/TooltipPopup.js +5 -1
- package/lib/tooltip/popup/TooltipPopup.js.map +1 -1
- package/lib/tooltip/root/TooltipRoot.d.ts +1 -1
- package/lib/tooltip/root/TooltipRoot.d.ts.map +1 -1
- package/lib/tooltip/root/TooltipRoot.js +40 -1
- package/lib/tooltip/root/TooltipRoot.js.map +1 -1
- package/lib/tooltip/root/TooltipTransitionContext.d.ts +8 -0
- package/lib/tooltip/root/TooltipTransitionContext.d.ts.map +1 -0
- package/lib/tooltip/root/TooltipTransitionContext.js +44 -0
- package/lib/tooltip/root/TooltipTransitionContext.js.map +1 -0
- package/package.json +182 -2
- package/src/accordion/root/AccordionRoot.tsx +22 -5
- package/src/avatar/root/AvatarRoot.tsx +4 -1
- package/src/button/Button.tsx +4 -1
- package/src/checkbox-group/CheckboxGroup.tsx +4 -1
- package/src/collapsible/panel/useCollapsiblePanel.tsx +1 -0
- package/src/dialog/popup/DialogPopup.tsx +8 -2
- package/src/dialog/popup/useDialogPopupProps.ts +3 -0
- package/src/dialog/root/DialogTransitionContext.ts +15 -0
- package/src/dialog/root/useRenderDialogRoot.tsx +13 -1
- package/src/drawer/popup/DrawerPopup.tsx +8 -1
- package/src/input/Input.tsx +5 -1
- package/src/internals/useTransitionStatus.ts +13 -11
- package/src/menu/item/MenuItem.tsx +4 -1
- package/src/menu/popup/MenuPopup.tsx +18 -1
- package/src/menu/root/MenuRoot.tsx +14 -2
- package/src/menu/root/MenuTransitionContext.ts +15 -0
- package/src/popover/popup/PopoverPopup.tsx +9 -1
- package/src/popover/root/PopoverRoot.tsx +14 -2
- package/src/popover/root/PopoverTransitionContext.ts +15 -0
- package/src/radio-group/RadioGroup.tsx +4 -1
- package/src/select/list/SelectList.tsx +9 -1
- package/src/select/popup/SelectPopup.tsx +18 -1
- package/src/select/root/SelectRoot.tsx +18 -2
- package/src/select/root/SelectTransitionContext.ts +15 -0
- package/src/separator/Separator.tsx +5 -1
- package/src/slider/thumb/SliderThumb.tsx +5 -1
- package/src/tabs/tab/TabsTab.tsx +4 -1
- package/src/toggle/Toggle.tsx +5 -1
- package/src/toggle-group/ToggleGroup.tsx +4 -1
- package/src/tooltip/popup/TooltipPopup.tsx +19 -1
- package/src/tooltip/root/TooltipRoot.tsx +18 -2
- package/src/tooltip/root/TooltipTransitionContext.ts +15 -0
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.TooltipRoot = TooltipRoot;
|
|
5
38
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
6
40
|
const useRefWithInit_1 = require("../../hooks/useRefWithInit");
|
|
41
|
+
const useTransitionStatus_1 = require("../../internals/useTransitionStatus");
|
|
7
42
|
const TooltipStore_1 = require("../store/TooltipStore");
|
|
8
43
|
const TooltipRootContext_1 = require("./TooltipRootContext");
|
|
44
|
+
const TooltipTransitionContext_1 = require("./TooltipTransitionContext");
|
|
9
45
|
/**
|
|
10
46
|
* Groups all parts of the tooltip.
|
|
11
47
|
* Doesn't render its own element.
|
|
@@ -21,6 +57,9 @@ function TooltipRoot(props) {
|
|
|
21
57
|
const store = (0, useRefWithInit_1.useRefWithInit)(() => new TooltipStore_1.TooltipStore({ open: defaultOpen, openProp: open })).current;
|
|
22
58
|
store.useControlledProp('openProp', open);
|
|
23
59
|
store.useContextCallback('onOpenChange', onOpenChange);
|
|
24
|
-
|
|
60
|
+
const resolvedOpen = store.useState('open');
|
|
61
|
+
const { transitionStatus } = (0, useTransitionStatus_1.useTransitionStatus)(resolvedOpen, false, true);
|
|
62
|
+
const transitionContextValue = React.useMemo(() => ({ transitionStatus }), [transitionStatus]);
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(TooltipRootContext_1.TooltipRootContext.Provider, { value: store, children: (0, jsx_runtime_1.jsx)(TooltipTransitionContext_1.TooltipTransitionContext.Provider, { value: transitionContextValue, children: children }) }));
|
|
25
64
|
}
|
|
26
65
|
//# sourceMappingURL=TooltipRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipRoot.js","sourceRoot":"","sources":["../../../src/tooltip/root/TooltipRoot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"TooltipRoot.js","sourceRoot":"","sources":["../../../src/tooltip/root/TooltipRoot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBb,kCAyBC;;AA5CD,6CAA+B;AAC/B,+DAA4D;AAC5D,6EAA0E;AAG1E,wDAAqD;AACrD,6DAA0D;AAC1D,yEAAsE;AAEtE;;;;;;;;;GASG;AACH,SAAgB,WAAW,CAAC,KAAwB;IAClD,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAEpE,MAAM,KAAK,GAAG,IAAA,+BAAc,EAC1B,GAAG,EAAE,CAAC,IAAI,2BAAY,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAC9D,CAAC,OAAO,CAAC;IAEV,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1C,KAAK,CAAC,kBAAkB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAEvD,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,yCAAmB,EAAC,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAE5E,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,CAC1C,GAAG,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAC5B,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,uBAAC,uCAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACvC,uBAAC,mDAAwB,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,YAC7D,QAAQ,GACyB,GACR,CAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TransitionStatus } from '../../internals/useTransitionStatus';
|
|
3
|
+
export interface TooltipTransitionContext {
|
|
4
|
+
transitionStatus: TransitionStatus;
|
|
5
|
+
}
|
|
6
|
+
export declare const TooltipTransitionContext: React.Context<TooltipTransitionContext | undefined>;
|
|
7
|
+
export declare function useTooltipTransitionContext(): TooltipTransitionContext | undefined;
|
|
8
|
+
//# sourceMappingURL=TooltipTransitionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipTransitionContext.d.ts","sourceRoot":"","sources":["../../../src/tooltip/root/TooltipTransitionContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,MAAM,WAAW,wBAAwB;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,eAAO,MAAM,wBAAwB,qDAEpC,CAAC;AAEF,wBAAgB,2BAA2B,yCAE1C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.TooltipTransitionContext = void 0;
|
|
38
|
+
exports.useTooltipTransitionContext = useTooltipTransitionContext;
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
exports.TooltipTransitionContext = React.createContext(undefined);
|
|
41
|
+
function useTooltipTransitionContext() {
|
|
42
|
+
return React.useContext(exports.TooltipTransitionContext);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=TooltipTransitionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipTransitionContext.js","sourceRoot":"","sources":["../../../src/tooltip/root/TooltipTransitionContext.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYb,kEAEC;AAbD,6CAA+B;AAOlB,QAAA,wBAAwB,GAAG,KAAK,CAAC,aAAa,CACzD,SAAS,CACV,CAAC;AAEF,SAAgB,2BAA2B;IACzC,OAAO,KAAK,CAAC,UAAU,CAAC,gCAAwB,CAAC,CAAC;AACpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limonify/zest-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Base UI for React Native — headless, unstyled, accessible primitive components.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,176 @@
|
|
|
21
21
|
"types": "./lib/index.d.ts",
|
|
22
22
|
"react-native": "./src/index.ts",
|
|
23
23
|
"default": "./lib/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./accordion": {
|
|
26
|
+
"types": "./lib/accordion/index.d.ts",
|
|
27
|
+
"react-native": "./src/accordion/index.ts",
|
|
28
|
+
"default": "./lib/accordion/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./alert-dialog": {
|
|
31
|
+
"types": "./lib/alert-dialog/index.d.ts",
|
|
32
|
+
"react-native": "./src/alert-dialog/index.ts",
|
|
33
|
+
"default": "./lib/alert-dialog/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./autocomplete": {
|
|
36
|
+
"types": "./lib/autocomplete/index.d.ts",
|
|
37
|
+
"react-native": "./src/autocomplete/index.ts",
|
|
38
|
+
"default": "./lib/autocomplete/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./avatar": {
|
|
41
|
+
"types": "./lib/avatar/index.d.ts",
|
|
42
|
+
"react-native": "./src/avatar/index.ts",
|
|
43
|
+
"default": "./lib/avatar/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./button": {
|
|
46
|
+
"types": "./lib/button/index.d.ts",
|
|
47
|
+
"react-native": "./src/button/index.ts",
|
|
48
|
+
"default": "./lib/button/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./checkbox": {
|
|
51
|
+
"types": "./lib/checkbox/index.d.ts",
|
|
52
|
+
"react-native": "./src/checkbox/index.ts",
|
|
53
|
+
"default": "./lib/checkbox/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./checkbox-group": {
|
|
56
|
+
"types": "./lib/checkbox-group/index.d.ts",
|
|
57
|
+
"react-native": "./src/checkbox-group/index.ts",
|
|
58
|
+
"default": "./lib/checkbox-group/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./collapsible": {
|
|
61
|
+
"types": "./lib/collapsible/index.d.ts",
|
|
62
|
+
"react-native": "./src/collapsible/index.ts",
|
|
63
|
+
"default": "./lib/collapsible/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./combobox": {
|
|
66
|
+
"types": "./lib/combobox/index.d.ts",
|
|
67
|
+
"react-native": "./src/combobox/index.ts",
|
|
68
|
+
"default": "./lib/combobox/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./context-menu": {
|
|
71
|
+
"types": "./lib/context-menu/index.d.ts",
|
|
72
|
+
"react-native": "./src/context-menu/index.ts",
|
|
73
|
+
"default": "./lib/context-menu/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./dialog": {
|
|
76
|
+
"types": "./lib/dialog/index.d.ts",
|
|
77
|
+
"react-native": "./src/dialog/index.ts",
|
|
78
|
+
"default": "./lib/dialog/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./drawer": {
|
|
81
|
+
"types": "./lib/drawer/index.d.ts",
|
|
82
|
+
"react-native": "./src/drawer/index.ts",
|
|
83
|
+
"default": "./lib/drawer/index.js"
|
|
84
|
+
},
|
|
85
|
+
"./field": {
|
|
86
|
+
"types": "./lib/field/index.d.ts",
|
|
87
|
+
"react-native": "./src/field/index.ts",
|
|
88
|
+
"default": "./lib/field/index.js"
|
|
89
|
+
},
|
|
90
|
+
"./fieldset": {
|
|
91
|
+
"types": "./lib/fieldset/index.d.ts",
|
|
92
|
+
"react-native": "./src/fieldset/index.ts",
|
|
93
|
+
"default": "./lib/fieldset/index.js"
|
|
94
|
+
},
|
|
95
|
+
"./input": {
|
|
96
|
+
"types": "./lib/input/index.d.ts",
|
|
97
|
+
"react-native": "./src/input/index.ts",
|
|
98
|
+
"default": "./lib/input/index.js"
|
|
99
|
+
},
|
|
100
|
+
"./menu": {
|
|
101
|
+
"types": "./lib/menu/index.d.ts",
|
|
102
|
+
"react-native": "./src/menu/index.ts",
|
|
103
|
+
"default": "./lib/menu/index.js"
|
|
104
|
+
},
|
|
105
|
+
"./meter": {
|
|
106
|
+
"types": "./lib/meter/index.d.ts",
|
|
107
|
+
"react-native": "./src/meter/index.ts",
|
|
108
|
+
"default": "./lib/meter/index.js"
|
|
109
|
+
},
|
|
110
|
+
"./number-field": {
|
|
111
|
+
"types": "./lib/number-field/index.d.ts",
|
|
112
|
+
"react-native": "./src/number-field/index.ts",
|
|
113
|
+
"default": "./lib/number-field/index.js"
|
|
114
|
+
},
|
|
115
|
+
"./otp-field": {
|
|
116
|
+
"types": "./lib/otp-field/index.d.ts",
|
|
117
|
+
"react-native": "./src/otp-field/index.ts",
|
|
118
|
+
"default": "./lib/otp-field/index.js"
|
|
119
|
+
},
|
|
120
|
+
"./popover": {
|
|
121
|
+
"types": "./lib/popover/index.d.ts",
|
|
122
|
+
"react-native": "./src/popover/index.ts",
|
|
123
|
+
"default": "./lib/popover/index.js"
|
|
124
|
+
},
|
|
125
|
+
"./progress": {
|
|
126
|
+
"types": "./lib/progress/index.d.ts",
|
|
127
|
+
"react-native": "./src/progress/index.ts",
|
|
128
|
+
"default": "./lib/progress/index.js"
|
|
129
|
+
},
|
|
130
|
+
"./radio": {
|
|
131
|
+
"types": "./lib/radio/index.d.ts",
|
|
132
|
+
"react-native": "./src/radio/index.ts",
|
|
133
|
+
"default": "./lib/radio/index.js"
|
|
134
|
+
},
|
|
135
|
+
"./radio-group": {
|
|
136
|
+
"types": "./lib/radio-group/index.d.ts",
|
|
137
|
+
"react-native": "./src/radio-group/index.ts",
|
|
138
|
+
"default": "./lib/radio-group/index.js"
|
|
139
|
+
},
|
|
140
|
+
"./select": {
|
|
141
|
+
"types": "./lib/select/index.d.ts",
|
|
142
|
+
"react-native": "./src/select/index.ts",
|
|
143
|
+
"default": "./lib/select/index.js"
|
|
144
|
+
},
|
|
145
|
+
"./separator": {
|
|
146
|
+
"types": "./lib/separator/index.d.ts",
|
|
147
|
+
"react-native": "./src/separator/index.ts",
|
|
148
|
+
"default": "./lib/separator/index.js"
|
|
149
|
+
},
|
|
150
|
+
"./slider": {
|
|
151
|
+
"types": "./lib/slider/index.d.ts",
|
|
152
|
+
"react-native": "./src/slider/index.ts",
|
|
153
|
+
"default": "./lib/slider/index.js"
|
|
154
|
+
},
|
|
155
|
+
"./switch": {
|
|
156
|
+
"types": "./lib/switch/index.d.ts",
|
|
157
|
+
"react-native": "./src/switch/index.ts",
|
|
158
|
+
"default": "./lib/switch/index.js"
|
|
159
|
+
},
|
|
160
|
+
"./tabs": {
|
|
161
|
+
"types": "./lib/tabs/index.d.ts",
|
|
162
|
+
"react-native": "./src/tabs/index.ts",
|
|
163
|
+
"default": "./lib/tabs/index.js"
|
|
164
|
+
},
|
|
165
|
+
"./toast": {
|
|
166
|
+
"types": "./lib/toast/index.d.ts",
|
|
167
|
+
"react-native": "./src/toast/index.ts",
|
|
168
|
+
"default": "./lib/toast/index.js"
|
|
169
|
+
},
|
|
170
|
+
"./toggle": {
|
|
171
|
+
"types": "./lib/toggle/index.d.ts",
|
|
172
|
+
"react-native": "./src/toggle/index.ts",
|
|
173
|
+
"default": "./lib/toggle/index.js"
|
|
174
|
+
},
|
|
175
|
+
"./toggle-group": {
|
|
176
|
+
"types": "./lib/toggle-group/index.d.ts",
|
|
177
|
+
"react-native": "./src/toggle-group/index.ts",
|
|
178
|
+
"default": "./lib/toggle-group/index.js"
|
|
179
|
+
},
|
|
180
|
+
"./tooltip": {
|
|
181
|
+
"types": "./lib/tooltip/index.d.ts",
|
|
182
|
+
"react-native": "./src/tooltip/index.ts",
|
|
183
|
+
"default": "./lib/tooltip/index.js"
|
|
184
|
+
},
|
|
185
|
+
"./hooks": {
|
|
186
|
+
"types": "./lib/hooks/index.d.ts",
|
|
187
|
+
"react-native": "./src/hooks/index.ts",
|
|
188
|
+
"default": "./lib/hooks/index.js"
|
|
189
|
+
},
|
|
190
|
+
"./store": {
|
|
191
|
+
"types": "./lib/store/index.d.ts",
|
|
192
|
+
"react-native": "./src/store/index.ts",
|
|
193
|
+
"default": "./lib/store/index.js"
|
|
24
194
|
}
|
|
25
195
|
},
|
|
26
196
|
"files": [
|
|
@@ -34,6 +204,7 @@
|
|
|
34
204
|
"scripts": {
|
|
35
205
|
"typecheck": "tsc --noEmit",
|
|
36
206
|
"test": "jest",
|
|
207
|
+
"test:coverage": "jest --coverage",
|
|
37
208
|
"lint": "eslint src",
|
|
38
209
|
"build": "tsc -p tsconfig.build.json",
|
|
39
210
|
"clean": "rm -rf lib",
|
|
@@ -46,6 +217,7 @@
|
|
|
46
217
|
},
|
|
47
218
|
"devDependencies": {
|
|
48
219
|
"@babel/runtime": "^8.0.0",
|
|
220
|
+
"@size-limit/preset-small-lib": "^12.1.0",
|
|
49
221
|
"@testing-library/react-native": "^14.0.1",
|
|
50
222
|
"@types/jest": "^29.5.14",
|
|
51
223
|
"@types/react": "~19.2.2",
|
|
@@ -55,6 +227,7 @@
|
|
|
55
227
|
"react": "19.2.3",
|
|
56
228
|
"react-native": "0.86.0",
|
|
57
229
|
"react-native-gesture-handler": "~3.1.0",
|
|
230
|
+
"size-limit": "^12.1.0",
|
|
58
231
|
"typescript": "~6.0.3"
|
|
59
232
|
},
|
|
60
233
|
"dependencies": {
|
|
@@ -64,5 +237,12 @@
|
|
|
64
237
|
"react-native-gesture-handler": {
|
|
65
238
|
"optional": true
|
|
66
239
|
}
|
|
67
|
-
}
|
|
240
|
+
},
|
|
241
|
+
"size-limit": [
|
|
242
|
+
{
|
|
243
|
+
"name": "full",
|
|
244
|
+
"path": "lib/index.js",
|
|
245
|
+
"limit": "500 KB"
|
|
246
|
+
}
|
|
247
|
+
]
|
|
68
248
|
}
|
|
@@ -32,18 +32,33 @@ export function AccordionRoot<Value = any>(componentProps: AccordionRoot.Props<V
|
|
|
32
32
|
...elementProps
|
|
33
33
|
} = componentProps;
|
|
34
34
|
|
|
35
|
+
const normalizeValue = React.useCallback((val: any) => {
|
|
36
|
+
if (val === undefined || val === null) return undefined;
|
|
37
|
+
if (Array.isArray(val)) return val;
|
|
38
|
+
return [val];
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
const normalizedValueProp = React.useMemo(
|
|
42
|
+
() => normalizeValue(valueProp),
|
|
43
|
+
[valueProp, normalizeValue],
|
|
44
|
+
);
|
|
45
|
+
const normalizedDefaultValueProp = React.useMemo(
|
|
46
|
+
() => normalizeValue(defaultValueProp),
|
|
47
|
+
[defaultValueProp, normalizeValue],
|
|
48
|
+
);
|
|
49
|
+
|
|
35
50
|
// Memoized to allow omitting both defaultValue and value, which would
|
|
36
51
|
// otherwise trigger a warning in useControlled.
|
|
37
52
|
const defaultValue = React.useMemo(() => {
|
|
38
53
|
if (valueProp === undefined) {
|
|
39
|
-
return
|
|
54
|
+
return normalizedDefaultValueProp ?? [];
|
|
40
55
|
}
|
|
41
56
|
|
|
42
57
|
return undefined;
|
|
43
|
-
}, [valueProp,
|
|
58
|
+
}, [valueProp, normalizedDefaultValueProp]);
|
|
44
59
|
|
|
45
60
|
const [value, setValue] = useControlled<AccordionValue<Value>>({
|
|
46
|
-
controlled:
|
|
61
|
+
controlled: normalizedValueProp,
|
|
47
62
|
default: defaultValue,
|
|
48
63
|
name: 'Accordion',
|
|
49
64
|
state: 'value',
|
|
@@ -115,16 +130,18 @@ export interface AccordionRootProps<Value = any>
|
|
|
115
130
|
extends Omit<ZestUIComponentProps<typeof View, AccordionRootState<Value>>, 'value'> {
|
|
116
131
|
/**
|
|
117
132
|
* The controlled value of the item(s) that should be expanded.
|
|
133
|
+
* Accepts a single value or an array of values.
|
|
118
134
|
*
|
|
119
135
|
* To render an uncontrolled accordion, use the `defaultValue` prop instead.
|
|
120
136
|
*/
|
|
121
|
-
value?: AccordionValue<Value> | undefined;
|
|
137
|
+
value?: Value | AccordionValue<Value> | undefined;
|
|
122
138
|
/**
|
|
123
139
|
* The uncontrolled value of the item(s) that should be initially expanded.
|
|
140
|
+
* Accepts a single value or an array of values.
|
|
124
141
|
*
|
|
125
142
|
* To render a controlled accordion, use the `value` prop instead.
|
|
126
143
|
*/
|
|
127
|
-
defaultValue?: AccordionValue<Value> | undefined;
|
|
144
|
+
defaultValue?: Value | AccordionValue<Value> | undefined;
|
|
128
145
|
/**
|
|
129
146
|
* Whether the component should ignore user interaction.
|
|
130
147
|
* @default false
|
|
@@ -14,7 +14,10 @@ export function AvatarRoot(componentProps: AvatarRoot.Props) {
|
|
|
14
14
|
|
|
15
15
|
const [imageLoadingStatus, setImageLoadingStatus] = React.useState<ImageLoadingStatus>('idle');
|
|
16
16
|
|
|
17
|
-
const state: AvatarRootState =
|
|
17
|
+
const state: AvatarRootState = React.useMemo(
|
|
18
|
+
() => ({ imageLoadingStatus }),
|
|
19
|
+
[imageLoadingStatus],
|
|
20
|
+
);
|
|
18
21
|
|
|
19
22
|
const contextValue: AvatarRootContext = React.useMemo(
|
|
20
23
|
() => ({ imageLoadingStatus, setImageLoadingStatus }),
|
package/src/button/Button.tsx
CHANGED
|
@@ -19,7 +19,10 @@ export function Button(componentProps: Button.Props) {
|
|
|
19
19
|
|
|
20
20
|
const { getButtonProps } = useButton({ disabled });
|
|
21
21
|
|
|
22
|
-
const state: ButtonState =
|
|
22
|
+
const state: ButtonState = React.useMemo(
|
|
23
|
+
() => ({ disabled, pressed }),
|
|
24
|
+
[disabled, pressed],
|
|
25
|
+
);
|
|
23
26
|
|
|
24
27
|
return useRenderElement(Pressable, componentProps, {
|
|
25
28
|
state,
|
|
@@ -52,7 +52,10 @@ export function CheckboxGroup(componentProps: CheckboxGroup.Props) {
|
|
|
52
52
|
|
|
53
53
|
const parent = useCheckboxGroupParent({ allValues, value, onValueChange: setValue });
|
|
54
54
|
|
|
55
|
-
const state: CheckboxGroupState =
|
|
55
|
+
const state: CheckboxGroupState = React.useMemo(
|
|
56
|
+
() => ({ disabled }),
|
|
57
|
+
[disabled],
|
|
58
|
+
);
|
|
56
59
|
|
|
57
60
|
const contextValue: CheckboxGroupContext = React.useMemo(
|
|
58
61
|
() => ({
|
|
@@ -35,6 +35,7 @@ export function useCollapsiblePanel(parameters: UseCollapsiblePanelParameters) {
|
|
|
35
35
|
|
|
36
36
|
const handleContentLayout = React.useCallback((event: LayoutChangeEvent) => {
|
|
37
37
|
const { height, width } = event.nativeEvent.layout;
|
|
38
|
+
if (height <= 0) return;
|
|
38
39
|
setDimensions((previous) =>
|
|
39
40
|
previous.height === height && previous.width === width ? previous : { height, width },
|
|
40
41
|
);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { useRenderElement } from '../../use-render/useRenderElement';
|
|
4
4
|
import type { ZestUIComponentProps } from '../../types';
|
|
5
|
+
import type { TransitionStatus } from '../../internals/useTransitionStatus';
|
|
5
6
|
import { useDialogPopupProps } from './useDialogPopupProps';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -11,9 +12,9 @@ import { useDialogPopupProps } from './useDialogPopupProps';
|
|
|
11
12
|
export function DialogPopup(componentProps: DialogPopup.Props) {
|
|
12
13
|
const { render, className, style, ref, ...elementProps } = componentProps;
|
|
13
14
|
|
|
14
|
-
const { open, props } = useDialogPopupProps();
|
|
15
|
+
const { open, transitionStatus, props } = useDialogPopupProps();
|
|
15
16
|
|
|
16
|
-
const state: DialogPopupState = { open };
|
|
17
|
+
const state: DialogPopupState = { open, transitionStatus };
|
|
17
18
|
|
|
18
19
|
return useRenderElement(View, componentProps, {
|
|
19
20
|
state,
|
|
@@ -27,6 +28,11 @@ export interface DialogPopupState {
|
|
|
27
28
|
* Whether the dialog is currently open.
|
|
28
29
|
*/
|
|
29
30
|
open: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The transition status of the dialog: `'starting'` as it opens (auto-clears
|
|
33
|
+
* to `undefined` after one frame), `'ending'` once it is closing.
|
|
34
|
+
*/
|
|
35
|
+
transitionStatus: TransitionStatus;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
export interface DialogPopupProps extends ZestUIComponentProps<typeof View, DialogPopupState> {}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useDialogRootContext } from '../root/DialogRootContext';
|
|
3
3
|
import { useDialogPortalContext } from '../portal/DialogPortalContext';
|
|
4
|
+
import { useDialogTransitionContext } from '../root/DialogTransitionContext';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The state and element props shared by every popup built on the dialog store —
|
|
@@ -9,6 +10,7 @@ import { useDialogPortalContext } from '../portal/DialogPortalContext';
|
|
|
9
10
|
export function useDialogPopupProps() {
|
|
10
11
|
useDialogPortalContext();
|
|
11
12
|
const store = useDialogRootContext();
|
|
13
|
+
const transitionContext = useDialogTransitionContext();
|
|
12
14
|
|
|
13
15
|
const open = store.useState('open');
|
|
14
16
|
const titleElementId = store.useState('titleElementId');
|
|
@@ -18,6 +20,7 @@ export function useDialogPopupProps() {
|
|
|
18
20
|
return {
|
|
19
21
|
store,
|
|
20
22
|
open,
|
|
23
|
+
transitionStatus: transitionContext?.transitionStatus,
|
|
21
24
|
props: {
|
|
22
25
|
role,
|
|
23
26
|
accessibilityViewIsModal: true,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { TransitionStatus } from '../../internals/useTransitionStatus';
|
|
4
|
+
|
|
5
|
+
export interface DialogTransitionContext {
|
|
6
|
+
transitionStatus: TransitionStatus;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const DialogTransitionContext = React.createContext<DialogTransitionContext | undefined>(
|
|
10
|
+
undefined,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export function useDialogTransitionContext() {
|
|
14
|
+
return React.useContext(DialogTransitionContext);
|
|
15
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useRefWithInit } from '../../hooks/useRefWithInit';
|
|
4
|
+
import { useTransitionStatus } from '../../internals/useTransitionStatus';
|
|
4
5
|
import { usePopupRootHandle } from '../../utils/popups/usePopupRootHandle';
|
|
5
6
|
import { DialogStore } from '../store/DialogStore';
|
|
6
7
|
import type { DialogRootProps } from './DialogRoot';
|
|
7
8
|
import { DialogRootContext } from './DialogRootContext';
|
|
9
|
+
import { DialogTransitionContext } from './DialogTransitionContext';
|
|
8
10
|
|
|
9
11
|
export type DialogRootMode = 'dialog' | 'alert-dialog';
|
|
10
12
|
|
|
@@ -53,11 +55,21 @@ export function useRenderDialogRoot<Payload = unknown>(
|
|
|
53
55
|
|
|
54
56
|
usePopupRootHandle({ store, handle, actionsRef });
|
|
55
57
|
|
|
58
|
+
const resolvedOpen = store.useState('open');
|
|
59
|
+
const { transitionStatus } = useTransitionStatus(resolvedOpen, false, true);
|
|
60
|
+
|
|
56
61
|
const payload = store.useState('payload') as Payload;
|
|
57
62
|
|
|
63
|
+
const transitionContextValue = React.useMemo(
|
|
64
|
+
() => ({ transitionStatus }),
|
|
65
|
+
[transitionStatus],
|
|
66
|
+
);
|
|
67
|
+
|
|
58
68
|
return (
|
|
59
69
|
<DialogRootContext.Provider value={store}>
|
|
60
|
-
{
|
|
70
|
+
<DialogTransitionContext.Provider value={transitionContextValue}>
|
|
71
|
+
{typeof children === 'function' ? children(payload) : children}
|
|
72
|
+
</DialogTransitionContext.Provider>
|
|
61
73
|
</DialogRootContext.Provider>
|
|
62
74
|
);
|
|
63
75
|
}
|
|
@@ -6,6 +6,7 @@ import { useDialogPopupProps } from '../../dialog/popup/useDialogPopupProps';
|
|
|
6
6
|
import { useRenderElement } from '../../use-render/useRenderElement';
|
|
7
7
|
import { useStableCallback } from '../../hooks/useStableCallback';
|
|
8
8
|
import type { ZestUIComponentProps } from '../../types';
|
|
9
|
+
import type { TransitionStatus } from '../../internals/useTransitionStatus';
|
|
9
10
|
import { createChangeEventDetails } from '../../utils/createChangeEventDetails';
|
|
10
11
|
import { REASONS } from '../../utils/reasons';
|
|
11
12
|
import { useDrawerRootContext, type DrawerSnapPoint, type DrawerSwipeDirection } from '../root/DrawerRootContext';
|
|
@@ -59,7 +60,7 @@ export function DrawerPopup(componentProps: DrawerPopup.Props) {
|
|
|
59
60
|
setActiveSnapPoint,
|
|
60
61
|
snapToSequentialPoints,
|
|
61
62
|
} = useDrawerSnapPoints();
|
|
62
|
-
const { store, open, props } = useDialogPopupProps();
|
|
63
|
+
const { store, open, transitionStatus, props } = useDialogPopupProps();
|
|
63
64
|
|
|
64
65
|
const [swiping, setSwiping] = React.useState(false);
|
|
65
66
|
const [swipeMovement, setSwipeMovement] = React.useState(0);
|
|
@@ -157,6 +158,7 @@ export function DrawerPopup(componentProps: DrawerPopup.Props) {
|
|
|
157
158
|
|
|
158
159
|
const state: DrawerPopupState = {
|
|
159
160
|
open,
|
|
161
|
+
transitionStatus,
|
|
160
162
|
swiping,
|
|
161
163
|
swipeMovement,
|
|
162
164
|
swipeDirection,
|
|
@@ -192,6 +194,11 @@ export interface DrawerPopupState {
|
|
|
192
194
|
* Whether the drawer is currently open.
|
|
193
195
|
*/
|
|
194
196
|
open: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* The transition status of the drawer: `'starting'` as it opens (auto-clears
|
|
199
|
+
* to `undefined` after one frame), `'ending'` once it is closing.
|
|
200
|
+
*/
|
|
201
|
+
transitionStatus: TransitionStatus;
|
|
195
202
|
/**
|
|
196
203
|
* Whether a swipe is currently in progress.
|
|
197
204
|
*/
|
package/src/input/Input.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { TextInput } from 'react-native';
|
|
3
4
|
import { useRenderElement } from '../use-render/useRenderElement';
|
|
4
5
|
import { useFieldControl } from '../field/control/useFieldControl';
|
|
@@ -32,7 +33,10 @@ export function Input(componentProps: Input.Props) {
|
|
|
32
33
|
requireField: false,
|
|
33
34
|
});
|
|
34
35
|
|
|
35
|
-
const state: Input.State =
|
|
36
|
+
const state: Input.State = React.useMemo(
|
|
37
|
+
() => ({ disabled: field?.disabled ?? false }),
|
|
38
|
+
[field?.disabled],
|
|
39
|
+
);
|
|
36
40
|
|
|
37
41
|
return useRenderElement(TextInput, componentProps, {
|
|
38
42
|
state,
|
|
@@ -26,16 +26,18 @@ export function useTransitionStatus(
|
|
|
26
26
|
);
|
|
27
27
|
const [mounted, setMounted] = React.useState(open);
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
if (open && !mounted) {
|
|
30
|
+
setMounted(true);
|
|
31
|
+
setTransitionStatus('starting');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!open && mounted && transitionStatus !== 'ending' && !deferEndingState) {
|
|
35
|
+
setTransitionStatus('ending');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!open && !mounted && transitionStatus === 'ending') {
|
|
39
|
+
setTransitionStatus(undefined);
|
|
40
|
+
}
|
|
39
41
|
|
|
40
42
|
useIsoLayoutEffect(() => {
|
|
41
43
|
if (!open && mounted && transitionStatus !== 'ending' && deferEndingState) {
|
|
@@ -63,7 +65,7 @@ export function useTransitionStatus(
|
|
|
63
65
|
return () => {
|
|
64
66
|
AnimationFrame.cancel(frame);
|
|
65
67
|
};
|
|
66
|
-
}, [enableIdleState, open]);
|
|
68
|
+
}, [enableIdleState, open, transitionStatus]);
|
|
67
69
|
|
|
68
70
|
useIsoLayoutEffect(() => {
|
|
69
71
|
if (!open || !enableIdleState) {
|