@jamsrui/tabs 0.0.12 → 0.0.14

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/dist/index.d.mts CHANGED
@@ -1,13 +1,22 @@
1
- export { Tab } from './tab.mjs';
2
- export { T as Tabs } from './tabs-BlJagjtc.mjs';
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Tab } from './tab.mjs';
4
+ import { TabIndicator } from './tab-indicator.mjs';
5
+ import { TabList } from './tab-list.mjs';
6
+ import { TabPanel } from './tab-panel.mjs';
7
+ import { T as Tabs$1 } from './tabs-DgVVpbTS.mjs';
3
8
  export { TabsConfig, useTabsConfig } from './tabs-config.mjs';
4
- import 'react';
5
9
  import '@jamsrui/utils';
6
- import 'react/jsx-runtime';
7
- import './styles.mjs';
8
- import './tab-content.mjs';
9
- import './tab-cursor.mjs';
10
10
  import 'motion/react';
11
- import './tab-list.mjs';
12
- import './tab-panel.mjs';
11
+ import './styles.mjs';
13
12
  import '@jamsrui/core';
13
+
14
+ declare const Tabs: ((props: Tabs$1.Props) => react_jsx_runtime.JSX.Element) & {
15
+ Root: (props: Tabs$1.Props) => react_jsx_runtime.JSX.Element;
16
+ List: (props: TabList.Props) => react_jsx_runtime.JSX.Element;
17
+ Tab: (props: Tab.Props) => react_jsx_runtime.JSX.Element;
18
+ Panel: (props: TabPanel.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
19
+ Indicator: (props: TabIndicator.Props) => react_jsx_runtime.JSX.Element | null;
20
+ };
21
+
22
+ export { Tab, TabIndicator, TabList, TabPanel, Tabs };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{a as f}from"./chunk-HEQQLVV2.mjs";import"./chunk-A4TFE4ZB.mjs";import"./chunk-NMCFI34B.mjs";import"./chunk-H3BKXKOX.mjs";import"./chunk-MW5NNZLH.mjs";import{a as o}from"./chunk-ADOEZWRQ.mjs";import"./chunk-LA2JMAFM.mjs";import"./chunk-HKWZIGYP.mjs";import"./chunk-KOJBJNDN.mjs";import"./chunk-M6FSPJQJ.mjs";import{a as e,b as r}from"./chunk-MUQ2LZD2.mjs";export{o as Tab,f as Tabs,e as TabsConfig,r as useTabsConfig};
1
+ import{Tab as o}from"./tab.mjs";import{TabIndicator as a}from"./tab-indicator.mjs";import{TabList as r}from"./tab-list.mjs";import{TabPanel as t}from"./tab-panel.mjs";import{Tabs as i}from"./tabs.mjs";import{TabsConfig as c,useTabsConfig as g}from"./tabs-config.mjs";const n=Object.assign(i,{Root:i,List:r,Tab:o,Panel:t,Indicator:a});export{o as Tab,a as TabIndicator,r as TabList,t as TabPanel,n as Tabs,c as TabsConfig,g as useTabsConfig};
package/dist/styles.d.mts CHANGED
@@ -4,19 +4,20 @@ import { VariantProps } from '@jamsrui/utils';
4
4
  declare const tabsVariant: _jamsrui_utils.TVReturnType<{
5
5
  variant: {
6
6
  solid: {
7
- cursor: string;
7
+ list: string;
8
+ indicator: string;
8
9
  };
9
10
  light: {
10
- tabList: string;
11
- cursor: string;
11
+ list: string;
12
+ indicator: string;
12
13
  };
13
14
  underlined: {
14
- tabList: string;
15
- cursor: string;
15
+ list: string;
16
+ indicator: string;
16
17
  };
17
18
  bordered: {
18
- tabList: string;
19
- cursor: string;
19
+ list: string;
20
+ indicator: string;
20
21
  };
21
22
  };
22
23
  color: {
@@ -29,62 +30,57 @@ declare const tabsVariant: _jamsrui_utils.TVReturnType<{
29
30
  };
30
31
  size: {
31
32
  sm: {
32
- tabList: string;
33
+ list: string;
33
34
  tab: string;
34
- cursor: string;
35
+ indicator: string;
35
36
  };
36
37
  md: {
37
- tabList: string;
38
+ list: string;
38
39
  tab: string;
39
- cursor: string;
40
+ indicator: string;
40
41
  };
41
42
  lg: {
42
- tabList: string;
43
+ list: string;
43
44
  tab: string;
44
- cursor: string;
45
+ indicator: string;
45
46
  };
46
47
  };
47
48
  radius: {
48
49
  none: {
49
- tabList: string;
50
+ list: string;
50
51
  tab: string;
51
- cursor: string;
52
+ indicator: string;
52
53
  };
53
54
  sm: {
54
- tabList: string;
55
+ list: string;
55
56
  tab: string;
56
- cursor: string;
57
+ indicator: string;
57
58
  };
58
59
  md: {
59
- tabList: string;
60
+ list: string;
60
61
  tab: string;
61
- cursor: string;
62
+ indicator: string;
62
63
  };
63
64
  lg: {
64
- tabList: string;
65
+ list: string;
65
66
  tab: string;
66
- cursor: string;
67
+ indicator: string;
67
68
  };
68
69
  xl: {
69
- tabList: string;
70
+ list: string;
70
71
  tab: string;
71
- cursor: string;
72
+ indicator: string;
72
73
  };
73
74
  full: {
74
- tabList: string;
75
+ list: string;
75
76
  tab: string;
76
- cursor: string;
77
+ indicator: string;
77
78
  };
78
79
  };
79
80
  fullWidth: {
80
81
  true: {
81
82
  root: string;
82
- tabList: string;
83
- };
84
- };
85
- isDisabled: {
86
- true: {
87
- tabList: string;
83
+ list: string;
88
84
  };
89
85
  };
90
86
  disableAnimation: {
@@ -93,45 +89,29 @@ declare const tabsVariant: _jamsrui_utils.TVReturnType<{
93
89
  tabContent: string;
94
90
  };
95
91
  };
96
- placement: {
97
- top: {};
98
- start: {
99
- tabList: string;
100
- panel: string;
101
- root: string;
102
- };
103
- end: {
104
- tabList: string;
105
- panel: string;
106
- root: string;
107
- };
108
- bottom: {
109
- root: string;
110
- };
111
- };
112
92
  }, {
113
93
  root: string;
114
- tabList: string[];
94
+ list: string[];
115
95
  tab: string[];
116
- tabContent: string[];
117
- cursor: string[];
96
+ indicator: string[];
118
97
  panel: string[];
119
98
  }, undefined, {
120
99
  variant: {
121
100
  solid: {
122
- cursor: string;
101
+ list: string;
102
+ indicator: string;
123
103
  };
124
104
  light: {
125
- tabList: string;
126
- cursor: string;
105
+ list: string;
106
+ indicator: string;
127
107
  };
128
108
  underlined: {
129
- tabList: string;
130
- cursor: string;
109
+ list: string;
110
+ indicator: string;
131
111
  };
132
112
  bordered: {
133
- tabList: string;
134
- cursor: string;
113
+ list: string;
114
+ indicator: string;
135
115
  };
136
116
  };
137
117
  color: {
@@ -144,62 +124,57 @@ declare const tabsVariant: _jamsrui_utils.TVReturnType<{
144
124
  };
145
125
  size: {
146
126
  sm: {
147
- tabList: string;
127
+ list: string;
148
128
  tab: string;
149
- cursor: string;
129
+ indicator: string;
150
130
  };
151
131
  md: {
152
- tabList: string;
132
+ list: string;
153
133
  tab: string;
154
- cursor: string;
134
+ indicator: string;
155
135
  };
156
136
  lg: {
157
- tabList: string;
137
+ list: string;
158
138
  tab: string;
159
- cursor: string;
139
+ indicator: string;
160
140
  };
161
141
  };
162
142
  radius: {
163
143
  none: {
164
- tabList: string;
144
+ list: string;
165
145
  tab: string;
166
- cursor: string;
146
+ indicator: string;
167
147
  };
168
148
  sm: {
169
- tabList: string;
149
+ list: string;
170
150
  tab: string;
171
- cursor: string;
151
+ indicator: string;
172
152
  };
173
153
  md: {
174
- tabList: string;
154
+ list: string;
175
155
  tab: string;
176
- cursor: string;
156
+ indicator: string;
177
157
  };
178
158
  lg: {
179
- tabList: string;
159
+ list: string;
180
160
  tab: string;
181
- cursor: string;
161
+ indicator: string;
182
162
  };
183
163
  xl: {
184
- tabList: string;
164
+ list: string;
185
165
  tab: string;
186
- cursor: string;
166
+ indicator: string;
187
167
  };
188
168
  full: {
189
- tabList: string;
169
+ list: string;
190
170
  tab: string;
191
- cursor: string;
171
+ indicator: string;
192
172
  };
193
173
  };
194
174
  fullWidth: {
195
175
  true: {
196
176
  root: string;
197
- tabList: string;
198
- };
199
- };
200
- isDisabled: {
201
- true: {
202
- tabList: string;
177
+ list: string;
203
178
  };
204
179
  };
205
180
  disableAnimation: {
@@ -208,45 +183,29 @@ declare const tabsVariant: _jamsrui_utils.TVReturnType<{
208
183
  tabContent: string;
209
184
  };
210
185
  };
211
- placement: {
212
- top: {};
213
- start: {
214
- tabList: string;
215
- panel: string;
216
- root: string;
217
- };
218
- end: {
219
- tabList: string;
220
- panel: string;
221
- root: string;
222
- };
223
- bottom: {
224
- root: string;
225
- };
226
- };
227
186
  }, {
228
187
  root: string;
229
- tabList: string[];
188
+ list: string[];
230
189
  tab: string[];
231
- tabContent: string[];
232
- cursor: string[];
190
+ indicator: string[];
233
191
  panel: string[];
234
192
  }, _jamsrui_utils.TVReturnType<{
235
193
  variant: {
236
194
  solid: {
237
- cursor: string;
195
+ list: string;
196
+ indicator: string;
238
197
  };
239
198
  light: {
240
- tabList: string;
241
- cursor: string;
199
+ list: string;
200
+ indicator: string;
242
201
  };
243
202
  underlined: {
244
- tabList: string;
245
- cursor: string;
203
+ list: string;
204
+ indicator: string;
246
205
  };
247
206
  bordered: {
248
- tabList: string;
249
- cursor: string;
207
+ list: string;
208
+ indicator: string;
250
209
  };
251
210
  };
252
211
  color: {
@@ -259,62 +218,57 @@ declare const tabsVariant: _jamsrui_utils.TVReturnType<{
259
218
  };
260
219
  size: {
261
220
  sm: {
262
- tabList: string;
221
+ list: string;
263
222
  tab: string;
264
- cursor: string;
223
+ indicator: string;
265
224
  };
266
225
  md: {
267
- tabList: string;
226
+ list: string;
268
227
  tab: string;
269
- cursor: string;
228
+ indicator: string;
270
229
  };
271
230
  lg: {
272
- tabList: string;
231
+ list: string;
273
232
  tab: string;
274
- cursor: string;
233
+ indicator: string;
275
234
  };
276
235
  };
277
236
  radius: {
278
237
  none: {
279
- tabList: string;
238
+ list: string;
280
239
  tab: string;
281
- cursor: string;
240
+ indicator: string;
282
241
  };
283
242
  sm: {
284
- tabList: string;
243
+ list: string;
285
244
  tab: string;
286
- cursor: string;
245
+ indicator: string;
287
246
  };
288
247
  md: {
289
- tabList: string;
248
+ list: string;
290
249
  tab: string;
291
- cursor: string;
250
+ indicator: string;
292
251
  };
293
252
  lg: {
294
- tabList: string;
253
+ list: string;
295
254
  tab: string;
296
- cursor: string;
255
+ indicator: string;
297
256
  };
298
257
  xl: {
299
- tabList: string;
258
+ list: string;
300
259
  tab: string;
301
- cursor: string;
260
+ indicator: string;
302
261
  };
303
262
  full: {
304
- tabList: string;
263
+ list: string;
305
264
  tab: string;
306
- cursor: string;
265
+ indicator: string;
307
266
  };
308
267
  };
309
268
  fullWidth: {
310
269
  true: {
311
270
  root: string;
312
- tabList: string;
313
- };
314
- };
315
- isDisabled: {
316
- true: {
317
- tabList: string;
271
+ list: string;
318
272
  };
319
273
  };
320
274
  disableAnimation: {
@@ -323,31 +277,14 @@ declare const tabsVariant: _jamsrui_utils.TVReturnType<{
323
277
  tabContent: string;
324
278
  };
325
279
  };
326
- placement: {
327
- top: {};
328
- start: {
329
- tabList: string;
330
- panel: string;
331
- root: string;
332
- };
333
- end: {
334
- tabList: string;
335
- panel: string;
336
- root: string;
337
- };
338
- bottom: {
339
- root: string;
340
- };
341
- };
342
280
  }, {
343
281
  root: string;
344
- tabList: string[];
282
+ list: string[];
345
283
  tab: string[];
346
- tabContent: string[];
347
- cursor: string[];
284
+ indicator: string[];
348
285
  panel: string[];
349
286
  }, undefined, unknown, unknown, undefined>>;
350
- type TabVariants = VariantProps<typeof tabsVariant>;
287
+ type TabsVariants = VariantProps<typeof tabsVariant>;
351
288
  type TabsSlots = keyof ReturnType<typeof tabsVariant>;
352
289
 
353
- export { type TabVariants, type TabsSlots, tabsVariant };
290
+ export { type TabsSlots, type TabsVariants, tabsVariant };
package/dist/styles.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-NMCFI34B.mjs";export{a as tabsVariant};
1
+ import{colorVariants as e,dataFocusVisibleClasses as t,focusVisibleClasses as r,tv as a}from"@jamsrui/utils";const o=a({slots:{root:"",list:["inline-flex","p-1","h-fit","gap-2","items-center","flex-nowrap","overflow-x-auto","scrollbar-hide","max-w-full overflow-auto"],tab:["z-0 text-foreground-secondary","w-full","px-3","py-1","flex flex-row items-center justify-center gap-2","relative","outline-none","cursor-default","transition-opacity","tap-highlight-transparent","disabled:cursor-not-allowed","disabled:opacity-30","data-selected:text-foreground",...r],indicator:["absolute","-z-1","bg-white"],panel:["py-3","px-1","outline-none",...t]},variants:{variant:{solid:{list:"bg-background-secondary",indicator:"inset-0"},light:{list:"bg-transparent",indicator:"inset-0"},underlined:{list:"bg-transparent",indicator:"bottom-0 h-[2px] w-4/5 shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]"},bordered:{list:"border border-divider bg-transparent shadow-sm",indicator:"inset-0"}},color:{default:{},primary:{},secondary:{},success:{},warning:{},danger:{}},size:{sm:{list:"rounded-xl",tab:"h-7 rounded text-xs",indicator:"rounded"},md:{list:"rounded-xl",tab:"h-8 rounded text-sm",indicator:"rounded-md"},lg:{list:"rounded-lg",tab:"h-9 rounded-xl text-base",indicator:"rounded-xl"}},radius:{none:{list:"rounded-none",tab:"rounded-none",indicator:"rounded-none"},sm:{list:"rounded",tab:"rounded",indicator:"rounded"},md:{list:"rounded-md",tab:"rounded-md",indicator:"rounded-md"},lg:{list:"rounded-lg",tab:"rounded-lg",indicator:"rounded-lg"},xl:{list:"rounded-xl",tab:"rounded-xl",indicator:"rounded-xl"},full:{list:"rounded-full",tab:"rounded-full",indicator:"rounded-full"}},fullWidth:{true:{root:"w-full",list:"w-full"}},disableAnimation:{true:{tab:"transition-none",tabContent:"transition-none"}}},compoundVariants:[{variant:["solid","bordered","light"],color:"default",className:{indicator:["bg-background","dark:bg-default","shadow-sm"],tabContent:"uig-selected:text-default-foreground"}},{variant:["solid","bordered","light"],color:"primary",className:{indicator:e.solid.primary,tabContent:"uig-selected:text-primary-foreground"}},{variant:["solid","bordered","light"],color:"secondary",className:{indicator:e.solid.secondary,tabContent:"uig-selected:text-secondary-foreground"}},{variant:["solid","bordered","light"],color:"success",className:{indicator:e.solid.success,tabContent:"uig-selected:text-success-foreground"}},{variant:["solid","bordered","light"],color:"warning",className:{indicator:e.solid.warning,tabContent:"uig-selected:text-warning-foreground"}},{variant:["solid","bordered","light"],color:"danger",className:{indicator:e.solid.danger,tabContent:"uig-selected:text-danger-foreground"}},{variant:"underlined",color:"default",className:{indicator:"bg-foreground",tabContent:"uig-selected:text-foreground"}},{variant:"underlined",color:"primary",className:{indicator:"bg-primary",tabContent:"uig-selected:text-primary"}},{variant:"underlined",color:"secondary",className:{indicator:"bg-secondary",tabContent:"uig-selected:text-secondary"}},{variant:"underlined",color:"success",className:{indicator:"bg-success",tabContent:"uig-selected:text-success"}},{variant:"underlined",color:"warning",className:{indicator:"bg-warning",tabContent:"uig-selected:text-warning"}},{variant:"underlined",color:"danger",className:{indicator:"bg-danger",tabContent:"uig-selected:text-danger"}}],defaultVariants:{color:"default",variant:"solid",size:"md",fullWidth:!1}});export{o as tabsVariant};
@@ -0,0 +1,11 @@
1
+ import * as react from 'react';
2
+
3
+ declare const useTabContext: () => TabContext.Type;
4
+ declare const TabContext: react.Context<TabContext.Type | null>;
5
+ declare namespace TabContext {
6
+ interface Type {
7
+ isActive: boolean;
8
+ }
9
+ }
10
+
11
+ export { TabContext, useTabContext };
@@ -0,0 +1 @@
1
+ import{createContext as e,use as o}from"react";const n=e(null),a=()=>{const t=o(n);if(!t)throw new Error("useTabContext must be used within a TabContext");return t};export{n as TabContext,a as useTabContext};
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { MotionProps } from 'motion/react';
3
3
 
4
- declare const TabCursor: (props: TabCursor.Props) => react_jsx_runtime.JSX.Element;
5
- declare namespace TabCursor {
4
+ declare const TabIndicator: (props: TabIndicator.Props) => react_jsx_runtime.JSX.Element | null;
5
+ declare namespace TabIndicator {
6
6
  interface Props extends MotionProps, Omit<React.HTMLAttributes<HTMLDivElement>, keyof MotionProps> {
7
7
  }
8
8
  }
9
9
 
10
- export { TabCursor };
10
+ export { TabIndicator };
@@ -0,0 +1 @@
1
+ "use client";import{jsx as s}from"react/jsx-runtime";import{motion as e}from"motion/react";import{useTabsContext as i}from"./tabs-context.mjs";import{useTabContext as n}from"./tab-context.mjs";const m=o=>{const{getIndicatorProps:t}=i(),{isActive:r}=n();return r?s(e.div,{...t(o)}):null};export{m as TabIndicator};
package/dist/tab-list.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-H3BKXKOX.mjs";import"./chunk-M6FSPJQJ.mjs";export{a as TabList};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{useId as s}from"react";import{useRenderElement as p}from"@jamsrui/hooks";import{LayoutGroup as i}from"motion/react";import{useTabsContext as m}from"./tabs-context.mjs";const f=o=>{const{getTabListProps:t}=m(),r=p("div",{props:[t(o)]}),e=s();return n(i,{id:e,children:r})};export{f as TabList};
@@ -1,9 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { UIProps } from '@jamsrui/utils';
3
3
 
4
- declare const TabPanel: (props: TabPanel.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
4
+ declare const TabPanel: (props: TabPanel.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
5
5
  declare namespace TabPanel {
6
6
  interface Props extends UIProps<"div"> {
7
+ value: React.ReactNode;
7
8
  }
8
9
  }
9
10
 
@@ -1 +1 @@
1
- import{a}from"./chunk-MW5NNZLH.mjs";import"./chunk-M6FSPJQJ.mjs";export{a as TabPanel};
1
+ "use client";import{useRenderElement as s}from"@jamsrui/hooks";import{useTabsContext as l}from"./tabs-context.mjs";const c=e=>{const{value:t}=e,{getPanelProps:r,value:n}=l(),o=n===t,a=s("div",{props:[r(e),{}]});return o?a:null};export{c as TabPanel};
package/dist/tab.d.mts CHANGED
@@ -1,11 +1,10 @@
1
- import * as react from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { UIProps } from '@jamsrui/utils';
3
3
 
4
- declare const Tab: (props: Tab.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
4
+ declare const Tab: (props: Tab.Props) => react_jsx_runtime.JSX.Element;
5
5
  declare namespace Tab {
6
6
  interface Props extends UIProps<"button"> {
7
7
  value: string;
8
- heading: React.ReactNode;
9
8
  }
10
9
  }
11
10
 
package/dist/tab.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-ADOEZWRQ.mjs";import"./chunk-LA2JMAFM.mjs";import"./chunk-HKWZIGYP.mjs";import"./chunk-KOJBJNDN.mjs";import"./chunk-M6FSPJQJ.mjs";export{a as Tab};
1
+ "use client";import{jsx as b}from"react/jsx-runtime";import{useRenderElement as p}from"@jamsrui/hooks";import{useTabsContext as m}from"./tabs-context.mjs";import{useTab as c}from"./use-tab.mjs";import{dataAttr as i}from"@jamsrui/utils";import{TabContext as l}from"./tab-context.mjs";const P=t=>{const{getTabProps:o}=m(),{value:r,...n}=o(t),{handleClick:s,isActive:e}=c({value:r}),a=p("button",{props:[n,{onClick:s,"data-selected":i(e)}]});return b(l,{value:{isActive:e},children:a})};export{P as Tab};
@@ -1,38 +1,27 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ReactElement } from 'react';
4
- import { PropGetter, UIProps, SlotsToClassNames } from '@jamsrui/utils';
5
- import { TabVariants, TabsSlots } from './styles.mjs';
3
+ import { PropGetter, UIProps } from '@jamsrui/utils';
4
+ import { TabsVariants } from './styles.mjs';
6
5
  import { Tab } from './tab.mjs';
7
- import { TabContent } from './tab-content.mjs';
8
- import { TabCursor } from './tab-cursor.mjs';
6
+ import { TabIndicator } from './tab-indicator.mjs';
9
7
  import { TabList } from './tab-list.mjs';
10
8
  import { TabPanel } from './tab-panel.mjs';
11
9
 
12
10
  declare const useTabs: (props: useTabs.Props) => {
13
11
  getRootProps: PropGetter<Tabs.Props>;
14
12
  getTabListProps: PropGetter<TabList.Props>;
15
- getContentProps: PropGetter<TabContent.Props>;
16
13
  getTabProps: PropGetter<Tab.Props>;
17
- getCursorProps: PropGetter<TabCursor.Props>;
14
+ getIndicatorProps: PropGetter<TabIndicator.Props>;
18
15
  value: string;
19
16
  setValue: react.Dispatch<react.SetStateAction<string>>;
20
- selectedTabContent: ReactElement<unknown, string | react.JSXElementConstructor<any>>;
21
17
  getPanelProps: PropGetter<TabPanel.Props>;
22
18
  };
23
19
  declare namespace useTabs {
24
- interface Props extends UIProps<"div">, TabVariants {
20
+ interface Props extends UIProps<"div">, TabsVariants {
25
21
  defaultValue?: string;
26
22
  value?: string;
27
23
  onValueChange?: (value: string) => void;
28
- slotProps?: {
29
- tab?: Tab.Props;
30
- tabList?: TabList.Props;
31
- tabContent?: TabContent.Props;
32
- cursor?: TabCursor.Props;
33
- tabPanel?: TabPanel.Props;
34
- };
35
- classNames?: SlotsToClassNames<TabsSlots>;
24
+ disabled?: boolean;
36
25
  }
37
26
  }
38
27
 
@@ -1,12 +1,11 @@
1
- import './tab.mjs';
2
- import { T as Tabs } from './tabs-BlJagjtc.mjs';
3
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
2
  import { GlobalConfigProps } from '@jamsrui/core';
3
+ import { T as Tabs } from './tabs-DgVVpbTS.mjs';
5
4
  import 'react';
6
5
  import '@jamsrui/utils';
7
6
  import './styles.mjs';
8
- import './tab-content.mjs';
9
- import './tab-cursor.mjs';
7
+ import './tab.mjs';
8
+ import './tab-indicator.mjs';
10
9
  import 'motion/react';
11
10
  import './tab-list.mjs';
12
11
  import './tab-panel.mjs';
@@ -1 +1 @@
1
- import{a,b}from"./chunk-MUQ2LZD2.mjs";export{a as TabsConfig,b as useTabsConfig};
1
+ "use client";import{createConfigContext as o}from"@jamsrui/utils";const[e,r]=o({displayName:"TabsConfig"});export{e as TabsConfig,r as useTabsConfig};
@@ -1,11 +1,10 @@
1
1
  import * as react from 'react';
2
- import { u as useTabs } from './tabs-BlJagjtc.mjs';
2
+ import { u as useTabs } from './tabs-DgVVpbTS.mjs';
3
3
  import 'react/jsx-runtime';
4
4
  import '@jamsrui/utils';
5
5
  import './styles.mjs';
6
6
  import './tab.mjs';
7
- import './tab-content.mjs';
8
- import './tab-cursor.mjs';
7
+ import './tab-indicator.mjs';
9
8
  import 'motion/react';
10
9
  import './tab-list.mjs';
11
10
  import './tab-panel.mjs';
@@ -1 +1 @@
1
- import{a,b}from"./chunk-M6FSPJQJ.mjs";export{a as TabsContext,b as useTabsContext};
1
+ import{createContext as t,use as o}from"react";const s=t(null),r=()=>{const e=o(s);if(!e)throw new Error("useTabsContext must be used within a TabsContext");return e};export{s as TabsContext,r as useTabsContext};
package/dist/tabs.d.mts CHANGED
@@ -1,11 +1,10 @@
1
1
  import 'react/jsx-runtime';
2
- export { T as Tabs } from './tabs-BlJagjtc.mjs';
2
+ export { T as Tabs } from './tabs-DgVVpbTS.mjs';
3
3
  import 'react';
4
4
  import '@jamsrui/utils';
5
5
  import './styles.mjs';
6
6
  import './tab.mjs';
7
- import './tab-content.mjs';
8
- import './tab-cursor.mjs';
7
+ import './tab-indicator.mjs';
9
8
  import 'motion/react';
10
9
  import './tab-list.mjs';
11
10
  import './tab-panel.mjs';
package/dist/tabs.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-HEQQLVV2.mjs";import"./chunk-A4TFE4ZB.mjs";import"./chunk-NMCFI34B.mjs";import"./chunk-H3BKXKOX.mjs";import"./chunk-MW5NNZLH.mjs";import"./chunk-M6FSPJQJ.mjs";import"./chunk-MUQ2LZD2.mjs";export{a as Tabs};
1
+ "use client";import{jsx as f}from"react/jsx-runtime";import{useRenderElement as p}from"@jamsrui/hooks";import{mergeConfigProps as m}from"@jamsrui/utils";import{useTabsConfig as a}from"./tabs-config.mjs";import{TabsContext as c}from"./tabs-context.mjs";import{useTabs as i}from"./use-tabs.mjs";const P=s=>{const o=a(),r=m(o,o,s),e=i(r),{getRootProps:t}=e,n=p("div",{props:[t({})]});return f(c,{value:e,children:n})};export{P as Tabs};
package/dist/use-tab.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-LA2JMAFM.mjs";import"./chunk-M6FSPJQJ.mjs";export{a as useTab};
1
+ import{useCallback as u,useMemo as n}from"react";import{useTabsContext as c}from"./tabs-context.mjs";const i=o=>{const{value:e}=o,{value:r,setValue:s}=c(),t=u(()=>{s(e)},[s,e]),a=r===e;return n(()=>({isActive:a,handleClick:t}),[t,a])};export{i as useTab};
@@ -2,10 +2,9 @@ import 'react';
2
2
  import '@jamsrui/utils';
3
3
  import './styles.mjs';
4
4
  import './tab.mjs';
5
- import './tab-content.mjs';
6
- import './tab-cursor.mjs';
5
+ import './tab-indicator.mjs';
7
6
  import './tab-list.mjs';
8
7
  import './tab-panel.mjs';
9
- export { u as useTabs } from './tabs-BlJagjtc.mjs';
8
+ export { u as useTabs } from './tabs-DgVVpbTS.mjs';
10
9
  import 'react/jsx-runtime';
11
10
  import 'motion/react';
package/dist/use-tabs.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-A4TFE4ZB.mjs";import"./chunk-NMCFI34B.mjs";export{a as useTabs};
1
+ import{useCallback as e,useMemo as y}from"react";import{useControlledState as V}from"@jamsrui/hooks";import{dataAttrDev as s,mapPropsVariants as v}from"@jamsrui/utils";import{tabsVariant as b}from"./styles.mjs";const x=P=>{const[d,u]=v(P,b.variantKeys),{defaultValue:T,value:f,onValueChange:N,children:g,...o}=d,t=b(u),[r,l]=V({defaultProp:T,onChange:N,prop:f}),p=e(()=>({...o,"data-slot":s("root"),"data-component":s("tabs"),className:t.root({className:o.className}),children:g}),[o,t]),n=e(a=>({...a,"data-slot":s("tab-list"),className:t.list({className:a.className})}),[t]),i=e(a=>({...a,"data-slot":s("tab"),className:t.tab({className:a.className})}),[t]),m=e(a=>({layoutId:"indicator",...a,"data-slot":s("indicator"),className:t.indicator({className:a.className})}),[t]),c=e(a=>({...a,"data-slot":s("tab-panel"),className:t.panel({className:a.className})}),[t]);return y(()=>({getRootProps:p,getTabListProps:n,getTabProps:i,getIndicatorProps:m,value:r,setValue:l,getPanelProps:c}),[m,c,p,n,i,l,r])};export{x as useTabs};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@jamsrui/tabs",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "peerDependencies": {
5
5
  "motion": ">=12",
6
6
  "react": ">=19"
7
7
  },
8
8
  "dependencies": {
9
- "@jamsrui/hooks": "^0.0.12",
10
- "@jamsrui/core": "^0.0.10",
11
- "@jamsrui/utils": "^0.0.12"
9
+ "@jamsrui/core": "^0.0.12",
10
+ "@jamsrui/hooks": "^0.0.14",
11
+ "@jamsrui/utils": "^0.0.14"
12
12
  },
13
13
  "exports": {
14
14
  ".": {
@@ -1 +0,0 @@
1
- import{a as c}from"./chunk-NMCFI34B.mjs";import{Children as E,isValidElement as S,useCallback as n,useMemo as g}from"react";import{useControlledState as x}from"@jamsrui/hooks";import{cn as l,dataAttrDev as r,mapPropsVariants as A,mergeProps as b}from"@jamsrui/utils";var K=L=>{let[V,v]=A(L,c.variantKeys),{defaultValue:G,value:h,onValueChange:R,slotProps:t,classNames:s,children:m,...o}=V,e=c(v),[p,P]=x({defaultProp:G,onChange:R,prop:h}),i=g(()=>{let a=E.toArray(m);return(p?a.find(y=>S(y)?y.props.value===p:null):a[0])?.props.children},[m,p]),u=n(()=>({...o,"data-slot":r("root"),"data-component":r("tabs"),className:e.root({className:l(s?.root,o.className)})}),[s?.root,o,e]),T=n(a=>({...b(t?.tabList,a),"data-slot":r("tab-list"),className:e.tabList({className:l(t?.tabList?.className,s?.tabList,o.className)})}),[s?.tabList,o.className,t?.tabList,e]),N=n(a=>({...b(t?.tabContent,a),"data-slot":r("tab-content"),className:e.tabContent({className:l(t?.tabContent?.className,s?.tabContent,o.className)})}),[s?.tabContent,o.className,t?.tabContent,e]),C=n(a=>({...b(t?.tab,a),"data-slot":r("tab"),className:e.tab({className:l(t?.tab?.className,s?.tab,a.className)})}),[s?.tab,t?.tab,e]),d=n(a=>({layoutId:"cursor",...b(t?.cursor,a),"data-slot":r("cursor"),className:e.cursor({className:l(t?.cursor?.className,s?.cursor,a.className)})}),[s?.cursor,t?.cursor,e]),f=n(a=>({...b(t?.tabContent,a),"data-slot":r("tab-panel"),className:e.panel({className:l(t?.tabPanel?.className,s?.panel,a.className)})}),[s?.panel,t?.tabContent,t?.tabPanel?.className,e]);return g(()=>({getRootProps:u,getTabListProps:T,getContentProps:N,getTabProps:C,getCursorProps:d,value:p,setValue:P,selectedTabContent:i,getPanelProps:f}),[N,d,f,u,T,C,i,P,p])};export{K as a};
@@ -1 +0,0 @@
1
- import{a as r}from"./chunk-LA2JMAFM.mjs";import{a as o}from"./chunk-HKWZIGYP.mjs";import{a as t}from"./chunk-KOJBJNDN.mjs";import{b as e}from"./chunk-M6FSPJQJ.mjs";import{useRenderElement as l}from"@jamsrui/hooks";import{Fragment as b,jsx as n,jsxs as u}from"react/jsx-runtime";var v=s=>{let{getTabProps:p}=e(),{heading:a,value:m,...i}=p(s),{handleClick:c,isActive:d}=r({value:m});return l("button",{props:[i,{onClick:c},{children:u(b,{children:[n(o,{children:a}),!!d&&n(t,{})]})}]})};export{v as a};
@@ -1 +0,0 @@
1
- import{b as o}from"./chunk-M6FSPJQJ.mjs";import{useId as p}from"react";import{useRenderElement as i}from"@jamsrui/hooks";import{LayoutGroup as m}from"motion/react";import{jsx as n}from"react/jsx-runtime";var L=r=>{let{getTabListProps:t}=o(),e=i("div",{props:[t(r)]}),s=p();return n(m,{id:s,children:e})};export{L as a};
@@ -1 +0,0 @@
1
- import{a as i}from"./chunk-A4TFE4ZB.mjs";import{a as n}from"./chunk-H3BKXKOX.mjs";import{a as m}from"./chunk-MW5NNZLH.mjs";import{a as t}from"./chunk-M6FSPJQJ.mjs";import{b as p}from"./chunk-MUQ2LZD2.mjs";import{useRenderElement as d}from"@jamsrui/hooks";import{mergeConfigProps as l}from"@jamsrui/utils";import{Fragment as P,jsx as o,jsxs as g}from"react/jsx-runtime";var R=e=>{let{children:a}=e,r=p(),c=l(r,r,e),s=i(c),{getRootProps:b}=s,f=g(P,{children:[o(n,{children:a}),o(m,{})]}),T=d("div",{props:[b({}),{children:f}]});return o(t,{value:s,children:T})};export{R as a};
@@ -1 +0,0 @@
1
- import{b as e}from"./chunk-M6FSPJQJ.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var m=t=>{let{getContentProps:r}=e();return o("div",{props:[r(t)]})};export{m as a};
@@ -1 +0,0 @@
1
- import{b as o}from"./chunk-M6FSPJQJ.mjs";import{motion as e}from"motion/react";import{jsx as s}from"react/jsx-runtime";var n=r=>{let{getCursorProps:t}=o();return s(e.div,{...t(r)})};export{n as a};
@@ -1 +0,0 @@
1
- import{b as o}from"./chunk-M6FSPJQJ.mjs";import{useCallback as n,useMemo as c}from"react";var i=r=>{let{value:e}=r,{value:u,setValue:s}=o(),t=n(()=>{s(e)},[s,e]),a=u===e;return c(()=>({isActive:a,handleClick:t}),[t,a])};export{i as a};
@@ -1 +0,0 @@
1
- import{createContext as t,use as o}from"react";var s=t(null),r=()=>{let e=o(s);if(!e)throw new Error("useTabsContext must be used within a TabsContext");return e};export{s as a,r as b};
@@ -1 +0,0 @@
1
- import{createConfigContext as o}from"@jamsrui/utils";var[r,a]=o({displayName:"TabsConfig"});export{r as a,a as b};
@@ -1 +0,0 @@
1
- import{b as e}from"./chunk-M6FSPJQJ.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var m=r=>{let{getPanelProps:t,selectedTabContent:n}=e();return o("div",{props:[t(r),{children:n}]})};export{m as a};
@@ -1 +0,0 @@
1
- import{colorVariants as e,dataFocusVisibleClasses as t,focusVisibleClasses as r,tv as o}from"@jamsrui/utils";var n=o({slots:{root:"",tabList:["inline-flex","p-1","h-fit","gap-2","items-center","flex-nowrap","overflow-x-auto","scrollbar-hide","bg-default-100","max-w-full overflow-auto"],tab:["z-0 text-default-500","w-full","px-3","py-1","flex flex-row items-center justify-center gap-2","group","relative","outline-none","cursor-pointer","transition-opacity","tap-highlight-transparent","ui-disabled:cursor-not-allowed","ui-disabled:opacity-30","ui-disabled:text-foreground",...r],tabContent:["relative","z-10","whitespace-nowrap","transition-colors","text-default-500","uig-selected:text-foreground","flex flex-row items-center justify-center gap-2"],cursor:["absolute","-z-1","bg-white"],panel:["py-3","px-1","outline-none","data-[inert=true]:hidden",...t]},variants:{variant:{solid:{cursor:"inset-0"},light:{tabList:"bg-transparent dark:bg-transparent",cursor:"inset-0"},underlined:{tabList:"bg-transparent dark:bg-transparent",cursor:"bottom-0 h-[2px] w-4/5 shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]"},bordered:{tabList:"border-2 border-default-200 bg-transparent shadow-sm dark:bg-transparent",cursor:"inset-0"}},color:{default:{},primary:{},secondary:{},success:{},warning:{},danger:{}},size:{sm:{tabList:"rounded-xl",tab:"h-7 rounded text-xs",cursor:"rounded"},md:{tabList:"rounded-xl",tab:"h-8 rounded text-sm",cursor:"rounded-md"},lg:{tabList:"rounded-lg",tab:"h-9 rounded-xl text-base",cursor:"rounded-xl"}},radius:{none:{tabList:"rounded-none",tab:"rounded-none",cursor:"rounded-none"},sm:{tabList:"rounded",tab:"rounded",cursor:"rounded"},md:{tabList:"rounded-md",tab:"rounded-md",cursor:"rounded-md"},lg:{tabList:"rounded-lg",tab:"rounded-lg",cursor:"rounded-lg"},xl:{tabList:"rounded-xl",tab:"rounded-xl",cursor:"rounded-xl"},full:{tabList:"rounded-full",tab:"rounded-full",cursor:"rounded-full"}},fullWidth:{true:{root:"w-full",tabList:"w-full"}},isDisabled:{true:{tabList:"pointer-events-none opacity-disabled"}},disableAnimation:{true:{tab:"transition-none",tabContent:"transition-none"}},placement:{top:{},start:{tabList:"flex-col",panel:"px-3 py-0",root:"flex"},end:{tabList:"flex-col",panel:"px-3 py-0",root:"flex flex-row-reverse"},bottom:{root:"flex flex-col-reverse"}}},compoundVariants:[{variant:["solid","bordered","light"],color:"default",className:{cursor:["bg-background","dark:bg-default","shadow-sm"],tabContent:"uig-selected:text-default-foreground"}},{variant:["solid","bordered","light"],color:"primary",className:{cursor:e.solid.primary,tabContent:"uig-selected:text-primary-foreground"}},{variant:["solid","bordered","light"],color:"secondary",className:{cursor:e.solid.secondary,tabContent:"uig-selected:text-secondary-foreground"}},{variant:["solid","bordered","light"],color:"success",className:{cursor:e.solid.success,tabContent:"uig-selected:text-success-foreground"}},{variant:["solid","bordered","light"],color:"warning",className:{cursor:e.solid.warning,tabContent:"uig-selected:text-warning-foreground"}},{variant:["solid","bordered","light"],color:"danger",className:{cursor:e.solid.danger,tabContent:"uig-selected:text-danger-foreground"}},{variant:"underlined",color:"default",className:{cursor:"bg-foreground",tabContent:"uig-selected:text-foreground"}},{variant:"underlined",color:"primary",className:{cursor:"bg-primary",tabContent:"uig-selected:text-primary"}},{variant:"underlined",color:"secondary",className:{cursor:"bg-secondary",tabContent:"uig-selected:text-secondary"}},{variant:"underlined",color:"success",className:{cursor:"bg-success",tabContent:"uig-selected:text-success"}},{variant:"underlined",color:"warning",className:{cursor:"bg-warning",tabContent:"uig-selected:text-warning"}},{variant:"underlined",color:"danger",className:{cursor:"bg-danger",tabContent:"uig-selected:text-danger"}}],defaultVariants:{color:"default",variant:"solid",size:"md",fullWidth:!1,isDisabled:!1}});export{n as a};
@@ -1,10 +0,0 @@
1
- import * as react from 'react';
2
- import { UIProps } from '@jamsrui/utils';
3
-
4
- declare const TabContent: (props: TabContent.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
- declare namespace TabContent {
6
- interface Props extends UIProps<"div"> {
7
- }
8
- }
9
-
10
- export { TabContent };
@@ -1 +0,0 @@
1
- import{a}from"./chunk-HKWZIGYP.mjs";import"./chunk-M6FSPJQJ.mjs";export{a as TabContent};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-KOJBJNDN.mjs";import"./chunk-M6FSPJQJ.mjs";export{a as TabCursor};