@obosbbl/grunnmuren-react 0.2.2 → 1.0.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.
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ interface StepperProps extends React.ComponentPropsWithoutRef<'ol'> {
3
+ }
4
+ export declare const Stepper: (props: StepperProps) => JSX.Element;
5
+ interface StepProps extends React.ComponentPropsWithoutRef<'li'> {
6
+ /** Content for the Step item's bullet */
7
+ bullet: React.ReactNode;
8
+ }
9
+ export declare const Step: (props: StepProps) => JSX.Element;
10
+ interface StepBulletProps extends React.ComponentPropsWithoutRef<'span'> {
11
+ }
12
+ export declare const StepBullet: (props: StepBulletProps) => JSX.Element;
13
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Stepper';
@@ -77,36 +77,6 @@ const InfoCircle = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spread
77
77
  d: "M16 0C12.8355 0 9.74207 0.938384 7.11088 2.69649C4.4797 4.45459 2.42894 6.95345 1.21793 9.87707C0.0069325 12.8007 -0.309921 16.0177 0.307443 19.1214C0.924806 22.2251 2.44866 25.0761 4.6863 27.3137C6.92394 29.5513 9.77487 31.0752 12.8786 31.6926C15.9823 32.3099 19.1993 31.9931 22.1229 30.7821C25.0466 29.5711 27.5454 27.5203 29.3035 24.8891C31.0616 22.2579 32 19.1645 32 16C32 11.7565 30.3143 7.68687 27.3137 4.68629C24.3131 1.68571 20.2435 0 16 0ZM18 26H14V15H18V26ZM18 11H14V7H18V11Z"
78
78
  })
79
79
  }));
80
- const Mail = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
81
- width: "1.25em",
82
- height: "1.25em",
83
- fill: "none",
84
- viewBox: "0 0 28 22",
85
- role: "img",
86
- "aria-hidden": props["aria-label"] == null
87
- }, props), {
88
- children: /* @__PURE__ */ jsx("path", {
89
- fill: "currentColor",
90
- fillRule: "evenodd",
91
- d: "M28 4L15.984 10.866C15.3797 11.2112 14.6959 11.3927 14 11.3927C13.3041 11.3927 12.6203 11.2112 12.016 10.866L0 4C0 2.93913 0.421427 1.92172 1.17157 1.17157C1.92172 0.421427 2.93913 0 4 0H24C25.0609 0 26.0783 0.421427 26.8284 1.17157C27.5786 1.92172 28 2.93913 28 4ZM0 9L12 16H16L28 9V18C28 19.0609 27.5786 20.0783 26.8284 20.8284C26.0783 21.5786 25.0609 22 24 22H4C2.93913 22 1.92172 21.5786 1.17157 20.8284C0.421427 20.0783 0 19.0609 0 18V9Z",
92
- clipRule: "evenodd"
93
- })
94
- }));
95
- const MapPin = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
96
- width: "1.25em",
97
- height: "1.25em",
98
- fill: "none",
99
- viewBox: "0 0 22 35",
100
- role: "img",
101
- "aria-hidden": props["aria-label"] == null
102
- }, props), {
103
- children: /* @__PURE__ */ jsx("path", {
104
- fill: "currentColor",
105
- fillRule: "evenodd",
106
- d: "M2.51 17.205L2.28 16.915H2.24C1.09834 15.315 0.41945 13.4314 0.277819 11.471C0.136187 9.51058 0.537288 7.54902 1.43711 5.80154C2.33694 4.05407 3.70071 2.58821 5.37881 1.56481C7.0569 0.541404 8.98446 0 10.95 0C12.9155 0 14.8431 0.541404 16.5212 1.56481C18.1993 2.58821 19.5631 4.05407 20.4629 5.80154C21.3627 7.54902 21.7638 9.51058 21.6222 11.471C21.4806 13.4314 20.8017 15.315 19.66 16.915L19.43 17.215L19.43 17.215C19.33 17.345 19.23 17.475 19.12 17.595L14.12 24.015C13.828 24.6005 13.3785 25.0931 12.8221 25.4374C12.2657 25.7816 11.6243 25.964 10.97 25.964C10.3157 25.964 9.67431 25.7816 9.11789 25.4374C8.56147 25.0931 8.11202 24.6005 7.82 24.015L2.82 17.605C2.74304 17.514 2.67097 17.4182 2.60037 17.3243C2.57007 17.284 2.54004 17.244 2.51 17.205ZM14 8.00497H8V14.005H14V8.00497ZM4 30.005H18L22 34.005H0L4 30.005Z",
107
- clipRule: "evenodd"
108
- })
109
- }));
110
80
  const MenuAlt = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
