@nrbx/topbar-components 1.1.6 → 1.1.8

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.
@@ -19,6 +19,8 @@ export interface IconProps extends React.PropsWithChildren {
19
19
  textColor?: StateDependent<Color3>;
20
20
  /** Transparency of the icon image. Animated on state change. */
21
21
  imageTransparency?: StateDependent<number>;
22
+ /** Transparency of the label text. Animated on state change. */
23
+ textTransparency?: StateDependent<number>;
22
24
  /** Layout order used for horizontal sorting in docks. */
23
25
  layoutOrder?: StateDependent<number>;
24
26
  /** Text displayed next to or instead of the image. */
@@ -33,7 +33,7 @@ local Notification = TS.import(script, script.Parent, "notification").Notificati
33
33
  * both states, or `{ deselected: T; selected: T }` to animate between them.
34
34
 
35
35
  ]]
36
- local ANIMATEABLE = { "backgroundColor", "backgroundTransparency", "imageColor", "imageTransparency" }
36
+ local ANIMATEABLE = { "backgroundColor", "backgroundTransparency", "imageColor", "imageTransparency", "textTransparency" }
37
37
  --* Icon select/deselect state.
38
38
  --[[
39
39
  *
@@ -260,7 +260,7 @@ local function Icon(componentProps)
260
260
  Size = UDim2.new(1, 0, 0, iconSize.Y),
261
261
  Active = not props.static,
262
262
  Selectable = not props.static,
263
- AutoButtonColor = false,
263
+ AutoButtonColor = not props.static,
264
264
  Text = "",
265
265
  BackgroundTransparency = animatedProps.backgroundTransparency,
266
266
  BackgroundColor3 = animatedProps.backgroundColor,
@@ -340,6 +340,7 @@ local function Icon(componentProps)
340
340
  TextXAlignment = stateful(props.textAlignment, currentState),
341
341
  RichText = stateful(props.richText, currentState),
342
342
  BackgroundTransparency = 1,
343
+ TextTransparency = animatedProps.textTransparency,
343
344
  Text = currentText,
344
345
  }, React.createElement("uistroke", {
345
346
  Thickness = stateful(props.strokeThickness, currentState),
@@ -10,6 +10,7 @@ local springs = TS.import(script, script.Parent.Parent, "utilities", "springs").
10
10
  local function useAnimateableProps(state, props, ...)
11
11
  local keys = { ... }
12
12
  local previousProps = usePrevious(props)
13
+ local previousState = usePrevious(state)
13
14
  local motionBindings = {}
14
15
  local motionControls = {}
15
16
  for _, key in keys do
@@ -21,13 +22,13 @@ local function useAnimateableProps(state, props, ...)
21
22
  for i = 0, #keys - 1 do
22
23
  local key = keys[i + 1]
23
24
  local value = stateful(props[key], state)
24
- local previousValue = if previousProps then stateful(previousProps[key], state) else nil
25
+ local previousValue = if previousProps and previousState ~= nil then stateful(previousProps[key], previousState) else nil
25
26
  if value == previousValue then
26
27
  continue
27
28
  end
28
29
  motionControls[i + 1]:spring(value, springs.responsive)
29
30
  end
30
- end, { props })
31
+ end, { props, state })
31
32
  -- ▼ ReadonlyArray.map ▼
32
33
  local _newValue = table.create(#keys)
33
34
  local _callback = function(key, i)
package/out/style.luau CHANGED
@@ -44,6 +44,7 @@ local DefaultStylesheet = {
44
44
  playSound = defaultPlaySound,
45
45
  imageId = "",
46
46
  imageTransparency = 0,
47
+ textTransparency = 0,
47
48
  layoutOrder = 0,
48
49
  text = "",
49
50
  defaultState = "deselected",
@@ -54,7 +55,7 @@ local DefaultStylesheet = {
54
55
  toggleKey = Enum.KeyCode.Unknown,
55
56
  notificationCount = 0,
56
57
  iconWidth = 0,
57
- contentPaddingX = 2,
58
+ contentPaddingX = 10,
58
59
  contentPaddingY = 2,
59
60
  imageToTextSpacing = 6,
60
61
  selected = noop,
@@ -105,7 +106,7 @@ local DefaultStylesheet = {
105
106
  imageToTextSpacing = 6,
106
107
  iconHorizontalPadding = 6,
107
108
  iconVerticalPadding = 6,
108
- contentPaddingX = 2,
109
+ contentPaddingX = 10,
109
110
  contentPaddingY = 2,
110
111
  textMeasurementWidth = 99999,
111
112
  minLabelWidthPadding = 12,
@@ -131,12 +132,12 @@ local DefaultStylesheet = {
131
132
  hoverLift = 2,
132
133
  },
133
134
  notification = {
134
- backgroundColor = Color3.new(1, 0.2, 0.2),
135
- backgroundTransparency = 0.1,
136
- textColor = Color3.new(1, 1, 1),
135
+ backgroundColor = Color3.new(1, 1, 1),
136
+ backgroundTransparency = 0,
137
+ textColor = Color3.fromRGB(57, 60, 65),
137
138
  textSize = 13,
138
139
  fontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Bold, Enum.FontStyle.Normal),
139
- position = UDim2.new(1, -12, 0, -1),
140
+ position = UDim2.fromScale(1, 0),
140
141
  size = UDim2.new(0, 20, 0, 20),
141
142
  cornerRadius = UDim.new(1, 0),
142
143
  borderColor = Color3.new(1, 1, 1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrbx/topbar-components",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "main": "out/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",