@atom-learning/components 5.4.1 → 5.4.3

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 (26) hide show
  1. package/dist/components/segmented-control/SegmentedControl.d.ts +2 -370
  2. package/dist/components/segmented-control/SegmentedControl.types.d.ts +1 -0
  3. package/dist/components/segmented-control/SegmentedControlBadge.js +1 -1
  4. package/dist/components/segmented-control/SegmentedControlBadge.js.map +1 -1
  5. package/dist/components/segmented-control/SegmentedControlContext.d.ts +3 -5
  6. package/dist/components/segmented-control/SegmentedControlContext.js +1 -1
  7. package/dist/components/segmented-control/SegmentedControlContext.js.map +1 -1
  8. package/dist/components/segmented-control/SegmentedControlDescription.js +1 -1
  9. package/dist/components/segmented-control/SegmentedControlDescription.js.map +1 -1
  10. package/dist/components/segmented-control/SegmentedControlHeading.js +1 -1
  11. package/dist/components/segmented-control/SegmentedControlHeading.js.map +1 -1
  12. package/dist/components/segmented-control/SegmentedControlIcon.js +1 -1
  13. package/dist/components/segmented-control/SegmentedControlIcon.js.map +1 -1
  14. package/dist/components/segmented-control/SegmentedControlItem.js +1 -1
  15. package/dist/components/segmented-control/SegmentedControlItem.js.map +1 -1
  16. package/dist/components/segmented-control/SegmentedControlItemList.d.ts +1 -2
  17. package/dist/components/segmented-control/SegmentedControlItemList.js +1 -1
  18. package/dist/components/segmented-control/SegmentedControlItemList.js.map +1 -1
  19. package/dist/components/segmented-control/SegmentedControlRoot.d.ts +2 -2
  20. package/dist/components/segmented-control/SegmentedControlRoot.js +1 -1
  21. package/dist/components/segmented-control/SegmentedControlRoot.js.map +1 -1
  22. package/dist/docgen.json +1 -1
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.cjs.js.map +1 -1
  25. package/package.json +2 -2
  26. package/CHANGELOG.md +0 -207
@@ -1,5 +1,5 @@
1
1
  export declare const SegmentedControl: {
2
- Root: ({ size, children, theme, defaultValue, ...props }: import("react").PropsWithChildren<import("./SegmentedControlRoot").SegmentedControlRootProps>) => import("react").JSX.Element;
2
+ Root: ({ size, theme, defaultValue, children, ...props }: import("react").PropsWithChildren<import("./SegmentedControlRoot").SegmentedControlRootProps>) => import("react").JSX.Element;
3
3
  Item: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<import("@radix-ui/react-tabs").TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "css"> & import("@atom-learning/stitches-react/types/styled-component").TransformProps<{}, {
4
4
  sm: string;
5
5
  md: string;
@@ -2582,373 +2582,5 @@ export declare const SegmentedControl: {
2582
2582
  };
2583
2583
  }>>;
2584
2584
  Badge: ({ css, ...props }: Omit<import("react").ComponentProps<typeof import("..").Badge>, "size">) => JSX.Element;
2585
- ItemList: (props: import("react").ComponentProps<{
2586
- ({ children, colorScheme, ...rest }: import("react").ComponentProps<import("@atom-learning/stitches-react/types/styled-component").StyledComponent<import("react").ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsListProps & import("react").RefAttributes<HTMLDivElement>>, {}, {
2587
- sm: string;
2588
- md: string;
2589
- lg: string;
2590
- xl: string;
2591
- reducedMotion: string;
2592
- allowMotion: string;
2593
- hover: string;
2594
- }, import("@atom-learning/stitches-react/types/css-util").CSS<{
2595
- sm: string;
2596
- md: string;
2597
- lg: string;
2598
- xl: string;
2599
- reducedMotion: string;
2600
- allowMotion: string;
2601
- hover: string;
2602
- }, {
2603
- colors: {
2604
- textBold: string;
2605
- textRegular: string;
2606
- textSubtle: string;
2607
- textMinimal: string;
2608
- background: string;
2609
- backgroundAccent: string;
2610
- grey100: string;
2611
- grey200: string;
2612
- grey300: string;
2613
- grey400: string;
2614
- grey500: string;
2615
- grey600: string;
2616
- grey700: string;
2617
- grey800: string;
2618
- grey900: string;
2619
- grey1000: string;
2620
- grey1100: string;
2621
- grey1200: string;
2622
- blue100: string;
2623
- blue200: string;
2624
- blue300: string;
2625
- blue400: string;
2626
- blue500: string;
2627
- blue600: string;
2628
- blue700: string;
2629
- blue800: string;
2630
- blue900: string;
2631
- blue1000: string;
2632
- blue1100: string;
2633
- blue1200: string;
2634
- pink100: string;
2635
- pink200: string;
2636
- pink300: string;
2637
- pink400: string;
2638
- pink500: string;
2639
- pink600: string;
2640
- pink700: string;
2641
- pink800: string;
2642
- pink900: string;
2643
- pink1000: string;
2644
- pink1100: string;
2645
- pink1200: string;
2646
- purple100: string;
2647
- purple200: string;
2648
- purple300: string;
2649
- purple400: string;
2650
- purple500: string;
2651
- purple600: string;
2652
- purple700: string;
2653
- purple800: string;
2654
- purple900: string;
2655
- purple1000: string;
2656
- purple1100: string;
2657
- purple1200: string;
2658
- cyan100: string;
2659
- cyan200: string;
2660
- cyan300: string;
2661
- cyan400: string;
2662
- cyan500: string;
2663
- cyan600: string;
2664
- cyan700: string;
2665
- cyan800: string;
2666
- cyan900: string;
2667
- cyan1000: string;
2668
- cyan1100: string;
2669
- cyan1200: string;
2670
- green100: string;
2671
- green200: string;
2672
- green300: string;
2673
- green400: string;
2674
- green500: string;
2675
- green600: string;
2676
- green700: string;
2677
- green800: string;
2678
- green900: string;
2679
- green1000: string;
2680
- green1100: string;
2681
- green1200: string;
2682
- magenta100: string;
2683
- magenta200: string;
2684
- magenta300: string;
2685
- magenta400: string;
2686
- magenta500: string;
2687
- magenta600: string;
2688
- magenta700: string;
2689
- magenta800: string;
2690
- magenta900: string;
2691
- magenta1000: string;
2692
- magenta1100: string;
2693
- magenta1200: string;
2694
- red100: string;
2695
- red200: string;
2696
- red300: string;
2697
- red400: string;
2698
- red500: string;
2699
- red600: string;
2700
- red700: string;
2701
- red800: string;
2702
- red900: string;
2703
- red1000: string;
2704
- red1100: string;
2705
- red1200: string;
2706
- teal100: string;
2707
- teal200: string;
2708
- teal300: string;
2709
- teal400: string;
2710
- teal500: string;
2711
- teal600: string;
2712
- teal700: string;
2713
- teal800: string;
2714
- teal900: string;
2715
- teal1000: string;
2716
- teal1100: string;
2717
- teal1200: string;
2718
- orange100: string;
2719
- orange200: string;
2720
- orange300: string;
2721
- orange400: string;
2722
- orange500: string;
2723
- orange600: string;
2724
- orange700: string;
2725
- orange800: string;
2726
- orange900: string;
2727
- orange1000: string;
2728
- orange1100: string;
2729
- orange1200: string;
2730
- yellow100: string;
2731
- yellow200: string;
2732
- yellow300: string;
2733
- yellow400: string;
2734
- yellow500: string;
2735
- yellow600: string;
2736
- yellow700: string;
2737
- yellow800: string;
2738
- yellow900: string;
2739
- yellow1000: string;
2740
- yellow1100: string;
2741
- yellow1200: string;
2742
- lime100: string;
2743
- lime200: string;
2744
- lime300: string;
2745
- lime400: string;
2746
- lime500: string;
2747
- lime600: string;
2748
- lime700: string;
2749
- lime800: string;
2750
- lime900: string;
2751
- lime1000: string;
2752
- lime1100: string;
2753
- lime1200: string;
2754
- lapis100: string;
2755
- lapis200: string;
2756
- lapis300: string;
2757
- lapis400: string;
2758
- lapis500: string;
2759
- lapis600: string;
2760
- lapis700: string;
2761
- lapis800: string;
2762
- lapis900: string;
2763
- lapis1000: string;
2764
- lapis1100: string;
2765
- lapis1200: string;
2766
- maroon100: string;
2767
- maroon200: string;
2768
- maroon300: string;
2769
- maroon400: string;
2770
- maroon500: string;
2771
- maroon600: string;
2772
- maroon700: string;
2773
- maroon800: string;
2774
- maroon900: string;
2775
- maroon1000: string;
2776
- maroon1100: string;
2777
- maroon1200: string;
2778
- marsh100: string;
2779
- marsh200: string;
2780
- marsh300: string;
2781
- marsh400: string;
2782
- marsh500: string;
2783
- marsh600: string;
2784
- marsh700: string;
2785
- marsh800: string;
2786
- marsh900: string;
2787
- marsh1000: string;
2788
- marsh1100: string;
2789
- marsh1200: string;
2790
- alpha100: string;
2791
- alpha150: string;
2792
- alpha200: string;
2793
- alpha250: string;
2794
- alpha600: string;
2795
- infoLight: string;
2796
- info: string;
2797
- infoMid: string;
2798
- infoDark: string;
2799
- successLight: string;
2800
- success: string;
2801
- successMid: string;
2802
- successDark: string;
2803
- dangerLight: string;
2804
- danger: string;
2805
- dangerMid: string;
2806
- dangerDark: string;
2807
- warningLight: string;
2808
- warning: string;
2809
- warningMid: string;
2810
- warningDark: string;
2811
- warningText: string;
2812
- subjectEnglish: string;
2813
- subjectMaths: string;
2814
- subjectScience: string;
2815
- subjectVerbalReasoning: string;
2816
- subjectNonVerbalReasoning: string;
2817
- subjectCreativeWriting: string;
2818
- subjectExamSkills: string;
2819
- glBlueLight: string;
2820
- glBluePrimary: string;
2821
- glBlueDark: string;
2822
- primary100: string;
2823
- primary200: string;
2824
- primary300: string;
2825
- primary400: string;
2826
- primary500: string;
2827
- primary600: string;
2828
- primary700: string;
2829
- primary800: string;
2830
- primary900: string;
2831
- primary1000: string;
2832
- primary1100: string;
2833
- primary1200: string;
2834
- };
2835
- space: {
2836
- "0": string;
2837
- "1": string;
2838
- "2": string;
2839
- "3": string;
2840
- "4": string;
2841
- "5": string;
2842
- "6": string;
2843
- "7": string;
2844
- "8": string;
2845
- "9": string;
2846
- "24": string;
2847
- };
2848
- fontSizes: {
2849
- xs: string;
2850
- sm: string;
2851
- md: string;
2852
- lg: string;
2853
- xl: string;
2854
- "2xl": string;
2855
- "3xl": string;
2856
- "4xl": string;
2857
- };
2858
- fonts: {
2859
- sans: string;
2860
- mono: string;
2861
- display: string;
2862
- body: string;
2863
- };
2864
- sizes: {
2865
- "0": string;
2866
- "1": string;
2867
- "2": string;
2868
- "3": string;
2869
- "4": string;
2870
- "5": string;
2871
- "6": string;
2872
- "7": string;
2873
- "8": string;
2874
- };
2875
- radii: {
2876
- "0": string;
2877
- "1": string;
2878
- "2": string;
2879
- "3": string;
2880
- round: string;
2881
- };
2882
- shadows: {
2883
- "0": string;
2884
- "1": string;
2885
- "2": string;
2886
- "3": string;
2887
- };
2888
- ratios: {
2889
- "16-9": string;
2890
- "3-2": string;
2891
- "4-3": string;
2892
- "1-1": string;
2893
- "3-4": string;
2894
- };
2895
- }, import("@atom-learning/stitches-react/types/config").DefaultThemeMap, {
2896
- bg: (value: import("@atom-learning/stitches-react").PropertyValue<"background">) => {
2897
- background: import("@atom-learning/stitches-react/types/css-util").WithPropertyValue<"background">;
2898
- };
2899
- size: (value: import("@atom-learning/stitches-react").ScaleValue<"size"> | number | string) => {
2900
- height: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"size">;
2901
- width: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"size">;
2902
- };
2903
- p: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2904
- padding: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2905
- };
2906
- pt: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2907
- paddingTop: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2908
- };
2909
- pr: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2910
- paddingRight: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2911
- };
2912
- pb: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2913
- paddingBottom: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2914
- };
2915
- pl: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2916
- paddingLeft: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2917
- };
2918
- px: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2919
- paddingLeft: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2920
- paddingRight: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2921
- };
2922
- py: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2923
- paddingTop: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2924
- paddingBottom: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2925
- };
2926
- m: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2927
- margin: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2928
- };
2929
- mt: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2930
- marginTop: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2931
- };
2932
- mr: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2933
- marginRight: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2934
- };
2935
- mb: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2936
- marginBottom: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2937
- };
2938
- ml: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2939
- marginLeft: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2940
- };
2941
- mx: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2942
- marginLeft: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2943
- marginRight: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2944
- };
2945
- my: (value: import("@atom-learning/stitches-react").ScaleValue<"space"> | number | string) => {
2946
- marginTop: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2947
- marginBottom: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
2948
- };
2949
- }>>> & {
2950
- colorScheme?: import("../..").TcolorScheme;
2951
- }): import("react").JSX.Element;
2952
- displayName: string;
2953
- }>) => JSX.Element;
2585
+ ItemList: import("react").FC<{}>;
2954
2586
  };