111
81
  width: "1.25em",
112
82
  height: "1.25em",
@@ -122,19 +92,6 @@ const MenuAlt = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadVal
122
92
  clipRule: "evenodd"
123
93
  })
124
94
  }));
125
- const Mobile = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
126
- width: "1.25em",
127
- height: "1.25em",
128
- fill: "none",
129
- viewBox: "0 0 22 32",
130
- role: "img",
131
- "aria-hidden": props["aria-label"] == null
132
- }, props), {
133
- children: /* @__PURE__ */ jsx("path", {
134
- fill: "currentColor",
135
- d: "M18 0H4C2.93914 0 1.92172 0.421427 1.17157 1.17157C0.421427 1.92172 0 2.93913 0 4V28C0 29.0609 0.421427 30.0783 1.17157 30.8284C1.92172 31.5786 2.93914 32 4 32H18C19.0609 32 20.0783 31.5786 20.8284 30.8284C21.5786 30.0783 22 29.0609 22 28V4C22 2.93913 21.5786 1.92172 20.8284 1.17157C20.0783 0.421427 19.0609 0 18 0ZM13.036 28H9.036V24H13.036V28ZM16.036 20H6.036V6H16.036V20Z"
136
- })
137
- }));
138
95
  const Warning = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
139
96
  width: "1.25em",
140
97
  height: "1.25em",
@@ -722,30 +679,6 @@ const HeroActions = (props) => {
722
679
  })
723
680
  }, rest));
724
681
  };
