@nrbx/topbar-components 1.0.12 → 1.1.1

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.
@@ -0,0 +1,29 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local useEffect = TS.import(script, TS.getModule(script, "@rbxts", "react")).useEffect
4
+ local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
5
+ --[[
6
+ *
7
+ * Calls `callback` whenever the given `keycode` is pressed.
8
+ *
9
+ * Listens on `UserInputService.InputBegan` and ignores game-processed input.
10
+
11
+ ]]
12
+ local function useToggleKey(keycode, callback)
13
+ useEffect(function()
14
+ local connection = UserInputService.InputBegan:Connect(function(input, gameProcessed)
15
+ if gameProcessed then
16
+ return nil
17
+ end
18
+ if input.KeyCode == keycode then
19
+ callback()
20
+ end
21
+ end)
22
+ return function()
23
+ return connection:Disconnect()
24
+ end
25
+ end, { keycode })
26
+ end
27
+ return {
28
+ useToggleKey = useToggleKey,
29
+ }
@@ -8,7 +8,7 @@ local VoiceChatService = _services.VoiceChatService
8
8
  local function useVoicechatEnabled()
9
9
  local enabled, setEnabled = useState(false)
10
10
  useAsyncEffect(TS.async(function()
11
- setEnabled(VoiceChatService:IsVoiceEnabledForUserIdAsync(Players.LocalPlayer.UserId))
11
+ setEnabled(VoiceChatService:IsVoiceEnabledForUserIdAsync(Players.LocalPlayer))
12
12
  end), {})
13
13
  return enabled
14
14
  end
package/out/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
+ export * from "./components/custom-dropdown";
1
2
  export * from "./components/dropdown";
2
3
  export * from "./components/icon";
4
+ export * from "./components/notification";
5
+ export * from "./components/overflow";
3
6
  export * from "./components/provider";
4
7
  export * from "./components/stylesheet";
8
+ export * from "./components/tooltip";
9
+ export * from "./hooks/use-toggle-key";
package/out/init.luau CHANGED
@@ -1,16 +1,31 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
+ for _k, _v in TS.import(script, script, "components", "custom-dropdown") or {} do
5
+ exports[_k] = _v
6
+ end
4
7
  for _k, _v in TS.import(script, script, "components", "dropdown") or {} do
5
8
  exports[_k] = _v
6
9
  end
7
10
  for _k, _v in TS.import(script, script, "components", "icon") or {} do
8
11
  exports[_k] = _v
9
12
  end
13
+ for _k, _v in TS.import(script, script, "components", "notification") or {} do
14
+ exports[_k] = _v
15
+ end
16
+ for _k, _v in TS.import(script, script, "components", "overflow") or {} do
17
+ exports[_k] = _v
18
+ end
10
19
  for _k, _v in TS.import(script, script, "components", "provider") or {} do
11
20
  exports[_k] = _v
12
21
  end
13
22
  for _k, _v in TS.import(script, script, "components", "stylesheet") or {} do
14
23
  exports[_k] = _v
15
24
  end
25
+ for _k, _v in TS.import(script, script, "components", "tooltip") or {} do
26
+ exports[_k] = _v
27
+ end
28
+ for _k, _v in TS.import(script, script, "hooks", "use-toggle-key") or {} do
29
+ exports[_k] = _v
30
+ end
16
31
  return exports
package/out/style.d.ts CHANGED
@@ -2,84 +2,166 @@ import type { SpringOptions } from '@rbxts/ripple';
2
2
  import type { DropdownProps } from './components/dropdown';
3
3
  import type { IconProps } from './components/icon';
4
4
  export declare function noop(): void;
