@rbxts/uiblox 0.2.0-alpha.19 → 0.2.0-alpha.20

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.
@@ -5,6 +5,7 @@ export interface AccordionProps {
5
5
  open?: boolean;
6
6
  defaultOpen?: boolean;
7
7
  disabled?: boolean;
8
+ square?: boolean;
8
9
  onChange?: (open: boolean) => void;
9
10
  children?: React.ReactNode;
10
11
  }
@@ -14,6 +14,7 @@ local function Accordion(props)
14
14
  local controlled = _binding.open
15
15
  local defaultOpen = _binding.defaultOpen
16
16
  local disabled = _binding.disabled
17
+ local square = _binding.square
17
18
  local onChange = _binding.onChange
18
19
  local children = _binding.children
19
20
  local className = _binding.className
@@ -59,49 +60,52 @@ local function Accordion(props)
59
60
  _attributes[_k] = _v
60
61
  end
61
62
  end
62
- local _attributes_1 = table.clone(styles.corner)
63
+ local _condition_1 = square ~= true
64
+ if _condition_1 then
65
+ local _attributes_1 = table.clone(styles.corner)
66
+ setmetatable(_attributes_1, nil)
67
+ _condition_1 = React.createElement("uicorner", _attributes_1)
68
+ end
69
+ local _attributes_1 = table.clone(styles.list)
63
70
  setmetatable(_attributes_1, nil)
