@quenty/iris 1.1.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/CHANGELOG.md +14 -0
- package/LICENSE.md +22 -0
- package/README.md +33 -0
- package/default.project.json +14 -0
- package/package.json +42 -0
- package/src/Shared/Iris.lua +702 -0
- package/src/Shared/iris_API.lua +231 -0
- package/src/Shared/iris_Internal.lua +923 -0
- package/src/Shared/iris_PubTypes.lua +44 -0
- package/src/Shared/iris_Types.lua +674 -0
- package/src/Shared/iris_WidgetTypes.lua +522 -0
- package/src/Shared/iris_config.lua +306 -0
- package/src/Shared/iris_demoWindow.lua +2148 -0
- package/src/Shared/widgets/iris_Button.lua +91 -0
- package/src/Shared/widgets/iris_Checkbox.lua +116 -0
- package/src/Shared/widgets/iris_Combo.lua +498 -0
- package/src/Shared/widgets/iris_Format.lua +141 -0
- package/src/Shared/widgets/iris_Image.lua +156 -0
- package/src/Shared/widgets/iris_Input.lua +1430 -0
- package/src/Shared/widgets/iris_Menu.lua +603 -0
- package/src/Shared/widgets/iris_Plot.lua +642 -0
- package/src/Shared/widgets/iris_RadioButton.lua +127 -0
- package/src/Shared/widgets/iris_Root.lua +148 -0
- package/src/Shared/widgets/iris_Tab.lua +334 -0
- package/src/Shared/widgets/iris_Table.lua +641 -0
- package/src/Shared/widgets/iris_Text.lua +133 -0
- package/src/Shared/widgets/iris_Tree.lua +291 -0
- package/src/Shared/widgets/iris_Window.lua +1158 -0
- package/src/Shared/widgets/iris_widgets.lua +487 -0
- package/src/jest.config.lua +3 -0
- package/src/node_modules.project.json +7 -0
- package/test/default.project.json +25 -0
- package/test/scripts/Server/ServerMain.server.lua +13 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
--!nocheck
|
|
2
|
+
local Types = require(script.Parent.Parent.iris_Types)
|
|
3
|
+
|
|
4
|
+
return function(Iris: Types.Internal, widgets: Types.WidgetUtility)
|
|
5
|
+
--stylua: ignore
|
|
6
|
+
Iris.WidgetConstructor("Text", {
|
|
7
|
+
hasState = false,
|
|
8
|
+
hasChildren = false,
|
|
9
|
+
Args = {
|
|
10
|
+
["Text"] = 1,
|
|
11
|
+
["Wrapped"] = 2,
|
|
12
|
+
["Color"] = 3,
|
|
13
|
+
["RichText"] = 4,
|
|
14
|
+
},
|
|
15
|
+
Events = {
|
|
16
|
+
["hovered"] = widgets.EVENTS.hover(function(thisWidget: Types.Widget)
|
|
17
|
+
return thisWidget.Instance
|
|
18
|
+
end),
|
|
19
|
+
},
|
|
20
|
+
Generate = function(_thisWidget: Types.Text)
|
|
21
|
+
local Text = Instance.new("TextLabel")
|
|
22
|
+
Text.Name = "Iris_Text"
|
|
23
|
+
Text.AutomaticSize = Enum.AutomaticSize.XY
|
|
24
|
+
Text.Size = UDim2.fromOffset(0, 0)
|
|
25
|
+
Text.BackgroundTransparency = 1
|
|
26
|
+
Text.BorderSizePixel = 0
|
|
27
|
+
|
|
28
|
+
widgets.applyTextStyle(Text)
|
|
29
|
+
widgets.UIPadding(Text, Vector2.new(0, 2))
|
|
30
|
+
|
|
31
|
+
return Text
|
|
32
|
+
end,
|
|
33
|
+
Update = function(thisWidget: Types.Text)
|
|
34
|
+
local Text = thisWidget.Instance :: TextLabel
|
|
35
|
+
if thisWidget.arguments.Text == nil then
|
|
36
|
+
error("Text argument is required for Iris.Text().", 5)
|
|
37
|
+
end
|
|
38
|
+
if thisWidget.arguments.Wrapped ~= nil then
|
|
39
|
+
Text.TextWrapped = thisWidget.arguments.Wrapped
|
|
40
|
+
else
|
|
41
|
+
Text.TextWrapped = Iris._config.TextWrapped
|
|
42
|
+
end
|
|
43
|
+
if thisWidget.arguments.Color then
|
|
44
|
+
Text.TextColor3 = thisWidget.arguments.Color
|
|
45
|
+
else
|
|
46
|
+
Text.TextColor3 = Iris._config.TextColor
|
|
47
|
+
end
|
|
48
|
+
if thisWidget.arguments.RichText ~= nil then
|
|
49
|
+
Text.RichText = thisWidget.arguments.RichText
|
|
50
|
+
else
|
|
51
|
+
Text.RichText = Iris._config.RichText
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Text.Text = thisWidget.arguments.Text
|
|
55
|
+
end,
|
|
56
|
+
Discard = function(thisWidget: Types.Text)
|
|
57
|
+
thisWidget.Instance:Destroy()
|
|
58
|
+
end,
|
|
59
|
+
} :: Types.WidgetClass)
|
|
60
|
+
|
|
61
|
+
--stylua: ignore
|
|
62
|
+
Iris.WidgetConstructor("SeparatorText", {
|
|
63
|
+
hasState = false,
|
|
64
|
+
hasChildren = false,
|
|
65
|
+
Args = {
|
|
66
|
+
["Text"] = 1,
|
|
67
|
+
},
|
|
68
|
+
Events = {
|
|
69
|
+
["hovered"] = widgets.EVENTS.hover(function(thisWidget: Types.Widget)
|
|
70
|
+
return thisWidget.Instance
|
|
71
|
+
end),
|
|
72
|
+
},
|
|
73
|
+
Generate = function(_thisWidget: Types.SeparatorText)
|
|
74
|
+
local SeparatorText = Instance.new("Frame")
|
|
75
|
+
SeparatorText.Name = "Iris_SeparatorText"
|
|
76
|
+
SeparatorText.AutomaticSize = Enum.AutomaticSize.Y
|
|
77
|
+
SeparatorText.Size = UDim2.new(Iris._config.ItemWidth, UDim.new())
|
|
78
|
+
SeparatorText.BackgroundTransparency = 1
|
|
79
|
+
SeparatorText.BorderSizePixel = 0
|
|
80
|
+
SeparatorText.ClipsDescendants = true
|
|
81
|
+
|
|
82
|
+
widgets.UIPadding(SeparatorText, Vector2.new(0, Iris._config.SeparatorTextPadding.Y))
|
|
83
|
+
widgets.UIListLayout(SeparatorText, Enum.FillDirection.Horizontal, UDim.new(0, Iris._config.ItemSpacing.X))
|
|
84
|
+
|
|
85
|
+
SeparatorText.UIListLayout.VerticalAlignment = Enum.VerticalAlignment.Center
|
|
86
|
+
|
|
87
|
+
local TextLabel = Instance.new("TextLabel")
|
|
88
|
+
TextLabel.Name = "TextLabel"
|
|
89
|
+
TextLabel.AutomaticSize = Enum.AutomaticSize.XY
|
|
90
|
+
TextLabel.BackgroundTransparency = 1
|
|
91
|
+
TextLabel.BorderSizePixel = 0
|
|
92
|
+
TextLabel.LayoutOrder = 1
|
|
93
|
+
|
|
94
|
+
widgets.applyTextStyle(TextLabel)
|
|
95
|
+
|
|
96
|
+
TextLabel.Parent = SeparatorText
|
|
97
|
+
|
|
98
|
+
local Left = Instance.new("Frame")
|
|
99
|
+
Left.Name = "Left"
|
|
100
|
+
Left.AnchorPoint = Vector2.new(1, 0.5)
|
|
101
|
+
Left.Size = UDim2.fromOffset(Iris._config.SeparatorTextPadding.X - Iris._config.ItemSpacing.X, Iris._config.SeparatorTextBorderSize)
|
|
102
|
+
Left.BackgroundColor3 = Iris._config.SeparatorColor
|
|
103
|
+
Left.BackgroundTransparency = Iris._config.SeparatorTransparency
|
|
104
|
+
Left.BorderSizePixel = 0
|
|
105
|
+
|
|
106
|
+
Left.Parent = SeparatorText
|
|
107
|
+
|
|
108
|
+
local Right = Instance.new("Frame")
|
|
109
|
+
Right.Name = "Right"
|
|
110
|
+
Right.AnchorPoint = Vector2.new(1, 0.5)
|
|
111
|
+
Right.Size = UDim2.new(1, 0, 0, Iris._config.SeparatorTextBorderSize)
|
|
112
|
+
Right.BackgroundColor3 = Iris._config.SeparatorColor
|
|
113
|
+
Right.BackgroundTransparency = Iris._config.SeparatorTransparency
|
|
114
|
+
Right.BorderSizePixel = 0
|
|
115
|
+
Right.LayoutOrder = 2
|
|
116
|
+
|
|
117
|
+
Right.Parent = SeparatorText
|
|
118
|
+
|
|
119
|
+
return SeparatorText
|
|
120
|
+
end,
|
|
121
|
+
Update = function(thisWidget: Types.SeparatorText)
|
|
122
|
+
local SeparatorText = thisWidget.Instance :: Frame
|
|
123
|
+
local TextLabel: TextLabel = SeparatorText.TextLabel
|
|
124
|
+
if thisWidget.arguments.Text == nil then
|
|
125
|
+
error("Text argument is required for Iris.SeparatorText().", 5)
|
|
126
|
+
end
|
|
127
|
+
TextLabel.Text = thisWidget.arguments.Text
|
|
128
|
+
end,
|
|
129
|
+
Discard = function(thisWidget: Types.SeparatorText)
|
|
130
|
+
thisWidget.Instance:Destroy()
|
|
131
|
+
end,
|
|
132
|
+
} :: Types.WidgetClass)
|
|
133
|
+
end
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
--!nocheck
|
|
2
|
+
local Types = require(script.Parent.Parent.iris_Types)
|
|
3
|
+
|
|
4
|
+
return function(Iris: Types.Internal, widgets: Types.WidgetUtility)
|
|
5
|
+
local abstractTree = {
|
|
6
|
+
hasState = true,
|
|
7
|
+
hasChildren = true,
|
|
8
|
+
Events = {
|
|
9
|
+
["collapsed"] = {
|
|
10
|
+
["Init"] = function(_thisWidget: Types.CollapsingHeader) end,
|
|
11
|
+
["Get"] = function(thisWidget: Types.CollapsingHeader)
|
|
12
|
+
return thisWidget.lastCollapsedTick == Iris._cycleTick
|
|
13
|
+
end,
|
|
14
|
+
},
|
|
15
|
+
["uncollapsed"] = {
|
|
16
|
+
["Init"] = function(_thisWidget: Types.CollapsingHeader) end,
|
|
17
|
+
["Get"] = function(thisWidget: Types.CollapsingHeader)
|
|
18
|
+
return thisWidget.lastUncollapsedTick == Iris._cycleTick
|
|
19
|
+
end,
|
|
20
|
+
},
|
|
21
|
+
["hovered"] = widgets.EVENTS.hover(function(thisWidget)
|
|
22
|
+
return thisWidget.Instance
|
|
23
|
+
end),
|
|
24
|
+
},
|
|
25
|
+
Discard = function(thisWidget: Types.CollapsingHeader)
|
|
26
|
+
thisWidget.Instance:Destroy()
|
|
27
|
+
widgets.discardState(thisWidget)
|
|
28
|
+
end,
|
|
29
|
+
ChildAdded = function(thisWidget: Types.CollapsingHeader, _thisChild: Types.Widget)
|
|
30
|
+
local ChildContainer = thisWidget.ChildContainer :: Frame
|
|
31
|
+
|
|
32
|
+
ChildContainer.Visible = thisWidget.state.isUncollapsed.value
|
|
33
|
+
|
|
34
|
+
return ChildContainer
|
|
35
|
+
end,
|
|
36
|
+
UpdateState = function(thisWidget: Types.CollapsingHeader)
|
|
37
|
+
local isUncollapsed = thisWidget.state.isUncollapsed.value
|
|
38
|
+
local Tree = thisWidget.Instance :: Frame
|
|
39
|
+
local ChildContainer = thisWidget.ChildContainer :: Frame
|
|
40
|
+
local Header = Tree.Header :: Frame
|
|
41
|
+
local Button = Header.Button :: TextButton
|
|
42
|
+
local Arrow: ImageLabel = Button.Arrow
|
|
43
|
+
|
|
44
|
+
Arrow.Image = (
|
|
45
|
+
isUncollapsed and widgets.ICONS.DOWN_POINTING_TRIANGLE or widgets.ICONS.RIGHT_POINTING_TRIANGLE
|
|
46
|
+
)
|
|
47
|
+
if isUncollapsed then
|
|
48
|
+
thisWidget.lastUncollapsedTick = Iris._cycleTick + 1
|
|
49
|
+
else
|
|
50
|
+
thisWidget.lastCollapsedTick = Iris._cycleTick + 1
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
ChildContainer.Visible = isUncollapsed
|
|
54
|
+
end,
|
|
55
|
+
GenerateState = function(thisWidget: Types.CollapsingHeader)
|
|
56
|
+
if thisWidget.state.isUncollapsed == nil then
|
|
57
|
+
thisWidget.state.isUncollapsed =
|
|
58
|
+
Iris._widgetState(thisWidget, "isUncollapsed", thisWidget.arguments.DefaultOpen or false)
|
|
59
|
+
end
|
|
60
|
+
end,
|
|
61
|
+
} :: Types.WidgetClass
|
|
62
|
+
|
|
63
|
+
--stylua: ignore
|
|
64
|
+
Iris.WidgetConstructor(
|
|
65
|
+
"Tree",
|
|
66
|
+
widgets.extend(abstractTree, {
|
|
67
|
+
Args = {
|
|
68
|
+
["Text"] = 1,
|
|
69
|
+
["SpanAvailWidth"] = 2,
|
|
70
|
+
["NoIndent"] = 3,
|
|
71
|
+
["DefaultOpen"] = 4,
|
|
72
|
+
},
|
|
73
|
+
Generate = function(thisWidget: Types.Tree)
|
|
74
|
+
local Tree = Instance.new("Frame")
|
|
75
|
+
Tree.Name = "Iris_Tree"
|
|
76
|
+
Tree.AutomaticSize = Enum.AutomaticSize.Y
|
|
77
|
+
Tree.Size = UDim2.new(Iris._config.ItemWidth, UDim.new(0, 0))
|
|
78
|
+
Tree.BackgroundTransparency = 1
|
|
79
|
+
Tree.BorderSizePixel = 0
|
|
80
|
+
|
|
81
|
+
widgets.UIListLayout(Tree, Enum.FillDirection.Vertical, UDim.new(0, 0))
|
|
82
|
+
|
|
83
|
+
local ChildContainer = Instance.new("Frame")
|
|
84
|
+
ChildContainer.Name = "TreeContainer"
|
|
85
|
+
ChildContainer.AutomaticSize = Enum.AutomaticSize.Y
|
|
86
|
+
ChildContainer.Size = UDim2.fromScale(1, 0)
|
|
87
|
+
ChildContainer.BackgroundTransparency = 1
|
|
88
|
+
ChildContainer.BorderSizePixel = 0
|
|
89
|
+
ChildContainer.LayoutOrder = 1
|
|
90
|
+
ChildContainer.Visible = false
|
|
91
|
+
-- ChildContainer.ClipsDescendants = true
|
|
92
|
+
|
|
93
|
+
widgets.UIListLayout(ChildContainer, Enum.FillDirection.Vertical, UDim.new(0, Iris._config.ItemSpacing.Y))
|
|
94
|
+
widgets.UIPadding(ChildContainer, Vector2.zero).PaddingTop = UDim.new(0, Iris._config.ItemSpacing.Y)
|
|
95
|
+
|
|
96
|
+
ChildContainer.Parent = Tree
|
|
97
|
+
|
|
98
|
+
local Header = Instance.new("Frame")
|
|
99
|
+
Header.Name = "Header"
|
|
100
|
+
Header.AutomaticSize = Enum.AutomaticSize.Y
|
|
101
|
+
Header.Size = UDim2.fromScale(1, 0)
|
|
102
|
+
Header.BackgroundTransparency = 1
|
|
103
|
+
Header.BorderSizePixel = 0
|
|
104
|
+
Header.Parent = Tree
|
|
105
|
+
|
|
106
|
+
local Button = Instance.new("TextButton")
|
|
107
|
+
Button.Name = "Button"
|
|
108
|
+
Button.BackgroundTransparency = 1
|
|
109
|
+
Button.BorderSizePixel = 0
|
|
110
|
+
Button.Text = ""
|
|
111
|
+
Button.AutoButtonColor = false
|
|
112
|
+
|
|
113
|
+
widgets.applyInteractionHighlights("Background", Button, Header, {
|
|
114
|
+
Color = Color3.fromRGB(0, 0, 0),
|
|
115
|
+
Transparency = 1,
|
|
116
|
+
HoveredColor = Iris._config.HeaderHoveredColor,
|
|
117
|
+
HoveredTransparency = Iris._config.HeaderHoveredTransparency,
|
|
118
|
+
ActiveColor = Iris._config.HeaderActiveColor,
|
|
119
|
+
ActiveTransparency = Iris._config.HeaderActiveTransparency,
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
widgets.UIPadding(Button, Vector2.zero).PaddingLeft = UDim.new(0, Iris._config.FramePadding.X)
|
|
123
|
+
widgets.UIListLayout(Button, Enum.FillDirection.Horizontal, UDim.new(0, Iris._config.FramePadding.X)).VerticalAlignment = Enum.VerticalAlignment.Center
|
|
124
|
+
|
|
125
|
+
Button.Parent = Header
|
|
126
|
+
|
|
127
|
+
local Arrow = Instance.new("ImageLabel")
|
|
128
|
+
Arrow.Name = "Arrow"
|
|
129
|
+
Arrow.Size = UDim2.fromOffset(Iris._config.TextSize, math.floor(Iris._config.TextSize * 0.7))
|
|
130
|
+
Arrow.BackgroundTransparency = 1
|
|
131
|
+
Arrow.BorderSizePixel = 0
|
|
132
|
+
Arrow.ImageColor3 = Iris._config.TextColor
|
|
133
|
+
Arrow.ImageTransparency = Iris._config.TextTransparency
|
|
134
|
+
Arrow.ScaleType = Enum.ScaleType.Fit
|
|
135
|
+
|
|
136
|
+
Arrow.Parent = Button
|
|
137
|
+
|
|
138
|
+
local TextLabel = Instance.new("TextLabel")
|
|
139
|
+
TextLabel.Name = "TextLabel"
|
|
140
|
+
TextLabel.AutomaticSize = Enum.AutomaticSize.XY
|
|
141
|
+
TextLabel.Size = UDim2.fromOffset(0, 0)
|
|
142
|
+
TextLabel.BackgroundTransparency = 1
|
|
143
|
+
TextLabel.BorderSizePixel = 0
|
|
144
|
+
|
|
145
|
+
widgets.UIPadding(TextLabel, Vector2.zero).PaddingRight = UDim.new(0, 21)
|
|
146
|
+
widgets.applyTextStyle(TextLabel)
|
|
147
|
+
|
|
148
|
+
TextLabel.Parent = Button
|
|
149
|
+
|
|
150
|
+
widgets.applyButtonClick(Button, function()
|
|
151
|
+
thisWidget.state.isUncollapsed:set(not thisWidget.state.isUncollapsed.value)
|
|
152
|
+
end)
|
|
153
|
+
|
|
154
|
+
thisWidget.ChildContainer = ChildContainer
|
|
155
|
+
return Tree
|
|
156
|
+
end,
|
|
157
|
+
Update = function(thisWidget: Types.Tree)
|
|
158
|
+
local Tree = thisWidget.Instance :: Frame
|
|
159
|
+
local ChildContainer = thisWidget.ChildContainer :: Frame
|
|
160
|
+
local Header = Tree.Header :: Frame
|
|
161
|
+
local Button = Header.Button :: TextButton
|
|
162
|
+
local TextLabel: TextLabel = Button.TextLabel
|
|
163
|
+
local Padding: UIPadding = ChildContainer.UIPadding
|
|
164
|
+
|
|
165
|
+
TextLabel.Text = thisWidget.arguments.Text or "Tree"
|
|
166
|
+
if thisWidget.arguments.SpanAvailWidth then
|
|
167
|
+
Button.AutomaticSize = Enum.AutomaticSize.Y
|
|
168
|
+
Button.Size = UDim2.fromScale(1, 0)
|
|
169
|
+
else
|
|
170
|
+
Button.AutomaticSize = Enum.AutomaticSize.XY
|
|
171
|
+
Button.Size = UDim2.fromScale(0, 0)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if thisWidget.arguments.NoIndent then
|
|
175
|
+
Padding.PaddingLeft = UDim.new(0, 0)
|
|
176
|
+
else
|
|
177
|
+
Padding.PaddingLeft = UDim.new(0, Iris._config.IndentSpacing)
|
|
178
|
+
end
|
|
179
|
+
end,
|
|
180
|
+
})
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
--stylua: ignore
|
|
184
|
+
Iris.WidgetConstructor(
|
|
185
|
+
"CollapsingHeader",
|
|
186
|
+
widgets.extend(abstractTree, {
|
|
187
|
+
Args = {
|
|
188
|
+
["Text"] = 1,
|
|
189
|
+
["DefaultOpen"] = 2
|
|
190
|
+
},
|
|
191
|
+
Generate = function(thisWidget: Types.CollapsingHeader)
|
|
192
|
+
local CollapsingHeader = Instance.new("Frame")
|
|
193
|
+
CollapsingHeader.Name = "Iris_CollapsingHeader"
|
|
194
|
+
CollapsingHeader.AutomaticSize = Enum.AutomaticSize.Y
|
|
195
|
+
CollapsingHeader.Size = UDim2.new(Iris._config.ItemWidth, UDim.new(0, 0))
|
|
196
|
+
CollapsingHeader.BackgroundTransparency = 1
|
|
197
|
+
CollapsingHeader.BorderSizePixel = 0
|
|
198
|
+
|
|
199
|
+
widgets.UIListLayout(CollapsingHeader, Enum.FillDirection.Vertical, UDim.new(0, 0))
|
|
200
|
+
|
|
201
|
+
local ChildContainer = Instance.new("Frame")
|
|
202
|
+
ChildContainer.Name = "CollapsingHeaderContainer"
|
|
203
|
+
ChildContainer.AutomaticSize = Enum.AutomaticSize.Y
|
|
204
|
+
ChildContainer.Size = UDim2.fromScale(1, 0)
|
|
205
|
+
ChildContainer.BackgroundTransparency = 1
|
|
206
|
+
ChildContainer.BorderSizePixel = 0
|
|
207
|
+
ChildContainer.LayoutOrder = 1
|
|
208
|
+
ChildContainer.Visible = false
|
|
209
|
+
-- ChildContainer.ClipsDescendants = true
|
|
210
|
+
|
|
211
|
+
widgets.UIListLayout(ChildContainer, Enum.FillDirection.Vertical, UDim.new(0, Iris._config.ItemSpacing.Y))
|
|
212
|
+
widgets.UIPadding(ChildContainer, Vector2.zero).PaddingTop = UDim.new(0, Iris._config.ItemSpacing.Y)
|
|
213
|
+
|
|
214
|
+
ChildContainer.Parent = CollapsingHeader
|
|
215
|
+
|
|
216
|
+
local Header = Instance.new("Frame")
|
|
217
|
+
Header.Name = "Header"
|
|
218
|
+
Header.AutomaticSize = Enum.AutomaticSize.Y
|
|
219
|
+
Header.Size = UDim2.fromScale(1, 0)
|
|
220
|
+
Header.BackgroundTransparency = 1
|
|
221
|
+
Header.BorderSizePixel = 0
|
|
222
|
+
Header.Parent = CollapsingHeader
|
|
223
|
+
|
|
224
|
+
local Button = Instance.new("TextButton")
|
|
225
|
+
Button.Name = "Button"
|
|
226
|
+
Button.AutomaticSize = Enum.AutomaticSize.Y
|
|
227
|
+
Button.Size = UDim2.fromScale(1, 0)
|
|
228
|
+
Button.BackgroundColor3 = Iris._config.HeaderColor
|
|
229
|
+
Button.BackgroundTransparency = Iris._config.HeaderTransparency
|
|
230
|
+
Button.BorderSizePixel = 0
|
|
231
|
+
Button.Text = ""
|
|
232
|
+
Button.AutoButtonColor = false
|
|
233
|
+
Button.ClipsDescendants = true
|
|
234
|
+
|
|
235
|
+
widgets.UIPadding(Button, Iris._config.FramePadding) -- we add a custom padding because it extends on both sides
|
|
236
|
+
widgets.applyFrameStyle(Button, true)
|
|
237
|
+
widgets.UIListLayout(Button, Enum.FillDirection.Horizontal, UDim.new(0, 2 * Iris._config.FramePadding.X)).VerticalAlignment = Enum.VerticalAlignment.Center
|
|
238
|
+
|
|
239
|
+
widgets.applyInteractionHighlights("Background", Button, Button, {
|
|
240
|
+
Color = Iris._config.HeaderColor,
|
|
241
|
+
Transparency = Iris._config.HeaderTransparency,
|
|
242
|
+
HoveredColor = Iris._config.HeaderHoveredColor,
|
|
243
|
+
HoveredTransparency = Iris._config.HeaderHoveredTransparency,
|
|
244
|
+
ActiveColor = Iris._config.HeaderActiveColor,
|
|
245
|
+
ActiveTransparency = Iris._config.HeaderActiveTransparency,
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
Button.Parent = Header
|
|
249
|
+
|
|
250
|
+
local Arrow = Instance.new("ImageLabel")
|
|
251
|
+
Arrow.Name = "Arrow"
|
|
252
|
+
Arrow.AutomaticSize = Enum.AutomaticSize.Y
|
|
253
|
+
Arrow.Size = UDim2.fromOffset(Iris._config.TextSize, math.ceil(Iris._config.TextSize * 0.8))
|
|
254
|
+
Arrow.BackgroundTransparency = 1
|
|
255
|
+
Arrow.BorderSizePixel = 0
|
|
256
|
+
Arrow.ImageColor3 = Iris._config.TextColor
|
|
257
|
+
Arrow.ImageTransparency = Iris._config.TextTransparency
|
|
258
|
+
Arrow.ScaleType = Enum.ScaleType.Fit
|
|
259
|
+
|
|
260
|
+
Arrow.Parent = Button
|
|
261
|
+
|
|
262
|
+
local TextLabel = Instance.new("TextLabel")
|
|
263
|
+
TextLabel.Name = "TextLabel"
|
|
264
|
+
TextLabel.AutomaticSize = Enum.AutomaticSize.XY
|
|
265
|
+
TextLabel.Size = UDim2.fromOffset(0, 0)
|
|
266
|
+
TextLabel.BackgroundTransparency = 1
|
|
267
|
+
TextLabel.BorderSizePixel = 0
|
|
268
|
+
|
|
269
|
+
widgets.UIPadding(TextLabel, Vector2.zero).PaddingRight = UDim.new(0, 21)
|
|
270
|
+
widgets.applyTextStyle(TextLabel)
|
|
271
|
+
|
|
272
|
+
TextLabel.Parent = Button
|
|
273
|
+
|
|
274
|
+
widgets.applyButtonClick(Button, function()
|
|
275
|
+
thisWidget.state.isUncollapsed:set(not thisWidget.state.isUncollapsed.value)
|
|
276
|
+
end)
|
|
277
|
+
|
|
278
|
+
thisWidget.ChildContainer = ChildContainer
|
|
279
|
+
return CollapsingHeader
|
|
280
|
+
end,
|
|
281
|
+
Update = function(thisWidget: Types.CollapsingHeader)
|
|
282
|
+
local Tree = thisWidget.Instance :: Frame
|
|
283
|
+
local Header = Tree.Header :: Frame
|
|
284
|
+
local Button = Header.Button :: TextButton
|
|
285
|
+
local TextLabel: TextLabel = Button.TextLabel
|
|
286
|
+
|
|
287
|
+
TextLabel.Text = thisWidget.arguments.Text or "Collapsing Header"
|
|
288
|
+
end,
|
|
289
|
+
})
|
|
290
|
+
)
|
|
291
|
+
end
|