@okshaun/components 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ import { LabelVariantProps } from '../../../styled-system/recipes';
27
27
  import { LinkVariantProps } from '../../../styled-system/recipes';
28
28
  import { menu } from '../../../styled-system/recipes';
29
29
  import { MenuVariantProps } from '../../../styled-system/recipes';
30
+ import { ModalVariantProps } from '../../../styled-system/recipes';
30
31
  import { NumericSizeToken } from '../../../styled-system/tokens';
31
32
  import { Placement } from '@floating-ui/react';
32
33
  import { RadioInputVariantProps } from '../../../styled-system/recipes';
@@ -34,6 +35,10 @@ import { RadioVariantProps } from '../../../styled-system/recipes';
34
35
  import * as React_2 from 'react';
35
36
  import { ReactNode } from 'react';
36
37
  import { RefObject } from 'react';
38
+ import { SelectContextValue } from './types';
39
+ import { SelectOptionProps } from './types';
40
+ import { SelectProps } from './types';
41
+ import { SelectTriggerProps } from './types';
37
42
  import { SpinnerVariantProps } from '../../../styled-system/recipes';
38
43
  import { SVGAttributes } from 'react';
39
44
  import { SystemStyleObject } from '../../../styled-system/types';
@@ -207,7 +212,7 @@ declare type ButtonComponent = <E extends React_2.ElementType = 'button'>(props:
207
212
  * It includes props for the element type E (default "button") and ButtonVariantProps.
208
213
  * This means that any prop accepted by the underlying element (e.g. onClick) is automatically allowed.
209
214
  */
210
- export declare type ButtonProps<E extends React_2.ElementType = 'button'> = React_2.ComponentPropsWithoutRef<E> & Omit<ButtonVariantProps, 'iconBefore' | 'iconAfter'> & {
215
+ export declare type ButtonProps<E extends React_2.ElementType = 'button'> = Omit<BoxProps, keyof ButtonVariantProps | 'as'> & Omit<ButtonVariantProps, 'iconBefore' | 'iconAfter'> & {
211
216
  as?: E;
212
217
  href?: string;
213
218
  loading?: boolean;
@@ -219,13 +224,39 @@ export declare type ButtonProps<E extends React_2.ElementType = 'button'> = Reac
219
224
  gap?: NumericSizeToken;
220
225
  };
221
226
 
222
- export declare const Card: React.FC<CardProps>;
227
+ /**
228
+ * Card component that supports both static (content container) and interactive (button/link) modes.
229
+ *
230
+ * By default, renders as a div for semantic correctness.
231
+ * - With `href`: renders as an anchor element
232
+ * - With `interactive` or `onClick`: renders as a button element
233
+ * - Use `as` prop for custom elements like 'article' or 'section'
234
+ */
235
+ export declare const Card: CardComponent;
223
236
 
224
- export declare type CardProps = Omit<BoxProps, keyof CardVariantProps> & CardVariantProps & {
237
+ /**
238
+ * Define a polymorphic CardComponent type.
239
+ */
240
+ declare type CardComponent = <E extends React_2.ElementType = 'div'>(props: CardProps<E> & {
241
+ ref?: React_2.ForwardedRef<Element>;
242
+ }) => React_2.ReactElement;
243
+
244
+ /**
245
+ * CardProps is generic and manages its own polymorphism.
246
+ * Default element is 'div' for non-interactive cards.
247
+ * Automatically renders as 'a' when href is provided, or 'button' when interactive without href.
248
+ */
249
+ export declare type CardProps<E extends React_2.ElementType = 'div'> = Omit<BoxProps, keyof CardVariantProps | 'as'> & Omit<CardVariantProps, 'interactive'> & {
250
+ as?: E;
225
251
  href?: string;
226
- children?: string | ReactNode;
227
- grabbed?: boolean;
252
+ children?: React_2.ReactNode;
253
+ className?: string;
228
254
  disabled?: boolean;
255
+ /**
256
+ * When true, the card becomes interactive (button or link).
257
+ * Automatically true when href or onClick is provided.
258
+ */
259
+ interactive?: boolean;
229
260
  };
230
261
 
231
262
  /**
@@ -311,45 +342,19 @@ export declare type CodeProps = Omit<BoxProps, keyof CodeVariantProps | keyof Te
311
342
  declare type ContainerSizeKey = keyof typeof containerSizes;
312
343
 
313
344
  declare const containerSizes: {
314
- '2xs': {
315
- value: string;
316
- };
317
- xs: {
318
- value: string;
319
- };
320
- sm: {
321
- value: string;
322
- };
323
- md: {
324
- value: string;
325
- };
326
- lg: {
327
- value: string;
328
- };
329
- xl: {
330
- value: string;
331
- };
332
- '2xl': {
333
- value: string;
334
- };
335
- '3xl': {
336
- value: string;
337
- };
338
- '4xl': {
339
- value: string;
340
- };
341
- '5xl': {
342
- value: string;
343
- };
344
- '6xl': {
345
- value: string;
346
- };
347
- '7xl': {
348
- value: string;
349
- };
350
- '8xl': {
351
- value: string;
352
- };
345
+ '2xs': string;
346
+ xs: string;
347
+ sm: string;
348
+ md: string;
349
+ lg: string;
350
+ xl: string;
351
+ '2xl': string;
352
+ '3xl': string;
353
+ '4xl': string;
354
+ '5xl': string;
355
+ '6xl': string;
356
+ '7xl': string;
357
+ '8xl': string;
353
358
  };
354
359
 
355
360
  export declare const Divider: React.FC<DividerProps>;
@@ -396,7 +401,7 @@ declare type IconButtonComponent = <E extends React_2.ElementType = 'button'>(pr
396
401
  * We've added a new optional prop 'iconName'. When provided (and if no children
397
402
  * are passed), IconButton will render the corresponding Icon automatically.
398
403
  */
399
- export declare type IconButtonProps<E extends React_2.ElementType = 'button'> = React_2.ComponentPropsWithoutRef<E> & IconButtonVariantProps & {
404
+ export declare type IconButtonProps<E extends React_2.ElementType = 'button'> = Omit<BoxProps, keyof IconButtonVariantProps | 'as'> & IconButtonVariantProps & {
400
405
  as?: E;
401
406
  href?: string;
402
407
  loading?: boolean;
@@ -869,6 +874,55 @@ export declare type MenuTriggerProps = Omit<BoxProps, 'children'> & {
869
874
  disabled?: boolean;
870
875
  };
871
876
 
877
+ export declare const Modal: default_2.FC<ModalProps>;
878
+
879
+ export declare const ModalBody: default_2.FC<ModalBodyProps>;
880
+
881
+ export declare type ModalBodyProps = Omit<BoxProps, 'children'> & {
882
+ /** Body content */
883
+ children: React.ReactNode;
884
+ };
885
+
886
+ declare interface ModalContextValue {
887
+ /** Whether the modal is open */
888
+ open: boolean;
889
+ /** Callback to close the modal */
890
+ onClose: () => void;
891
+ /** Whether overlay clicks should close the modal */
892
+ preventOverlayClose?: boolean;
893
+ }
894
+
895
+ export declare const ModalFooter: default_2.FC<ModalFooterProps>;
896
+
897
+ export declare type ModalFooterProps = Omit<BoxProps, 'children'> & {
898
+ /** Footer content (typically action buttons) */
899
+ children: React.ReactNode;
900
+ };
901
+
902
+ export declare const ModalHeader: default_2.FC<ModalHeaderProps>;
903
+
904
+ export declare type ModalHeaderProps = Omit<BoxProps, 'children'> & {
905
+ /** Title text */
906
+ title?: string | React.ReactNode;
907
+ /** Whether to show the close button */
908
+ showCloseButton?: boolean;
909
+ /** Children (custom header content) */
910
+ children?: React.ReactNode;
911
+ };
912
+
913
+ export declare type ModalProps = Omit<BoxProps, keyof ModalVariantProps> & ModalVariantProps & {
914
+ /** Controlled open state (REQUIRED) */
915
+ open: boolean;
916
+ /** Callback when open state should change (REQUIRED) */
917
+ onOpenChange: (open: boolean) => void;
918
+ /** Whether clicking the overlay should close the modal */
919
+ preventOverlayClose?: boolean;
920
+ /** Children (ModalHeader, ModalBody, ModalFooter) */
921
+ children: React.ReactNode;
922
+ /** Optional ID for ARIA attributes */
923
+ id?: string;
924
+ };
925
+
872
926
  declare const numericSizes: {
873
927
  '0': {
874
928
  value: string;
@@ -1051,8 +1105,27 @@ export declare type RadioProps = Omit<BoxProps, keyof RadioVariantProps> & Radio
1051
1105
  error?: boolean;
1052
1106
  };
1053
1107
 
1108
+ export declare const Select: default_2.FC<SelectProps>;
1109
+
1110
+ export { SelectContextValue }
1111
+
1054
1112
  export declare type SelectionIndicator = 'checkmark' | 'checkbox';
1055
1113
 
1114
+ /**
1115
+ * SelectOption component used within Select
1116
+ * Note: This component doesn't render directly - the Select parent component
1117
+ * converts SelectOption instances to MenuItem components for actual rendering.
1118
+ */
1119
+ export declare const SelectOption: default_2.FC<SelectOptionProps>;
1120
+
1121
+ export { SelectOptionProps }
1122
+
1123
+ export { SelectProps }
1124
+
1125
+ export declare const SelectTrigger: default_2.FC<SelectTriggerProps>;
1126
+
1127
+ export { SelectTriggerProps }
1128
+
1056
1129
  export declare const Spinner: React.FC<SpinnerProps>;
1057
1130
 
1058
1131
  export declare type SpinnerProps = Omit<BoxProps, keyof SpinnerVariantProps> & SpinnerVariantProps & {
@@ -1186,6 +1259,10 @@ export declare function useMediaQuery(breakpoint: BreakpointKey, direction?: Que
1186
1259
 
1187
1260
  export declare const useMenuContext: () => MenuContextValue;
1188
1261
 
1262
+ export declare const useModalContext: () => ModalContextValue;
1263
+
1264
+ export declare const useSelectContext: () => SelectContextValue;
1265
+
1189
1266
  export declare function useTheme(): ThemeContextType;
1190
1267
 
1191
1268
  export { }