@lattice-ui/select 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/out/Select/SelectContent.d.ts +3 -0
- package/out/Select/SelectContent.luau +268 -0
- package/out/Select/SelectGroup.d.ts +3 -0
- package/out/Select/SelectGroup.luau +22 -0
- package/out/Select/SelectItem.d.ts +3 -0
- package/out/Select/SelectItem.luau +124 -0
- package/out/Select/SelectLabel.d.ts +3 -0
- package/out/Select/SelectLabel.luau +26 -0
- package/out/Select/SelectPortal.d.ts +3 -0
- package/out/Select/SelectPortal.luau +33 -0
- package/out/Select/SelectRoot.d.ts +3 -0
- package/out/Select/SelectRoot.luau +201 -0
- package/out/Select/SelectSeparator.d.ts +3 -0
- package/out/Select/SelectSeparator.luau +22 -0
- package/out/Select/SelectTrigger.d.ts +3 -0
- package/out/Select/SelectTrigger.luau +72 -0
- package/out/Select/SelectValue.d.ts +3 -0
- package/out/Select/SelectValue.luau +47 -0
- package/out/Select/context.d.ts +3 -0
- package/out/Select/context.luau +10 -0
- package/out/Select/types.d.ts +84 -0
- package/out/Select/types.luau +2 -0
- package/out/index.d.ts +22 -0
- package/out/init.luau +34 -0
- package/package.json +26 -0
- package/src/Select/SelectContent.tsx +297 -0
- package/src/Select/SelectGroup.tsx +19 -0
- package/src/Select/SelectItem.tsx +132 -0
- package/src/Select/SelectLabel.tsx +27 -0
- package/src/Select/SelectPortal.tsx +28 -0
- package/src/Select/SelectRoot.tsx +124 -0
- package/src/Select/SelectSeparator.tsx +19 -0
- package/src/Select/SelectTrigger.tsx +89 -0
- package/src/Select/SelectValue.tsx +42 -0
- package/src/Select/context.ts +6 -0
- package/src/Select/types.ts +96 -0
- package/src/index.ts +59 -0
- package/tsconfig.json +16 -0
- package/tsconfig.typecheck.json +35 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _core = TS.import(script, TS.getModule(script, "@lattice-ui", "core").out)
|
|
4
|
+
local React = _core.React
|
|
5
|
+
local useControllableState = _core.useControllableState
|
|
6
|
+
local SelectContextProvider = TS.import(script, script.Parent, "context").SelectContextProvider
|
|
7
|
+
local function getOrderedItems(items)
|
|
8
|
+
local _array = {}
|
|
9
|
+
local _length = #_array
|
|
10
|
+
table.move(items, 1, #items, _length + 1, _array)
|
|
11
|
+
local ordered = _array
|
|
12
|
+
table.sort(ordered, function(left, right)
|
|
13
|
+
return left.order < right.order
|
|
14
|
+
end)
|
|
15
|
+
return ordered
|
|
16
|
+
end
|
|
17
|
+
local function SelectRoot(props)
|
|
18
|
+
local _object = {
|
|
19
|
+
value = props.open,
|
|
20
|
+
}
|
|
21
|
+
local _left = "defaultValue"
|
|
22
|
+
local _condition = props.defaultOpen
|
|
23
|
+
if _condition == nil then
|
|
24
|
+
_condition = false
|
|
25
|
+
end
|
|
26
|
+
_object[_left] = _condition
|
|
27
|
+
_object.onChange = props.onOpenChange
|
|
28
|
+
local _binding = useControllableState(_object)
|
|
29
|
+
local open = _binding[1]
|
|
30
|
+
local setOpenState = _binding[2]
|
|
31
|
+
local _binding_1 = useControllableState({
|
|
32
|
+
value = props.value,
|
|
33
|
+
defaultValue = props.defaultValue,
|
|
34
|
+
onChange = function(nextValue)
|
|
35
|
+
if nextValue ~= nil then
|
|
36
|
+
local _result = props.onValueChange
|
|
37
|
+
if _result ~= nil then
|
|
38
|
+
_result(nextValue)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end,
|
|
42
|
+
})
|
|
43
|
+
local value = _binding_1[1]
|
|
44
|
+
local setValueState = _binding_1[2]
|
|
45
|
+
local disabled = props.disabled == true
|
|
46
|
+
local required = props.required == true
|
|
47
|
+
local _condition_1 = props.loop
|
|
48
|
+
if _condition_1 == nil then
|
|
49
|
+
_condition_1 = true
|
|
50
|
+
end
|
|
51
|
+
local loop = _condition_1
|
|
52
|
+
local triggerRef = React.useRef()
|
|
53
|
+
local contentRef = React.useRef()
|
|
54
|
+
local itemEntriesRef = React.useRef({})
|
|
55
|
+
local registryRevision, setRegistryRevision = React.useState(0)
|
|
56
|
+
local registerItem = React.useCallback(function(item)
|
|
57
|
+
local _current = itemEntriesRef.current
|
|
58
|
+
local _item = item
|
|
59
|
+
table.insert(_current, _item)
|
|
60
|
+
setRegistryRevision(function(revision)
|
|
61
|
+
return revision + 1
|
|
62
|
+
end)
|
|
63
|
+
return function()
|
|
64
|
+
local _exp = itemEntriesRef.current
|
|
65
|
+
-- ▼ ReadonlyArray.findIndex ▼
|
|
66
|
+
local _callback = function(entry)
|
|
67
|
+
return entry.id == item.id
|
|
68
|
+
end
|
|
69
|
+
local _result = -1
|
|
70
|
+
for _i, _v in _exp do
|
|
71
|
+
if _callback(_v, _i - 1, _exp) == true then
|
|
72
|
+
_result = _i - 1
|
|
73
|
+
break
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
-- ▲ ReadonlyArray.findIndex ▲
|
|
77
|
+
local index = _result
|
|
78
|
+
if index >= 0 then
|
|
79
|
+
table.remove(itemEntriesRef.current, index + 1)
|
|
80
|
+
setRegistryRevision(function(revision)
|
|
81
|
+
return revision + 1
|
|
82
|
+
end)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end, {})
|
|
86
|
+
local resolveOrderedItems = React.useCallback(function()
|
|
87
|
+
return getOrderedItems(itemEntriesRef.current)
|
|
88
|
+
end, { registryRevision })
|
|
89
|
+
local getItemText = React.useCallback(function(candidateValue)
|
|
90
|
+
local _exp = resolveOrderedItems()
|
|
91
|
+
-- ▼ ReadonlyArray.find ▼
|
|
92
|
+
local _callback = function(item)
|
|
93
|
+
return item.value == candidateValue
|
|
94
|
+
end
|
|
95
|
+
local _result
|
|
96
|
+
for _i, _v in _exp do
|
|
97
|
+
if _callback(_v, _i - 1, _exp) == true then
|
|
98
|
+
_result = _v
|
|
99
|
+
break
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
-- ▲ ReadonlyArray.find ▲
|
|
103
|
+
local selected = _result
|
|
104
|
+
local _result_1 = selected
|
|
105
|
+
if _result_1 ~= nil then
|
|
106
|
+
_result_1 = _result_1.getTextValue()
|
|
107
|
+
end
|
|
108
|
+
return _result_1
|
|
109
|
+
end, { resolveOrderedItems })
|
|
110
|
+
local setOpen = React.useCallback(function(nextOpen)
|
|
111
|
+
if disabled and nextOpen then
|
|
112
|
+
return nil
|
|
113
|
+
end
|
|
114
|
+
setOpenState(nextOpen)
|
|
115
|
+
end, { disabled, setOpenState })
|
|
116
|
+
local setValue = React.useCallback(function(nextValue)
|
|
117
|
+
if disabled then
|
|
118
|
+
return nil
|
|
119
|
+
end
|
|
120
|
+
local _exp = resolveOrderedItems()
|
|
121
|
+
-- ▼ ReadonlyArray.find ▼
|
|
122
|
+
local _callback = function(item)
|
|
123
|
+
return item.value == nextValue
|
|
124
|
+
end
|
|
125
|
+
local _result
|
|
126
|
+
for _i, _v in _exp do
|
|
127
|
+
if _callback(_v, _i - 1, _exp) == true then
|
|
128
|
+
_result = _v
|
|
129
|
+
break
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
-- ▲ ReadonlyArray.find ▲
|
|
133
|
+
local selected = _result
|
|
134
|
+
if selected and selected.getDisabled() then
|
|
135
|
+
return nil
|
|
136
|
+
end
|
|
137
|
+
setValueState(nextValue)
|
|
138
|
+
end, { disabled, resolveOrderedItems, setValueState })
|
|
139
|
+
React.useEffect(function()
|
|
140
|
+
if value == nil then
|
|
141
|
+
return nil
|
|
142
|
+
end
|
|
143
|
+
local orderedItems = resolveOrderedItems()
|
|
144
|
+
-- ▼ ReadonlyArray.find ▼
|
|
145
|
+
local _callback = function(item)
|
|
146
|
+
return item.value == value
|
|
147
|
+
end
|
|
148
|
+
local _result
|
|
149
|
+
for _i, _v in orderedItems do
|
|
150
|
+
if _callback(_v, _i - 1, orderedItems) == true then
|
|
151
|
+
_result = _v
|
|
152
|
+
break
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
-- ▲ ReadonlyArray.find ▲
|
|
156
|
+
local selected = _result
|
|
157
|
+
if selected and not selected.getDisabled() then
|
|
158
|
+
return nil
|
|
159
|
+
end
|
|
160
|
+
-- ▼ ReadonlyArray.find ▼
|
|
161
|
+
local _callback_1 = function(item)
|
|
162
|
+
return not item.getDisabled()
|
|
163
|
+
end
|
|
164
|
+
local _result_1
|
|
165
|
+
for _i, _v in orderedItems do
|
|
166
|
+
if _callback_1(_v, _i - 1, orderedItems) == true then
|
|
167
|
+
_result_1 = _v
|
|
168
|
+
break
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
-- ▲ ReadonlyArray.find ▲
|
|
172
|
+
local fallback = _result_1
|
|
173
|
+
local _result_2 = fallback
|
|
174
|
+
if _result_2 ~= nil then
|
|
175
|
+
_result_2 = _result_2.value
|
|
176
|
+
end
|
|
177
|
+
setValueState(_result_2)
|
|
178
|
+
end, { registryRevision, resolveOrderedItems, setValueState, value })
|
|
179
|
+
local contextValue = React.useMemo(function()
|
|
180
|
+
return {
|
|
181
|
+
open = open,
|
|
182
|
+
setOpen = setOpen,
|
|
183
|
+
value = value,
|
|
184
|
+
setValue = setValue,
|
|
185
|
+
disabled = disabled,
|
|
186
|
+
required = required,
|
|
187
|
+
loop = loop,
|
|
188
|
+
triggerRef = triggerRef,
|
|
189
|
+
contentRef = contentRef,
|
|
190
|
+
registerItem = registerItem,
|
|
191
|
+
getOrderedItems = resolveOrderedItems,
|
|
192
|
+
getItemText = getItemText,
|
|
193
|
+
}
|
|
194
|
+
end, { disabled, getItemText, loop, open, registerItem, required, resolveOrderedItems, setOpen, setValue, value })
|
|
195
|
+
return React.createElement(SelectContextProvider, {
|
|
196
|
+
value = contextValue,
|
|
197
|
+
}, props.children)
|
|
198
|
+
end
|
|
199
|
+
return {
|
|
200
|
+
SelectRoot = SelectRoot,
|
|
201
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _core = TS.import(script, TS.getModule(script, "@lattice-ui", "core").out)
|
|
4
|
+
local React = _core.React
|
|
5
|
+
local Slot = _core.Slot
|
|
6
|
+
local function SelectSeparator(props)
|
|
7
|
+
if props.asChild then
|
|
8
|
+
local child = props.children
|
|
9
|
+
if not child then
|
|
10
|
+
error("[SelectSeparator] `asChild` requires a child element.")
|
|
11
|
+
end
|
|
12
|
+
return React.createElement(Slot, nil, child)
|
|
13
|
+
end
|
|
14
|
+
return React.createElement("frame", {
|
|
15
|
+
BackgroundColor3 = Color3.fromRGB(78, 86, 104),
|
|
16
|
+
BorderSizePixel = 0,
|
|
17
|
+
Size = UDim2.fromOffset(220, 1),
|
|
18
|
+
}, props.children)
|
|
19
|
+
end
|
|
20
|
+
return {
|
|
21
|
+
SelectSeparator = SelectSeparator,
|
|
22
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _core = TS.import(script, TS.getModule(script, "@lattice-ui", "core").out)
|
|
4
|
+
local React = _core.React
|
|
5
|
+
local Slot = _core.Slot
|
|
6
|
+
local useSelectContext = TS.import(script, script.Parent, "context").useSelectContext
|
|
7
|
+
local function toGuiObject(instance)
|
|
8
|
+
if not instance or not instance:IsA("GuiObject") then
|
|
9
|
+
return nil
|
|
10
|
+
end
|
|
11
|
+
return instance
|
|
12
|
+
end
|
|
13
|
+
local function SelectTrigger(props)
|
|
14
|
+
local selectContext = useSelectContext()
|
|
15
|
+
local disabled = selectContext.disabled or props.disabled == true
|
|
16
|
+
local setTriggerRef = React.useCallback(function(instance)
|
|
17
|
+
selectContext.triggerRef.current = toGuiObject(instance)
|
|
18
|
+
end, { selectContext.triggerRef })
|
|
19
|
+
local handleActivated = React.useCallback(function()
|
|
20
|
+
if disabled then
|
|
21
|
+
return nil
|
|
22
|
+
end
|
|
23
|
+
selectContext.setOpen(not selectContext.open)
|
|
24
|
+
end, { disabled, selectContext })
|
|
25
|
+
local handleInputBegan = React.useCallback(function(_rbx, inputObject)
|
|
26
|
+
if disabled then
|
|
27
|
+
return nil
|
|
28
|
+
end
|
|
29
|
+
local keyCode = inputObject.KeyCode
|
|
30
|
+
if keyCode == Enum.KeyCode.Return or keyCode == Enum.KeyCode.Space then
|
|
31
|
+
selectContext.setOpen(not selectContext.open)
|
|
32
|
+
return nil
|
|
33
|
+
end
|
|
34
|
+
if keyCode == Enum.KeyCode.Down or keyCode == Enum.KeyCode.Up then
|
|
35
|
+
selectContext.setOpen(true)
|
|
36
|
+
end
|
|
37
|
+
end, { disabled, selectContext })
|
|
38
|
+
local eventHandlers = React.useMemo(function()
|
|
39
|
+
return {
|
|
40
|
+
Activated = handleActivated,
|
|
41
|
+
InputBegan = handleInputBegan,
|
|
42
|
+
}
|
|
43
|
+
end, { handleActivated, handleInputBegan })
|
|
44
|
+
if props.asChild then
|
|
45
|
+
local child = props.children
|
|
46
|
+
if not child then
|
|
47
|
+
error("[SelectTrigger] `asChild` requires a child element.")
|
|
48
|
+
end
|
|
49
|
+
return React.createElement(Slot, {
|
|
50
|
+
Active = not disabled,
|
|
51
|
+
Event = eventHandlers,
|
|
52
|
+
Selectable = not disabled,
|
|
53
|
+
ref = setTriggerRef,
|
|
54
|
+
}, child)
|
|
55
|
+
end
|
|
56
|
+
return React.createElement("textbutton", {
|
|
57
|
+
Active = not disabled,
|
|
58
|
+
AutoButtonColor = false,
|
|
59
|
+
BackgroundColor3 = Color3.fromRGB(41, 48, 63),
|
|
60
|
+
BorderSizePixel = 0,
|
|
61
|
+
Event = eventHandlers,
|
|
62
|
+
Selectable = not disabled,
|
|
63
|
+
Size = UDim2.fromOffset(220, 36),
|
|
64
|
+
Text = "Select",
|
|
65
|
+
TextColor3 = if disabled then Color3.fromRGB(140, 148, 164) else Color3.fromRGB(235, 241, 248),
|
|
66
|
+
TextSize = 15,
|
|
67
|
+
ref = setTriggerRef,
|
|
68
|
+
}, props.children)
|
|
69
|
+
end
|
|
70
|
+
return {
|
|
71
|
+
SelectTrigger = SelectTrigger,
|
|
72
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _core = TS.import(script, TS.getModule(script, "@lattice-ui", "core").out)
|
|
4
|
+
local React = _core.React
|
|
5
|
+
local Slot = _core.Slot
|
|
6
|
+
local useSelectContext = TS.import(script, script.Parent, "context").useSelectContext
|
|
7
|
+
local function SelectValue(props)
|
|
8
|
+
local selectContext = useSelectContext()
|
|
9
|
+
local selectedValue = selectContext.value
|
|
10
|
+
local hasValue = selectedValue ~= nil
|
|
11
|
+
local resolvedText = React.useMemo(function()
|
|
12
|
+
if not hasValue or selectedValue == nil then
|
|
13
|
+
local _condition = props.placeholder
|
|
14
|
+
if _condition == nil then
|
|
15
|
+
_condition = ""
|
|
16
|
+
end
|
|
17
|
+
return _condition
|
|
18
|
+
end
|
|
19
|
+
local _condition = selectContext.getItemText(selectedValue)
|
|
20
|
+
if _condition == nil then
|
|
21
|
+
_condition = selectedValue
|
|
22
|
+
end
|
|
23
|
+
return _condition
|
|
24
|
+
end, { hasValue, props.placeholder, selectContext, selectedValue })
|
|
25
|
+
if props.asChild then
|
|
26
|
+
local child = props.children
|
|
27
|
+
if not child then
|
|
28
|
+
error("[SelectValue] `asChild` requires a child element.")
|
|
29
|
+
end
|
|
30
|
+
return React.createElement(Slot, {
|
|
31
|
+
Name = "SelectValue",
|
|
32
|
+
Text = resolvedText,
|
|
33
|
+
}, child)
|
|
34
|
+
end
|
|
35
|
+
return React.createElement("textlabel", {
|
|
36
|
+
BackgroundTransparency = 1,
|
|
37
|
+
BorderSizePixel = 0,
|
|
38
|
+
Size = UDim2.fromOffset(200, 20),
|
|
39
|
+
Text = resolvedText,
|
|
40
|
+
TextColor3 = if hasValue then Color3.fromRGB(235, 240, 248) else Color3.fromRGB(153, 161, 177),
|
|
41
|
+
TextSize = 14,
|
|
42
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
43
|
+
})
|
|
44
|
+
end
|
|
45
|
+
return {
|
|
46
|
+
SelectValue = SelectValue,
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local createStrictContext = TS.import(script, TS.getModule(script, "@lattice-ui", "core").out).createStrictContext
|
|
4
|
+
local _binding = createStrictContext("Select")
|
|
5
|
+
local SelectContextProvider = _binding[1]
|
|
6
|
+
local useSelectContext = _binding[2]
|
|
7
|
+
return {
|
|
8
|
+
SelectContextProvider = SelectContextProvider,
|
|
9
|
+
useSelectContext = useSelectContext,
|
|
10
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { LayerInteractEvent } from "@lattice-ui/layer";
|
|
2
|
+
import type { PopperPlacement } from "@lattice-ui/popper";
|
|
3
|
+
import type React from "@rbxts/react";
|
|
4
|
+
export type SelectSetOpen = (open: boolean) => void;
|
|
5
|
+
export type SelectSetValue = (value: string) => void;
|
|
6
|
+
export type SelectItemRegistration = {
|
|
7
|
+
id: number;
|
|
8
|
+
value: string;
|
|
9
|
+
order: number;
|
|
10
|
+
getNode: () => GuiObject | undefined;
|
|
11
|
+
getDisabled: () => boolean;
|
|
12
|
+
getTextValue: () => string;
|
|
13
|
+
};
|
|
14
|
+
export type SelectContextValue = {
|
|
15
|
+
open: boolean;
|
|
16
|
+
setOpen: SelectSetOpen;
|
|
17
|
+
value?: string;
|
|
18
|
+
setValue: SelectSetValue;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
required: boolean;
|
|
21
|
+
loop: boolean;
|
|
22
|
+
triggerRef: React.MutableRefObject<GuiObject | undefined>;
|
|
23
|
+
contentRef: React.MutableRefObject<GuiObject | undefined>;
|
|
24
|
+
registerItem: (item: SelectItemRegistration) => () => void;
|
|
25
|
+
getOrderedItems: () => Array<SelectItemRegistration>;
|
|
26
|
+
getItemText: (value: string) => string | undefined;
|
|
27
|
+
};
|
|
28
|
+
export type SelectProps = {
|
|
29
|
+
value?: string;
|
|
30
|
+
defaultValue?: string;
|
|
31
|
+
onValueChange?: (value: string) => void;
|
|
32
|
+
open?: boolean;
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
loop?: boolean;
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
};
|
|
40
|
+
export type SelectTriggerProps = {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
children?: React.ReactElement;
|
|
44
|
+
};
|
|
45
|
+
export type SelectValueProps = {
|
|
46
|
+
asChild?: boolean;
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
children?: React.ReactElement;
|
|
49
|
+
};
|
|
50
|
+
export type SelectPortalProps = {
|
|
51
|
+
container?: BasePlayerGui;
|
|
52
|
+
displayOrderBase?: number;
|
|
53
|
+
children?: React.ReactNode;
|
|
54
|
+
};
|
|
55
|
+
export type SelectContentProps = {
|
|
56
|
+
asChild?: boolean;
|
|
57
|
+
forceMount?: boolean;
|
|
58
|
+
placement?: PopperPlacement;
|
|
59
|
+
offset?: Vector2;
|
|
60
|
+
padding?: number;
|
|
61
|
+
onEscapeKeyDown?: (event: LayerInteractEvent) => void;
|
|
62
|
+
onPointerDownOutside?: (event: LayerInteractEvent) => void;
|
|
63
|
+
onInteractOutside?: (event: LayerInteractEvent) => void;
|
|
64
|
+
children?: React.ReactNode;
|
|
65
|
+
};
|
|
66
|
+
export type SelectItemProps = {
|
|
67
|
+
value: string;
|
|
68
|
+
textValue?: string;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
asChild?: boolean;
|
|
71
|
+
children?: React.ReactElement;
|
|
72
|
+
};
|
|
73
|
+
export type SelectSeparatorProps = {
|
|
74
|
+
asChild?: boolean;
|
|
75
|
+
children?: React.ReactElement;
|
|
76
|
+
};
|
|
77
|
+
export type SelectGroupProps = {
|
|
78
|
+
asChild?: boolean;
|
|
79
|
+
children?: React.ReactElement;
|
|
80
|
+
};
|
|
81
|
+
export type SelectLabelProps = {
|
|
82
|
+
asChild?: boolean;
|
|
83
|
+
children?: React.ReactElement;
|
|
84
|
+
};
|
package/out/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SelectContent } from "./Select/SelectContent";
|
|
2
|
+
import { SelectGroup } from "./Select/SelectGroup";
|
|
3
|
+
import { SelectItem } from "./Select/SelectItem";
|
|
4
|
+
import { SelectLabel } from "./Select/SelectLabel";
|
|
5
|
+
import { SelectPortal } from "./Select/SelectPortal";
|
|
6
|
+
import { SelectRoot } from "./Select/SelectRoot";
|
|
7
|
+
import { SelectSeparator } from "./Select/SelectSeparator";
|
|
8
|
+
import { SelectTrigger } from "./Select/SelectTrigger";
|
|
9
|
+
import { SelectValue } from "./Select/SelectValue";
|
|
10
|
+
export declare const Select: {
|
|
11
|
+
readonly Root: typeof SelectRoot;
|
|
12
|
+
readonly Trigger: typeof SelectTrigger;
|
|
13
|
+
readonly Value: typeof SelectValue;
|
|
14
|
+
readonly Portal: typeof SelectPortal;
|
|
15
|
+
readonly Content: typeof SelectContent;
|
|
16
|
+
readonly Item: typeof SelectItem;
|
|
17
|
+
readonly Group: typeof SelectGroup;
|
|
18
|
+
readonly Label: typeof SelectLabel;
|
|
19
|
+
readonly Separator: typeof SelectSeparator;
|
|
20
|
+
};
|
|
21
|
+
export { SelectContent, SelectGroup, SelectItem, SelectLabel, SelectPortal, SelectRoot, SelectSeparator, SelectTrigger, SelectValue, };
|
|
22
|
+
export type { SelectContentProps, SelectContextValue, SelectGroupProps, SelectItemProps, SelectItemRegistration, SelectLabelProps, SelectPortalProps, SelectProps, SelectSeparatorProps, SelectSetOpen, SelectSetValue, SelectTriggerProps, SelectValueProps, } from "./Select/types";
|
package/out/init.luau
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local SelectContent = TS.import(script, script, "Select", "SelectContent").SelectContent
|
|
4
|
+
local SelectGroup = TS.import(script, script, "Select", "SelectGroup").SelectGroup
|
|
5
|
+
local SelectItem = TS.import(script, script, "Select", "SelectItem").SelectItem
|
|
6
|
+
local SelectLabel = TS.import(script, script, "Select", "SelectLabel").SelectLabel
|
|
7
|
+
local SelectPortal = TS.import(script, script, "Select", "SelectPortal").SelectPortal
|
|
8
|
+
local SelectRoot = TS.import(script, script, "Select", "SelectRoot").SelectRoot
|
|
9
|
+
local SelectSeparator = TS.import(script, script, "Select", "SelectSeparator").SelectSeparator
|
|
10
|
+
local SelectTrigger = TS.import(script, script, "Select", "SelectTrigger").SelectTrigger
|
|
11
|
+
local SelectValue = TS.import(script, script, "Select", "SelectValue").SelectValue
|
|
12
|
+
local Select = {
|
|
13
|
+
Root = SelectRoot,
|
|
14
|
+
Trigger = SelectTrigger,
|
|
15
|
+
Value = SelectValue,
|
|
16
|
+
Portal = SelectPortal,
|
|
17
|
+
Content = SelectContent,
|
|
18
|
+
Item = SelectItem,
|
|
19
|
+
Group = SelectGroup,
|
|
20
|
+
Label = SelectLabel,
|
|
21
|
+
Separator = SelectSeparator,
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
Select = Select,
|
|
25
|
+
SelectContent = SelectContent,
|
|
26
|
+
SelectGroup = SelectGroup,
|
|
27
|
+
SelectItem = SelectItem,
|
|
28
|
+
SelectLabel = SelectLabel,
|
|
29
|
+
SelectPortal = SelectPortal,
|
|
30
|
+
SelectRoot = SelectRoot,
|
|
31
|
+
SelectSeparator = SelectSeparator,
|
|
32
|
+
SelectTrigger = SelectTrigger,
|
|
33
|
+
SelectValue = SelectValue,
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lattice-ui/select",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "out/init.luau",
|
|
6
|
+
"types": "out/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@lattice-ui/core": "0.3.0",
|
|
9
|
+
"@lattice-ui/focus": "0.3.0",
|
|
10
|
+
"@lattice-ui/popper": "0.3.0",
|
|
11
|
+
"@lattice-ui/layer": "0.3.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@rbxts/react": "17.3.7-ts.1",
|
|
15
|
+
"@rbxts/react-roblox": "17.3.7-ts.1"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@rbxts/react": "^17",
|
|
19
|
+
"@rbxts/react-roblox": "^17"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rbxtsc -p tsconfig.json",
|
|
23
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
24
|
+
"watch": "rbxtsc -p tsconfig.json -w"
|
|
25
|
+
}
|
|
26
|
+
}
|