@rbxts/react-clean-ui 1.0.5
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 +3 -0
- package/out/Components/Decorator/BoxShadow.d.ts +10 -0
- package/out/Components/Decorator/BoxShadow.luau +41 -0
- package/out/Components/Decorator/Corners.d.ts +7 -0
- package/out/Components/Decorator/Corners.luau +15 -0
- package/out/Components/Decorator/Padding.d.ts +3 -0
- package/out/Components/Decorator/Padding.luau +18 -0
- package/out/Components/Decorator/index.d.ts +3 -0
- package/out/Components/Decorator/init.luau +13 -0
- package/out/Components/Input/Button.d.ts +24 -0
- package/out/Components/Input/Button.luau +159 -0
- package/out/Components/Input/Checkbox.d.ts +12 -0
- package/out/Components/Input/Checkbox.luau +79 -0
- package/out/Components/Input/HoverButton.d.ts +16 -0
- package/out/Components/Input/HoverButton.luau +127 -0
- package/out/Components/Input/Input.d.ts +12 -0
- package/out/Components/Input/Input.luau +92 -0
- package/out/Components/Input/Select.d.ts +30 -0
- package/out/Components/Input/Select.luau +288 -0
- package/out/Components/Input/Slider.d.ts +51 -0
- package/out/Components/Input/Slider.luau +415 -0
- package/out/Components/Input/index.d.ts +6 -0
- package/out/Components/Input/init.luau +22 -0
- package/out/Components/Layout/Column.d.ts +13 -0
- package/out/Components/Layout/Column.luau +60 -0
- package/out/Components/Layout/Container.d.ts +6 -0
- package/out/Components/Layout/Container.luau +73 -0
- package/out/Components/Layout/Draggable.d.ts +46 -0
- package/out/Components/Layout/Draggable.luau +315 -0
- package/out/Components/Layout/Droppable.d.ts +10 -0
- package/out/Components/Layout/Droppable.luau +34 -0
- package/out/Components/Layout/Fieldset.d.ts +34 -0
- package/out/Components/Layout/Fieldset.luau +130 -0
- package/out/Components/Layout/FlexItem.d.ts +11 -0
- package/out/Components/Layout/FlexItem.luau +20 -0
- package/out/Components/Layout/Group.d.ts +34 -0
- package/out/Components/Layout/Group.luau +168 -0
- package/out/Components/Layout/HStack.d.ts +12 -0
- package/out/Components/Layout/HStack.luau +21 -0
- package/out/Components/Layout/Row.d.ts +15 -0
- package/out/Components/Layout/Row.luau +87 -0
- package/out/Components/Layout/Scroller.d.ts +7 -0
- package/out/Components/Layout/Scroller.luau +54 -0
- package/out/Components/Layout/Tabs.d.ts +31 -0
- package/out/Components/Layout/Tabs.luau +189 -0
- package/out/Components/Layout/VStack.d.ts +11 -0
- package/out/Components/Layout/VStack.luau +21 -0
- package/out/Components/Layout/index.d.ts +12 -0
- package/out/Components/Layout/init.luau +40 -0
- package/out/Components/Navigation/Menu.d.ts +19 -0
- package/out/Components/Navigation/Menu.luau +91 -0
- package/out/Components/Navigation/index.d.ts +1 -0
- package/out/Components/Navigation/init.luau +7 -0
- package/out/Components/Surface/Box.d.ts +7 -0
- package/out/Components/Surface/Box.luau +50 -0
- package/out/Components/Surface/Card.d.ts +25 -0
- package/out/Components/Surface/Card.luau +138 -0
- package/out/Components/Surface/Icon.d.ts +10 -0
- package/out/Components/Surface/Icon.luau +64 -0
- package/out/Components/Surface/Panel.d.ts +4 -0
- package/out/Components/Surface/Panel.luau +33 -0
- package/out/Components/Surface/index.d.ts +4 -0
- package/out/Components/Surface/init.luau +16 -0
- package/out/Components/Typography/Text.d.ts +18 -0
- package/out/Components/Typography/Text.luau +48 -0
- package/out/Components/Typography/index.d.ts +1 -0
- package/out/Components/Typography/init.luau +7 -0
- package/out/Components/index.d.ts +8 -0
- package/out/Components/init.luau +28 -0
- package/out/Contexts/draggable.context.d.ts +8 -0
- package/out/Contexts/draggable.context.luau +7 -0
- package/out/Contexts/droppable.context.d.ts +6 -0
- package/out/Contexts/droppable.context.luau +7 -0
- package/out/Contexts/index.d.ts +6 -0
- package/out/Contexts/init.luau +22 -0
- package/out/Contexts/navigation.context.d.ts +5 -0
- package/out/Contexts/navigation.context.luau +9 -0
- package/out/Contexts/overlay.context.d.ts +13 -0
- package/out/Contexts/overlay.context.luau +17 -0
- package/out/Contexts/row.context.d.ts +9 -0
- package/out/Contexts/row.context.luau +12 -0
- package/out/Contexts/theme.context.d.ts +3 -0
- package/out/Contexts/theme.context.luau +8 -0
- package/out/Helpers/breakpoint.helper.d.ts +7 -0
- package/out/Helpers/breakpoint.helper.luau +124 -0
- package/out/Helpers/color.helper.d.ts +5 -0
- package/out/Helpers/color.helper.luau +101 -0
- package/out/Helpers/create-ui-story.d.ts +16 -0
- package/out/Helpers/create-ui-story.luau +38 -0
- package/out/Helpers/css.helper.d.ts +12 -0
- package/out/Helpers/css.helper.luau +114 -0
- package/out/Helpers/gui.helper.d.ts +10 -0
- package/out/Helpers/gui.helper.luau +134 -0
- package/out/Helpers/index.d.ts +8 -0
- package/out/Helpers/init.luau +28 -0
- package/out/Helpers/size.helper.d.ts +14 -0
- package/out/Helpers/size.helper.luau +162 -0
- package/out/Helpers/spacing.helper.d.ts +7 -0
- package/out/Helpers/spacing.helper.luau +57 -0
- package/out/Helpers/typography.helper.d.ts +7 -0
- package/out/Helpers/typography.helper.luau +91 -0
- package/out/Interfaces/clean.element.props.d.ts +109 -0
- package/out/Interfaces/clean.element.props.luau +5 -0
- package/out/Interfaces/icon.d.ts +2 -0
- package/out/Interfaces/icon.luau +2 -0
- package/out/Interfaces/index.d.ts +3 -0
- package/out/Interfaces/init.luau +13 -0
- package/out/Interfaces/userinput.d.ts +22 -0
- package/out/Interfaces/userinput.luau +8 -0
- package/out/Providers/index.d.ts +3 -0
- package/out/Providers/init.luau +13 -0
- package/out/Providers/overlay.provider.d.ts +3 -0
- package/out/Providers/overlay.provider.luau +25 -0
- package/out/Providers/registry.provider.d.ts +33 -0
- package/out/Providers/registry.provider.luau +119 -0
- package/out/Providers/theme.provider.d.ts +8 -0
- package/out/Providers/theme.provider.luau +12 -0
- package/out/Theme/CleanTheme.d.ts +169 -0
- package/out/Theme/CleanTheme.luau +2 -0
- package/out/Theme/DefaultIcons.d.ts +2 -0
- package/out/Theme/DefaultIcons.luau +791 -0
- package/out/Theme/index.d.ts +3 -0
- package/out/Theme/init.luau +13 -0
- package/out/Theme/themes/dark.theme.d.ts +2 -0
- package/out/Theme/themes/dark.theme.luau +345 -0
- package/out/Theme/themes/default.theme.d.ts +2 -0
- package/out/Theme/themes/default.theme.luau +403 -0
- package/out/Theme/themes/index.d.ts +3 -0
- package/out/Theme/themes/init.luau +13 -0
- package/out/Theme/themes/sandstone.theme.d.ts +2 -0
- package/out/Theme/themes/sandstone.theme.luau +345 -0
- package/out/index.d.ts +6 -0
- package/out/init.luau +22 -0
- package/package.json +43 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
-- This registry is used to keep a global map of GuiObjects => React components
|
|
5
|
+
-- For example Droppable zones use this to register themselves
|
|
6
|
+
local DroppableRegistryKey = {
|
|
7
|
+
name = "Droppable",
|
|
8
|
+
}
|
|
9
|
+
local DraggableRegistryKey = {
|
|
10
|
+
name = "Draggable",
|
|
11
|
+
}
|
|
12
|
+
local RegistryContext = React.createContext(nil)
|
|
13
|
+
local function RegistryProvider(props)
|
|
14
|
+
local entries = React.useRef({})
|
|
15
|
+
local register = function(guiObject, key, value)
|
|
16
|
+
local _current = entries.current
|
|
17
|
+
local _name = key.name
|
|
18
|
+
local keyEntries = _current[_name]
|
|
19
|
+
if keyEntries == nil then
|
|
20
|
+
keyEntries = {}
|
|
21
|
+
local _current_1 = entries.current
|
|
22
|
+
local _name_1 = key.name
|
|
23
|
+
local _keyEntries = keyEntries
|
|
24
|
+
_current_1[_name_1] = _keyEntries
|
|
25
|
+
end
|
|
26
|
+
local _keyEntries = keyEntries
|
|
27
|
+
local _guiObject = guiObject
|
|
28
|
+
local _value = value
|
|
29
|
+
_keyEntries[_guiObject] = _value
|
|
30
|
+
end
|
|
31
|
+
local unregister = function(guiObject, key)
|
|
32
|
+
local _current = entries.current
|
|
33
|
+
local _name = key.name
|
|
34
|
+
local keyEntries = _current[_name]
|
|
35
|
+
if keyEntries == nil then
|
|
36
|
+
return nil
|
|
37
|
+
end
|
|
38
|
+
local _guiObject = guiObject
|
|
39
|
+
keyEntries[_guiObject] = nil
|
|
40
|
+
-- ▼ ReadonlyMap.size ▼
|
|
41
|
+
local _size = 0
|
|
42
|
+
for _ in keyEntries do
|
|
43
|
+
_size += 1
|
|
44
|
+
end
|
|
45
|
+
-- ▲ ReadonlyMap.size ▲
|
|
46
|
+
if _size == 0 then
|
|
47
|
+
local _current_1 = entries.current
|
|
48
|
+
local _name_1 = key.name
|
|
49
|
+
_current_1[_name_1] = nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
local get = function(guiObject, key)
|
|
53
|
+
local _current = entries.current
|
|
54
|
+
local _name = key.name
|
|
55
|
+
local _result = _current[_name]
|
|
56
|
+
if _result ~= nil then
|
|
57
|
+
local _guiObject = guiObject
|
|
58
|
+
_result = _result[_guiObject]
|
|
59
|
+
end
|
|
60
|
+
return _result
|
|
61
|
+
end
|
|
62
|
+
local getAll = function(key)
|
|
63
|
+
local _current = entries.current
|
|
64
|
+
local _name = key.name
|
|
65
|
+
local keyEntries = _current[_name]
|
|
66
|
+
if keyEntries == nil then
|
|
67
|
+
return {}
|
|
68
|
+
end
|
|
69
|
+
local result = {}
|
|
70
|
+
for _, value in keyEntries do
|
|
71
|
+
table.insert(result, value)
|
|
72
|
+
end
|
|
73
|
+
return result
|
|
74
|
+
end
|
|
75
|
+
local contextValue = {
|
|
76
|
+
register = register,
|
|
77
|
+
unregister = unregister,
|
|
78
|
+
get = get,
|
|
79
|
+
getAll = getAll,
|
|
80
|
+
}
|
|
81
|
+
return React.createElement(RegistryContext.Provider, {
|
|
82
|
+
value = contextValue,
|
|
83
|
+
}, props.children)
|
|
84
|
+
end
|
|
85
|
+
local function useRegistryRegistration(key, createRegistration, dependencies)
|
|
86
|
+
local registry = React.useContext(RegistryContext)
|
|
87
|
+
local guiObject, setGuiObject = React.useState()
|
|
88
|
+
local _exp = function()
|
|
89
|
+
if guiObject == nil then
|
|
90
|
+
return nil
|
|
91
|
+
end
|
|
92
|
+
return createRegistration(guiObject)
|
|
93
|
+
end
|
|
94
|
+
local _array = { guiObject }
|
|
95
|
+
local _length = #_array
|
|
96
|
+
table.move(dependencies, 1, #dependencies, _length + 1, _array)
|
|
97
|
+
local registration = React.useMemo(_exp, _array)
|
|
98
|
+
React.useEffect(function()
|
|
99
|
+
if registry == nil or guiObject == nil or registration == nil then
|
|
100
|
+
return nil
|
|
101
|
+
end
|
|
102
|
+
registry.register(guiObject, key, registration)
|
|
103
|
+
return function()
|
|
104
|
+
registry.unregister(guiObject, key)
|
|
105
|
+
end
|
|
106
|
+
end, { registry, guiObject, key, registration })
|
|
107
|
+
return {
|
|
108
|
+
ref = setGuiObject,
|
|
109
|
+
guiObject = guiObject,
|
|
110
|
+
registration = registration,
|
|
111
|
+
}
|
|
112
|
+
end
|
|
113
|
+
return {
|
|
114
|
+
RegistryProvider = RegistryProvider,
|
|
115
|
+
useRegistryRegistration = useRegistryRegistration,
|
|
116
|
+
DroppableRegistryKey = DroppableRegistryKey,
|
|
117
|
+
DraggableRegistryKey = DraggableRegistryKey,
|
|
118
|
+
RegistryContext = RegistryContext,
|
|
119
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent, "Contexts").CleanThemeContext
|
|
5
|
+
local function ThemeProvider(props)
|
|
6
|
+
return React.createElement(CleanThemeContext.Provider, {
|
|
7
|
+
value = props.theme,
|
|
8
|
+
}, props.children)
|
|
9
|
+
end
|
|
10
|
+
return {
|
|
11
|
+
ThemeProvider = ThemeProvider,
|
|
12
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { CssShadow, CssSize, Breakpoint, BreakpointValue, ScaleSizeValue, ScaleSize, Intent, IconSet, TextVariant, ButtonFlag } from "../Interfaces/";
|
|
2
|
+
export interface TypographyStyle {
|
|
3
|
+
font: Enum.Font;
|
|
4
|
+
size: Enum.FontSize;
|
|
5
|
+
weight?: Enum.FontWeight;
|
|
6
|
+
lineHeight?: number;
|
|
7
|
+
}
|
|
8
|
+
export type ScaledTypographyStyle = Partial<Record<ScaleSize, Partial<TypographyStyle>>>;
|
|
9
|
+
export interface IntentScheme {
|
|
10
|
+
textColor: Color3;
|
|
11
|
+
backgroundColor: Color3;
|
|
12
|
+
borderColor: Color3;
|
|
13
|
+
backgroundTransparency?: number;
|
|
14
|
+
boxShadow?: CssShadow;
|
|
15
|
+
typography?: Partial<TypographyStyle>;
|
|
16
|
+
}
|
|
17
|
+
export interface IntentColors extends Partial<Record<ButtonFlag, IntentScheme>> {
|
|
18
|
+
default: IntentScheme;
|
|
19
|
+
hover?: IntentScheme;
|
|
20
|
+
focus?: IntentScheme;
|
|
21
|
+
}
|
|
22
|
+
export type InlineIntentColors = {
|
|
23
|
+
[State in keyof IntentColors]?: Partial<NonNullable<IntentColors[State]>>;
|
|
24
|
+
};
|
|
25
|
+
export interface CleanTheme {
|
|
26
|
+
colors: {
|
|
27
|
+
intents: Record<Intent, IntentColors>;
|
|
28
|
+
};
|
|
29
|
+
breakpoints: BreakpointValue<number>;
|
|
30
|
+
default: {
|
|
31
|
+
scale: ScaleSize;
|
|
32
|
+
spacing: ScaleSize;
|
|
33
|
+
};
|
|
34
|
+
spacing: ScaleSizeValue<number>;
|
|
35
|
+
radius: {
|
|
36
|
+
sm: number;
|
|
37
|
+
md: number;
|
|
38
|
+
lg: number;
|
|
39
|
+
default: Breakpoint;
|
|
40
|
+
};
|
|
41
|
+
typography: {
|
|
42
|
+
display: TypographyStyle;
|
|
43
|
+
title: TypographyStyle;
|
|
44
|
+
heading: TypographyStyle;
|
|
45
|
+
body: TypographyStyle;
|
|
46
|
+
label: TypographyStyle;
|
|
47
|
+
caption: TypographyStyle;
|
|
48
|
+
};
|
|
49
|
+
typeScaleMap: Record<ScaleSize, TextVariant>;
|
|
50
|
+
components: {
|
|
51
|
+
draggable: {
|
|
52
|
+
placeholder: {
|
|
53
|
+
backgroundColor: Color3;
|
|
54
|
+
backgroundTransparency: number;
|
|
55
|
+
borderColor: Color3;
|
|
56
|
+
borderThickness: number;
|
|
57
|
+
cornerRadius: CssSize;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
scroller: {
|
|
61
|
+
barColor: Color3;
|
|
62
|
+
};
|
|
63
|
+
boxShadow: {
|
|
64
|
+
color: Color3;
|
|
65
|
+
transparency: number;
|
|
66
|
+
};
|
|
67
|
+
box: {
|
|
68
|
+
backgroundColor: Color3;
|
|
69
|
+
backgroundTransparency: number;
|
|
70
|
+
borderColor: Color3;
|
|
71
|
+
borderThickness: number;
|
|
72
|
+
cornerRadius: CssSize;
|
|
73
|
+
boxShadow?: CssShadow;
|
|
74
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
75
|
+
};
|
|
76
|
+
button: {
|
|
77
|
+
backgroundTransparency: number;
|
|
78
|
+
cornerRadius: CssSize;
|
|
79
|
+
boxShadow?: CssShadow;
|
|
80
|
+
borderThickness: number;
|
|
81
|
+
typography?: Partial<TypographyStyle> | ScaledTypographyStyle;
|
|
82
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
83
|
+
};
|
|
84
|
+
input: {
|
|
85
|
+
borderColor: Color3;
|
|
86
|
+
borderThickness: number;
|
|
87
|
+
cornerRadius: CssSize;
|
|
88
|
+
typography?: Partial<TypographyStyle> | ScaledTypographyStyle;
|
|
89
|
+
};
|
|
90
|
+
select: {
|
|
91
|
+
borderColor: Color3;
|
|
92
|
+
borderThickness: number;
|
|
93
|
+
cornerRadius: CssSize;
|
|
94
|
+
dropDownBackgroundColor: Color3;
|
|
95
|
+
typography?: Partial<TypographyStyle> | ScaledTypographyStyle;
|
|
96
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
97
|
+
maxDropDownHeight: number;
|
|
98
|
+
};
|
|
99
|
+
checkbox: {
|
|
100
|
+
borderColor: Color3;
|
|
101
|
+
borderThickness: number;
|
|
102
|
+
cornerRadius: CssSize;
|
|
103
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
104
|
+
spacing?: ScaleSizeValue<number>;
|
|
105
|
+
};
|
|
106
|
+
tabs: {
|
|
107
|
+
borderColor: Color3;
|
|
108
|
+
backgroundColor: Color3;
|
|
109
|
+
borderThickness: number;
|
|
110
|
+
cornerRadius: CssSize;
|
|
111
|
+
spacing?: ScaleSizeValue<number>;
|
|
112
|
+
list: {
|
|
113
|
+
borderColor?: Color3;
|
|
114
|
+
backgroundColor?: Color3;
|
|
115
|
+
borderThickness: number;
|
|
116
|
+
cornerRadius: CssSize;
|
|
117
|
+
spacing?: ScaleSizeValue<number>;
|
|
118
|
+
};
|
|
119
|
+
button: {
|
|
120
|
+
borderThickness: number;
|
|
121
|
+
cornerRadius: CssSize;
|
|
122
|
+
spacing?: ScaleSizeValue<number>;
|
|
123
|
+
boxShadow?: CssShadow;
|
|
124
|
+
typography?: Partial<TypographyStyle> | ScaledTypographyStyle;
|
|
125
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
card: {
|
|
129
|
+
borderThickness: number;
|
|
130
|
+
cornerRadius: CssSize;
|
|
131
|
+
header: {
|
|
132
|
+
spacing?: ScaleSizeValue<number>;
|
|
133
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
134
|
+
};
|
|
135
|
+
footer: {
|
|
136
|
+
spacing?: ScaleSizeValue<number>;
|
|
137
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
slider: {
|
|
141
|
+
height: CssSize;
|
|
142
|
+
bar: {
|
|
143
|
+
height: CssSize;
|
|
144
|
+
padding: CssSize;
|
|
145
|
+
borderColor: Color3;
|
|
146
|
+
borderThickness: number;
|
|
147
|
+
cornerRadius: CssSize;
|
|
148
|
+
backgroundColor: Color3;
|
|
149
|
+
backgroundTransparency: number;
|
|
150
|
+
highlight: {
|
|
151
|
+
borderColor: Color3;
|
|
152
|
+
backgroundColor: Color3;
|
|
153
|
+
backgroundTransparency: number;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
handle: {
|
|
157
|
+
boxShadow?: CssShadow;
|
|
158
|
+
borderColor: Color3;
|
|
159
|
+
borderThickness: number;
|
|
160
|
+
cornerRadius: CssSize;
|
|
161
|
+
backgroundColor: Color3;
|
|
162
|
+
backgroundTransparency: number;
|
|
163
|
+
aspectRation?: number;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
icons: Partial<IconSet>;
|
|
168
|
+
iconSize: ScaleSizeValue<number>;
|
|
169
|
+
}
|