@okshaun/components 0.4.4 → 0.4.6

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 { ChipVariantProps } from '../../../styled-system/recipes';
9
10
  import { CodeVariantProps } from '../../../styled-system/recipes';
10
11
  import { ColorToken } from '../../../styled-system/tokens';
11
12
  import { ComponentPropsWithoutRef } from 'react';
@@ -224,6 +225,13 @@ export declare type CheckboxProps = {
224
225
  error?: boolean;
225
226
  } & Omit<BoxProps, 'checked' | 'onChange' | keyof CheckboxVariantProps> & CheckboxVariantProps;
226
227
 
228
+ export declare const Chip: React.FC<ChipProps>;
229
+
230
+ export declare type ChipProps = BoxProps & ChipVariantProps & {
231
+ children: string | ReactNode;
232
+ iconName?: IconNamesList;
233
+ };
234
+
227
235
  export declare const Code: React.FC<CodeProps>;
228
236
 
229
237
  export declare type CodeProps = Omit<BoxProps, keyof CodeVariantProps | keyof TextProps> & CodeVariantProps & TextProps & {
@@ -277,7 +285,7 @@ declare const containerSizes: {
277
285
 
278
286
  export declare const Divider: React.FC<DividerProps>;
279
287
 
280
- export declare type DividerProps = Omit<BoxProps, keyof DividerVariantProps> & DividerVariantProps & {
288
+ export declare type DividerProps = BoxProps & DividerVariantProps & {
281
289
  direction?: string;
282
290
  weight?: string;
283
291
  };
package/dist/index.js CHANGED
@@ -560,6 +560,362 @@ const checkboxInput = /* @__PURE__ */ Object.assign(memo(checkboxInputFn.recipeF
560
560
  },
561
561
  getVariantProps: checkboxInputFn.getVariantProps
562
562
  });
563
+ const chipFn = /* @__PURE__ */ createRecipe("chip", {
564
+ "state": "resolved",
565
+ "hue": "blue",
566
+ "hasIcon": false
567
+ }, [
568
+ {
569
+ "hue": "blue",
570
+ "state": "resolved",
571
+ "css": {
572
+ "color": {
573
+ "base": "blue.70",
574
+ "_dark": "blue.20"
575
+ },
576
+ "bg": {
577
+ "base": "blue.20",
578
+ "_dark": "blue.90"
579
+ },
580
+ "_hover": {
581
+ "bg": {
582
+ "base": "blue.30",
583
+ "_dark": "blue.80"
584
+ }
585
+ }
586
+ }
587
+ },
588
+ {
589
+ "hue": "blue",
590
+ "state": "placeholder",
591
+ "css": {
592
+ "color": {
593
+ "base": "blue.50",
594
+ "_dark": "blue.40"
595
+ },
596
+ "borderColor": {
597
+ "base": "blue.40",
598
+ "_dark": "blue.60"
599
+ },
600
+ "bg": "transparent",
601
+ "_hover": {
602
+ "bg": {
603
+ "base": "blue.10",
604
+ "_dark": "blue.90/50"
605
+ }
606
+ }
607
+ }
608
+ },
609
+ {
610
+ "hue": "blue",
611
+ "state": "loading",
612
+ "css": {
613
+ "color": {
614
+ "base": "blue.50",
615
+ "_dark": "blue.40"
616
+ },
617
+ "bg": {
618
+ "base": "blue.10",
619
+ "_dark": "blue.90"
620
+ }
621
+ }
622
+ },
623
+ {
624
+ "hue": "blue",
625
+ "state": "deleted",
626
+ "css": {
627
+ "color": {
628
+ "base": "blue.40",
629
+ "_dark": "blue.60"
630
+ },
631
+ "bg": {
632
+ "base": "blue.10",
633
+ "_dark": "blue.90"
634
+ }
635
+ }
636
+ },
637
+ {
638
+ "hue": "purple",
639
+ "state": "resolved",
640
+ "css": {
641
+ "color": {
642
+ "base": "purple.70",
643
+ "_dark": "purple.20"
644
+ },
645
+ "bg": {
646
+ "base": "purple.20",
647
+ "_dark": "purple.90"
648
+ },
649
+ "_hover": {
650
+ "bg": {
651
+ "base": "purple.30",
652
+ "_dark": "purple.80"
653
+ }
654
+ }
655
+ }
656
+ },
657
+ {
658
+ "hue": "purple",
659
+ "state": "placeholder",
660
+ "css": {
661
+ "color": {
662
+ "base": "purple.50",
663
+ "_dark": "purple.40"
664
+ },
665
+ "borderColor": {
666
+ "base": "purple.40",
667
+ "_dark": "purple.60"
668
+ },
669
+ "bg": "transparent",
670
+ "_hover": {
671
+ "bg": {
672
+ "base": "purple.10",
673
+ "_dark": "purple.90/50"
674
+ }
675
+ }
676
+ }
677
+ },
678
+ {
679
+ "hue": "purple",
680
+ "state": "loading",
681
+ "css": {
682
+ "color": {
683
+ "base": "purple.50",
684
+ "_dark": "purple.40"
685
+ },
686
+ "bg": {
687
+ "base": "purple.10",
688
+ "_dark": "purple.90"
689
+ }
690
+ }
691
+ },
692
+ {
693
+ "hue": "purple",
694
+ "state": "deleted",
695
+ "css": {
696
+ "color": {
697
+ "base": "purple.40",
698
+ "_dark": "purple.60"
699
+ },
700
+ "bg": {
701
+ "base": "purple.10",
702
+ "_dark": "purple.90"
703
+ }
704
+ }
705
+ },
706
+ {
707
+ "hue": "orange",
708
+ "state": "resolved",
709
+ "css": {
710
+ "color": {
711
+ "base": "orange.70",
712
+ "_dark": "orange.20"
713
+ },
714
+ "bg": {
715
+ "base": "orange.20",
716
+ "_dark": "orange.100"
717
+ },
718
+ "_hover": {
719
+ "bg": {
720
+ "base": "orange.30",
721
+ "_dark": "orange.90"
722
+ }
723
+ }
724
+ }
725
+ },
726
+ {
727
+ "hue": "orange",
728
+ "state": "placeholder",
729
+ "css": {
730
+ "color": {
731
+ "base": "orange.50",
732
+ "_dark": "orange.40"
733
+ },
734
+ "borderColor": {
735
+ "base": "orange.40",
736
+ "_dark": "orange.60"
737
+ },
738
+ "bg": "transparent",
739
+ "_hover": {
740
+ "bg": {
741
+ "base": "orange.10",
742
+ "_dark": "orange.90/50"
743
+ }
744
+ }
745
+ }
746
+ },
747
+ {
748
+ "hue": "orange",
749
+ "state": "loading",
750
+ "css": {
751
+ "color": {
752
+ "base": "orange.50",
753
+ "_dark": "orange.40"
754
+ },
755
+ "bg": {
756
+ "base": "orange.10",
757
+ "_dark": "orange.100"
758
+ }
759
+ }
760
+ },
761
+ {
762
+ "hue": "orange",
763
+ "state": "deleted",
764
+ "css": {
765
+ "color": {
766
+ "base": "orange.40",
767
+ "_dark": "orange.60"
768
+ },
769
+ "bg": {
770
+ "base": "orange.10",
771
+ "_dark": "orange.100"
772
+ }
773
+ }
774
+ },
775
+ {
776
+ "hue": "green",
777
+ "state": "resolved",
778
+ "css": {
779
+ "color": {
780
+ "base": "green.70",
781
+ "_dark": "green.20"
782
+ },
783
+ "bg": {
784
+ "base": "green.20",
785
+ "_dark": "green.90"
786
+ },
787
+ "_hover": {
788
+ "bg": {
789
+ "base": "green.30",
790
+ "_dark": "green.80"
791
+ }
792
+ }
793
+ }
794
+ },
795
+ {
796
+ "hue": "green",
797
+ "state": "placeholder",
798
+ "css": {
799
+ "color": {
800
+ "base": "green.50",
801
+ "_dark": "green.40"
802
+ },
803
+ "borderColor": {
804
+ "base": "green.40",
805
+ "_dark": "green.60"
806
+ },
807
+ "bg": "transparent",
808
+ "_hover": {
809
+ "bg": {
810
+ "base": "green.10",
811
+ "_dark": "green.90/50"
812
+ }
813
+ }
814
+ }
815
+ },
816
+ {
817
+ "hue": "green",
818
+ "state": "loading",
819
+ "css": {
820
+ "color": {
821
+ "base": "green.50",
822
+ "_dark": "green.40"
823
+ },
824
+ "bg": {
825
+ "base": "green.10",
826
+ "_dark": "green.90"
827
+ }
828
+ }
829
+ },
830
+ {
831
+ "hue": "green",
832
+ "state": "deleted",
833
+ "css": {
834
+ "color": {
835
+ "base": "green.40",
836
+ "_dark": "green.60"
837
+ },
838
+ "bg": {
839
+ "base": "green.10",
840
+ "_dark": "green.90"
841
+ }
842
+ }
843
+ },
844
+ {
845
+ "hue": "gray",
846
+ "state": "resolved",
847
+ "css": {
848
+ "color": "text.subtle",
849
+ "bg": "bg.neutral",
850
+ "_hover": {
851
+ "bg": "bg.neutral.hovered"
852
+ }
853
+ }
854
+ },
855
+ {
856
+ "hue": "gray",
857
+ "state": "placeholder",
858
+ "css": {
859
+ "color": "text.subtlest",
860
+ "borderColor": "border.default",
861
+ "bg": "transparent",
862
+ "_hover": {
863
+ "bg": "bg.neutral"
864
+ }
865
+ }
866
+ },
867
+ {
868
+ "hue": "gray",
869
+ "state": "loading",
870
+ "css": {
871
+ "color": "text.subtlest",
872
+ "bg": "bg.neutral"
873
+ }
874
+ },
875
+ {
876
+ "hue": "gray",
877
+ "state": "deleted",
878
+ "css": {
879
+ "color": "text.disabled",
880
+ "bg": "bg.neutral"
881
+ }
882
+ }
883
+ ]);
884
+ const chipVariantMap = {
885
+ "state": [
886
+ "resolved",
887
+ "placeholder",
888
+ "loading",
889
+ "deleted"
890
+ ],
891
+ "hue": [
892
+ "blue",
893
+ "purple",
894
+ "orange",
895
+ "green",
896
+ "gray"
897
+ ],
898
+ "hasIcon": [
899
+ "true",
900
+ "false"
901
+ ]
902
+ };
903
+ const chipVariantKeys = Object.keys(chipVariantMap);
904
+ const chip = /* @__PURE__ */ Object.assign(memo(chipFn.recipeFn), {
905
+ __recipe__: true,
906
+ __name__: "chip",
907
+ __getCompoundVariantCss__: chipFn.__getCompoundVariantCss__,
908
+ raw: (props) => props,
909
+ variantKeys: chipVariantKeys,
910
+ variantMap: chipVariantMap,
911
+ merge(recipe) {
912
+ return mergeRecipes(this, recipe);
913
+ },
914
+ splitVariantProps(props) {
915
+ return splitProps$1(props, chipVariantKeys);
916
+ },
917
+ getVariantProps: chipFn.getVariantProps
918
+ });
563
919
  const codeFn = /* @__PURE__ */ createRecipe("code", {}, []);
564
920
  const codeVariantMap = {};
565
921
  const codeVariantKeys = Object.keys(codeVariantMap);
@@ -3073,6 +3429,33 @@ const Tag = ({
3073
3429
  }
3074
3430
  );
3075
3431
  };
3432
+ const Chip = ({
3433
+ state = "resolved",
3434
+ hue = "blue",
3435
+ children,
3436
+ iconName,
3437
+ onClick,
3438
+ ...props
3439
+ }) => {
3440
+ const [className, otherProps] = splitProps(props);
3441
+ const hasIcon = !!iconName;
3442
+ const isClickable = state === "resolved" || state === "placeholder";
3443
+ return /* @__PURE__ */ jsxs(
3444
+ Box,
3445
+ {
3446
+ as: "span",
3447
+ className: cx(chip({ state, hue, hasIcon }), className),
3448
+ onClick: isClickable ? onClick : void 0,
3449
+ role: isClickable ? "button" : void 0,
3450
+ tabIndex: isClickable ? 0 : void 0,
3451
+ ...otherProps,
3452
+ children: [
3453
+ iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, width: 14, height: 14 }),
3454
+ children
3455
+ ]
3456
+ }
3457
+ );
3458
+ };
3076
3459
  function hasWindow() {
3077
3460
  return typeof window !== "undefined";
3078
3461
  }
@@ -8384,6 +8767,7 @@ export {
8384
8767
  Card,
8385
8768
  Checkbox,
8386
8769
  CheckboxInput,
8770
+ Chip,
8387
8771
  Code,
8388
8772
  Divider,
8389
8773
  Dropdown,