@okshaun/components 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -451,14 +451,44 @@ npm run build
451
451
 
452
452
  ## Publishing
453
453
 
454
- To publish a new version to npm:
454
+ Publishing is handled via GitHub Actions with a manual workflow that prevents common pitfalls like tag conflicts.
455
455
 
456
- 1. Update version in `package.json`
457
- 2. Create a git tag: `git tag v1.0.0`
458
- 3. Push tag: `git push --tags`
459
- 4. Create a GitHub release, or use the manual workflow in GitHub Actions
456
+ ### How to Publish
460
457
 
461
- The package will be automatically published to npm via GitHub Actions.
458
+ 1. Go to the repository on GitHub
459
+ 2. Click **Actions** tab
460
+ 3. Select **"Publish to NPM"** workflow from the left sidebar
461
+ 4. Click **"Run workflow"** button (dropdown on the right)
462
+ 5. Select the version bump type:
463
+ - **patch** (0.3.4 → 0.3.5) - Bug fixes, minor changes
464
+ - **minor** (0.3.4 → 0.4.0) - New features, backward compatible
465
+ - **major** (0.3.4 → 1.0.0) - Breaking changes
466
+ 6. Click **"Run workflow"**
467
+
468
+ ### What the Workflow Does
469
+
470
+ 1. Builds and lints the package
471
+ 2. **Validates** the new version doesn't already exist (on npm or as a git tag)
472
+ 3. Bumps `package.json` version and commits
473
+ 4. Pushes the commit to `main`
474
+ 5. Publishes to npm with provenance
475
+ 6. Creates git tag and GitHub release (only after successful publish)
476
+
477
+ ### Troubleshooting
478
+
479
+ **"Tag already exists" error:**
480
+ ```bash
481
+ # Delete the conflicting tag locally and remotely
482
+ git tag -d v0.3.5
483
+ git push origin :refs/tags/v0.3.5
484
+ ```
485
+
486
+ **"Version already published" error:**
487
+ - Choose a higher version bump level (e.g., minor instead of patch)
488
+
489
+ **Workflow failed mid-way:**
490
+ - Safe to re-run - the workflow validates before making changes
491
+ - If version commit was pushed but npm publish failed, fix the issue and re-run
462
492
 
463
493
  ## Storybook
464
494
 
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import { ColorToken } from '../../../styled-system/tokens';
11
11
  import { ComponentPropsWithoutRef } from 'react';
12
12
  import { default as default_2 } from 'react';
13
13
  import { DividerVariantProps } from '../../../styled-system/recipes';
14
+ import { DropdownProps } from './types';
14
15
  import { ElementType } from 'react';
15
16
  import { FC } from 'react';
16
17
  import { FontSizeToken } from '../../../styled-system/tokens';
@@ -22,7 +23,9 @@ import { IconNamesList } from './icons';
22
23
  import { JSX } from 'react/jsx-runtime';
23
24
  import { LabelVariantProps } from '../../../styled-system/recipes';
24
25
  import { LinkVariantProps } from '../../../styled-system/recipes';
26
+ import { menu } from '../../../styled-system/recipes';
25
27
  import { MenuVariantProps } from '../../../styled-system/recipes';
28
+ import { Placement } from '@floating-ui/react';
26
29
  import { RadioInputVariantProps } from '../../../styled-system/recipes';
27
30
  import { RadioVariantProps } from '../../../styled-system/recipes';
28
31
  import * as React_2 from 'react';
@@ -41,6 +44,52 @@ import { TooltipVariantProps } from '../../../styled-system/recipes';
41
44
 
42
45
  declare type AllowedIconSizes = keyof typeof numericSizes;
43
46
 