64
- local _exp = React.createElement("uicorner", _attributes_1)
65
- local _attributes_2 = table.clone(styles.list)
66
- setmetatable(_attributes_2, nil)
67
- local _exp_1 = React.createElement("uilistlayout", _attributes_2)
68
- local _attributes_3 = {
71
+ local _exp = React.createElement("uilistlayout", _attributes_1)
72
+ local _attributes_2 = {
69
73
  key = "Header",
70
74
  }
71
75
  for _k, _v in styles.header do
72
- _attributes_3[_k] = _v
76
+ _attributes_2[_k] = _v
73
77
  end
74
- _attributes_3.Event = {
78
+ _attributes_2.Event = {
75
79
  Activated = toggle,
76
80
  }
77
- local _attributes_4 = table.clone(styles.padding)
78
- setmetatable(_attributes_4, nil)
79
- local _exp_2 = React.createElement("uipadding", _attributes_4)
80
- local _attributes_5 = {
81
+ local _attributes_3 = table.clone(styles.padding)
82
+ setmetatable(_attributes_3, nil)
83
+ local _exp_1 = React.createElement("uipadding", _attributes_3)
84
+ local _attributes_4 = {
81
85
  key = "Title",
82
86
  }
83
87
  for _k, _v in styles.title do
84
- _attributes_5[_k] = _v
88
+ _attributes_4[_k] = _v
85
89
  end
86
- _attributes_5.Text = title
87
- local _exp_3 = React.createElement("textlabel", _attributes_5)
88
- local _attributes_6 = {
90
+ _attributes_4.Text = title
91
+ local _exp_2 = React.createElement("textlabel", _attributes_4)
92
+ local _attributes_5 = {
89
93
  key = "Icon",
90
94
  }
91
95
  for _k, _v in styles.icon do
92
- _attributes_6[_k] = _v
96
+ _attributes_5[_k] = _v
93
97
  end
94
- _attributes_6.Image = if accordionGlyph(open) == "expanded" then Icons.Expanded else Icons.Collapsed
95
- local _exp_4 = React.createElement("textbutton", _attributes_3, _exp_2, _exp_3, React.createElement("imagelabel", _attributes_6))
96
- local _attributes_7 = {
98
+ _attributes_5.Image = if accordionGlyph(open) == "expanded" then Icons.Expanded else Icons.Collapsed
99
+ local _exp_3 = React.createElement("textbutton", _attributes_2, _exp_1, _exp_2, React.createElement("imagelabel", _attributes_5))
100
+ local _attributes_6 = {
97
101
  key = "Body",
98
102
  }
99
103
  for _k, _v in styles.body do
100
- _attributes_7[_k] = _v
104
+ _attributes_6[_k] = _v
101
105
  end
102
- local _attributes_8 = table.clone(styles.padding)
103
- setmetatable(_attributes_8, nil)
104
- return React.createElement("frame", _attributes, _exp, _exp_1, _exp_4, React.createElement("frame", _attributes_7, React.createElement("uipadding", _attributes_8), children))
106
+ local _attributes_7 = table.clone(styles.padding)
107
+ setmetatable(_attributes_7, nil)
108
+ return React.createElement("frame", _attributes, _condition_1, _exp, _exp_3, React.createElement("frame", _attributes_6, React.createElement("uipadding", _attributes_7), children))
105
109
  end
106
110
  local default = Accordion
107
111
  return {
@@ -6,6 +6,7 @@ export interface AlertProps {
6
6
  message: string;
7
7
  onClose?: () => void;
8
8
  filled?: boolean;
9
+ square?: boolean;
9
10
  }
10
11
  declare function Alert(props: CustomizedProps<Frame, AlertProps>): JSX.Element;
11
12
  export default Alert;
@@ -10,6 +10,7 @@ local function Alert(props)
10
10
  local message = _binding.message
11
11
  local onClose = _binding.onClose
12
12
  local filled = _binding.filled
13
+ local square = _binding.square
13
14
  local className = _binding.className
14
15
  local sx = _binding.sx
15
16
  local id = _binding.id
@@ -43,56 +44,59 @@ local function Alert(props)
43
44
  local _attributes_1 = table.clone(styles.padding)
44
45
  setmetatable(_attributes_1, nil)
45
46
  local _exp = React.createElement("uipadding", _attributes_1)
46
- local _attributes_2 = table.clone(styles.corner)
47
- setmetatable(_attributes_2, nil)
48
- local _exp_1 = React.createElement("uicorner", _attributes_2)
49
- local _attributes_3 = table.clone(styles.stroke)
50
- setmetatable(_attributes_3, nil)
51
- local _exp_2 = React.createElement("uistroke", _attributes_3)
52
- local _condition_1 = dismissible
47
+ local _condition_1 = square ~= true
53
48
  if _condition_1 then
54
- local _attributes_4 = {
49
+ local _attributes_2 = table.clone(styles.corner)
50
+ setmetatable(_attributes_2, nil)
51
+ _condition_1 = React.createElement("uicorner", _attributes_2)
52
+ end
53
+ local _attributes_2 = table.clone(styles.stroke)
54
+ setmetatable(_attributes_2, nil)
55
+ local _exp_1 = React.createElement("uistroke", _attributes_2)
56
+ local _condition_2 = dismissible
57
+ if _condition_2 then
58
+ local _attributes_3 = {
55
59
  key = "Close",
56
60
  }
57
61
  for _k, _v in styles.close do
58
- _attributes_4[_k] = _v
62
+ _attributes_3[_k] = _v
59
63
  end
60
- _attributes_4.Image = tostring(Icons.Close)
61
- _attributes_4.Event = {
64
+ _attributes_3.Image = tostring(Icons.Close)
65
+ _attributes_3.Event = {
62
66
  Activated = function()
63
67
  return onClose()
64
68
  end,
65
69
  }
66
- _condition_1 = (React.createElement("imagebutton", _attributes_4))
70
+ _condition_2 = (React.createElement("imagebutton", _attributes_3))
67
71
  end
68
- local _attributes_4 = {
72
+ local _attributes_3 = {
69
73
  key = "Body",
70
74
  }
71
75
  for _k, _v in styles.body do
72
- _attributes_4[_k] = _v
76
+ _attributes_3[_k] = _v
73
77
  end
74
- local _attributes_5 = table.clone(styles.layout)
75
- setmetatable(_attributes_5, nil)
76
- local _exp_3 = React.createElement("uilistlayout", _attributes_5)
77
- local _condition_2 = title ~= nil and title ~= ""
78
- if _condition_2 then
79
- local _attributes_6 = {
78
+ local _attributes_4 = table.clone(styles.layout)
79
+ setmetatable(_attributes_4, nil)
80
+ local _exp_2 = React.createElement("uilistlayout", _attributes_4)
81
+ local _condition_3 = title ~= nil and title ~= ""
82
+ if _condition_3 then
83
+ local _attributes_5 = {
80
84
  key = "Title",
81
85
  }
82
86
  for _k, _v in styles.title do
83
- _attributes_6[_k] = _v
87
+ _attributes_5[_k] = _v
84
88
  end
85
- _attributes_6.Text = title
86
- _condition_2 = React.createElement("textlabel", _attributes_6)
89
+ _attributes_5.Text = title
90
+ _condition_3 = React.createElement("textlabel", _attributes_5)
87
91
  end
88
- local _attributes_6 = {
92
+ local _attributes_5 = {
89
93
  key = "Message",
90
94
  }
91
95
  for _k, _v in styles.message do
92
- _attributes_6[_k] = _v
96
+ _attributes_5[_k] = _v
93
97
  end
94
- _attributes_6.Text = message
95
- return React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, _condition_1, React.createElement("frame", _attributes_4, _exp_3, _condition_2, React.createElement("textlabel", _attributes_6)))
98
+ _attributes_5.Text = message
99
+ return React.createElement("frame", _attributes, _exp, _condition_1, _exp_1, _condition_2, React.createElement("frame", _attributes_3, _exp_2, _condition_3, React.createElement("textlabel", _attributes_5)))
96
100
  end
97
101
  local default = Alert
98
102
  return {
@@ -5,6 +5,7 @@ export type DefaultInputComponent = Frame;
5
5
  export interface InputProps {
6
6
  color?: InputColor;
7
7
  disabled?: boolean;
8
+ readOnly?: boolean;
8
9
  loading?: boolean;
9
10
  hasError?: boolean;
10
11
  helperText?: string;
@@ -36,6 +36,10 @@ local function Input(props)
36
36
  if disabled == nil then
37
37
  disabled = false
38
38
  end
39
+ local readOnly = _binding.readOnly
40
+ if readOnly == nil then
41
+ readOnly = false
42
+ end
39
43
  local loading = _binding.loading
40
44
  if loading == nil then
41
45
  loading = false
@@ -71,7 +75,8 @@ local function Input(props)
71
75
  local focused, setFocused = useState(false)
72
76
  local _binding_1 = useTheme()
73
77
  local theme = _binding_1.theme
74
- local editable = canActivate(disabled, loading)
78
+ local active = canActivate(disabled, loading)
79
+ local editable = active and readOnly ~= true
75
80
  local endSlotContent = if loading then nil else endAdornment
76
81
  local _object = table.clone(props)
77
82
  setmetatable(_object, nil)
@@ -160,7 +165,7 @@ local function Input(props)
160
165
  for _k, _v in box do
161
166
  _attributes_3[_k] = _v
162
167
  end
163
- _attributes_3.Active = editable
168
+ _attributes_3.Active = active
164
169
  _attributes_3.TextEditable = editable
165
170
  _attributes_3.Text = draft
166
171
  _attributes_3.PlaceholderText = placeholder
@@ -4,6 +4,7 @@ export interface ListItemProps {
4
4
  selected?: boolean;
5
5
  disabled?: boolean;
6
6
  dense?: boolean;
7
+ divider?: boolean;
7
8
  onActivated?: () => void;
8
9
  }
9
10
  declare function ListItem(props: ListItemProps): JSX.Element;
@@ -18,6 +18,10 @@ local function ListItem(props)
18
18
  if dense == nil then
19
19
  dense = false
20
20
  end
21
+ local divider = _binding.divider
22
+ if divider == nil then
23
+ divider = false
24
+ end
21
25
  local onActivated = _binding.onActivated
22
26
  local styles = useListItemStyles({
23
27
  selected = selected,
@@ -64,7 +68,19 @@ local function ListItem(props)
64
68
  else
65
69
  _result = nil
66
70
  end
67
- return React.createElement("textbutton", _attributes, _exp, _exp_1, _exp_2, _result)
71
+ local _result_1
72
+ if divider == true then
73
+ local _attributes_4 = {
74
+ key = "Divider",
75
+ }
76
+ for _k, _v in styles.divider do
77
+ _attributes_4[_k] = _v
78
+ end
79
+ _result_1 = React.createElement("frame", _attributes_4)
80
+ else
81
+ _result_1 = nil
82
+ end
83
+ return React.createElement("textbutton", _attributes, _exp, _exp_1, _exp_2, _result, _result_1)
68
84
  end
69
85
  local default = ListItem
70
86
  return {
@@ -61,6 +61,12 @@ local useListItemStyles = componentStyles("ListItem", function(theme, _param)
61
61
  TextColor3 = theme.palette.text.secondary,
62
62
  TextXAlignment = Enum.TextXAlignment.Left,
63
63
  },
64
+ divider = {
65
+ LayoutOrder = 3,
66
+ Size = UDim2.new(1, 0, 0, 1),
67
+ BackgroundColor3 = theme.palette.divider,
68
+ BorderSizePixel = 0,
69
+ },
64
70
  })
65
71
  end)
66
72
  local default = useListItemStyles
@@ -6,6 +6,7 @@ export interface NumberInputProps {
6
6
  max?: number;
7
7
  step?: number;
8
8
  disabled?: boolean;
9
+ readOnly?: boolean;
9
10
  loading?: boolean;
10
11
  placeholder?: string;
11
12
  width?: UDim;
@@ -11,6 +11,7 @@ local function NumberInput(props)
11
11
  local max = _binding.max
12
12
  local step = _binding.step
13
13
  local disabled = _binding.disabled
14
+ local readOnly = _binding.readOnly
14
15
  local loading = _binding.loading
15
16
  local placeholder = _binding.placeholder
16
17
  local width = _binding.width
@@ -31,6 +32,7 @@ local function NumberInput(props)
31
32
  _attributes.placeholder = placeholder
32
33
  _attributes.width = width
33
34
  _attributes.disabled = disabled
35
+ _attributes.readOnly = readOnly
34
36
  _attributes.loading = loading
35
37
  _attributes.size = size
36
38
  _attributes.reducedMotion = reducedMotion
@@ -1,4 +1,5 @@
1
1
  import { ControlSize, CustomizedProps } from "../../../../theme/index";
2
+ import { SliderColor } from "./Slider.styles";
2
3
  export interface SliderProps {
3
4
  value: number;
4
5
  onChange: (value: number) => void;
@@ -9,6 +10,7 @@ export interface SliderProps {
9
10
  disabled?: boolean;
10
11
  size?: ControlSize;
11
12
  marks?: boolean | ReadonlyArray<number>;
13
+ color?: SliderColor;
12
14
  }
13
15
  declare function Slider(props: CustomizedProps<Frame, SliderProps>): JSX.Element;
14
16
  export default Slider;
@@ -25,12 +25,17 @@ local function Slider(props)
25
25
  local disabled = _binding.disabled
26
26
  local size = _binding.size
27
27
  local marks = _binding.marks
28
+ local color = _binding.color
29
+ if color == nil then
30
+ color = "primary"
31
+ end
28
32
  local className = _binding.className
29
33
  local sx = _binding.sx
30
34
  local id = _binding.id
31
35
  local ref = _binding.ref
32
36
  local _binding_1 = useSliderStyles({
33
37
  size = size,
38
+ color = color,
34
39
  })
35
40
  local root = _binding_1.root
36
41
  local track = _binding_1.track
@@ -188,6 +193,7 @@ local function Slider(props)
188
193
  _newValue[_k] = _callback(_v, _k - 1, markValues)
189
194
  end
190
195
  -- ▲ ReadonlyArray.map ▲
196
+ local _exp_1 = React.createElement(React.Fragment, nil, _newValue)
191
197
  local _attributes_3 = {
192
198
  key = "Fill",
193
199
  }
@@ -199,7 +205,7 @@ local function Slider(props)
199
205
  _attributes_3.Size = UDim2.fromScale(ratio, 1)
200
206
  local _attributes_4 = table.clone(corner)
201
207
  setmetatable(_attributes_4, nil)
202
- local _exp_1 = React.createElement("frame", _attributes_3, React.createElement("uicorner", _attributes_4))
208
+ local _exp_2 = React.createElement("frame", _attributes_3, React.createElement("uicorner", _attributes_4))
203
209
  local _attributes_5 = {
204
210
  key = "Knob",
205
211
  }
@@ -211,7 +217,7 @@ local function Slider(props)
211
217
  _attributes_5.Position = UDim2.fromScale(ratio, 0.5)
212
218
  local _attributes_6 = table.clone(corner)
213
219
  setmetatable(_attributes_6, nil)
214
- local _exp_2 = React.createElement("uicorner", _attributes_6)
220
+ local _exp_3 = React.createElement("uicorner", _attributes_6)
215
221
  local _condition_2 = showFocus
216
222
  if _condition_2 then
217
223
  local _attributes_7 = table.clone(stroke)
@@ -219,7 +225,7 @@ local function Slider(props)
219
225
  _attributes_7.Thickness = 1
220
226
  _condition_2 = React.createElement("uistroke", _attributes_7)
221
227
  end
222
- return React.createElement("frame", _attributes, React.createElement("frame", _attributes_1, _exp, _condition_1, _newValue, _exp_1, React.createElement("frame", _attributes_5, _exp_2, _condition_2)))
228
+ return React.createElement("frame", _attributes, React.createElement("frame", _attributes_1, _exp, _condition_1, _exp_1, _exp_2, React.createElement("frame", _attributes_5, _exp_3, _condition_2)))
223
229
  end
224
230
  local default = Slider
225
231
  return {
@@ -1,6 +1,8 @@
1
1
  import { ControlSize } from "../../../../theme/index";
2
+ export type SliderColor = "primary" | "accent";
2
3
  export interface SliderStyleProps {
3
4
  size?: ControlSize;
5
+ color?: SliderColor;
4
6
  }
5
7
  declare const useSliderStyles: (props: SliderStyleProps) => import("../../../../theme/index").ClassNameMap<string>;
6
8
  export default useSliderStyles;
@@ -6,7 +6,12 @@ local createStyles = _theme.createStyles
6
6
  local componentStyles = _theme.componentStyles
7
7
  local useSliderStyles = componentStyles("Slider", function(theme, _param)
8
8
  local size = _param.size
9
+ local color = _param.color
10
+ if color == nil then
11
+ color = "primary"
12
+ end
9
13
  local metrics = controlMetrics(theme.density, size)
14
+ local tone = if color == "accent" then theme.palette.accent.main else theme.palette.primary.main
10
15
  return createStyles({
11
16
  root = {
12
17
  Size = UDim2.new(1, 0, 0, metrics.sliderHeight),
@@ -21,7 +26,7 @@ local useSliderStyles = componentStyles("Slider", function(theme, _param)
21
26
  BorderSizePixel = 0,
22
27
  },
23
28
  fill = {
24
- BackgroundColor3 = theme.palette.primary.main,
29
+ BackgroundColor3 = tone,
25
30
  BorderSizePixel = 0,
26
31
  },
27
32
  knob = {