@okshaun/components 0.3.1 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { CardVariantProps } from '../../../styled-system/recipes';
6
6
  import { ChangeEventHandler } from 'react';
7
7
  import { CheckboxInputVariantProps } from '../../../styled-system/recipes';
8
8
  import { CheckboxVariantProps } from '../../../styled-system/recipes';
9
+ import { CodeVariantProps } from '../../../styled-system/recipes';
9
10
  import { ColorToken } from '../../../styled-system/tokens';
10
11
  import { ComponentPropsWithoutRef } from 'react';
11
12
  import { default as default_2 } from 'react';
@@ -26,6 +27,7 @@ import { RadioInputVariantProps } from '../../../styled-system/recipes';
26
27
  import { RadioVariantProps } from '../../../styled-system/recipes';
27
28
  import * as React_2 from 'react';
28
29
  import { ReactNode } from 'react';
30
+ import { RefObject } from 'react';
29
31
  import { SpinnerVariantProps } from '../../../styled-system/recipes';
30
32
  import { SVGAttributes } from 'react';
31
33
  import { SystemStyleObject } from '../../../styled-system/types';
@@ -56,7 +58,7 @@ declare type BadgeComponent = <E extends React_2.ElementType = 'span'>(props: Ba
56
58
  * BadgeProps is generic and manages its own polymorphism.
57
59
  * It includes props for the element type E (default "span") and BadgeVariantProps.
58
60
  */
59
- declare type BadgeProps<E extends React_2.ElementType = 'span'> = React_2.ComponentPropsWithoutRef<E> & BadgeVariantProps & {
61
+ export declare type BadgeProps<E extends React_2.ElementType = 'span'> = React_2.ComponentPropsWithoutRef<E> & BadgeVariantProps & {
60
62
  as?: E;
61
63
  className?: string;
62
64
  children?: React_2.ReactNode;
@@ -64,13 +66,13 @@ declare type BadgeProps<E extends React_2.ElementType = 'span'> = React_2.Compon
64
66
 
65
67
  export declare const Box: default_2.FC<BoxProps>;
66
68
 
67
- declare type BoxProps = Omit<ComponentPropsWithoutRef<ElementType>, 'as'> & SystemStyleObject & BoxVariantProps & {
69
+ export declare type BoxProps = Omit<ComponentPropsWithoutRef<ElementType>, 'as'> & SystemStyleObject & BoxVariantProps & {
68
70
  as?: ElementType;
69
71
  } & AriaAttributes;
70
72
 
71
73
  export declare const Breadcrumbs: default_2.FC<BreadcrumbsProps>;
72
74
 
73
- declare type BreadcrumbsProps = BoxProps & {
75
+ export declare type BreadcrumbsProps = BoxProps & {
74
76
  items: {
75
77
  id: string;
76
78
  label: string;
@@ -78,6 +80,19 @@ declare type BreadcrumbsProps = BoxProps & {
78
80
  }[];
79
81
  };
80
82
 
83
+ export declare function BreakpointIndicator(): JSX.Element;
84
+
85
+ declare type BreakpointKey = keyof typeof breakpoints;
86
+
87
+ declare const breakpoints: {
88
+ xs: string;
89
+ sm: string;
90
+ md: string;
91
+ lg: string;
92
+ xl: string;
93
+ '2xl': string;
94
+ };
95
+
81
96
  /**
82
97
  * The Button component uses the polymorphic Box as its base.
83
98
  * It automatically renders as an <a> if href is provided.
@@ -98,7 +113,7 @@ declare type ButtonComponent = <E extends React_2.ElementType = 'button'>(props:
98
113
  * It includes props for the element type E (default "button") and ButtonVariantProps.
99
114
  * This means that any prop accepted by the underlying element (e.g. onClick) is automatically allowed.
100
115
  */
101
- declare type ButtonProps<E extends React_2.ElementType = 'button'> = React_2.ComponentPropsWithoutRef<E> & Omit<ButtonVariantProps, 'iconBefore' | 'iconAfter'> & {
116
+ export declare type ButtonProps<E extends React_2.ElementType = 'button'> = React_2.ComponentPropsWithoutRef<E> & Omit<ButtonVariantProps, 'iconBefore' | 'iconAfter'> & {
102
117
  as?: E;
103
118
  href?: string;
104
119
  loading?: boolean;
@@ -111,7 +126,7 @@ declare type ButtonProps<E extends React_2.ElementType = 'button'> = React_2.Com
111
126
 
112
127
  export declare const Card: React.FC<CardProps>;
113
128
 
114
- declare type CardProps = Omit<BoxProps, keyof CardVariantProps> & CardVariantProps & {
129
+ export declare type CardProps = Omit<BoxProps, keyof CardVariantProps> & CardVariantProps & {
115
130
  href?: string;
116
131
  children?: string | ReactNode;
117
132
  grabbed?: boolean;
@@ -133,7 +148,7 @@ export declare const Checkbox: React.FC<CheckboxProps>;
133
148
 
134
149
  export declare const CheckboxInput: FC<CheckboxInputProps>;
135
150
 
136
- declare type CheckboxInputProps = BoxProps & CheckboxInputVariantProps & {
151
+ export declare type CheckboxInputProps = BoxProps & CheckboxInputVariantProps & {
137
152
  name: string;
138
153
  checked: boolean;
139
154
  onChange: ChangeEventHandler<HTMLInputElement>;
@@ -143,7 +158,7 @@ declare type CheckboxInputProps = BoxProps & CheckboxInputVariantProps & {
143
158
  disabled?: boolean;
144
159
  };
145
160
 
146
- declare type CheckboxProps = {
161
+ export declare type CheckboxProps = {
147
162
  /** Form field name */
148
163
  name: string;
149
164
  /** Controlled checked state (REQUIRED) */
@@ -160,16 +175,67 @@ declare type CheckboxProps = {
160
175
  error?: boolean;
161
176
  } & Omit<BoxProps, 'checked' | 'onChange' | keyof CheckboxVariantProps> & CheckboxVariantProps;
162
177
 
178
+ export declare const Code: React.FC<CodeProps>;
179
+
180
+ export declare type CodeProps = Omit<BoxProps, keyof CodeVariantProps | keyof TextProps> & CodeVariantProps & TextProps & {
181
+ children?: string | React.ReactNode;
182
+ lang?: string;
183
+ };
184
+
185
+ declare type ContainerSizeKey = keyof typeof containerSizes;
186
+
187
+ declare const containerSizes: {
188
+ '2xs': {
189
+ value: string;
190
+ };
191
+ xs: {
192
+ value: string;
193
+ };
194
+ sm: {
195
+ value: string;
196
+ };
197
+ md: {
198
+ value: string;
199
+ };
200
+ lg: {
201
+ value: string;
202
+ };
203
+ xl: {
204
+ value: string;
205
+ };
206
+ '2xl': {
207
+ value: string;
208
+ };
209
+ '3xl': {
210
+ value: string;
211
+ };
212
+ '4xl': {
213
+ value: string;
214
+ };
215
+ '5xl': {
216
+ value: string;
217
+ };
218
+ '6xl': {
219
+ value: string;
220
+ };
221
+ '7xl': {
222
+ value: string;
223
+ };
224
+ '8xl': {
225
+ value: string;
226
+ };
227
+ };
228
+
163
229
  export declare const Divider: React.FC<DividerProps>;
164
230
 
165
- declare type DividerProps = Omit<BoxProps, keyof DividerVariantProps> & DividerVariantProps & {
231
+ export declare type DividerProps = Omit<BoxProps, keyof DividerVariantProps> & DividerVariantProps & {
166
232
  direction?: string;
167
233
  weight?: string;
168
234
  };
169
235
 
170
236
  export declare const Heading: React.FC<HeadingProps>;
171
237
 
172
- declare type HeadingProps = Omit<TextProps, keyof HeadingVariantProps> & HeadingVariantProps & {
238
+ export declare type HeadingProps = Omit<TextProps, keyof HeadingVariantProps> & HeadingVariantProps & {
173
239
  children?: string | React.ReactNode;
174
240
  level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
175
241
  };
@@ -200,7 +266,7 @@ declare type IconButtonComponent = <E extends React_2.ElementType = 'button'>(pr
200
266
  * We've added a new optional prop 'iconName'. When provided (and if no children
201
267
  * are passed), IconButton will render the corresponding Icon automatically.
202
268
  */
203
- declare type IconButtonProps<E extends React_2.ElementType = 'button'> = React_2.ComponentPropsWithoutRef<E> & IconButtonVariantProps & {
269
+ export declare type IconButtonProps<E extends React_2.ElementType = 'button'> = React_2.ComponentPropsWithoutRef<E> & IconButtonVariantProps & {
204
270
  as?: E;
205
271
  href?: string;
206
272
  loading?: boolean;
@@ -506,7 +572,7 @@ export declare const IconNames: {
506
572
  readonly 'zoom-out': "zoom-out";
507
573
  };
508
574
 
509
- declare type IconProps = Omit<BoxProps, 'size'> & SVGAttributes<SVGElement> & {
575
+ export declare type IconProps = Omit<BoxProps, 'size'> & SVGAttributes<SVGElement> & {
510
576
  name: IconNamesList;
511
577
  size?: AllowedIconSizes;
512
578
  fill?: ColorToken;
@@ -514,14 +580,14 @@ declare type IconProps = Omit<BoxProps, 'size'> & SVGAttributes<SVGElement> & {
514
580
 
515
581
  export declare const Label: default_2.FC<LabelProps>;
516
582
 
517
- declare type LabelProps = Omit<BoxProps, keyof LabelVariantProps> & LabelVariantProps & {
583
+ export declare type LabelProps = Omit<BoxProps, keyof LabelVariantProps> & LabelVariantProps & {
518
584
  htmlFor?: string;
519
585
  children?: string | default_2.ReactNode;
520
586
  };
521
587
 
522
588
  export declare const Link: React.FC<LinkProps>;
523
589
 
524
- declare type LinkProps = Omit<BoxProps, keyof LinkVariantProps> & LinkVariantProps & {
590
+ export declare type LinkProps = Omit<BoxProps, keyof LinkVariantProps> & LinkVariantProps & {
525
591
  href: string;
526
592
  external?: boolean;
527
593
  disabled?: boolean;
@@ -536,7 +602,7 @@ declare type LinkProps = Omit<BoxProps, keyof LinkVariantProps> & LinkVariantPro
536
602
 
537
603
  export declare const Menu: React.FC<MenuProps>;
538
604
 
539
- declare type MenuProps = Omit<BoxProps, keyof MenuVariantProps> & MenuVariantProps & {
605
+ export declare type MenuProps = Omit<BoxProps, keyof MenuVariantProps> & MenuVariantProps & {
540
606
  menuSection: {
541
607
  id?: string;
542
608
  title?: string;
@@ -714,24 +780,28 @@ declare type Position = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'bot
714
780
 
715
781
  export declare const Pre: React.FC<PreProps>;
716
782
 
717
- declare type PreProps = BoxProps & {
783
+ export declare type PreProps = BoxProps & {
718
784
  children: string | React.ReactNode;
719
785
  lang?: string;
720
786
  as?: string;
721
787
  };
722
788
 
789
+ declare type QueryDirection = 'min' | 'max';
790
+
791
+ declare type QueryDirection_2 = 'min' | 'max';
792
+
723
793
  export declare const Radio: React.FC<RadioProps>;
724
794
 
725
795
  export declare const RadioInput: FC<RadioInputProps>;
726
796
 
727
- declare type RadioInputProps = BoxProps & RadioInputVariantProps & {
797
+ export declare type RadioInputProps = BoxProps & RadioInputVariantProps & {
728
798
  name: string;
729
799
  id?: string;
730
800
  error?: boolean;
731
801
  children?: string | ReactNode;
732
802
  };
733
803
 
734
- declare type RadioProps = Omit<BoxProps, keyof RadioVariantProps> & RadioVariantProps & {
804
+ export declare type RadioProps = Omit<BoxProps, keyof RadioVariantProps> & RadioVariantProps & {
735
805
  id?: string;
736
806
  name: string;
737
807
  disabled?: boolean;
@@ -740,14 +810,16 @@ declare type RadioProps = Omit<BoxProps, keyof RadioVariantProps> & RadioVariant
740
810
 
741
811
  export declare const Spinner: React.FC<SpinnerProps>;
742
812
 
743
- declare type SpinnerProps = Omit<BoxProps, keyof SpinnerVariantProps> & SpinnerVariantProps & {
813
+ export declare type SpinnerProps = Omit<BoxProps, keyof SpinnerVariantProps> & SpinnerVariantProps & {
744
814
  size?: 'standard' | 'small' | 'large';
745
815
  className?: string;
746
816
  };
747
817
 
818
+ export declare const splitProps: (props: Record<string, any>) => [string, Record<string, any>];
819
+
748
820
  export declare const Tag: React.FC<TagProps>;
749
821
 
750
- declare type TagProps = BoxProps & TagVariantProps & {
822
+ export declare type TagProps = BoxProps & TagVariantProps & {
751
823
  children: string | ReactNode;
752
824
  iconName?: IconNamesList;
753
825
  };
@@ -757,7 +829,7 @@ export { Text_2 as Text }
757
829
 
758
830
  export declare const Textarea: React.FC<TextareaProps>;
759
831
 
760
- declare type TextareaProps = Omit<BoxProps, keyof TextareaVariantProps> & TextareaVariantProps & {
832
+ export declare type TextareaProps = Omit<BoxProps, keyof TextareaVariantProps> & TextareaVariantProps & {
761
833
  name: string;
762
834
  error?: boolean;
763
835
  id?: string;
@@ -765,13 +837,13 @@ declare type TextareaProps = Omit<BoxProps, keyof TextareaVariantProps> & Textar
765
837
 
766
838
  export declare const TextInput: React.FC<TextInputProps>;
767
839
 
768
- declare type TextInputProps = Omit<BoxProps, keyof TextinputVariantProps> & TextinputVariantProps & {
840
+ export declare type TextInputProps = Omit<BoxProps, keyof TextinputVariantProps> & TextinputVariantProps & {
769
841
  name: string;
770
842
  error?: boolean;
771
843
  id?: string;
772
844
  };
773
845
 
774
- declare type TextProps = Omit<BoxProps, keyof TextVariantProps> & TextVariantProps & {
846
+ export declare type TextProps = Omit<BoxProps, keyof TextVariantProps> & TextVariantProps & {
775
847
  italic?: boolean;
776
848
  family?: FontToken;
777
849
  bold?: boolean;
@@ -800,14 +872,14 @@ export declare const Toggle: default_2.FC<ToggleProps>;
800
872
 
801
873
  export declare const ToggleInput: FC<ToggleInputProps>;
802
874
 
803
- declare type ToggleInputProps = BoxProps & ToggleInputVariantProps & {
875
+ export declare type ToggleInputProps = BoxProps & ToggleInputVariantProps & {
804
876
  name: string;
805
877
  id?: string;
806
878
  error?: boolean;
807
879
  children?: string | ReactNode;
808
880
  };
809
881
 
810
- declare type ToggleProps = Omit<BoxProps, keyof ToggleVariantProps> & ToggleVariantProps & {
882
+ export declare type ToggleProps = Omit<BoxProps, keyof ToggleVariantProps> & ToggleVariantProps & {
811
883
  name: string;
812
884
  id?: string;
813
885
  error?: boolean;
@@ -816,7 +888,7 @@ declare type ToggleProps = Omit<BoxProps, keyof ToggleVariantProps> & ToggleVari
816
888
 
817
889
  export declare const Tooltip: React.FC<TooltipProps>;
818
890
 
819
- declare type TooltipProps = Omit<BoxProps, keyof TooltipVariantProps> & TooltipVariantProps & {
891
+ export declare type TooltipProps = Omit<BoxProps, keyof TooltipVariantProps> & TooltipVariantProps & {
820
892
  text: string;
821
893
  title?: string;
822
894
  caret?: boolean;
@@ -825,6 +897,47 @@ declare type TooltipProps = Omit<BoxProps, keyof TooltipVariantProps> & TooltipV
825
897
  trigger?: 'onHover' | 'onClick';
826
898
  };
827
899
 
900
+ /**
901
+ * Token-aware container query hook for conditional rendering based on container sizes.
902
+ * Requires a ref to the container element and the container must have container-type set.
903
+ *
904
+ * @example
905
+ * // Component with container query
906
+ * function MyComponent() {
907
+ * const containerRef = useRef<HTMLDivElement>(null);
908
+ * const isLarge = useContainerQuery(containerRef, 'lg');
909
+ *
910
+ * return (
911
+ * <div ref={containerRef} style={{ containerType: 'inline-size' }}>
912
+ * {isLarge && <LargeLayout />}
913
+ * {!isLarge && <SmallLayout />}
914
+ * </div>
915
+ * );
916
+ * }
917
+ *
918
+ * @example
919
+ * // Max-width: matches when container is < xl size
920
+ * const isSmall = useContainerQuery(containerRef, 'xl', 'max');
921
+ */
922
+ export declare function useContainerQuery(containerRef: RefObject<HTMLElement>, size: ContainerSizeKey, direction?: QueryDirection_2): boolean;
923
+
924
+ /**
925
+ * Token-aware media query hook for conditional rendering based on breakpoints.
926
+ *
927
+ * @example
928
+ * // Mobile-first: matches when viewport is >= md (768px)
929
+ * const isDesktop = useMediaQuery('md');
930
+ *
931
+ * @example
932
+ * // Max-width: matches when viewport is < lg (1024px)
933
+ * const isMobile = useMediaQuery('lg', 'max');
934
+ *
935
+ * @example
936
+ * // In JSX
937
+ * {isDesktop && <DesktopOnlyComponent />}
938
+ */
939
+ export declare function useMediaQuery(breakpoint: BreakpointKey, direction?: QueryDirection): boolean;
940
+
828
941
  export declare function useTheme(): ThemeContextType;
829
942
 
830
943
  export { }