willba-component-library 0.1.13 → 0.1.14

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 (64) hide show
  1. package/.nvmrc +1 -1
  2. package/.storybook/main.ts +19 -19
  3. package/.storybook/preview.ts +15 -15
  4. package/README.md +57 -57
  5. package/lib/index.esm.js +13 -13
  6. package/lib/index.esm.js.map +1 -1
  7. package/lib/index.js +13 -13
  8. package/lib/index.js.map +1 -1
  9. package/lib/index.umd.js +13 -13
  10. package/lib/index.umd.js.map +1 -1
  11. package/package.json +51 -51
  12. package/prettier.config.js +6 -6
  13. package/rollup.config.mjs +61 -61
  14. package/src/components/Button/Button.stories.tsx +34 -34
  15. package/src/components/Button/Button.tsx +56 -56
  16. package/src/components/Button/button.css +29 -29
  17. package/src/components/Button/index.ts +1 -1
  18. package/src/components/FilterBar/FilterBar.css +83 -83
  19. package/src/components/FilterBar/FilterBar.stories.tsx +47 -47
  20. package/src/components/FilterBar/FilterBar.tsx +180 -180
  21. package/src/components/FilterBar/FilterBarTypes.ts +25 -25
  22. package/src/components/FilterBar/components/buttons/close-button/CloseButton.css +33 -33
  23. package/src/components/FilterBar/components/buttons/close-button/CloseButton.tsx +16 -16
  24. package/src/components/FilterBar/components/buttons/select-button/SelectButton.css +36 -36
  25. package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +24 -24
  26. package/src/components/FilterBar/components/buttons/submit-button/SubmitButton.css +27 -27
  27. package/src/components/FilterBar/components/buttons/submit-button/SubmitButton.tsx +18 -18
  28. package/src/components/FilterBar/components/calendar/Calendar.css +76 -76
  29. package/src/components/FilterBar/components/calendar/Calendar.tsx +52 -52
  30. package/src/components/FilterBar/components/categories/Categories.css +21 -21
  31. package/src/components/FilterBar/components/categories/Categories.tsx +41 -41
  32. package/src/components/FilterBar/components/divider/Divider.css +14 -14
  33. package/src/components/FilterBar/components/divider/Divider.tsx +7 -7
  34. package/src/components/FilterBar/components/guests/GuestCount/GuestCount.css +53 -53
  35. package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +51 -51
  36. package/src/components/FilterBar/components/guests/Guests.css +27 -27
  37. package/src/components/FilterBar/components/guests/Guests.tsx +38 -38
  38. package/src/components/FilterBar/hooks/useFilterBar.tsx +106 -106
  39. package/src/components/FilterBar/index.ts +1 -1
  40. package/src/i18n.ts +25 -25
  41. package/src/index.ts +4 -4
  42. package/src/locales/en/filterBar.json +20 -20
  43. package/src/locales/fi/filterBar.json +20 -20
  44. package/src/themes/Default.css +42 -42
  45. package/src/themes/useTheme.tsx +24 -24
  46. package/stories/Button.stories.ts +50 -50
  47. package/stories/Button.tsx +48 -48
  48. package/stories/Configure.mdx +364 -364
  49. package/stories/Header.stories.ts +27 -27
  50. package/stories/Header.tsx +56 -56
  51. package/stories/Page.stories.ts +29 -29
  52. package/stories/Page.tsx +73 -73
  53. package/stories/assets/accessibility.svg +4 -4
  54. package/stories/assets/discord.svg +15 -15
  55. package/stories/assets/github.svg +3 -3
  56. package/stories/assets/tutorials.svg +12 -12
  57. package/stories/assets/youtube.svg +4 -4
  58. package/stories/button.css +30 -30
  59. package/stories/header.css +32 -32
  60. package/stories/page.css +69 -69
  61. package/tsconfig.json +27 -27
  62. package/lib/components/FilterBar/components/close-button/CloseButton.d.ts +0 -7
  63. package/lib/components/FilterBar/components/select-button/SelectButton.d.ts +0 -3
  64. package/lib/components/FilterBar/components/submit-button/SubmitButton.d.ts +0 -3
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
- {
2
- "name": "willba-component-library",
3
- "version": "0.1.13",
4
- "description": "A stroybook 6 with TypeScript demo",
5
- "main": "lib/index.js",
6
- "module": "lib/index.esm.js",
7
- "types": "lib/index.d.ts",
8
- "scripts": {
9
- "test": "echo \"Error: no test specified\" && exit 1",
10
- "storybook": "storybook dev -p 6006",
11
- "build-storybook": "storybook build",
12
- "build": "rollup -c"
13
- },
14
- "author": "Willba",
15
- "license": "MIT",
16
- "dependencies": {
17
- "@rollup/plugin-json": "^6.0.0",
18
- "classnames": "^2.3.2",
19
- "react-day-picker": "^8.8.0",
20
- "react-i18next": "^13.1.2",
21
- "react-icons": "^4.11.0",
22
- "react-responsive": "^9.0.2"
23
- },
24
- "peerDependencies": {
25
- "react": "^18.2.0",
26
- "react-dom": "^18.2.0"
27
- },
28
- "devDependencies": {
29
- "@rollup/plugin-commonjs": "^25.0.3",
30
- "@rollup/plugin-node-resolve": "^15.1.0",
31
- "@rollup/plugin-typescript": "^11.1.2",
32
- "@storybook/addon-essentials": "^7.2.1",
33
- "@storybook/addon-interactions": "^7.2.1",
34
- "@storybook/addon-links": "^7.2.1",
35
- "@storybook/addon-onboarding": "^1.0.8",
36
- "@storybook/blocks": "^7.2.1",
37
- "@storybook/react": "^7.2.1",
38
- "@storybook/react-vite": "^7.2.1",
39
- "@storybook/testing-library": "^0.2.0",
40
- "@types/react": "^18.2.19",
41
- "postcss": "^8.4.27",
42
- "react": "^18.2.0",
43
- "react-dom": "^18.2.0",
44
- "rollup": "^3.28.0",
45
- "rollup-plugin-dts": "^5.3.1",
46
- "rollup-plugin-peer-deps-external": "^2.2.4",
47
- "rollup-plugin-postcss": "^4.0.2",
48
- "storybook": "^7.2.1",
49
- "typescript": "^5.1.6"
50
- }
51
- }
1
+ {
2
+ "name": "willba-component-library",
3
+ "version": "0.1.14",
4
+ "description": "A stroybook 6 with TypeScript demo",
5
+ "main": "lib/index.js",
6
+ "module": "lib/index.esm.js",
7
+ "types": "lib/index.d.ts",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
+ "storybook": "storybook dev -p 6006",
11
+ "build-storybook": "storybook build",
12
+ "build": "rollup -c"
13
+ },
14
+ "author": "Willba",
15
+ "license": "MIT",
16
+ "dependencies": {
17
+ "@rollup/plugin-json": "^6.0.0",
18
+ "classnames": "^2.3.2",
19
+ "react-day-picker": "^8.8.0",
20
+ "react-i18next": "^13.1.2",
21
+ "react-icons": "^4.11.0",
22
+ "react-responsive": "^9.0.2"
23
+ },
24
+ "peerDependencies": {
25
+ "react": "^18.2.0",
26
+ "react-dom": "^18.2.0"
27
+ },
28
+ "devDependencies": {
29
+ "@rollup/plugin-commonjs": "^25.0.3",
30
+ "@rollup/plugin-node-resolve": "^15.1.0",
31
+ "@rollup/plugin-typescript": "^11.1.2",
32
+ "@storybook/addon-essentials": "^7.2.1",
33
+ "@storybook/addon-interactions": "^7.2.1",
34
+ "@storybook/addon-links": "^7.2.1",
35
+ "@storybook/addon-onboarding": "^1.0.8",
36
+ "@storybook/blocks": "^7.2.1",
37
+ "@storybook/react": "^7.2.1",
38
+ "@storybook/react-vite": "^7.2.1",
39
+ "@storybook/testing-library": "^0.2.0",
40
+ "@types/react": "^18.2.19",
41
+ "postcss": "^8.4.27",
42
+ "react": "^18.2.0",
43
+ "react-dom": "^18.2.0",
44
+ "rollup": "^3.28.0",
45
+ "rollup-plugin-dts": "^5.3.1",
46
+ "rollup-plugin-peer-deps-external": "^2.2.4",
47
+ "rollup-plugin-postcss": "^4.0.2",
48
+ "storybook": "^7.2.1",
49
+ "typescript": "^5.1.6"
50
+ }
51
+ }
@@ -1,6 +1,6 @@
1
- module.exports = {
2
- arrowParens: 'always',
3
- semi: false,
4
- singleQuote: true,
5
- trailingComma: 'es5',
6
- }
1
+ module.exports = {
2
+ arrowParens: 'always',
3
+ semi: false,
4
+ singleQuote: true,
5
+ trailingComma: 'es5',
6
+ }
package/rollup.config.mjs CHANGED
@@ -1,61 +1,61 @@
1
- import peerDepsExternal from 'rollup-plugin-peer-deps-external'
2
- import resolve from '@rollup/plugin-node-resolve'
3
- import commonjs from '@rollup/plugin-commonjs'
4
- import typescript from '@rollup/plugin-typescript'
5
- import postcss from 'rollup-plugin-postcss'
6
- import dts from 'rollup-plugin-dts'
7
- import json from '@rollup/plugin-json'
8
-
9
- // This is required to read package.json file when
10
- // using Native ES modules in Node.js
11
- // https://rollupjs.org/command-line-interface/#importing-package-json
12
- import { createRequire } from 'node:module'
13
- const requireFile = createRequire(import.meta.url)
14
- const packageJson = requireFile('./package.json')
15
-
16
- const globals = {
17
- react: 'React',
18
- 'react-dom': 'ReactDOM',
19
- 'react-query': 'ReactQuery',
20
- }
21
-
22
- export default [
23
- {
24
- input: 'src/index.ts',
25
- output: [
26
- {
27
- file: packageJson.main,
28
- format: 'cjs',
29
- sourcemap: true,
30
- },
31
- {
32
- file: packageJson.module,
33
- format: 'esm',
34
- sourcemap: true,
35
- },
36
- {
37
- name: 'WillbaComponentLibrary',
38
- file: `lib/index.umd.js`,
39
- format: 'umd',
40
- sourcemap: true,
41
- globals,
42
- },
43
- ],
44
- plugins: [
45
- peerDepsExternal(),
46
- resolve(),
47
- commonjs(),
48
- typescript(),
49
- postcss({
50
- extensions: ['.css'],
51
- }),
52
- json(),
53
- ],
54
- },
55
- {
56
- input: 'lib/index.d.ts',
57
- output: [{ file: 'lib/index.d.ts', format: 'es' }],
58
- plugins: [dts()],
59
- external: [/\.css$/],
60
- },
61
- ]
1
+ import peerDepsExternal from 'rollup-plugin-peer-deps-external'
2
+ import resolve from '@rollup/plugin-node-resolve'
3
+ import commonjs from '@rollup/plugin-commonjs'
4
+ import typescript from '@rollup/plugin-typescript'
5
+ import postcss from 'rollup-plugin-postcss'
6
+ import dts from 'rollup-plugin-dts'
7
+ import json from '@rollup/plugin-json'
8
+
9
+ // This is required to read package.json file when
10
+ // using Native ES modules in Node.js
11
+ // https://rollupjs.org/command-line-interface/#importing-package-json
12
+ import { createRequire } from 'node:module'
13
+ const requireFile = createRequire(import.meta.url)
14
+ const packageJson = requireFile('./package.json')
15
+
16
+ const globals = {
17
+ react: 'React',
18
+ 'react-dom': 'ReactDOM',
19
+ 'react-query': 'ReactQuery',
20
+ }
21
+
22
+ export default [
23
+ {
24
+ input: 'src/index.ts',
25
+ output: [
26
+ {
27
+ file: packageJson.main,
28
+ format: 'cjs',
29
+ sourcemap: true,
30
+ },
31
+ {
32
+ file: packageJson.module,
33
+ format: 'esm',
34
+ sourcemap: true,
35
+ },
36
+ {
37
+ name: 'WillbaComponentLibrary',
38
+ file: `lib/index.umd.js`,
39
+ format: 'umd',
40
+ sourcemap: true,
41
+ globals,
42
+ },
43
+ ],
44
+ plugins: [
45
+ peerDepsExternal(),
46
+ resolve(),
47
+ commonjs(),
48
+ typescript(),
49
+ postcss({
50
+ extensions: ['.css'],
51
+ }),
52
+ json(),
53
+ ],
54
+ },
55
+ {
56
+ input: 'lib/index.d.ts',
57
+ output: [{ file: 'lib/index.d.ts', format: 'es' }],
58
+ plugins: [dts()],
59
+ external: [/\.css$/],
60
+ },
61
+ ]
@@ -1,34 +1,34 @@
1
- import React from "react";
2
- import type { Meta, StoryObj } from "@storybook/react";
3
- import Button from "./Button";
4
-
5
- // Default metadata of the story https://storybook.js.org/docs/react/api/csf#default-export
6
- const meta: Meta<typeof Button> = {
7
- title: "Components/Button",
8
- component: Button,
9
- argTypes: {
10
- textColor: { control: "color" },
11
- onClick: { action: "clicked" },
12
- },
13
- };
14
-
15
- export default meta;
16
-
17
- // The story type for the component https://storybook.js.org/docs/react/api/csf#named-story-exports
18
- type Story = StoryObj<typeof Button>;
19
-
20
- export const Primary: Story = {
21
- args: {
22
- label: "Primary 😃",
23
- size: "large",
24
- type: "primary",
25
- },
26
- };
27
-
28
- export const Secondary: Story = {
29
- args: {
30
- ...Primary.args,
31
- type: "secondary",
32
- label: "Secondary 😇",
33
- },
34
- };
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import Button from "./Button";
4
+
5
+ // Default metadata of the story https://storybook.js.org/docs/react/api/csf#default-export
6
+ const meta: Meta<typeof Button> = {
7
+ title: "Components/Button",
8
+ component: Button,
9
+ argTypes: {
10
+ textColor: { control: "color" },
11
+ onClick: { action: "clicked" },
12
+ },
13
+ };
14
+
15
+ export default meta;
16
+
17
+ // The story type for the component https://storybook.js.org/docs/react/api/csf#named-story-exports
18
+ type Story = StoryObj<typeof Button>;
19
+
20
+ export const Primary: Story = {
21
+ args: {
22
+ label: "Primary 😃",
23
+ size: "large",
24
+ type: "primary",
25
+ },
26
+ };
27
+
28
+ export const Secondary: Story = {
29
+ args: {
30
+ ...Primary.args,
31
+ type: "secondary",
32
+ label: "Secondary 😇",
33
+ },
34
+ };
@@ -1,56 +1,56 @@
1
- import React, { useState } from "react";
2
- import classNames from "classnames";
3
- import "./button.css";
4
-
5
- export interface ButtonProps {
6
- /**
7
- * Is this the principal call to action on the page?
8
- */
9
- type?: "primary" | "secondary";
10
- /**
11
- * What background color to use
12
- */
13
- textColor?: string;
14
- /**
15
- * How large should the button be?
16
- */
17
- size?: "small" | "medium" | "large";
18
- /**
19
- * Button contents
20
- */
21
- label: string;
22
- /**
23
- * Optional click handler
24
- */
25
- onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
26
- }
27
-
28
- /**
29
- * Primary UI component for user interaction
30
- */
31
- const Button = ({
32
- type = "primary",
33
- textColor,
34
- size = "medium",
35
- onClick,
36
- label,
37
- }: ButtonProps) => {
38
- const [theState, setTheState] = useState(4);
39
-
40
- return (
41
- <button
42
- type="button"
43
- className={classNames(
44
- "storybook-button",
45
- `storybook-button--${size}`,
46
- `storybook-button--${type}`
47
- )}
48
- style={textColor ? { color: textColor } : {}}
49
- onClick={onClick}
50
- >
51
- {`${label} ${theState}`}
52
- </button>
53
- );
54
- };
55
-
56
- export default Button;
1
+ import React, { useState } from "react";
2
+ import classNames from "classnames";
3
+ import "./button.css";
4
+
5
+ export interface ButtonProps {
6
+ /**
7
+ * Is this the principal call to action on the page?
8
+ */
9
+ type?: "primary" | "secondary";
10
+ /**
11
+ * What background color to use
12
+ */
13
+ textColor?: string;
14
+ /**
15
+ * How large should the button be?
16
+ */
17
+ size?: "small" | "medium" | "large";
18
+ /**
19
+ * Button contents
20
+ */
21
+ label: string;
22
+ /**
23
+ * Optional click handler
24
+ */
25
+ onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
26
+ }
27
+
28
+ /**
29
+ * Primary UI component for user interaction
30
+ */
31
+ const Button = ({
32
+ type = "primary",
33
+ textColor,
34
+ size = "medium",
35
+ onClick,
36
+ label,
37
+ }: ButtonProps) => {
38
+ const [theState, setTheState] = useState(4);
39
+
40
+ return (
41
+ <button
42
+ type="button"
43
+ className={classNames(
44
+ "storybook-button",
45
+ `storybook-button--${size}`,
46
+ `storybook-button--${type}`
47
+ )}
48
+ style={textColor ? { color: textColor } : {}}
49
+ onClick={onClick}
50
+ >
51
+ {`${label} ${theState}`}
52
+ </button>
53
+ );
54
+ };
55
+
56
+ export default Button;
@@ -1,30 +1,30 @@
1
- .storybook-button {
2
- font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
3
- font-weight: 700;
4
- border: 0;
5
- border-radius: 3em;
6
- cursor: pointer;
7
- display: inline-block;
8
- line-height: 1;
9
- }
10
- .storybook-button--primary {
11
- color: white;
12
- background-color: #1ea7fd;
13
- }
14
- .storybook-button--secondary {
15
- color: #333;
16
- background-color: transparent;
17
- box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
18
- }
19
- .storybook-button--small {
20
- font-size: 12px;
21
- padding: 10px 16px;
22
- }
23
- .storybook-button--medium {
24
- font-size: 14px;
25
- padding: 11px 20px;
26
- }
27
- .storybook-button--large {
28
- font-size: 16px;
29
- padding: 12px 24px;
1
+ .storybook-button {
2
+ font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
3
+ font-weight: 700;
4
+ border: 0;
5
+ border-radius: 3em;
6
+ cursor: pointer;
7
+ display: inline-block;
8
+ line-height: 1;
9
+ }
10
+ .storybook-button--primary {
11
+ color: white;
12
+ background-color: #1ea7fd;
13
+ }
14
+ .storybook-button--secondary {
15
+ color: #333;
16
+ background-color: transparent;
17
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
18
+ }
19
+ .storybook-button--small {
20
+ font-size: 12px;
21
+ padding: 10px 16px;
22
+ }
23
+ .storybook-button--medium {
24
+ font-size: 14px;
25
+ padding: 11px 20px;
26
+ }
27
+ .storybook-button--large {
28
+ font-size: 16px;
29
+ padding: 12px 24px;
30
30
  }
@@ -1 +1 @@
1
- export { default } from "./Button";
1
+ export { default } from "./Button";
@@ -1,83 +1,83 @@
1
- .will-root {
2
- z-index: 99999;
3
- width: 100%;
4
- max-height: 100vh;
5
- position: relative;
6
-
7
- }
8
-
9
- .will-filter-bar {
10
- box-sizing: border-box;
11
- position: relative;
12
- }
13
-
14
- .will-filter-bar-underlay {
15
- background-color: rgba(0,0,0,.8);
16
- position: absolute;
17
- /* top:0; */
18
- left: 0;
19
- width: 100%;
20
- height: 100%;
21
- cursor: pointer;
22
- min-height: 200vh;
23
- z-index: 88888;
24
-
25
- transform: translateY(-50%);
26
- }
27
-
28
- /* Header */
29
- .will-filter-bar-header {
30
- display: flex;
31
- justify-content: space-between;
32
- padding: 10px 20px;
33
- position: relative;
34
- z-index: 222;
35
-
36
-
37
- border-radius: 40px;
38
- background-color: var(--will-white);
39
- box-shadow: var(--will-box-shadow);
40
- }
41
-
42
- @media (max-width: 960px) {
43
- .will-filter-bar-header {
44
- flex-direction: column;
45
- padding: 20px;
46
- }
47
- }
48
-
49
- /* Container */
50
-
51
- .will-filter-bar-container {
52
- background-color: var(--will-white);
53
- min-height: 100px;
54
-
55
- padding: 90px 40px 30px 40px;
56
- position: absolute;
57
- top: 0;
58
- z-index: 111;
59
- border-radius: 25px;
60
- width: -webkit-fill-available;
61
- box-shadow: var(--will-box-shadow);
62
- }
63
-
64
- @media (max-width: 960px) {
65
- .will-root {
66
- overflow-y: auto;
67
- padding: 40px 10px;
68
- top: 15px;
69
- z-index: 0;
70
- }
71
-
72
- .will-filter-bar-container {
73
- margin-top: 20px;
74
- padding: 30px 40px;
75
- position: relative;
76
- }
77
-
78
- .will-root.isMobileAbsolute {
79
- position: relative;
80
- z-index: 99999;
81
- }
82
- }
83
-
1
+ .will-root {
2
+ z-index: 99999;
3
+ width: 100%;
4
+ max-height: 100vh;
5
+ position: relative;
6
+
7
+ }
8
+
9
+ .will-filter-bar {
10
+ box-sizing: border-box;
11
+ position: relative;
12
+ }
13
+
14
+ .will-filter-bar-underlay {
15
+ background-color: rgba(0,0,0,.8);
16
+ position: absolute;
17
+ /* top:0; */
18
+ left: 0;
19
+ width: 100%;
20
+ height: 100%;
21
+ cursor: pointer;
22
+ min-height: 200vh;
23
+ z-index: 88888;
24
+
25
+ transform: translateY(-50%);
26
+ }
27
+
28
+ /* Header */
29
+ .will-filter-bar-header {
30
+ display: flex;
31
+ justify-content: space-between;
32
+ padding: 10px 20px;
33
+ position: relative;
34
+ z-index: 222;
35
+
36
+
37
+ border-radius: 40px;
38
+ background-color: var(--will-white);
39
+ box-shadow: var(--will-box-shadow);
40
+ }
41
+
42
+ @media (max-width: 960px) {
43
+ .will-filter-bar-header {
44
+ flex-direction: column;
45
+ padding: 20px;
46
+ }
47
+ }
48
+
49
+ /* Container */
50
+
51
+ .will-filter-bar-container {
52
+ background-color: var(--will-white);
53
+ min-height: 100px;
54
+
55
+ padding: 90px 40px 30px 40px;
56
+ position: absolute;
57
+ top: 0;
58
+ z-index: 111;
59
+ border-radius: 25px;
60
+ width: -webkit-fill-available;
61
+ box-shadow: var(--will-box-shadow);
62
+ }
63
+
64
+ @media (max-width: 960px) {
65
+ .will-root {
66
+ overflow-y: auto;
67
+ padding: 40px 10px;
68
+ top: 15px;
69
+ z-index: 0;
70
+ }
71
+
72
+ .will-filter-bar-container {
73
+ margin-top: 20px;
74
+ padding: 30px 40px;
75
+ position: relative;
76
+ }
77
+
78
+ .will-root.isMobileAbsolute {
79
+ position: relative;
80
+ z-index: 99999;
81
+ }
82
+ }
83
+