willba-component-library 0.1.12 → 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 (66) 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/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +3 -0
  6. package/lib/index.esm.js +124 -117
  7. package/lib/index.esm.js.map +1 -1
  8. package/lib/index.js +124 -117
  9. package/lib/index.js.map +1 -1
  10. package/lib/index.umd.js +124 -117
  11. package/lib/index.umd.js.map +1 -1
  12. package/package.json +51 -51
  13. package/prettier.config.js +6 -6
  14. package/rollup.config.mjs +61 -61
  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 +83 -83
  20. package/src/components/FilterBar/FilterBar.stories.tsx +47 -47
  21. package/src/components/FilterBar/FilterBar.tsx +180 -171
  22. package/src/components/FilterBar/FilterBarTypes.ts +25 -25
  23. package/src/components/FilterBar/components/{close-button → buttons/close-button}/CloseButton.css +33 -30
  24. package/src/components/FilterBar/components/{close-button → buttons/close-button}/CloseButton.tsx +16 -16
  25. package/src/components/FilterBar/components/{select-button → buttons/select-button}/SelectButton.css +36 -20
  26. package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +24 -0
  27. package/src/components/FilterBar/components/{submit-button → buttons/submit-button}/SubmitButton.css +27 -27
  28. package/src/components/FilterBar/components/{submit-button → buttons/submit-button}/SubmitButton.tsx +18 -18
  29. package/src/components/FilterBar/components/calendar/Calendar.css +76 -76
  30. package/src/components/FilterBar/components/calendar/Calendar.tsx +52 -54
  31. package/src/components/FilterBar/components/categories/Categories.css +21 -21
  32. package/src/components/FilterBar/components/categories/Categories.tsx +41 -41
  33. package/src/components/FilterBar/components/divider/Divider.css +14 -14
  34. package/src/components/FilterBar/components/divider/Divider.tsx +7 -7
  35. package/src/components/FilterBar/components/guests/GuestCount/GuestCount.css +53 -53
  36. package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +51 -51
  37. package/src/components/FilterBar/components/guests/Guests.css +27 -27
  38. package/src/components/FilterBar/components/guests/Guests.tsx +38 -38
  39. package/src/components/FilterBar/hooks/useFilterBar.tsx +106 -106
  40. package/src/components/FilterBar/index.ts +1 -1
  41. package/src/i18n.ts +25 -25
  42. package/src/index.ts +4 -4
  43. package/src/locales/en/filterBar.json +20 -20
  44. package/src/locales/fi/filterBar.json +20 -20
  45. package/src/themes/Default.css +42 -42
  46. package/src/themes/useTheme.tsx +24 -24
  47. package/stories/Button.stories.ts +50 -50
  48. package/stories/Button.tsx +48 -48
  49. package/stories/Configure.mdx +364 -364
  50. package/stories/Header.stories.ts +27 -27
  51. package/stories/Header.tsx +56 -56
  52. package/stories/Page.stories.ts +29 -29
  53. package/stories/Page.tsx +73 -73
  54. package/stories/assets/accessibility.svg +4 -4
  55. package/stories/assets/discord.svg +15 -15
  56. package/stories/assets/github.svg +3 -3
  57. package/stories/assets/tutorials.svg +12 -12
  58. package/stories/assets/youtube.svg +4 -4
  59. package/stories/button.css +30 -30
  60. package/stories/header.css +32 -32
  61. package/stories/page.css +69 -69
  62. package/tsconfig.json +27 -27
  63. package/lib/components/FilterBar/components/select-button/SelectButton.d.ts +0 -3
  64. package/src/components/FilterBar/components/select-button/SelectButton.tsx +0 -15
  65. /package/lib/components/FilterBar/components/{close-button → buttons/close-button}/CloseButton.d.ts +0 -0
  66. /package/lib/components/FilterBar/components/{submit-button → buttons/submit-button}/SubmitButton.d.ts +0 -0
