@pautena/react-design-system 1.0.1 → 2.0.0-alpha.1b
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/README.md +6 -6
- package/dist/Drawerx/Drawer.types.d.ts +3 -3
- package/dist/Drawerx/Drawer.types.mjs.map +1 -1
- package/dist/Drawerx/DrawerContent/DrawerContent.mjs +2 -4
- package/dist/Drawerx/DrawerContent/DrawerContent.mjs.map +1 -1
- package/dist/Drawerx/DrawerItem/DrawerItemLink.mjs +23 -23
- package/dist/Drawerx/DrawerItem/DrawerItemLink.mjs.map +1 -1
- package/dist/ListPanel/ListPanel.mjs +8 -8
- package/dist/ListPanel/ListPanel.mjs.map +1 -1
- package/dist/SkeletonGrid/SkeletonGrid.mjs +1 -1
- package/dist/SkeletonGrid/SkeletonGrid.mjs.map +1 -1
- package/dist/ValueItem/ValueItem.mjs.map +1 -1
- package/dist/ValueLabel/ValueLabel.d.ts +3 -7
- package/dist/ValueLabel/ValueLabel.mjs +20 -23
- package/dist/ValueLabel/ValueLabel.mjs.map +1 -1
- package/dist/components/badge/badge.d.ts +21 -0
- package/dist/components/badge/badge.mjs +19 -0
- package/dist/components/badge/badge.mjs.map +1 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/{Bullet/Bullet.d.ts → components/bullet/bullet.d.ts} +3 -4
- package/dist/components/bullet/bullet.mjs +44 -0
- package/dist/components/bullet/bullet.mjs.map +1 -0
- package/dist/components/bullet/index.d.ts +2 -0
- package/dist/components/button/button.d.ts +18 -0
- package/dist/components/button/button.mjs +23 -0
- package/dist/components/button/button.mjs.map +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/ui/badge.d.ts +7 -0
- package/dist/components/ui/badge.mjs +48 -0
- package/dist/components/ui/badge.mjs.map +1 -0
- package/dist/components/ui/button.d.ts +8 -0
- package/dist/components/ui/button.mjs +53 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/global.css +1 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.mjs +133 -128
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/button/Button.mjs +32 -0
- package/dist/node_modules/@base-ui/react/esm/button/Button.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/composite/root/CompositeRootContext.mjs +15 -0
- package/dist/node_modules/@base-ui/react/esm/composite/root/CompositeRootContext.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/merge-props/mergeProps.mjs +83 -0
- package/dist/node_modules/@base-ui/react/esm/merge-props/mergeProps.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/use-button/useButton.mjs +101 -0
- package/dist/node_modules/@base-ui/react/esm/use-button/useButton.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/use-render/useRender.mjs +8 -0
- package/dist/node_modules/@base-ui/react/esm/use-render/useRender.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/utils/getStateAttributesProps.mjs +17 -0
- package/dist/node_modules/@base-ui/react/esm/utils/getStateAttributesProps.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveClassName.mjs +7 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveClassName.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveStyle.mjs +7 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveStyle.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.mjs +25 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.mjs.map +1 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useRenderElement.mjs +64 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useRenderElement.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/empty.mjs +5 -0
- package/dist/node_modules/@base-ui/utils/esm/empty.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/error.mjs +12 -0
- package/dist/node_modules/@base-ui/utils/esm/error.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/formatErrorMessage.mjs +8 -0
- package/dist/node_modules/@base-ui/utils/esm/formatErrorMessage.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/getReactElementRef.mjs +12 -0
- package/dist/node_modules/@base-ui/utils/esm/getReactElementRef.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/mergeObjects.mjs +15 -0
- package/dist/node_modules/@base-ui/utils/esm/mergeObjects.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/reactVersion.mjs +9 -0
- package/dist/node_modules/@base-ui/utils/esm/reactVersion.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/safeReact.mjs +8 -0
- package/dist/node_modules/@base-ui/utils/esm/safeReact.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/useIsoLayoutEffect.mjs +7 -0
- package/dist/node_modules/@base-ui/utils/esm/useIsoLayoutEffect.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/useMergedRefs.mjs +70 -0
- package/dist/node_modules/@base-ui/utils/esm/useMergedRefs.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/useRefWithInit.mjs +10 -0
- package/dist/node_modules/@base-ui/utils/esm/useRefWithInit.mjs.map +1 -0
- package/dist/node_modules/@base-ui/utils/esm/useStableCallback.mjs +33 -0
- package/dist/node_modules/@base-ui/utils/esm/useStableCallback.mjs.map +1 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +15 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs.map +1 -0
- package/dist/node_modules/class-variance-authority/dist/index.mjs +36 -0
- package/dist/node_modules/class-variance-authority/dist/index.mjs.map +1 -0
- package/dist/node_modules/clsx/dist/clsx.mjs +17 -0
- package/dist/node_modules/clsx/dist/clsx.mjs.map +1 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.mjs +2766 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.mjs.map +1 -0
- package/package.json +44 -21
- package/dist/Bullet/Bullet.mjs +0 -24
- package/dist/Bullet/Bullet.mjs.map +0 -1
- package/dist/Bullet/index.d.ts +0 -2
- package/dist/Label/Label.d.ts +0 -35
- package/dist/Label/Label.mjs +0 -61
- package/dist/Label/Label.mjs.map +0 -1
- package/dist/Label/index.d.ts +0 -2
package/dist/index.mjs
CHANGED
|
@@ -1,139 +1,144 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ConfirmDialog as
|
|
6
|
-
import { Content as
|
|
7
|
-
import { ContentPlaceholder as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { default as
|
|
18
|
-
import { default as
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { Autocomplete as i } from "./Autocomplete/Autocomplete.mjs";
|
|
3
|
+
import { Board as d } from "./Board/Board.mjs";
|
|
4
|
+
import { BootstrapDialog as C } from "./BootstrapDialog/BootstrapDialog.mjs";
|
|
5
|
+
import { ConfirmDialog as b } from "./ConfirmDialog/ConfirmDialog.mjs";
|
|
6
|
+
import { Content as g } from "./Content/Content.mjs";
|
|
7
|
+
import { ContentPlaceholder as V } from "./ContentPlaceholder/ContentPlaceholder.mjs";
|
|
8
|
+
import { Badge as B } from "./components/badge/badge.mjs";
|
|
9
|
+
import { Bullet as h, bulletClasses as L } from "./components/bullet/bullet.mjs";
|
|
10
|
+
import { Button as S } from "./components/button/button.mjs";
|
|
11
|
+
import { Button as R, buttonVariants as k } from "./components/ui/button.mjs";
|
|
12
|
+
import { DateRangeCalendar as N } from "./DateRangeCalendar/DateRangeCalendar.mjs";
|
|
13
|
+
import { DateRangePicker as H } from "./DateRangePicker/DateRangePicker.mjs";
|
|
14
|
+
import { useDialog as G } from "./Dialog/UseDialog.mjs";
|
|
15
|
+
import { default as M, DrawerHeader as U } from "./Drawerx/Drawer/Drawer.mjs";
|
|
16
|
+
import { getDrawerItemColors as z } from "./Drawerx/Drawer.types.mjs";
|
|
17
|
+
import { default as Q } from "./Drawerx/DrawerAppBar/DrawerAppBar.mjs";
|
|
18
|
+
import { default as q } from "./Drawerx/DrawerContent/DrawerContent.mjs";
|
|
19
|
+
import { DrawerContext as K, UndefinedProvider as X, useDrawer as Y } from "./Drawerx/DrawerContext/DrawerContext.mjs";
|
|
20
|
+
import { default as _ } from "./Drawerx/DrawerMain/DrawerMain.mjs";
|
|
21
|
+
import { default as ee } from "./Drawerx/DrawerSubheader/DrawerSubheader.mjs";
|
|
22
|
+
import { default as oe } from "./Drawerx/DrawerLayout/DrawerLayout.mjs";
|
|
23
|
+
import { default as ae } from "./ExpandableAlert/ExpandableAlert.mjs";
|
|
24
|
+
import { FormDialog as fe } from "./FormDialog/FormDialog.mjs";
|
|
25
|
+
import { GroupValueCard as xe } from "./GroupValueCard/GroupValueCard.mjs";
|
|
26
|
+
import { Header as ne } from "./Header/Header.mjs";
|
|
27
|
+
import { HeaderSubtitle as ue } from "./Header/header-title.mjs";
|
|
28
|
+
import { HeaderLayout as se } from "./HeaderLayout/HeaderLayout.mjs";
|
|
29
|
+
import { ListPanel as De } from "./ListPanel/ListPanel.mjs";
|
|
30
|
+
import { ListPanelContext as Pe, ListPanelContextProvider as ge, useListPanel as we } from "./ListPanel/ListPanel.context.mjs";
|
|
31
|
+
import { markdownMuiOptions as ce } from "./Markdown/Markdown.mjs";
|
|
32
|
+
import { NotificationCenterContext as Te, NotificationCenterProviderUndefinedError as he, useNotificationCenter as Le } from "./NotificationCenter/NotificationCenter.context.mjs";
|
|
33
|
+
import { useNotifyWhenValueChanges as Se } from "./NotificationCenter/NotificationCenter.hooks.mjs";
|
|
34
|
+
import { NotificationCenterProvider as Re } from "./NotificationCenter/NotificationCenter.provider.mjs";
|
|
35
|
+
import { Placeholder as ye } from "./Placeholder/Placeholder.mjs";
|
|
33
36
|
import "react/jsx-runtime";
|
|
34
37
|
import "@mui/material/Alert";
|
|
35
38
|
import "@mui/material/AlertTitle";
|
|
36
39
|
import "@mui/material/Box";
|
|
37
40
|
import "@mui/material/CircularProgress";
|
|
38
41
|
import "@mui/material/LinearProgress";
|
|
39
|
-
import { RemoteDataTable as
|
|
40
|
-
import { useRemoteDataTable as
|
|
41
|
-
import { Select as
|
|
42
|
-
import { SkeletonCard as
|
|
43
|
-
import { SkeletonGrid as
|
|
44
|
-
import { TabCard as
|
|
42
|
+
import { RemoteDataTable as Ae } from "./RemoteDataTable/RemoteDataTable.mjs";
|
|
43
|
+
import { useRemoteDataTable as Fe } from "./RemoteDataTable/use-remote-data-table.mjs";
|
|
44
|
+
import { Select as Ee } from "./Select/Select.mjs";
|
|
45
|
+
import { SkeletonCard as Ue } from "./SkeletonCard/SkeletonCard.mjs";
|
|
46
|
+
import { SkeletonGrid as ze } from "./SkeletonGrid/SkeletonGrid.mjs";
|
|
47
|
+
import { TabCard as Qe } from "./TabCard/TabCard.mjs";
|
|
45
48
|
import "react";
|
|
46
49
|
import "./TabCard/TabCard.context.mjs";
|
|
47
|
-
import { TabPanel as
|
|
48
|
-
import { TabContext as
|
|
49
|
-
import { TabProvider as
|
|
50
|
-
import { TextField as
|
|
51
|
-
import { getRandomItem as
|
|
52
|
-
import { newBreakpointsCounter as
|
|
53
|
-
import { getFormData as
|
|
54
|
-
import { useGetDefaultThemeColor as
|
|
55
|
-
import { DefaultPlaceholder as
|
|
56
|
-
import { ValueBoolean as
|
|
57
|
-
import { ValueCard as
|
|
58
|
-
import { ValueContent as
|
|
59
|
-
import { ValueDatetime as
|
|
60
|
-
import { ValueImage as
|
|
61
|
-
import { default as
|
|
62
|
-
import { ValueLabel as
|
|
63
|
-
import { ValueRating as
|
|
64
|
-
import { ValueText as
|
|
65
|
-
import { buildQuerySpecParams as
|
|
50
|
+
import { TabPanel as qe } from "./TabPanel/TabPanel.mjs";
|
|
51
|
+
import { TabContext as Ke, TabContextProvider as Xe, useTab as Ye } from "./TabProvider/TabProvider.context.mjs";
|
|
52
|
+
import { TabProvider as _e } from "./TabProvider/TabProvider.provider.mjs";
|
|
53
|
+
import { TextField as er } from "./TextField/TextField.mjs";
|
|
54
|
+
import { getRandomItem as or, newArrayWithSize as tr } from "./utils/arrays.mjs";
|
|
55
|
+
import { newBreakpointsCounter as mr } from "./utils/breakpoints.mjs";
|
|
56
|
+
import { getFormData as pr } from "./utils/forms.mjs";
|
|
57
|
+
import { useGetDefaultThemeColor as lr } from "./utils/theme.mjs";
|
|
58
|
+
import { DefaultPlaceholder as ir } from "./ValueBase/ValueDisplays.types.mjs";
|
|
59
|
+
import { ValueBoolean as dr } from "./ValueBoolean/ValueBoolean.mjs";
|
|
60
|
+
import { ValueCard as Cr } from "./ValueCard/ValueCard.mjs";
|
|
61
|
+
import { ValueContent as br, getValueContentLabelId as Pr } from "./ValueContent/ValueContent.mjs";
|
|
62
|
+
import { ValueDatetime as wr } from "./ValueDatetime/ValueDatetime.mjs";
|
|
63
|
+
import { ValueImage as cr } from "./ValueImage/ValueImage.mjs";
|
|
64
|
+
import { default as Tr, valueItemClasses as hr } from "./ValueItem/ValueItem.mjs";
|
|
65
|
+
import { ValueLabel as vr } from "./ValueLabel/ValueLabel.mjs";
|
|
66
|
+
import { ValueRating as Ir } from "./ValueRating/ValueRating.mjs";
|
|
67
|
+
import { ValueText as kr } from "./ValueText/ValueText.mjs";
|
|
68
|
+
import { buildQuerySpecParams as Nr } from "./RemoteDataTable/query-spec-utils.mjs";
|
|
66
69
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
_ as
|
|
87
|
-
ee as
|
|
88
|
-
|
|
89
|
-
fe as
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Qe as
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Cr as
|
|
114
|
-
br as
|
|
115
|
-
|
|
116
|
-
cr as
|
|
117
|
-
|
|
118
|
-
vr as
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
70
|
+
i as Autocomplete,
|
|
71
|
+
B as Badge,
|
|
72
|
+
R as BaseButton,
|
|
73
|
+
d as Board,
|
|
74
|
+
C as BootstrapDialog,
|
|
75
|
+
h as Bullet,
|
|
76
|
+
S as Button,
|
|
77
|
+
b as ConfirmDialog,
|
|
78
|
+
g as Content,
|
|
79
|
+
V as ContentPlaceholder,
|
|
80
|
+
N as DateRangeCalendar,
|
|
81
|
+
H as DateRangePicker,
|
|
82
|
+
ir as DefaultPlaceholder,
|
|
83
|
+
M as Drawer,
|
|
84
|
+
Q as DrawerAppBar,
|
|
85
|
+
q as DrawerContent,
|
|
86
|
+
K as DrawerContext,
|
|
87
|
+
U as DrawerHeader,
|
|
88
|
+
oe as DrawerLayout,
|
|
89
|
+
_ as DrawerMain,
|
|
90
|
+
ee as DrawerSubheader,
|
|
91
|
+
ae as ExpandableAlert,
|
|
92
|
+
fe as FormDialog,
|
|
93
|
+
xe as GroupValueCard,
|
|
94
|
+
ne as Header,
|
|
95
|
+
se as HeaderLayout,
|
|
96
|
+
ue as HeaderSubtitle,
|
|
97
|
+
De as ListPanel,
|
|
98
|
+
Pe as ListPanelContext,
|
|
99
|
+
ge as ListPanelContextProvider,
|
|
100
|
+
Te as NotificationCenterContext,
|
|
101
|
+
Re as NotificationCenterProvider,
|
|
102
|
+
he as NotificationCenterProviderUndefinedError,
|
|
103
|
+
ye as Placeholder,
|
|
104
|
+
Ae as RemoteDataTable,
|
|
105
|
+
Ee as Select,
|
|
106
|
+
Ue as SkeletonCard,
|
|
107
|
+
ze as SkeletonGrid,
|
|
108
|
+
Qe as TabCard,
|
|
109
|
+
Ke as TabContext,
|
|
110
|
+
Xe as TabContextProvider,
|
|
111
|
+
qe as TabPanel,
|
|
112
|
+
_e as TabProvider,
|
|
113
|
+
er as TextField,
|
|
114
|
+
X as UndefinedProvider,
|
|
115
|
+
dr as ValueBoolean,
|
|
116
|
+
Cr as ValueCard,
|
|
117
|
+
br as ValueContent,
|
|
118
|
+
wr as ValueDatetime,
|
|
119
|
+
cr as ValueImage,
|
|
120
|
+
Tr as ValueItem,
|
|
121
|
+
vr as ValueLabel,
|
|
122
|
+
Ir as ValueRating,
|
|
123
|
+
kr as ValueText,
|
|
124
|
+
Nr as buildQuerySpecParams,
|
|
125
|
+
L as bulletClasses,
|
|
126
|
+
k as buttonVariants,
|
|
127
|
+
z as getDrawerItemColors,
|
|
128
|
+
pr as getFormData,
|
|
129
|
+
or as getRandomItem,
|
|
130
|
+
Pr as getValueContentLabelId,
|
|
131
|
+
ce as markdownMuiOptions,
|
|
132
|
+
tr as newArrayWithSize,
|
|
133
|
+
mr as newBreakpointsCounter,
|
|
134
|
+
G as useDialog,
|
|
135
|
+
Y as useDrawer,
|
|
136
|
+
lr as useGetDefaultThemeColor,
|
|
137
|
+
we as useListPanel,
|
|
138
|
+
Le as useNotificationCenter,
|
|
139
|
+
Se as useNotifyWhenValueChanges,
|
|
140
|
+
Fe as useRemoteDataTable,
|
|
141
|
+
Ye as useTab,
|
|
142
|
+
hr as valueItemClasses
|
|
138
143
|
};
|
|
139
144
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/lib/utils.ts"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"names":["cn","inputs","twMerge","clsx"],"mappings":";;AAGO,SAASA,KAAMC,GAAsB;AAC1C,SAAOC,EAAQC,EAAKF,CAAM,CAAC;AAC7B;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
import { useButton as i } from "../use-button/useButton.mjs";
|
|
3
|
+
import { useRenderElement as c } from "../utils/useRenderElement.mjs";
|
|
4
|
+
const l = /* @__PURE__ */ f.forwardRef(function(t, o) {
|
|
5
|
+
const {
|
|
6
|
+
render: p,
|
|
7
|
+
className: d,
|
|
8
|
+
disabled: e = !1,
|
|
9
|
+
focusableWhenDisabled: n = !1,
|
|
10
|
+
nativeButton: s = !0,
|
|
11
|
+
...r
|
|
12
|
+
} = t, {
|
|
13
|
+
getButtonProps: a,
|
|
14
|
+
buttonRef: u
|
|
15
|
+
} = i({
|
|
16
|
+
disabled: e,
|
|
17
|
+
focusableWhenDisabled: n,
|
|
18
|
+
native: s
|
|
19
|
+
});
|
|
20
|
+
return c("button", t, {
|
|
21
|
+
state: {
|
|
22
|
+
disabled: e
|
|
23
|
+
},
|
|
24
|
+
ref: [o, u],
|
|
25
|
+
props: [r, a]
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
process.env.NODE_ENV !== "production" && (l.displayName = "Button");
|
|
29
|
+
export {
|
|
30
|
+
l as Button
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=Button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../../../../../node_modules/@base-ui/react/esm/button/Button.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButton } from \"../use-button/useButton.js\";\nimport { useRenderElement } from \"../utils/useRenderElement.js\";\n/**\n * A button component that can be used to trigger actions.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Button](https://base-ui.com/react/components/button)\n */\nexport const Button = /*#__PURE__*/React.forwardRef(function Button(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled = false,\n focusableWhenDisabled = false,\n nativeButton = true,\n ...elementProps\n } = componentProps;\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled,\n native: nativeButton\n });\n const state = {\n disabled\n };\n return useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef],\n props: [elementProps, getButtonProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") Button.displayName = \"Button\";"],"names":["Button","React","componentProps","forwardedRef","render","className","disabled","focusableWhenDisabled","nativeButton","elementProps","getButtonProps","buttonRef","useButton","useRenderElement"],"mappings":";;;AAWY,MAACA,IAAsB,gBAAAC,EAAM,WAAW,SAAgBC,GAAgBC,GAAc;AAChG,QAAM;AAAA,IACJ,QAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,uBAAAC,IAAwB;AAAA,IACxB,cAAAC,IAAe;AAAA,IACf,GAAGC;AAAA,EACP,IAAMP,GACE;AAAA,IACJ,gBAAAQ;AAAA,IACA,WAAAC;AAAA,EACJ,IAAMC,EAAU;AAAA,IACZ,UAAAN;AAAA,IACA,uBAAAC;AAAA,IACA,QAAQC;AAAA,EACZ,CAAG;AAID,SAAOK,EAAiB,UAAUX,GAAgB;AAAA,IAChD,OAJY;AAAA,MACZ,UAAAI;AAAA,IACJ;AAAA,IAGI,KAAK,CAACH,GAAcQ,CAAS;AAAA,IAC7B,OAAO,CAACF,GAAcC,CAAc;AAAA,EACxC,CAAG;AACH,CAAC;AACG,QAAQ,IAAI,aAAa,iBAAcV,EAAO,cAAc;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import n from "../../../../utils/esm/formatErrorMessage.mjs";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
const e = /* @__PURE__ */ t.createContext(void 0);
|
|
4
|
+
process.env.NODE_ENV !== "production" && (e.displayName = "CompositeRootContext");
|
|
5
|
+
function r(s = !1) {
|
|
6
|
+
const o = t.useContext(e);
|
|
7
|
+
if (o === void 0 && !s)
|
|
8
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : n(16));
|
|
9
|
+
return o;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
e as CompositeRootContext,
|
|
13
|
+
r as useCompositeRootContext
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=CompositeRootContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompositeRootContext.mjs","sources":["../../../../../../../node_modules/@base-ui/react/esm/composite/root/CompositeRootContext.js"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const CompositeRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") CompositeRootContext.displayName = \"CompositeRootContext\";\nexport function useCompositeRootContext(optional = false) {\n const context = React.useContext(CompositeRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.' : _formatErrorMessage(16));\n }\n return context;\n}"],"names":["CompositeRootContext","React","useCompositeRootContext","optional","context","_formatErrorMessage"],"mappings":";;AAIY,MAACA,IAAoC,gBAAAC,EAAM,cAAc,MAAS;AAC1E,QAAQ,IAAI,aAAa,iBAAcD,EAAqB,cAAc;AACvE,SAASE,EAAwBC,IAAW,IAAO;AACxD,QAAMC,IAAUH,EAAM,WAAWD,CAAoB;AACrD,MAAII,MAAY,UAAa,CAACD;AAC5B,UAAM,IAAI,MAAM,QAAQ,IAAI,aAAa,eAAe,sGAAsGE,EAAoB,EAAE,CAAC;AAEvL,SAAOD;AACT;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { mergeObjects as a } from "../../../utils/esm/mergeObjects.mjs";
|
|
2
|
+
const u = {};
|
|
3
|
+
function g(t, n, e, r, c) {
|
|
4
|
+
let f = {
|
|
5
|
+
...o(t, u)
|
|
6
|
+
};
|
|
7
|
+
return n && (f = i(f, n)), e && (f = i(f, e)), r && (f = i(f, r)), f;
|
|
8
|
+
}
|
|
9
|
+
function h(t) {
|
|
10
|
+
if (t.length === 0)
|
|
11
|
+
return u;
|
|
12
|
+
if (t.length === 1)
|
|
13
|
+
return o(t[0], u);
|
|
14
|
+
let n = {
|
|
15
|
+
...o(t[0], u)
|
|
16
|
+
};
|
|
17
|
+
for (let e = 1; e < t.length; e += 1)
|
|
18
|
+
n = i(n, t[e]);
|
|
19
|
+
return n;
|
|
20
|
+
}
|
|
21
|
+
function i(t, n) {
|
|
22
|
+
return l(n) ? n(t) : s(t, n);
|
|
23
|
+
}
|
|
24
|
+
function s(t, n) {
|
|
25
|
+
if (!n)
|
|
26
|
+
return t;
|
|
27
|
+
for (const e in n) {
|
|
28
|
+
const r = n[e];
|
|
29
|
+
switch (e) {
|
|
30
|
+
case "style": {
|
|
31
|
+
t[e] = a(t.style, r);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "className": {
|
|
35
|
+
t[e] = I(t.className, r);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
default:
|
|
39
|
+
b(e, r) ? t[e] = E(t[e], r) : t[e] = r;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return t;
|
|
43
|
+
}
|
|
44
|
+
function b(t, n) {
|
|
45
|
+
const e = t.charCodeAt(0), r = t.charCodeAt(1), c = t.charCodeAt(2);
|
|
46
|
+
return e === 111 && r === 110 && c >= 65 && c <= 90 && (typeof n == "function" || typeof n > "u");
|
|
47
|
+
}
|
|
48
|
+
function l(t) {
|
|
49
|
+
return typeof t == "function";
|
|
50
|
+
}
|
|
51
|
+
function o(t, n) {
|
|
52
|
+
return l(t) ? t(n) : t ?? u;
|
|
53
|
+
}
|
|
54
|
+
function E(t, n) {
|
|
55
|
+
return n ? t ? (e) => {
|
|
56
|
+
if (v(e)) {
|
|
57
|
+
const c = e;
|
|
58
|
+
y(c);
|
|
59
|
+
const f = n(c);
|
|
60
|
+
return c.baseUIHandlerPrevented || t?.(c), f;
|
|
61
|
+
}
|
|
62
|
+
const r = n(e);
|
|
63
|
+
return t?.(e), r;
|
|
64
|
+
} : n : t;
|
|
65
|
+
}
|
|
66
|
+
function y(t) {
|
|
67
|
+
return t.preventBaseUIHandler = () => {
|
|
68
|
+
t.baseUIHandlerPrevented = !0;
|
|
69
|
+
}, t;
|
|
70
|
+
}
|
|
71
|
+
function I(t, n) {
|
|
72
|
+
return n ? t ? n + " " + t : n : t;
|
|
73
|
+
}
|
|
74
|
+
function v(t) {
|
|
75
|
+
return t != null && typeof t == "object" && "nativeEvent" in t;
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
y as makeEventPreventable,
|
|
79
|
+
I as mergeClassNames,
|
|
80
|
+
g as mergeProps,
|
|
81
|
+
h as mergePropsN
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=mergeProps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeProps.mjs","sources":["../../../../../../node_modules/@base-ui/react/esm/merge-props/mergeProps.js"],"sourcesContent":["import { mergeObjects } from '@base-ui/utils/mergeObjects';\nconst EMPTY_PROPS = {};\n\n/* eslint-disable id-denylist */\n/**\n * Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object's fields overwrite\n * the conflicting ones from others. This doesn't apply to event handlers, `className` and `style` props.\n *\n * Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last).\n * For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing\n * by calling `event.preventBaseUIHandler()`. For non-synthetic events (custom events with primitive/object values),\n * all handlers always execute without prevention capability.\n *\n * The `className` prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).\n * The `style` prop is merged with rightmost styles overwriting the prior ones.\n *\n * Props can either be provided as objects or as functions that take the previous props as an argument.\n * The function will receive the merged props up to that point (going from left to right):\n * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.\n * The function is responsible for chaining event handlers if needed (i.e. we don't run the merge logic).\n *\n * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.\n * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.\n *\n * @important **`ref` is not merged.**\n * @param a Props object to merge.\n * @param b Props object to merge. The function will overwrite conflicting props from `a`.\n * @param c Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param d Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param e Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @returns The merged props.\n * @public\n */\n\nexport function mergeProps(a, b, c, d, e) {\n // We need to mutably own `merged`\n let merged = {\n ...resolvePropsGetter(a, EMPTY_PROPS)\n };\n if (b) {\n merged = mergeOne(merged, b);\n }\n if (c) {\n merged = mergeOne(merged, c);\n }\n if (d) {\n merged = mergeOne(merged, d);\n }\n if (e) {\n merged = mergeOne(merged, e);\n }\n return merged;\n}\n/* eslint-enable id-denylist */\n\n/**\n * Merges an arbitrary number of React props using the same logic as {@link mergeProps}.\n * This function accepts an array of props instead of individual arguments.\n *\n * This has slightly lower performance than {@link mergeProps} due to accepting an array\n * instead of a fixed number of arguments. Prefer {@link mergeProps} when merging 5 or\n * fewer prop sets for better performance.\n *\n * @param props Array of props to merge.\n * @returns The merged props.\n * @see mergeProps\n * @public\n */\nexport function mergePropsN(props) {\n if (props.length === 0) {\n return EMPTY_PROPS;\n }\n if (props.length === 1) {\n return resolvePropsGetter(props[0], EMPTY_PROPS);\n }\n\n // We need to mutably own `merged`\n let merged = {\n ...resolvePropsGetter(props[0], EMPTY_PROPS)\n };\n for (let i = 1; i < props.length; i += 1) {\n merged = mergeOne(merged, props[i]);\n }\n return merged;\n}\nfunction mergeOne(merged, inputProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(merged);\n }\n return mutablyMergeInto(merged, inputProps);\n}\n\n/**\n * Merges two sets of props. In case of conflicts, the external props take precedence.\n */\nfunction mutablyMergeInto(mergedProps, externalProps) {\n if (!externalProps) {\n return mergedProps;\n }\n\n // eslint-disable-next-line guard-for-in\n for (const propName in externalProps) {\n const externalPropValue = externalProps[propName];\n switch (propName) {\n case 'style':\n {\n mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);\n break;\n }\n case 'className':\n {\n mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);\n break;\n }\n default:\n {\n if (isEventHandler(propName, externalPropValue)) {\n mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);\n } else {\n mergedProps[propName] = externalPropValue;\n }\n }\n }\n }\n return mergedProps;\n}\nfunction isEventHandler(key, value) {\n // This approach is more efficient than using a regex.\n const code0 = key.charCodeAt(0);\n const code1 = key.charCodeAt(1);\n const code2 = key.charCodeAt(2);\n return code0 === 111 /* o */ && code1 === 110 /* n */ && code2 >= 65 /* A */ && code2 <= 90 /* Z */ && (typeof value === 'function' || typeof value === 'undefined');\n}\nfunction isPropsGetter(inputProps) {\n return typeof inputProps === 'function';\n}\nfunction resolvePropsGetter(inputProps, previousProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(previousProps);\n }\n return inputProps ?? EMPTY_PROPS;\n}\nfunction mergeEventHandlers(ourHandler, theirHandler) {\n if (!theirHandler) {\n return ourHandler;\n }\n if (!ourHandler) {\n return theirHandler;\n }\n return event => {\n if (isSyntheticEvent(event)) {\n const baseUIEvent = event;\n makeEventPreventable(baseUIEvent);\n const result = theirHandler(baseUIEvent);\n if (!baseUIEvent.baseUIHandlerPrevented) {\n ourHandler?.(baseUIEvent);\n }\n return result;\n }\n const result = theirHandler(event);\n ourHandler?.(event);\n return result;\n };\n}\nexport function makeEventPreventable(event) {\n event.preventBaseUIHandler = () => {\n event.baseUIHandlerPrevented = true;\n };\n return event;\n}\nexport function mergeClassNames(ourClassName, theirClassName) {\n if (theirClassName) {\n if (ourClassName) {\n // eslint-disable-next-line prefer-template\n return theirClassName + ' ' + ourClassName;\n }\n return theirClassName;\n }\n return ourClassName;\n}\nfunction isSyntheticEvent(event) {\n return event != null && typeof event === 'object' && 'nativeEvent' in event;\n}"],"names":["EMPTY_PROPS","mergeProps","a","b","c","d","e","merged","resolvePropsGetter","mergeOne","mergePropsN","props","i","inputProps","isPropsGetter","mutablyMergeInto","mergedProps","externalProps","propName","externalPropValue","mergeObjects","mergeClassNames","isEventHandler","mergeEventHandlers","key","value","code0","code1","code2","previousProps","ourHandler","theirHandler","event","isSyntheticEvent","baseUIEvent","makeEventPreventable","result","ourClassName","theirClassName"],"mappings":"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","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { isHTMLElement as U } from "../../../../@floating-ui/utils/dist/floating-ui.utils.dom.mjs";
|
|
3
|
+
import { useStableCallback as m } from "../../../utils/esm/useStableCallback.mjs";
|
|
4
|
+
import { error as b } from "../../../utils/esm/error.mjs";
|
|
5
|
+
import { SafeReact as h } from "../../../utils/esm/safeReact.mjs";
|
|
6
|
+
import { useIsoLayoutEffect as K } from "../../../utils/esm/useIsoLayoutEffect.mjs";
|
|
7
|
+
import { useCompositeRootContext as N } from "../composite/root/CompositeRootContext.mjs";
|
|
8
|
+
import { useFocusableWhenDisabled as R } from "../utils/useFocusableWhenDisabled.mjs";
|
|
9
|
+
import { mergeProps as T, makeEventPreventable as g } from "../merge-props/mergeProps.mjs";
|
|
10
|
+
function F(s = {}) {
|
|
11
|
+
const {
|
|
12
|
+
disabled: n = !1,
|
|
13
|
+
focusableWhenDisabled: k,
|
|
14
|
+
tabIndex: D = 0,
|
|
15
|
+
native: o = !0
|
|
16
|
+
} = s, a = u.useRef(null), c = N(!0) !== void 0, p = m(() => {
|
|
17
|
+
const t = a.current;
|
|
18
|
+
return !!(t?.tagName === "A" && t?.href);
|
|
19
|
+
}), {
|
|
20
|
+
props: i
|
|
21
|
+
} = R({
|
|
22
|
+
focusableWhenDisabled: k,
|
|
23
|
+
disabled: n,
|
|
24
|
+
composite: c,
|
|
25
|
+
tabIndex: D,
|
|
26
|
+
isNativeButton: o
|
|
27
|
+
});
|
|
28
|
+
process.env.NODE_ENV !== "production" && u.useEffect(() => {
|
|
29
|
+
if (!a.current)
|
|
30
|
+
return;
|
|
31
|
+
const t = a.current.tagName === "BUTTON";
|
|
32
|
+
if (o) {
|
|
33
|
+
if (!t) {
|
|
34
|
+
const r = h.captureOwnerStack?.() || "";
|
|
35
|
+
b(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${r}`);
|
|
36
|
+
}
|
|
37
|
+
} else if (t) {
|
|
38
|
+
const r = h.captureOwnerStack?.() || "";
|
|
39
|
+
b(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${r}`);
|
|
40
|
+
}
|
|
41
|
+
}, [o]);
|
|
42
|
+
const l = u.useCallback(() => {
|
|
43
|
+
const t = a.current;
|
|
44
|
+
S(t) && c && n && i.disabled === void 0 && t.disabled && (t.disabled = !1);
|
|
45
|
+
}, [n, i.disabled, c]);
|
|
46
|
+
K(l, [l]);
|
|
47
|
+
const w = u.useCallback((t = {}) => {
|
|
48
|
+
const {
|
|
49
|
+
onClick: r,
|
|
50
|
+
onMouseDown: f,
|
|
51
|
+
onKeyUp: B,
|
|
52
|
+
onKeyDown: x,
|
|
53
|
+
onPointerDown: C,
|
|
54
|
+
...E
|
|
55
|
+
} = t;
|
|
56
|
+
return T({
|
|
57
|
+
type: o ? "button" : void 0,
|
|
58
|
+
onClick(e) {
|
|
59
|
+
if (n) {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
r?.(e);
|
|
64
|
+
},
|
|
65
|
+
onMouseDown(e) {
|
|
66
|
+
n || f?.(e);
|
|
67
|
+
},
|
|
68
|
+
onKeyDown(e) {
|
|
69
|
+
if (n || (g(e), x?.(e)), e.baseUIHandlerPrevented)
|
|
70
|
+
return;
|
|
71
|
+
const O = e.target === e.currentTarget && !o && !p() && !n, d = e.key === "Enter", P = e.key === " ";
|
|
72
|
+
O && ((P || d) && e.preventDefault(), d && r?.(e));
|
|
73
|
+
},
|
|
74
|
+
onKeyUp(e) {
|
|
75
|
+
n || (g(e), B?.(e)), !e.baseUIHandlerPrevented && e.target === e.currentTarget && !o && !n && e.key === " " && r?.(e);
|
|
76
|
+
},
|
|
77
|
+
onPointerDown(e) {
|
|
78
|
+
if (n) {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
C?.(e);
|
|
83
|
+
}
|
|
84
|
+
}, o ? void 0 : {
|
|
85
|
+
role: "button"
|
|
86
|
+
}, i, E);
|
|
87
|
+
}, [n, i, o, p]), y = m((t) => {
|
|
88
|
+
a.current = t, l();
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
getButtonProps: w,
|
|
92
|
+
buttonRef: y
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function S(s) {
|
|
96
|
+
return U(s) && s.tagName === "BUTTON";
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
F as useButton
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=useButton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useButton.mjs","sources":["../../../../../../node_modules/@base-ui/react/esm/use-button/useButton.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { error } from '@base-ui/utils/error';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { makeEventPreventable, mergeProps } from \"../merge-props/index.js\";\nimport { useCompositeRootContext } from \"../composite/root/CompositeRootContext.js\";\nimport { useFocusableWhenDisabled } from \"../utils/useFocusableWhenDisabled.js\";\nexport function useButton(parameters = {}) {\n const {\n disabled = false,\n focusableWhenDisabled,\n tabIndex = 0,\n native: isNativeButton = true\n } = parameters;\n const elementRef = React.useRef(null);\n const isCompositeItem = useCompositeRootContext(true) !== undefined;\n const isValidLink = useStableCallback(() => {\n const element = elementRef.current;\n return Boolean(element?.tagName === 'A' && element?.href);\n });\n const {\n props: focusableWhenDisabledProps\n } = useFocusableWhenDisabled({\n focusableWhenDisabled,\n disabled,\n composite: isCompositeItem,\n tabIndex,\n isNativeButton\n });\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n const isButtonTag = elementRef.current.tagName === 'BUTTON';\n if (isNativeButton) {\n if (!isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a native <button> because the ' + '`nativeButton` prop is true. Rendering a non-<button> removes native button ' + 'semantics, which can impact forms and accessibility. Use a real <button> in the ' + '`render` prop, or set `nativeButton` to `false`.';\n error(`${message}${ownerStackMessage}`);\n }\n } else if (isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a non-<button> because the `nativeButton` ' + 'prop is false. Rendering a <button> keeps native behavior while Base UI applies ' + 'non-native attributes and handlers, which can add unintended extra attributes (such ' + 'as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set ' + '`nativeButton` to `true`.';\n error(`${message}${ownerStackMessage}`);\n }\n }, [isNativeButton]);\n }\n\n // handles a disabled composite button rendering another button, e.g.\n // <Toolbar.Button disabled render={<Menu.Trigger />} />\n // the `disabled` prop needs to pass through 2 `useButton`s then finally\n // delete the `disabled` attribute from DOM\n const updateDisabled = React.useCallback(() => {\n const element = elementRef.current;\n if (!isButtonElement(element)) {\n return;\n }\n if (isCompositeItem && disabled && focusableWhenDisabledProps.disabled === undefined && element.disabled) {\n element.disabled = false;\n }\n }, [disabled, focusableWhenDisabledProps.disabled, isCompositeItem]);\n useIsoLayoutEffect(updateDisabled, [updateDisabled]);\n const getButtonProps = React.useCallback((externalProps = {}) => {\n const {\n onClick: externalOnClick,\n onMouseDown: externalOnMouseDown,\n onKeyUp: externalOnKeyUp,\n onKeyDown: externalOnKeyDown,\n onPointerDown: externalOnPointerDown,\n ...otherExternalProps\n } = externalProps;\n const type = isNativeButton ? 'button' : undefined;\n return mergeProps({\n type,\n onClick(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnClick?.(event);\n },\n onMouseDown(event) {\n if (!disabled) {\n externalOnMouseDown?.(event);\n }\n },\n onKeyDown(event) {\n if (!disabled) {\n makeEventPreventable(event);\n externalOnKeyDown?.(event);\n }\n if (event.baseUIHandlerPrevented) {\n return;\n }\n const shouldClick = event.target === event.currentTarget && !isNativeButton && !isValidLink() && !disabled;\n const isEnterKey = event.key === 'Enter';\n const isSpaceKey = event.key === ' ';\n\n // Keyboard accessibility for non interactive elements\n if (shouldClick) {\n if (isSpaceKey || isEnterKey) {\n event.preventDefault();\n }\n if (isEnterKey) {\n externalOnClick?.(event);\n }\n }\n },\n onKeyUp(event) {\n // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed\n // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0\n // Keyboard accessibility for non interactive elements\n if (!disabled) {\n makeEventPreventable(event);\n externalOnKeyUp?.(event);\n }\n if (event.baseUIHandlerPrevented) {\n return;\n }\n if (event.target === event.currentTarget && !isNativeButton && !disabled && event.key === ' ') {\n externalOnClick?.(event);\n }\n },\n onPointerDown(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnPointerDown?.(event);\n }\n }, !isNativeButton ? {\n role: 'button'\n } : undefined, focusableWhenDisabledProps, otherExternalProps);\n }, [disabled, focusableWhenDisabledProps, isNativeButton, isValidLink]);\n const buttonRef = useStableCallback(element => {\n elementRef.current = element;\n updateDisabled();\n });\n return {\n getButtonProps,\n buttonRef\n };\n}\nfunction isButtonElement(elem) {\n return isHTMLElement(elem) && elem.tagName === 'BUTTON';\n}"],"names":["useButton","parameters","disabled","focusableWhenDisabled","tabIndex","isNativeButton","elementRef","React","isCompositeItem","useCompositeRootContext","isValidLink","useStableCallback","element","focusableWhenDisabledProps","useFocusableWhenDisabled","isButtonTag","ownerStackMessage","SafeReact","error","updateDisabled","isButtonElement","useIsoLayoutEffect","getButtonProps","externalProps","externalOnClick","externalOnMouseDown","externalOnKeyUp","externalOnKeyDown","externalOnPointerDown","otherExternalProps","mergeProps","event","makeEventPreventable","shouldClick","isEnterKey","isSpaceKey","buttonRef","elem","isHTMLElement"],"mappings":"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","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRender.mjs","sources":["../../../../../../node_modules/@base-ui/react/esm/use-render/useRender.js"],"sourcesContent":["import { useRenderElement } from \"../utils/useRenderElement.js\";\n/**\n * Renders a Base UI element.\n *\n * @public\n */\nexport function useRender(params) {\n return useRenderElement(params.defaultTagName ?? 'div', params, params);\n}"],"names":["useRender","params","useRenderElement"],"mappings":";AAMO,SAASA,EAAUC,GAAQ;AAChC,SAAOC,EAAiBD,EAAO,kBAAkB,OAAOA,GAAQA,CAAM;AACxE;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function i(r, n) {
|
|
2
|
+
const o = {};
|
|
3
|
+
for (const t in r) {
|
|
4
|
+
const e = r[t];
|
|
5
|
+
if (n?.hasOwnProperty(t)) {
|
|
6
|
+
const s = n[t](e);
|
|
7
|
+
s != null && Object.assign(o, s);
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
e === !0 ? o[`data-${t.toLowerCase()}`] = "" : e && (o[`data-${t.toLowerCase()}`] = e.toString());
|
|
11
|
+
}
|
|
12
|
+
return o;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
i as getStateAttributesProps
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=getStateAttributesProps.mjs.map
|