47
+ export declare const Autocomplete: default_2.FC<AutocompleteProps>;
48
+
49
+ export declare interface AutocompleteOption {
50
+ /** Unique identifier for the option */
51
+ id: string;
52
+ /** Display label */
53
+ label: string;
54
+ /** Optional description */
55
+ description?: string;
56
+ /** Optional icon name */
57
+ icon?: string;
58
+ /** Whether this option is disabled */
59
+ disabled?: boolean;
60
+ }
61
+
62
+ export declare type AutocompleteProps = MenuVariantProps & {
63
+ /** Input name attribute */
64
+ name: string;
65
+ /** Current input value */
66
+ value: string;
67
+ /** Callback when input value changes */
68
+ onChange: (value: string) => void;
69
+ /** Available options to filter and display */
70
+ options: AutocompleteOption[];
71
+ /** Callback when an option is selected */
72
+ onSelect: (option: AutocompleteOption) => void;
73
+ /** Placeholder text for the input */
74
+ placeholder?: string;
75
+ /** Floating UI placement */
76
+ placement?: Placement;
77
+ /** Offset distance from input (in pixels) */
78
+ offset?: number;
79
+ /** Optional ID for ARIA attributes */
80
+ id?: string;
81
+ /** Disable the autocomplete */
82
+ disabled?: boolean;
83
+ /** Show error state */
84
+ error?: boolean;
85
+ /** Custom filter function (defaults to case-insensitive label match) */
86
+ filterFn?: (option: AutocompleteOption, inputValue: string) => boolean;
87
+ /** Message to show when no options match */
88
+ noResultsMessage?: string;
89
+ /** Props to pass to the TextInput */
90
+ inputProps?: Omit<TextInputProps, 'name' | 'value' | 'onChange' | 'disabled' | 'error' | 'id'>;
91
+ };
92
+
44
93
  /**
45
94
  * The Badge component uses the polymorphic Box as its base.
46
95
  * Renders as a <span> by default but can be changed via the 'as' prop.
@@ -233,6 +282,10 @@ export declare type DividerProps = Omit<BoxProps, keyof DividerVariantProps> & D
233
282
  weight?: string;
234
283
  };
235
284
 
285
+ export declare const Dropdown: default_2.FC<DropdownProps>;
286
+
287
+ export { DropdownProps }
288
+
236
289
  export declare const Heading: React.FC<HeadingProps>;
237
290
 
238
291
  export declare type HeadingProps = Omit<TextProps, keyof HeadingVariantProps> & HeadingVariantProps & {
@@ -337,6 +390,14 @@ export declare const IconNames: {
337
390
  readonly 'checkbox-focus': "checkbox-focus";
338
391
  readonly 'checkbox-indeterminate': "checkbox-indeterminate";
339
392
  readonly checkbox: "checkbox";
393
+ readonly 'chevron-down': "chevron-down";
394
+ readonly 'chevron-filled-down': "chevron-filled-down";
395
+ readonly 'chevron-filled-left': "chevron-filled-left";
396
+ readonly 'chevron-filled-right': "chevron-filled-right";
397
+ readonly 'chevron-filled-up': "chevron-filled-up";
398
+ readonly 'chevron-left': "chevron-left";
399
+ readonly 'chevron-right': "chevron-right";
400
+ readonly 'chevron-up': "chevron-up";
340
401
  readonly 'circle-change': "circle-change";
341
402
  readonly 'circle-check': "circle-check";
342
403
  readonly circle: "circle";
@@ -600,30 +661,91 @@ export declare type LinkProps = Omit<BoxProps, keyof LinkVariantProps> & LinkVar
600
661
  children?: React.ReactNode;
601
662
  };
602
663
 
603
- export declare const Menu: React.FC<MenuProps>;
664
+ export declare const Menu: default_2.FC<MenuProps>;
665
+
666
+ declare interface MenuContextValue {
667
+ open: boolean;
668
+ setOpen: (open: boolean) => void;
669
+ refs: {
670
+ setReference: (node: HTMLElement | null) => void;
671
+ setFloating: (node: HTMLElement | null) => void;
672
+ };
673
+ floatingStyles: React.CSSProperties;
674
+ getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
675
+ getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
676
+ getItemProps: (userProps?: React.HTMLProps<HTMLElement> & {
677
+ index?: number;
678
+ active?: boolean;
679
+ }) => Record<string, unknown>;
680
+ activeIndex: number | null;
681
+ listRef: React.MutableRefObject<(HTMLElement | null)[]>;
682
+ classes: ReturnType<menu>;
683
+ }
684
+
685
+ export declare const MenuDivider: default_2.FC<MenuDividerProps>;
686
+
687
+ export declare type MenuDividerProps = Omit<BoxProps, 'children'>;
688
+
689
+ export declare const MenuGroup: default_2.FC<MenuGroupProps>;
690
+
691
+ export declare type MenuGroupProps = Omit<BoxProps, 'title'> & {
692
+ /** Group label */
693
+ label?: string;
694
+ /** Children (MenuItem components) */
695
+ children: React.ReactNode;
696
+ };
697
+
698
+ export declare const MenuItem: default_2.FC<MenuItemProps>;
699
+
700
+ export declare type MenuItemProps = Omit<BoxProps, 'children'> & {
701
+ /** Item behavior type */
702
+ type?: MenuItemType;
703
+ /** Selected state (for single-select and multi-select) */
704
+ selected?: boolean;
705
+ /** Callback when item is selected/activated */
706
+ onSelect?: () => void;
707
+ /** Disable the item */
708
+ disabled?: boolean;
709
+ /** Primary label (required) */
710
+ label: string | React.ReactNode;
711
+ /** Secondary description text */
712
+ description?: string;
713
+ /** Icon on the left side */
714
+ iconLeft?: IconNamesList;
715
+ /** Icon on the right side */
716
+ iconRight?: IconNamesList;
717
+ /** Text to highlight (for autocomplete/search scenarios) */
718
+ highlightMatch?: string;
719
+ /** Selection indicator style (only for select types) */
720
+ selectionIndicator?: SelectionIndicator;
721
+ /** Index for keyboard navigation (managed internally via context) */
722
+ index?: number;
723
+ };
724
+
725
+ export declare type MenuItemType = 'action' | 'single-select' | 'multi-select';
604
726
 
