willba-component-library 0.0.28 → 0.0.31

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 (43) hide show
  1. package/.storybook/main.ts +19 -19
  2. package/.storybook/preview.ts +15 -15
  3. package/lib/components/FilterBar/components/Callendar.d.ts +2 -0
  4. package/lib/components/FilterBar/components/Divider.d.ts +2 -0
  5. package/lib/components/FilterBar/components/SelectButton.d.ts +2 -0
  6. package/lib/components/FilterBar/components/SubmitButton.d.ts +2 -0
  7. package/lib/index.esm.js +17 -14
  8. package/lib/index.esm.js.map +1 -1
  9. package/lib/index.js +17 -14
  10. package/lib/index.js.map +1 -1
  11. package/lib/index.umd.js +18 -15
  12. package/lib/index.umd.js.map +1 -1
  13. package/package.json +5 -5
  14. package/rollup.config.mjs +59 -59
  15. package/src/components/Button/Button.stories.tsx +34 -34
  16. package/src/components/Button/Button.tsx +56 -56
  17. package/src/components/Button/button.css +29 -29
  18. package/src/components/Button/index.ts +1 -1
  19. package/src/components/FilterBar/FilterBar.css +2 -2
  20. package/src/components/FilterBar/FilterBar.stories.tsx +20 -20
  21. package/src/components/FilterBar/FilterBar.tsx +6 -21
  22. package/src/components/FilterBar/components/Callendar.tsx +5 -0
  23. package/src/components/FilterBar/components/Divider.tsx +5 -0
  24. package/src/components/FilterBar/components/SelectButton.tsx +9 -0
  25. package/src/components/FilterBar/components/SubmitButton.tsx +9 -0
  26. package/src/components/FilterBar/index.ts +1 -1
  27. package/src/index.ts +4 -4
  28. package/stories/Button.stories.ts +50 -50
  29. package/stories/Button.tsx +48 -48
  30. package/stories/Configure.mdx +364 -364
  31. package/stories/Header.stories.ts +27 -27
  32. package/stories/Header.tsx +56 -56
  33. package/stories/Page.stories.ts +29 -29
  34. package/stories/Page.tsx +73 -73
  35. package/stories/assets/accessibility.svg +4 -4
  36. package/stories/assets/discord.svg +15 -15
  37. package/stories/assets/github.svg +3 -3
  38. package/stories/assets/tutorials.svg +12 -12
  39. package/stories/assets/youtube.svg +4 -4
  40. package/stories/button.css +30 -30
  41. package/stories/header.css +32 -32
  42. package/stories/page.css +69 -69
  43. package/tsconfig.json +22 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.0.28",
3
+ "version": "0.0.31",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -17,8 +17,8 @@
17
17
  "classnames": "^2.3.2"
18
18
  },
