@xsolla/xui-toggle-button-group 0.101.0-pr166.1772004027

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Flowtype definitions for index
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import React from "react";
9
+ declare type ToggleButtonGroupSize = "xl" | "lg" | "md" | "sm";
10
+ declare type ToggleButtonGroupAppearance = "separated" | "united";
11
+ declare interface ToggleButtonGroupItem {
12
+ /**
13
+ * Unique identifier for the item
14
+ */
15
+ id: string;
16
+
17
+ /**
18
+ * Display label for the item
19
+ */
20
+ label: string;
21
+
22
+ /**
23
+ * Optional icon to display on the left
24
+ */
25
+ iconLeft?: React.ReactNode;
26
+
27
+ /**
28
+ * Optional icon to display on the right
29
+ */
30
+ iconRight?: React.ReactNode;
31
+
32
+ /**
33
+ * Whether the item is disabled
34
+ */
35
+ disabled?: boolean;
36
+
37
+ /**
38
+ * Accessible label for screen readers
39
+ */
40
+ "aria-label"?: string;
41
+ }
42
+ declare interface ToggleButtonGroupProps {
43
+ /**
44
+ * Array of items
45
+ */
46
+ items: ToggleButtonGroupItem[];
47
+
48
+ /**
49
+ * ID(s) of the currently active item(s). For single selection, pass a string. For multiple selection, pass an array.
50
+ */
51
+ value?: string | string[];
52
+
53
+ /**
54
+ * Default value(s) for uncontrolled mode
55
+ */
56
+ defaultValue?: string | string[];
57
+
58
+ /**
59
+ * Callback when selection changes. Returns string for single selection, string[] for multiple.
60
+ */
61
+ onChange?: (value: string | string[]) => void;
62
+
63
+ /**
64
+ * Size variant
65
+ */
66
+ size?: ToggleButtonGroupSize;
67
+
68
+ /**
69
+ * Visual appearance - separated has gaps, united has connected items
70
+ */
71
+ appearance?: ToggleButtonGroupAppearance;
72
+
73
+ /**
74
+ * Whether multiple items can be selected
75
+ */
76
+ multiple?: boolean;
77
+
78
+ /**
79
+ * HTML id attribute
80
+ */
81
+ id?: string;
82
+
83
+ /**
84
+ * Test ID for testing frameworks
85
+ */
86
+ testID?: string;
87
+
88
+ /**
89
+ * Accessible label for the group
90
+ */
91
+ "aria-label"?: string;
92
+
93
+ /**
94
+ * ID of element that labels this group
95
+ */
96
+ "aria-labelledby"?: string;
97
+ }
98
+ /**
99
+ * ToggleButtonGroup - A control for picking one or several options from a set
100
+ *
101
+ * Used to pick one or several options from a linear set of closely related options.
102
+ * Can be used to filter or to sort elements.
103
+ *
104
+ * ## Accessibility Features
105
+ *
106
+ * - **Role**: Uses `role="radiogroup"` for single selection, `role="group"` for multiple
107
+ * - **Keyboard Navigation**: Arrow keys to navigate, Enter/Space to select
108
+ * - **ARIA**: Proper aria-checked and aria-disabled states
109
+ */
110
+ declare var ToggleButtonGroup: React.FC<ToggleButtonGroupProps>;
111
+ export type {
112
+ ToggleButtonGroupAppearance,
113
+ ToggleButtonGroupItem,
114
+ ToggleButtonGroupProps,
115
+ ToggleButtonGroupSize,
116
+ };
117
+ declare export { ToggleButtonGroup };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.tsx","../../src/ToggleButtonGroup.tsx","../../../primitives-web/src/Box.tsx","../../../primitives-web/src/Text.tsx","../../../primitives-web/src/Icon.tsx"],"sourcesContent":["export { ToggleButtonGroup } from \"./ToggleButtonGroup\";\nexport type {\n ToggleButtonGroupProps,\n ToggleButtonGroupItem,\n ToggleButtonGroupSize,\n ToggleButtonGroupAppearance,\n} from \"./types\";\n","import React, { useCallback, useRef, useState } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text, Icon } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\nimport type { ToggleButtonGroupProps } from \"./types\";\n\n/**\n * ToggleButtonGroup - A control for picking one or several options from a set\n *\n * Used to pick one or several options from a linear set of closely related options.\n * Can be used to filter or to sort elements.\n *\n * ## Accessibility Features\n *\n * - **Role**: Uses `role=\"radiogroup\"` for single selection, `role=\"group\"` for multiple\n * - **Keyboard Navigation**: Arrow keys to navigate, Enter/Space to select\n * - **ARIA**: Proper aria-checked and aria-disabled states\n */\nexport const ToggleButtonGroup: React.FC<ToggleButtonGroupProps> = ({\n items,\n value,\n defaultValue,\n onChange,\n size = \"md\",\n appearance = \"separated\",\n multiple = false,\n id,\n testID,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n}) => {\n const { theme } = useDesignSystem();\n const sizeStyles = theme.sizing.toggleButtonGroup(size);\n const itemRefs = useRef<(HTMLElement | null)[]>([]);\n\n // Internal state for uncontrolled mode\n const [internalValue, setInternalValue] = useState<string[]>(() => {\n if (defaultValue !== undefined) {\n return Array.isArray(defaultValue) ? defaultValue : [defaultValue];\n }\n return [];\n });\n\n // Determine current value (controlled vs uncontrolled)\n const currentValue =\n value !== undefined\n ? Array.isArray(value)\n ? value\n : [value]\n : internalValue;\n\n const isItemActive = (itemId: string) => currentValue.includes(itemId);\n\n const enabledIndices = items\n .map((item, index) => (!item.disabled ? index : -1))\n .filter((i) => i !== -1);\n\n const focusItem = useCallback((index: number) => {\n const element = itemRefs.current[index];\n if (element) {\n element.focus();\n }\n }, []);\n\n const handleSelect = useCallback(\n (itemId: string) => {\n let newValue: string[];\n\n if (multiple) {\n // Multiple selection mode\n if (currentValue.includes(itemId)) {\n newValue = currentValue.filter((v) => v !== itemId);\n } else {\n newValue = [...currentValue, itemId];\n }\n } else {\n // Single selection mode\n newValue = [itemId];\n }\n\n // Update internal state for uncontrolled mode\n if (value === undefined) {\n setInternalValue(newValue);\n }\n\n // Call onChange with appropriate type\n if (onChange) {\n if (multiple) {\n onChange(newValue);\n } else {\n onChange(newValue[0] || \"\");\n }\n }\n },\n [currentValue, multiple, value, onChange]\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent, currentIndex: number) => {\n const currentEnabledIndex = enabledIndices.indexOf(currentIndex);\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n e.preventDefault();\n {\n const nextEnabledIndex =\n currentEnabledIndex < enabledIndices.length - 1\n ? enabledIndices[currentEnabledIndex + 1]\n : enabledIndices[0];\n focusItem(nextEnabledIndex);\n }\n break;\n\n case \"ArrowLeft\":\n case \"ArrowUp\":\n e.preventDefault();\n {\n const prevEnabledIndex =\n currentEnabledIndex > 0\n ? enabledIndices[currentEnabledIndex - 1]\n : enabledIndices[enabledIndices.length - 1];\n focusItem(prevEnabledIndex);\n }\n break;\n\n case \"Enter\":\n case \" \":\n e.preventDefault();\n if (!items[currentIndex].disabled) {\n handleSelect(items[currentIndex].id);\n }\n break;\n\n default:\n break;\n }\n },\n [enabledIndices, focusItem, handleSelect, items]\n );\n\n const isSeparated = appearance === \"separated\";\n const containerGap = isSeparated ? sizeStyles.itemGap : 0;\n\n // Determine first active item for tabindex in single selection mode\n const firstActiveIndex = items.findIndex((item) =>\n currentValue.includes(item.id)\n );\n const firstEnabledIndex = enabledIndices[0] ?? 0;\n\n return (\n <Box\n id={id}\n role={multiple ? \"group\" : \"radiogroup\"}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n testID={testID}\n flexDirection=\"row\"\n alignItems=\"center\"\n flexWrap=\"wrap\"\n gap={containerGap}\n {...(!isSeparated && {\n borderWidth: 1,\n borderColor: theme.colors.control.toggleButton.border,\n borderStyle: \"solid\",\n borderRadius: sizeStyles.borderRadius,\n width: \"fit-content\",\n })}\n >\n {items.map((item, index) => {\n const isActive = isItemActive(item.id);\n const isDisabled = item.disabled;\n const itemId = id ? `${id}-item-${item.id}` : undefined;\n\n // Determine tab index\n let tabIndex: number;\n if (isDisabled) {\n tabIndex = -1;\n } else if (multiple) {\n // In multiple mode, all enabled items are tabbable\n tabIndex = 0;\n } else {\n // In single mode, only the active item (or first enabled if none active) is tabbable\n tabIndex =\n isActive || (firstActiveIndex === -1 && index === firstEnabledIndex)\n ? 0\n : -1;\n }\n\n const handlePress = () => {\n if (!isDisabled) {\n handleSelect(item.id);\n }\n };\n\n // Colors based on state - using toggle button specific colors\n const toggleColors = theme.colors.control.toggleButton;\n\n const bgColor = isDisabled\n ? toggleColors.bgDisable\n : isActive\n ? toggleColors.bgPress\n : toggleColors.bg;\n\n const textColor = isDisabled\n ? toggleColors.textDisable\n : toggleColors.text;\n\n const borderColor = isDisabled\n ? toggleColors.borderDisable\n : isActive\n ? toggleColors.borderPress\n : toggleColors.border;\n\n return (\n <Box\n key={item.id}\n as=\"button\"\n role={multiple ? \"checkbox\" : \"radio\"}\n id={itemId}\n aria-checked={isActive}\n aria-disabled={isDisabled}\n aria-label={item[\"aria-label\"] || item.label}\n tabIndex={tabIndex}\n disabled={isDisabled}\n ref={(el: HTMLElement | null) => {\n itemRefs.current[index] = el;\n }}\n onPress={handlePress}\n onKeyDown={(e: React.KeyboardEvent) => handleKeyDown(e, index)}\n height={sizeStyles.height}\n paddingHorizontal={sizeStyles.paddingHorizontal}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={sizeStyles.gap}\n backgroundColor={bgColor}\n {...(isSeparated && {\n borderWidth: 1,\n borderColor: borderColor,\n borderStyle: \"solid\",\n borderRadius: sizeStyles.borderRadius,\n })}\n cursor={isDisabled ? \"not-allowed\" : \"pointer\"}\n hoverStyle={\n !isDisabled && !isActive\n ? {\n backgroundColor: toggleColors.bgHover,\n borderColor: toggleColors.borderHover,\n }\n : undefined\n }\n {...(!isSeparated && {\n borderLeftWidth: index > 0 ? 1 : 0,\n borderLeftColor: theme.colors.control.toggleButton.border,\n borderLeftStyle: \"solid\",\n })}\n style={{\n flexShrink: 0,\n ...(!isSeparated &&\n index === 0 && {\n borderTopLeftRadius: sizeStyles.borderRadius - 1,\n borderBottomLeftRadius: sizeStyles.borderRadius - 1,\n }),\n ...(!isSeparated &&\n index === items.length - 1 && {\n borderTopRightRadius: sizeStyles.borderRadius - 1,\n borderBottomRightRadius: sizeStyles.borderRadius - 1,\n }),\n }}\n >\n {item.iconLeft && (\n <Icon size={sizeStyles.iconSize} color={textColor} aria-hidden>\n {item.iconLeft}\n </Icon>\n )}\n <Text\n color={textColor}\n fontSize={sizeStyles.fontSize}\n fontWeight=\"400\"\n textAlign=\"center\"\n style={{\n lineHeight: `${sizeStyles.lineHeight}px`,\n }}\n >\n {item.label}\n </Text>\n {item.iconRight && (\n <Icon size={sizeStyles.iconSize} color={textColor} aria-hidden>\n {item.iconRight}\n </Icon>\n )}\n </Box>\n );\n })}\n </Box>\n );\n};\n\nToggleButtonGroup.displayName = \"ToggleButtonGroup\";\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 '\"Pilat Wide Bold\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif !important'};\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\";\nimport styled from \"styled-components\";\nimport { IconProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledIcon = styled.div<IconProps>`\n display: flex;\n align-items: center;\n justify-content: center;\n width: ${(props) =>\n typeof props.size === \"number\" ? `${props.size}px` : props.size || \"24px\"};\n height: ${(props) =>\n typeof props.size === \"number\" ? `${props.size}px` : props.size || \"24px\"};\n color: ${(props) => props.color || \"currentColor\"};\n\n svg {\n width: 100%;\n height: 100%;\n fill: none;\n stroke: currentColor;\n }\n`;\n\nexport const Icon: React.FC<IconProps> = ({ children, ...props }) => {\n return <StyledIcon {...props}>{children}</StyledIcon>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAqD;;;ACArD,mBAAkB;AAClB,+BAAmB;AAuMX;AApMR,IAAM,YAAY,yBAAAC,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;AAAA,GAE/E;AAAA,IACC,CAAC,UACD,MAAM,oBAAoB,UAC1B;AAAA,yBACqB,OAAO,MAAM,oBAAoB,WAAW,GAAG,MAAM,eAAe,OAAO,MAAM,eAAe;AAAA,yBAChG,MAAM,mBAAmB,MAAM,eAAe,aAAa;AAAA;AAAA,GAEjF;AAAA,IACC,CAAC,UACD,MAAM,qBAAqB,UAC3B;AAAA,0BACsB,OAAO,MAAM,qBAAqB,WAAW,GAAG,MAAM,gBAAgB,OAAO,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D,eAAK,UACR;AAAA,cAEF;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO;AAAA,kBACP,UAAU,WAAW;AAAA,kBACrB,YAAW;AAAA,kBACX,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,YAAY,GAAG,WAAW,UAAU;AAAA,kBACtC;AAAA,kBAEC,eAAK;AAAA;AAAA,cACR;AAAA,cACC,KAAK,aACJ,6CAAC,QAAK,MAAM,WAAW,UAAU,OAAO,WAAW,eAAW,MAC3D,eAAK,WACR;AAAA;AAAA;AAAA,UA1EG,KAAK;AAAA,QA4EZ;AAAA,MAEJ,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,kBAAkB,cAAc;","names":["import_react","styled","React","import_styled_components","import_jsx_runtime","styled","import_styled_components","import_jsx_runtime","styled","import_jsx_runtime"]}
package/web/index.mjs ADDED
@@ -0,0 +1,443 @@
1
+ // src/ToggleButtonGroup.tsx
2
+ import { useCallback, useRef, useState } from "react";
3
+
4
+ // ../primitives-web/src/Box.tsx
5
+ import React from "react";
6
+ import styled from "styled-components";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var StyledBox = styled.div`
9
+ display: flex;
10
+ box-sizing: border-box;
11
+ background-color: ${(props) => props.backgroundColor || "transparent"};
12
+ border-color: ${(props) => props.borderColor || "transparent"};
13
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
14
+
15
+ ${(props) => props.borderBottomWidth !== void 0 && `
16
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
17
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
18
+ border-bottom-style: solid;
19
+ `}
20
+ ${(props) => props.borderTopWidth !== void 0 && `
21
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
22
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
23
+ border-top-style: solid;
24
+ `}
25
+ ${(props) => props.borderLeftWidth !== void 0 && `
26
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
27
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
28
+ border-left-style: solid;
29
+ `}
30
+ ${(props) => props.borderRightWidth !== void 0 && `
31
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
32
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
33
+ border-right-style: solid;
34
+ `}
35
+
36
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
37
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
38
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
39
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
40
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
41
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
42
+
43
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
44
+ ${(props) => props.paddingHorizontal && `
45
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
46
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
47
+ `}
48
+ ${(props) => props.paddingVertical && `
49
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
50
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
51
+ `}
52
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
53
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
54
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
55
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
56
+
57
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
58
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
59
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
60
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
61
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
62
+
63
+ flex-direction: ${(props) => props.flexDirection || "column"};
64
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
65
+ align-items: ${(props) => props.alignItems || "stretch"};
66
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
67
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
68
+ position: ${(props) => props.position || "static"};
69
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
70
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
71
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
72
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
73
+ flex: ${(props) => props.flex};
74
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
75
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
76
+ align-self: ${(props) => props.alignSelf || "auto"};
77
+ overflow: ${(props) => props.overflow || "visible"};
78
+ overflow-x: ${(props) => props.overflowX || "visible"};
79
+ overflow-y: ${(props) => props.overflowY || "visible"};
80
+ z-index: ${(props) => props.zIndex};
81
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
82
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
83
+
84
+ &:hover {
85
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
86
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
87
+ }
88
+
89
+ &:active {
90
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
91
+ }
92
+ `;
93
+ var Box = React.forwardRef(
94
+ ({
95
+ children,
96
+ onPress,
97
+ onKeyDown,
98
+ onKeyUp,
99
+ role,
100
+ "aria-label": ariaLabel,
101
+ "aria-labelledby": ariaLabelledBy,
102
+ "aria-current": ariaCurrent,
103
+ "aria-disabled": ariaDisabled,
104
+ "aria-live": ariaLive,
105
+ "aria-busy": ariaBusy,
106
+ "aria-describedby": ariaDescribedBy,
107
+ "aria-expanded": ariaExpanded,
108
+ "aria-haspopup": ariaHasPopup,
109
+ "aria-pressed": ariaPressed,
110
+ "aria-controls": ariaControls,
111
+ tabIndex,
112
+ as,
113
+ src,
114
+ alt,
115
+ type,
116
+ disabled,
117
+ id,
118
+ ...props
119
+ }, ref) => {
120
+ if (as === "img" && src) {
121
+ return /* @__PURE__ */ jsx(
122
+ "img",
123
+ {
124
+ src,
125
+ alt: alt || "",
126
+ style: {
127
+ display: "block",
128
+ objectFit: "cover",
129
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
130
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
131
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
132
+ position: props.position,
133
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
134
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
135
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
136
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom
137
+ }
138
+ }
139
+ );
140
+ }
141
+ return /* @__PURE__ */ jsx(
142
+ StyledBox,
143
+ {
144
+ ref,
145
+ as,
146
+ id,
147
+ type: as === "button" ? type || "button" : void 0,
148
+ disabled: as === "button" ? disabled : void 0,
149
+ onClick: onPress,
150
+ onKeyDown,
151
+ onKeyUp,
152
+ role,
153
+ "aria-label": ariaLabel,
154
+ "aria-labelledby": ariaLabelledBy,
155
+ "aria-current": ariaCurrent,
156
+ "aria-disabled": ariaDisabled,
157
+ "aria-busy": ariaBusy,
158
+ "aria-describedby": ariaDescribedBy,
159
+ "aria-expanded": ariaExpanded,
160
+ "aria-haspopup": ariaHasPopup,
161
+ "aria-pressed": ariaPressed,
162
+ "aria-controls": ariaControls,
163
+ "aria-live": ariaLive,
164
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
165
+ ...props,
166
+ children
167
+ }
168
+ );
169
+ }
170
+ );
171
+ Box.displayName = "Box";
172
+
173
+ // ../primitives-web/src/Text.tsx
174
+ import styled2 from "styled-components";
175
+ import { jsx as jsx2 } from "react/jsx-runtime";
176
+ var StyledText = styled2.span`
177
+ color: ${(props) => props.color || "inherit"};
178
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
179
+ font-weight: ${(props) => props.fontWeight || "normal"};
180
+ font-family: ${(props) => props.fontFamily || '"Pilat Wide Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important'};
181
+ line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
182
+ white-space: ${(props) => props.whiteSpace || "normal"};
183
+ text-align: ${(props) => props.textAlign || "inherit"};
184
+ text-decoration: ${(props) => props.textDecoration || "none"};
185
+ `;
186
+ var Text = ({
187
+ style,
188
+ className,
189
+ id,
190
+ role,
191
+ ...props
192
+ }) => {
193
+ return /* @__PURE__ */ jsx2(
194
+ StyledText,
195
+ {
196
+ ...props,
197
+ style,
198
+ className,
199
+ id,
200
+ role
201
+ }
202
+ );
203
+ };
204
+
205
+ // ../primitives-web/src/Icon.tsx
206
+ import styled3 from "styled-components";
207
+ import { jsx as jsx3 } from "react/jsx-runtime";
208
+ var StyledIcon = styled3.div`
209
+ display: flex;
210
+ align-items: center;
211
+ justify-content: center;
212
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
213
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
214
+ color: ${(props) => props.color || "currentColor"};
215
+
216
+ svg {
217
+ width: 100%;
218
+ height: 100%;
219
+ fill: none;
220
+ stroke: currentColor;
221
+ }
222
+ `;
223
+ var Icon = ({ children, ...props }) => {
224
+ return /* @__PURE__ */ jsx3(StyledIcon, { ...props, children });
225
+ };
226
+
227
+ // src/ToggleButtonGroup.tsx
228
+ import { useDesignSystem } from "@xsolla/xui-core";
229
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
230
+ var ToggleButtonGroup = ({
231
+ items,
232
+ value,
233
+ defaultValue,
234
+ onChange,
235
+ size = "md",
236
+ appearance = "separated",
237
+ multiple = false,
238
+ id,
239
+ testID,
240
+ "aria-label": ariaLabel,
241
+ "aria-labelledby": ariaLabelledBy
242
+ }) => {
243
+ const { theme } = useDesignSystem();
244
+ const sizeStyles = theme.sizing.toggleButtonGroup(size);
245
+ const itemRefs = useRef([]);
246
+ const [internalValue, setInternalValue] = useState(() => {
247
+ if (defaultValue !== void 0) {
248
+ return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
249
+ }
250
+ return [];
251
+ });
252
+ const currentValue = value !== void 0 ? Array.isArray(value) ? value : [value] : internalValue;
253
+ const isItemActive = (itemId) => currentValue.includes(itemId);
254
+ const enabledIndices = items.map((item, index) => !item.disabled ? index : -1).filter((i) => i !== -1);
255
+ const focusItem = useCallback((index) => {
256
+ const element = itemRefs.current[index];
257
+ if (element) {
258
+ element.focus();
259
+ }
260
+ }, []);
261
+ const handleSelect = useCallback(
262
+ (itemId) => {
263
+ let newValue;
264
+ if (multiple) {
265
+ if (currentValue.includes(itemId)) {
266
+ newValue = currentValue.filter((v) => v !== itemId);
267
+ } else {
268
+ newValue = [...currentValue, itemId];
269
+ }
270
+ } else {
271
+ newValue = [itemId];
272
+ }
273
+ if (value === void 0) {
274
+ setInternalValue(newValue);
275
+ }
276
+ if (onChange) {
277
+ if (multiple) {
278
+ onChange(newValue);
279
+ } else {
280
+ onChange(newValue[0] || "");
281
+ }
282
+ }
283
+ },
284
+ [currentValue, multiple, value, onChange]
285
+ );
286
+ const handleKeyDown = useCallback(
287
+ (e, currentIndex) => {
288
+ const currentEnabledIndex = enabledIndices.indexOf(currentIndex);
289
+ switch (e.key) {
290
+ case "ArrowRight":
291
+ case "ArrowDown":
292
+ e.preventDefault();
293
+ {
294
+ const nextEnabledIndex = currentEnabledIndex < enabledIndices.length - 1 ? enabledIndices[currentEnabledIndex + 1] : enabledIndices[0];
295
+ focusItem(nextEnabledIndex);
296
+ }
297
+ break;
298
+ case "ArrowLeft":
299
+ case "ArrowUp":
300
+ e.preventDefault();
301
+ {
302
+ const prevEnabledIndex = currentEnabledIndex > 0 ? enabledIndices[currentEnabledIndex - 1] : enabledIndices[enabledIndices.length - 1];
303
+ focusItem(prevEnabledIndex);
304
+ }
305
+ break;
306
+ case "Enter":
307
+ case " ":
308
+ e.preventDefault();
309
+ if (!items[currentIndex].disabled) {
310
+ handleSelect(items[currentIndex].id);
311
+ }
312
+ break;
313
+ default:
314
+ break;
315
+ }
316
+ },
317
+ [enabledIndices, focusItem, handleSelect, items]
318
+ );
319
+ const isSeparated = appearance === "separated";
320
+ const containerGap = isSeparated ? sizeStyles.itemGap : 0;
321
+ const firstActiveIndex = items.findIndex(
322
+ (item) => currentValue.includes(item.id)
323
+ );
324
+ const firstEnabledIndex = enabledIndices[0] ?? 0;
325
+ return /* @__PURE__ */ jsx4(
326
+ Box,
327
+ {
328
+ id,
329
+ role: multiple ? "group" : "radiogroup",
330
+ "aria-label": ariaLabel,
331
+ "aria-labelledby": ariaLabelledBy,
332
+ testID,
333
+ flexDirection: "row",
334
+ alignItems: "center",
335
+ flexWrap: "wrap",
336
+ gap: containerGap,
337
+ ...!isSeparated && {
338
+ borderWidth: 1,
339
+ borderColor: theme.colors.control.toggleButton.border,
340
+ borderStyle: "solid",
341
+ borderRadius: sizeStyles.borderRadius,
342
+ width: "fit-content"
343
+ },
344
+ children: items.map((item, index) => {
345
+ const isActive = isItemActive(item.id);
346
+ const isDisabled = item.disabled;
347
+ const itemId = id ? `${id}-item-${item.id}` : void 0;
348
+ let tabIndex;
349
+ if (isDisabled) {
350
+ tabIndex = -1;
351
+ } else if (multiple) {
352
+ tabIndex = 0;
353
+ } else {
354
+ tabIndex = isActive || firstActiveIndex === -1 && index === firstEnabledIndex ? 0 : -1;
355
+ }
356
+ const handlePress = () => {
357
+ if (!isDisabled) {
358
+ handleSelect(item.id);
359
+ }
360
+ };
361
+ const toggleColors = theme.colors.control.toggleButton;
362
+ const bgColor = isDisabled ? toggleColors.bgDisable : isActive ? toggleColors.bgPress : toggleColors.bg;
363
+ const textColor = isDisabled ? toggleColors.textDisable : toggleColors.text;
364
+ const borderColor = isDisabled ? toggleColors.borderDisable : isActive ? toggleColors.borderPress : toggleColors.border;
365
+ return /* @__PURE__ */ jsxs(
366
+ Box,
367
+ {
368
+ as: "button",
369
+ role: multiple ? "checkbox" : "radio",
370
+ id: itemId,
371
+ "aria-checked": isActive,
372
+ "aria-disabled": isDisabled,
373
+ "aria-label": item["aria-label"] || item.label,
374
+ tabIndex,
375
+ disabled: isDisabled,
376
+ ref: (el) => {
377
+ itemRefs.current[index] = el;
378
+ },
379
+ onPress: handlePress,
380
+ onKeyDown: (e) => handleKeyDown(e, index),
381
+ height: sizeStyles.height,
382
+ paddingHorizontal: sizeStyles.paddingHorizontal,
383
+ flexDirection: "row",
384
+ alignItems: "center",
385
+ justifyContent: "center",
386
+ gap: sizeStyles.gap,
387
+ backgroundColor: bgColor,
388
+ ...isSeparated && {
389
+ borderWidth: 1,
390
+ borderColor,
391
+ borderStyle: "solid",
392
+ borderRadius: sizeStyles.borderRadius
393
+ },
394
+ cursor: isDisabled ? "not-allowed" : "pointer",
395
+ hoverStyle: !isDisabled && !isActive ? {
396
+ backgroundColor: toggleColors.bgHover,
397
+ borderColor: toggleColors.borderHover
398
+ } : void 0,
399
+ ...!isSeparated && {
400
+ borderLeftWidth: index > 0 ? 1 : 0,
401
+ borderLeftColor: theme.colors.control.toggleButton.border,
402
+ borderLeftStyle: "solid"
403
+ },
404
+ style: {
405
+ flexShrink: 0,
406
+ ...!isSeparated && index === 0 && {
407
+ borderTopLeftRadius: sizeStyles.borderRadius - 1,
408
+ borderBottomLeftRadius: sizeStyles.borderRadius - 1
409
+ },
410
+ ...!isSeparated && index === items.length - 1 && {
411
+ borderTopRightRadius: sizeStyles.borderRadius - 1,
412
+ borderBottomRightRadius: sizeStyles.borderRadius - 1
413
+ }
414
+ },
415
+ children: [
416
+ item.iconLeft && /* @__PURE__ */ jsx4(Icon, { size: sizeStyles.iconSize, color: textColor, "aria-hidden": true, children: item.iconLeft }),
417
+ /* @__PURE__ */ jsx4(
418
+ Text,
419
+ {
420
+ color: textColor,
421
+ fontSize: sizeStyles.fontSize,
422
+ fontWeight: "400",
423
+ textAlign: "center",
424
+ style: {
425
+ lineHeight: `${sizeStyles.lineHeight}px`
426
+ },
427
+ children: item.label
428
+ }
429
+ ),
430
+ item.iconRight && /* @__PURE__ */ jsx4(Icon, { size: sizeStyles.iconSize, color: textColor, "aria-hidden": true, children: item.iconRight })
431
+ ]
432
+ },
433
+ item.id
434
+ );
435
+ })
436
+ }
437
+ );
438
+ };
439
+ ToggleButtonGroup.displayName = "ToggleButtonGroup";
440
+ export {
441
+ ToggleButtonGroup
442
+ };
443
+ //# sourceMappingURL=index.mjs.map