@xsolla/xui-switch 0.109.0 → 0.111.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 CHANGED
@@ -51,6 +51,35 @@ export default function SwitchWithDescription() {
51
51
  }
52
52
  ```
53
53
 
54
+ ### Label Position
55
+
56
+ ```tsx
57
+ import * as React from 'react';
58
+ import { Switch } from '@xsolla/xui-switch';
59
+
60
+ export default function SwitchLabelPosition() {
61
+ const [left, setLeft] = React.useState(false);
62
+ const [right, setRight] = React.useState(false);
63
+
64
+ return (
65
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
66
+ <Switch
67
+ label="Label on the right (default)"
68
+ labelPosition="right"
69
+ checked={right}
70
+ onValueChange={setRight}
71
+ />
72
+ <Switch
73
+ label="Label on the left"
74
+ labelPosition="left"
75
+ checked={left}
76
+ onValueChange={setLeft}
77
+ />
78
+ </div>
79
+ );
80
+ }
81
+ ```
82
+
54
83
  ### Switch Sizes
55
84
 
56
85
  ```tsx
@@ -80,6 +109,7 @@ import { Switch } from '@xsolla/xui-switch';
80
109
  checked={isEnabled} // Whether switch is on
81
110
  onValueChange={handleToggle} // Toggle handler
82
111
  label="Setting label" // Label text
112
+ labelPosition="right" // "left" | "right" (default: "right")
83
113
  description="Help text" // Description below label
84
114
  errorLabel="Error text" // Error message
85
115
  state="default" // Visual state
@@ -186,6 +216,7 @@ A toggle switch component.
186
216
  | size | `"sm" \| "md" \| "lg" \| "xl"` | `"md"` | Size of the switch. |
187
217
  | state | `"default" \| "hover" \| "disable" \| "error"` | `"default"` | Visual state. |
188
218
  | label | `string` | - | Label text displayed next to switch. |
219
+ | labelPosition | `"left" \| "right"` | `"right"` | Position of the label relative to the switch. |
189
220
  | description | `string` | - | Description text below the label. |
190
221
  | errorLabel | `string` | - | Error message when state is "error". |
191
222
  | onValueChange | `(value: boolean) => void` | - | Callback when toggled. |
@@ -11,6 +11,8 @@ interface SwitchProps {
11
11
  disabled?: boolean;
12
12
  /** Label text to display next to the switch */
13
13
  label?: string;
14
+ /** Position of the label relative to the switch */
15
+ labelPosition?: "left" | "right";
14
16
  /** Description text to display below the label */
15
17
  description?: string;
16
18
  /** Error label text to display when state is 'error' */
package/native/index.d.ts CHANGED
@@ -11,6 +11,8 @@ interface SwitchProps {
11
11
  disabled?: boolean;
12
12
  /** Label text to display next to the switch */
13
13
  label?: string;
14
+ /** Position of the label relative to the switch */
15
+ labelPosition?: "left" | "right";
14
16
  /** Description text to display below the label */
15
17
  description?: string;
16
18
  /** Error label text to display when state is 'error' */
package/native/index.js CHANGED
@@ -234,6 +234,7 @@ var Switch = ({
234
234
  state = "default",
235
235
  disabled = false,
236
236
  label,
237
+ labelPosition = "right",
237
238
  description,
238
239
  errorLabel,
239
240
  onValueChange,
@@ -274,6 +275,61 @@ var Switch = ({
274
275
  const getKnobColor = () => {
275
276
  return theme.colors.content.static.light;
276
277
  };
278
+ const labelBlock = (label || description || showErrorLabel) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box, { flexDirection: "column", gap: sizing.textGap, children: [
279
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
280
+ Text,
281
+ {
282
+ color: getTextColor(),
283
+ fontSize: sizing.fontSize,
284
+ lineHeight: sizing.lineHeight,
285
+ fontWeight: "400",
286
+ children: label
287
+ }
288
+ ),
289
+ description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
290
+ Text,
291
+ {
292
+ color: theme.colors.content.tertiary,
293
+ fontSize: sizing.descriptionFontSize,
294
+ lineHeight: sizing.descriptionLineHeight,
295
+ children: description
296
+ }
297
+ ),
298
+ showErrorLabel && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
299
+ Text,
300
+ {
301
+ color: theme.colors.content.alert.primary,
302
+ fontSize: sizing.descriptionFontSize,
303
+ lineHeight: sizing.descriptionLineHeight,
304
+ children: errorLabel
305
+ }
306
+ )
307
+ ] });
308
+ const toggle = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
309
+ Box,
310
+ {
311
+ width: sizing.width,
312
+ height: sizing.height,
313
+ backgroundColor: getBgColor(),
314
+ borderRadius: sizing.frameBorderRadius,
315
+ padding: 2,
316
+ flexDirection: "row",
317
+ alignItems: "center",
318
+ justifyContent: checked ? "flex-end" : "flex-start",
319
+ hoverStyle: !isDisable && !isHover ? {
320
+ backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
321
+ } : void 0,
322
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
323
+ Box,
324
+ {
325
+ width: sizing.knobSize,
326
+ height: sizing.knobSize,
327
+ backgroundColor: getKnobColor(),
328
+ borderRadius: sizing.knobBorderRadius
329
+ }
330
+ )
331
+ }
332
+ );
277
333
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
278
334
  Box,
279
335
  {
@@ -290,61 +346,9 @@ var Switch = ({
290
346
  onKeyDown: handleKeyDown,
291
347
  cursor: !isDisable ? "pointer" : "default",
292
348
  children: [
293
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
294
- Box,
295
- {
296
- width: sizing.width,
297
- height: sizing.height,
298
- backgroundColor: getBgColor(),
299
- borderRadius: sizing.frameBorderRadius,
300
- padding: 2,
301
- flexDirection: "row",
302
- alignItems: "center",
303
- justifyContent: checked ? "flex-end" : "flex-start",
304
- hoverStyle: !isDisable && !isHover ? {
305
- backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
306
- } : void 0,
307
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
308
- Box,
309
- {
310
- width: sizing.knobSize,
311
- height: sizing.knobSize,
312
- backgroundColor: getKnobColor(),
313
- borderRadius: sizing.knobBorderRadius
314
- }
315
- )
316
- }
317
- ),
318
- (label || description || showErrorLabel) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box, { flexDirection: "column", gap: sizing.textGap, children: [
319
- label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
320
- Text,
321
- {
322
- color: getTextColor(),
323
- fontSize: sizing.fontSize,
324
- lineHeight: sizing.lineHeight,
325
- fontWeight: "400",
326
- children: label
327
- }
328
- ),
329
- description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
330
- Text,
331
- {
332
- color: theme.colors.content.tertiary,
333
- fontSize: sizing.descriptionFontSize,
334
- lineHeight: sizing.descriptionLineHeight,
335
- children: description
336
- }
337
- ),
338
- showErrorLabel && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
339
- Text,
340
- {
341
- color: theme.colors.content.alert.primary,
342
- fontSize: sizing.descriptionFontSize,
343
- lineHeight: sizing.descriptionLineHeight,
344
- children: errorLabel
345
- }
346
- )
347
- ] })
349
+ labelPosition === "left" && labelBlock,
350
+ toggle,
351
+ labelPosition === "right" && labelBlock
348
352
  ]
349
353
  }
350
354
  );