19
19
  "peerDependencies": {
20
- "react": "^17.0.2",
21
- "react-dom": "^17.0.2"
20
+ "react": "^18.2.0",
21
+ "react-dom": "^18.2.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@rollup/plugin-commonjs": "^25.0.3",
@@ -34,8 +34,8 @@
34
34
  "@storybook/testing-library": "^0.2.0",
35
35
  "@types/react": "^18.2.19",
36
36
  "postcss": "^8.4.27",
37
- "react": "^17.0.2",
38
- "react-dom": "^17.0.2",
37
+ "react": "^18.2.0",
38
+ "react-dom": "^18.2.0",
39
39
  "rollup": "^3.28.0",
40
40
  "rollup-plugin-dts": "^5.3.1",
41
41
  "rollup-plugin-peer-deps-external": "^2.2.4",
package/rollup.config.mjs CHANGED
@@ -1,59 +1,59 @@
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
-
8
- // This is required to read package.json file when
9
- // using Native ES modules in Node.js
10
- // https://rollupjs.org/command-line-interface/#importing-package-json
11
- import { createRequire } from "node:module";
12
- const requireFile = createRequire(import.meta.url);
13
- const packageJson = requireFile("./package.json");
14
-
15
- const globals = {
16
- react: "React",
17
- "react-dom": "ReactDOM",
18
- "react-query": "ReactQuery",
19
- };
20
-
21
- export default [
22
- {
23
- input: "src/index.ts",
24
- output: [
25
- {
26
- file: packageJson.main,
27
- format: "cjs",
28
- sourcemap: true,
29
- },
30
- {
31
- file: packageJson.module,
32
- format: "esm",
33
- sourcemap: true,
34
- },
35
- {
36
- name: "MyComponentLibrary",
37
- file: `lib/index.umd.js`,
38
- format: "umd",
39
- sourcemap: true,
40
- globals,
41
- },
42
- ],
43
- plugins: [
44
- peerDepsExternal(),
45
- resolve(),
46
- commonjs(),
47
- typescript(),
48
- postcss({
49
- extensions: [".css"],
50
- }),
51
- ],
52
- },
53
- {
54
- input: "lib/index.d.ts",
55
- output: [{ file: "lib/index.d.ts", format: "es" }],
56
- plugins: [dts()],
57
- external: [/\.css$/],
58
- },
59
- ];
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
+
8
+ // This is required to read package.json file when
9
+ // using Native ES modules in Node.js
10
+ // https://rollupjs.org/command-line-interface/#importing-package-json
11
+ import { createRequire } from "node:module";
12
+ const requireFile = createRequire(import.meta.url);
13
+ const packageJson = requireFile("./package.json");
14
+
15
+ const globals = {
16
+ react: "React",
17
+ "react-dom": "ReactDOM",
18
+ "react-query": "ReactQuery",
19
+ };
20
+
21
+ export default [
22
+ {
23
+ input: "src/index.ts",
24
+ output: [
25
+ {
26
+ file: packageJson.main,
27
+ format: "cjs",
28
+ sourcemap: true,
29
+ },
30
+ {
31
+ file: packageJson.module,
32
+ format: "esm",
33
+ sourcemap: true,
34
+ },
35
+ {
36
+ name: "WillbaComponentLibrary",
37
+ file: `lib/index.umd.js`,
38
+ format: "umd",
39
+ sourcemap: true,
40
+ globals,
41
+ },
42
+ ],
43
+ plugins: [
44
+ peerDepsExternal(),
45
+ resolve(),
46
+ commonjs(),
47
+ typescript(),
48
+ postcss({
49
+ extensions: [".css"],
50
+ }),
51
+ ],
52
+ },
53
+ {
54
+ input: "lib/index.d.ts",
55
+ output: [{ file: "lib/index.d.ts", format: "es" }],
56
+ plugins: [dts()],
57
+ external: [/\.css$/],
58
+ },
59
+ ];
@@ -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";
@@ -19,12 +19,12 @@
19
19
  z-index: 222;
20
20
 
21
21
  border-radius: 40px;
22
- background-color: #ecf1f4;
22
+ background-color: #fff;
23
23
  box-shadow: 0px 6px 11px 0px #a7a4a480;
24
24
  }
25
25
 
