@rbxts/uiblox 0.2.0-alpha.16 → 0.2.0-alpha.18

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.
@@ -1,10 +1,12 @@
1
1
  import React from "@rbxts/react";
2
2
  import { CustomizedProps } from "../../../../theme/index";
3
+ import { BadgeColor } from "./Badge.styles";
3
4
  export interface BadgeProps {
4
5
  count?: number;
5
6
  max?: number;
6
7
  invisible?: boolean;
7
8
  variant?: "standard" | "dot";
9
+ color?: BadgeColor;
8
10
  children?: React.ReactNode;
9
11
  }
10
12
  declare function Badge(props: CustomizedProps<Frame, BadgeProps>): JSX.Element;
@@ -21,6 +21,10 @@ local function Badge(props)
21
21
  if variant == nil then
22
22
  variant = "standard"
23
23
  end
24
+ local color = _binding.color
25
+ if color == nil then
26
+ color = "error"
27
+ end
24
28
  local children = _binding.children
25
29
  local className = _binding.className
26
30
  local sx = _binding.sx
@@ -28,6 +32,7 @@ local function Badge(props)
28
32
  local ref = _binding.ref
29
33
  local styles = useBadgeStyles({
30
34
  variant = variant,
35
+ color = color,
31
36
  })
32
37
  local isDot = variant == "dot"
33
38
  local shown = not invisible and (isDot or count > 0)
@@ -1,4 +1,6 @@
1
+ export type BadgeColor = "error" | "primary" | "success";
1
2
  declare const useBadgeStyles: (props: {
2
3
  variant?: "standard" | "dot";
4
+ color?: BadgeColor;
3
5
  }) => import("../../../../theme/index").ClassNameMap<string>;
4
6
  export default useBadgeStyles;
