@nrbx/topbar-components 1.0.8 → 1.0.10

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.
@@ -28,6 +28,8 @@ export interface IconProps extends React.PropsWithChildren {
28
28
  static?: boolean;
29
29
  /** When true, dulls the text and icon with a dimming overlay */
30
30
  disabled?: boolean;
31
+ /** Per-icon stylesheet overrides — merged above the global stylesheet but below explicit props */
32
+ style?: Partial<IconProps>;
31
33
  selected?: () => void;
32
34
  deselected?: () => void;
33
35
  hover?: () => void;
@@ -27,6 +27,7 @@ local ANIMATEABLE = { "backgroundColor", "backgroundTransparency", "imageColor",
27
27
  local function Icon(componentProps)
28
28
  local _binding = componentProps
29
29
  local children = _binding.children
30
+ local style = _binding.style
30
31
  local inset = useGuiInset()
31
32
  local location = useLocation()
32
33
  local id = useId()
@@ -46,6 +47,9 @@ local function Icon(componentProps)
46
47
  local animatedProps = useAnimateableProps(currentState, _object, unpack(ANIMATEABLE))
47
48
  local _object_1 = table.clone(stylesheet.icon)
48
49
  setmetatable(_object_1, nil)
50
+ for _k, _v in (style or {}) do
51
+ _object_1[_k] = _v
52
+ end
49
53
  for _k, _v in componentProps do
50
54
  _object_1[_k] = _v
51
55
  end
@@ -122,12 +126,12 @@ local function Icon(componentProps)
122
126
  if _condition == nil then
123
127
  _condition = forceHeight
124
128
  if _condition == nil then
125
- _condition = inset.Height - 12
129
+ _condition = inset.Height - stylesheet.sizing.iconVerticalPadding * 2
126
130
  end
127
131
  end
128
132
  local iconHeight = _condition
129
133
  local imageSize = iconHeight - stylesheet.sizing.imagePadding * 2 + imageSizeOff
130
- local minLabelWidth = if location.type == "dropdown" then location.desiredIconWidth - stylesheet.sizing.minLabelWidthPadding else inset.Height - stylesheet.sizing.labelPadding * 2
134
+ local minLabelWidth = if location.type == "dropdown" then location.desiredIconWidth - stylesheet.sizing.minLabelWidthPadding else inset.Height - stylesheet.sizing.iconHorizontalPadding * 2
131
135
  local accumulatedLabelWidth = if currentImage ~= "" and currentImage then textBounds.X else math.max(textBounds.X, minLabelWidth)
132
136
  local _exp = textBounds.X + stylesheet.sizing.labelPadding * 2
133
137
  local _condition_1 = currentImage
package/out/style.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { DropdownProps } from './components/dropdown';
3
3
  import type { IconProps } from './components/icon';
4
4
  export declare function noop(): void;
5
5
  export interface Stylesheet {
6
- icon: Required<IconProps>;
6
+ icon: Required<Omit<IconProps, 'style'>>;
7
7
  dropdown: Required<DropdownProps>;
8
8
  /**
9
9
  * Configure the top-level provider frame: padding, spacing, background, sizing.
@@ -44,6 +44,10 @@ export interface Stylesheet {
44
44
  labelPadding: number;
45
45
  /** Gap between the image and the text label (default 6) */
46
46
  imageToTextSpacing: number;
47
+ /** Horizontal padding within the icon button (default 6, used in icon size calculations) */
48
+ iconHorizontalPadding: number;
49
+ /** Vertical padding within the icon button (default 6, subtracted from inset height) */
50
+ iconVerticalPadding: number;
47
51
  /** Max width passed to GetTextBoundsParams (default 99999) */
48
52
  textMeasurementWidth: number;
49
53
  /** Extra padding subtracted from the min label width inside a dropdown (default 12) */
package/out/style.luau CHANGED
@@ -95,6 +95,8 @@ local DefaultStylesheet = {
95
95
  imagePadding = 6,
96
96
  labelPadding = 6,
97
97
  imageToTextSpacing = 6,
98
+ iconHorizontalPadding = 6,
99
+ iconVerticalPadding = 6,
98
100
  textMeasurementWidth = 99999,
99
101
  minLabelWidthPadding = 12,
100
102
  buttonLabelHeightFraction = 0.8,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrbx/topbar-components",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "main": "out/init.lua",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",