26
26
  .search-widget-container {
27
- background-color: #ecf1f4;
27
+ background-color: #fff;
28
28
  min-height: 100px;
29
29
 
30
30
  padding: 90px 40px 30px 40px;
@@ -1,20 +1,20 @@
1
- import React from "react";
2
- import type { Meta, StoryObj } from "@storybook/react";
3
- import FilterBar from "./FilterBar";
4
-
5
- // Default metadata of the story https://storybook.js.org/docs/react/api/csf#default-export
6
- const meta: Meta<typeof FilterBar> = {
7
- title: "Components/FilterBar",
8
- component: FilterBar,
9
- };
10
-
11
- export default meta;
12
-
13
- // The story type for the component https://storybook.js.org/docs/react/api/csf#named-story-exports
14
- type Story = StoryObj<typeof FilterBar>;
15
-
16
- export const Primary: Story = {
17
- args: {
18
- label: "Primary 😃",
19
- },
20
- };
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import FilterBar from "./FilterBar";
4
+
5
+ // Default metadata of the story https://storybook.js.org/docs/react/api/csf#default-export
6
+ const meta: Meta<typeof FilterBar> = {
7
+ title: "Components/FilterBar",
8
+ component: FilterBar,
9
+ };
10
+
11
+ export default meta;
12
+
13
+ // The story type for the component https://storybook.js.org/docs/react/api/csf#named-story-exports
14
+ type Story = StoryObj<typeof FilterBar>;
15
+
16
+ export const Primary: Story = {
17
+ args: {
18
+ label: "Primary 😃",
19
+ },
20
+ };
@@ -1,11 +1,16 @@
1
1
  import React, { useState } from "react";
2
+
3
+ import Divider from "./components/Divider";
4
+ import SelectButton from "./components/SelectButton";
5
+ import SubmitButton from "./components/SubmitButton";
6
+
2
7
  import "./FilterBar.css";
3
8
 
4
9
  export default function FilterBar() {
5
10
  const [selectedFilter, setSelectedFilter] = useState<number | boolean>(false);
6
11
  // const [startDate, setStartDate] = useState(0);
7
12
  // const [endDate, setEndDate] = useState(0);
8
- const [guestsAdults, setGuestsAdults] = useState(0);
13
+ const [guestsAdults, setGuestsAdults] = useState(1);
9
14
  const [guestsKids, setGuestsKids] = useState(0);
10
15
  const [categories, setCategories] = useState(0);
11
16
 
@@ -80,26 +85,6 @@ export default function FilterBar() {
80
85
  );
81
86
  }
82
87
 
83
- const Divider = () => {
84
- return <div className="search-widget-divider" />;
85
- };
86
-
87
- const SubmitButton = ({ onClick }: any) => {
88
- return (
89
- <button className="search-widget-submit-button" onClick={onClick}>
90
- Apply filters
91
- </button>
92
- );
93
- };
94
-
95
- const SelectButton = ({ label, onClick }: any) => {
96
- return (
97
- <button className="search-widget-select-button" onClick={onClick}>
98
- {label}
99
- </button>
100
- );
101
- };
102
-
103
88
  const StartDate = () => {
104
89
  return <div>Start date</div>;
105
90
  };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+
3
+ export default function Calendar() {
4
+ return <div>calendar</div>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+
3
+ export default function Divider() {
4
+ return <div className="search-widget-divider" />;
5
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+
3
+ export default function SelectButton({ label, onClick }: any) {
4
+ return (
5
+ <button className="search-widget-select-button" onClick={onClick}>
6
+ {label}
7
+ </button>
8
+ );
9
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+
3
+ export default function SubmitButton({ onClick }: any) {
4
+ return (
5
+ <button className="search-widget-submit-button" onClick={onClick}>
6
+ Apply filters
7
+ </button>
8
+ );
9
+ }
@@ -1 +1 @@
1
- export { default } from "./FilterBar";
1
+ export { default } from "./FilterBar";
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Button from "./components/Button";
2
- import FilterBar from "./components/FilterBar";
3
-
4
- export { Button, FilterBar };
1
+ import Button from "./components/Button";
2
+ import FilterBar from "./components/FilterBar";
3
+
4
+ export { Button, FilterBar };
@@ -1,50 +1,50 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
-
3
- import { Button } from './Button';
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
- const meta = {
7
- title: 'Example/Button',
8
- component: Button,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
- layout: 'centered',
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
- tags: ['autodocs'],
15
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
16
- argTypes: {
17
- backgroundColor: { control: 'color' },
18
- },
19
- } satisfies Meta<typeof Button>;
20
-
21
- export default meta;
22
- type Story = StoryObj<typeof meta>;
23
-
24
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
25
- export const Primary: Story = {
26
- args: {
27
- primary: true,
28
- label: 'Button',
29
- },
30
- };
31
-
32
- export const Secondary: Story = {
33
- args: {
34
- label: 'Button',
35
- },
36
- };
37
-
38
- export const Large: Story = {
39
- args: {
40
- size: 'large',
41
- label: 'Button',
42
- },
43
- };
44
-
45
- export const Small: Story = {
46
- args: {
47
- size: 'small',
48
- label: 'Button',
49
- },
50
- };
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Button } from './Button';
4
+
5
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
+ const meta = {
7
+ title: 'Example/Button',
8
+ component: Button,
9
+ parameters: {
10
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
+ layout: 'centered',
12
+ },
13
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
+ tags: ['autodocs'],
15
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
16
+ argTypes: {
17
+ backgroundColor: { control: 'color' },
18
+ },
19
+ } satisfies Meta<typeof Button>;
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
25
+ export const Primary: Story = {
26
+ args: {
27
+ primary: true,
28
+ label: 'Button',
29
+ },
30
+ };
31
+
32
+ export const Secondary: Story = {
33
+ args: {
34
+ label: 'Button',
35
+ },
36
+ };
37
+
38
+ export const Large: Story = {
39
+ args: {
40
+ size: 'large',
41
+ label: 'Button',
42
+ },
43
+ };
44
+
45
+ export const Small: Story = {
46
+ args: {
47
+ size: 'small',
48
+ label: 'Button',
49
+ },
50
+ };