@obosbbl/grunnmuren-react 0.1.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.
Files changed (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/Alert/Alert.d.ts +9 -0
  4. package/dist/Alert/index.d.ts +1 -0
  5. package/dist/Banner/Banner.d.ts +11 -0
  6. package/dist/Banner/BannerImage.d.ts +6 -0
  7. package/dist/Banner/index.d.ts +2 -0
  8. package/dist/Button/Button.d.ts +14 -0
  9. package/dist/Button/ButtonColorContext.d.ts +3 -0
  10. package/dist/Button/index.d.ts +2 -0
  11. package/dist/Card/Card.d.ts +8 -0
  12. package/dist/Card/CardContent.d.ts +5 -0
  13. package/dist/Card/CardImage.d.ts +7 -0
  14. package/dist/Card/CardLinkOverlay.d.ts +4 -0
  15. package/dist/Card/CardList.d.ts +7 -0
  16. package/dist/Card/index.d.ts +5 -0
  17. package/dist/Checkbox/Checkbox.d.ts +9 -0
  18. package/dist/Checkbox/index.d.ts +1 -0
  19. package/dist/Footer/Footer.d.ts +7 -0
  20. package/dist/Footer/index.d.ts +1 -0
  21. package/dist/Form/Form.d.ts +9 -0
  22. package/dist/Form/FormError.d.ts +4 -0
  23. package/dist/Form/FormErrorMessage.d.ts +5 -0
  24. package/dist/Form/FormHelperText.d.ts +5 -0
  25. package/dist/Form/FormLabel.d.ts +6 -0
  26. package/dist/Form/FormSuccess.d.ts +6 -0
  27. package/dist/Form/index.d.ts +6 -0
  28. package/dist/Hero/Hero.d.ts +21 -0
  29. package/dist/Hero/HeroActions.d.ts +7 -0
  30. package/dist/Hero/HeroContent.d.ts +9 -0
  31. package/dist/Hero/HeroImage.d.ts +8 -0
  32. package/dist/Hero/index.d.ts +4 -0
  33. package/dist/Hero/utils.d.ts +2 -0
  34. package/dist/IconLegacy/IconLegacy.d.ts +20 -0
  35. package/dist/IconLegacy/index.d.ts +1 -0
  36. package/dist/Input/Input.d.ts +8 -0
  37. package/dist/Input/index.d.ts +1 -0
  38. package/dist/Link/Link.d.ts +8 -0
  39. package/dist/Link/index.d.ts +1 -0
  40. package/dist/Navbar/Navbar.d.ts +6 -0
  41. package/dist/Navbar/NavbarCollapsible.d.ts +6 -0
  42. package/dist/Navbar/NavbarContent.d.ts +7 -0
  43. package/dist/Navbar/NavbarContext.d.ts +6 -0
  44. package/dist/Navbar/NavbarExpandedMobileContent.d.ts +9 -0
  45. package/dist/Navbar/NavbarItem.d.ts +7 -0
  46. package/dist/Navbar/NavbarItems.d.ts +6 -0
  47. package/dist/Navbar/NavbarMenuButton.d.ts +5 -0
  48. package/dist/Navbar/index.d.ts +6 -0
  49. package/dist/Select/Select.d.ts +7 -0
  50. package/dist/Select/index.d.ts +1 -0
  51. package/dist/Snackbar/Snackbar.d.ts +8 -0
  52. package/dist/Snackbar/SnackbarButton.d.ts +6 -0
  53. package/dist/Snackbar/SnackbarContent.d.ts +5 -0
  54. package/dist/Snackbar/index.d.ts +3 -0
  55. package/dist/TextArea/TextArea.d.ts +11 -0
  56. package/dist/TextArea/index.d.ts +1 -0
  57. package/dist/TextField/TextField.d.ts +12 -0
  58. package/dist/TextField/index.d.ts +1 -0
  59. package/dist/grunnmuren.es.js +1078 -0
  60. package/dist/hooks/index.d.ts +7 -0
  61. package/dist/hooks/useBlockBackgroundColor.d.ts +2 -0
  62. package/dist/hooks/useComposedRefs.d.ts +25 -0
  63. package/dist/hooks/useFallbackId.d.ts +4 -0
  64. package/dist/hooks/useFormControlValidity.d.ts +14 -0
  65. package/dist/hooks/useMedia.d.ts +1 -0
  66. package/dist/hooks/usePrefersReducedMotion.d.ts +1 -0
  67. package/dist/hooks/useScreenMaxWidthMd.d.ts +1 -0
  68. package/dist/index.d.ts +16 -0
  69. package/package.json +51 -0
@@ -0,0 +1,7 @@
1
+ export * from './useComposedRefs';
2
+ export * from './usePrefersReducedMotion';
3
+ export * from './useBlockBackgroundColor';
4
+ export * from './useMedia';
5
+ export * from './useScreenMaxWidthMd';
6
+ export * from './useFormControlValidity';
7
+ export * from './useFallbackId';
@@ -0,0 +1,2 @@
1
+ export declare type BlockBackgroundColor = 'yellow' | 'gray' | 'blue' | 'green';
2
+ export declare function useBlockBackgroundColor(blockBgColor: BlockBackgroundColor | undefined): string | undefined;
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * React.Ref uses the readonly type `React.RefObject` instead of
4
+ * `React.MutableRefObject`, We pretty much always assume ref objects are
5
+ * mutable (at least when we create them), so this type is a workaround so some
6
+ * of the weird mechanics of using refs with TS.
7
+ */
8
+ export declare type AssignableRef<ValueType> = {
9
+ bivarianceHack(instance: ValueType | null): void;
10
+ }['bivarianceHack'] | React.MutableRefObject<ValueType | null>;
11
+ /**
12
+ * Passes or assigns an arbitrary value to a ref function or object.
13
+ *
14
+ * @param ref
15
+ * @param value
16
+ */
17
+ export declare function assignRef<RefValueType = unknown>(ref: AssignableRef<RefValueType> | null | undefined, value: any): void;
18
+ /**
19
+ * Passes or assigns a value to multiple refs (typically a DOM node). Useful for
20
+ * dealing with components that need an explicit ref for DOM calculations but
21
+ * also forwards refs assigned by an app.
22
+ *
23
+ * @param refs Refs to fork
24
+ */
25
+ export declare function useComposedRefs<RefValueType = unknown>(...refs: (AssignableRef<RefValueType> | null | undefined)[]): (node: unknown) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A wrapper around useId that returns the supplied id parameter or generates one if necessary
3
+ */
4
+ export declare function useFallbackId(id?: string): string;
@@ -0,0 +1,14 @@
1
+ import { RefObject } from 'react';
2
+ declare type Validity = 'indeterminate' | 'invalid' | 'valid';
3
+ /**
4
+ * Browser validation as it should be. "Invalid" only triggers after the user has blurred an input, or attempted
5
+ * to submit the form.
6
+ *
7
+ * NB! Currently this only works with uncontrolled components
8
+ */
9
+ export declare function useFormControlValidity(ref: RefObject<HTMLElement & {
10
+ checkValidity(): boolean;
11
+ }>): {
12
+ validity: Validity;
13
+ };
14
+ export {};
@@ -0,0 +1 @@
1
+ export declare function useMedia(query: string): boolean;
@@ -0,0 +1 @@
1
+ export declare const usePrefersReducedMotion: () => boolean;
@@ -0,0 +1 @@
1
+ export declare const useScreenMaxWidthMd: () => boolean;
@@ -0,0 +1,16 @@
1
+ export * from './Alert';
2
+ export * from './Banner';
3
+ export * from './Button';
4
+ export * from './Card';
5
+ export * from './Checkbox';
6
+ export * from './Footer';
7
+ export * from './Form';
8
+ export * from './Hero';
9
+ export * from './IconLegacy';
10
+ export * from './Input';
11
+ export * from './Link';
12
+ export * from './Navbar';
13
+ export * from './Snackbar';
14
+ export * from './TextArea';
15
+ export * from './TextField';
16
+ export * from './hooks';
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@obosbbl/grunnmuren-react",
3
+ "version": "0.1.0",
4
+ "description": "OBOS Grunnmuren design system React components",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "url": "https://github.com/code-obos/grunnmuren",
8
+ "directory": "packages/react"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/grunnmuren.es.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "types": "./dist/index.d.ts",
19
+ "devDependencies": {
20
+ "@babel/core": "7.17.10",
21
+ "@storybook/addon-controls": "6.4.22",
22
+ "@storybook/addon-docs": "6.4.22",
23
+ "@storybook/addon-postcss": "2.0.0",
24
+ "@storybook/builder-webpack5": "6.4.22",
25
+ "@storybook/manager-webpack5": "6.4.22",
26
+ "@storybook/react": "6.4.22",
27
+ "@types/react": "18.0.9",
28
+ "@types/react-dom": "18.0.3",
29
+ "@vitejs/plugin-react": "1.3.2",
30
+ "postcss": "8.4.13",
31
+ "react": "18.1.0",
32
+ "react-dom": "18.1.0",
33
+ "tailwindcss": "3.0.24",
34
+ "vite": "2.9.9"
35
+ },
36
+ "dependencies": {
37
+ "@obosbbl/grunnmuren-icons": "^0.3.0",
38
+ "@obosbbl/grunnmuren-tailwind": "^0.2.0",
39
+ "clsx": "1.1.1"
40
+ },
41
+ "peerDependencies": {
42
+ "react": "^18"
43
+ },
44
+ "scripts": {
45
+ "build": "pnpm run build:lib && pnpm run build:types",
46
+ "build:lib": "vite build",
47
+ "build:types": "tsc --emitDeclarationOnly --declaration",
48
+ "dev": "start-storybook -p 6006 --ci",
49
+ "build:storybook": "build-storybook"
50
+ }
51
+ }