@beydesign/storybook 0.0.6 → 0.0.8

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.
@@ -141,8 +141,6 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
141
141
  const getButtonSize = () => {
142
142
  const sizes = {
143
143
  [ButtonSize.xl]: {
144
- width: displayIconMode === ButtonDisplayMode.Only ? '3.25rem' : '12.75rem',
145
- height: '3.25rem',
146
144
  padding: displayIconMode === ButtonDisplayMode.Only
147
145
  ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
148
146
  : 'var(--spacing-tokens-size-in-px-spacing-spacing-lg) var(--spacing-tokens-size-in-px-spacing-spacing-3xl)',
@@ -150,8 +148,6 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
150
148
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
151
149
  },
152
150
  [ButtonSize.lg]: {
153
- width: displayIconMode === ButtonDisplayMode.Only ? '3rem' : '11.75rem',
154
- height: '3rem',
155
151
  padding: displayIconMode === ButtonDisplayMode.Only
156
152
  ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
157
153
  : 'var(--spacing-tokens-size-in-px-spacing-spacing-lg) var(--spacing-tokens-size-in-px-spacing-spacing-2xl)',
@@ -159,8 +155,6 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
159
155
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
160
156
  },
161
157
  [ButtonSize.md]: {
162
- width: displayIconMode === ButtonDisplayMode.Only ? '2.75rem' : '10.75rem',
163
- height: '2.75rem',
164
158
  padding: displayIconMode === ButtonDisplayMode.Only
165
159
  ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
166
160
  : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-xl)',
@@ -168,8 +162,6 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
168
162
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
169
163
  },
170
164
  [ButtonSize.sm]: {
171
- width: displayIconMode === ButtonDisplayMode.Only ? '2.5rem' : '9.75rem',
172
- height: '2.5rem',
173
165
  padding: displayIconMode === ButtonDisplayMode.Only
174
166
  ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
175
167
  : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-xl)',
@@ -177,8 +169,6 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
177
169
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
178
170
  },
179
171
  [ButtonSize.xs]: {
180
- width: displayIconMode === ButtonDisplayMode.Only ? '2.25rem' : '8.75rem',
181
- height: '2.25rem',
182
172
  padding: displayIconMode === ButtonDisplayMode.Only
183
173
  ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
184
174
  : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-lg)',
@@ -186,8 +176,6 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
186
176
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
187
177
  },
188
178
  [ButtonSize.xxs]: {
189
- width: displayIconMode === ButtonDisplayMode.Only ? '2rem' : '7.75rem',
190
- height: '2rem',
191
179
  padding: displayIconMode === ButtonDisplayMode.Only
192
180
  ? 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)'