605
727
  export declare type MenuProps = Omit<BoxProps, keyof MenuVariantProps> & MenuVariantProps & {
606
- menuSection: {
607
- id?: string;
608
- title?: string;
609
- divider?: boolean;
610
- spacer?: boolean;
611
- link?: boolean;
612
- items: {
613
- id: string;
614
- label: string;
615
- description?: string;
616
- value?: string;
617
- iconName?: string;
618
- children?: MenuProps['menuSection'];
619
- disabled?: boolean;
620
- href?: string;
621
- }[];
622
- }[];
623
- iconPlacement?: 'left' | 'right';
624
- variant?: 'single-select' | 'multi-select';
625
- multiSelectType?: 'checkbox' | 'toggle';
626
- onChange?: (selected: string[] | string | null) => void;
728
+ /** Controlled open state (REQUIRED) */
729
+ open: boolean;
730
+ /** Callback when open state should change (REQUIRED) */
731
+ onOpenChange: (open: boolean) => void;
732
+ /** Floating UI placement */
733
+ placement?: Placement;
734
+ /** Offset distance from trigger (in pixels) */
735
+ offset?: number;
736
+ /** Children (MenuTrigger, MenuItem, MenuGroup, etc.) */
737
+ children: React.ReactNode;
738
+ /** Optional ID for ARIA attributes */
739
+ id?: string;
740
+ };
741
+
742
+ export declare const MenuTrigger: default_2.FC<MenuTriggerProps>;
743
+
744
+ export declare type MenuTriggerProps = Omit<BoxProps, 'children'> & {
745
+ /** Trigger element (button, custom component, etc.) */
746
+ children: React.ReactElement;
747
+ /** Disable the trigger */
748
+ disabled?: boolean;
627
749
  };
628
750
 
629
751
  declare const numericSizes: {
@@ -808,6 +930,8 @@ export declare type RadioProps = Omit<BoxProps, keyof RadioVariantProps> & Radio
808
930
  error?: boolean;
809
931
  };
810
932
 
933
+ export declare type SelectionIndicator = 'checkmark' | 'checkbox';
934
+
811
935
  export declare const Spinner: React.FC<SpinnerProps>;
812
936
 
813
937
  export declare type SpinnerProps = Omit<BoxProps, keyof SpinnerVariantProps> & SpinnerVariantProps & {
@@ -938,6 +1062,8 @@ export declare function useContainerQuery(containerRef: RefObject<HTMLElement>,
938
1062
  */
939
1063
  export declare function useMediaQuery(breakpoint: BreakpointKey, direction?: QueryDirection): boolean;
940
1064
 
1065
+ export declare const useMenuContext: () => MenuContextValue;
1066
+
941
1067
  export declare function useTheme(): ThemeContextType;
942
1068
 
943
1069
  export { }