@@ -32,6 +32,11 @@ declare interface SwitchProps {
32
32
  */
33
33
  label?: string;
34
34
 
35
+ /**
36
+ * Position of the label relative to the switch
37
+ */
38
+ labelPosition?: "left" | "right";
39
+
35
40
  /**
36
41
  * Description text to display below the label
37
42
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.tsx","../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["export * from \"./Switch\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport { Text as RNText, TextStyle, AccessibilityRole } from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web roles to React Native accessibility roles\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n id,\n role,\n ...props\n}) => {\n // Extract the first font name from a comma-separated list (e.g. for web-style font stacks)\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n // On native, if we don't have the custom font loaded, fall back to the system font\n if (\n resolvedFontFamily === \"Pilat Wide\" ||\n resolvedFontFamily === \"Pilat Wide Bold\" ||\n resolvedFontFamily === \"Aktiv Grotesk\"\n ) {\n resolvedFontFamily = undefined;\n }\n\n const style: TextStyle = {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n };\n\n // Map role to React Native accessibilityRole\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText style={style} testID={id} accessibilityRole={accessibilityRole}>\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n\n {(label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {errorLabel}\n </Text>\n )}\n </Box>\n )}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,0BAQO;AAmID;AAhIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IAC3D,iBACE,WAAW,YAAY,kBACnB,WAAW,kBACX;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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,gBACd,QAAQ,OAAO;AAAA,gBACf,iBAAiB,aAAa;AAAA,gBAC9B,cAAc,OAAO;AAAA;AAAA,YACvB;AAAA;AAAA,QACF;AAAA,SAEE,SAAS,eAAe,mBACxB,8CAAC,OAAI,eAAc,UAAS,KAAK,OAAO,SACrC;AAAA,mBACC;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,aAAa;AAAA,cACpB,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cACnB,YAAW;AAAA,cAEV;AAAA;AAAA,UACH;AAAA,UAED,eACC;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM,OAAO,QAAQ;AAAA,cAC5B,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cAElB;AAAA;AAAA,UACH;AAAA,UAED,kBACC;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM,OAAO,QAAQ,MAAM;AAAA,cAClC,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cAElB;AAAA;AAAA,UACH;AAAA,WAEJ;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["import_react_native","import_jsx_runtime","RNText","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/index.tsx","../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["export * from \"./Switch\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport { Text as RNText, TextStyle, AccessibilityRole } from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web roles to React Native accessibility roles\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n id,\n role,\n ...props\n}) => {\n // Extract the first font name from a comma-separated list (e.g. for web-style font stacks)\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n // On native, if we don't have the custom font loaded, fall back to the system font\n if (\n resolvedFontFamily === \"Pilat Wide\" ||\n resolvedFontFamily === \"Pilat Wide Bold\" ||\n resolvedFontFamily === \"Aktiv Grotesk\"\n ) {\n resolvedFontFamily = undefined;\n }\n\n const style: TextStyle = {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n };\n\n // Map role to React Native accessibilityRole\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText style={style} testID={id} accessibilityRole={accessibilityRole}>\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Position of the label relative to the switch */\n labelPosition?: \"left\" | \"right\";\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n labelPosition = \"right\",\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n const labelBlock = (label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {errorLabel}\n </Text>\n )}\n </Box>\n );\n\n const toggle = (\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n );\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n {labelPosition === \"left\" && labelBlock}\n {toggle}\n {labelPosition === \"right\" && labelBlock}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,0BAQO;AAmID;AAhIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IAC3D,iBACE,WAAW,YAAY,kBACnB,WAAW,kBACX;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAC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AEJ;AAGF,QAAM,SACJ;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,OAAO;AAAA,MACd,QAAQ,OAAO;AAAA,MACf,iBAAiB,WAAW;AAAA,MAC5B,cAAc,OAAO;AAAA,MACrB,SAAS;AAAA,MACT,eAAc;AAAA,MACd,YAAW;AAAA,MACX,gBAAgB,UAAU,aAAa;AAAA,MACvC,YACE,CAAC,aAAa,CAAC,UACX;AAAA,QACE,iBAAiB,UACb,YAAY,UACZ,aAAa;AAAA,MACnB,IACA;AAAA,MAGN;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,OAAO;AAAA,UACd,QAAQ,OAAO;AAAA,UACf,iBAAiB,aAAa;AAAA,UAC9B,cAAc,OAAO;AAAA;AAAA,MACvB;AAAA;AAAA,EACF;AAGF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,gBAAc;AAAA,MACd,iBAAe,aAAa;AAAA,MAC5B,cACE,iBAAiB,SAAY,cAAc,QAAQ,SAAY;AAAA,MAEjE,mBAAiB;AAAA,MACjB,UAAU,YAAY,KAAK;AAAA,MAC3B,eAAc;AAAA,MACd,YAAY,eAAe,iBAAiB,eAAe;AAAA,MAC3D,KAAK,OAAO;AAAA,MACZ,SAAS;AAAA,MACT,WAAW;AAAA,MACX,QAAQ,CAAC,YAAY,YAAY;AAAA,MAEhC;AAAA,0BAAkB,UAAU;AAAA,QAC5B;AAAA,QACA,kBAAkB,WAAW;AAAA;AAAA;AAAA,EAChC;AAEJ;","names":["import_react_native","import_jsx_runtime","RNText","import_jsx_runtime"]}
package/native/index.mjs CHANGED
@@ -212,6 +212,7 @@ var Switch = ({
212
212
  state = "default",
213
213
  disabled = false,
214
214
  label,
215
+ labelPosition = "right",
215
216
  description,
216
217
  errorLabel,
217
218
  onValueChange,
@@ -252,6 +253,61 @@ var Switch = ({
252
253
  const getKnobColor = () => {
253
254
  return theme.colors.content.static.light;
254
255
  };
256
+ const labelBlock = (label || description || showErrorLabel) && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: sizing.textGap, children: [
257
+ label && /* @__PURE__ */ jsx3(
258
+ Text,
259
+ {
260
+ color: getTextColor(),
261
+ fontSize: sizing.fontSize,
262
+ lineHeight: sizing.lineHeight,
263
+ fontWeight: "400",
264
+ children: label
265
+ }
266
+ ),
267
+ description && /* @__PURE__ */ jsx3(
268
+ Text,
269
+ {
270
+ color: theme.colors.content.tertiary,
271
+ fontSize: sizing.descriptionFontSize,
272
+ lineHeight: sizing.descriptionLineHeight,
273
+ children: description
274
+ }
275
+ ),
276
+ showErrorLabel && /* @__PURE__ */ jsx3(
277
+ Text,
278
+ {
279
+ color: theme.colors.content.alert.primary,
280
+ fontSize: sizing.descriptionFontSize,
281
+ lineHeight: sizing.descriptionLineHeight,
282
+ children: errorLabel
283
+ }
284
+ )
285
+ ] });
286
+ const toggle = /* @__PURE__ */ jsx3(
287
+ Box,
288
+ {
289
+ width: sizing.width,
290
+ height: sizing.height,
291
+ backgroundColor: getBgColor(),
292
+ borderRadius: sizing.frameBorderRadius,
293
+ padding: 2,
294
+ flexDirection: "row",
295
+ alignItems: "center",
296
+ justifyContent: checked ? "flex-end" : "flex-start",
297
+ hoverStyle: !isDisable && !isHover ? {
298
+ backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
299
+ } : void 0,
300
+ children: /* @__PURE__ */ jsx3(
301
+ Box,
302
+ {
303
+ width: sizing.knobSize,
304
+ height: sizing.knobSize,
305
+ backgroundColor: getKnobColor(),
306
+ borderRadius: sizing.knobBorderRadius
307
+ }
308
+ )
309
+ }
310
+ );
255
311
  return /* @__PURE__ */ jsxs(
256
312
  Box,
257
313
  {
@@ -268,61 +324,9 @@ var Switch = ({
268
324
  onKeyDown: handleKeyDown,
269
325
  cursor: !isDisable ? "pointer" : "default",
270
326
  children: [
271
- /* @__PURE__ */ jsx3(
272
- Box,
273
- {
274
- width: sizing.width,
275
- height: sizing.height,
276
- backgroundColor: getBgColor(),
277
- borderRadius: sizing.frameBorderRadius,
278
- padding: 2,
279
- flexDirection: "row",
280
- alignItems: "center",
281
- justifyContent: checked ? "flex-end" : "flex-start",
282
- hoverStyle: !isDisable && !isHover ? {
283
- backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
284
- } : void 0,
285
- children: /* @__PURE__ */ jsx3(
286
- Box,
287
- {
288
- width: sizing.knobSize,
289
- height: sizing.knobSize,
290
- backgroundColor: getKnobColor(),
291
- borderRadius: sizing.knobBorderRadius
292
- }
293
- )
294
- }
295
- ),
296
- (label || description || showErrorLabel) && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: sizing.textGap, children: [
297
- label && /* @__PURE__ */ jsx3(
298
- Text,
299
- {
300
- color: getTextColor(),
301
- fontSize: sizing.fontSize,
302
- lineHeight: sizing.lineHeight,
303
- fontWeight: "400",
304
- children: label
305
- }
306
- ),
307
- description && /* @__PURE__ */ jsx3(
308
- Text,
309
- {
310
- color: theme.colors.content.tertiary,
311
- fontSize: sizing.descriptionFontSize,
312
- lineHeight: sizing.descriptionLineHeight,
313
- children: description
314
- }
315
- ),
316
- showErrorLabel && /* @__PURE__ */ jsx3(
317
- Text,
318
- {
319
- color: theme.colors.content.alert.primary,
320
- fontSize: sizing.descriptionFontSize,
321
- lineHeight: sizing.descriptionLineHeight,
322
- children: errorLabel
323
- }
324
- )
325
- ] })
327
+ labelPosition === "left" && labelBlock,
328
+ toggle,
329
+ labelPosition === "right" && labelBlock
326
330
  ]
327
331
  }
328
332
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport { Text as RNText, TextStyle, AccessibilityRole } from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web roles to React Native accessibility roles\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n id,\n role,\n ...props\n}) => {\n // Extract the first font name from a comma-separated list (e.g. for web-style font stacks)\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n // On native, if we don't have the custom font loaded, fall back to the system font\n if (\n resolvedFontFamily === \"Pilat Wide\" ||\n resolvedFontFamily === \"Pilat Wide Bold\" ||\n resolvedFontFamily === \"Aktiv Grotesk\"\n ) {\n resolvedFontFamily = undefined;\n }\n\n const style: TextStyle = {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n };\n\n // Map role to React Native accessibilityRole\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText style={style} testID={id} accessibilityRole={accessibilityRole}>\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n\n {(label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {errorLabel}\n </Text>\n )}\n </Box>\n )}\n </Box>\n );\n};\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAmID;AAhIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IAC3D,iBACE,WAAW,YAAY,kBACnB,WAAW,kBACX;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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YACd,YAAW;AAAA,YACX,gBAAgB,UAAU,aAAa;AAAA,YACvC,YACE,CAAC,aAAa,CAAC,UACX;AAAA,cACE,iBAAiB,UACb,YAAY,UACZ,aAAa;AAAA,YACnB,IACA;AAAA,YAGN,0BAAAA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAO,OAAO;AAAA,gBACd,QAAQ,OAAO;AAAA,gBACf,iBAAiB,aAAa;AAAA,gBAC9B,cAAc,OAAO;AAAA;AAAA,YACvB;AAAA;AAAA,QACF;AAAA,SAEE,SAAS,eAAe,mBACxB,qBAAC,OAAI,eAAc,UAAS,KAAK,OAAO,SACrC;AAAA,mBACC,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,aAAa;AAAA,cACpB,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cACnB,YAAW;AAAA,cAEV;AAAA;AAAA,UACH;AAAA,UAED,eACC,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM,OAAO,QAAQ;AAAA,cAC5B,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cAElB;AAAA;AAAA,UACH;AAAA,UAED,kBACC,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM,OAAO,QAAQ,MAAM;AAAA,cAClC,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cAElB;AAAA;AAAA,UACH;AAAA,WAEJ;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["jsx","jsx"]}
1
+ {"version":3,"sources":["../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport { Text as RNText, TextStyle, AccessibilityRole } from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web roles to React Native accessibility roles\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n id,\n role,\n ...props\n}) => {\n // Extract the first font name from a comma-separated list (e.g. for web-style font stacks)\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n // On native, if we don't have the custom font loaded, fall back to the system font\n if (\n resolvedFontFamily === \"Pilat Wide\" ||\n resolvedFontFamily === \"Pilat Wide Bold\" ||\n resolvedFontFamily === \"Aktiv Grotesk\"\n ) {\n resolvedFontFamily = undefined;\n }\n\n const style: TextStyle = {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n };\n\n // Map role to React Native accessibilityRole\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText style={style} testID={id} accessibilityRole={accessibilityRole}>\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Position of the label relative to the switch */\n labelPosition?: \"left\" | \"right\";\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n labelPosition = \"right\",\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n const labelBlock = (label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {errorLabel}\n </Text>\n )}\n </Box>\n );\n\n const toggle = (\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n );\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n {labelPosition === \"left\" && labelBlock}\n {toggle}\n {labelPosition === \"right\" && labelBlock}\n </Box>\n );\n};\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAmID;AAhIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IA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version": "0.109.0",
3
+ "version": "0.111.0",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "test:coverage": "vitest run --coverage"
14
14
  },
15
15
  "dependencies": {
16
- "@xsolla/xui-core": "0.109.0",
17
- "@xsolla/xui-primitives-core": "0.109.0"
16
+ "@xsolla/xui-core": "0.111.0",
17
+ "@xsolla/xui-primitives-core": "0.111.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "react": ">=16.8.0",
package/web/index.d.mts CHANGED
@@ -11,6 +11,8 @@ interface SwitchProps {
11
11
  disabled?: boolean;
12
12
  /** Label text to display next to the switch */
13
13
  label?: string;
14
+ /** Position of the label relative to the switch */
15
+ labelPosition?: "left" | "right";
14
16
  /** Description text to display below the label */
15
17
  description?: string;
16
18
  /** Error label text to display when state is 'error' */
package/web/index.d.ts CHANGED
@@ -11,6 +11,8 @@ interface SwitchProps {
11
11
  disabled?: boolean;
12
12
  /** Label text to display next to the switch */
13
13
  label?: string;
14
+ /** Position of the label relative to the switch */
15
+ labelPosition?: "left" | "right";
14
16
  /** Description text to display below the label */
15
17
  description?: string;
16
18
  /** Error label text to display when state is 'error' */
package/web/index.js CHANGED
@@ -244,6 +244,7 @@ var Switch = ({
244
244
  state = "default",
245
245
  disabled = false,
246
246
  label,
247
+ labelPosition = "right",
247
248
  description,
248
249
  errorLabel,
249
250
  onValueChange,
@@ -284,6 +285,61 @@ var Switch = ({
284
285
  const getKnobColor = () => {
285
286
  return theme.colors.content.static.light;
286
287
  };
288
+ const labelBlock = (label || description || showErrorLabel) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box, { flexDirection: "column", gap: sizing.textGap, children: [
289
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
290
+ Text,
291
+ {
292
+ color: getTextColor(),
293
+ fontSize: sizing.fontSize,
294
+ lineHeight: sizing.lineHeight,
295
+ fontWeight: "400",
296
+ children: label
297
+ }
298
+ ),
299
+ description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
300
+ Text,
301
+ {
302
+ color: theme.colors.content.tertiary,
303
+ fontSize: sizing.descriptionFontSize,
304
+ lineHeight: sizing.descriptionLineHeight,
305
+ children: description
306
+ }
307
+ ),
308
+ showErrorLabel && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
309
+ Text,
310
+ {
311
+ color: theme.colors.content.alert.primary,
312
+ fontSize: sizing.descriptionFontSize,
313
+ lineHeight: sizing.descriptionLineHeight,
314
+ children: errorLabel
315
+ }
316
+ )
317
+ ] });
318
+ const toggle = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
319
+ Box,
320
+ {
321
+ width: sizing.width,
322
+ height: sizing.height,
323
+ backgroundColor: getBgColor(),
324
+ borderRadius: sizing.frameBorderRadius,
325
+ padding: 2,
326
+ flexDirection: "row",
327
+ alignItems: "center",
328
+ justifyContent: checked ? "flex-end" : "flex-start",
329
+ hoverStyle: !isDisable && !isHover ? {
330
+ backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
331
+ } : void 0,
332
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
333
+ Box,
334
+ {
335
+ width: sizing.knobSize,
336
+ height: sizing.knobSize,
337
+ backgroundColor: getKnobColor(),
338
+ borderRadius: sizing.knobBorderRadius
339
+ }
340
+ )
341
+ }
342
+ );
287
343
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
288
344
  Box,
289
345
  {
@@ -300,61 +356,9 @@ var Switch = ({
300
356
  onKeyDown: handleKeyDown,
301
357
  cursor: !isDisable ? "pointer" : "default",
302
358
  children: [
303
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
304
- Box,
305
- {
306
- width: sizing.width,
307
- height: sizing.height,
308
- backgroundColor: getBgColor(),
309
- borderRadius: sizing.frameBorderRadius,
310
- padding: 2,
311
- flexDirection: "row",
312
- alignItems: "center",
313
- justifyContent: checked ? "flex-end" : "flex-start",
314
- hoverStyle: !isDisable && !isHover ? {
315
- backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
316
- } : void 0,
317
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
318
- Box,
319
- {
320
- width: sizing.knobSize,
321
- height: sizing.knobSize,
322
- backgroundColor: getKnobColor(),
323
- borderRadius: sizing.knobBorderRadius
324
- }
325
- )
326
- }
327
- ),
328
- (label || description || showErrorLabel) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box, { flexDirection: "column", gap: sizing.textGap, children: [
329
- label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
330
- Text,
331
- {
332
- color: getTextColor(),
333
- fontSize: sizing.fontSize,
334
- lineHeight: sizing.lineHeight,
335
- fontWeight: "400",
336
- children: label
337
- }
338
- ),
339
- description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
340
- Text,
341
- {
342
- color: theme.colors.content.tertiary,
343
- fontSize: sizing.descriptionFontSize,
344
- lineHeight: sizing.descriptionLineHeight,
345
- children: description
346
- }
347
- ),
348
- showErrorLabel && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
349
- Text,
350
- {
351
- color: theme.colors.content.alert.primary,
352
- fontSize: sizing.descriptionFontSize,
353
- lineHeight: sizing.descriptionLineHeight,
354
- children: errorLabel
355
- }
356
- )
357
- ] })
359
+ labelPosition === "left" && labelBlock,
360
+ toggle,
361
+ labelPosition === "right" && labelBlock
358
362
  ]
359
363
  }
