@ingamigo/ui 1.0.8 → 1.2.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.
Files changed (54) hide show
  1. package/dist/components/button/button.d.ts +4 -4
  2. package/dist/components/button/button.d.ts.map +1 -0
  3. package/dist/components/button/button.js +7 -0
  4. package/dist/components/button/button.js.map +1 -0
  5. package/dist/components/button/button.styles.d.ts +8 -0
  6. package/dist/components/button/button.styles.d.ts.map +1 -0
  7. package/dist/components/button/button.styles.js +117 -0
  8. package/dist/components/button/button.styles.js.map +1 -0
  9. package/dist/components/input/input.d.ts +2 -2
  10. package/dist/components/input/input.d.ts.map +1 -0
  11. package/dist/components/input/input.js +7 -0
  12. package/dist/components/input/input.js.map +1 -0
  13. package/dist/components/input/input.styles.d.ts +9 -0
  14. package/dist/components/input/input.styles.d.ts.map +1 -0
  15. package/dist/components/input/input.styles.js +83 -0
  16. package/dist/components/input/input.styles.js.map +1 -0
  17. package/dist/components/segmented-control/segmented-control.d.ts +16 -0
  18. package/dist/components/segmented-control/segmented-control.d.ts.map +1 -0
  19. package/dist/components/segmented-control/segmented-control.js +50 -0
  20. package/dist/components/segmented-control/segmented-control.js.map +1 -0
  21. package/dist/components/segmented-control/segmented-control.stories .d.ts +25 -0
  22. package/dist/components/segmented-control/segmented-control.stories .d.ts.map +1 -0
  23. package/dist/components/segmented-control/segmented-control.stories .js +91 -0
  24. package/dist/components/segmented-control/segmented-control.stories .js.map +1 -0
  25. package/dist/components/segmented-control/segmented-control.styles.d.ts +11 -0
  26. package/dist/components/segmented-control/segmented-control.styles.d.ts.map +1 -0
  27. package/dist/components/segmented-control/segmented-control.styles.js +83 -0
  28. package/dist/components/segmented-control/segmented-control.styles.js.map +1 -0
  29. package/dist/components/typography/typography.d.ts +2 -2
  30. package/dist/components/typography/typography.d.ts.map +1 -0
  31. package/dist/components/typography/typography.js +17 -0
  32. package/dist/components/typography/typography.js.map +1 -0
  33. package/dist/components/typography/typography.styles.d.ts +5 -0
  34. package/dist/components/typography/typography.styles.d.ts.map +1 -0
  35. package/dist/components/typography/typography.styles.js +63 -0
  36. package/dist/components/typography/typography.styles.js.map +1 -0
  37. package/dist/index.d.ts +8 -6
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +7 -2
  40. package/dist/index.js.map +1 -0
  41. package/dist/theme/ThemeProvider.d.ts +6 -0
  42. package/dist/theme/ThemeProvider.d.ts.map +1 -0
  43. package/dist/theme/ThemeProvider.js +8 -0
  44. package/dist/theme/ThemeProvider.js.map +1 -0
  45. package/dist/theme/index.d.ts +4 -0
  46. package/dist/theme/index.d.ts.map +1 -0
  47. package/dist/theme/index.js +3 -0
  48. package/dist/theme/index.js.map +1 -0
  49. package/dist/theme/theme.d.ts +458 -0
  50. package/dist/theme/theme.d.ts.map +1 -0
  51. package/dist/theme/theme.js +210 -0
  52. package/dist/theme/theme.js.map +1 -0
  53. package/package.json +11 -8
  54. package/dist/index.js.LICENSE.txt +0 -9
@@ -1,8 +1,8 @@
1
1
  import type { ButtonHTMLAttributes } from "react";
2
- import "./button.style.css";
3
2
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
- variant?: "primary" | "secondary";
5
- size?: "small" | "medium" | "large";
3
+ variant?: "primary" | "secondary" | "ghost";
4
+ size?: "small" | "medium" | "large" | "icon";
6
5
  }