@@ -0,0 +1 @@
1
+ export type SegmentedControlTheme = 'primary' | 'marsh';
@@ -1,2 +1,2 @@
1
- import*as r from"react";import{Badge as s}from"../badge/Badge.js";import{useSegmentedControl as m}from"./SegmentedControlContext.js";const n={sm:"xs",md:"xs",lg:"sm"},c=({css:e,...o})=>{const{size:t}=m();return r.createElement(s,{...o,css:{border:"none",...e,fontWeight:"normal"},size:n[t]})};export{c as SegmentedControlBadge};
1
+ import*as e from"react";import{Badge as r}from"../badge/Badge.js";import{SegmentedControlContext as s}from"./SegmentedControlContext.js";const m={sm:"xs",md:"xs",lg:"sm"},c=({css:o,...t})=>{const{size:n}=e.useContext(s);return e.createElement(r,{...t,css:{border:"none",...o,fontWeight:"normal"},size:m[n]})};export{c as SegmentedControlBadge};
2
2
  //# sourceMappingURL=SegmentedControlBadge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlBadge.js","sources":["../../../src/components/segmented-control/SegmentedControlBadge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Badge } from '../badge'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst badgeSizeMap = {\n sm: 'xs',\n md: 'xs',\n lg: 'sm'\n}\n\nexport const SegmentedControlBadge = ({\n css,\n ...props\n}: Omit<React.ComponentProps<typeof Badge>, 'size'>): JSX.Element => {\n const { size } = useSegmentedControl()\n return (\n <Badge\n {...props}\n css={{ border: 'none', ...css, fontWeight: 'normal' }}\n size={badgeSizeMap[size as string]}\n />\n )\n}\n"],"names":["badgeSizeMap","SegmentedControlBadge","css","props","size","useSegmentedControl","React","Badge"],"mappings":"qIAKA,MAAMA,EAAe,CACnB,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAEaC,EAAwB,CAAC,CACpC,IAAAC,KACGC,CACL,IAAqE,CACnE,KAAM,CAAE,KAAAC,CAAK,EAAIC,EAAoB,EACrC,OACEC,EAAA,cAACC,EAAA,CACE,GAAGJ,EACJ,IAAK,CAAE,OAAQ,OAAQ,GAAGD,EAAK,WAAY,QAAS,EACpD,KAAMF,EAAaI,EAAAA,CACrB,CAEJ"}
1
+ {"version":3,"file":"SegmentedControlBadge.js","sources":["../../../src/components/segmented-control/SegmentedControlBadge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Badge } from '../badge'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nconst badgeSizeMap = {\n sm: 'xs',\n md: 'xs',\n lg: 'sm'\n}\n\nexport const SegmentedControlBadge = ({\n css,\n ...props\n}: Omit<React.ComponentProps<typeof Badge>, 'size'>): JSX.Element => {\n const { size } = React.useContext(SegmentedControlContext)\n\n return (\n <Badge\n {...props}\n css={{ border: 'none', ...css, fontWeight: 'normal' }}\n size={badgeSizeMap[size as string]}\n />\n )\n}\n"],"names":["badgeSizeMap","SegmentedControlBadge","css","props","size","React","SegmentedControlContext","Badge"],"mappings":"yIAKA,MAAMA,EAAe,CACnB,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAEaC,EAAwB,CAAC,CACpC,IAAAC,KACGC,CACL,IAAqE,CACnE,KAAM,CAAE,KAAAC,CAAK,EAAIC,EAAM,WAAWC,CAAuB,EAEzD,OACED,EAAA,cAACE,EAAA,CACE,GAAGJ,EACJ,IAAK,CAAE,OAAQ,OAAQ,GAAGD,EAAK,WAAY,QAAS,EACpD,KAAMF,EAAaI,EAAAA,CACrB,CAEJ"}
@@ -1,11 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { Tabs } from '../tabs';
3
+ import type { SegmentedControlTheme } from './SegmentedControl.types';
2
4
  import type { SegmentedControlRootProps } from './SegmentedControlRoot';
