@okshaun/components 0.3.2 → 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 +136 -25
- package/dist/index.js +232 -98
- package/dist/index.js.map +1 -1
- package/dist/preset.js +257 -581
- package/dist/preset.js.map +1 -1
- package/dist/size.primitives-j2MFgtrT.js +335 -0
- package/dist/size.primitives-j2MFgtrT.js.map +1 -0
- package/package.json +1 -1
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,7 +810,7 @@ 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
|
};
|
|
@@ -749,7 +819,7 @@ export declare const splitProps: (props: Record<string, any>) => [string, Record
|
|
|
749
819
|
|
|
750
820
|
export declare const Tag: React.FC<TagProps>;
|
|
751
821
|
|
|
752
|
-
declare type TagProps = BoxProps & TagVariantProps & {
|
|
822
|
+
export declare type TagProps = BoxProps & TagVariantProps & {
|
|
753
823
|
children: string | ReactNode;
|
|
754
824
|
iconName?: IconNamesList;
|
|
755
825
|
};
|
|
@@ -759,7 +829,7 @@ export { Text_2 as Text }
|
|
|
759
829
|
|
|
760
830
|
export declare const Textarea: React.FC<TextareaProps>;
|
|
761
831
|
|
|
762
|
-
declare type TextareaProps = Omit<BoxProps, keyof TextareaVariantProps> & TextareaVariantProps & {
|
|
832
|
+
export declare type TextareaProps = Omit<BoxProps, keyof TextareaVariantProps> & TextareaVariantProps & {
|
|
763
833
|
name: string;
|
|
764
834
|
error?: boolean;
|
|
765
835
|
id?: string;
|
|
@@ -767,13 +837,13 @@ declare type TextareaProps = Omit<BoxProps, keyof TextareaVariantProps> & Textar
|
|
|
767
837
|
|
|
768
838
|
export declare const TextInput: React.FC<TextInputProps>;
|
|
769
839
|
|
|
770
|
-
declare type TextInputProps = Omit<BoxProps, keyof TextinputVariantProps> & TextinputVariantProps & {
|
|
840
|
+
export declare type TextInputProps = Omit<BoxProps, keyof TextinputVariantProps> & TextinputVariantProps & {
|
|
771
841
|
name: string;
|
|
772
842
|
error?: boolean;
|
|
773
843
|
id?: string;
|
|
774
844
|
};
|
|
775
845
|
|
|
776
|
-
declare type TextProps = Omit<BoxProps, keyof TextVariantProps> & TextVariantProps & {
|
|
846
|
+
export declare type TextProps = Omit<BoxProps, keyof TextVariantProps> & TextVariantProps & {
|
|
777
847
|
italic?: boolean;
|
|
778
848
|
family?: FontToken;
|
|
779
849
|
bold?: boolean;
|
|
@@ -802,14 +872,14 @@ export declare const Toggle: default_2.FC<ToggleProps>;
|
|
|
802
872
|
|
|
803
873
|
export declare const ToggleInput: FC<ToggleInputProps>;
|
|
804
874
|
|
|
805
|
-
declare type ToggleInputProps = BoxProps & ToggleInputVariantProps & {
|
|
875
|
+
export declare type ToggleInputProps = BoxProps & ToggleInputVariantProps & {
|
|
806
876
|
name: string;
|
|
807
877
|
id?: string;
|
|
808
878
|
error?: boolean;
|
|
809
879
|
children?: string | ReactNode;
|
|
810
880
|
};
|
|
811
881
|
|
|
812
|
-
declare type ToggleProps = Omit<BoxProps, keyof ToggleVariantProps> & ToggleVariantProps & {
|
|
882
|
+
export declare type ToggleProps = Omit<BoxProps, keyof ToggleVariantProps> & ToggleVariantProps & {
|
|
813
883
|
name: string;
|
|
814
884
|
id?: string;
|
|
815
885
|
error?: boolean;
|
|
@@ -818,7 +888,7 @@ declare type ToggleProps = Omit<BoxProps, keyof ToggleVariantProps> & ToggleVari
|
|
|
818
888
|
|
|
819
889
|
export declare const Tooltip: React.FC<TooltipProps>;
|
|
820
890
|
|
|
821
|
-
declare type TooltipProps = Omit<BoxProps, keyof TooltipVariantProps> & TooltipVariantProps & {
|
|
891
|
+
export declare type TooltipProps = Omit<BoxProps, keyof TooltipVariantProps> & TooltipVariantProps & {
|
|
822
892
|
text: string;
|
|
823
893
|
title?: string;
|
|
824
894
|
caret?: boolean;
|
|
@@ -827,6 +897,47 @@ declare type TooltipProps = Omit<BoxProps, keyof TooltipVariantProps> & TooltipV
|
|
|
827
897
|
trigger?: 'onHover' | 'onClick';
|
|
828
898
|
};
|
|
829
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
|
+
|
|
830
941
|
export declare function useTheme(): ThemeContextType;
|
|
831
942
|
|
|
832
943
|
export { }
|