5
+ /** Complete theme configuration consumed by all topbar components. */
5
6
  export interface Stylesheet {
7
+ /** Default values for every {@link Icon} prop. */
6
8
  icon: Required<Omit<IconProps, 'style'>>;
9
+ /** Default values for every {@link Dropdown} prop. */
7
10
  dropdown: Required<DropdownProps>;
8
- /**
9
- * Configure the top-level provider frame: padding, spacing, background, sizing.
10
- */
11
+ /** Topbar container layout settings. */
11
12
  provider: {
13
+ /** Left padding of the topbar frame. */
12
14
  paddingLeft: number;
15
+ /** Right padding of the topbar frame. */
13
16
  paddingRight: number;
17
+ /** Top padding of the topbar frame. */
14
18
  paddingTop: number;
19
+ /** Bottom padding of the topbar frame. */
15
20
  paddingBottom: number;
21
+ /** Horizontal gap between adjacent icons. */
16
22
  iconSpacing: number;
23
+ /** Background transparency of the topbar frame. */
17
24
  backgroundTransparency: number;
25
+ /** Background color of the topbar frame. */
18
26
  backgroundColor: Color3;
27
+ /** Anchor point of the topbar frame. */
19
28
  anchorPoint: Vector2;
29
+ /** Position of the topbar frame. */
20
30
  position: UDim2;
31
+ /** Multiplier applied to the topbar frame size. */
21
32
  sizeScale: Vector2;
22
- /** Offset subtracted from the gui inset height */
33
+ /** Pixels subtracted from the gui inset height. */
23
34
  insetHeightOffset: number;
24
- /** Extra gap between left, center, and right icon groups (default 0) */
35
+ /** Extra horizontal gap between left/center and right/center icon groups. */
25
36
  iconGroupSpacing: number;
26
- /**
27
- * Explicit override for the provider frame Y size (in pixels).
28
- * When set, this replaces the automatic `(inset.Height - insetHeightOffset) * sizeScale.Y` calculation.
29
- */
37
+ /** Override for the topbar frame height. Uses inset height when `undefined`. */
30
38
  forceFrameHeight: number | undefined;
31
39
  };
32
- /**
33
- * Fine-grained sizing & layout overrides for icon internals.
34
- */
40
+ /** Sizing and spacing values shared by all icons. */
35
41
  sizing: {
36
- /**
37
- * Explicit icon height override.
38
- * When defined, this replaces the automatic `forceHeight ?? inset.Height - 12` calculation.
39
- */
42
+ /** Fixed icon height. Uses the inset height when `undefined`. */
40
43
  iconHeight: number | undefined;
41
- /** Padding between the icon edge and the image (default 6) */
44
+ /** Fixed icon width. Auto-fits to content when `undefined` or `0`. */
45
+ iconWidth: number | undefined;
46
+ /** Padding around the image inside the icon button. */
42
47
  imagePadding: number;
43
- /** Padding between the icon edge and the text label (default 6) */
48
+ /** Padding around the label inside the icon button. */
44
49
  labelPadding: number;
45
- /** Gap between the image and the text label (default 6) */
50
+ /** Gap between the icon image and its text label. */
46
51
  imageToTextSpacing: number;
47
- /** Horizontal padding within the icon button (default 6, used in icon size calculations) */
52
+ /** Horizontal padding applied to icons. */
48
53
  iconHorizontalPadding: number;
49
- /** Vertical padding within the icon button (default 6, subtracted from inset height) */
54
+ /** Vertical padding applied to icons. */
50
55
  iconVerticalPadding: number;
51
- /** Max width passed to GetTextBoundsParams (default 99999) */
56
+ /** Horizontal outer padding from button edge to content. */
57
+ contentPaddingX: number;
58
+ /** Vertical outer padding from button edge to content. */
59
+ contentPaddingY: number;
60
+ /** Width used when measuring text bounds. */
52
61
  textMeasurementWidth: number;
53
- /** Extra padding subtracted from the min label width inside a dropdown (default 12) */
62
+ /** Minimum label width padding when inside a dropdown. */
54
63
  minLabelWidthPadding: number;
55
- /** Fraction of icon height used for the text button label size (default 0.8) */
64
+ /** Fraction of icon height used for the label's vertical size. */
56
65
  buttonLabelHeightFraction: number;
57
- /** Transparency of the dimming overlay when an icon is disabled (0 = fully visible, 1 = fully hidden) */
66
+ /** Transparency of the overlay shown on disabled icons. */
58
67
  disabledOverlayTransparency: number;
59
- /** Color of the dimming overlay when an icon is disabled */
68
+ /** Color of the overlay shown on disabled icons. */
60
69
  disabledOverlayColor: Color3;
61
70
  };
62
- /**
63
- * Visual theming for the dropdown surface (background, border, position).
64
- */
71
+ /** Appearance of the {@link Dropdown} panel. */
65
72
  dropdownTheme: {
73
+ /** Background color of the dropdown. */
66
74
  backgroundColor: Color3;
75
+ /** Background transparency of the dropdown. */
67
76
  backgroundTransparency: number;
77
+ /** Corner radius of the dropdown. */
68
78
  cornerRadius: UDim;
79
+ /** Thickness of the dropdown border. */
69
80
  borderSize: number;
81
+ /** Color of the dropdown border. */
70
82
  borderColor: Color3;
83
+ /** Transparency of the dropdown border. */
71
84
  borderTransparency: number;
72
- /** Position of the dropdown relative to its parent icon (default (0, 1)) */
85
+ /** Position of the dropdown relative to its parent icon. */
73
86
  position: UDim2;
74
87
  };
75
- /**
76
- * Global animation configuration.
77
- */
88
+ /** Animation configuration. */
78
89
  animation: {
79
- /** Speed value used by the dropdown transition motion (default 10) */
90
+ /** Speed of the dropdown open/close spring. Higher = faster. */
80
91
  dropdownTransitionSpeed: number;
81
- /** Spring options for icon state transitions (color, transparency, etc.) */
92
+ /** Spring options used for icon state transitions and hover lift. */
82
93
  stateSpring: SpringOptions;
94
+ /** Whether icons lift on hover. Set to `false` to disable globally. */
95
+ hoverEnabled: boolean;
96
+ /** How many pixels icons lift upward on hover. */
97
+ hoverLift: number;
98
+ };
99
+ /** Appearance of the notification badge. */
100
+ notification: {
101
+ /** Background color of the badge. */
102
+ backgroundColor: Color3;
103
+ /** Background transparency of the badge. */
104
+ backgroundTransparency: number;
105
+ /** Text color inside the badge. */
106
+ textColor: Color3;
107
+ /** Font size of the badge text. */
108
+ textSize: number;
109
+ /** Font face of the badge text. */
110
+ fontFace: Font;
111
+ /** Position of the badge relative to the icon. */
112
+ position: UDim2;
113
+ /** Size of the badge. */
114
+ size: UDim2;
115
+ /** Corner radius of the badge. */
116
+ cornerRadius: UDim;
117
+ /** Border color of the badge. */
118
+ borderColor: Color3;
119
+ /** Border transparency of the badge. */
120
+ borderTransparency: number;
121
+ };
122
+ /** Appearance of the {@link Tooltip} component. */
123
+ tooltip: {
124
+ /** Background color of the tooltip. */
125
+ backgroundColor: Color3;
126
+ /** Background transparency of the tooltip. */
127
+ backgroundTransparency: number;
128
+ /** Text color inside the tooltip. */
129
+ textColor: Color3;
130
+ /** Font size of the tooltip text. */
131
+ textSize: number;
132
+ /** Font face of the tooltip text. */
133
+ fontFace: Font;
134
+ /** Corner radius of the tooltip. */
135
+ cornerRadius: UDim;
136
+ /** Border color of the tooltip. */
137
+ borderColor: Color3;
138
+ /** Border transparency of the tooltip. */
139
+ borderTransparency: number;
140
+ /** Border thickness of the tooltip. */
141
+ borderSize: number;
142
+ /** Horizontal padding inside the tooltip. */
143
+ paddingX: number;
144
+ /** Vertical padding inside the tooltip. */
145
+ paddingY: number;
146
+ /** Delay in milliseconds before the tooltip appears. */
147
+ delayMs: number;
148
+ };
149
+ /** Appearance of the {@link CustomDropdown} component. */
150
+ customDropdown: {
151
+ /** Background color of the custom dropdown. */
152
+ backgroundColor: Color3;
153
+ /** Background transparency of the custom dropdown. */
154
+ backgroundTransparency: number;
155
+ /** Corner radius of the custom dropdown. */
156
+ cornerRadius: UDim;
157
+ /** Thickness of the custom dropdown border. */
158
+ borderSize: number;
159
+ /** Color of the custom dropdown border. */
160
+ borderColor: Color3;
161
+ /** Transparency of the custom dropdown border. */
162
+ borderTransparency: number;
163
+ /** Position of the custom dropdown relative to its parent. */
164
+ position: UDim2;
83
165
  };
84
166
  }