725
- const IconLegacy = (props) => {
726
- var _b;
727
- const _a = props, {
728
- className,
729
- name
730
- } = _a, rest = __objRest(_a, [
731
- "className",
732
- "name"
733
- ]);
734
- const IconComponent = (_b = iconMap[name]) != null ? _b : IconFallback;
735
- return /* @__PURE__ */ jsx(IconComponent, __spreadValues({
736
- className: classNames(className, "inline")
737
- }, rest));
738
- };
739
- const IconFallback = (props) => /* @__PURE__ */ jsx("svg", __spreadValues({
740
- "aria-hidden": props["aria-label"] == null,
741
- height: "1.25em",
742
- width: "1.25em"
743
- }, props));
744
- const iconMap = {
745
- mapmarker: MapPin,
746
- smartphone: Mobile,
747
- envelope: Mail
748
- };
749
682
  const Input = forwardRef((props, ref) => {
750
683
  const _a = props, {
751
684
  className,
@@ -753,7 +686,7 @@ const Input = forwardRef((props, ref) => {
753
686
  size,
754
687
  prefix,
755
688
  as,
756
- type
689
+ type: typeProp
757
690
  } = _a, rest = __objRest(_a, [
758
691
  "className",
759
692
  "isInvalid",
@@ -763,7 +696,7 @@ const Input = forwardRef((props, ref) => {
763
696
  "type"
764
697
  ]);
765
698
  const Component = as != null ? as : "input";
766
- const inputType = (type != null ? type : Component === "input") ? "text" : void 0;
699
+ const type = getType(Component, typeProp);
767
700
  return /* @__PURE__ */ jsxs("div", {
768
701
  className: classNames(className, "relative flex items-center rounded-md border-[1px] border-b-[3px] focus-within:-ml-[2px] focus-within:-mt-[2px] focus-within:border-[3px] focus-within:shadow", {
769
702
  "border-gray-dark focus-within:border-blue": !isInvalid,
@@ -779,10 +712,16 @@ const Input = forwardRef((props, ref) => {
779
712
  ref,
780
713
  className: "focus:none placeholder-gray w-full rounded-md border-none px-4 py-3 outline-none",
781
714
  size,
782
- type: inputType
715
+ type
783
716
  }, rest))]
784
717
  });
785
718
  });
719
+ function getType(Component, type) {
720
+ if (type != null)
721
+ return type;
722
+ if (Component === "input")
723
+ return "text";
724
+ }
786
725
  const Link = (props) => {
787
726
  let iconClass = "";
788
727
  if (props.icon) {
@@ -987,6 +926,38 @@ const SnackbarContent = (props) => {
987
926
  children: props.children
988
927
  }));
989
928
  };
929
+ const Stepper = (props) => {
930
+ return /* @__PURE__ */ jsx("ol", __spreadValues({}, props));
931
+ };
932
+ const Step = (props) => {
933
+ const _a = props, {
934
+ className,
935
+ children,
936
+ bullet
937
+ } = _a, rest = __objRest(_a, [
938
+ "className",
939
+ "children",
940
+ "bullet"
941
+ ]);
942
+ return /* @__PURE__ */ jsxs("li", __spreadProps(__spreadValues({
943
+ className: classNames(className, "group relative flex gap-4 pb-8 text-sm last:pb-0 md:gap-8 md:pb-12 md:text-base")
944
+ }, rest), {
945
+ children: [/* @__PURE__ */ jsx(StepBullet, {
946
+ children: bullet
947
+ }), children]
948
+ }));
949
+ };
950
+ const StepBullet = (props) => {
951
+ const _a = props, {
952
+ className
953
+ } = _a, rest = __objRest(_a, [
954
+ "className"
955
+ ]);
956
+ return /* @__PURE__ */ jsx("span", __spreadValues({
957
+ "aria-hidden": true,
958
+ className: classNames(className, "text-green border-gray-light after:bg-gray-light grid h-10 w-10 flex-none place-content-center rounded-full border-2 text-sm font-bold after:absolute after:left-5 after:top-10 after:bottom-0 after:w-0.5 group-last:after:hidden md:h-20 md:w-20 md:text-xl md:after:left-10 md:after:top-20")
959
+ }, rest));
960
+ };
990
961
  const TextArea = forwardRef((props, ref) => {
991
962
  const _a = props, {
992
963
  description,
@@ -1091,4 +1062,4 @@ const TextField = forwardRef((props, ref) => {
1091
1062
  })]
1092
1063
  });
1093
1064
  });
1094
- export { Alert, Banner, BannerImage, Button, ButtonColorContext, Card, CardContent, CardImage, CardLinkOverlay, CardList, Checkbox, Footer, Form, FormError, FormErrorMessage, FormHeading, FormHelperText, FormLabel, FormSuccess, Hero, HeroActions, HeroContent, HeroContext, HeroImage, IconLegacy, Input, Link, Navbar, NavbarCollapsible, NavbarContent, NavbarExpandedMobileContent, NavbarItem, NavbarItems, Snackbar, SnackbarButton, SnackbarContent, TextArea, TextField, assignRef, useBlockBackgroundColor, useComposedRefs, useFallbackId, useFormControlValidity, useMedia, usePrefersReducedMotion, useScreenMaxWidthMd };
1065
+ export { Alert, Banner, BannerImage, Button, ButtonColorContext, Card, CardContent, CardImage, CardLinkOverlay, CardList, Checkbox, Footer, Form, FormError, FormErrorMessage, FormHeading, FormHelperText, FormLabel, FormSuccess, Hero, HeroActions, HeroContent, HeroContext, HeroImage, Input, Link, Navbar, NavbarCollapsible, NavbarContent, NavbarExpandedMobileContent, NavbarItem, NavbarItems, Snackbar, SnackbarButton, SnackbarContent, Step, StepBullet, Stepper, TextArea, TextField, assignRef, useBlockBackgroundColor, useComposedRefs, useFallbackId, useFormControlValidity, useMedia, usePrefersReducedMotion, useScreenMaxWidthMd };
package/dist/index.d.ts CHANGED
@@ -6,11 +6,11 @@ export * from './Checkbox';
6
6
  export * from './Footer';
7
7
  export * from './Form';
8
8
  export * from './Hero';
9
- export * from './IconLegacy';
10
9
  export * from './Input';
11
10
  export * from './Link';
12
11
  export * from './Navbar';
13
12
  export * from './Snackbar';
13
+ export * from './Stepper';
14
14
  export * from './TextArea';
15
15
  export * from './TextField';
16
16
  export * from './hooks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "0.2.2",
3
+ "version": "1.0.0",
4
4
  "description": "OBOS Grunnmuren design system React components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,30 +17,37 @@
17
17
  ],
