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

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 { ControlSize, CustomizedProps } from "../../../../theme/index";
2
+ import { ChipColor } from "./Chip.styles";
2
3
  export interface ChipProps {
3
4
  label: string;
4
5
  selected?: boolean;
5
6
  disabled?: boolean;
6
7
  size?: ControlSize;
7
8
  variant?: "filled" | "outlined";
9
+ color?: ChipColor;
8
10
  onActivated?: () => void;
9
11
  onDelete?: () => void;
10
12
  }
@@ -13,6 +13,10 @@ local function Chip(props)
13
13
  if variant == nil then
14
14
  variant = "filled"
15
15
  end
16
+ local color = _binding.color
17
+ if color == nil then
18
+ color = "default"
19
+ end
16
20
  local onActivated = _binding.onActivated
17
21
  local onDelete = _binding.onDelete
18
22
  local className = _binding.className
@@ -26,6 +30,7 @@ local function Chip(props)
26
30
  deletable = deletable,
27
31
  size = size,
28
32
  variant = variant,
33
+ color = color,
29
34
  })
30
35
  local _attributes = {}
31
36
  local _condition = id
@@ -1,9 +1,11 @@
1
1
  import { ControlSize } from "../../../../theme/index";
2
+ export type ChipColor = "default" | "primary";
2
3
  declare const useChipStyles: (props: {
3
4
  selected?: boolean;
4
5
  disabled?: boolean;
5
6
  deletable?: boolean;
6
7
  size?: ControlSize;
7
8
  variant?: "filled" | "outlined";
9
+ color?: ChipColor;
8
10
  }) => import("../../../../theme/index").ClassNameMap<string>;
9
11
  export default useChipStyles;
@@ -22,21 +22,27 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
22
22
  if variant == nil then
23
23
  variant = "filled"
24
24
  end
25
+ local color = _param.color
26
+ if color == nil then
27
+ color = "default"
28
+ end
25
29
  local metrics = controlMetrics(theme.density, size)
26
30
  local padY = if size == "small" then 0.25 elseif size == "large" then 0.75 else 0.5
27
31
  local padX = if size == "small" then 1 elseif size == "large" then 2 else 1.5
28
32
  local deletePx = metrics.icon
33
+ local primary = color == "primary"
34
+ local ink = if disabled then theme.palette.text.disabled elseif primary then if variant == "outlined" then theme.palette.primary.main else theme.palette.primary.on else theme.palette.text.primary
29
35
  return createStyles({
30
36
  root = {
31
37
  AutomaticSize = Enum.AutomaticSize.XY,
32
38
  Size = UDim2.fromScale(0, 0),
33
- BackgroundColor3 = if selected then theme.palette.action.selected else theme.palette.surface.input,
39
+ BackgroundColor3 = if primary and variant ~= "outlined" then theme.palette.primary.main elseif selected then theme.palette.action.selected else theme.palette.surface.input,
34
40
  BackgroundTransparency = if variant == "outlined" and selected ~= true then 1 else 0,
35
41
  BorderSizePixel = 0,
36
42
  AutoButtonColor = false,
37
43
  Active = not disabled,
38
44
  Selectable = not disabled,
39
- TextColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.primary,
45
+ TextColor3 = ink,
40
46
  Font = theme.typography.fontFamilies.default,
41
47
  TextSize = metrics.font,
42
48
  },
@@ -50,9 +56,9 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
50
56
  CornerRadius = UDim.new(theme.shape.pillScale, 0),
51
57
  },
52
58
  stroke = {
53
- Color = theme.palette.border,
59
+ Color = if primary then theme.palette.primary.main else theme.palette.border,
54
60
  ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
55
- Transparency = if variant == "outlined" then (if disabled then 0.5 else 0) elseif selected then 1 else 0,
61
+ Transparency = if variant == "outlined" then (if disabled then 0.5 else 0) elseif primary or selected then 1 else 0,
56
62
  },
57
63
  row = {
58
64
  FillDirection = Enum.FillDirection.Horizontal,
@@ -65,7 +71,7 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
65
71
  Size = UDim2.fromScale(0, 0),
66
72
  BackgroundTransparency = 1,
67
73
  BorderSizePixel = 0,
68
- TextColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.primary,
74
+ TextColor3 = ink,
69
75
  Font = theme.typography.fontFamilies.default,
70
76
  TextSize = metrics.font,
71
77
  LayoutOrder = 1,
@@ -75,7 +81,7 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
75
81
  BackgroundTransparency = 1,
76
82
  BorderSizePixel = 0,
77
83
  AutoButtonColor = false,
78
- ImageColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.secondary,
84
+ ImageColor3 = if disabled then theme.palette.text.disabled elseif primary and variant ~= "outlined" then theme.palette.primary.on else theme.palette.text.secondary,
79
85
  LayoutOrder = 2,
80
86
  },
81
87
  })
