willba-component-library 0.1.4 → 0.1.6

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 (32) hide show
  1. package/README.md +57 -57
  2. package/lib/index.esm.js +9 -11
  3. package/lib/index.esm.js.map +1 -1
  4. package/lib/index.js +9 -11
  5. package/lib/index.js.map +1 -1
  6. package/lib/index.umd.js +9 -11
  7. package/lib/index.umd.js.map +1 -1
  8. package/package.json +51 -51
  9. package/src/components/FilterBar/FilterBar.tsx +4 -3
  10. package/src/components/FilterBar/FilterBarTypes.ts +25 -25
  11. package/src/components/FilterBar/components/calendar/Calendar.css +76 -76
  12. package/src/components/FilterBar/components/calendar/Calendar.tsx +54 -54
  13. package/src/components/FilterBar/components/categories/Categories.css +21 -21
  14. package/src/components/FilterBar/components/categories/Categories.tsx +41 -41
  15. package/src/components/FilterBar/components/close-button/CloseButton.css +26 -26
  16. package/src/components/FilterBar/components/close-button/CloseButton.tsx +16 -16
  17. package/src/components/FilterBar/components/divider/Divider.css +14 -14
  18. package/src/components/FilterBar/components/divider/Divider.tsx +7 -7
  19. package/src/components/FilterBar/components/guests/GuestCount/GuestCount.css +53 -53
  20. package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +51 -51
  21. package/src/components/FilterBar/components/guests/Guests.css +27 -27
  22. package/src/components/FilterBar/components/guests/Guests.tsx +38 -38
  23. package/src/components/FilterBar/components/select-button/SelectButton.css +20 -20
  24. package/src/components/FilterBar/components/select-button/SelectButton.tsx +15 -15
  25. package/src/components/FilterBar/components/submit-button/SubmitButton.css +27 -27
  26. package/src/components/FilterBar/components/submit-button/SubmitButton.tsx +18 -18
  27. package/src/components/FilterBar/hooks/useFilterBar.tsx +106 -106
  28. package/src/i18n.ts +25 -25
  29. package/src/locales/en/filterBar.json +20 -20
  30. package/src/locales/fi/filterBar.json +20 -20
  31. package/src/themes/Default.css +51 -51
  32. package/src/themes/useTheme.tsx +14 -14
@@ -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
  }