3
- export type SegmentedControlTheme = 'primary' | 'marsh';
4
- export interface SegmentedControlContextValue {
5
+ export interface SegmentedControlContextValue extends Pick<React.ComponentProps<typeof Tabs>, 'defaultValue' | 'value' | 'onValueChange'> {
5
6
  size: SegmentedControlRootProps['size'];
6
7
  theme: SegmentedControlTheme;
7
- defaultValue: string;
8
8
  }
9
9
  export declare const SegmentedControlContext: React.Context<SegmentedControlContextValue>;
10
- export declare const SegmentedControlProvider: ({ size, theme, defaultValue, children }: React.PropsWithChildren<SegmentedControlContextValue>) => JSX.Element;
11
- export declare const useSegmentedControl: () => SegmentedControlContextValue;
@@ -1,2 +1,2 @@
1
- import*as e from"react";const t=e.createContext({size:"md",theme:"primary",defaultValue:""}),a=({size:r,theme:o,defaultValue:m,children:n})=>{const l=e.useMemo(()=>({size:r,theme:o,defaultValue:m}),[r,o,m]);return e.createElement(t.Provider,{value:l},n)},u=()=>e.useContext(t);export{t as SegmentedControlContext,a as SegmentedControlProvider,u as useSegmentedControl};
1
+ import*as e from"react";const t=e.createContext({size:"md",theme:"primary",defaultValue:"",value:"",onValueChange:()=>null});export{t as SegmentedControlContext};
2
2
  //# sourceMappingURL=SegmentedControlContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlContext.js","sources":["../../../src/components/segmented-control/SegmentedControlContext.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { SegmentedControlRootProps } from './SegmentedControlRoot'\n\nexport type SegmentedControlTheme = 'primary' | 'marsh'\n\nexport interface SegmentedControlContextValue {\n size: SegmentedControlRootProps['size']\n theme: SegmentedControlTheme\n defaultValue: string\n}\n\nexport const SegmentedControlContext =\n React.createContext<SegmentedControlContextValue>({\n size: 'md',\n theme: 'primary',\n defaultValue: ''\n })\n\nexport const SegmentedControlProvider = ({\n size,\n theme,\n defaultValue,\n children\n}: React.PropsWithChildren<SegmentedControlContextValue>): JSX.Element => {\n const value = React.useMemo<SegmentedControlContextValue>(\n () => ({ size, theme, defaultValue }),\n [size, theme, defaultValue]\n )\n\n return (\n <SegmentedControlContext.Provider value={value}>\n {children}\n </SegmentedControlContext.Provider>\n )\n}\n\nexport const useSegmentedControl = (): SegmentedControlContextValue =>\n React.useContext(SegmentedControlContext)\n"],"names":["SegmentedControlContext","React","SegmentedControlProvider","size","theme","defaultValue","children","value","useSegmentedControl"],"mappings":"wBAYa,MAAAA,EACXC,EAAM,cAA4C,CAChD,KAAM,KACN,MAAO,UACP,aAAc,EAChB,CAAC,EAEUC,EAA2B,CAAC,CACvC,KAAAC,EACA,MAAAC,EACA,aAAAC,EACA,SAAAC,CACF,IAA0E,CACxE,MAAMC,EAAQN,EAAM,QAClB,KAAO,CAAE,KAAAE,EAAM,MAAAC,EAAO,aAAAC,CAAa,GACnC,CAACF,EAAMC,EAAOC,CAAY,CAC5B,EAEA,OACEJ,EAAA,cAACD,EAAwB,SAAxB,CAAiC,MAAOO,CAAAA,EACtCD,CACH,CAEJ,EAEaE,EAAsB,IACjCP,EAAM,WAAWD,CAAuB"}
1
+ {"version":3,"file":"SegmentedControlContext.js","sources":["../../../src/components/segmented-control/SegmentedControlContext.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Tabs } from '../tabs'\nimport type { SegmentedControlTheme } from './SegmentedControl.types'\nimport type { SegmentedControlRootProps } from './SegmentedControlRoot'\n\nexport interface SegmentedControlContextValue\n extends Pick<\n React.ComponentProps<typeof Tabs>,\n 'defaultValue' | 'value' | 'onValueChange'\n > {\n size: SegmentedControlRootProps['size']\n theme: SegmentedControlTheme\n}\n\nexport const SegmentedControlContext =\n React.createContext<SegmentedControlContextValue>({\n size: 'md',\n theme: 'primary',\n defaultValue: '',\n value: '',\n onValueChange: () => null\n })\n"],"names":["SegmentedControlContext","React"],"mappings":"wBAeO,MAAMA,EACXC,EAAM,cAA4C,CAChD,KAAM,KACN,MAAO,UACP,aAAc,GACd,MAAO,GACP,cAAe,IAAM,IACvB,CAAC"}
@@ -1,2 +1,2 @@
1
- import*as o from"react";import{styled as r}from"../../stitches.js";import{Text as m}from"../text/Text.js";import{useSegmentedControl as n}from"./SegmentedControlContext.js";const i=r(m,{fontFamily:"$body",color:"$textSubtle",fontWeight:400,variants:{size:{sm:{fontSize:"$xs"},md:{fontSize:"$sm"},lg:{fontSize:"$md"}}}}),s=t=>{const{size:e}=n();return o.createElement(i,{...t,size:e})};export{s as SegmentedControlDescription};
1
+ import*as t from"react";import{styled as n}from"../../stitches.js";import{Text as r}from"../text/Text.js";import{SegmentedControlContext as m}from"./SegmentedControlContext.js";const i=n(r,{fontFamily:"$body",color:"$textSubtle",fontWeight:400,variants:{size:{sm:{fontSize:"$xs"},md:{fontSize:"$sm"},lg:{fontSize:"$md"}}}}),s=e=>{const{size:o}=t.useContext(m);return t.createElement(i,{...e,size:o})};export{s as SegmentedControlDescription};
2
2
  //# sourceMappingURL=SegmentedControlDescription.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlDescription.js","sources":["../../../src/components/segmented-control/SegmentedControlDescription.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Text } from '../text'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst StyledText = styled(Text, {\n fontFamily: '$body',\n color: '$textSubtle',\n fontWeight: 400,\n variants: {\n size: {\n sm: {\n fontSize: '$xs'\n },\n md: {\n fontSize: '$sm'\n },\n lg: {\n fontSize: '$md'\n }\n }\n }\n})\n\nexport const SegmentedControlDescription = (\n props: Omit<React.ComponentProps<typeof StyledText>, 'size'>\n): JSX.Element => {\n const { size } = useSegmentedControl()\n return <StyledText {...props} size={size} />\n}\n"],"names":["StyledText","styled","Text","SegmentedControlDescription","props","size","useSegmentedControl","React"],"mappings":"6KAMA,MAAMA,EAAaC,EAAOC,EAAM,CAC9B,WAAY,QACZ,MAAO,cACP,WAAY,IACZ,SAAU,CACR,KAAM,CACJ,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,CACF,CACF,CACF,CAAC,EAEYC,EACXC,GACgB,CAChB,KAAM,CAAE,KAAAC,CAAK,EAAIC,IACjB,OAAOC,EAAA,cAACP,EAAA,CAAY,GAAGI,EAAO,KAAMC,EAAM,CAC5C"}
1
+ {"version":3,"file":"SegmentedControlDescription.js","sources":["../../../src/components/segmented-control/SegmentedControlDescription.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Text } from '../text'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nconst StyledText = styled(Text, {\n fontFamily: '$body',\n color: '$textSubtle',\n fontWeight: 400,\n variants: {\n size: {\n sm: {\n fontSize: '$xs'\n },\n md: {\n fontSize: '$sm'\n },\n lg: {\n fontSize: '$md'\n }\n }\n }\n})\n\nexport const SegmentedControlDescription = (\n props: Omit<React.ComponentProps<typeof StyledText>, 'size'>\n): JSX.Element => {\n const { size } = React.useContext(SegmentedControlContext)\n\n return <StyledText {...props} size={size} />\n}\n"],"names":["StyledText","styled","Text","SegmentedControlDescription","props","size","React","SegmentedControlContext"],"mappings":"iLAMA,MAAMA,EAAaC,EAAOC,EAAM,CAC9B,WAAY,QACZ,MAAO,cACP,WAAY,IACZ,SAAU,CACR,KAAM,CACJ,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,CACF,CACF,CACF,CAAC,EAEYC,EACXC,GACgB,CAChB,KAAM,CAAE,KAAAC,CAAK,EAAIC,EAAM,WAAWC,CAAuB,EAEzD,OAAOD,EAAA,cAACN,EAAA,CAAY,GAAGI,EAAO,KAAMC,EAAM,CAC5C"}
@@ -1,2 +1,2 @@
1
- import*as o from"react";import{styled as r}from"../../stitches.js";import{Text as m}from"../text/Text.js";import{useSegmentedControl as n}from"./SegmentedControlContext.js";const i=r(m,{fontFamily:"$body",color:"$textRegular",variants:{size:{sm:{fontSize:"$sm"},md:{fontSize:"$md"},lg:{fontSize:"$lg"}}}}),s=e=>{const{size:t}=n();return o.createElement(i,{...e,size:t})};export{s as SegmentedControlHeading};
1
+ import*as t from"react";import{styled as r}from"../../stitches.js";import{Text as n}from"../text/Text.js";import{SegmentedControlContext as m}from"./SegmentedControlContext.js";const i=r(n,{fontFamily:"$body",color:"$textRegular",variants:{size:{sm:{fontSize:"$sm"},md:{fontSize:"$md"},lg:{fontSize:"$lg"}}}}),s=e=>{const{size:o}=t.useContext(m);return t.createElement(i,{...e,size:o})};export{s as SegmentedControlHeading};
2
2
  //# sourceMappingURL=SegmentedControlHeading.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlHeading.js","sources":["../../../src/components/segmented-control/SegmentedControlHeading.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Text } from '../text'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst StyledHeading = styled(Text, {\n fontFamily: '$body',\n color: '$textRegular',\n variants: {\n size: {\n sm: {\n fontSize: '$sm'\n },\n md: {\n fontSize: '$md'\n },\n lg: {\n fontSize: '$lg'\n }\n }\n }\n})\n\nexport const SegmentedControlHeading = (\n props: Omit<React.ComponentProps<typeof StyledHeading>, 'size'>\n): JSX.Element => {\n const { size } = useSegmentedControl()\n return <StyledHeading {...props} size={size} />\n}\n"],"names":["StyledHeading","styled","Text","SegmentedControlHeading","props","size","useSegmentedControl","React"],"mappings":"6KAMA,MAAMA,EAAgBC,EAAOC,EAAM,CACjC,WAAY,QACZ,MAAO,eACP,SAAU,CACR,KAAM,CACJ,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,CACF,CACF,CACF,CAAC,EAEYC,EACXC,GACgB,CAChB,KAAM,CAAE,KAAAC,CAAK,EAAIC,IACjB,OAAOC,EAAA,cAACP,EAAA,CAAe,GAAGI,EAAO,KAAMC,EAAM,CAC/C"}
1
+ {"version":3,"file":"SegmentedControlHeading.js","sources":["../../../src/components/segmented-control/SegmentedControlHeading.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Text } from '../text'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nconst StyledHeading = styled(Text, {\n fontFamily: '$body',\n color: '$textRegular',\n variants: {\n size: {\n sm: {\n fontSize: '$sm'\n },\n md: {\n fontSize: '$md'\n },\n lg: {\n fontSize: '$lg'\n }\n }\n }\n})\n\nexport const SegmentedControlHeading = (\n props: Omit<React.ComponentProps<typeof StyledHeading>, 'size'>\n): JSX.Element => {\n const { size } = React.useContext(SegmentedControlContext)\n\n return <StyledHeading {...props} size={size} />\n}\n"],"names":["StyledHeading","styled","Text","SegmentedControlHeading","props","size","React","SegmentedControlContext"],"mappings":"iLAMA,MAAMA,EAAgBC,EAAOC,EAAM,CACjC,WAAY,QACZ,MAAO,eACP,SAAU,CACR,KAAM,CACJ,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,EACA,GAAI,CACF,SAAU,KACZ,CACF,CACF,CACF,CAAC,EAEYC,EACXC,GACgB,CAChB,KAAM,CAAE,KAAAC,CAAK,EAAIC,EAAM,WAAWC,CAAuB,EAEzD,OAAOD,EAAA,cAACN,EAAA,CAAe,GAAGI,EAAO,KAAMC,EAAM,CAC/C"}
@@ -1,2 +1,2 @@
1
- import*as m from"react";import{Icon as t}from"../icon/Icon.js";import{useSegmentedControl as r}from"./SegmentedControlContext.js";const n={sm:"sm",md:"md",lg:"md"},s=e=>{const{size:o}=r();return m.createElement(t,{...e,size:n[o]})};export{s as SegmentedControlIcon};
1
+ import*as e from"react";import{Icon as m}from"../icon/Icon.js";import{SegmentedControlContext as n}from"./SegmentedControlContext.js";const r={sm:"sm",md:"md",lg:"md"},s=o=>{const{size:t}=e.useContext(n);return e.createElement(m,{...o,size:r[t]})};export{s as SegmentedControlIcon};
2
2
  //# sourceMappingURL=SegmentedControlIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlIcon.js","sources":["../../../src/components/segmented-control/SegmentedControlIcon.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Icon } from '../icon'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst sizeMap = {\n sm: 'sm',\n md: 'md',\n lg: 'md'\n}\n\nexport const SegmentedControlIcon = (\n props: Omit<React.ComponentProps<typeof Icon>, 'size'>\n): JSX.Element => {\n const { size } = useSegmentedControl()\n return <Icon {...props} size={sizeMap[size as string]} />\n}\n"],"names":["sizeMap","SegmentedControlIcon","props","size","useSegmentedControl","React","Icon"],"mappings":"kIAKA,MAAMA,EAAU,CACd,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAEaC,EACXC,GACgB,CAChB,KAAM,CAAE,KAAAC,CAAK,EAAIC,EAAoB,EACrC,OAAOC,EAAA,cAACC,EAAA,CAAM,GAAGJ,EAAO,KAAMF,EAAQG,GAAiB,CACzD"}
1
+ {"version":3,"file":"SegmentedControlIcon.js","sources":["../../../src/components/segmented-control/SegmentedControlIcon.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Icon } from '../icon'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nconst sizeMap = {\n sm: 'sm',\n md: 'md',\n lg: 'md'\n}\n\nexport const SegmentedControlIcon = (\n props: Omit<React.ComponentProps<typeof Icon>, 'size'>\n): JSX.Element => {\n const { size } = React.useContext(SegmentedControlContext)\n\n return <Icon {...props} size={sizeMap[size as string]} />\n}\n"],"names":["sizeMap","SegmentedControlIcon","props","size","React","SegmentedControlContext","Icon"],"mappings":"sIAKA,MAAMA,EAAU,CACd,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAEaC,EACXC,GACgB,CAChB,KAAM,CAAE,KAAAC,CAAK,EAAIC,EAAM,WAAWC,CAAuB,EAEzD,OAAOD,EAAA,cAACE,EAAA,CAAM,GAAGJ,EAAO,KAAMF,EAAQG,GAAiB,CACzD"}
@@ -1,2 +1,2 @@
1
- import*as e from"react";import{styled as s}from"../../stitches.js";import{Tabs as d}from"../tabs/Tabs.js";import{useSegmentedControl as l}from"./SegmentedControlContext.js";const m=s(d.Trigger,{position:"relative",bg:"transparent",borderRadius:"$2",p:0,zIndex:2,minWidth:"140px",border:"2px solid transparent",variants:{theme:{primary:{"&[data-state=inactive]:hover":{bg:"$primary300"},"&:focus-visible":{borderColor:"$primary800"}},marsh:{"&[data-state=inactive]:hover":{bg:"$marsh300"},"&:focus-visible":{borderColor:"$marsh800"}}},size:{sm:{flex:"unset",p:"$4 $24",gap:"$3"},md:{flex:1,p:"$24 $4",gap:"$4"},lg:{flex:1,p:"$24 $4",gap:"$4"}}},"& > div":{display:"none"},"& > span":{display:"flex",flexDirection:"column",alignItems:"center"},"&[data-state=active]":{boxShadow:"none",border:"2px solid transparent",fontWeight:600,color:"$textBold","&:focus-visible":{boxShadow:"none",borderColor:"$primary800"}},"&[data-state=inactive]":{fontWeight:400,color:"$grey900"},"&[disabled]":{opacity:.3}}),r=e.forwardRef(({children:t,...o},a)=>{const{size:i,theme:n}=l();return e.createElement(m,{...o,theme:n,size:i,ref:a},t)});r.displayName="SegmentedControlItem";export{r as SegmentedControlItem};
1
+ import*as e from"react";import{styled as s}from"../../stitches.js";import{Tabs as d}from"../tabs/Tabs.js";import{SegmentedControlContext as l}from"./SegmentedControlContext.js";const m=s(d.Trigger,{position:"relative",bg:"transparent",borderRadius:"$2",p:0,zIndex:2,minWidth:"140px",border:"2px solid transparent",variants:{theme:{primary:{"&[data-state=inactive]:hover":{bg:"$primary300"},"&:focus-visible":{borderColor:"$primary800"}},marsh:{"&[data-state=inactive]:hover":{bg:"$marsh300"},"&:focus-visible":{borderColor:"$marsh800"}}},size:{sm:{flex:"unset",p:"$4 $24",gap:"$3"},md:{flex:1,p:"$24 $4",gap:"$4"},lg:{flex:1,p:"$24 $4",gap:"$4"}}},"& > div":{display:"none"},"& > span":{display:"flex",flexDirection:"column",alignItems:"center"},"&[data-state=active]":{boxShadow:"none",border:"2px solid transparent",fontWeight:600,color:"$textBold","&:focus-visible":{boxShadow:"none",borderColor:"$primary800"}},"&[data-state=inactive]":{fontWeight:400,color:"$grey900"},"&[disabled]":{opacity:.3}}),t=e.forwardRef(({children:r,...o},a)=>{const{size:i,theme:n}=e.useContext(l);return e.createElement(m,{...o,theme:n,size:i,ref:a},r)});t.displayName="SegmentedControlItem";export{t as SegmentedControlItem};
2
2
  //# sourceMappingURL=SegmentedControlItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlItem.js","sources":["../../../src/components/segmented-control/SegmentedControlItem.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Tabs } from '../tabs'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst StyledItem = styled(Tabs.Trigger, {\n position: 'relative',\n bg: 'transparent',\n borderRadius: '$2',\n p: 0,\n zIndex: 2,\n minWidth: '140px',\n border: '2px solid transparent',\n variants: {\n theme: {\n primary: {\n '&[data-state=inactive]:hover': {\n bg: '$primary300'\n },\n '&:focus-visible': {\n borderColor: '$primary800'\n }\n },\n marsh: {\n '&[data-state=inactive]:hover': {\n bg: '$marsh300'\n },\n '&:focus-visible': {\n borderColor: '$marsh800'\n }\n }\n },\n size: {\n sm: {\n flex: 'unset',\n p: '$4 $24',\n gap: '$3'\n },\n md: {\n flex: 1,\n p: '$24 $4',\n gap: '$4'\n },\n lg: {\n flex: 1,\n p: '$24 $4',\n gap: '$4'\n }\n }\n },\n '& > div': { display: 'none' },\n '& > span': {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n '&[data-state=active]': {\n boxShadow: 'none',\n border: '2px solid transparent',\n fontWeight: 600,\n color: '$textBold',\n '&:focus-visible': {\n boxShadow: 'none',\n borderColor: '$primary800'\n }\n },\n '&[data-state=inactive]': {\n fontWeight: 400,\n color: '$grey900'\n },\n '&[disabled]': {\n opacity: 0.3\n }\n})\n\nexport const SegmentedControlItem = React.forwardRef<\n HTMLButtonElement,\n Omit<React.ComponentProps<typeof StyledItem>, 'size'>\n>(({ children, ...props }, ref) => {\n const { size, theme } = useSegmentedControl()\n\n return (\n <StyledItem {...props} theme={theme} size={size} ref={ref}>\n {children}\n </StyledItem>\n )\n})\n\nSegmentedControlItem.displayName = 'SegmentedControlItem'\n"],"names":["StyledItem","styled","Tabs","SegmentedControlItem","React","children","props","ref","size","theme","useSegmentedControl"],"mappings":"6KAMA,MAAMA,EAAaC,EAAOC,EAAK,QAAS,CACtC,SAAU,WACV,GAAI,cACJ,aAAc,KACd,EAAG,EACH,OAAQ,EACR,SAAU,QACV,OAAQ,wBACR,SAAU,CACR,MAAO,CACL,QAAS,CACP,+BAAgC,CAC9B,GAAI,aACN,EACA,kBAAmB,CACjB,YAAa,aACf,CACF,EACA,MAAO,CACL,+BAAgC,CAC9B,GAAI,WACN,EACA,kBAAmB,CACjB,YAAa,WACf,CACF,CACF,EACA,KAAM,CACJ,GAAI,CACF,KAAM,QACN,EAAG,SACH,IAAK,IACP,EACA,GAAI,CACF,KAAM,EACN,EAAG,SACH,IAAK,IACP,EACA,GAAI,CACF,KAAM,EACN,EAAG,SACH,IAAK,IACP,CACF,CACF,EACA,UAAW,CAAE,QAAS,MAAO,EAC7B,WAAY,CACV,QAAS,OACT,cAAe,SACf,WAAY,QACd,EACA,uBAAwB,CACtB,UAAW,OACX,OAAQ,wBACR,WAAY,IACZ,MAAO,YACP,kBAAmB,CACjB,UAAW,OACX,YAAa,aACf,CACF,EACA,yBAA0B,CACxB,WAAY,IACZ,MAAO,UACT,EACA,cAAe,CACb,QAAS,EACX,CACF,CAAC,EAEYC,EAAuBC,EAAM,WAGxC,CAAC,CAAE,SAAAC,KAAaC,CAAM,EAAGC,IAAQ,CACjC,KAAM,CAAE,KAAAC,EAAM,MAAAC,CAAM,EAAIC,IAExB,OACEN,EAAA,cAACJ,EAAA,CAAY,GAAGM,EAAO,MAAOG,EAAO,KAAMD,EAAM,IAAKD,CACnDF,EAAAA,CACH,CAEJ,CAAC,EAEDF,EAAqB,YAAc"}
1
+ {"version":3,"file":"SegmentedControlItem.js","sources":["../../../src/components/segmented-control/SegmentedControlItem.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Tabs } from '../tabs'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nconst StyledItem = styled(Tabs.Trigger, {\n position: 'relative',\n bg: 'transparent',\n borderRadius: '$2',\n p: 0,\n zIndex: 2,\n minWidth: '140px',\n border: '2px solid transparent',\n variants: {\n theme: {\n primary: {\n '&[data-state=inactive]:hover': {\n bg: '$primary300'\n },\n '&:focus-visible': {\n borderColor: '$primary800'\n }\n },\n marsh: {\n '&[data-state=inactive]:hover': {\n bg: '$marsh300'\n },\n '&:focus-visible': {\n borderColor: '$marsh800'\n }\n }\n },\n size: {\n sm: {\n flex: 'unset',\n p: '$4 $24',\n gap: '$3'\n },\n md: {\n flex: 1,\n p: '$24 $4',\n gap: '$4'\n },\n lg: {\n flex: 1,\n p: '$24 $4',\n gap: '$4'\n }\n }\n },\n '& > div': { display: 'none' },\n '& > span': {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n '&[data-state=active]': {\n boxShadow: 'none',\n border: '2px solid transparent',\n fontWeight: 600,\n color: '$textBold',\n '&:focus-visible': {\n boxShadow: 'none',\n borderColor: '$primary800'\n }\n },\n '&[data-state=inactive]': {\n fontWeight: 400,\n color: '$grey900'\n },\n '&[disabled]': {\n opacity: 0.3\n }\n})\n\nexport const SegmentedControlItem = React.forwardRef<\n HTMLButtonElement,\n Omit<React.ComponentProps<typeof StyledItem>, 'size'>\n>(({ children, ...props }, ref) => {\n const { size, theme } = React.useContext(SegmentedControlContext)\n\n return (\n <StyledItem {...props} theme={theme} size={size} ref={ref}>\n {children}\n </StyledItem>\n )\n})\n\nSegmentedControlItem.displayName = 'SegmentedControlItem'\n"],"names":["StyledItem","styled","Tabs","SegmentedControlItem","React","children","props","ref","size","theme","SegmentedControlContext"],"mappings":"iLAMA,MAAMA,EAAaC,EAAOC,EAAK,QAAS,CACtC,SAAU,WACV,GAAI,cACJ,aAAc,KACd,EAAG,EACH,OAAQ,EACR,SAAU,QACV,OAAQ,wBACR,SAAU,CACR,MAAO,CACL,QAAS,CACP,+BAAgC,CAC9B,GAAI,aACN,EACA,kBAAmB,CACjB,YAAa,aACf,CACF,EACA,MAAO,CACL,+BAAgC,CAC9B,GAAI,WACN,EACA,kBAAmB,CACjB,YAAa,WACf,CACF,CACF,EACA,KAAM,CACJ,GAAI,CACF,KAAM,QACN,EAAG,SACH,IAAK,IACP,EACA,GAAI,CACF,KAAM,EACN,EAAG,SACH,IAAK,IACP,EACA,GAAI,CACF,KAAM,EACN,EAAG,SACH,IAAK,IACP,CACF,CACF,EACA,UAAW,CAAE,QAAS,MAAO,EAC7B,WAAY,CACV,QAAS,OACT,cAAe,SACf,WAAY,QACd,EACA,uBAAwB,CACtB,UAAW,OACX,OAAQ,wBACR,WAAY,IACZ,MAAO,YACP,kBAAmB,CACjB,UAAW,OACX,YAAa,aACf,CACF,EACA,yBAA0B,CACxB,WAAY,IACZ,MAAO,UACT,EACA,cAAe,CACb,QAAS,EACX,CACF,CAAC,EAEYC,EAAuBC,EAAM,WAGxC,CAAC,CAAE,SAAAC,KAAaC,CAAM,EAAGC,IAAQ,CACjC,KAAM,CAAE,KAAAC,EAAM,MAAAC,CAAM,EAAIL,EAAM,WAAWM,CAAuB,EAEhE,OACEN,EAAA,cAACJ,EAAA,CAAY,GAAGM,EAAO,MAAOG,EAAO,KAAMD,EAAM,IAAKD,CACnDF,EAAAA,CACH,CAEJ,CAAC,EAEDF,EAAqB,YAAc"}
@@ -1,3 +1,2 @@
1
1
  import * as React from 'react';
2
- import { Tabs } from '../tabs';
3
- export declare const SegmentedControlItemList: (props: React.ComponentProps<typeof Tabs.TriggerList>) => JSX.Element;
2
+ export declare const SegmentedControlItemList: React.FC;
@@ -1,2 +1,2 @@
1
- import*as t from"react";import{styled as c}from"../../stitches.js";import{Box as g}from"../box/Box.js";import{Tabs as w}from"../tabs/Tabs.js";import{useSegmentedControl as E}from"./SegmentedControlContext.js";const C=c(w.TriggerList,{position:"relative",p:"$1",borderRadius:"$3",overflow:"hidden",variants:{theme:{primary:{bg:"$primary200"},marsh:{bg:"$marsh200"}}},'& > div[role="tablist"]':{position:"relative"},"& > button":{zIndex:2}}),R=c(g,{content:"",position:"absolute",bg:"white",borderRadius:"$2",variants:{interacted:{true:{transition:"all 0.3s ease"},false:{transition:"none"}}}}),L=s=>{const{theme:u,defaultValue:l}=E(),a=t.useRef([]),d=t.Children.toArray(s.children).findIndex(e=>(e==null?void 0:e.props.value)===l),[i,f]=t.useState(d!==-1?d:0),[m,h]=t.useState({left:0,height:0,width:0}),[p,b]=t.useState(!1),v=e=>{f(e),b(!0)},n=t.useCallback(()=>{const e=a.current[i];if(!e)return;const{width:o,height:r}=e.getBoundingClientRect();h({left:e.offsetLeft,height:r,width:o})},[i]);return t.useEffect(()=>{const e=new ResizeObserver(n),o=a.current;return o.forEach(r=>{r&&e.observe(r)}),()=>{o.forEach(r=>{r&&e.unobserve(r)}),e.disconnect()}},[i,n]),t.useEffect(()=>(window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}),[n]),t.useEffect(()=>{n()},[i,n]),t.createElement(C,{theme:u,defaultValue:l,...s},t.createElement(R,{css:{...m},interacted:p}),t.Children.map(s.children,(e,o)=>t.cloneElement(e,{onClick:()=>v(o),ref:r=>a.current[o]=r})))};export{L as SegmentedControlItemList};
1
+ import*as t from"react";import{styled as l}from"../../stitches.js";import{Box as b}from"../box/Box.js";import{Tabs as g}from"../tabs/Tabs.js";import{SegmentedControlContext as E}from"./SegmentedControlContext.js";const w=l(g.TriggerList,{position:"relative",p:"$1",borderRadius:"$3",overflow:"hidden",variants:{theme:{primary:{bg:"$primary200"},marsh:{bg:"$marsh200"}}},'& > div[role="tablist"]':{position:"relative"},"& > button":{zIndex:2}}),C=l(b,{content:"",position:"absolute",bg:"white",borderRadius:"$2",variants:{interacted:{true:{transition:"all 0.3s ease"},false:{transition:"none"}}}}),d=s=>{const{theme:c,defaultValue:u,value:m}=t.useContext(E),a=t.useRef([]),i=t.Children.toArray(s.children).findIndex(e=>(e==null?void 0:e.props.value)===m),[f,h]=t.useState({left:0,height:0,width:0}),[p,v]=t.useState(!1),n=t.useCallback(()=>{const e=a.current[i];if(!e)return;const{width:o,height:r}=e.getBoundingClientRect();h({left:e.offsetLeft,height:r,width:o})},[i]);return t.useEffect(()=>{const e=new ResizeObserver(n),o=a.current;return o.forEach(r=>{r&&e.observe(r)}),()=>{o.forEach(r=>{r&&e.unobserve(r)}),e.disconnect()}},[i,n]),t.useEffect(()=>(window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}),[n]),t.useEffect(()=>{n()},[i,n]),t.createElement(w,{theme:c,defaultValue:u,...s},t.createElement(C,{css:{...f},interacted:p}),t.Children.map(s.children,(e,o)=>{if(!t.isValidElement(e))throw new Error(`Child passed to ${d.displayName} is not a valid element`);return t.cloneElement(e,{onClick:r=>{v(!0),e.props.onClick&&e.props.onClick(r)},ref:r=>a.current[o]=r})}))};export{d as SegmentedControlItemList};
2
2
  //# sourceMappingURL=SegmentedControlItemList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlItemList.js","sources":["../../../src/components/segmented-control/SegmentedControlItemList.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Box } from '../box'\nimport { Tabs } from '../tabs'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst StyledTriggerList = styled(Tabs.TriggerList, {\n position: 'relative',\n p: '$1',\n borderRadius: '$3',\n overflow: 'hidden',\n variants: {\n theme: {\n primary: { bg: '$primary200' },\n marsh: { bg: '$marsh200' }\n }\n },\n '& > div[role=\"tablist\"]': {\n position: 'relative'\n },\n '& > button': {\n zIndex: 2\n }\n})\n\nconst SelectionIndicator = styled(Box, {\n content: '',\n position: 'absolute',\n bg: 'white',\n borderRadius: '$2',\n variants: {\n interacted: {\n true: {\n transition: 'all 0.3s ease'\n },\n false: {\n transition: 'none'\n }\n }\n }\n})\n\nexport const SegmentedControlItemList = (\n props: React.ComponentProps<typeof Tabs.TriggerList>\n): JSX.Element => {\n const { theme, defaultValue } = useSegmentedControl()\n\n const tabsRef = React.useRef<(HTMLElement | null)[]>([])\n\n const defaultSelectedIndex = React.Children.toArray(props.children).findIndex(\n (child) => (child as React.ReactElement)?.props.value === defaultValue\n )\n const [selectedIndex, setSelectedIndex] = React.useState(\n defaultSelectedIndex !== -1 ? defaultSelectedIndex : 0\n )\n const [indicatorStyles, setIndicatorStyles] = React.useState({\n left: 0,\n height: 0,\n width: 0\n })\n const [hasInteracted, setHasInteracted] = React.useState(false)\n\n const setSelection = (index: number) => {\n setSelectedIndex(index)\n setHasInteracted(true)\n }\n\n const updateIndicatorPosition = React.useCallback(() => {\n const currentTab = tabsRef.current[selectedIndex]\n if (!currentTab) return\n\n const { width, height } = currentTab.getBoundingClientRect()\n setIndicatorStyles({ left: currentTab.offsetLeft, height, width })\n }, [selectedIndex])\n\n React.useEffect(() => {\n const resizeObserver = new ResizeObserver(updateIndicatorPosition)\n const currentTabs = tabsRef.current\n currentTabs.forEach((tab) => {\n if (tab) resizeObserver.observe(tab)\n })\n\n return () => {\n currentTabs.forEach((tab) => {\n if (tab) resizeObserver.unobserve(tab)\n })\n resizeObserver.disconnect()\n }\n }, [selectedIndex, updateIndicatorPosition])\n\n React.useEffect(() => {\n window.addEventListener('resize', updateIndicatorPosition)\n return () => {\n window.removeEventListener('resize', updateIndicatorPosition)\n }\n }, [updateIndicatorPosition])\n\n React.useEffect(() => {\n updateIndicatorPosition()\n }, [selectedIndex, updateIndicatorPosition])\n\n return (\n <StyledTriggerList theme={theme} defaultValue={defaultValue} {...props}>\n <SelectionIndicator\n css={{\n ...indicatorStyles\n }}\n interacted={hasInteracted}\n />\n {React.Children.map(props.children, (child, index) =>\n React.cloneElement(child as React.ReactElement, {\n onClick: () => setSelection(index),\n ref: (el) => (tabsRef.current[index] = el)\n })\n )}\n </StyledTriggerList>\n )\n}\n"],"names":["StyledTriggerList","styled","Tabs","SelectionIndicator","Box","SegmentedControlItemList","props","theme","defaultValue","useSegmentedControl","tabsRef","React","defaultSelectedIndex","child","selectedIndex","setSelectedIndex","indicatorStyles","setIndicatorStyles","hasInteracted","setHasInteracted","setSelection","index","updateIndicatorPosition","currentTab","width","height","resizeObserver","currentTabs","tab","el"],"mappings":"iNAOA,MAAMA,EAAoBC,EAAOC,EAAK,YAAa,CACjD,SAAU,WACV,EAAG,KACH,aAAc,KACd,SAAU,SACV,SAAU,CACR,MAAO,CACL,QAAS,CAAE,GAAI,aAAc,EAC7B,MAAO,CAAE,GAAI,WAAY,CAC3B,CACF,EACA,0BAA2B,CACzB,SAAU,UACZ,EACA,aAAc,CACZ,OAAQ,CACV,CACF,CAAC,EAEKC,EAAqBF,EAAOG,EAAK,CACrC,QAAS,GACT,SAAU,WACV,GAAI,QACJ,aAAc,KACd,SAAU,CACR,WAAY,CACV,KAAM,CACJ,WAAY,eACd,EACA,MAAO,CACL,WAAY,MACd,CACF,CACF,CACF,CAAC,EAEYC,EACXC,GACgB,CAChB,KAAM,CAAE,MAAAC,EAAO,aAAAC,CAAa,EAAIC,EAE1BC,EAAAA,EAAUC,EAAM,OAA+B,CAAE,CAAA,EAEjDC,EAAuBD,EAAM,SAAS,QAAQL,EAAM,QAAQ,EAAE,UACjEO,IAAWA,GAAA,KAAA,OAAAA,EAA8B,MAAM,SAAUL,CAC5D,EACM,CAACM,EAAeC,CAAgB,EAAIJ,EAAM,SAC9CC,IAAyB,GAAKA,EAAuB,CACvD,EACM,CAACI,EAAiBC,CAAkB,EAAIN,EAAM,SAAS,CAC3D,KAAM,EACN,OAAQ,EACR,MAAO,CACT,CAAC,EACK,CAACO,EAAeC,CAAgB,EAAIR,EAAM,SAAS,EAAK,EAExDS,EAAgBC,GAAkB,CACtCN,EAAiBM,CAAK,EACtBF,EAAiB,EAAI,CACvB,EAEMG,EAA0BX,EAAM,YAAY,IAAM,CACtD,MAAMY,EAAab,EAAQ,QAAQI,GACnC,GAAI,CAACS,EAAY,OAEjB,KAAM,CAAE,MAAAC,EAAO,OAAAC,CAAO,EAAIF,EAAW,sBAAA,EACrCN,EAAmB,CAAE,KAAMM,EAAW,WAAY,OAAAE,EAAQ,MAAAD,CAAM,CAAC,CACnE,EAAG,CAACV,CAAa,CAAC,EAElB,OAAAH,EAAM,UAAU,IAAM,CACpB,MAAMe,EAAiB,IAAI,eAAeJ,CAAuB,EAC3DK,EAAcjB,EAAQ,QAC5B,OAAAiB,EAAY,QAASC,GAAQ,CACvBA,GAAKF,EAAe,QAAQE,CAAG,CACrC,CAAC,EAEM,IAAM,CACXD,EAAY,QAASC,GAAQ,CACvBA,GAAKF,EAAe,UAAUE,CAAG,CACvC,CAAC,EACDF,EAAe,WACjB,CAAA,CACF,EAAG,CAACZ,EAAeQ,CAAuB,CAAC,EAE3CX,EAAM,UAAU,KACd,OAAO,iBAAiB,SAAUW,CAAuB,EAClD,IAAM,CACX,OAAO,oBAAoB,SAAUA,CAAuB,CAC9D,GACC,CAACA,CAAuB,CAAC,EAE5BX,EAAM,UAAU,IAAM,CACpBW,EACF,CAAA,EAAG,CAACR,EAAeQ,CAAuB,CAAC,EAGzCX,EAAA,cAACX,EAAA,CAAkB,MAAOO,EAAO,aAAcC,EAAe,GAAGF,GAC/DK,EAAA,cAACR,EAAA,CACC,IAAK,CACH,GAAGa,CACL,EACA,WAAYE,CACd,CAAA,EACCP,EAAM,SAAS,IAAIL,EAAM,SAAU,CAACO,EAAOQ,IAC1CV,EAAM,aAAaE,EAA6B,CAC9C,QAAS,IAAMO,EAAaC,CAAK,EACjC,IAAMQ,GAAQnB,EAAQ,QAAQW,GAASQ,CACzC,CAAC,CACH,CACF,CAEJ"}