7
- declare const Button: ({ variant, size, className, children, ...props }: ButtonProps) => import("react").JSX.Element;
6
+ declare const Button: ({ variant, size, children, ...props }: ButtonProps) => import("react").JSX.Element;
8
7
  export default Button;
8
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAIlD,MAAM,WAAW,WACf,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC/C,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IAC5C,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;CAC9C;AAED,QAAA,MAAM,MAAM,GAAI,uCAKb,WAAW,gCAUb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StyledButton } from "./button.styles";
3
+ const Button = ({ variant = "primary", size = "medium", children, ...props }) => {
4
+ return (_jsx(StyledButton, { variant: variant, size: size, ...props, children: children }));
5
+ };
6
+ export default Button;
7
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C,MAAM,MAAM,GAAG,CAAC,EACd,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,QAAQ,EACf,QAAQ,EACR,GAAG,KAAK,EACI,EAAE,EAAE;IAChB,OAAO,CACL,KAAC,YAAY,IACX,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,KACN,KAAK,YAER,QAAQ,GACI,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const StyledButton: import("@emotion/styled").StyledComponent<{
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
4
+ } & {
5
+ variant: "primary" | "secondary" | "ghost";
6
+ size: "small" | "medium" | "large" | "icon";
7
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
8
+ //# sourceMappingURL=button.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.styles.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;aACd,SAAS,GAAG,WAAW,GAAG,OAAO;UACpC,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM;qHAwH5C,CAAC"}
@@ -0,0 +1,117 @@
1
+ import styled from "@emotion/styled";
2
+ export const StyledButton = styled.button `
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ gap: ${({ theme }) => theme.spacing[2]};
7
+
8
+ border: 1px solid transparent;
9
+ border-radius: ${({ theme }) => theme.radiusSemantic.control};
10
+
11
+ font-family: ${({ theme }) => theme.typography.fontFamily};
12
+ font-weight: ${({ theme }) => theme.semanticTypography.fontWeight.label};
13
+
14
+ line-height: 1;
15
+ white-space: nowrap;
16
+
17
+ cursor: pointer;
18
+ user-select: none;
19
+
20
+ transition:
21
+ background-color ${({ theme }) => theme.motionSemantic.interaction}
22
+ ${({ theme }) => theme.motionSemantic.transition},
23
+ color ${({ theme }) => theme.motionSemantic.interaction}
24
+ ${({ theme }) => theme.motionSemantic.transition},
25
+ border-color ${({ theme }) => theme.motionSemantic.interaction}
26
+ ${({ theme }) => theme.motionSemantic.transition},
27
+ box-shadow ${({ theme }) => theme.motionSemantic.interaction}
28
+ ${({ theme }) => theme.motionSemantic.transition};
29
+
30
+ ${({ theme, size }) => {
31
+ switch (size) {
32
+ case "small":
33
+ return `
34
+ min-height: 32px;
35
+ padding: 0 ${theme.spacing[3]};
36
+ font-size: ${theme.semanticTypography.fontSize.bodySm};
37
+ `;
38
+ case "large":
39
+ return `
40
+ min-height: 44px;
41
+ padding: 0 ${theme.spacing[5]};
42
+ font-size: ${theme.semanticTypography.fontSize.bodyLg};
43
+ `;
44
+ case "icon":
45
+ return `
46
+ min-width: 36px;
47
+ min-height: 36px;
48
+ padding: ${theme.spacing[2]};
49
+ aspect-ratio: 1 / 1;
50
+ `;
51
+ case "medium":
52
+ default:
53
+ return `
54
+ min-height: 36px;
55
+ padding: 0 ${theme.spacing[4]};
56
+ font-size: ${theme.semanticTypography.fontSize.body};
57
+ `;
58
+ }
59
+ }}
60
+
61
+ ${({ theme, variant }) => {
62
+ switch (variant) {
63
+ case "primary":
64
+ return `
65
+ background: ${theme.action.primary};
66
+ color: ${theme.text.inverse};
67
+ border-color: ${theme.action.primary};
68
+
69
+ &:hover:not(:disabled) {
70
+ background: ${theme.action.primaryHover};
71
+ border-color: ${theme.action.primaryHover};
72
+ }
73
+ `;
74
+ case "secondary":
75
+ return `
76
+ background: ${theme.surface.secondary};
77
+ color: ${theme.text.primary};
78
+ border-color: ${theme.border.default};
79
+
80
+ &:hover:not(:disabled) {
81
+ background: ${theme.surface.tertiary};
82
+ border-color: ${theme.border.strong};
83
+ }
84
+ `;
85
+ case "ghost":
86
+ return `
87
+ background: transparent;
88
+ color: ${theme.text.secondary};
89
+ border-color: transparent;
90
+
91
+ &:hover:not(:disabled) {
92
+ background: ${theme.surface.tertiary};
93
+ color: ${theme.text.primary};
94
+ }
95
+
96
+ &:active:not(:disabled) {
97
+ background: ${theme.surface.tertiary};
98
+ }
99
+ `;
100
+ }
101
+ }}
102
+
103
+ &:focus-visible {
104
+ outline: 2px solid ${({ theme }) => theme.border.focus};
105
+ outline-offset: 2px;
106
+ }
107
+
108
+ &:disabled {
109
+ cursor: not-allowed;
110
+ opacity: 0.5;
111
+ }
112
+
113
+ &[aria-busy="true"] {
114
+ cursor: wait;
115
+ }
116
+ `;
117
+ //# sourceMappingURL=button.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.styles.js","sourceRoot":"","sources":["../../../src/components/button/button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAGvC;;;;SAIO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;;;mBAGrB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,OAA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K,CAAC,OAAO,CAAC,CAAC,CAAC;;WAE5B,CAAC;QAEN,KAAK,QAAQ,CAAC;QACd;YACE,OAAO;;uBAEQ,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;uBAChB,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI;SACpD,CAAC;IACN,CAAC;AACH,CAAC;;IAEC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;IACvB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO;wBACS,KAAK,CAAC,MAAM,CAAC,OAAO;mBACzB,KAAK,CAAC,IAAI,CAAC,OAAO;0BACX,KAAK,CAAC,MAAM,CAAC,OAAO;;;0BAGpB,KAAK,CAAC,MAAM,CAAC,YAAY;4BACvB,KAAK,CAAC,MAAM,CAAC,YAAY;;SAE5C,CAAC;QAEJ,KAAK,WAAW;YACd,OAAO;wBACS,KAAK,CAAC,OAAO,CAAC,SAAS;mBAC5B,KAAK,CAAC,IAAI,CAAC,OAAO;0BACX,KAAK,CAAC,MAAM,CAAC,OAAO;;;0BAGpB,KAAK,CAAC,OAAO,CAAC,QAAQ;4BACpB,KAAK,CAAC,MAAM,CAAC,MAAM;;SAEtC,CAAC;QAEJ,KAAK,OAAO;YACV,OAAO;;mBAEI,KAAK,CAAC,IAAI,CAAC,SAAS;;;;0BAIb,KAAK,CAAC,OAAO,CAAC,QAAQ;qBAC3B,KAAK,CAAC,IAAI,CAAC,OAAO;;;;0BAIb,KAAK,CAAC,OAAO,CAAC,QAAQ;;SAEvC,CAAC;IACN,CAAC;AACH,CAAC;;;yBAGsB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;;;;;;;;;;;CAYzD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { InputHTMLAttributes } from "react";
2
- import "./input.style.css";
3
2
  export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
4
3
  inputSize?: "small" | "medium" | "large";
5
4
  }