@@ -1,51 +1,51 @@
1
- import React from 'react'
2
-
3
- import { GuestsCountPropsType } from '../../../FilterBarTypes'
4
-
5
- import './GuestCount.css'
6
-
7
- export default function GuestCount({
8
- label,
9
- id,
10
- updateGuestsCount,
11
- count,
12
- minVal,
13
- }: GuestsCountPropsType) {
14
- const handleDecrement = () => {
15
- if (count > minVal) {
16
- updateGuestsCount(id, count - 1)
17
- }
18
- }
19
-
20
- const handleIncrement = () => {
21
- updateGuestsCount(id, count + 1)
22
- }
23
-
24
- return (
25
- <div className="will-guests-filter-inner">
26
- <span className="will-guests-filter-label">{label}</span>
27
- <div>
28
- <button
29
- className="will-guests-filter-button"
30
- onClick={handleDecrement}
31
- disabled={minVal && count < 2 ? true : false}
32
- style={{
33
- cursor:
34
- minVal && count < 2
35
- ? 'initial'
36
- : !minVal && count < 1
37
- ? 'initial'
38
- : 'pointer',
39
- paddingBottom: '4px',
40
- }}
41
- >
42
- -
43
- </button>
44
- <span className="will-guests-filter-count">{count}</span>
45
- <button className="will-guests-filter-button" onClick={handleIncrement}>
46
- +
47
- </button>
48
- </div>
49
- </div>
50
- )
51
- }
1
+ import React from 'react'
2
+
3
+ import { GuestsCountPropsType } from '../../../FilterBarTypes'
4
+
5
+ import './GuestCount.css'
6
+
7
+ export default function GuestCount({
8
+ label,
9
+ id,
10
+ updateGuestsCount,
11
+ count,
12
+ minVal,
13
+ }: GuestsCountPropsType) {
14
+ const handleDecrement = () => {
15
+ if (count > minVal) {
16
+ updateGuestsCount(id, count - 1)
17
+ }
18
+ }
19
+
20
+ const handleIncrement = () => {
21
+ updateGuestsCount(id, count + 1)
22
+ }
23
+
24
+ return (
25
+ <div className="will-guests-filter-inner">
26
+ <span className="will-guests-filter-label">{label}</span>
27
+ <div>
28
+ <button
29
+ className="will-guests-filter-button"
30
+ onClick={handleDecrement}
31
+ disabled={minVal && count < 2 ? true : false}
32
+ style={{
33
+ cursor:
34
+ minVal && count < 2
35
+ ? 'initial'
36
+ : !minVal && count < 1
37
+ ? 'initial'
38
+ : 'pointer',
39
+ paddingBottom: '4px',
40
+ }}
41
+ >
42
+ -
43
+ </button>
44
+ <span className="will-guests-filter-count">{count}</span>
45
+ <button className="will-guests-filter-button" onClick={handleIncrement}>
46
+ +
47
+ </button>
48
+ </div>
49
+ </div>
50
+ )
51
+ }
@@ -1,28 +1,28 @@
1
- .will-filter-bar-guests {
2
- text-align: initial;
3
- }
4
-
5
- .will-guests-filter-title {
6
- font-size: 16px;
7
- text-transform: uppercase;
8
- margin: 10px 0;
9
- }
10
-
11
- .will-guests-filter-subtitle {
12
- font-size: 15px;
13
- font-weight: 500;
14
- color:var(--will-text)
15
- }
16
-
17
-
18
- .will-guests-filter-container {
19
- display: flex;
20
- flex-wrap: wrap;
21
- }
22
-
23
-
24
- @media (max-width: 960px) {
25
- .will-guests-filter-container {
26
- margin-top: 15px;
27
- }
1
+ .will-filter-bar-guests {
2
+ text-align: initial;
3
+ }
4
+
5
+ .will-guests-filter-title {
6
+ font-size: 16px;
7
+ text-transform: uppercase;
8
+ margin: 10px 0;
9
+ }
10
+
11
+ .will-guests-filter-subtitle {
12
+ font-size: 15px;
13
+ font-weight: 500;
14
+ color:var(--will-text)
15
+ }
16
+
17
+
18
+ .will-guests-filter-container {
19
+ display: flex;
20
+ flex-wrap: wrap;
21
+ }
22
+
23
+
24
+ @media (max-width: 960px) {
25
+ .will-guests-filter-container {
26
+ margin-top: 15px;
27
+ }
28
28
  }
@@ -1,38 +1,38 @@
1
- import React from 'react'
2
- import { useTranslation } from 'react-i18next'
3
-
4
- import GuestCount from './GuestCount/GuestCount'
5
- import { AgeCategoryCount, GuestsPropsType } from '../../FilterBarTypes'
6
-
7
- import './Guests.css'
8
-
9
- export default function Guests({
10
- ageCategories,
11
- updateGuestsCount,
12
- ageCategoryCounts,
13
- }: GuestsPropsType) {
14
- const { t } = useTranslation('filterBar')
15
-
16
- return (
17
- <div className="will-filter-bar-guests">
18
- <h3 className="will-guests-filter-title">{t('guests.title')}</h3>
19
- <p className="will-guests-filter-subtitle">{t('guests.subtitle')}</p>
20
-
21
- <div className="will-guests-filter-container">
22
- {ageCategories?.map((category) => (
23
- <GuestCount
24
- key={category.id}
25
- id={parseInt(category.id)}
26
- label={category.name}
27
- minVal={category.minVal}
28
- updateGuestsCount={updateGuestsCount}
29
- count={
30
- (ageCategoryCounts as AgeCategoryCount)[category.id] ||
31
- category.minVal
32
- }
33
- />
34
- ))}
35
- </div>
36
- </div>
37
- )
38
- }
1
+ import React from 'react'
2
+ import { useTranslation } from 'react-i18next'
3
+
4
+ import GuestCount from './GuestCount/GuestCount'
5
+ import { AgeCategoryCount, GuestsPropsType } from '../../FilterBarTypes'
6
+
7
+ import './Guests.css'
8
+
9
+ export default function Guests({
10
+ ageCategories,
11
+ updateGuestsCount,
12
+ ageCategoryCounts,
13
+ }: GuestsPropsType) {
14
+ const { t } = useTranslation('filterBar')
15
+
16
+ return (
17
+ <div className="will-filter-bar-guests">
18
+ <h3 className="will-guests-filter-title">{t('guests.title')}</h3>
19
+ <p className="will-guests-filter-subtitle">{t('guests.subtitle')}</p>
20
+
21
+ <div className="will-guests-filter-container">
22
+ {ageCategories?.map((category) => (
23
+ <GuestCount
24
+ key={category.id}
25
+ id={parseInt(category.id)}
26
+ label={category.name}
27
+ minVal={category.minVal}
28
+ updateGuestsCount={updateGuestsCount}
29
+ count={
30
+ (ageCategoryCounts as AgeCategoryCount)[category.id] ||
31
+ category.minVal
32
+ }
33
+ />
34
+ ))}
35
+ </div>
36
+ </div>
37
+ )
38
+ }
@@ -1,20 +1,20 @@
1
- .will-filter-bar-select-button {
2
- width: 100%;
3
- height: auto;
4
- background-color: transparent;
5
- border: none;
6
- padding: 10px 20px;
7
- border-radius: 20px;
8
- cursor: pointer;
9
- font-size: 15px;
10
- text-align: initial;
11
- }
12
-
13
- @media (max-width: 960px) {
14
- .will-filter-bar-select-button {
15
- margin: 15px 0;
16
- text-align: center;
17
- }
18
- }
19
-
20
-
1
+ .will-filter-bar-select-button {
2
+ width: 100%;
3
+ height: auto;
4
+ background-color: transparent;
5
+ border: none;
6
+ padding: 10px 20px;
7
+ border-radius: 20px;
8
+ cursor: pointer;
9
+ font-size: 15px;
10
+ text-align: initial;
11
+ }
12
+
13
+ @media (max-width: 960px) {
14
+ .will-filter-bar-select-button {
15
+ margin: 15px 0;
16
+ text-align: center;
17
+ }
18
+ }
19
+
20
+
@@ -1,15 +1,15 @@
1
- import React from 'react'
2
-
3
- import './SelectButton.css'
4
-
5
- export default function SelectButton({ label, onClick, style }: any) {
6
- return (
7
- <button
8
- className="will-filter-bar-select-button"
9
- onClick={onClick}
10
- style={style}
11
- >
12
- {label}
13
- </button>
14
- )
15
- }
1
+ import React from 'react'
2
+
3
+ import './SelectButton.css'
4
+
5
+ export default function SelectButton({ label, onClick, style }: any) {
6
+ return (
7
+ <button
8
+ className="will-filter-bar-select-button"
9
+ onClick={onClick}
10
+ style={style}
11
+ >
12
+ {label}
13
+ </button>
14
+ )
15
+ }
@@ -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: 25px;
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: 25px;
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
+ }