193
181
  : 'var(--spacing-tokens-size-in-px-spacing-spacing-sm) var(--spacing-tokens-size-in-px-spacing-spacing-md)',
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ComponentsProps, ToggleButtonProps } from './types/toggle-button';
3
+ export declare const ToggleButton: React.FC<ToggleButtonProps>;
4
+ export declare const Components: React.FC<ComponentsProps>;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ToggleButtonSize, } from './types/toggle-button';
3
+ import { Box } from '@mui/material';
4
+ import { MainButton } from './Button';
5
+ import { ButtonHierarchy, ButtonSize, ButtonType, } from './types/button';
6
+ export const ToggleButton = ({ onChange, options, selectedOption, disabled, size = ToggleButtonSize.lg, }) => {
7
+ const selectedOptionStyle = {
8
+ backgroundColor: 'var(--colors-light-background-bg-card-highlight-hover)',
9
+ color: 'var(--colors-light-text-text-accent)',
10
+ };
11
+ const unselectedOptionStyle = {
12
+ backgroundColor: 'transparent',
13
+ };
14
+ const getButtonSize = () => {
15
+ switch (size) {
16
+ case ToggleButtonSize.sm:
17
+ return ButtonSize.sm;
18
+ case ToggleButtonSize.md:
19
+ return ButtonSize.md;
20
+ case ToggleButtonSize.lg:
21
+ return ButtonSize.lg;
22
+ default:
23
+ return ButtonSize.md;
24
+ }
25
+ };
26
+ return (_jsx(Box, { display: "flex", flexDirection: "row", sx: {
27
+ borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)',
28
+ overflow: 'hidden',
29
+ backgroundColor: 'var(--colors-light-background-bg-component)',
30
+ }, gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', border: `1px solid var(--colors-light-border-border-component)`, children: options.map((option) => {
31
+ const isSelected = option === selectedOption;
32
+ return (_jsx(MainButton, { text: option, onClick: () => onChange(option), size: getButtonSize(), hierarchy: ButtonHierarchy.Tetriary, type: ButtonType.Button, style: isSelected ? selectedOptionStyle : unselectedOptionStyle, disabled: disabled }, option));
33
+ }) }));
34
+ };
35
+ export const Components = () => {
36
+ return (_jsxs("div", { style: { padding: '20px' }, children: [_jsx("h1", { children: "Toggle Buttons" }), _jsx("div", { style: { display: 'flex', gap: '1rem', flexDirection: 'column' }, children: _jsx(ToggleButton, { options: ['Option 1', 'Option 2', 'Option 3'], selectedOption: "Option 1", onChange: () => { } }) })] }));
37
+ };
@@ -0,0 +1,9 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { ToggleButton } from './ToggleButton';
3
+ declare const meta: Meta<typeof ToggleButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ToggleButton>;
6
+ export declare const Default: Story;
7
+ export declare const Size_SM: Story;
8
+ export declare const Size_MD: Story;
9
+ export declare const Size_LG: Story;
@@ -0,0 +1,78 @@
1
+ import { ToggleButton } from './ToggleButton';
2
+ import { ToggleButtonSize } from './types/toggle-button';
3
+ const meta = {
4
+ title: 'Design System/Components/ToggleButton',
5
+ component: ToggleButton,
6
+ parameters: {
7
+ layout: 'centered',
8
+ design: {
9
+ type: 'figspec',
10
+ url: '',
11
+ },
12
+ },
13
+ tags: ['autodocs'],
14
+ argTypes: {
15
+ options: {
16
+ control: 'radio',
17
+ description: 'Options for the toggle button',
18
+ table: {
19
+ type: { summary: 'string[]' },
20
+ },
21
+ },
22
+ selectedOption: {
23
+ control: 'text',
24
+ description: 'Selected option for the toggle button',
25
+ table: {
26
+ type: { summary: 'string' },
27
+ },
28
+ },
29
+ disabled: {
30
+ control: 'boolean',
31
+ description: 'Whether the toggle button is disabled',
32
+ table: {
33
+ type: { summary: 'boolean' },
34
+ },
35
+ },
36
+ size: {
37
+ control: 'select',
38
+ options: Object.values(ToggleButtonSize),
39
+ description: 'Size of the toggle button',
40
+ table: {
41
+ type: { summary: 'string' },
42
+ defaultValue: { summary: ToggleButtonSize.md },
43
+ },
44
+ },
45
+ },
46
+ };
47
+ export default meta;
48
+ export const Default = {
49
+ args: {
50
+ options: ['Option 1', 'Option 2', 'Option 3'],
51
+ selectedOption: 'Option 1',
52
+ onChange: () => { },
53
+ },
54
+ };
55
+ export const Size_SM = {
56
+ args: {
57
+ options: ['Option 1', 'Option 2', 'Option 3'],
58
+ selectedOption: 'Option 1',
59
+ onChange: () => { },
60
+ size: ToggleButtonSize.sm,
61
+ },
62
+ };
63
+ export const Size_MD = {
64
+ args: {
65
+ options: ['Option 1', 'Option 2', 'Option 3'],
66
+ selectedOption: 'Option 1',
67
+ onChange: () => { },
68
+ size: ToggleButtonSize.md,
69
+ },
70
+ };
71
+ export const Size_LG = {
72
+ args: {
73
+ options: ['Option 1', 'Option 2', 'Option 3'],
74
+ selectedOption: 'Option 1',
75
+ onChange: () => { },
76
+ size: ToggleButtonSize.lg,
77
+ },
78
+ };
@@ -56,8 +56,6 @@ export declare enum ButtonType {
56
56
  * Size configuration for a button
57
57
  */
58
58
  export interface ButtonSizeConfig {
59
- width: string;
60
- height: string;
61
59
  padding: string;
62
60
  fontSize: string;
63
61
  gap: string;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Toggle button size variants
3
+ */
4
+ export declare enum ToggleButtonSize {
5
+ lg = "lg",
6
+ md = "md",
7
+ sm = "sm"
8
+ }
9
+ /**
10
+ * Toggle button style variants
11
+ */
12
+ export declare enum ToggleButtonStyle {
13
+ Outline = "Outline",
14
+ Filled = "Filled"
15
+ }
16
+ /**
17
+ * Toggle button component props
18
+ */
19
+ export type ToggleButtonProps = {
20
+ /** Size variant of the toggle button */
21
+ size?: ToggleButtonSize;
22
+ /** Selected option of the toggle button */
23
+ selectedOption: string;
24
+ /** Options of the toggle button */
25
+ options: string[];
26
+ /** Whether the toggle button is disabled */
27
+ disabled?: boolean;
28
+ /** Callback function when the toggle button is selected */
29
+ onChange: (option: string) => void;
30
+ };
31
+ /**
32
+ * Props for the Components wrapper
33
+ */
34
+ export interface ComponentsProps {
35
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Toggle button size variants
3
+ */
4
+ export var ToggleButtonSize;
5
+ (function (ToggleButtonSize) {
6
+ ToggleButtonSize["lg"] = "lg";
7
+ ToggleButtonSize["md"] = "md";
8
+ ToggleButtonSize["sm"] = "sm";
9
+ })(ToggleButtonSize || (ToggleButtonSize = {}));
10
+ /**
11
+ * Toggle button style variants
12
+ */
13
+ export var ToggleButtonStyle;
14
+ (function (ToggleButtonStyle) {
15
+ ToggleButtonStyle["Outline"] = "Outline";
16
+ ToggleButtonStyle["Filled"] = "Filled";
17
+ })(ToggleButtonStyle || (ToggleButtonStyle = {}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",