6
- declare const Input: ({ inputSize, className, ...props }: InputProps) => import("react").JSX.Element;
5
+ declare const Input: ({ inputSize, ...props }: InputProps) => import("react").JSX.Element;
7
6
  export default Input;
7
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIjD,MAAM,WAAW,UACf,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC7C,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC1C;AAED,QAAA,MAAM,KAAK,GAAI,yBAGZ,UAAU,gCAOZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StyledInput } from "./input.styles";
3
+ const Input = ({ inputSize = "medium", ...props }) => {
4
+ return (_jsx(StyledInput, { inputSize: inputSize, ...props }));
5
+ };
6
+ export default Input;
7
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C,MAAM,KAAK,GAAG,CAAC,EACb,SAAS,GAAG,QAAQ,EACpB,GAAG,KAAK,EACG,EAAE,EAAE;IACf,OAAO,CACL,KAAC,WAAW,IACV,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,9 @@
1
+ interface StyledInputProps {
2
+ inputSize: "small" | "medium" | "large";
3
+ }
4
+ export declare const StyledInput: import("@emotion/styled").StyledComponent<{
5
+ theme?: import("@emotion/react").Theme;
6
+ as?: React.ElementType;
7
+ } & StyledInputProps, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
8
+ export {};
9
+ //# sourceMappingURL=input.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.styles.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.styles.ts"],"names":[],"mappings":"AAEA,UAAU,gBAAgB;IACxB,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,WAAW;;;qIAmFvB,CAAC"}
@@ -0,0 +1,83 @@
1
+ import styled from "@emotion/styled";
2
+ export const StyledInput = styled.input `
3
+ display: block;
4
+ width: 100%;
5
+
6
+ border: 1px solid ${({ theme }) => theme.border.default};
7
+ border-radius: ${({ theme }) => theme.radius.md};
8
+
9
+ background: ${({ theme }) => theme.surface.primary};
10
+ color: ${({ theme }) => theme.text.primary};
11
+
12
+ font-family:
13
+ Inter,
14
+ system-ui,
15
+ -apple-system,
16
+ BlinkMacSystemFont,
17
+ "Segoe UI",
18
+ Roboto,
19
+ Helvetica,
20
+ Arial,
21
+ sans-serif;
22
+ font-weight: ${({ theme }) => theme.typography.fontWeight.regular};
23
+ line-height: 1;
24
+
25
+ outline: none;
26
+
27
+ transition:
28
+ background-color ${({ theme }) => theme.motion.duration.normal}
29
+ ${({ theme }) => theme.motion.ease.standard},
30
+ border-color ${({ theme }) => theme.motion.duration.normal}
31
+ ${({ theme }) => theme.motion.ease.standard},
32
+ box-shadow ${({ theme }) => theme.motion.duration.normal}
33
+ ${({ theme }) => theme.motion.ease.standard},
34
+ color ${({ theme }) => theme.motion.duration.normal}
35
+ ${({ theme }) => theme.motion.ease.standard};
36
+
37
+ &::placeholder {
38
+ color: ${({ theme }) => theme.text.tertiary};
39
+ }
40
+
41
+ &:hover:not(:disabled) {
42
+ border-color: ${({ theme }) => theme.border.strong};
43
+ }
44
+
45
+ &:focus {
46
+ border-color: ${({ theme }) => theme.border.focus};
47
+
48
+ box-shadow: 0 0 0 3px
49
+ color-mix(
50
+ in srgb,
51
+ ${({ theme }) => theme.border.focus} 18%,
52
+ transparent
53
+ );
54
+ }
55
+
56
+ &:disabled {
57
+ cursor: not-allowed;
58
+ opacity: 0.5;
59
+ background: ${({ theme }) => theme.surface.secondary};
60
+ }
61
+
62
+ ${({ theme, inputSize }) => inputSize === "small" &&
63
+ `
64
+ min-height: 32px;
65
+ padding: 0 ${theme.spacing[3]};
66
+ font-size: ${theme.typography.fontSize.sm};
67
+ `}
68
+
69
+ ${({ theme, inputSize }) => inputSize === "medium" &&
70
+ `
71
+ min-height: 40px;
72
+ padding: 0 ${theme.spacing[4]};
73
+ font-size: ${theme.typography.fontSize.md};
74
+ `}
75
+
76
+ ${({ theme, inputSize }) => inputSize === "large" &&
77
+ `
78
+ min-height: 48px;
79
+ padding: 0 ${theme.spacing[4]};
80
+ font-size: ${theme.typography.fontSize.lg};
81
+ `}
82
+ `;
83
+ //# sourceMappingURL=input.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.styles.js","sourceRoot":"","sources":["../../../src/components/input/input.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAkB;;;;sBAInC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;mBACtC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;;gBAEjC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO;WACzC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;;;;;;;;iBAY3B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC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AE,CACzB,SAAS,KAAK,OAAO;IACrB;;mBAEe,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;mBAChB,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;KAC1C;;IAED,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CACzB,SAAS,KAAK,QAAQ;IACtB;;mBAEe,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;mBAChB,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;KAC1C;;IAED,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CACzB,SAAS,KAAK,OAAO;IACrB;;mBAEe,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;mBAChB,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;KAC1C;CACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from "react";
2
+ export interface SegmentedControlOption<T extends string> {
3
+ value: T;
4
+ label: ReactNode;
5
+ disabled?: boolean;
6
+ }
7
+ export interface SegmentedControlProps<T extends string> {
8
+ options: SegmentedControlOption<T>[];
9
+ value: T;
10
+ onChange: (value: T) => void;
11
+ size?: "small" | "medium" | "large";
12
+ disabled?: boolean;
13
+ }
14
+ declare const SegmentedControl: <T extends string>({ options, value, onChange, size, disabled, }: SegmentedControlProps<T>) => import("react").JSX.Element;
15
+ export default SegmentedControl;
16
+ //# sourceMappingURL=segmented-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/segmented-control.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAOtD,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,MAAM;IACtD,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM;IACrD,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,EAAE,+CAMzC,qBAAqB,CAAC,CAAC,CAAC,gCA2F1B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { StyledSegment, StyledSegmentedControl, } from "./segmented-control.styles";
4
+ const SegmentedControl = ({ options, value, onChange, size = "medium", disabled = false, }) => {
5
+ const refs = useRef([]);
6
+ const enabledOptions = options.filter((option) => !option.disabled);
7
+ const handleKeyDown = (event, currentIndex) => {
8
+ if (disabled || currentIndex === -1) {
9
+ return;
10
+ }
11
+ let nextIndex;
12
+ switch (event.key) {
13
+ case "ArrowRight":
14
+ case "ArrowDown":
15
+ nextIndex = (currentIndex + 1) % enabledOptions.length;
16
+ break;
17
+ case "ArrowLeft":
18
+ case "ArrowUp":
19
+ nextIndex =
20
+ (currentIndex - 1 + enabledOptions.length) %
21
+ enabledOptions.length;
22
+ break;
23
+ case "Home":
24
+ nextIndex = 0;
25
+ break;
26
+ case "End":
27
+ nextIndex = enabledOptions.length - 1;
28
+ break;
29
+ default:
30
+ return;
31
+ }
32
+ event.preventDefault();
33
+ const nextOption = enabledOptions[nextIndex];
34
+ const originalIndex = options.findIndex((option) => option.value === nextOption.value);
35
+ refs.current[originalIndex]?.focus();
36
+ onChange(nextOption.value);
37
+ };
38
+ return (_jsx(StyledSegmentedControl, { role: "radiogroup", "aria-disabled": disabled, children: options.map((option, index) => {
39
+ const checked = option.value === value;
40
+ const optionDisabled = disabled || option.disabled;
41
+ const enabledIndex = enabledOptions.findIndex((item) => item.value === option.value);
42
+ return (_jsx(StyledSegment, { ref: (element) => {
43
+ refs.current[index] = element;
44
+ }, size: size, type: "button", role: "radio", "aria-checked": checked, tabIndex: checked && !optionDisabled ? 0 : -1, disabled: optionDisabled, onClick: () => onChange(option.value), onKeyDown: (event) => {
45
+ handleKeyDown(event, enabledIndex);
46
+ }, children: option.label }, option.value));
47
+ }) }));
48
+ };
49
+ export default SegmentedControl;
50
+ //# sourceMappingURL=segmented-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.js","sourceRoot":"","sources":["../../../src/components/segmented-control/segmented-control.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAgBpC,MAAM,gBAAgB,GAAG,CAAmB,EAC1C,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,QAAQ,GAAG,KAAK,GACS,EAAE,EAAE;IAC7B,MAAM,IAAI,GAAG,MAAM,CAA+B,EAAE,CAAC,CAAC;IAEtD,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CACnC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAC7B,CAAC;IAEF,MAAM,aAAa,GAAG,CACpB,KAAuC,EACvC,YAAoB,EACpB,EAAE;QACF,IAAI,QAAQ,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QAED,IAAI,SAAiB,CAAC;QAEtB,QAAQ,KAAK,CAAC,GAAG,EAAE,CAAC;YAClB,KAAK,YAAY,CAAC;YAClB,KAAK,WAAW;gBACd,SAAS,GAAG,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,C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AC;gBAChC,CAAC,EACD,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,OAAO,kBACE,OAAO,EACrB,QAAQ,EAAE,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC7C,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EACrC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;oBACnB,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;gBACrC,CAAC,YAEA,MAAM,CAAC,KAAK,IAfR,MAAM,CAAC,KAAK,CAgBH,CACjB,CAAC;QACJ,CAAC,CAAC,GACqB,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { StoryObj } from "@storybook/react";
2
+ declare const meta: {
3
+ title: string;
4
+ component: <T extends string>({ options, value, onChange, size, disabled, }: import("./segmented-control").SegmentedControlProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ argTypes: {
9
+ value: {
10
+ control: false;
11
+ };
12
+ onChange: {
13
+ action: string;
14
+ };
15
+ };
16
+ };
17
+ export default meta;
18
+ type Story = StoryObj;
19
+ export declare const Default: Story;
20
+ export declare const Small: Story;
21
+ export declare const Large: Story;
22
+ export declare const WithDisabledOption: Story;
23
+ export declare const Disabled: Story;
24
+ export declare const ThreeOptions: Story;
25
+ //# sourceMappingURL=segmented-control.stories%20.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.stories .d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/segmented-control.stories .tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIvD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;CAc+B,CAAC;AAE1C,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AA4BtB,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAEnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAEnB,CAAC;AAwBF,eAAO,MAAM,kBAAkB,EAAE,KAEhC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAkBtB,CAAC;AA2BF,eAAO,MAAM,YAAY,EAAE,KAE1B,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import SegmentedControl from "./segmented-control";
4
+ const meta = {
5
+ title: "Components/SegmentedControl",
6
+ component: SegmentedControl,
7
+ parameters: {
8
+ layout: "centered",
9
+ },
10
+ argTypes: {
11
+ value: {
12
+ control: false,
13
+ },
14
+ onChange: {
15
+ action: "changed",
16
+ },
17
+ },
18
+ };
19
+ export default meta;
20
+ function CustomerExecutorControl({ size, }) {
21
+ const [value, setValue] = useState("customer");
22
+ return (_jsx(SegmentedControl, { size: size, options: [
23
+ {
24
+ value: "customer",
25
+ label: "Заказчик",
26
+ },
27
+ {
28
+ value: "executor",
29
+ label: "Исполнитель",
30
+ },
31
+ ], value: value, onChange: setValue }));
32
+ }
33
+ export const Default = {
34
+ render: () => _jsx(CustomerExecutorControl, {}),
35
+ };
36
+ export const Small = {
37
+ render: () => _jsx(CustomerExecutorControl, { size: "small" }),
38
+ };
39
+ export const Large = {
40
+ render: () => _jsx(CustomerExecutorControl, { size: "large" }),
41
+ };
42
+ function DisabledOptionControl() {
43
+ const [value, setValue] = useState("customer");
44
+ return (_jsx(SegmentedControl, { options: [
45
+ {
46
+ value: "customer",
47
+ label: "Заказчик",
48
+ },
49
+ {
50
+ value: "executor",
51
+ label: "Исполнитель",
52
+ disabled: true,
53
+ },
54
+ ], value: value, onChange: setValue }));
55
+ }
56
+ export const WithDisabledOption = {
57
+ render: () => _jsx(DisabledOptionControl, {}),
58
+ };
59
+ export const Disabled = {
60
+ render: () => (_jsx(SegmentedControl, { options: [
61
+ {
62
+ value: "customer",
63
+ label: "Заказчик",
64
+ },
65
+ {
66
+ value: "executor",
67
+ label: "Исполнитель",
68
+ },
69
+ ], value: "customer", onChange: () => { }, disabled: true })),
70
+ };
71
+ function ThreeOptionsControl() {
72
+ const [value, setValue] = useState("all");
73
+ return (_jsx(SegmentedControl, { options: [
74
+ {
75
+ value: "all",
76
+ label: "Все",
77
+ },
78
+ {
79
+ value: "active",
80
+ label: "Активные",
81
+ },
82
+ {
83
+ value: "completed",
84
+ label: "Завершённые",
85
+ },
86
+ ], value: value, onChange: setValue }));
87
+ }
88
+ export const ThreeOptions = {
89
+ render: () => _jsx(ThreeOptionsControl, {}),
90
+ };
91
+ //# sourceMappingURL=segmented-control.stories%20.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.stories .js","sourceRoot":"","sources":["../../../src/components/segmented-control/segmented-control.stories .tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAEnD,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,6BAA6B;IACpC,SAAS,EAAE,gBAAgB;IAC3B,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,SAAS;SAClB;KACF;CACsC,CAAC;AAE1C,eAAe,IAAI,CAAC;AAIpB,SAAS,uBAAuB,CAAC,EAC/B,IAAI,GAGL;IACC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAE/C,OAAO,CACL,KAAC,gBAAgB,IACf,IAAI,EAAE,IAAI,EACV,OAAO,E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YACD;gBACE,KAAK,EAAE,UAAU;gBACjB,KAAK,EAAE,aAAa;aACrB;SACF,EACD,KAAK,EAAC,UAAU,EAChB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAClB,QAAQ,SACR,CACH;CACF,CAAC;AAEF,SAAS,mBAAmB;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,OAAO,CACL,KAAC,gBAAgB,IACf,OAAO,EAAE;YACP;gBACE,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,KAAK;aACb;YACD;gBACE,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,UAAU;aAClB;YACD;gBACE,KAAK,EAAE,WAAW;gBAClB,KAAK,EAAE,aAAa;aACrB;SACF,EACD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,mBAAmB,KAAG;CACtC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const StyledSegmentedControl: import("@emotion/styled").StyledComponent<{
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
4
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
+ export declare const StyledSegment: import("@emotion/styled").StyledComponent<{
6
+ theme?: import("@emotion/react").Theme;
7
+ as?: React.ElementType;
8
+ } & {
9
+ size: "small" | "medium" | "large";
10
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
11
+ //# sourceMappingURL=segmented-control.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.styles.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/segmented-control.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;;;yGAUlC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;UAClB,OAAO,GAAG,QAAQ,GAAG,OAAO;qHA4EnC,CAAC"}
@@ -0,0 +1,83 @@
1
+ import styled from "@emotion/styled";
2
+ export const StyledSegmentedControl = styled.div `
3
+ display: inline-flex;
4
+ align-items: center;
5
+ gap: 2px;
6
+
7
+ padding: ${({ theme }) => theme.spacing[1]};
8
+
9
+ background: ${({ theme }) => theme.surface.secondary};
10
+ border: 1px solid ${({ theme }) => theme.border.default};
11
+ border-radius: ${({ theme }) => theme.radius.full};
12
+ `;
13
+ export const StyledSegment = styled.button `
14
+ display: inline-flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+
18
+ border: 0;
19
+ border-radius: ${({ theme }) => theme.radius.full};
20
+
21
+ background: transparent;
22
+ color: ${({ theme }) => theme.text.secondary};
23
+
24
+ font-family: ${({ theme }) => theme.typography.fontFamily};
25
+ font-weight: ${({ theme }) => theme.semanticTypography.fontWeight.label};
26
+ line-height: 1;
27
+
28
+ cursor: pointer;
29
+ user-select: none;
30
+
31
+ transition:
32
+ background-color ${({ theme }) => theme.motionSemantic.interaction}
33
+ ${({ theme }) => theme.motionSemantic.transition},
34
+ color ${({ theme }) => theme.motionSemantic.interaction}
35
+ ${({ theme }) => theme.motionSemantic.transition},
36
+ box-shadow ${({ theme }) => theme.motionSemantic.interaction}
37
+ ${({ theme }) => theme.motionSemantic.transition};
38
+
39
+ ${({ theme, size }) => {
40
+ switch (size) {
41
+ case "small":
42
+ return `
43
+ min-height: 32px;
44
+ padding: 0 ${theme.spacing[3]};
45
+ font-size: ${theme.semanticTypography.fontSize.bodySm};
46
+ `;
47
+ case "large":
48
+ return `
49
+ min-height: 44px;
50
+ padding: 0 ${theme.spacing[5]};
51
+ font-size: ${theme.semanticTypography.fontSize.bodyLg};
52
+ `;
53
+ case "medium":
54
+ default:
55
+ return `
56
+ min-height: 36px;
57
+ padding: 0 ${theme.spacing[4]};
58
+ font-size: ${theme.semanticTypography.fontSize.body};
59
+ `;
60
+ }
61
+ }}
62
+
63
+ &:hover:not(:disabled) {
64
+ color: ${({ theme }) => theme.text.primary};
65
+ }
66
+
67
+ &:focus-visible {
68
+ outline: 2px solid ${({ theme }) => theme.border.focus};
69
+ outline-offset: 2px;
70
+ }
71
+
72
+ &:disabled {
73
+ cursor: not-allowed;
74
+ opacity: 0.5;
75
+ }
76
+
77
+ &[aria-checked="true"] {
78
+ background: ${({ theme }) => theme.surface.primary};
79
+ color: ${({ theme }) => theme.text.primary};
80
+ box-shadow: ${({ theme }) => theme.elevation.surface};
81
+ }
82
+ `;
83
+ //# sourceMappingURL=segmented-control.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.styles.js","sourceRoot":"","sources":["../../../src/components/segmented-control/segmented-control.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;aAKnC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;;gBAE5B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS;sBAChC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;mBACtC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI;CAClD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAExC;;;;;;mBAMiB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI;;;WAGxC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS;;iBAE7B,CAAC,EAAE,KAAK,EAAE,EAAE,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,CAAC,OAAO;;;;yBAIrB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;;;;;;;;;kBAUxC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO;aACzC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;kBAC5B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO;;CAEvD,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import type { HTMLAttributes, ReactNode } from "react";
2
- import "./typography.style.css";
3
2
  export type TypographyVariant = "heading-1" | "heading-2" | "heading-3" | "body-lg" | "body" | "body-sm" | "label";
4
3
  export interface TypographyProps extends HTMLAttributes<HTMLElement> {
5
4
  variant?: TypographyVariant;
6
5
  children: ReactNode;
7
6
  }
8
- declare const Typography: ({ variant, className, children, ...props }: TypographyProps) => import("react").JSX.Element;
7
+ declare const Typography: ({ variant, children, ...props }: TypographyProps) => import("react").JSX.Element;
9
8
  export default Typography;
9
+ //# sourceMappingURL=typography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../src/components/typography/typography.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAClE,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAeD,QAAA,MAAM,UAAU,GAAI,iCAIjB,eAAe,gCAYjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StyledTypography } from "./typography.styles";
3
+ const variantElements = {
4
+ "heading-1": "h1",
5
+ "heading-2": "h2",
6
+ "heading-3": "h3",
7
+ "body-lg": "p",
8
+ body: "p",
9
+ "body-sm": "p",
10
+ label: "span",
11
+ };
12
+ const Typography = ({ variant = "body", children, ...props }) => {
13
+ const Component = variantElements[variant];
14
+ return (_jsx(StyledTypography, { as: Component, "data-variant": variant, ...props, children: children }));
15
+ };
16
+ export default Typography;
17
+ //# sourceMappingURL=typography.js.map