@xsolla/xui-button 0.191.0 → 0.193.0
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/README.md +13 -1
- package/native/index.d.mts +32 -4
- package/native/index.d.ts +32 -4
- package/native/index.js +327 -299
- package/native/index.js.map +1 -1
- package/native/index.mjs +331 -303
- package/native/index.mjs.map +1 -1
- package/package.json +4 -4
- package/web/index.d.mts +32 -4
- package/web/index.d.ts +32 -4
- package/web/index.js +327 -299
- package/web/index.js.map +1 -1
- package/web/index.mjs +331 -303
- package/web/index.mjs.map +1 -1
package/web/index.d.mts
CHANGED
|
@@ -169,8 +169,15 @@ interface IconButtonProps extends ThemeOverrideProps {
|
|
|
169
169
|
*/
|
|
170
170
|
declare const IconButton: React.FC<IconButtonProps>;
|
|
171
171
|
|
|
172
|
-
interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"
|
|
173
|
-
/**
|
|
172
|
+
interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type">, ThemeOverrideProps {
|
|
173
|
+
/**
|
|
174
|
+
* Button label. Omit for icon-only buttons (provide `aria-label`).
|
|
175
|
+
*
|
|
176
|
+
* An icon may also be passed directly as `children` instead of via
|
|
177
|
+
* `iconLeft`/`iconRight`. When `children` carries no text, the button is
|
|
178
|
+
* treated as icon-only and renders as a square sized from the design-system
|
|
179
|
+
* height token for `size`.
|
|
180
|
+
*/
|
|
174
181
|
children?: ReactNode;
|
|
175
182
|
/** Visual variant of the button */
|
|
176
183
|
variant?: "brand" | "primary" | "secondary" | "tertiary" | "brandExtra" | "inverse";
|
|
@@ -190,6 +197,9 @@ interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
190
197
|
* The component applies padding via an inline style, which overrides any CSS
|
|
191
198
|
* class or `style` prop a consumer passes, so this prop is the supported way
|
|
192
199
|
* to render a zero-padding FlexButton (e.g. an inline text action).
|
|
200
|
+
*
|
|
201
|
+
* Icon-only buttons keep their square dimensions when `noPadding` is set —
|
|
202
|
+
* only the inner padding is removed.
|
|
193
203
|
* @default false
|
|
194
204
|
*/
|
|
195
205
|
noPadding?: boolean;
|
|
@@ -219,11 +229,29 @@ interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
219
229
|
"aria-controls"?: string;
|
|
220
230
|
testID?: string;
|
|
221
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Total hit-area size of an icon-only `FlexButton`, in px. `noPadding` does not
|
|
234
|
+
* change it — only the inner padding is removed.
|
|
235
|
+
*/
|
|
236
|
+
declare const getFlexButtonBoxSize: (size?: NonNullable<FlexButtonProps["size"]>) => number;
|
|
222
237
|
/**
|
|
223
238
|
* FlexButton - A compact button component designed for use in modals and popups.
|
|
224
239
|
*
|
|
225
240
|
* Renders as a semantic `<button>` element with full ARIA support.
|
|
226
241
|
*
|
|
242
|
+
* ## Icon-only buttons
|
|
243
|
+
*
|
|
244
|
+
* A FlexButton is icon-only when it has no text label and an icon is supplied
|
|
245
|
+
* either as `children` or via `iconLeft`/`iconRight`. Icon-only buttons render
|
|
246
|
+
* as a square whose side equals `theme.sizing.flexButton(size).height`, so they
|
|
247
|
+
* line up with the Modal header icon slots (36x36 at `size="xl"`).
|
|
248
|
+
*
|
|
249
|
+
* ```tsx
|
|
250
|
+
* <FlexButton variant="secondary" size="xl" aria-label="Go back">
|
|
251
|
+
* <BackwardAlt variant="line" />
|
|
252
|
+
* </FlexButton>
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
227
255
|
* ## Accessibility Features
|
|
228
256
|
*
|
|
229
257
|
* - **Semantic HTML**: Renders as a native `<button>` element
|
|
@@ -232,7 +260,7 @@ interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
232
260
|
* - **Focus Indicator**: Visible focus ring for keyboard navigation
|
|
233
261
|
* - **Screen Reader Support**: Announces button label, state, and any associated descriptions
|
|
234
262
|
*/
|
|
235
|
-
declare const FlexButton: React.
|
|
263
|
+
declare const FlexButton: React.ForwardRefExoticComponent<FlexButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
236
264
|
|
|
237
265
|
interface AppButtonProps extends ThemeOverrideProps {
|
|
238
266
|
/** Size of the button */
|
|
@@ -341,4 +369,4 @@ interface ButtonGroupProps extends ThemeOverrideProps {
|
|
|
341
369
|
*/
|
|
342
370
|
declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
343
371
|
|
|
344
|
-
export { AppButton, type AppButtonProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, FlexButton, type FlexButtonProps, IconButton, type IconButtonProps };
|
|
372
|
+
export { AppButton, type AppButtonProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, FlexButton, type FlexButtonProps, IconButton, type IconButtonProps, getFlexButtonBoxSize };
|
package/web/index.d.ts
CHANGED
|
@@ -169,8 +169,15 @@ interface IconButtonProps extends ThemeOverrideProps {
|
|
|
169
169
|
*/
|
|
170
170
|
declare const IconButton: React.FC<IconButtonProps>;
|
|
171
171
|
|
|
172
|
-
interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"
|
|
173
|
-
/**
|
|
172
|
+
interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type">, ThemeOverrideProps {
|
|
173
|
+
/**
|
|
174
|
+
* Button label. Omit for icon-only buttons (provide `aria-label`).
|
|
175
|
+
*
|
|
176
|
+
* An icon may also be passed directly as `children` instead of via
|
|
177
|
+
* `iconLeft`/`iconRight`. When `children` carries no text, the button is
|
|
178
|
+
* treated as icon-only and renders as a square sized from the design-system
|
|
179
|
+
* height token for `size`.
|
|
180
|
+
*/
|
|
174
181
|
children?: ReactNode;
|
|
175
182
|
/** Visual variant of the button */
|
|
176
183
|
variant?: "brand" | "primary" | "secondary" | "tertiary" | "brandExtra" | "inverse";
|
|
@@ -190,6 +197,9 @@ interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
190
197
|
* The component applies padding via an inline style, which overrides any CSS
|
|
191
198
|
* class or `style` prop a consumer passes, so this prop is the supported way
|
|
192
199
|
* to render a zero-padding FlexButton (e.g. an inline text action).
|
|
200
|
+
*
|
|
201
|
+
* Icon-only buttons keep their square dimensions when `noPadding` is set —
|
|
202
|
+
* only the inner padding is removed.
|
|
193
203
|
* @default false
|
|
194
204
|
*/
|
|
195
205
|
noPadding?: boolean;
|
|
@@ -219,11 +229,29 @@ interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
219
229
|
"aria-controls"?: string;
|
|
220
230
|
testID?: string;
|
|
221
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Total hit-area size of an icon-only `FlexButton`, in px. `noPadding` does not
|
|
234
|
+
* change it — only the inner padding is removed.
|
|
235
|
+
*/
|
|
236
|
+
declare const getFlexButtonBoxSize: (size?: NonNullable<FlexButtonProps["size"]>) => number;
|
|
222
237
|
/**
|
|
223
238
|
* FlexButton - A compact button component designed for use in modals and popups.
|
|
224
239
|
*
|
|
225
240
|
* Renders as a semantic `<button>` element with full ARIA support.
|
|
226
241
|
*
|
|
242
|
+
* ## Icon-only buttons
|
|
243
|
+
*
|
|
244
|
+
* A FlexButton is icon-only when it has no text label and an icon is supplied
|
|
245
|
+
* either as `children` or via `iconLeft`/`iconRight`. Icon-only buttons render
|
|
246
|
+
* as a square whose side equals `theme.sizing.flexButton(size).height`, so they
|
|
247
|
+
* line up with the Modal header icon slots (36x36 at `size="xl"`).
|
|
248
|
+
*
|
|
249
|
+
* ```tsx
|
|
250
|
+
* <FlexButton variant="secondary" size="xl" aria-label="Go back">
|
|
251
|
+
* <BackwardAlt variant="line" />
|
|
252
|
+
* </FlexButton>
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
227
255
|
* ## Accessibility Features
|
|
228
256
|
*
|
|
229
257
|
* - **Semantic HTML**: Renders as a native `<button>` element
|
|
@@ -232,7 +260,7 @@ interface FlexButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
232
260
|
* - **Focus Indicator**: Visible focus ring for keyboard navigation
|
|
233
261
|
* - **Screen Reader Support**: Announces button label, state, and any associated descriptions
|
|
234
262
|
*/
|
|
235
|
-
declare const FlexButton: React.
|
|
263
|
+
declare const FlexButton: React.ForwardRefExoticComponent<FlexButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
236
264
|
|
|
237
265
|
interface AppButtonProps extends ThemeOverrideProps {
|
|
238
266
|
/** Size of the button */
|
|
@@ -341,4 +369,4 @@ interface ButtonGroupProps extends ThemeOverrideProps {
|
|
|
341
369
|
*/
|
|
342
370
|
declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
343
371
|
|
|
344
|
-
export { AppButton, type AppButtonProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, FlexButton, type FlexButtonProps, IconButton, type IconButtonProps };
|
|
372
|
+
export { AppButton, type AppButtonProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, FlexButton, type FlexButtonProps, IconButton, type IconButtonProps, getFlexButtonBoxSize };
|