18
18
  "types": "./dist/index.d.ts",
19
19
  "devDependencies": {
20
- "@babel/core": "7.17.10",
21
- "@storybook/addon-controls": "6.5.4",
22
- "@storybook/addon-docs": "6.5.4",
20
+ "@babel/core": "7.18.2",
21
+ "@obosbbl/grunnmuren-tailwind": "^0.4.0",
22
+ "@storybook/addon-controls": "6.5.5",
23
+ "@storybook/addon-docs": "6.5.5",
23
24
  "@storybook/addon-postcss": "2.0.0",
24
- "@storybook/builder-webpack5": "6.5.4",
25
- "@storybook/manager-webpack5": "6.5.4",
26
- "@storybook/react": "6.5.4",
25
+ "@storybook/builder-webpack5": "6.5.5",
26
+ "@storybook/manager-webpack5": "6.5.5",
27
+ "@storybook/react": "6.5.5",
27
28
  "@types/react": "18.0.9",
28
- "@types/react-dom": "18.0.3",
29
+ "@types/react-dom": "18.0.5",
29
30
  "@vitejs/plugin-react": "1.3.2",
30
- "postcss": "8.4.13",
31
+ "postcss": "8.4.14",
31
32
  "react": "18.1.0",
32
33
  "react-dom": "18.1.0",
34
+ "require-from-string": "2.0.2",
33
35
  "tailwindcss": "3.0.24",
34
36
  "vite": "2.9.9",
35
37
  "webpack": "5.72.1"
36
38
  },
37
39
  "dependencies": {
38
40
  "@obosbbl/grunnmuren-icons": "^0.3.0",
39
- "@obosbbl/grunnmuren-tailwind": "^0.3.1",
40
41
  "clsx": "1.1.1"
41
42
  },
42
43
  "peerDependencies": {
43
- "react": "^18"
44
+ "react": "^18",
45
+ "@obosbbl/grunnmuren-tailwind": "^0.4.0"
46
+ },
47
+ "peerDependenciesMeta": {
48
+ "@obosbbl/grunnmuren-tailwind": {
49
+ "optional": true
50
+ }
44
51
  },
45
52
  "scripts": {
46
53
  "build": "pnpm run build:lib && pnpm run build:types",
@@ -1,20 +0,0 @@
1
- /// <reference types="react" />
2
- export declare type IconName = keyof typeof iconMap;
3
- interface IconLegacyProps {
4
- className?: string;
5
- name: IconName;
6
- children?: never;
7
- }
8
- /**
9
- *
10
- * NB! This component should only be used for compatibility reasons.
11
- * It uses old icon names and it causes all the referenced icons to be inluded in the application bundle.
12
- * Import icons from @obosbbl/grunnmuren-icons instead.
13
- */
14
- export declare const IconLegacy: (props: IconLegacyProps) => JSX.Element;
15
- declare const iconMap: {
16
- readonly mapmarker: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
17
- readonly smartphone: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
18
- readonly envelope: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
19
- };
20
- export {};
@@ -1 +0,0 @@
1
- export * from './IconLegacy';