@lattice-ui/tabs 0.1.1 → 0.3.1
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/LICENSE +7 -0
- package/README.md +5 -5
- package/out/index.d.ts +10 -4
- package/out/init.luau +13 -8
- package/package.json +10 -6
- package/src/Tabs/TabsContent.tsx +0 -65
- package/src/Tabs/TabsList.tsx +0 -29
- package/src/Tabs/TabsRoot.tsx +0 -111
- package/src/Tabs/TabsTrigger.tsx +0 -127
- package/src/Tabs/context.ts +0 -6
- package/src/Tabs/internals/ids.ts +0 -13
- package/src/Tabs/types.ts +0 -50
- package/src/index.ts +0 -13
- package/tsconfig.json +0 -16
- package/tsconfig.typecheck.json +0 -25
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 astra-void
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ Behavior-only Tabs primitives for Roblox UI, aligned with the lattice compound p
|
|
|
4
4
|
|
|
5
5
|
## Exports
|
|
6
6
|
|
|
7
|
-
- `Tabs`
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
7
|
+
- `Tabs`
|
|
8
|
+
- `Tabs.Root`
|
|
9
|
+
- `Tabs.List`
|
|
10
|
+
- `Tabs.Trigger`
|
|
11
|
+
- `Tabs.Content`
|
package/out/index.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { TabsContent } from "./Tabs/TabsContent";
|
|
2
|
+
import { TabsList } from "./Tabs/TabsList";
|
|
3
|
+
import { TabsRoot } from "./Tabs/TabsRoot";
|
|
4
|
+
import { TabsTrigger } from "./Tabs/TabsTrigger";
|
|
5
|
+
export declare const Tabs: {
|
|
6
|
+
readonly Root: typeof TabsRoot;
|
|
7
|
+
readonly List: typeof TabsList;
|
|
8
|
+
readonly Trigger: typeof TabsTrigger;
|
|
9
|
+
readonly Content: typeof TabsContent;
|
|
10
|
+
};
|
|
5
11
|
export type { TabsActivationMode, TabsContentProps, TabsContextValue, TabsListProps, TabsOrientation, TabsProps, TabsTriggerProps, } from "./Tabs/types";
|
package/out/init.luau
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
local
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
local TabsContent = TS.import(script, script, "Tabs", "TabsContent").TabsContent
|
|
4
|
+
local TabsList = TS.import(script, script, "Tabs", "TabsList").TabsList
|
|
5
|
+
local TabsRoot = TS.import(script, script, "Tabs", "TabsRoot").TabsRoot
|
|
6
|
+
local TabsTrigger = TS.import(script, script, "Tabs", "TabsTrigger").TabsTrigger
|
|
7
|
+
local Tabs = {
|
|
8
|
+
Root = TabsRoot,
|
|
9
|
+
List = TabsList,
|
|
10
|
+
Trigger = TabsTrigger,
|
|
11
|
+
Content = TabsContent,
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
Tabs = Tabs,
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lattice-ui/tabs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "out/init.luau",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"out",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
7
11
|
"dependencies": {
|
|
8
|
-
"@lattice-ui/core": "0.
|
|
9
|
-
"@lattice-ui/focus": "0.
|
|
10
|
-
"@lattice-ui/layer": "0.
|
|
12
|
+
"@lattice-ui/core": "0.3.1",
|
|
13
|
+
"@lattice-ui/focus": "0.3.1",
|
|
14
|
+
"@lattice-ui/layer": "0.3.1"
|
|
11
15
|
},
|
|
12
16
|
"devDependencies": {
|
|
13
17
|
"@rbxts/react": "17.3.7-ts.1",
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
},
|
|
20
24
|
"scripts": {
|
|
21
25
|
"build": "rbxtsc -p tsconfig.json",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
26
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
27
|
+
"watch": "rbxtsc -p tsconfig.json -w"
|
|
24
28
|
}
|
|
25
29
|
}
|
package/src/Tabs/TabsContent.tsx
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { React, Slot } from "@lattice-ui/core";
|
|
2
|
-
import { Presence } from "@lattice-ui/layer";
|
|
3
|
-
import { useTabsContext } from "./context";
|
|
4
|
-
import { createTabsContentName } from "./internals/ids";
|
|
5
|
-
import type { TabsContentProps } from "./types";
|
|
6
|
-
|
|
7
|
-
type TabsContentImplProps = {
|
|
8
|
-
visible: boolean;
|
|
9
|
-
value: string;
|
|
10
|
-
asChild?: boolean;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
function TabsContentImpl(props: TabsContentImplProps) {
|
|
15
|
-
const contentName = createTabsContentName(props.value);
|
|
16
|
-
|
|
17
|
-
if (props.asChild) {
|
|
18
|
-
const child = props.children;
|
|
19
|
-
if (!React.isValidElement(child)) {
|
|
20
|
-
error("[TabsContent] `asChild` requires a child element.");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Slot Name={contentName} Visible={props.visible}>
|
|
25
|
-
{child}
|
|
26
|
-
</Slot>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<frame BackgroundTransparency={1} BorderSizePixel={0} Size={UDim2.fromOffset(0, 0)} Visible={props.visible}>
|
|
32
|
-
{props.children}
|
|
33
|
-
</frame>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function TabsContent(props: TabsContentProps) {
|
|
38
|
-
const tabsContext = useTabsContext();
|
|
39
|
-
const selected = tabsContext.value === props.value;
|
|
40
|
-
const forceMount = props.forceMount === true;
|
|
41
|
-
|
|
42
|
-
if (!selected && !forceMount) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (forceMount) {
|
|
47
|
-
return (
|
|
48
|
-
<TabsContentImpl asChild={props.asChild} value={props.value} visible={selected}>
|
|
49
|
-
{props.children}
|
|
50
|
-
</TabsContentImpl>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<Presence
|
|
56
|
-
exitFallbackMs={0}
|
|
57
|
-
present={selected}
|
|
58
|
-
render={(state) => (
|
|
59
|
-
<TabsContentImpl asChild={props.asChild} value={props.value} visible={state.isPresent}>
|
|
60
|
-
{props.children}
|
|
61
|
-
</TabsContentImpl>
|
|
62
|
-
)}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
}
|
package/src/Tabs/TabsList.tsx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { React, Slot } from "@lattice-ui/core";
|
|
2
|
-
import { RovingFocusGroup } from "@lattice-ui/focus";
|
|
3
|
-
import { useTabsContext } from "./context";
|
|
4
|
-
import type { TabsListProps } from "./types";
|
|
5
|
-
|
|
6
|
-
export function TabsList(props: TabsListProps) {
|
|
7
|
-
const tabsContext = useTabsContext();
|
|
8
|
-
|
|
9
|
-
const listNode = props.asChild ? (
|
|
10
|
-
(() => {
|
|
11
|
-
const child = props.children;
|
|
12
|
-
if (!React.isValidElement(child)) {
|
|
13
|
-
error("[TabsList] `asChild` requires a child element.");
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return <Slot>{child}</Slot>;
|
|
17
|
-
})()
|
|
18
|
-
) : (
|
|
19
|
-
<frame BackgroundTransparency={1} BorderSizePixel={0} Size={UDim2.fromOffset(0, 0)}>
|
|
20
|
-
{props.children}
|
|
21
|
-
</frame>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<RovingFocusGroup active autoFocus="none" loop orientation={tabsContext.orientation}>
|
|
26
|
-
{listNode}
|
|
27
|
-
</RovingFocusGroup>
|
|
28
|
-
);
|
|
29
|
-
}
|
package/src/Tabs/TabsRoot.tsx
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { React, useControllableState } from "@lattice-ui/core";
|
|
2
|
-
import { TabsContextProvider } from "./context";
|
|
3
|
-
import type { TabsProps, TabsTriggerRegistration } from "./types";
|
|
4
|
-
|
|
5
|
-
function getOrderedTriggers(triggers: Array<TabsTriggerRegistration>) {
|
|
6
|
-
const ordered = [...triggers];
|
|
7
|
-
ordered.sort((a, b) => a.order < b.order);
|
|
8
|
-
return ordered;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function resolveNextValue(
|
|
12
|
-
currentValue: string | undefined,
|
|
13
|
-
orderedTriggers: Array<TabsTriggerRegistration>,
|
|
14
|
-
fallbackOrder: number | undefined,
|
|
15
|
-
) {
|
|
16
|
-
const enabled = orderedTriggers.filter((trigger) => !trigger.disabled);
|
|
17
|
-
if (enabled.size() === 0) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (currentValue === undefined) {
|
|
22
|
-
return enabled[0]?.value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const selectedEnabled = enabled.find((trigger) => trigger.value === currentValue);
|
|
26
|
-
if (selectedEnabled) {
|
|
27
|
-
return selectedEnabled.value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const selected = orderedTriggers.find((trigger) => trigger.value === currentValue);
|
|
31
|
-
const anchorOrder = selected?.order ?? fallbackOrder;
|
|
32
|
-
if (anchorOrder !== undefined) {
|
|
33
|
-
const after = enabled.find((trigger) => trigger.order > anchorOrder);
|
|
34
|
-
if (after) {
|
|
35
|
-
return after.value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return enabled[0]?.value;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function TabsRoot(props: TabsProps) {
|
|
43
|
-
const [value, setValueState] = useControllableState<string | undefined>({
|
|
44
|
-
value: props.value,
|
|
45
|
-
defaultValue: props.defaultValue,
|
|
46
|
-
onChange: (nextValue) => {
|
|
47
|
-
if (nextValue !== undefined) {
|
|
48
|
-
props.onValueChange?.(nextValue);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const orientation = props.orientation ?? "horizontal";
|
|
54
|
-
const activationMode = props.activationMode ?? "automatic";
|
|
55
|
-
|
|
56
|
-
const triggerRegistryRef = React.useRef<Array<TabsTriggerRegistration>>([]);
|
|
57
|
-
const lastSelectedOrderRef = React.useRef<number>();
|
|
58
|
-
const [registryRevision, setRegistryRevision] = React.useState(0);
|
|
59
|
-
|
|
60
|
-
const registerTrigger = React.useCallback((trigger: TabsTriggerRegistration) => {
|
|
61
|
-
triggerRegistryRef.current.push(trigger);
|
|
62
|
-
setRegistryRevision((revision) => revision + 1);
|
|
63
|
-
|
|
64
|
-
return () => {
|
|
65
|
-
const index = triggerRegistryRef.current.findIndex((entry) => entry.id === trigger.id);
|
|
66
|
-
if (index >= 0) {
|
|
67
|
-
triggerRegistryRef.current.remove(index);
|
|
68
|
-
setRegistryRevision((revision) => revision + 1);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}, []);
|
|
72
|
-
|
|
73
|
-
const setValue = React.useCallback(
|
|
74
|
-
(nextValue: string) => {
|
|
75
|
-
const orderedTriggers = getOrderedTriggers(triggerRegistryRef.current);
|
|
76
|
-
const selected = orderedTriggers.find((trigger) => trigger.value === nextValue && !trigger.disabled);
|
|
77
|
-
if (selected) {
|
|
78
|
-
lastSelectedOrderRef.current = selected.order;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
setValueState(nextValue);
|
|
82
|
-
},
|
|
83
|
-
[setValueState],
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
React.useEffect(() => {
|
|
87
|
-
const orderedTriggers = getOrderedTriggers(triggerRegistryRef.current);
|
|
88
|
-
const selected = orderedTriggers.find((trigger) => trigger.value === value && !trigger.disabled);
|
|
89
|
-
if (selected) {
|
|
90
|
-
lastSelectedOrderRef.current = selected.order;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const nextValue = resolveNextValue(value, orderedTriggers, lastSelectedOrderRef.current);
|
|
94
|
-
if (nextValue !== value) {
|
|
95
|
-
setValueState(nextValue);
|
|
96
|
-
}
|
|
97
|
-
}, [registryRevision, setValueState, value]);
|
|
98
|
-
|
|
99
|
-
const contextValue = React.useMemo(
|
|
100
|
-
() => ({
|
|
101
|
-
value,
|
|
102
|
-
setValue,
|
|
103
|
-
orientation,
|
|
104
|
-
activationMode,
|
|
105
|
-
registerTrigger,
|
|
106
|
-
}),
|
|
107
|
-
[activationMode, orientation, registerTrigger, setValue, value],
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
return <TabsContextProvider value={contextValue}>{props.children}</TabsContextProvider>;
|
|
111
|
-
}
|
package/src/Tabs/TabsTrigger.tsx
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { React, Slot } from "@lattice-ui/core";
|
|
2
|
-
import { RovingFocusItem } from "@lattice-ui/focus";
|
|
3
|
-
import { useTabsContext } from "./context";
|
|
4
|
-
import { createTabsTriggerName } from "./internals/ids";
|
|
5
|
-
import type { TabsTriggerProps } from "./types";
|
|
6
|
-
|
|
7
|
-
let nextTriggerId = 0;
|
|
8
|
-
let nextTriggerOrder = 0;
|
|
9
|
-
|
|
10
|
-
function toGuiObject(instance: Instance | undefined) {
|
|
11
|
-
if (!instance || !instance.IsA("GuiObject")) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return instance;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function TabsTrigger(props: TabsTriggerProps) {
|
|
19
|
-
const tabsContext = useTabsContext();
|
|
20
|
-
const triggerRef = React.useRef<GuiObject>();
|
|
21
|
-
const selected = tabsContext.value === props.value;
|
|
22
|
-
const disabled = props.disabled === true;
|
|
23
|
-
|
|
24
|
-
const triggerIdRef = React.useRef(0);
|
|
25
|
-
if (triggerIdRef.current === 0) {
|
|
26
|
-
nextTriggerId += 1;
|
|
27
|
-
triggerIdRef.current = nextTriggerId;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const triggerOrderRef = React.useRef(0);
|
|
31
|
-
if (triggerOrderRef.current === 0) {
|
|
32
|
-
nextTriggerOrder += 1;
|
|
33
|
-
triggerOrderRef.current = nextTriggerOrder;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
return tabsContext.registerTrigger({
|
|
38
|
-
id: triggerIdRef.current,
|
|
39
|
-
value: props.value,
|
|
40
|
-
disabled,
|
|
41
|
-
ref: triggerRef,
|
|
42
|
-
order: triggerOrderRef.current,
|
|
43
|
-
});
|
|
44
|
-
}, [disabled, props.value, tabsContext]);
|
|
45
|
-
|
|
46
|
-
const setTriggerRef = React.useCallback((instance: Instance | undefined) => {
|
|
47
|
-
triggerRef.current = toGuiObject(instance);
|
|
48
|
-
}, []);
|
|
49
|
-
|
|
50
|
-
const handleActivated = React.useCallback(() => {
|
|
51
|
-
if (disabled) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
tabsContext.setValue(props.value);
|
|
56
|
-
}, [disabled, props.value, tabsContext]);
|
|
57
|
-
|
|
58
|
-
const handleSelectionGained = React.useCallback(() => {
|
|
59
|
-
if (disabled || tabsContext.activationMode !== "automatic") {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
tabsContext.setValue(props.value);
|
|
64
|
-
}, [disabled, props.value, tabsContext]);
|
|
65
|
-
|
|
66
|
-
const handleInputBegan = React.useCallback(
|
|
67
|
-
(_rbx: TextButton, inputObject: InputObject) => {
|
|
68
|
-
if (disabled || tabsContext.activationMode !== "manual") {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const keyCode = inputObject.KeyCode;
|
|
73
|
-
if (keyCode !== Enum.KeyCode.Return && keyCode !== Enum.KeyCode.Space) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
tabsContext.setValue(props.value);
|
|
78
|
-
},
|
|
79
|
-
[disabled, props.value, tabsContext],
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const eventHandlers = React.useMemo(
|
|
83
|
-
() => ({
|
|
84
|
-
Activated: handleActivated,
|
|
85
|
-
SelectionGained: handleSelectionGained,
|
|
86
|
-
InputBegan: handleInputBegan,
|
|
87
|
-
}),
|
|
88
|
-
[handleActivated, handleInputBegan, handleSelectionGained],
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
const triggerName = React.useMemo(() => createTabsTriggerName(props.value), [props.value]);
|
|
92
|
-
|
|
93
|
-
if (props.asChild) {
|
|
94
|
-
const child = props.children;
|
|
95
|
-
if (!child) {
|
|
96
|
-
error("[TabsTrigger] `asChild` requires a child element.");
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<RovingFocusItem asChild disabled={disabled}>
|
|
101
|
-
<Slot Event={eventHandlers} Name={triggerName} ref={setTriggerRef}>
|
|
102
|
-
{child}
|
|
103
|
-
</Slot>
|
|
104
|
-
</RovingFocusItem>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<RovingFocusItem asChild disabled={disabled}>
|
|
110
|
-
<textbutton
|
|
111
|
-
Active={!disabled}
|
|
112
|
-
AutoButtonColor={false}
|
|
113
|
-
BackgroundColor3={selected ? Color3.fromRGB(86, 137, 245) : Color3.fromRGB(47, 53, 68)}
|
|
114
|
-
BorderSizePixel={0}
|
|
115
|
-
Event={eventHandlers}
|
|
116
|
-
Selectable={!disabled}
|
|
117
|
-
Size={UDim2.fromOffset(132, 34)}
|
|
118
|
-
Text={props.value}
|
|
119
|
-
TextColor3={disabled ? Color3.fromRGB(136, 144, 159) : Color3.fromRGB(235, 240, 248)}
|
|
120
|
-
TextSize={15}
|
|
121
|
-
ref={setTriggerRef}
|
|
122
|
-
>
|
|
123
|
-
{props.children}
|
|
124
|
-
</textbutton>
|
|
125
|
-
</RovingFocusItem>
|
|
126
|
-
);
|
|
127
|
-
}
|
package/src/Tabs/context.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function sanitizeValue(value: string) {
|
|
2
|
-
const lowered = string.lower(value);
|
|
3
|
-
const sanitized = string.gsub(lowered, "[^%w_%-]", "-")[0];
|
|
4
|
-
return sanitized.size() > 0 ? sanitized : "tab";
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function createTabsTriggerName(value: string) {
|
|
8
|
-
return `TabsTrigger:${sanitizeValue(value)}`;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function createTabsContentName(value: string) {
|
|
12
|
-
return `TabsContent:${sanitizeValue(value)}`;
|
|
13
|
-
}
|
package/src/Tabs/types.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type React from "@rbxts/react";
|
|
2
|
-
|
|
3
|
-
export type TabsOrientation = "horizontal" | "vertical";
|
|
4
|
-
export type TabsActivationMode = "automatic" | "manual";
|
|
5
|
-
|
|
6
|
-
export type TabsSetValue = (value: string) => void;
|
|
7
|
-
|
|
8
|
-
export type TabsTriggerRegistration = {
|
|
9
|
-
id: number;
|
|
10
|
-
value: string;
|
|
11
|
-
disabled: boolean;
|
|
12
|
-
ref: React.MutableRefObject<GuiObject | undefined>;
|
|
13
|
-
order: number;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type TabsContextValue = {
|
|
17
|
-
value?: string;
|
|
18
|
-
setValue: TabsSetValue;
|
|
19
|
-
orientation: TabsOrientation;
|
|
20
|
-
activationMode: TabsActivationMode;
|
|
21
|
-
registerTrigger: (trigger: TabsTriggerRegistration) => () => void;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type TabsProps = {
|
|
25
|
-
value?: string;
|
|
26
|
-
defaultValue?: string;
|
|
27
|
-
onValueChange?: (value: string) => void;
|
|
28
|
-
orientation?: TabsOrientation;
|
|
29
|
-
activationMode?: TabsActivationMode;
|
|
30
|
-
children?: React.ReactNode;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type TabsListProps = {
|
|
34
|
-
asChild?: boolean;
|
|
35
|
-
children?: React.ReactNode;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type TabsTriggerProps = {
|
|
39
|
-
value: string;
|
|
40
|
-
asChild?: boolean;
|
|
41
|
-
disabled?: boolean;
|
|
42
|
-
children?: React.ReactElement;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type TabsContentProps = {
|
|
46
|
-
value: string;
|
|
47
|
-
asChild?: boolean;
|
|
48
|
-
forceMount?: boolean;
|
|
49
|
-
children?: React.ReactNode;
|
|
50
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { TabsContent } from "./Tabs/TabsContent";
|
|
2
|
-
export { TabsList } from "./Tabs/TabsList";
|
|
3
|
-
export { TabsRoot, TabsRoot as Tabs } from "./Tabs/TabsRoot";
|
|
4
|
-
export { TabsTrigger } from "./Tabs/TabsTrigger";
|
|
5
|
-
export type {
|
|
6
|
-
TabsActivationMode,
|
|
7
|
-
TabsContentProps,
|
|
8
|
-
TabsContextValue,
|
|
9
|
-
TabsListProps,
|
|
10
|
-
TabsOrientation,
|
|
11
|
-
TabsProps,
|
|
12
|
-
TabsTriggerProps,
|
|
13
|
-
} from "./Tabs/types";
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "src",
|
|
5
|
-
"outDir": "out",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"typeRoots": [
|
|
8
|
-
"./node_modules/@rbxts",
|
|
9
|
-
"../../node_modules/@rbxts",
|
|
10
|
-
"./node_modules/@lattice-ui",
|
|
11
|
-
"../../node_modules/@lattice-ui"
|
|
12
|
-
],
|
|
13
|
-
"types": ["types", "compiler-types"]
|
|
14
|
-
},
|
|
15
|
-
"include": ["src"]
|
|
16
|
-
}
|
package/tsconfig.typecheck.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"noEmit": true,
|
|
5
|
-
"baseUrl": "..",
|
|
6
|
-
"rootDir": "..",
|
|
7
|
-
"paths": {
|
|
8
|
-
"@lattice-ui/checkbox": ["checkbox/src/index.ts"],
|
|
9
|
-
"@lattice-ui/core": ["core/src/index.ts"],
|
|
10
|
-
"@lattice-ui/dialog": ["dialog/src/index.ts"],
|
|
11
|
-
"@lattice-ui/focus": ["focus/src/index.ts"],
|
|
12
|
-
"@lattice-ui/layer": ["layer/src/index.ts"],
|
|
13
|
-
"@lattice-ui/menu": ["menu/src/index.ts"],
|
|
14
|
-
"@lattice-ui/popover": ["popover/src/index.ts"],
|
|
15
|
-
"@lattice-ui/popper": ["popper/src/index.ts"],
|
|
16
|
-
"@lattice-ui/radio-group": ["radio-group/src/index.ts"],
|
|
17
|
-
"@lattice-ui/style": ["style/src/index.ts"],
|
|
18
|
-
"@lattice-ui/switch": ["switch/src/index.ts"],
|
|
19
|
-
"@lattice-ui/system": ["system/src/index.ts"],
|
|
20
|
-
"@lattice-ui/tabs": ["tabs/src/index.ts"],
|
|
21
|
-
"@lattice-ui/toggle-group": ["toggle-group/src/index.ts"],
|
|
22
|
-
"@lattice-ui/tooltip": ["tooltip/src/index.ts"]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|