@nrbx/topbar-components 1.0.9 → 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.
- package/out/components/icon.d.ts +2 -0
- package/out/components/icon.luau +11 -9
- package/out/style.d.ts +5 -1
- package/out/style.luau +2 -0
- package/package.json +1 -1
package/out/components/icon.d.ts
CHANGED
|
@@ -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;
|
package/out/components/icon.luau
CHANGED
|
@@ -27,7 +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 =
|
|
30
|
+
local style = _binding.style
|
|
31
31
|
local inset = useGuiInset()
|
|
32
32
|
local location = useLocation()
|
|
33
33
|
local id = useId()
|
|
@@ -41,16 +41,18 @@ local function Icon(componentProps)
|
|
|
41
41
|
assert(_arg0, "Icons cannot be nested")
|
|
42
42
|
local _object = table.clone(stylesheet.icon)
|
|
43
43
|
setmetatable(_object, nil)
|
|
44
|
-
for _k, _v in (style or {}) do
|
|
45
|
-
_object[_k] = _v
|
|
46
|
-
end
|
|
47
44
|
for _k, _v in componentProps do
|
|
48
45
|
_object[_k] = _v
|
|
49
46
|
end
|
|
50
|
-
local
|
|
51
|
-
local
|
|
52
|
-
local _object_1 = table.clone(merged)
|
|
47
|
+
local animatedProps = useAnimateableProps(currentState, _object, unpack(ANIMATEABLE))
|
|
48
|
+
local _object_1 = table.clone(stylesheet.icon)
|
|
53
49
|
setmetatable(_object_1, nil)
|
|
50
|
+
for _k, _v in (style or {}) do
|
|
51
|
+
_object_1[_k] = _v
|
|
52
|
+
end
|
|
53
|
+
for _k, _v in componentProps do
|
|
54
|
+
_object_1[_k] = _v
|
|
55
|
+
end
|
|
54
56
|
for _k, _v in animatedProps do
|
|
55
57
|
_object_1[_k] = _v
|
|
56
58
|
end
|
|
@@ -124,12 +126,12 @@ local function Icon(componentProps)
|
|
|
124
126
|
if _condition == nil then
|
|
125
127
|
_condition = forceHeight
|
|
126
128
|
if _condition == nil then
|
|
127
|
-
_condition = inset.Height -
|
|
129
|
+
_condition = inset.Height - stylesheet.sizing.iconVerticalPadding * 2
|
|
128
130
|
end
|
|
129
131
|
end
|
|
130
132
|
local iconHeight = _condition
|
|
131
133
|
local imageSize = iconHeight - stylesheet.sizing.imagePadding * 2 + imageSizeOff
|
|
132
|
-
local minLabelWidth = if location.type == "dropdown" then location.desiredIconWidth - stylesheet.sizing.minLabelWidthPadding else inset.Height - stylesheet.sizing.
|
|
134
|
+
local minLabelWidth = if location.type == "dropdown" then location.desiredIconWidth - stylesheet.sizing.minLabelWidthPadding else inset.Height - stylesheet.sizing.iconHorizontalPadding * 2
|
|
133
135
|
local accumulatedLabelWidth = if currentImage ~= "" and currentImage then textBounds.X else math.max(textBounds.X, minLabelWidth)
|
|
134
136
|
local _exp = textBounds.X + stylesheet.sizing.labelPadding * 2
|
|
135
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