@@ -0,0 +1,24 @@
1
+ import React from 'react'
2
+
3
+ import './SelectButton.css'
4
+
5
+ export default function SelectButton({ label, onClick, style, date }: any) {
6
+ return (
7
+ <button
8
+ className="will-filter-bar-select-button"
9
+ onClick={onClick}
10
+ style={style}
11
+ >
12
+ <span className="select-button-wrapper">
13
+ <span className="select-button-label">{label}</span>
14
+
15
+ {!!date && (
16
+ <>
17
+ <span className="select-button-divider">|</span>
18
+ <span className="select-button-date"> {date}</span>
19
+ </>
20
+ )}
21
+ </span>
22
+ </button>
23
+ )
24
+ }
@@ -1,27 +1,27 @@
1
- .will-filter-bar-submit-button {
2
- width: auto;
3
- height: auto;
4
- background-color: var(--will-primary);
5
- color: var(--will-white);
6
- padding: 10px 20px;
7
- border-radius: 20px;
8
- cursor: pointer;
9
- border: none;
10
- white-space: nowrap;
11
- text-transform: uppercase;
12
- font-size: 12px;
13
- display: flex;
14
- align-items: center;
15
- }
16
-
17
- .will-filter-bar-submit-button span {
18
- margin-right: 10px;
19
- display: flex;
20
- }
21
-
22
- @media (max-width: 960px) {
23
- .will-filter-bar-submit-button {
24
- justify-content: center;
25
- margin-bottom: 15px;
26
- }
27
- }
1
+ .will-filter-bar-submit-button {
2
+ width: auto;
3
+ height: auto;
4
+ background-color: var(--will-primary);
5
+ color: var(--will-white);
6
+ padding: 10px 20px;
7
+ border-radius: 20px;
8
+ cursor: pointer;
9
+ border: none;
10
+ white-space: nowrap;
11
+ text-transform: uppercase;
12
+ font-size: 12px;
13
+ display: flex;
14
+ align-items: center;
15
+ }
16
+
17
+ .will-filter-bar-submit-button span {
18
+ margin-right: 10px;
19
+ display: flex;
20
+ }
21
+
22
+ @media (max-width: 960px) {
23
+ .will-filter-bar-submit-button {
24
+ justify-content: center;
25
+ margin-bottom: 15px;
26
+ }
27
+ }
@@ -1,18 +1,18 @@
1
- import React from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { FaSearch } from 'react-icons/fa'
4
-
5
- import './SubmitButton.css'
6
-
7
- export default function SubmitButton({ onClick }: any) {
8
- const { t } = useTranslation('filterBar')
9
-
10
- return (
11
- <button className="will-filter-bar-submit-button" onClick={onClick}>
12
- <span>
13
- <FaSearch />
14
- </span>
15
- {t('submit.label')}
16
- </button>
17
- )
18
- }
1
+ import React from 'react'
2
+ import { useTranslation } from 'react-i18next'
3
+ import { FaSearch } from 'react-icons/fa'
4
+
5
+ import './SubmitButton.css'
6
+
7
+ export default function SubmitButton({ onClick }: any) {
8
+ const { t } = useTranslation('filterBar')
9
+
10
+ return (
11
+ <button className="will-filter-bar-submit-button" onClick={onClick}>
12
+ <span>
13
+ <FaSearch />
14
+ </span>
15
+ {t('submit.label')}
16
+ </button>
17
+ )
18
+ }
@@ -1,76 +1,76 @@
1
- /* .will-filter-bar-calendar {} */
2
-
3
- .will-calendar-filter-header {
4
- padding: 15px 0;
5
- border-bottom: 1px solid var(--will-grey);
6
- }
7
-
8
- .will-calendar-filter-title {
9
- font-size: 16px;
10
- text-transform: uppercase;
11
- margin: 10px 0;
12
- text-align: left;
13
- }
14
-
15
- .will-calendar-filter-container {
16
- display: flex;
17
- justify-content: center;
18
- padding-top: 20px;
19
- }
20
-
21
- /* Calendar overrides */
22
-
23
- .will-calendar-filter-container .DayPicker {
24
- font-size: 25px; /* Adjust this value to make the DayPicker bigger */
25
- }
26
-
27
- .will-calendar-filter-container .rdp-month {
28
- position: relative;
29
- }
30
-
31
- .will-calendar-filter-container .rdp-month.rdp-caption_start {
32
- padding-left: 70px;
33
- }
34
-
35
- .will-calendar-filter-container .rdp-month.rdp-caption_end {
36
- padding-right: 70px;
37
- }
38
-
39
- .will-calendar-filter-container .rdp-month .rdp-nav {
40
- border: 1px solid var(--will-primary);
41
- border-radius: 50%;
42
- left: 25;
43
- }
44
-
45
- .will-calendar-filter-container .rdp-month .rdp-nav svg {
46
- color: var(--will-primary);
47
- }
48
-
49
-
50
- .will-calendar-filter-container .rdp-month .rdp-caption {
51
- position: initial;
52
- }
53
-
54
- .will-calendar-filter-container .rdp-month .rdp-caption > .rdp-caption_label,
55
- .will-calendar-filter-container .rdp-table .rdp-head {
56
- opacity: .6;
57
- }
58
-
59
- .will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day {
60
- opacity: 0.7;
61
- }
62
-
63
- .will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day.rdp-day_selected {
64
- background-color: var(--will-primary);
65
- opacity: 1;
66
- }
67
-
68
- @media (max-width: 960px) {
69
- .will-calendar-filter-container .rdp-month .rdp-nav {
70
- border: none;
71
- border-radius: initial;
72
-
73
- }
74
- }
75
-
76
-
1
+ /* .will-filter-bar-calendar {} */
2
+
3
+ .will-calendar-filter-header {
4
+ padding: 15px 0;
5
+ border-bottom: 1px solid var(--will-grey);
6
+ }
7
+
8
+ .will-calendar-filter-title {
9
+ font-size: 16px;
10
+ text-transform: uppercase;
11
+ margin: 10px 0;
12
+ text-align: left;
13
+ }
14
+
15
+ .will-calendar-filter-container {
16
+ display: flex;
17
+ justify-content: center;
18
+ padding-top: 20px;
19
+ }
20
+
21
+ /* Calendar overrides */
22
+
23
+ .will-calendar-filter-container .DayPicker {
24
+ font-size: 25px; /* Adjust this value to make the DayPicker bigger */
25
+ }
26
+
27
+ .will-calendar-filter-container .rdp-month {
28
+ position: relative;
29
+ }
30
+
31
+ .will-calendar-filter-container .rdp-month.rdp-caption_start {
32
+ padding-left: 70px;
33
+ }
34
+
35
+ .will-calendar-filter-container .rdp-month.rdp-caption_end {
36
+ padding-right: 70px;
37
+ }
38
+
39
+ .will-calendar-filter-container .rdp-month .rdp-nav {
40
+ border: 1px solid var(--will-primary);
41
+ border-radius: 50%;
42
+ left: 25;
43
+ }
44
+
45
+ .will-calendar-filter-container .rdp-month .rdp-nav svg {
46
+ color: var(--will-primary);
47
+ }
48
+
49
+
50
+ .will-calendar-filter-container .rdp-month .rdp-caption {
51
+ position: initial;
52
+ }
53
+
54
+ .will-calendar-filter-container .rdp-month .rdp-caption > .rdp-caption_label,
55
+ .will-calendar-filter-container .rdp-table .rdp-head {
56
+ opacity: .6;
57
+ }
58
+
59
+ .will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day {
60
+ opacity: 0.7;
61
+ }
62
+
63
+ .will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day.rdp-day_selected {
64
+ background-color: var(--will-primary);
65
+ opacity: 1;
66
+ }
67
+
68
+ @media (max-width: 960px) {
69
+ .will-calendar-filter-container .rdp-month .rdp-nav {
70
+ border: none;
71
+ border-radius: initial;
72
+
73
+ }
74
+ }
75
+
76
+
@@ -1,54 +1,52 @@
1
- import React, { useEffect } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { DateRange, DayPicker } from 'react-day-picker'
4
- import { addDays } from 'date-fns'
5
- import { useMediaQuery } from 'react-responsive'
6
-
7
- import 'react-day-picker/dist/style.css'
8
- import './Calendar.css'
9
-
10
- interface CalendarPropsType {
11
- calendarRange: DateRange | undefined
12
- setCalendarRange: (range: DateRange | undefined) => void
13
- }
14
-
15
- const currentMonth = new Date()
16
-
17
- export default function Calendar({
18
- calendarRange,
19
- setCalendarRange,
20
- }: CalendarPropsType) {
21
- const { t } = useTranslation('filterBar')
22
- const isTablet = useMediaQuery({ maxWidth: 960 })
23
-
24
- const defaultCalendarSelected: DateRange = {
25
- from: currentMonth,
26
- to: addDays(currentMonth, 0),
27
- }
28
-
29
- useEffect(() => {
30
- if (!calendarRange) setCalendarRange(defaultCalendarSelected)
31
- }, [])
32
-
33
- return (
34
- <div className="will-filter-bar-calendar">
35
- <div className="will-calendar-filter-header">
36
- <h3 className="will-calendar-filter-title">{t('calendar.title')}</h3>
37
- </div>
38
- <div className="will-calendar-filter-container">
39
- <DayPicker
40
- id="will-calendar"
41
- mode="range"
42
- showOutsideDays
43
- fixedWeeks
44
- numberOfMonths={!isTablet ? 2 : 1}
45
- weekStartsOn={1}
46
- max={31}
47
- defaultMonth={currentMonth}
48
- selected={calendarRange}
49
- onSelect={setCalendarRange}
50
- />
51
- </div>
52
- </div>
53
- )
54
- }
1
+ import React, { useEffect } from 'react'
2
+ //import { useTranslation } from 'react-i18next'
3
+ import { DateRange, DayPicker } from 'react-day-picker'
4
+ import { addDays } from 'date-fns'
5
+ import { useMediaQuery } from 'react-responsive'
6
+
7
+ import 'react-day-picker/dist/style.css'
8
+ import './Calendar.css'
9
+
10
+ interface CalendarPropsType {
11
+ calendarRange: DateRange | undefined
12
+ setCalendarRange: (range: DateRange | undefined) => void
13
+ }
14
+
15
+ const currentMonth = new Date()
16
+
17
+ export default function Calendar({
18
+ calendarRange,
19
+ setCalendarRange,
20
+ }: CalendarPropsType) {
21
+ //const { t } = useTranslation('filterBar')
22
+ const isTablet = useMediaQuery({ maxWidth: 960 })
23
+
24
+ const defaultCalendarSelected: DateRange = {
25
+ from: currentMonth,
26
+ to: addDays(currentMonth, 0),
27
+ }
28
+
29
+ useEffect(() => {
30
+ if (!calendarRange) setCalendarRange(defaultCalendarSelected)
31
+ }, [])
32
+
33
+ return (
34
+ <div className="will-filter-bar-calendar">
35
+ {/* <div className="will-calendar-filter-header">
36
+ <h3 className="will-calendar-filter-title">{t('calendar.title')}</h3>
37
+ </div> */}
38
+ <div className="will-calendar-filter-container">
39
+ <DayPicker
40
+ id="will-calendar"
41
+ mode="range"
42
+ showOutsideDays
43
+ numberOfMonths={!isTablet ? 2 : 1}
44
+ weekStartsOn={1}
45
+ defaultMonth={currentMonth}
46
+ selected={calendarRange}
47
+ onSelect={setCalendarRange}
48
+ />
49
+ </div>
50
+ </div>
51
+ )
52
+ }
@@ -1,21 +1,21 @@
1
- .will-filter-bar-categories {
2
- text-align: center;
3
- }
4
-
5
- .will-categories-filter-title {
6
- font-size: 16px;
7
- text-transform: uppercase;
8
- margin: 10px 0 30px 0;
9
- }
10
-
11
- .will-categories-filter-inner {
12
- display: flex;
13
- align-items: center;
14
- justify-content: center;
15
- gap: 20px;
16
- }
17
-
18
- .will-categories-filter-inner input {
19
- cursor: pointer;
20
- margin-right: 10px;
21
- }
1
+ .will-filter-bar-categories {
2
+ text-align: center;
3
+ }
4
+
5
+ .will-categories-filter-title {
6
+ font-size: 16px;
7
+ text-transform: uppercase;
8
+ margin: 10px 0 30px 0;
9
+ }
10
+
11
+ .will-categories-filter-inner {
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ gap: 20px;
16
+ }
17
+
18
+ .will-categories-filter-inner input {
19
+ cursor: pointer;
20
+ margin-right: 10px;
21
+ }
@@ -1,41 +1,41 @@
1
- import React, { useState } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
-
4
- import './Categories.css'
5
-
6
- export default function Categories({ categories, setCategories }: any) {
7
- const { t } = useTranslation('filterBar')
8
-
9
- const categoriesPlaceholder = [
10
- 'Weekend',
11
- 'Week',
12
- 'Summer camp',
13
- 'Winter camp',
14
- ]
15
-
16
- const [selectedCategory, setSelectedCategory] = useState('')
17
-
18
- const handleCategoryChange = (selectedCategory: any) => {
19
- setSelectedCategory(selectedCategory)
20
- setCategories(selectedCategory)
21
- }
22
-
23
- return (
24
- <div className="will-filter-bar-categories">
25
- <h3 className="will-categories-filter-title">{t('categories.label')}</h3>
26
- <div className="will-categories-filter-inner">
27
- {categoriesPlaceholder.map((itm, idx) => (
28
- <div key={idx}>
29
- <input
30
- type="radio"
31
- value={itm}
32
- checked={selectedCategory === itm}
33
- onChange={() => handleCategoryChange(itm)}
34
- />
35
- <span>{itm}</span>
36
- </div>
37
- ))}
38
- </div>
39
- </div>
40
- )
41
- }
1
+ import React, { useState } from 'react'
2
+ import { useTranslation } from 'react-i18next'
3
+
4
+ import './Categories.css'
5
+
6
+ export default function Categories({ categories, setCategories }: any) {
7
+ const { t } = useTranslation('filterBar')
8
+
9
+ const categoriesPlaceholder = [
10
+ 'Weekend',
11
+ 'Week',
12
+ 'Summer camp',
13
+ 'Winter camp',
14
+ ]
15
+
16
+ const [selectedCategory, setSelectedCategory] = useState('')
17
+
18
+ const handleCategoryChange = (selectedCategory: any) => {
19
+ setSelectedCategory(selectedCategory)
20
+ setCategories(selectedCategory)
21
+ }
22
+
23
+ return (
24
+ <div className="will-filter-bar-categories">
25
+ <h3 className="will-categories-filter-title">{t('categories.label')}</h3>
26
+ <div className="will-categories-filter-inner">
27
+ {categoriesPlaceholder.map((itm, idx) => (
28
+ <div key={idx}>
29
+ <input
30
+ type="radio"
31
+ value={itm}
32
+ checked={selectedCategory === itm}
33
+ onChange={() => handleCategoryChange(itm)}
34
+ />
35
+ <span>{itm}</span>
36
+ </div>
37
+ ))}
38
+ </div>
39
+ </div>
40
+ )
41
+ }
@@ -1,15 +1,15 @@
1
- .will-filter-bar-divider {
2
- width: 1px;
3
- margin: 0 10px;
4
- height: 35px;
5
- background-color: #384265;
6
- }
7
-
8
- @media (max-width: 960px) {
9
- .will-filter-bar-divider {
10
- width: 100%;
11
- margin: 0 10px;
12
- height: 1px;
13
- background-color: #384265;
14
- }
1
+ .will-filter-bar-divider {
2
+ width: 1px;
3
+ margin: 0 10px;
4
+ height: 35px;
5
+ background-color: #384265;
6
+ }
7
+
8
+ @media (max-width: 960px) {
9
+ .will-filter-bar-divider {
10
+ width: 100%;
11
+ margin: 0 10px;
12
+ height: 1px;
13
+ background-color: #384265;
14
+ }
15
15
  }
@@ -1,7 +1,7 @@
1
- import React from 'react'
2
-
3
- import './Divider.css'
4
-
5
- export default function Divider() {
6
- return <div className="will-filter-bar-divider" />
7
- }
1
+ import React from 'react'
2
+
3
+ import './Divider.css'
4
+
5
+ export default function Divider() {
6
+ return <div className="will-filter-bar-divider" />
7
+ }
@@ -1,54 +1,54 @@
1
- .will-guests-filter-label, .will-guests-filter-count {
2
- font-size: 18px;
3
- color: var(--will-text)
4
- }
5
-
6
- .will-guests-filter-inner {
7
- display: flex;
8
- align-items: center;
9
- }
10
-
11
- .will-guests-filter-inner {
12
- margin-top: 30px;
13
- margin-right: 50px;
14
- }
15
-
16
- .will-guests-filter-label {
17
- display: block;
18
- margin-right: 20px;
19
- font-weight: bold;
20
-
21
- }
22
-
23
- .will-guests-filter-inner > div {
24
- display: flex;
25
- align-items: center;
26
- }
27
-
28
- .will-guests-filter-count {
29
- margin: 0 10px;
30
- min-width: 30px;
31
- text-align: center;
32
- }
33
-
34
- .will-guests-filter-button {
35
- border-radius: 50%;
36
- border: none;
37
- background-color: var(--will-onahau);
38
- width: 25px;
39
- height: 25px;
40
- display: flex;
41
- justify-content: center;
42
- align-items: center;
43
- font-size: 20px;
44
- cursor: pointer;
45
- }
46
-
47
- @media (max-width: 960px) {
48
-
49
- .will-guests-filter-inner {
50
- width: 100%;
51
- margin: 15px 0;
52
- justify-content: space-between;
53
- }
1
+ .will-guests-filter-label, .will-guests-filter-count {
2
+ font-size: 18px;
3
+ color: var(--will-text)
4
+ }
5
+
6
+ .will-guests-filter-inner {
7
+ display: flex;
8
+ align-items: center;
9
+ }
10
+
11
+ .will-guests-filter-inner {
12
+ margin-top: 30px;
13
+ margin-right: 50px;
14
+ }
15
+
16
+ .will-guests-filter-label {
17
+ display: block;
18
+ margin-right: 20px;
19
+ font-weight: bold;
20
+
21
+ }
22
+
23
+ .will-guests-filter-inner > div {
24
+ display: flex;
25
+ align-items: center;
26
+ }
27
+
28
+ .will-guests-filter-count {
29
+ margin: 0 10px;
30
+ min-width: 30px;
31
+ text-align: center;
32
+ }
33
+
34
+ .will-guests-filter-button {
35
+ border-radius: 50%;
36
+ border: none;
37
+ background-color: var(--will-onahau);
38
+ width: 25px;
39
+ height: 25px;
40
+ display: flex;
41
+ justify-content: center;
42
+ align-items: center;
43
+ font-size: 20px;
44
+ cursor: pointer;
45
+ }
46
+
47
+ @media (max-width: 960px) {
48
+
49
+ .will-guests-filter-inner {
50
+ width: 100%;
51
+ margin: 15px 0;
52
+ justify-content: space-between;
53
+ }
54
54
  }