1
+ {"version":3,"file":"SegmentedControlItemList.js","sources":["../../../src/components/segmented-control/SegmentedControlItemList.tsx"],"sourcesContent":["import invariant from 'invariant'\nimport * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Box } from '../box'\nimport { Tabs } from '../tabs'\nimport { SegmentedControlContext } from './SegmentedControlContext'\nimport { SegmentedControlItem } from './SegmentedControlItem'\n\nconst StyledTriggerList = styled(Tabs.TriggerList, {\n position: 'relative',\n p: '$1',\n borderRadius: '$3',\n overflow: 'hidden',\n variants: {\n theme: {\n primary: { bg: '$primary200' },\n marsh: { bg: '$marsh200' }\n }\n },\n '& > div[role=\"tablist\"]': {\n position: 'relative'\n },\n '& > button': {\n zIndex: 2\n }\n})\n\nconst SelectionIndicator = styled(Box, {\n content: '',\n position: 'absolute',\n bg: 'white',\n borderRadius: '$2',\n variants: {\n interacted: {\n true: {\n transition: 'all 0.3s ease'\n },\n false: {\n transition: 'none'\n }\n }\n }\n})\n\nexport const SegmentedControlItemList: React.FC = (\n props: React.ComponentProps<typeof Tabs.TriggerList>\n) => {\n const { theme, defaultValue, value } = React.useContext(\n SegmentedControlContext\n )\n\n const tabsRef = React.useRef<(HTMLElement | null)[]>([])\n\n const selectedIndex = React.Children.toArray(props.children).findIndex(\n (child) => (child as React.ReactElement)?.props.value === value\n )\n\n const [indicatorStyles, setIndicatorStyles] = React.useState({\n left: 0,\n height: 0,\n width: 0\n })\n const [hasInteracted, setHasInteracted] = React.useState(false)\n\n const updateIndicatorPosition = React.useCallback(() => {\n const currentTab = tabsRef.current[selectedIndex]\n if (!currentTab) return\n\n const { width, height } = currentTab.getBoundingClientRect()\n setIndicatorStyles({ left: currentTab.offsetLeft, height, width })\n }, [selectedIndex])\n\n React.useEffect(() => {\n const resizeObserver = new ResizeObserver(updateIndicatorPosition)\n const currentTabs = tabsRef.current\n currentTabs.forEach((tab) => {\n if (tab) resizeObserver.observe(tab)\n })\n\n return () => {\n currentTabs.forEach((tab) => {\n if (tab) resizeObserver.unobserve(tab)\n })\n resizeObserver.disconnect()\n }\n }, [selectedIndex, updateIndicatorPosition])\n\n React.useEffect(() => {\n window.addEventListener('resize', updateIndicatorPosition)\n return () => {\n window.removeEventListener('resize', updateIndicatorPosition)\n }\n }, [updateIndicatorPosition])\n\n React.useEffect(() => {\n updateIndicatorPosition()\n }, [selectedIndex, updateIndicatorPosition])\n\n return (\n <StyledTriggerList theme={theme} defaultValue={defaultValue} {...props}>\n <SelectionIndicator\n css={{\n ...indicatorStyles\n }}\n interacted={hasInteracted}\n />\n {React.Children.map(props.children, (child, index) => {\n if (!React.isValidElement(child)) {\n throw new Error(\n `Child passed to ${SegmentedControlItemList.displayName} is not a valid element`\n )\n }\n\n return React.cloneElement(\n child as React.ReactElement<\n React.ComponentProps<typeof SegmentedControlItem>\n >,\n {\n onClick: (e) => {\n setHasInteracted(true)\n if (child.props.onClick) child.props.onClick(e)\n },\n ref: (el) => (tabsRef.current[index] = el)\n }\n )\n })}\n </StyledTriggerList>\n )\n}\n"],"names":["StyledTriggerList","styled","Tabs","SelectionIndicator","Box","SegmentedControlItemList","props","theme","defaultValue","value","React","SegmentedControlContext","tabsRef","selectedIndex","child","indicatorStyles","setIndicatorStyles","hasInteracted","setHasInteracted","updateIndicatorPosition","currentTab","width","height","resizeObserver","currentTabs","tab","index","e","el"],"mappings":"qNASA,MAAMA,EAAoBC,EAAOC,EAAK,YAAa,CACjD,SAAU,WACV,EAAG,KACH,aAAc,KACd,SAAU,SACV,SAAU,CACR,MAAO,CACL,QAAS,CAAE,GAAI,aAAc,EAC7B,MAAO,CAAE,GAAI,WAAY,CAC3B,CACF,EACA,0BAA2B,CACzB,SAAU,UACZ,EACA,aAAc,CACZ,OAAQ,CACV,CACF,CAAC,EAEKC,EAAqBF,EAAOG,EAAK,CACrC,QAAS,GACT,SAAU,WACV,GAAI,QACJ,aAAc,KACd,SAAU,CACR,WAAY,CACV,KAAM,CACJ,WAAY,eACd,EACA,MAAO,CACL,WAAY,MACd,CACF,CACF,CACF,CAAC,EAEYC,EACXC,GACG,CACH,KAAM,CAAE,MAAAC,EAAO,aAAAC,EAAc,MAAAC,CAAM,EAAIC,EAAM,WAC3CC,CACF,EAEMC,EAAUF,EAAM,OAA+B,CAAE,CAAA,EAEjDG,EAAgBH,EAAM,SAAS,QAAQJ,EAAM,QAAQ,EAAE,UAC1DQ,IAAWA,GAAA,YAAAA,EAA8B,MAAM,SAAUL,CAC5D,EAEM,CAACM,EAAiBC,CAAkB,EAAIN,EAAM,SAAS,CAC3D,KAAM,EACN,OAAQ,EACR,MAAO,CACT,CAAC,EACK,CAACO,EAAeC,CAAgB,EAAIR,EAAM,SAAS,EAAK,EAExDS,EAA0BT,EAAM,YAAY,IAAM,CACtD,MAAMU,EAAaR,EAAQ,QAAQC,GACnC,GAAI,CAACO,EAAY,OAEjB,KAAM,CAAE,MAAAC,EAAO,OAAAC,CAAO,EAAIF,EAAW,wBACrCJ,EAAmB,CAAE,KAAMI,EAAW,WAAY,OAAAE,EAAQ,MAAAD,CAAM,CAAC,CACnE,EAAG,CAACR,CAAa,CAAC,EAElB,OAAAH,EAAM,UAAU,IAAM,CACpB,MAAMa,EAAiB,IAAI,eAAeJ,CAAuB,EAC3DK,EAAcZ,EAAQ,QAC5B,OAAAY,EAAY,QAASC,GAAQ,CACvBA,GAAKF,EAAe,QAAQE,CAAG,CACrC,CAAC,EAEM,IAAM,CACXD,EAAY,QAASC,GAAQ,CACvBA,GAAKF,EAAe,UAAUE,CAAG,CACvC,CAAC,EACDF,EAAe,YACjB,CACF,EAAG,CAACV,EAAeM,CAAuB,CAAC,EAE3CT,EAAM,UAAU,KACd,OAAO,iBAAiB,SAAUS,CAAuB,EAClD,IAAM,CACX,OAAO,oBAAoB,SAAUA,CAAuB,CAC9D,GACC,CAACA,CAAuB,CAAC,EAE5BT,EAAM,UAAU,IAAM,CACpBS,EACF,CAAA,EAAG,CAACN,EAAeM,CAAuB,CAAC,EAGzCT,EAAA,cAACV,EAAA,CAAkB,MAAOO,EAAO,aAAcC,EAAe,GAAGF,CAAAA,EAC/DI,EAAA,cAACP,EAAA,CACC,IAAK,CACH,GAAGY,CACL,EACA,WAAYE,CAAAA,CACd,EACCP,EAAM,SAAS,IAAIJ,EAAM,SAAU,CAACQ,EAAOY,IAAU,CACpD,GAAI,CAAChB,EAAM,eAAeI,CAAK,EAC7B,MAAM,IAAI,MACR,mBAAmBT,EAAyB,oCAC9C,EAGF,OAAOK,EAAM,aACXI,EAGA,CACE,QAAUa,GAAM,CACdT,EAAiB,EAAI,EACjBJ,EAAM,MAAM,SAASA,EAAM,MAAM,QAAQa,CAAC,CAChD,EACA,IAAMC,GAAQhB,EAAQ,QAAQc,GAASE,CACzC,CACF,CACF,CAAC,CACH,CAEJ"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SegmentedControlTheme } from './SegmentedControlContext';
2
+ import type { SegmentedControlTheme } from './SegmentedControl.types';
3
3
  declare const StyledSegmentedControlRoot: import("@atom-learning/stitches-react/types/styled-component").StyledComponent<import("@atom-learning/stitches-react/types/styled-component").StyledComponent<React.ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsProps & React.RefAttributes<HTMLDivElement>>, {}, {
4
4
  sm: string;
5
5
  md: string;
@@ -1834,5 +1834,5 @@ declare const StyledSegmentedControlRoot: import("@atom-learning/stitches-react/
1834
1834
  export interface SegmentedControlRootProps extends React.ComponentProps<typeof StyledSegmentedControlRoot> {
1835
1835
  theme?: SegmentedControlTheme;
1836
1836
  }
1837
- export declare const SegmentedControlRoot: ({ size, children, theme, defaultValue, ...props }: React.PropsWithChildren<SegmentedControlRootProps>) => React.JSX.Element;
1837
+ export declare const SegmentedControlRoot: ({ size, theme, defaultValue, children, ...props }: React.PropsWithChildren<SegmentedControlRootProps>) => React.JSX.Element;
1838
1838
  export {};
@@ -1,2 +1,2 @@
1
- import*as r from"react";import{styled as a}from"../../stitches.js";import{Tabs as l}from"../tabs/Tabs.js";import{SegmentedControlProvider as n}from"./SegmentedControlContext.js";const s=a(l,{"& > div":{border:"none"},variants:{size:{sm:{width:"unset"},md:{},lg:{}}}}),d=({size:e,children:o,theme:m="primary",defaultValue:t="",...i})=>r.createElement(n,{size:e,theme:m,defaultValue:t},r.createElement(s,{...i,size:e,defaultValue:t},o));export{d as SegmentedControlRoot};
1
+ import*as t from"react";import{styled as v}from"../../stitches.js";import{Tabs as c}from"../tabs/Tabs.js";import{SegmentedControlContext as f}from"./SegmentedControlContext.js";const h=v(c,{"& > div":{border:"none"},variants:{size:{sm:{width:"unset"},md:{},lg:{}}}}),g=({size:n,theme:m="primary",defaultValue:e,children:u,...o})=>{const a=o.value!==void 0,[i,s]=t.useState(e),r=a?o.value:i,l=a?o.onValueChange:s;t.useEffect(()=>{!a&&e&&s(e)},[e,a]);const d=t.useMemo(()=>({size:n,theme:m,defaultValue:e,onValueChange:l,value:r}),[n,m,e,l,r]);return t.createElement(f.Provider,{value:d},t.createElement(h,{size:n,value:r,onValueChange:l,...o},u))};export{g as SegmentedControlRoot};
2
2
  //# sourceMappingURL=SegmentedControlRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlRoot.js","sources":["../../../src/components/segmented-control/SegmentedControlRoot.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Tabs } from '../tabs'\nimport {\n SegmentedControlProvider,\n SegmentedControlTheme\n} from './SegmentedControlContext'\n\nconst StyledSegmentedControlRoot = styled(Tabs, {\n '& > div': { border: 'none' },\n variants: {\n size: {\n sm: {\n width: 'unset'\n },\n md: {},\n lg: {}\n }\n }\n})\n\nexport interface SegmentedControlRootProps\n extends React.ComponentProps<typeof StyledSegmentedControlRoot> {\n theme?: SegmentedControlTheme\n}\n\nexport const SegmentedControlRoot = ({\n size,\n children,\n theme = 'primary',\n defaultValue = '',\n ...props\n}: React.PropsWithChildren<SegmentedControlRootProps>): React.JSX.Element => (\n <SegmentedControlProvider\n size={size}\n theme={theme}\n defaultValue={defaultValue}\n >\n <StyledSegmentedControlRoot\n {...props}\n size={size}\n defaultValue={defaultValue}\n >\n {children}\n </StyledSegmentedControlRoot>\n </SegmentedControlProvider>\n)\n"],"names":["StyledSegmentedControlRoot","styled","Tabs","SegmentedControlRoot","size","children","theme","defaultValue","props","React","SegmentedControlProvider"],"mappings":"kLASA,MAAMA,EAA6BC,EAAOC,EAAM,CAC9C,UAAW,CAAE,OAAQ,MAAO,EAC5B,SAAU,CACR,KAAM,CACJ,GAAI,CACF,MAAO,OACT,EACA,GAAI,CACJ,EAAA,GAAI,CAAA,CACN,CACF,CACF,CAAC,EAOYC,EAAuB,CAAC,CACnC,KAAAC,EACA,SAAAC,EACA,MAAAC,EAAQ,UACR,aAAAC,EAAe,MACZC,CACL,IACEC,EAAA,cAACC,EAAA,CACC,KAAMN,EACN,MAAOE,EACP,aAAcC,GAEdE,EAAA,cAACT,EAAA,CACE,GAAGQ,EACJ,KAAMJ,EACN,aAAcG,CAAAA,EAEbF,CACH,CACF"}
1
+ {"version":3,"file":"SegmentedControlRoot.js","sources":["../../../src/components/segmented-control/SegmentedControlRoot.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Tabs } from '../tabs'\nimport type { SegmentedControlTheme } from './SegmentedControl.types'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nconst StyledSegmentedControlRoot = styled(Tabs, {\n '& > div': { border: 'none' },\n variants: {\n size: {\n sm: {\n width: 'unset'\n },\n md: {},\n lg: {}\n }\n }\n})\n\nexport interface SegmentedControlRootProps\n extends React.ComponentProps<typeof StyledSegmentedControlRoot> {\n theme?: SegmentedControlTheme\n}\n\nexport const SegmentedControlRoot = ({\n size,\n theme = 'primary',\n defaultValue,\n children,\n ...props\n}: React.PropsWithChildren<SegmentedControlRootProps>): React.JSX.Element => {\n const isControlled = props.value !== undefined\n\n const [internalValue, setInternalValue] = React.useState(defaultValue)\n\n const currentValue = isControlled ? props.value : internalValue\n const handleValueChange = isControlled\n ? props.onValueChange\n : setInternalValue\n\n React.useEffect(() => {\n if (!isControlled && defaultValue) {\n setInternalValue(defaultValue)\n }\n }, [defaultValue, isControlled])\n\n const value = React.useMemo(\n () => ({\n size,\n theme,\n defaultValue,\n onValueChange: handleValueChange,\n value: currentValue\n }),\n [size, theme, defaultValue, handleValueChange, currentValue]\n )\n\n return (\n <SegmentedControlContext.Provider value={value}>\n <StyledSegmentedControlRoot\n size={size}\n value={currentValue}\n onValueChange={handleValueChange}\n {...props}\n >\n {children}\n </StyledSegmentedControlRoot>\n </SegmentedControlContext.Provider>\n )\n}\n"],"names":["StyledSegmentedControlRoot","styled","Tabs","SegmentedControlRoot","size","theme","defaultValue","children","props","isControlled","internalValue","setInternalValue","React","currentValue","handleValueChange","value","SegmentedControlContext"],"mappings":"iLAOA,MAAMA,EAA6BC,EAAOC,EAAM,CAC9C,UAAW,CAAE,OAAQ,MAAO,EAC5B,SAAU,CACR,KAAM,CACJ,GAAI,CACF,MAAO,OACT,EACA,GAAI,CACJ,EAAA,GAAI,CAAA,CACN,CACF,CACF,CAAC,EAOYC,EAAuB,CAAC,CACnC,KAAAC,EACA,MAAAC,EAAQ,UACR,aAAAC,EACA,SAAAC,KACGC,CACL,IAA6E,CAC3E,MAAMC,EAAeD,EAAM,QAAU,OAE/B,CAACE,EAAeC,CAAgB,EAAIC,EAAM,SAASN,CAAY,EAE/DO,EAAeJ,EAAeD,EAAM,MAAQE,EAC5CI,EAAoBL,EACtBD,EAAM,cACNG,EAEJC,EAAM,UAAU,IAAM,CAChB,CAACH,GAAgBH,GACnBK,EAAiBL,CAAY,CAEjC,EAAG,CAACA,EAAcG,CAAY,CAAC,EAE/B,MAAMM,EAAQH,EAAM,QAClB,KAAO,CACL,KAAAR,EACA,MAAAC,EACA,aAAAC,EACA,cAAeQ,EACf,MAAOD,CACT,GACA,CAACT,EAAMC,EAAOC,EAAcQ,EAAmBD,CAAY,CAC7D,EAEA,OACED,EAAA,cAACI,EAAwB,SAAxB,CAAiC,MAAOD,CACvCH,EAAAA,EAAA,cAACZ,EAAA,CACC,KAAMI,EACN,MAAOS,EACP,cAAeC,EACd,GAAGN,CAEHD,EAAAA,CACH,CACF,CAEJ"}