85
167
  export declare const DefaultStylesheet: Stylesheet;
package/out/style.luau CHANGED
@@ -12,6 +12,7 @@ local function defaultPlaySound(id)
12
12
  end
13
13
  local function noop()
14
14
  end
15
+ --* Complete theme configuration consumed by all topbar components.
15
16
  local DefaultStylesheet = {
16
17
  icon = {
17
18
  fontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal),
@@ -50,6 +51,12 @@ local DefaultStylesheet = {
50
51
  toggleStateOnClick = true,
51
52
  static = false,
52
53
  disabled = false,
54
+ toggleKey = Enum.KeyCode.Unknown,
55
+ notificationCount = 0,
56
+ iconWidth = 0,
57
+ contentPaddingX = 6,
58
+ contentPaddingY = 6,
59
+ imageToTextSpacing = 6,
53
60
  selected = noop,
54
61
  deselected = noop,
55
62
  stateChanged = noop,
@@ -92,11 +99,14 @@ local DefaultStylesheet = {
92
99
  },
93
100
  sizing = {
94
101
  iconHeight = nil,
102
+ iconWidth = nil,
95
103
  imagePadding = 6,
96
104
  labelPadding = 6,
97
105
  imageToTextSpacing = 6,
98
106
  iconHorizontalPadding = 6,
99
107
  iconVerticalPadding = 6,
108
+ contentPaddingX = 6,
109
+ contentPaddingY = 6,
100
110
  textMeasurementWidth = 99999,
101
111
  minLabelWidthPadding = 12,
102
112
  buttonLabelHeightFraction = 0.8,
@@ -117,6 +127,43 @@ local DefaultStylesheet = {
117
127
  stateSpring = {
118
128
  tension = 400,
119
129
  },
130
+ hoverEnabled = true,
131
+ hoverLift = 2,
132
+ },
133
+ notification = {
134
+ backgroundColor = Color3.new(1, 0.2, 0.2),
135
+ backgroundTransparency = 0.1,
136
+ textColor = Color3.new(1, 1, 1),
137
+ textSize = 13,
138
+ fontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Bold, Enum.FontStyle.Normal),
139
+ position = UDim2.new(1, -12, 0, -1),
140
+ size = UDim2.new(0, 20, 0, 20),
141
+ cornerRadius = UDim.new(1, 0),
142
+ borderColor = Color3.new(1, 1, 1),
143
+ borderTransparency = 0.5,
144
+ },
145
+ tooltip = {
146
+ backgroundColor = Color3.new(0.12, 0.12, 0.14),
147
+ backgroundTransparency = 0.08,
148
+ textColor = Color3.new(1, 1, 1),
149
+ textSize = 12,
150
+ fontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal),
151
+ cornerRadius = UDim.new(0, 6),
152
+ borderColor = Color3.new(1, 1, 1),
153
+ borderTransparency = 0.72,
154
+ borderSize = 1,
155
+ paddingX = 8,
156
+ paddingY = 6,
157
+ delayMs = 200,
158
+ },
159
+ customDropdown = {
160
+ backgroundColor = Color3.new(0.12, 0.12, 0.14),
161
+ backgroundTransparency = 0.08,
162
+ cornerRadius = UDim.new(0, 6),
163
+ borderSize = 1,
164
+ borderColor = Color3.new(1, 1, 1),
165
+ borderTransparency = 0.72,
166
+ position = UDim2.fromScale(0, 1),
120
167
  },
121
168
  }