@@ -8,7 +8,12 @@ local useBadgeStyles = componentStyles("Badge", function(theme, _param)
8
8
  if variant == nil then
9
9
  variant = "standard"
10
10
  end
11
+ local color = _param.color
12
+ if color == nil then
13
+ color = "error"
14
+ end
11
15
  local diameter = if variant == "dot" then theme.spacing.calc(1) else theme.spacing.calc(2) + theme.padding.calc(1)
16
+ local tone = if color == "primary" then theme.palette.primary elseif color == "success" then theme.palette.status.success else theme.palette.status.error
12
17
  return createStyles({
13
18
  root = {
14
19
  AutomaticSize = Enum.AutomaticSize.XY,
@@ -21,11 +26,11 @@ local useBadgeStyles = componentStyles("Badge", function(theme, _param)
21
26
  Position = UDim2.fromScale(1, 0),
22
27
  AutomaticSize = if variant == "dot" then Enum.AutomaticSize.None else Enum.AutomaticSize.X,
23
28
  Size = UDim2.fromOffset(diameter, diameter),
24
- BackgroundColor3 = theme.palette.status.error.main,
29
+ BackgroundColor3 = tone.main,
25
30
  BorderSizePixel = 0,
26
31
  Font = theme.typography.fontFamilies.default,
27
32
  TextSize = theme.typography.fontSizes.caption,
28
- TextColor3 = theme.palette.text.inverse,
33
+ TextColor3 = if color == "error" then theme.palette.text.inverse else tone.on,
29
34
  TextXAlignment = Enum.TextXAlignment.Center,
30
35
  TextYAlignment = Enum.TextYAlignment.Center,
31
36
  ZIndex = 2,
@@ -9,6 +9,7 @@ export interface DividerProps {
9
9
  transparency?: number;
10
10
  weight?: number;
11
11
  anchorPoint?: Vector2;
12
+ text?: string;
12
13
  }
13
14
  declare function Divider<T extends DefaultDividerComponent>(props: CustomizedProps<T, DividerProps>): JSX.Element;
14
15
  export default Divider;
@@ -1,15 +1,63 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local Orientations = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Orientations
5
+ local dividerLabel = TS.import(script, script.Parent, "dividerLabel").dividerLabel
4
6
  local useDividerStyles = TS.import(script, script.Parent, "Divider.styles").default
5
7
  local function Divider(props)
6
8
  local _binding = props
9
+ local text = _binding.text
10
+ local orientation = _binding.orientation
7
11
  local className = _binding.className
8
12
  local sx = _binding.sx
9
13
  local id = _binding.id
10
14
  local ref = _binding.ref
11
15
  local _binding_1 = useDividerStyles(props)
12
16
  local root = _binding_1.root
17
+ local shell = _binding_1.shell
18
+ local line = _binding_1.line
19
+ local caption = _binding_1.caption
20
+ local captionPad = _binding_1.captionPad
21
+ local label = dividerLabel(text)
22
+ if label ~= nil and orientation ~= Orientations.Vertical then
23
+ local _attributes = {}
24
+ local _condition = id
25
+ if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
26
+ _condition = "Divider"
27
+ end
28
+ _attributes.key = _condition
29
+ _attributes.ref = ref
30
+ for _k, _v in shell do
31
+ _attributes[_k] = _v
32
+ end
33
+ if className ~= 0 and className == className and className ~= "" and className then
34
+ for _k, _v in className do
35
+ _attributes[_k] = _v
36
+ end
37
+ end
38
+ if sx ~= 0 and sx == sx and sx ~= "" and sx then
39
+ for _k, _v in sx do
40
+ _attributes[_k] = _v
41
+ end
42
+ end
43
+ local _attributes_1 = {
44
+ key = "Line",
45
+ }
46
+ for _k, _v in line do
47
+ _attributes_1[_k] = _v
48
+ end
49
+ local _exp = React.createElement("frame", _attributes_1)
50
+ local _attributes_2 = {
51
+ key = "Label",
52
+ }
53
+ for _k, _v in caption do
54
+ _attributes_2[_k] = _v
55
+ end
56
+ _attributes_2.Text = label
57
+ local _attributes_3 = table.clone(captionPad)
58
+ setmetatable(_attributes_3, nil)
59
+ return React.createElement("frame", _attributes, _exp, React.createElement("textlabel", _attributes_2, React.createElement("uipadding", _attributes_3)))
60
+ end
13
61
  local _attributes = {}
14
62
  local _condition = id
15
63
  if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
@@ -32,6 +32,35 @@ local useDividerStyles = componentStyles("Divider", function(theme, props)
32
32
  anchorPoint = Vector2.new(0, 0)
33
33
  end
34
34
  return createStyles({
35
+ shell = {
36
+ Size = UDim2.new(1, 0, 0, theme.spacing.calc(2)),
37
+ BackgroundTransparency = 1,
38
+ BorderSizePixel = 0,
39
+ },
40
+ line = {
41
+ Size = UDim2.new(1, 0, 0, weight),
42
+ Position = UDim2.new(0, 0, 0.5, 0),
43
+ AnchorPoint = Vector2.new(0, 0.5),
44
+ BackgroundColor3 = color,
45
+ BackgroundTransparency = transparency,
46
+ BorderSizePixel = 0,
47
+ },
48
+ caption = {
49
+ AutomaticSize = Enum.AutomaticSize.XY,
50
+ Size = UDim2.fromScale(0, 0),
51
+ AnchorPoint = Vector2.new(0.5, 0.5),
52
+ Position = UDim2.new(0.5, 0, 0.5, 0),
53
+ BackgroundColor3 = theme.palette.surface.canvas,
54
+ BorderSizePixel = 0,
55
+ Font = theme.typography.fontFamilies.default,
56
+ TextSize = theme.typography.fontSizes.caption,
57
+ TextColor3 = theme.palette.text.secondary,
58
+ ZIndex = 2,
59
+ },
60
+ captionPad = {
61
+ PaddingLeft = UDim.new(0, theme.padding.calc(1)),
62
+ PaddingRight = UDim.new(0, theme.padding.calc(1)),
63
+ },
35
64
  root = {
36
65
  Position = position or UDim2.new(0, 0, 0, 0),
37
66
  Size = UDim2.new(if orientation == Orientations.Horizontal then 1 else 0, if orientation == Orientations.Horizontal then -padding * 2 else weight, if orientation == Orientations.Vertical then 1 else 0, if orientation == Orientations.Vertical then -padding * 2 else weight),
@@ -0,0 +1 @@
1
+ export declare function dividerLabel(text?: string): string | undefined;
@@ -0,0 +1,10 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local function dividerLabel(text)
3
+ if text == nil or #text == 0 then
4
+ return nil
5
+ end
6
+ return text
7
+ end
8
+ return {
9
+ dividerLabel = dividerLabel,
10
+ }
@@ -6,6 +6,8 @@ export interface SnackbarProps {
6
6
  duration?: number;
7
7
  variant?: ToastVariants;
8
8
  open?: boolean;
9
+ action?: string;
10
+ onAction?: () => void;
9
11
  }
10
12
  declare function Snackbar(props: CustomizedProps<Frame, SnackbarProps>): JSX.Element | undefined;
11
13
  export default Snackbar;
@@ -2,6 +2,7 @@
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local Toast = TS.import(script, script.Parent.Parent.Parent, "toast").Toast
5
+ local snackbarActionLabel = TS.import(script, script.Parent, "snackbarAction").snackbarActionLabel
5
6
  local function Snackbar(props)
6
7
  local _binding = props
7
8
  local message = _binding.message
@@ -12,6 +13,8 @@ local function Snackbar(props)
12
13
  if open == nil then
13
14
  open = true
14
15
  end
16
+ local action = _binding.action
17
+ local onAction = _binding.onAction
15
18
  local className = _binding.className
16
19
  local sx = _binding.sx
17
20
  local id = _binding.id
@@ -24,6 +27,8 @@ local function Snackbar(props)
24
27
  onDismiss = onDismiss,
25
28
  duration = duration,
26
29
  variant = variant,
30
+ action = snackbarActionLabel(action),
31
+ onAction = onAction,
27
32
  className = className,
28
33
  sx = sx,
29
34
  }
@@ -0,0 +1 @@
1
+ export declare function snackbarActionLabel(action?: string): string | undefined;
@@ -0,0 +1,10 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local function snackbarActionLabel(action)
3
+ if action == nil or #action == 0 then
4
+ return nil
5
+ end
6
+ return action
7
+ end
8
+ return {
9
+ snackbarActionLabel = snackbarActionLabel,
10
+ }