@rbxts/uiblox 0.1.35 → 0.1.37
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/out/theme/styles/types/ConditionalStylesMap.d.ts +1 -1
- package/out/theme/styles/utilities/classNames.d.ts +1 -1
- package/out/theme/styles/utilities/classNames.luau +81 -11
- package/out/theme/types/types.d.ts +2 -1
- package/out/ui/packages/button/components/Button.luau +4 -2
- package/out/ui/packages/divider/components/Divider.luau +4 -2
- package/out/ui/packages/icon/components/Icon.luau +4 -2
- package/out/ui/packages/iconButton/components/IconButton.luau +4 -2
- package/out/ui/packages/input/components/Input.luau +4 -2
- package/out/ui/packages/layout/components/Grid.luau +4 -2
- package/out/ui/packages/layout/components/List.luau +4 -2
- package/out/ui/packages/preloader/components/Preloader.luau +4 -2
- package/out/ui/packages/progressBar/components/ProgressBar.luau +4 -2
- package/out/ui/packages/sidebar/components/Sidebar.luau +4 -2
- package/out/ui/packages/toast/components/Toast.luau +3 -2
- package/out/ui/packages/treeView/components/TreeView.luau +4 -2
- package/out/ui/packages/typography/components/Typography.luau +4 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { WriteableStyle } from "./WriteableStyle";
|
|
2
|
-
export type ConditionalStylesMap<T extends Instance> = Map<WriteableStyle<T
|
|
2
|
+
export type ConditionalStylesMap<T extends Instance> = Map<WriteableStyle<T> | undefined, boolean>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { WriteableStyle, ConditionalStylesMap } from "../types/index";
|
|
2
|
-
declare function classNames<T extends Instance>(...args: [...Array<WriteableStyle<T
|
|
2
|
+
declare function classNames<T extends Instance>(...args: [...Array<WriteableStyle<T> | undefined>, ConditionalStylesMap<T>] | [...Array<WriteableStyle<T> | undefined>]): WriteableStyle<T>;
|
|
3
3
|
export default classNames;
|
|
@@ -3,6 +3,23 @@ local TS = _G[script]
|
|
|
3
3
|
local classNamesInternal = function(conditionalStyles, ...)
|
|
4
4
|
local styles = { ... }
|
|
5
5
|
local style = {}
|
|
6
|
+
-- ▼ ReadonlyArray.filterUndefined ▼
|
|
7
|
+
local _length = 0
|
|
8
|
+
for _i in styles do
|
|
9
|
+
if _i > _length then
|
|
10
|
+
_length = _i
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
local _result = {}
|
|
14
|
+
local _resultLength = 0
|
|
15
|
+
for _i = 1, _length do
|
|
16
|
+
local _v = styles[_i]
|
|
17
|
+
if _v ~= nil then
|
|
18
|
+
_resultLength += 1
|
|
19
|
+
_result[_resultLength] = _v
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
-- ▲ ReadonlyArray.filterUndefined ▲
|
|
6
23
|
-- ▼ ReadonlyArray.forEach ▼
|
|
7
24
|
local _callback = function(value)
|
|
8
25
|
if value ~= 0 and value == value and value ~= "" and value then
|
|
@@ -14,25 +31,27 @@ local classNamesInternal = function(conditionalStyles, ...)
|
|
|
14
31
|
style = _object
|
|
15
32
|
end
|
|
16
33
|
end
|
|
17
|
-
for _k, _v in
|
|
18
|
-
_callback(_v, _k - 1,
|
|
34
|
+
for _k, _v in _result do
|
|
35
|
+
_callback(_v, _k - 1, _result)
|
|
19
36
|
end
|
|
20
37
|
-- ▲ ReadonlyArray.forEach ▲
|
|
21
|
-
local
|
|
22
|
-
if
|
|
38
|
+
local _result_1 = conditionalStyles
|
|
39
|
+
if _result_1 ~= nil then
|
|
23
40
|
-- ▼ ReadonlyMap.forEach ▼
|
|
24
41
|
local _callback_1 = function(value, key)
|
|
25
42
|
if value then
|
|
26
43
|
local _object = table.clone(style)
|
|
27
44
|
setmetatable(_object, nil)
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
if key ~= 0 and key == key and key ~= "" and key then
|
|
46
|
+
for _k, _v in key do
|
|
47
|
+
_object[_k] = _v
|
|
48
|
+
end
|
|
30
49
|
end
|
|
31
50
|
style = _object
|
|
32
51
|
end
|
|
33
52
|
end
|
|
34
|
-
for _k, _v in
|
|
35
|
-
_callback_1(_v, _k,
|
|
53
|
+
for _k, _v in _result_1 do
|
|
54
|
+
_callback_1(_v, _k, _result_1)
|
|
36
55
|
end
|
|
37
56
|
-- ▲ ReadonlyMap.forEach ▲
|
|
38
57
|
end
|
|
@@ -96,12 +115,46 @@ local function classNames(...)
|
|
|
96
115
|
local conditionalStyles = _result
|
|
97
116
|
local styles = args
|
|
98
117
|
-- ConditionalStyles<T> is the last argument
|
|
99
|
-
|
|
118
|
+
-- ▼ ReadonlyArray.filterUndefined ▼
|
|
119
|
+
local _length_1 = 0
|
|
120
|
+
for _i in styles do
|
|
121
|
+
if _i > _length_1 then
|
|
122
|
+
_length_1 = _i
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
local _result_1 = {}
|
|
126
|
+
local _resultLength = 0
|
|
127
|
+
for _i = 1, _length_1 do
|
|
128
|
+
local _v = styles[_i]
|
|
129
|
+
if _v ~= nil then
|
|
130
|
+
_resultLength += 1
|
|
131
|
+
_result_1[_resultLength] = _v
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
-- ▲ ReadonlyArray.filterUndefined ▲
|
|
135
|
+
return TS.TRY_RETURN, { classNamesInternal(conditionalStyles, unpack(_result_1)) }
|
|
100
136
|
end
|
|
101
137
|
end, function()
|
|
102
138
|
-- If we catch an error, like attempt to iterate over a string value, it means that the last argument is not a ConditionalStyles<T>
|
|
103
139
|
local styles = args
|
|
104
|
-
|
|
140
|
+
-- ▼ ReadonlyArray.filterUndefined ▼
|
|
141
|
+
local _length = 0
|
|
142
|
+
for _i in styles do
|
|
143
|
+
if _i > _length then
|
|
144
|
+
_length = _i
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
local _result = {}
|
|
148
|
+
local _resultLength = 0
|
|
149
|
+
for _i = 1, _length do
|
|
150
|
+
local _v = styles[_i]
|
|
151
|
+
if _v ~= nil then
|
|
152
|
+
_resultLength += 1
|
|
153
|
+
_result[_resultLength] = _v
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
-- ▲ ReadonlyArray.filterUndefined ▲
|
|
157
|
+
return TS.TRY_RETURN, { classNamesInternal(nil, unpack(_result)) }
|
|
105
158
|
end)
|
|
106
159
|
if _exitType then
|
|
107
160
|
return unpack(_returns)
|
|
@@ -109,7 +162,24 @@ local function classNames(...)
|
|
|
109
162
|
-- Handle case without ConditionalStyles
|
|
110
163
|
-- All args are WriteableStyle<T>
|
|
111
164
|
local styles = args
|
|
112
|
-
|
|
165
|
+
-- ▼ ReadonlyArray.filterUndefined ▼
|
|
166
|
+
local _length = 0
|
|
167
|
+
for _i in styles do
|
|
168
|
+
if _i > _length then
|
|
169
|
+
_length = _i
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
local _result = {}
|
|
173
|
+
local _resultLength = 0
|
|
174
|
+
for _i = 1, _length do
|
|
175
|
+
local _v = styles[_i]
|
|
176
|
+
if _v ~= nil then
|
|
177
|
+
_resultLength += 1
|
|
178
|
+
_result[_resultLength] = _v
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
-- ▲ ReadonlyArray.filterUndefined ▲
|
|
182
|
+
return classNamesInternal(nil, unpack(_result))
|
|
113
183
|
end
|
|
114
184
|
local default = classNames
|
|
115
185
|
return {
|
|
@@ -3,7 +3,8 @@ import { WriteableStyle } from "../interfaces/index";
|
|
|
3
3
|
export interface CommonProps<T extends Instance> extends PropsWithChildren {
|
|
4
4
|
className?: WriteableStyle<T>;
|
|
5
5
|
component?: T;
|
|
6
|
-
|
|
6
|
+
id?: React.Key;
|
|
7
|
+
ref?: React.Ref<T>;
|
|
7
8
|
}
|
|
8
9
|
export type BaseDefaultProps<T extends Instance, P> = CommonProps<T> & P;
|
|
9
10
|
export type BaseCustomizedProps<T extends Instance, P> = BaseDefaultProps<T, P>;
|
|
@@ -40,7 +40,8 @@ local function Button(props)
|
|
|
40
40
|
local mouseLeave = _binding.mouseLeave
|
|
41
41
|
local className = _binding.className
|
|
42
42
|
local children = _binding.children
|
|
43
|
-
local
|
|
43
|
+
local id = _binding.id
|
|
44
|
+
local ref = _binding.ref
|
|
44
45
|
local _binding_1 = useButtonStyles(props)
|
|
45
46
|
local root = _binding_1.root
|
|
46
47
|
local font = _binding_1.font
|
|
@@ -48,11 +49,12 @@ local function Button(props)
|
|
|
48
49
|
local stroke = _binding_1.stroke
|
|
49
50
|
local hovering, setHovering = useState(false)
|
|
50
51
|
local _attributes = {}
|
|
51
|
-
local _condition =
|
|
52
|
+
local _condition = id
|
|
52
53
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
53
54
|
_condition = "Button"
|
|
54
55
|
end
|
|
55
56
|
_attributes.key = _condition
|
|
57
|
+
_attributes.ref = ref
|
|
56
58
|
for _k, _v in root do
|
|
57
59
|
_attributes[_k] = _v
|
|
58
60
|
end
|
|
@@ -5,15 +5,17 @@ local useDividerStyles = TS.import(script, script.Parent, "Divider.styles").defa
|
|
|
5
5
|
local function Divider(props)
|
|
6
6
|
local _binding = props
|
|
7
7
|
local className = _binding.className
|
|
8
|
-
local
|
|
8
|
+
local id = _binding.id
|
|
9
|
+
local ref = _binding.ref
|
|
9
10
|
local _binding_1 = useDividerStyles(props)
|
|
10
11
|
local root = _binding_1.root
|
|
11
12
|
local _attributes = {}
|
|
12
|
-
local _condition =
|
|
13
|
+
local _condition = id
|
|
13
14
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
14
15
|
_condition = "Divider"
|
|
15
16
|
end
|
|
16
17
|
_attributes.key = _condition
|
|
18
|
+
_attributes.ref = ref
|
|
17
19
|
for _k, _v in root do
|
|
18
20
|
_attributes[_k] = _v
|
|
19
21
|
end
|
|
@@ -7,15 +7,17 @@ local function Icon(props)
|
|
|
7
7
|
local icon = _binding.icon
|
|
8
8
|
local tint = _binding.tint
|
|
9
9
|
local className = _binding.className
|
|
10
|
-
local
|
|
10
|
+
local id = _binding.id
|
|
11
|
+
local ref = _binding.ref
|
|
11
12
|
local _binding_1 = useIconStyles(props)
|
|
12
13
|
local container = _binding_1.container
|
|
13
14
|
local _attributes = {}
|
|
14
|
-
local _condition =
|
|
15
|
+
local _condition = id
|
|
15
16
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
16
17
|
_condition = "Icon"
|
|
17
18
|
end
|
|
18
19
|
_attributes.key = _condition
|
|
20
|
+
_attributes.ref = ref
|
|
19
21
|
for _k, _v in container do
|
|
20
22
|
_attributes[_k] = _v
|
|
21
23
|
end
|
|
@@ -11,16 +11,18 @@ local function IconButton(props)
|
|
|
11
11
|
local tint = _binding.tint
|
|
12
12
|
local onClick = _binding.onClick
|
|
13
13
|
local className = _binding.className
|
|
14
|
-
local
|
|
14
|
+
local id = _binding.id
|
|
15
|
+
local ref = _binding.ref
|
|
15
16
|
local _binding_1 = useIconButtonStyles(props)
|
|
16
17
|
local container = _binding_1.container
|
|
17
18
|
local hovering, setHovering = useState(false)
|
|
18
19
|
local _attributes = {}
|
|
19
|
-
local _condition =
|
|
20
|
+
local _condition = id
|
|
20
21
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
21
22
|
_condition = "IconButton"
|
|
22
23
|
end
|
|
23
24
|
_attributes.key = _condition
|
|
25
|
+
_attributes.ref = ref
|
|
24
26
|
for _k, _v in container do
|
|
25
27
|
_attributes[_k] = _v
|
|
26
28
|
end
|
|
@@ -33,7 +33,8 @@ local function Input(props)
|
|
|
33
33
|
local onBlur = _binding.onBlur
|
|
34
34
|
local onEnterPressed = _binding.onEnterPressed
|
|
35
35
|
local className = _binding.className
|
|
36
|
-
local
|
|
36
|
+
local id = _binding.id
|
|
37
|
+
local ref = _binding.ref
|
|
37
38
|
local _binding_1 = useInputStyles(props)
|
|
38
39
|
local root = _binding_1.root
|
|
39
40
|
local font = _binding_1.font
|
|
@@ -51,11 +52,12 @@ local function Input(props)
|
|
|
51
52
|
end
|
|
52
53
|
local input, setInput = useState(_condition)
|
|
53
54
|
local _attributes = {}
|
|
54
|
-
local _condition_1 =
|
|
55
|
+
local _condition_1 = id
|
|
55
56
|
if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
|
|
56
57
|
_condition_1 = "Input"
|
|
57
58
|
end
|
|
58
59
|
_attributes.key = _condition_1
|
|
60
|
+
_attributes.ref = ref
|
|
59
61
|
for _k, _v in root do
|
|
60
62
|
_attributes[_k] = _v
|
|
61
63
|
end
|
|
@@ -60,7 +60,8 @@ local function Grid(props)
|
|
|
60
60
|
end
|
|
61
61
|
local className = _binding.className
|
|
62
62
|
local children = _binding.children
|
|
63
|
-
local
|
|
63
|
+
local id = _binding.id
|
|
64
|
+
local ref = _binding.ref
|
|
64
65
|
local _binding_1 = useGridStyles({
|
|
65
66
|
cellPadding = cellPadding,
|
|
66
67
|
cellSize = cellSize,
|
|
@@ -74,11 +75,12 @@ local function Grid(props)
|
|
|
74
75
|
local baseGrid = _binding_1.baseGrid
|
|
75
76
|
local baseLayout = _binding_1.baseLayout
|
|
76
77
|
local _attributes = {}
|
|
77
|
-
local _condition =
|
|
78
|
+
local _condition = id
|
|
78
79
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
79
80
|
_condition = "Grid"
|
|
80
81
|
end
|
|
81
82
|
_attributes.key = _condition
|
|
83
|
+
_attributes.ref = ref
|
|
82
84
|
for _k, _v in baseGrid do
|
|
83
85
|
_attributes[_k] = _v
|
|
84
86
|
end
|
|
@@ -60,7 +60,8 @@ local function List(props)
|
|
|
60
60
|
end
|
|
61
61
|
local className = _binding.className
|
|
62
62
|
local children = _binding.children
|
|
63
|
-
local
|
|
63
|
+
local id = _binding.id
|
|
64
|
+
local ref = _binding.ref
|
|
64
65
|
local _binding_1 = useListStyles({
|
|
65
66
|
padding = padding,
|
|
66
67
|
fillDirection = fillDirection,
|
|
@@ -74,11 +75,12 @@ local function List(props)
|
|
|
74
75
|
local baseList = _binding_1.baseList
|
|
75
76
|
local baseLayout = _binding_1.baseLayout
|
|
76
77
|
local _attributes = {}
|
|
77
|
-
local _condition =
|
|
78
|
+
local _condition = id
|
|
78
79
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
79
80
|
_condition = "List"
|
|
80
81
|
end
|
|
81
82
|
_attributes.key = _condition
|
|
83
|
+
_attributes.ref = ref
|
|
82
84
|
for _k, _v in baseList do
|
|
83
85
|
_attributes[_k] = _v
|
|
84
86
|
end
|
|
@@ -34,7 +34,8 @@ local function Preloader(props)
|
|
|
34
34
|
local Adornment = _binding.adornment
|
|
35
35
|
local className = _binding.className
|
|
36
36
|
local children = _binding.children
|
|
37
|
-
local
|
|
37
|
+
local id = _binding.id
|
|
38
|
+
local ref = _binding.ref
|
|
38
39
|
local percentage, setPercentage = useState(0)
|
|
39
40
|
local loaded, setLoaded = useState(false)
|
|
40
41
|
local _binding_1 = usePreloaderStyles(props)
|
|
@@ -102,11 +103,12 @@ local function Preloader(props)
|
|
|
102
103
|
})
|
|
103
104
|
else
|
|
104
105
|
local _attributes = {}
|
|
105
|
-
local _condition =
|
|
106
|
+
local _condition = id
|
|
106
107
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
107
108
|
_condition = "Preloader"
|
|
108
109
|
end
|
|
109
110
|
_attributes.key = _condition
|
|
111
|
+
_attributes.ref = ref
|
|
110
112
|
for _k, _v in container do
|
|
111
113
|
_attributes[_k] = _v
|
|
112
114
|
end
|
|
@@ -6,7 +6,8 @@ local function ProgressBar(props)
|
|
|
6
6
|
local _binding = props
|
|
7
7
|
local progress = _binding.progress
|
|
8
8
|
local className = _binding.className
|
|
9
|
-
local
|
|
9
|
+
local id = _binding.id
|
|
10
|
+
local ref = _binding.ref
|
|
10
11
|
local _binding_1 = useProgressBarStyles()
|
|
11
12
|
local container = _binding_1.container
|
|
12
13
|
local outer = _binding_1.outer
|
|
@@ -15,11 +16,12 @@ local function ProgressBar(props)
|
|
|
15
16
|
local fill = _binding_1.fill
|
|
16
17
|
local corner = _binding_1.corner
|
|
17
18
|
local _attributes = {}
|
|
18
|
-
local _condition =
|
|
19
|
+
local _condition = id
|
|
19
20
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
20
21
|
_condition = "ProgressBar"
|
|
21
22
|
end
|
|
22
23
|
_attributes.key = _condition
|
|
24
|
+
_attributes.ref = ref
|
|
23
25
|
for _k, _v in container do
|
|
24
26
|
_attributes[_k] = _v
|
|
25
27
|
end
|
|
@@ -6,16 +6,18 @@ local function Sidebar(props)
|
|
|
6
6
|
local _binding = props
|
|
7
7
|
local className = _binding.className
|
|
8
8
|
local children = _binding.children
|
|
9
|
-
local
|
|
9
|
+
local id = _binding.id
|
|
10
|
+
local ref = _binding.ref
|
|
10
11
|
local _binding_1 = useSidebarStyles(props)
|
|
11
12
|
local root = _binding_1.root
|
|
12
13
|
local container = _binding_1.container
|
|
13
14
|
local _attributes = {}
|
|
14
|
-
local _condition =
|
|
15
|
+
local _condition = id
|
|
15
16
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
16
17
|
_condition = "Sidebar"
|
|
17
18
|
end
|
|
18
19
|
_attributes.key = _condition
|
|
20
|
+
_attributes.ref = ref
|
|
19
21
|
for _k, _v in root do
|
|
20
22
|
_attributes[_k] = _v
|
|
21
23
|
end
|
|
@@ -19,7 +19,8 @@ local function Toast(props)
|
|
|
19
19
|
duration = 4
|
|
20
20
|
end
|
|
21
21
|
local className = _binding.className
|
|
22
|
-
local
|
|
22
|
+
local id = _binding.id
|
|
23
|
+
local ref = _binding.ref
|
|
23
24
|
local _binding_1 = useToastStyles(props)
|
|
24
25
|
local container = _binding_1.container
|
|
25
26
|
local label = _binding_1.label
|
|
@@ -56,7 +57,7 @@ local function Toast(props)
|
|
|
56
57
|
end
|
|
57
58
|
end, {})
|
|
58
59
|
local _attributes = {}
|
|
59
|
-
local _condition =
|
|
60
|
+
local _condition = id
|
|
60
61
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
61
62
|
_condition = "Toast"
|
|
62
63
|
end
|
|
@@ -16,7 +16,8 @@ local function TreeView(props)
|
|
|
16
16
|
local icon = _binding.icon
|
|
17
17
|
local filter = _binding.filter
|
|
18
18
|
local className = _binding.className
|
|
19
|
-
local
|
|
19
|
+
local id = _binding.id
|
|
20
|
+
local ref = _binding.ref
|
|
20
21
|
local _binding_1 = useTreeViewStyles()
|
|
21
22
|
local root = _binding_1.root
|
|
22
23
|
local header = _binding_1.header
|
|
@@ -135,11 +136,12 @@ local function TreeView(props)
|
|
|
135
136
|
setExpanded(newExpanded)
|
|
136
137
|
end, { tree, filter })
|
|
137
138
|
local _attributes = {}
|
|
138
|
-
local _condition =
|
|
139
|
+
local _condition = id
|
|
139
140
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
140
141
|
_condition = "TreeView"
|
|
141
142
|
end
|
|
142
143
|
_attributes.key = _condition
|
|
144
|
+
_attributes.ref = ref
|
|
143
145
|
for _k, _v in root do
|
|
144
146
|
_attributes[_k] = _v
|
|
145
147
|
end
|
|
@@ -10,16 +10,18 @@ local function Typography(props)
|
|
|
10
10
|
end
|
|
11
11
|
local className = _binding.className
|
|
12
12
|
local children = _binding.children
|
|
13
|
-
local
|
|
13
|
+
local id = _binding.id
|
|
14
|
+
local ref = _binding.ref
|
|
14
15
|
local _binding_1 = useTypographyStyles(props)
|
|
15
16
|
local root = _binding_1.root
|
|
16
17
|
local variantToken = _binding_1.variantToken
|
|
17
18
|
local _attributes = {}
|
|
18
|
-
local _condition =
|
|
19
|
+
local _condition = id
|
|
19
20
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
20
21
|
_condition = "Typography"
|
|
21
22
|
end
|
|
22
23
|
_attributes.key = _condition
|
|
24
|
+
_attributes.ref = ref
|
|
23
25
|
for _k, _v in root do
|
|
24
26
|
_attributes[_k] = _v
|
|
25
27
|
end
|