122
169
  return {
@@ -1,5 +1 @@
1
- /**
2
- * Logs a debug message to the console only when `_G.__DEBUG__` is truthy.
3
- * No-op in production — stripped at the call site when debug is off.
4
- */
5
1
  export declare function debugLog(...messages: unknown[]): void;
@@ -1,10 +1,4 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
- --[[
3
- *
4
- * Logs a debug message to the console only when `_G.__DEBUG__` is truthy.
5
- * No-op in production — stripped at the call site when debug is off.
6
-
7
- ]]
8
2
  local function debugLog(...)
9
3
  local messages = { ... }
10
4
  local _value = _G.__DEBUG__
@@ -1,2 +1 @@
1
- declare function reconcile(target: object, template: object): object;
2
- export = reconcile;
1
+ export default function reconcile(target: object, template: object): object;
@@ -1,29 +1,33 @@
1
- local function deepCopy(original)
2
- local copy = {}
3
-
4
- for key, value in original do
5
- copy[key] = type(value) == "table" and deepCopy(value) or value
6
- end
7
-
8
- return copy
9
- end
10
-
11
- local function reconcileTable(target, template)
12
- for k, v in pairs(template) do
13
- if type(k) == "string" then -- Only string keys will be reconciled
14
- if target[k] == nil then
15
- if type(v) == "table" then
16
- target[k] = deepCopy(v)
17
- else
18
- target[k] = v
19
- end
20
- elseif type(target[k]) == "table" and type(v) == "table" then
21
- reconcileTable(target[k], v)
22
- end
23
- end
24
- end
25
-
26
- return target
27
- end
28
-
29
- return reconcileTable
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local deepCopy
3
+ local function reconcile(target, template)
4
+ local t = target
5
+ local tmpl = template
6
+ for key, value in pairs(tmpl) do
7
+ if typeof(key) == "string" then
8
+ if t[key] == nil then
9
+ t[key] = if typeof(value) == "table" then deepCopy(value) else value
10
+ else
11
+ local _arg0 = t[key]
12
+ local _condition = typeof(_arg0) == "table"
13
+ if _condition then
14
+ _condition = typeof(value) == "table"
15
+ end
16
+ if _condition then
17
+ reconcile(t[key], value)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ return target
23
+ end
24
+ function deepCopy(original)
25
+ local copy = {}
26
+ for key, value in pairs(original) do
27
+ copy[key] = if typeof(value) == "table" then deepCopy(value) else value
28
+ end
29
+ return copy
30
+ end
31
+ return {
32
+ default = reconcile,
33
+ }
@@ -20,4 +20,8 @@ export declare const springs: {
20
20
  stiff: SpringOptions;
21
21
  slow: SpringOptions;
22
22
  molasses: SpringOptions;
23
+ figmaGentle: SpringOptions;
24
+ figmaQuick: SpringOptions;
25
+ figmaBouncy: SpringOptions;
26
+ figmaSlow: SpringOptions;
23
27
  };
@@ -1,7 +1,7 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local config = TS.import(script, TS.getModule(script, "@rbxts", "ripple").src).config
4
- local _object = table.clone(config.spring)
4
+ local _object = table.clone(config)
5
5
  setmetatable(_object, nil)
6
6
  _object.bubbly = {
7
7
  tension = 400,
package/package.json CHANGED
@@ -1,13 +1,19 @@
1
1
  {
2
2
  "name": "@nrbx/topbar-components",
3
- "version": "1.0.12",
3
+ "version": "1.1.1",
4
4
  "main": "out/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
7
7
  "watch": "rbxtsc -w",
8
8
  "prepublishOnly": "npm run build"
9
9
  },
10
- "keywords": [],
10
+ "keywords": [
11
+ "roblox-ts",
12
+ "rbxts",
13
+ "nn140",
14
+ "nrbx",
15
+ "topbar-plus"
16
+ ],
11
17
  "author": "ninjaninja140",
12
18
  "license": "MIT",
13
19
  "description": "@rbxts/react component package mimicking topbar-plus with extra functionality, forked from @rbxts/topbar-components",
@@ -26,17 +32,17 @@
26
32
  "access": "public"
27
33
  },
28
34
  "devDependencies": {
29
- "@biomejs/biome": "^2.5.0",
35
+ "@biomejs/biome": "^2.5.7",
30
36
  "@rbxts/compiler-types": "^3.0.0-types.0",
31
37
  "@rbxts/react": "^17.3.7-ts.2",
32
- "@rbxts/types": "^1.0.925",
38
+ "@rbxts/types": "^1.0.942",
33
39
  "roblox-ts": "^3.0.0",
34
40
  "typescript": "^6.0.3"
35
41
  },
36
42
  "dependencies": {
37
43
  "@rbxts/object-utils": "^1.0.4",
38
44
  "@rbxts/pretty-react-hooks": "^0.6.4",
39
- "@rbxts/ripple": "^0.9.1",
45
+ "@rbxts/ripple": "^0.10.2",
40
46
  "@rbxts/services": "^1.6.0",
41
47
  "@rbxts/t": "^3.2.1"
42
48
  },