@@ -13,6 +13,7 @@ export interface MenuProps {
13
13
  emptyText?: string;
14
14
  empty?: React.Element;
15
15
  dense?: boolean;
16
+ selected?: string;
16
17
  }
17
18
  declare function Menu(props: MenuProps): JSX.Element | undefined;
18
19
  export default Menu;
@@ -17,6 +17,7 @@ local function Menu(props)
17
17
  local emptyText = _binding.emptyText
18
18
  local empty = _binding.empty
19
19
  local dense = _binding.dense
20
+ local selected = _binding.selected
20
21
  local styles = useMenuStyles()
21
22
  if not open then
22
23
  return nil
@@ -62,6 +63,7 @@ local function Menu(props)
62
63
  text = item.text,
63
64
  disabled = item.disabled,
64
65
  dense = dense,
66
+ selected = item.id == selected,
65
67
  onActivated = function()
66
68
  if item.disabled == true then
67
69
  return nil
@@ -1322,16 +1322,22 @@ local function surfacesRows()
1322
1322
  local _Length_40 = #_array_41
1323
1323
  table.move(_array_41, 1, _Length_40, _length + 1, _array)
1324
1324
  _length += _Length_40
1325
- local _array_42 = pair("Badge", "count", {
1326
- value = 3,
1325
+ local _array_42 = pair("Chip", "primary", {
1326
+ variant = "primary",
1327
1327
  })
1328
1328
  local _Length_41 = #_array_42
1329
1329
  table.move(_array_42, 1, _Length_41, _length + 1, _array)
1330
1330
  _length += _Length_41
1331
- local _array_43 = pair("Badge", "max", {
1331
+ local _array_43 = pair("Badge", "count", {
1332
+ value = 3,
1333
+ })
1334
+ local _Length_42 = #_array_43
1335
+ table.move(_array_43, 1, _Length_42, _length + 1, _array)
1336
+ _length += _Length_42
1337
+ local _array_44 = pair("Badge", "max", {
1332
1338
  value = 100,
1333
1339
  })
1334
- table.move(_array_43, 1, #_array_43, _length + 1, _array)
1340
+ table.move(_array_44, 1, #_array_44, _length + 1, _array)
1335
1341
  return _array
1336
1342
  end
1337
1343
  local function chromeRows()
@@ -2023,7 +2029,14 @@ local function miscRows()
2023
2029
  open = true,
2024
2030
  variant = "dense",
2025
2031
  })
2026
- table.move(_array_55, 1, #_array_55, _length + 1, _array)
2032
+ local _Length_54 = #_array_55
2033
+ table.move(_array_55, 1, _Length_54, _length + 1, _array)
2034
+ _length += _Length_54
2035
+ local _array_56 = pair("Menu", "selected", {
2036
+ open = true,
2037
+ selected = "a",
2038
+ })
2039
+ table.move(_array_56, 1, #_array_56, _length + 1, _array)
2027
2040
  return _array
2028
2041
  end
2029
2042
  local function concatRows(...)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/uiblox",
3
- "version": "0.2.0-alpha.18",
3
+ "version": "0.2.0-alpha.19",
4
4
  "description": "UI Library and theming for roblox-ts projects",
5
5
  "main": "out/init.luau",
6
6
  "packageManager": "pnpm@11.3.0",