360
364
  );
package/web/index.js.flow CHANGED
@@ -32,6 +32,11 @@ declare interface SwitchProps {
32
32
  */
33
33
  label?: string;
34
34
 
35
+ /**
36
+ * Position of the label relative to the switch
37
+ */
38
+ labelPosition?: "left" | "right";
39
+
35
40
  /**
36
41
  * Description text to display below the label
37
42
  */
package/web/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.tsx","../../../primitives-web/src/Box.tsx","../../../primitives-web/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["export * from \"./Switch\";\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport type { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledBox = styled.div<BoxProps>`\n display: flex;\n box-sizing: border-box;\n background-color: ${(props) => props.backgroundColor || \"transparent\"};\n border-color: ${(props) => props.borderColor || \"transparent\"};\n border-width: ${(props) =>\n typeof props.borderWidth === \"number\"\n ? `${props.borderWidth}px`\n : props.borderWidth || 0};\n\n ${(props) =>\n props.borderBottomWidth !== undefined &&\n `\n border-bottom-width: ${typeof props.borderBottomWidth === \"number\" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};\n border-bottom-color: ${props.borderBottomColor || props.borderColor || \"transparent\"};\n border-bottom-style: solid;\n `}\n ${(props) =>\n props.borderTopWidth !== undefined &&\n `\n border-top-width: ${typeof props.borderTopWidth === \"number\" ? `${props.borderTopWidth}px` : props.borderTopWidth};\n border-top-color: ${props.borderTopColor || props.borderColor || \"transparent\"};\n border-top-style: solid;\n `}\n ${(props) =>\n props.borderLeftWidth !== undefined &&\n `\n border-left-width: ${typeof props.borderLeftWidth === \"number\" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};\n border-left-color: ${props.borderLeftColor || props.borderColor || \"transparent\"};\n border-left-style: solid;\n `}\n ${(props) =>\n props.borderRightWidth !== undefined &&\n `\n border-right-width: ${typeof props.borderRightWidth === \"number\" ? `${props.borderRightWidth}px` : props.borderRightWidth};\n border-right-color: ${props.borderRightColor || props.borderColor || \"transparent\"};\n border-right-style: solid;\n `}\n\n border-style: ${(props) =>\n props.borderStyle ||\n (props.borderWidth ||\n props.borderBottomWidth ||\n props.borderTopWidth ||\n props.borderLeftWidth ||\n props.borderRightWidth\n ? \"solid\"\n : \"none\")};\n border-radius: ${(props) =>\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius || 0};\n height: ${(props) =>\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height || \"auto\"};\n width: ${(props) =>\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width || \"auto\"};\n min-width: ${(props) =>\n typeof props.minWidth === \"number\"\n ? `${props.minWidth}px`\n : props.minWidth || \"auto\"};\n min-height: ${(props) =>\n typeof props.minHeight === \"number\"\n ? `${props.minHeight}px`\n : props.minHeight || \"auto\"};\n\n padding: ${(props) =>\n typeof props.padding === \"number\"\n ? `${props.padding}px`\n : props.padding || 0};\n ${(props) =>\n props.paddingHorizontal &&\n `\n padding-left: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n padding-right: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n `}\n ${(props) =>\n props.paddingVertical &&\n `\n padding-top: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n padding-bottom: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n `}\n ${(props) =>\n props.paddingTop !== undefined &&\n `padding-top: ${typeof props.paddingTop === \"number\" ? `${props.paddingTop}px` : props.paddingTop};`}\n ${(props) =>\n props.paddingBottom !== undefined &&\n `padding-bottom: ${typeof props.paddingBottom === \"number\" ? `${props.paddingBottom}px` : props.paddingBottom};`}\n ${(props) =>\n props.paddingLeft !== undefined &&\n `padding-left: ${typeof props.paddingLeft === \"number\" ? `${props.paddingLeft}px` : props.paddingLeft};`}\n ${(props) =>\n props.paddingRight !== undefined &&\n `padding-right: ${typeof props.paddingRight === \"number\" ? `${props.paddingRight}px` : props.paddingRight};`}\n\n margin: ${(props) =>\n typeof props.margin === \"number\" ? `${props.margin}px` : props.margin || 0};\n ${(props) =>\n props.marginTop !== undefined &&\n `margin-top: ${typeof props.marginTop === \"number\" ? `${props.marginTop}px` : props.marginTop};`}\n ${(props) =>\n props.marginBottom !== undefined &&\n `margin-bottom: ${typeof props.marginBottom === \"number\" ? `${props.marginBottom}px` : props.marginBottom};`}\n ${(props) =>\n props.marginLeft !== undefined &&\n `margin-left: ${typeof props.marginLeft === \"number\" ? `${props.marginLeft}px` : props.marginLeft};`}\n ${(props) =>\n props.marginRight !== undefined &&\n `margin-right: ${typeof props.marginRight === \"number\" ? `${props.marginRight}px` : props.marginRight};`}\n\n flex-direction: ${(props) => props.flexDirection || \"column\"};\n flex-wrap: ${(props) => props.flexWrap || \"nowrap\"};\n align-items: ${(props) => props.alignItems || \"stretch\"};\n justify-content: ${(props) => props.justifyContent || \"flex-start\"};\n cursor: ${(props) =>\n props.cursor\n ? props.cursor\n : props.onClick || props.onPress\n ? \"pointer\"\n : \"inherit\"};\n position: ${(props) => props.position || \"static\"};\n top: ${(props) =>\n typeof props.top === \"number\" ? `${props.top}px` : props.top};\n bottom: ${(props) =>\n typeof props.bottom === \"number\" ? `${props.bottom}px` : props.bottom};\n left: ${(props) =>\n typeof props.left === \"number\" ? `${props.left}px` : props.left};\n right: ${(props) =>\n typeof props.right === \"number\" ? `${props.right}px` : props.right};\n flex: ${(props) => props.flex};\n flex-shrink: ${(props) => props.flexShrink ?? 1};\n gap: ${(props) =>\n typeof props.gap === \"number\" ? `${props.gap}px` : props.gap || 0};\n align-self: ${(props) => props.alignSelf || \"auto\"};\n overflow: ${(props) => props.overflow || \"visible\"};\n overflow-x: ${(props) => props.overflowX || \"visible\"};\n overflow-y: ${(props) => props.overflowY || \"visible\"};\n z-index: ${(props) => props.zIndex};\n opacity: ${(props) => (props.disabled ? 0.5 : 1)};\n pointer-events: ${(props) => (props.disabled ? \"none\" : \"auto\")};\n\n &:hover {\n ${(props) =>\n props.hoverStyle?.backgroundColor &&\n `background-color: ${props.hoverStyle.backgroundColor};`}\n ${(props) =>\n props.hoverStyle?.borderColor &&\n `border-color: ${props.hoverStyle.borderColor};`}\n }\n\n &:active {\n ${(props) =>\n props.pressStyle?.backgroundColor &&\n `background-color: ${props.pressStyle.backgroundColor};`}\n }\n`;\n\nexport const Box = React.forwardRef<\n HTMLDivElement | HTMLButtonElement,\n BoxProps\n>(\n (\n {\n children,\n onPress,\n onKeyDown,\n onKeyUp,\n role,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-current\": ariaCurrent,\n \"aria-disabled\": ariaDisabled,\n \"aria-live\": ariaLive,\n \"aria-busy\": ariaBusy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-expanded\": ariaExpanded,\n \"aria-haspopup\": ariaHasPopup,\n \"aria-pressed\": ariaPressed,\n \"aria-controls\": ariaControls,\n tabIndex,\n as,\n src,\n alt,\n type,\n disabled,\n id,\n ...props\n },\n ref\n ) => {\n // Handle as=\"img\" for rendering images with proper border-radius\n if (as === \"img\" && src) {\n return (\n <img\n src={src}\n alt={alt || \"\"}\n style={{\n display: \"block\",\n objectFit: \"cover\",\n width:\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width,\n height:\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height,\n borderRadius:\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius,\n position: props.position,\n top: typeof props.top === \"number\" ? `${props.top}px` : props.top,\n left:\n typeof props.left === \"number\" ? `${props.left}px` : props.left,\n right:\n typeof props.right === \"number\"\n ? `${props.right}px`\n : props.right,\n bottom:\n typeof props.bottom === \"number\"\n ? `${props.bottom}px`\n : props.bottom,\n }}\n />\n );\n }\n\n return (\n <StyledBox\n ref={ref}\n as={as}\n id={id}\n type={as === \"button\" ? type || \"button\" : undefined}\n disabled={as === \"button\" ? disabled : undefined}\n onClick={onPress}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-current={ariaCurrent}\n aria-disabled={ariaDisabled}\n aria-busy={ariaBusy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n aria-pressed={ariaPressed}\n aria-controls={ariaControls}\n aria-live={ariaLive}\n tabIndex={tabIndex !== undefined ? tabIndex : undefined}\n {...props}\n >\n {children}\n </StyledBox>\n );\n }\n);\n\nBox.displayName = \"Box\";\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledText = styled.span<TextProps>`\n color: ${(props) => props.color || \"inherit\"};\n font-size: ${(props) =>\n typeof props.fontSize === \"number\"\n ? `${props.fontSize}px`\n : props.fontSize || \"inherit\"};\n font-weight: ${(props) => props.fontWeight || \"normal\"};\n font-family: ${(props) =>\n props.fontFamily ||\n '\"Aktiv Grotesk\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif'};\n line-height: ${(props) =>\n typeof props.lineHeight === \"number\"\n ? `${props.lineHeight}px`\n : props.lineHeight || \"inherit\"};\n white-space: ${(props) => props.whiteSpace || \"normal\"};\n text-align: ${(props) => props.textAlign || \"inherit\"};\n text-decoration: ${(props) => props.textDecoration || \"none\"};\n`;\n\nexport const Text: React.FC<TextProps> = ({\n style,\n className,\n id,\n role,\n ...props\n}) => {\n return (\n <StyledText\n {...props}\n style={style}\n className={className}\n id={id}\n role={role}\n />\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n\n {(label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {errorLabel}\n </Text>\n )}\n </Box>\n )}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkB;AAClB,+BAAmB;AAuMX;AApMR,IAAM,YAAY,yBAAAA,QAAO;AAAA;AAAA;AAAA,sBAGH,CAAC,UAAU,MAAM,mBAAmB,aAAa;AAAA,kBACrD,CAAC,UAAU,MAAM,eAAe,aAAa;AAAA,kBAC7C,CAAC,UACf,OAAO,MAAM,gBAAgB,WACzB,GAAG,MAAM,WAAW,OACpB,MAAM,eAAe,CAAC;AAAA;AAAA,IAE1B,CAAC,UACD,MAAM,sBAAsB,UAC5B;AAAA,2BACuB,OAAO,MAAM,sBAAsB,WAAW,GAAG,MAAM,iBAAiB,OAAO,MAAM,iBAAiB;AAAA,2BACtG,MAAM,qBAAqB,MAAM,eAAe,aAAa;AAAA;AAAA,GAErF;AAAA,IACC,CAAC,UACD,MAAM,mBAAmB,UACzB;AAAA,wBACoB,OAAO,MAAM,mBAAmB,WAAW,GAAG,MAAM,cAAc,OAAO,MAAM,cAAc;AAAA,wBAC7F,MAAM,kBAAkB,MAAM,eAAe,aAAa;AAAA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AAA;AAAA,cACC,OAAO,MAAM,OAAO,QAAQ,MAAM;AAAA,cAClC,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cAElB;AAAA;AAAA,UACH;AAAA,WAEJ;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["styled","React","import_styled_components","import_jsx_runtime","styled","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/index.tsx","../../../primitives-web/src/Box.tsx","../../../primitives-web/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["export * from \"./Switch\";\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport type { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledBox = styled.div<BoxProps>`\n display: flex;\n box-sizing: border-box;\n background-color: ${(props) => props.backgroundColor || \"transparent\"};\n border-color: ${(props) => props.borderColor || \"transparent\"};\n border-width: ${(props) =>\n typeof props.borderWidth === \"number\"\n ? `${props.borderWidth}px`\n : props.borderWidth || 0};\n\n ${(props) =>\n props.borderBottomWidth !== undefined &&\n `\n border-bottom-width: ${typeof props.borderBottomWidth === \"number\" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};\n border-bottom-color: ${props.borderBottomColor || props.borderColor || \"transparent\"};\n border-bottom-style: solid;\n `}\n ${(props) =>\n props.borderTopWidth !== undefined &&\n `\n border-top-width: ${typeof props.borderTopWidth === \"number\" ? `${props.borderTopWidth}px` : props.borderTopWidth};\n border-top-color: ${props.borderTopColor || props.borderColor || \"transparent\"};\n border-top-style: solid;\n `}\n ${(props) =>\n props.borderLeftWidth !== undefined &&\n `\n border-left-width: ${typeof props.borderLeftWidth === \"number\" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};\n border-left-color: ${props.borderLeftColor || props.borderColor || \"transparent\"};\n border-left-style: solid;\n `}\n ${(props) =>\n props.borderRightWidth !== undefined &&\n `\n border-right-width: ${typeof props.borderRightWidth === \"number\" ? `${props.borderRightWidth}px` : props.borderRightWidth};\n border-right-color: ${props.borderRightColor || props.borderColor || \"transparent\"};\n border-right-style: solid;\n `}\n\n border-style: ${(props) =>\n props.borderStyle ||\n (props.borderWidth ||\n props.borderBottomWidth ||\n props.borderTopWidth ||\n props.borderLeftWidth ||\n props.borderRightWidth\n ? \"solid\"\n : \"none\")};\n border-radius: ${(props) =>\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius || 0};\n height: ${(props) =>\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height || \"auto\"};\n width: ${(props) =>\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width || \"auto\"};\n min-width: ${(props) =>\n typeof props.minWidth === \"number\"\n ? `${props.minWidth}px`\n : props.minWidth || \"auto\"};\n min-height: ${(props) =>\n typeof props.minHeight === \"number\"\n ? `${props.minHeight}px`\n : props.minHeight || \"auto\"};\n\n padding: ${(props) =>\n typeof props.padding === \"number\"\n ? `${props.padding}px`\n : props.padding || 0};\n ${(props) =>\n props.paddingHorizontal &&\n `\n padding-left: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n padding-right: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n `}\n ${(props) =>\n props.paddingVertical &&\n `\n padding-top: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n padding-bottom: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n `}\n ${(props) =>\n props.paddingTop !== undefined &&\n `padding-top: ${typeof props.paddingTop === \"number\" ? `${props.paddingTop}px` : props.paddingTop};`}\n ${(props) =>\n props.paddingBottom !== undefined &&\n `padding-bottom: ${typeof props.paddingBottom === \"number\" ? `${props.paddingBottom}px` : props.paddingBottom};`}\n ${(props) =>\n props.paddingLeft !== undefined &&\n `padding-left: ${typeof props.paddingLeft === \"number\" ? `${props.paddingLeft}px` : props.paddingLeft};`}\n ${(props) =>\n props.paddingRight !== undefined &&\n `padding-right: ${typeof props.paddingRight === \"number\" ? `${props.paddingRight}px` : props.paddingRight};`}\n\n margin: ${(props) =>\n typeof props.margin === \"number\" ? `${props.margin}px` : props.margin || 0};\n ${(props) =>\n props.marginTop !== undefined &&\n `margin-top: ${typeof props.marginTop === \"number\" ? `${props.marginTop}px` : props.marginTop};`}\n ${(props) =>\n props.marginBottom !== undefined &&\n `margin-bottom: ${typeof props.marginBottom === \"number\" ? `${props.marginBottom}px` : props.marginBottom};`}\n ${(props) =>\n props.marginLeft !== undefined &&\n `margin-left: ${typeof props.marginLeft === \"number\" ? `${props.marginLeft}px` : props.marginLeft};`}\n ${(props) =>\n props.marginRight !== undefined &&\n `margin-right: ${typeof props.marginRight === \"number\" ? `${props.marginRight}px` : props.marginRight};`}\n\n flex-direction: ${(props) => props.flexDirection || \"column\"};\n flex-wrap: ${(props) => props.flexWrap || \"nowrap\"};\n align-items: ${(props) => props.alignItems || \"stretch\"};\n justify-content: ${(props) => props.justifyContent || \"flex-start\"};\n cursor: ${(props) =>\n props.cursor\n ? props.cursor\n : props.onClick || props.onPress\n ? \"pointer\"\n : \"inherit\"};\n position: ${(props) => props.position || \"static\"};\n top: ${(props) =>\n typeof props.top === \"number\" ? `${props.top}px` : props.top};\n bottom: ${(props) =>\n typeof props.bottom === \"number\" ? `${props.bottom}px` : props.bottom};\n left: ${(props) =>\n typeof props.left === \"number\" ? `${props.left}px` : props.left};\n right: ${(props) =>\n typeof props.right === \"number\" ? `${props.right}px` : props.right};\n flex: ${(props) => props.flex};\n flex-shrink: ${(props) => props.flexShrink ?? 1};\n gap: ${(props) =>\n typeof props.gap === \"number\" ? `${props.gap}px` : props.gap || 0};\n align-self: ${(props) => props.alignSelf || \"auto\"};\n overflow: ${(props) => props.overflow || \"visible\"};\n overflow-x: ${(props) => props.overflowX || \"visible\"};\n overflow-y: ${(props) => props.overflowY || \"visible\"};\n z-index: ${(props) => props.zIndex};\n opacity: ${(props) => (props.disabled ? 0.5 : 1)};\n pointer-events: ${(props) => (props.disabled ? \"none\" : \"auto\")};\n\n &:hover {\n ${(props) =>\n props.hoverStyle?.backgroundColor &&\n `background-color: ${props.hoverStyle.backgroundColor};`}\n ${(props) =>\n props.hoverStyle?.borderColor &&\n `border-color: ${props.hoverStyle.borderColor};`}\n }\n\n &:active {\n ${(props) =>\n props.pressStyle?.backgroundColor &&\n `background-color: ${props.pressStyle.backgroundColor};`}\n }\n`;\n\nexport const Box = React.forwardRef<\n HTMLDivElement | HTMLButtonElement,\n BoxProps\n>(\n (\n {\n children,\n onPress,\n onKeyDown,\n onKeyUp,\n role,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-current\": ariaCurrent,\n \"aria-disabled\": ariaDisabled,\n \"aria-live\": ariaLive,\n \"aria-busy\": ariaBusy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-expanded\": ariaExpanded,\n \"aria-haspopup\": ariaHasPopup,\n \"aria-pressed\": ariaPressed,\n \"aria-controls\": ariaControls,\n tabIndex,\n as,\n src,\n alt,\n type,\n disabled,\n id,\n ...props\n },\n ref\n ) => {\n // Handle as=\"img\" for rendering images with proper border-radius\n if (as === \"img\" && src) {\n return (\n <img\n src={src}\n alt={alt || \"\"}\n style={{\n display: \"block\",\n objectFit: \"cover\",\n width:\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width,\n height:\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height,\n borderRadius:\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius,\n position: props.position,\n top: typeof props.top === \"number\" ? `${props.top}px` : props.top,\n left:\n typeof props.left === \"number\" ? `${props.left}px` : props.left,\n right:\n typeof props.right === \"number\"\n ? `${props.right}px`\n : props.right,\n bottom:\n typeof props.bottom === \"number\"\n ? `${props.bottom}px`\n : props.bottom,\n }}\n />\n );\n }\n\n return (\n <StyledBox\n ref={ref}\n as={as}\n id={id}\n type={as === \"button\" ? type || \"button\" : undefined}\n disabled={as === \"button\" ? disabled : undefined}\n onClick={onPress}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-current={ariaCurrent}\n aria-disabled={ariaDisabled}\n aria-busy={ariaBusy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n aria-pressed={ariaPressed}\n aria-controls={ariaControls}\n aria-live={ariaLive}\n tabIndex={tabIndex !== undefined ? tabIndex : undefined}\n {...props}\n >\n {children}\n </StyledBox>\n );\n }\n);\n\nBox.displayName = \"Box\";\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledText = styled.span<TextProps>`\n color: ${(props) => props.color || \"inherit\"};\n font-size: ${(props) =>\n typeof props.fontSize === \"number\"\n ? `${props.fontSize}px`\n : props.fontSize || \"inherit\"};\n font-weight: ${(props) => props.fontWeight || \"normal\"};\n font-family: ${(props) =>\n props.fontFamily ||\n '\"Aktiv Grotesk\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif'};\n line-height: ${(props) =>\n typeof props.lineHeight === \"number\"\n ? `${props.lineHeight}px`\n : props.lineHeight || \"inherit\"};\n white-space: ${(props) => props.whiteSpace || \"normal\"};\n text-align: ${(props) => props.textAlign || \"inherit\"};\n text-decoration: ${(props) => props.textDecoration || \"none\"};\n`;\n\nexport const Text: React.FC<TextProps> = ({\n style,\n className,\n id,\n role,\n ...props\n}) => {\n return (\n <StyledText\n {...props}\n style={style}\n className={className}\n id={id}\n role={role}\n />\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Position of the label relative to the switch */\n labelPosition?: \"left\" | \"right\";\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n labelPosition = \"right\",\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n const labelBlock = (label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {errorLabel}\n </Text>\n )}\n </Box>\n );\n\n const toggle = (\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n );\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n {labelPosition === \"left\" && labelBlock}\n {toggle}\n {labelPosition === \"right\" && labelBlock}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkB;AAClB,+BAAmB;AAuMX;AApMR,IAAM,YAAY,yBAAAA,QAAO;AAAA;AAAA;AAAA,sBAGH,CAAC,UAAU,MAAM,mBAAmB,aAAa;AAAA,kBACrD,CAAC,UAAU,MAAM,eAAe,aAAa;AAAA,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aAAa;AAAA,MACvC,YACE,CAAC,aAAa,CAAC,UACX;AAAA,QACE,iBAAiB,UACb,YAAY,UACZ,aAAa;AAAA,MACnB,IACA;AAAA,MAGN;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,OAAO;AAAA,UACd,QAAQ,OAAO;AAAA,UACf,iBAAiB,aAAa;AAAA,UAC9B,cAAc,OAAO;AAAA;AAAA,MACvB;AAAA;AAAA,EACF;AAGF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,gBAAc;AAAA,MACd,iBAAe,aAAa;AAAA,MAC5B,cACE,iBAAiB,SAAY,cAAc,QAAQ,SAAY;AAAA,MAEjE,mBAAiB;AAAA,MACjB,UAAU,YAAY,KAAK;AAAA,MAC3B,eAAc;AAAA,MACd,YAAY,eAAe,iBAAiB,eAAe;AAAA,MAC3D,KAAK,OAAO;AAAA,MACZ,SAAS;AAAA,MACT,WAAW;AAAA,MACX,QAAQ,CAAC,YAAY,YAAY;AAAA,MAEhC;AAAA,0BAAkB,UAAU;AAAA,QAC5B;AAAA,QACA,kBAAkB,WAAW;AAAA;AAAA;AAAA,EAChC;AAEJ;","names":["styled","React","import_styled_components","import_jsx_runtime","styled","import_jsx_runtime"]}
package/web/index.mjs CHANGED
@@ -208,6 +208,7 @@ var Switch = ({
208
208
  state = "default",
209
209
  disabled = false,
210
210
  label,
211
+ labelPosition = "right",
211
212
  description,
212
213
  errorLabel,
213
214
  onValueChange,
@@ -248,6 +249,61 @@ var Switch = ({
248
249
  const getKnobColor = () => {
249
250
  return theme.colors.content.static.light;
250
251
  };
252
+ const labelBlock = (label || description || showErrorLabel) && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: sizing.textGap, children: [
253
+ label && /* @__PURE__ */ jsx3(
254
+ Text,
255
+ {
256
+ color: getTextColor(),
257
+ fontSize: sizing.fontSize,
258
+ lineHeight: sizing.lineHeight,
259
+ fontWeight: "400",
260
+ children: label
261
+ }
262
+ ),
263
+ description && /* @__PURE__ */ jsx3(
264
+ Text,
265
+ {
266
+ color: theme.colors.content.tertiary,
267
+ fontSize: sizing.descriptionFontSize,
268
+ lineHeight: sizing.descriptionLineHeight,
269
+ children: description
270
+ }
271
+ ),
272
+ showErrorLabel && /* @__PURE__ */ jsx3(
273
+ Text,
274
+ {
275
+ color: theme.colors.content.alert.primary,
276
+ fontSize: sizing.descriptionFontSize,
277
+ lineHeight: sizing.descriptionLineHeight,
278
+ children: errorLabel
279
+ }
280
+ )
281
+ ] });
282
+ const toggle = /* @__PURE__ */ jsx3(
283
+ Box,
284
+ {
285
+ width: sizing.width,
286
+ height: sizing.height,
287
+ backgroundColor: getBgColor(),
288
+ borderRadius: sizing.frameBorderRadius,
289
+ padding: 2,
290
+ flexDirection: "row",
291
+ alignItems: "center",
292
+ justifyContent: checked ? "flex-end" : "flex-start",
293
+ hoverStyle: !isDisable && !isHover ? {
294
+ backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
295
+ } : void 0,
296
+ children: /* @__PURE__ */ jsx3(
297
+ Box,
298
+ {
299
+ width: sizing.knobSize,
300
+ height: sizing.knobSize,
301
+ backgroundColor: getKnobColor(),
302
+ borderRadius: sizing.knobBorderRadius
303
+ }
304
+ )
305
+ }
306
+ );
251
307
  return /* @__PURE__ */ jsxs(
252
308
  Box,
253
309
  {
@@ -264,61 +320,9 @@ var Switch = ({
264
320
  onKeyDown: handleKeyDown,
265
321
  cursor: !isDisable ? "pointer" : "default",
266
322
  children: [
267
- /* @__PURE__ */ jsx3(
268
- Box,
269
- {
270
- width: sizing.width,
271
- height: sizing.height,
272
- backgroundColor: getBgColor(),
273
- borderRadius: sizing.frameBorderRadius,
274
- padding: 2,
275
- flexDirection: "row",
276
- alignItems: "center",
277
- justifyContent: checked ? "flex-end" : "flex-start",
278
- hoverStyle: !isDisable && !isHover ? {
279
- backgroundColor: checked ? checkColors.bgHover : switchColors.bgHover
280
- } : void 0,
281
- children: /* @__PURE__ */ jsx3(
282
- Box,
283
- {
284
- width: sizing.knobSize,
285
- height: sizing.knobSize,
286
- backgroundColor: getKnobColor(),
287
- borderRadius: sizing.knobBorderRadius
288
- }
289
- )
290
- }
291
- ),
292
- (label || description || showErrorLabel) && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: sizing.textGap, children: [
293
- label && /* @__PURE__ */ jsx3(
294
- Text,
295
- {
296
- color: getTextColor(),
297
- fontSize: sizing.fontSize,
298
- lineHeight: sizing.lineHeight,
299
- fontWeight: "400",
300
- children: label
301
- }
302
- ),
303
- description && /* @__PURE__ */ jsx3(
304
- Text,
305
- {
306
- color: theme.colors.content.tertiary,
307
- fontSize: sizing.descriptionFontSize,
308
- lineHeight: sizing.descriptionLineHeight,
309
- children: description
310
- }
311
- ),
312
- showErrorLabel && /* @__PURE__ */ jsx3(
313
- Text,
314
- {
315
- color: theme.colors.content.alert.primary,
316
- fontSize: sizing.descriptionFontSize,
317
- lineHeight: sizing.descriptionLineHeight,
318
- children: errorLabel
319
- }
320
- )
321
- ] })
323
+ labelPosition === "left" && labelBlock,
324
+ toggle,
325
+ labelPosition === "right" && labelBlock
322
326
  ]
323
327
  }
324
328
  );
package/web/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../primitives-web/src/Box.tsx","../../../primitives-web/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"styled-components\";\nimport type { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledBox = styled.div<BoxProps>`\n display: flex;\n box-sizing: border-box;\n background-color: ${(props) => props.backgroundColor || \"transparent\"};\n border-color: ${(props) => props.borderColor || \"transparent\"};\n border-width: ${(props) =>\n typeof props.borderWidth === \"number\"\n ? `${props.borderWidth}px`\n : props.borderWidth || 0};\n\n ${(props) =>\n props.borderBottomWidth !== undefined &&\n `\n border-bottom-width: ${typeof props.borderBottomWidth === \"number\" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};\n border-bottom-color: ${props.borderBottomColor || props.borderColor || \"transparent\"};\n border-bottom-style: solid;\n `}\n ${(props) =>\n props.borderTopWidth !== undefined &&\n `\n border-top-width: ${typeof props.borderTopWidth === \"number\" ? `${props.borderTopWidth}px` : props.borderTopWidth};\n border-top-color: ${props.borderTopColor || props.borderColor || \"transparent\"};\n border-top-style: solid;\n `}\n ${(props) =>\n props.borderLeftWidth !== undefined &&\n `\n border-left-width: ${typeof props.borderLeftWidth === \"number\" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};\n border-left-color: ${props.borderLeftColor || props.borderColor || \"transparent\"};\n border-left-style: solid;\n `}\n ${(props) =>\n props.borderRightWidth !== undefined &&\n `\n border-right-width: ${typeof props.borderRightWidth === \"number\" ? `${props.borderRightWidth}px` : props.borderRightWidth};\n border-right-color: ${props.borderRightColor || props.borderColor || \"transparent\"};\n border-right-style: solid;\n `}\n\n border-style: ${(props) =>\n props.borderStyle ||\n (props.borderWidth ||\n props.borderBottomWidth ||\n props.borderTopWidth ||\n props.borderLeftWidth ||\n props.borderRightWidth\n ? \"solid\"\n : \"none\")};\n border-radius: ${(props) =>\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius || 0};\n height: ${(props) =>\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height || \"auto\"};\n width: ${(props) =>\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width || \"auto\"};\n min-width: ${(props) =>\n typeof props.minWidth === \"number\"\n ? `${props.minWidth}px`\n : props.minWidth || \"auto\"};\n min-height: ${(props) =>\n typeof props.minHeight === \"number\"\n ? `${props.minHeight}px`\n : props.minHeight || \"auto\"};\n\n padding: ${(props) =>\n typeof props.padding === \"number\"\n ? `${props.padding}px`\n : props.padding || 0};\n ${(props) =>\n props.paddingHorizontal &&\n `\n padding-left: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n padding-right: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n `}\n ${(props) =>\n props.paddingVertical &&\n `\n padding-top: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n padding-bottom: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n `}\n ${(props) =>\n props.paddingTop !== undefined &&\n `padding-top: ${typeof props.paddingTop === \"number\" ? `${props.paddingTop}px` : props.paddingTop};`}\n ${(props) =>\n props.paddingBottom !== undefined &&\n `padding-bottom: ${typeof props.paddingBottom === \"number\" ? `${props.paddingBottom}px` : props.paddingBottom};`}\n ${(props) =>\n props.paddingLeft !== undefined &&\n `padding-left: ${typeof props.paddingLeft === \"number\" ? `${props.paddingLeft}px` : props.paddingLeft};`}\n ${(props) =>\n props.paddingRight !== undefined &&\n `padding-right: ${typeof props.paddingRight === \"number\" ? `${props.paddingRight}px` : props.paddingRight};`}\n\n margin: ${(props) =>\n typeof props.margin === \"number\" ? `${props.margin}px` : props.margin || 0};\n ${(props) =>\n props.marginTop !== undefined &&\n `margin-top: ${typeof props.marginTop === \"number\" ? `${props.marginTop}px` : props.marginTop};`}\n ${(props) =>\n props.marginBottom !== undefined &&\n `margin-bottom: ${typeof props.marginBottom === \"number\" ? `${props.marginBottom}px` : props.marginBottom};`}\n ${(props) =>\n props.marginLeft !== undefined &&\n `margin-left: ${typeof props.marginLeft === \"number\" ? `${props.marginLeft}px` : props.marginLeft};`}\n ${(props) =>\n props.marginRight !== undefined &&\n `margin-right: ${typeof props.marginRight === \"number\" ? `${props.marginRight}px` : props.marginRight};`}\n\n flex-direction: ${(props) => props.flexDirection || \"column\"};\n flex-wrap: ${(props) => props.flexWrap || \"nowrap\"};\n align-items: ${(props) => props.alignItems || \"stretch\"};\n justify-content: ${(props) => props.justifyContent || \"flex-start\"};\n cursor: ${(props) =>\n props.cursor\n ? props.cursor\n : props.onClick || props.onPress\n ? \"pointer\"\n : \"inherit\"};\n position: ${(props) => props.position || \"static\"};\n top: ${(props) =>\n typeof props.top === \"number\" ? `${props.top}px` : props.top};\n bottom: ${(props) =>\n typeof props.bottom === \"number\" ? `${props.bottom}px` : props.bottom};\n left: ${(props) =>\n typeof props.left === \"number\" ? `${props.left}px` : props.left};\n right: ${(props) =>\n typeof props.right === \"number\" ? `${props.right}px` : props.right};\n flex: ${(props) => props.flex};\n flex-shrink: ${(props) => props.flexShrink ?? 1};\n gap: ${(props) =>\n typeof props.gap === \"number\" ? `${props.gap}px` : props.gap || 0};\n align-self: ${(props) => props.alignSelf || \"auto\"};\n overflow: ${(props) => props.overflow || \"visible\"};\n overflow-x: ${(props) => props.overflowX || \"visible\"};\n overflow-y: ${(props) => props.overflowY || \"visible\"};\n z-index: ${(props) => props.zIndex};\n opacity: ${(props) => (props.disabled ? 0.5 : 1)};\n pointer-events: ${(props) => (props.disabled ? \"none\" : \"auto\")};\n\n &:hover {\n ${(props) =>\n props.hoverStyle?.backgroundColor &&\n `background-color: ${props.hoverStyle.backgroundColor};`}\n ${(props) =>\n props.hoverStyle?.borderColor &&\n `border-color: ${props.hoverStyle.borderColor};`}\n }\n\n &:active {\n ${(props) =>\n props.pressStyle?.backgroundColor &&\n `background-color: ${props.pressStyle.backgroundColor};`}\n }\n`;\n\nexport const Box = React.forwardRef<\n HTMLDivElement | HTMLButtonElement,\n BoxProps\n>(\n (\n {\n children,\n onPress,\n onKeyDown,\n onKeyUp,\n role,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-current\": ariaCurrent,\n \"aria-disabled\": ariaDisabled,\n \"aria-live\": ariaLive,\n \"aria-busy\": ariaBusy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-expanded\": ariaExpanded,\n \"aria-haspopup\": ariaHasPopup,\n \"aria-pressed\": ariaPressed,\n \"aria-controls\": ariaControls,\n tabIndex,\n as,\n src,\n alt,\n type,\n disabled,\n id,\n ...props\n },\n ref\n ) => {\n // Handle as=\"img\" for rendering images with proper border-radius\n if (as === \"img\" && src) {\n return (\n <img\n src={src}\n alt={alt || \"\"}\n style={{\n display: \"block\",\n objectFit: \"cover\",\n width:\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width,\n height:\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height,\n borderRadius:\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius,\n position: props.position,\n top: typeof props.top === \"number\" ? `${props.top}px` : props.top,\n left:\n typeof props.left === \"number\" ? `${props.left}px` : props.left,\n right:\n typeof props.right === \"number\"\n ? `${props.right}px`\n : props.right,\n bottom:\n typeof props.bottom === \"number\"\n ? `${props.bottom}px`\n : props.bottom,\n }}\n />\n );\n }\n\n return (\n <StyledBox\n ref={ref}\n as={as}\n id={id}\n type={as === \"button\" ? type || \"button\" : undefined}\n disabled={as === \"button\" ? disabled : undefined}\n onClick={onPress}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-current={ariaCurrent}\n aria-disabled={ariaDisabled}\n aria-busy={ariaBusy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n aria-pressed={ariaPressed}\n aria-controls={ariaControls}\n aria-live={ariaLive}\n tabIndex={tabIndex !== undefined ? tabIndex : undefined}\n {...props}\n >\n {children}\n </StyledBox>\n );\n }\n);\n\nBox.displayName = \"Box\";\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledText = styled.span<TextProps>`\n color: ${(props) => props.color || \"inherit\"};\n font-size: ${(props) =>\n typeof props.fontSize === \"number\"\n ? `${props.fontSize}px`\n : props.fontSize || \"inherit\"};\n font-weight: ${(props) => props.fontWeight || \"normal\"};\n font-family: ${(props) =>\n props.fontFamily ||\n '\"Aktiv Grotesk\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif'};\n line-height: ${(props) =>\n typeof props.lineHeight === \"number\"\n ? `${props.lineHeight}px`\n : props.lineHeight || \"inherit\"};\n white-space: ${(props) => props.whiteSpace || \"normal\"};\n text-align: ${(props) => props.textAlign || \"inherit\"};\n text-decoration: ${(props) => props.textDecoration || \"none\"};\n`;\n\nexport const Text: React.FC<TextProps> = ({\n style,\n className,\n id,\n role,\n ...props\n}) => {\n return (\n <StyledText\n {...props}\n style={style}\n className={className}\n id={id}\n role={role}\n />\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n\n {(label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n f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AAAA,YACrB,SAAS;AAAA,YACT,eAAc;AAAA,YACd,YAAW;AAAA,YACX,gBAAgB,UAAU,aAAa;AAAA,YACvC,YACE,CAAC,aAAa,CAAC,UACX;AAAA,cACE,iBAAiB,UACb,YAAY,UACZ,aAAa;AAAA,YACnB,IACA;AAAA,YAGN,0BAAAA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAO,OAAO;AAAA,gBACd,QAAQ,OAAO;AAAA,gBACf,iBAAiB,aAAa;AAAA,gBAC9B,cAAc,OAAO;AAAA;AAAA,YACvB;AAAA;AAAA,QACF;AAAA,SAEE,SAAS,eAAe,mBACxB,qBAAC,OAAI,eAAc,UAAS,KAAK,OAAO,SACrC;AAAA,mBACC,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,aAAa;AAAA,cACpB,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cACnB,YAAW;AAAA,cAEV;AAAA;AAAA,UACH;AAAA,UAED,eACC,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM,OAAO,QAAQ;AAAA,cAC5B,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cAElB;AAAA;AAAA,UACH;AAAA,UAED,kBACC,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM,OAAO,QAAQ,MAAM;AAAA,cAClC,UAAU,OAAO;AAAA,cACjB,YAAY,OAAO;AAAA,cAElB;AAAA;AAAA,UACH;AAAA,WAEJ;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["styled","jsx","jsx"]}
1
+ {"version":3,"sources":["../../../primitives-web/src/Box.tsx","../../../primitives-web/src/Text.tsx","../../src/Switch.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"styled-components\";\nimport type { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledBox = styled.div<BoxProps>`\n display: flex;\n box-sizing: border-box;\n background-color: ${(props) => props.backgroundColor || \"transparent\"};\n border-color: ${(props) => props.borderColor || \"transparent\"};\n border-width: ${(props) =>\n typeof props.borderWidth === \"number\"\n ? `${props.borderWidth}px`\n : props.borderWidth || 0};\n\n ${(props) =>\n props.borderBottomWidth !== undefined &&\n `\n border-bottom-width: ${typeof props.borderBottomWidth === \"number\" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};\n border-bottom-color: ${props.borderBottomColor || props.borderColor || \"transparent\"};\n border-bottom-style: solid;\n `}\n ${(props) =>\n props.borderTopWidth !== undefined &&\n `\n border-top-width: ${typeof props.borderTopWidth === \"number\" ? `${props.borderTopWidth}px` : props.borderTopWidth};\n border-top-color: ${props.borderTopColor || props.borderColor || \"transparent\"};\n border-top-style: solid;\n `}\n ${(props) =>\n props.borderLeftWidth !== undefined &&\n `\n border-left-width: ${typeof props.borderLeftWidth === \"number\" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};\n border-left-color: ${props.borderLeftColor || props.borderColor || \"transparent\"};\n border-left-style: solid;\n `}\n ${(props) =>\n props.borderRightWidth !== undefined &&\n `\n border-right-width: ${typeof props.borderRightWidth === \"number\" ? `${props.borderRightWidth}px` : props.borderRightWidth};\n border-right-color: ${props.borderRightColor || props.borderColor || \"transparent\"};\n border-right-style: solid;\n `}\n\n border-style: ${(props) =>\n props.borderStyle ||\n (props.borderWidth ||\n props.borderBottomWidth ||\n props.borderTopWidth ||\n props.borderLeftWidth ||\n props.borderRightWidth\n ? \"solid\"\n : \"none\")};\n border-radius: ${(props) =>\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius || 0};\n height: ${(props) =>\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height || \"auto\"};\n width: ${(props) =>\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width || \"auto\"};\n min-width: ${(props) =>\n typeof props.minWidth === \"number\"\n ? `${props.minWidth}px`\n : props.minWidth || \"auto\"};\n min-height: ${(props) =>\n typeof props.minHeight === \"number\"\n ? `${props.minHeight}px`\n : props.minHeight || \"auto\"};\n\n padding: ${(props) =>\n typeof props.padding === \"number\"\n ? `${props.padding}px`\n : props.padding || 0};\n ${(props) =>\n props.paddingHorizontal &&\n `\n padding-left: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n padding-right: ${typeof props.paddingHorizontal === \"number\" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};\n `}\n ${(props) =>\n props.paddingVertical &&\n `\n padding-top: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n padding-bottom: ${typeof props.paddingVertical === \"number\" ? `${props.paddingVertical}px` : props.paddingVertical};\n `}\n ${(props) =>\n props.paddingTop !== undefined &&\n `padding-top: ${typeof props.paddingTop === \"number\" ? `${props.paddingTop}px` : props.paddingTop};`}\n ${(props) =>\n props.paddingBottom !== undefined &&\n `padding-bottom: ${typeof props.paddingBottom === \"number\" ? `${props.paddingBottom}px` : props.paddingBottom};`}\n ${(props) =>\n props.paddingLeft !== undefined &&\n `padding-left: ${typeof props.paddingLeft === \"number\" ? `${props.paddingLeft}px` : props.paddingLeft};`}\n ${(props) =>\n props.paddingRight !== undefined &&\n `padding-right: ${typeof props.paddingRight === \"number\" ? `${props.paddingRight}px` : props.paddingRight};`}\n\n margin: ${(props) =>\n typeof props.margin === \"number\" ? `${props.margin}px` : props.margin || 0};\n ${(props) =>\n props.marginTop !== undefined &&\n `margin-top: ${typeof props.marginTop === \"number\" ? `${props.marginTop}px` : props.marginTop};`}\n ${(props) =>\n props.marginBottom !== undefined &&\n `margin-bottom: ${typeof props.marginBottom === \"number\" ? `${props.marginBottom}px` : props.marginBottom};`}\n ${(props) =>\n props.marginLeft !== undefined &&\n `margin-left: ${typeof props.marginLeft === \"number\" ? `${props.marginLeft}px` : props.marginLeft};`}\n ${(props) =>\n props.marginRight !== undefined &&\n `margin-right: ${typeof props.marginRight === \"number\" ? `${props.marginRight}px` : props.marginRight};`}\n\n flex-direction: ${(props) => props.flexDirection || \"column\"};\n flex-wrap: ${(props) => props.flexWrap || \"nowrap\"};\n align-items: ${(props) => props.alignItems || \"stretch\"};\n justify-content: ${(props) => props.justifyContent || \"flex-start\"};\n cursor: ${(props) =>\n props.cursor\n ? props.cursor\n : props.onClick || props.onPress\n ? \"pointer\"\n : \"inherit\"};\n position: ${(props) => props.position || \"static\"};\n top: ${(props) =>\n typeof props.top === \"number\" ? `${props.top}px` : props.top};\n bottom: ${(props) =>\n typeof props.bottom === \"number\" ? `${props.bottom}px` : props.bottom};\n left: ${(props) =>\n typeof props.left === \"number\" ? `${props.left}px` : props.left};\n right: ${(props) =>\n typeof props.right === \"number\" ? `${props.right}px` : props.right};\n flex: ${(props) => props.flex};\n flex-shrink: ${(props) => props.flexShrink ?? 1};\n gap: ${(props) =>\n typeof props.gap === \"number\" ? `${props.gap}px` : props.gap || 0};\n align-self: ${(props) => props.alignSelf || \"auto\"};\n overflow: ${(props) => props.overflow || \"visible\"};\n overflow-x: ${(props) => props.overflowX || \"visible\"};\n overflow-y: ${(props) => props.overflowY || \"visible\"};\n z-index: ${(props) => props.zIndex};\n opacity: ${(props) => (props.disabled ? 0.5 : 1)};\n pointer-events: ${(props) => (props.disabled ? \"none\" : \"auto\")};\n\n &:hover {\n ${(props) =>\n props.hoverStyle?.backgroundColor &&\n `background-color: ${props.hoverStyle.backgroundColor};`}\n ${(props) =>\n props.hoverStyle?.borderColor &&\n `border-color: ${props.hoverStyle.borderColor};`}\n }\n\n &:active {\n ${(props) =>\n props.pressStyle?.backgroundColor &&\n `background-color: ${props.pressStyle.backgroundColor};`}\n }\n`;\n\nexport const Box = React.forwardRef<\n HTMLDivElement | HTMLButtonElement,\n BoxProps\n>(\n (\n {\n children,\n onPress,\n onKeyDown,\n onKeyUp,\n role,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-current\": ariaCurrent,\n \"aria-disabled\": ariaDisabled,\n \"aria-live\": ariaLive,\n \"aria-busy\": ariaBusy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-expanded\": ariaExpanded,\n \"aria-haspopup\": ariaHasPopup,\n \"aria-pressed\": ariaPressed,\n \"aria-controls\": ariaControls,\n tabIndex,\n as,\n src,\n alt,\n type,\n disabled,\n id,\n ...props\n },\n ref\n ) => {\n // Handle as=\"img\" for rendering images with proper border-radius\n if (as === \"img\" && src) {\n return (\n <img\n src={src}\n alt={alt || \"\"}\n style={{\n display: \"block\",\n objectFit: \"cover\",\n width:\n typeof props.width === \"number\"\n ? `${props.width}px`\n : props.width,\n height:\n typeof props.height === \"number\"\n ? `${props.height}px`\n : props.height,\n borderRadius:\n typeof props.borderRadius === \"number\"\n ? `${props.borderRadius}px`\n : props.borderRadius,\n position: props.position,\n top: typeof props.top === \"number\" ? `${props.top}px` : props.top,\n left:\n typeof props.left === \"number\" ? `${props.left}px` : props.left,\n right:\n typeof props.right === \"number\"\n ? `${props.right}px`\n : props.right,\n bottom:\n typeof props.bottom === \"number\"\n ? `${props.bottom}px`\n : props.bottom,\n }}\n />\n );\n }\n\n return (\n <StyledBox\n ref={ref}\n as={as}\n id={id}\n type={as === \"button\" ? type || \"button\" : undefined}\n disabled={as === \"button\" ? disabled : undefined}\n onClick={onPress}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-current={ariaCurrent}\n aria-disabled={ariaDisabled}\n aria-busy={ariaBusy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n aria-pressed={ariaPressed}\n aria-controls={ariaControls}\n aria-live={ariaLive}\n tabIndex={tabIndex !== undefined ? tabIndex : undefined}\n {...props}\n >\n {children}\n </StyledBox>\n );\n }\n);\n\nBox.displayName = \"Box\";\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledText = styled.span<TextProps>`\n color: ${(props) => props.color || \"inherit\"};\n font-size: ${(props) =>\n typeof props.fontSize === \"number\"\n ? `${props.fontSize}px`\n : props.fontSize || \"inherit\"};\n font-weight: ${(props) => props.fontWeight || \"normal\"};\n font-family: ${(props) =>\n props.fontFamily ||\n '\"Aktiv Grotesk\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif'};\n line-height: ${(props) =>\n typeof props.lineHeight === \"number\"\n ? `${props.lineHeight}px`\n : props.lineHeight || \"inherit\"};\n white-space: ${(props) => props.whiteSpace || \"normal\"};\n text-align: ${(props) => props.textAlign || \"inherit\"};\n text-decoration: ${(props) => props.textDecoration || \"none\"};\n`;\n\nexport const Text: React.FC<TextProps> = ({\n style,\n className,\n id,\n role,\n ...props\n}) => {\n return (\n <StyledText\n {...props}\n style={style}\n className={className}\n id={id}\n role={role}\n />\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\n\nexport interface SwitchProps {\n /** Size of the switch */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Whether the switch is checked */\n checked?: boolean;\n /** Visual state of the switch */\n state?: \"default\" | \"hover\" | \"disable\" | \"error\";\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Label text to display next to the switch */\n label?: string;\n /** Position of the label relative to the switch */\n labelPosition?: \"left\" | \"right\";\n /** Description text to display below the label */\n description?: string;\n /** Error label text to display when state is 'error' */\n errorLabel?: string;\n /** Callback when the switch value changes */\n onValueChange?: (value: boolean) => void;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** ID of the element that labels this switch */\n ariaLabelledBy?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n size = \"md\",\n checked = false,\n state = \"default\",\n disabled = false,\n label,\n labelPosition = \"right\",\n description,\n errorLabel,\n onValueChange,\n ariaLabel,\n ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n\n const isDisable = state === \"disable\" || disabled;\n const isError = state === \"error\";\n const isHover = state === \"hover\";\n const showErrorLabel = isError && errorLabel;\n\n // Resolve Sizing\n const sizing = theme.sizing.switch(size);\n\n // Resolve Colors from Theme\n const switchColors = theme.colors.control.switch;\n const checkColors = theme.colors.control.check;\n const textColors = theme.colors.control.text;\n\n const handlePress = () => {\n if (!isDisable && onValueChange) {\n onValueChange(!checked);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!isDisable && (event.key === \" \" || event.key === \"Enter\")) {\n event.preventDefault();\n handlePress();\n }\n };\n\n const getBgColor = () => {\n if (isDisable) return switchColors.bg;\n if (checked && isHover) return checkColors.bgHover;\n if (checked) return checkColors.bg;\n if (isHover) return switchColors.bgHover;\n return switchColors.bg;\n };\n\n const getTextColor = () => {\n if (isDisable) return textColors.disable;\n return textColors.primary;\n };\n\n const getKnobColor = () => {\n return theme.colors.content.static.light;\n };\n\n const labelBlock = (label || description || showErrorLabel) && (\n <Box flexDirection=\"column\" gap={sizing.textGap}>\n {label && (\n <Text\n color={getTextColor()}\n fontSize={sizing.fontSize}\n lineHeight={sizing.lineHeight}\n fontWeight=\"400\"\n >\n {label}\n </Text>\n )}\n {description && (\n <Text\n color={theme.colors.content.tertiary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {description}\n </Text>\n )}\n {showErrorLabel && (\n <Text\n color={theme.colors.content.alert.primary}\n fontSize={sizing.descriptionFontSize}\n lineHeight={sizing.descriptionLineHeight}\n >\n {errorLabel}\n </Text>\n )}\n </Box>\n );\n\n const toggle = (\n <Box\n width={sizing.width}\n height={sizing.height}\n backgroundColor={getBgColor()}\n borderRadius={sizing.frameBorderRadius}\n padding={2}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent={checked ? \"flex-end\" : \"flex-start\"}\n hoverStyle={\n !isDisable && !isHover\n ? {\n backgroundColor: checked\n ? checkColors.bgHover\n : switchColors.bgHover,\n }\n : undefined\n }\n >\n <Box\n width={sizing.knobSize}\n height={sizing.knobSize}\n backgroundColor={getKnobColor()}\n borderRadius={sizing.knobBorderRadius}\n />\n </Box>\n );\n\n return (\n <Box\n role=\"switch\"\n aria-checked={checked}\n aria-disabled={isDisable || undefined}\n aria-label={\n ariaLabelledBy ? undefined : ariaLabel || (label ? undefined : \"Switch\")\n }\n aria-labelledby={ariaLabelledBy}\n tabIndex={isDisable ? -1 : 0}\n flexDirection=\"row\"\n alignItems={description || showErrorLabel ? \"flex-start\" : \"center\"}\n gap={sizing.labelGap}\n onPress={handlePress}\n onKeyDown={handleKeyDown}\n cursor={!isDisable ? \"pointer\" : \"default\"}\n >\n {labelPosition === \"left\" && labelBlock}\n {toggle}\n {labelPosition === \"right\" && labelBlock}\n </Box>\n );\n};\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,OAAO,YAAY;AAuMX;AApMR,IAAM,YAAY,OAAO;AAAA;AAAA;AAAA,sBAGH,CAAC,UAAU,MAAM,mBAAmB,aAAa;AAAA,kBACrD,CAAC,UAAU,MAAM,eAAe,aAAa;AAAA,kBAC7C,CAAC,UACf,OAAO,MAAM,gBAAgB,WACzB,GAAG,MAAM,WAAW,OACpB,MAAM,eAAe,CAAC;AAAA;AAAA,IAE1B,CAAC,UACD,MAAM,sBAAsB,UAC5B;AAAA,2BACuB,OAAO,MAAM,sBAAsB,WAAW,GAAG,MAAM,iBAAiB,OAAO,MAAM,iBAAiB;AAAA,2BACtG,MAAM,qBAAqB,MAAM,eAAe,aAAa;AAAA;AAAA,GAErF;AAAA,IACC,CAAC,UACD,MAAM,mBAAmB,UACzB;AAAA,wBACoB,OAAO,MAAM,mBAAmB,WAAW,GAAG,MAAM,cAAc,OAAO,MAAM,cAAc;AAAA,wBAC7F,MAAM,kBAAkB,MAAM,eAAe,aAAa;AAAA;AAAA,GAE/E;AAAA,IACC,CAAC,UACD,MAAM,oBAAoB,UAC1B;AAAA,yBACqB,OAAO,MAAM,oBAAoB,WAAW,GAAG,MAAM,eAAe,OAAO,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