willba-component-library 0.0.47 → 0.0.48

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 (34) hide show
  1. package/.nvmrc +1 -0
  2. package/lib/components/FilterBar/components/select-button/SelectButton.d.ts +1 -1
  3. package/lib/index.esm.js +4792 -163
  4. package/lib/index.esm.js.map +1 -1
  5. package/lib/index.js +4806 -177
  6. package/lib/index.js.map +1 -1
  7. package/lib/index.umd.js +13075 -8446
  8. package/lib/index.umd.js.map +1 -1
  9. package/package.json +5 -2
  10. package/rollup.config.mjs +4 -0
  11. package/src/components/FilterBar/FilterBar.css +17 -9
  12. package/src/components/FilterBar/FilterBar.tsx +11 -3
  13. package/src/components/FilterBar/components/calendar/Calendar.css +60 -2
  14. package/src/components/FilterBar/components/calendar/Calendar.tsx +22 -11
  15. package/src/components/FilterBar/components/categories/Categories.css +9 -3
  16. package/src/components/FilterBar/components/categories/Categories.tsx +3 -3
  17. package/src/components/FilterBar/components/divider/Divider.css +1 -1
  18. package/src/components/FilterBar/components/divider/Divider.tsx +1 -1
  19. package/src/components/FilterBar/components/guests/Guests.css +29 -10
  20. package/src/components/FilterBar/components/guests/Guests.tsx +44 -14
  21. package/src/components/FilterBar/components/select-button/SelectButton.css +3 -1
  22. package/src/components/FilterBar/components/select-button/SelectButton.tsx +6 -2
  23. package/src/components/FilterBar/components/submit-button/SubmitButton.css +11 -3
  24. package/src/components/FilterBar/components/submit-button/SubmitButton.tsx +10 -2
  25. package/src/index.ts +2 -0
  26. package/src/locales/en/filterBar.json +5 -1
  27. package/src/locales/fi/filterBar.json +5 -1
  28. package/src/themes/Default.css +26 -10
  29. package/lib/index.css +0 -480
  30. package/lib/index.esm.css +0 -480
  31. package/lib/index.umd.css +0 -480
  32. package/lib/themes/Default.css +0 -13
  33. package/lib/themes/Kisakallio.css +0 -3
  34. package/lib/themes/Pajulahti.css +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -14,11 +14,14 @@
14
14
  "author": "Willba",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
+ "@fortawesome/free-solid-svg-icons": "^6.4.2",
18
+ "@fortawesome/react-fontawesome": "^0.2.0",
17
19
  "classnames": "^2.3.2",
18
20
  "date-fns": "^2.30.0",
19
21
  "i18next": "^23.4.4",
20
22
  "react-day-picker": "^8.8.0",
21
- "react-i18next": "^13.1.1"
23
+ "react-i18next": "^13.1.1",
24
+ "typeface-montserrat": "^1.1.13"
22
25
  },
23
26
  "peerDependencies": {
24
27
  "react": "^18.2.0",
package/rollup.config.mjs CHANGED
@@ -52,6 +52,10 @@ export default [
52
52
  extensions: ['.css'],
53
53
  }),
54
54
  json(),
55
+ resolve({
56
+ mainFields: ['module', 'main', 'browser'],
57
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
58
+ }),
55
59
  ],
56
60
  },
57
61
  {
@@ -1,31 +1,39 @@
1
- .filter-bar {
1
+ .will-filter-bar {
2
2
  box-sizing: border-box;
3
3
  max-width: 1100px;
4
4
  position: relative;
5
5
  }
6
6
 
7
- .filter-bar-header {
7
+ .will-filter-bar-header {
8
8
  display: flex;
9
9
  justify-content: space-between;
10
- align-items: center;
11
10
  padding: 10px 20px;
12
11
  position: relative;
13
12
  z-index: 222;
14
13
 
15
14
  border-radius: 40px;
16
- background-color: #fff;
17
- box-shadow: 0px 6px 11px 0px #a7a4a480;
15
+ background-color: var(--will-white);
16
+ box-shadow: var(--will-box-shadow);
18
17
  }
19
18
 
20
- .filter-bar-container {
21
- background-color: #fff;
19
+ .will-filter-bar-container {
20
+ background-color: var(--will-white);
22
21
  min-height: 100px;
23
22
 
24
23
  padding: 90px 40px 30px 40px;
25
24
  position: absolute;
26
25
  top: 0;
27
26
  z-index: 111;
28
- border-radius: 40px;
27
+ border-radius: 25px;
29
28
  width: -webkit-fill-available;
30
- box-shadow: var(--box-shadow);
29
+ box-shadow: var(--will-box-shadow);
30
+ }
31
+
32
+ .will-filter-bar-underlay {
33
+ background-color: red;
34
+ position: absolute;
35
+ top:0;
36
+ left: 0;
37
+ width: 100%;
38
+ height: 100%;
31
39
  }
@@ -49,14 +49,16 @@ export default function FilterBar({ vendor, language }: FilterBarProps) {
49
49
 
50
50
  return (
51
51
  <div className={`will-root ${themeClass}`}>
52
- <div className={`filter-bar`}>
53
- <div className="filter-bar-header">
52
+ <div className={`will-filter-bar will-filter-bar-underlay`}>
53
+ <div className="will-filter-bar-header">
54
54
  <SelectButton
55
+ style={fontWigthBold(selectedFilter === 1 || selectedFilter === 2)}
55
56
  label={t('calendar.startDate')}
56
57
  onClick={() => handleSelectedFilter(1)}
57
58
  />
58
59
  <Divider />
59
60
  <SelectButton
61
+ style={fontWigthBold(selectedFilter === 1 || selectedFilter === 2)}
60
62
  label={t('calendar.endDate')}
61
63
  onClick={() => handleSelectedFilter(2)}
62
64
  />
@@ -64,17 +66,19 @@ export default function FilterBar({ vendor, language }: FilterBarProps) {
64
66
  <SelectButton
65
67
  label={t('guests.label')}
66
68
  onClick={() => handleSelectedFilter(3)}
69
+ style={fontWigthBold(selectedFilter === 3)}
67
70
  />
68
71
  <Divider />
69
72
  <SelectButton
70
73
  label={t('categories.label')}
71
74
  onClick={() => handleSelectedFilter(4)}
75
+ style={fontWigthBold(selectedFilter === 4)}
72
76
  />
73
77
  <SubmitButton onClick={handleSubmit} />
74
78
  </div>
75
79
 
76
80
  {selectedFilter && (
77
- <div className="filter-bar-container">
81
+ <div className="will-filter-bar-container">
78
82
  {(selectedFilter === 1 || selectedFilter === 2) && (
79
83
  <Calendar
80
84
  calendarRange={calendarRange}
@@ -103,3 +107,7 @@ export default function FilterBar({ vendor, language }: FilterBarProps) {
103
107
  </div>
104
108
  )
105
109
  }
110
+
111
+ const fontWigthBold = (input: boolean) => {
112
+ return { fontWeight: input ? 'bold' : 'initial' }
113
+ }
@@ -1,4 +1,62 @@
1
- .filter-bar-calendar {
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
+ }
13
+
14
+ .will-calendar-filter-container {
2
15
  display: flex;
3
16
  justify-content: center;
4
- }
17
+ padding-top: 20px;
18
+ }
19
+
20
+ /* Calendar overrides */
21
+
22
+ .will-calendar-filter-container .rdp-month {
23
+ position: relative;
24
+ }
25
+
26
+ .will-calendar-filter-container .rdp-month.rdp-caption_start {
27
+ padding-left: 70px;
28
+ }
29
+
30
+ .will-calendar-filter-container .rdp-month.rdp-caption_end {
31
+ padding-right: 70px;
32
+ }
33
+
34
+ .will-calendar-filter-container .rdp-month .rdp-nav {
35
+ border: 1px solid var(--will-primary);
36
+ border-radius: 50%;
37
+ left: 25;
38
+
39
+ }
40
+
41
+ .will-calendar-filter-container .rdp-month .rdp-nav svg {
42
+ color: var(--will-primary);
43
+ }
44
+
45
+
46
+ .will-calendar-filter-container .rdp-month .rdp-caption {
47
+ position: initial;
48
+ }
49
+
50
+ .will-calendar-filter-container .rdp-month .rdp-caption > .rdp-caption_label,
51
+ .will-calendar-filter-container .rdp-table .rdp-head {
52
+ opacity: .6;
53
+ }
54
+
55
+ .will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day {
56
+ opacity: 0.7;
57
+ }
58
+
59
+ .will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day.rdp-day_selected {
60
+ background-color: var(--will-primary);
61
+ opacity: 1;
62
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react'
2
-
3
- import { addDays } from 'date-fns'
2
+ import { useTranslation } from 'react-i18next'
4
3
  import { DateRange, DayPicker } from 'react-day-picker'
4
+ import { addDays } from 'date-fns'
5
5
 
6
6
  import 'react-day-picker/dist/style.css'
7
7
  import './Calendar.css'
@@ -9,6 +9,8 @@ import './Calendar.css'
9
9
  const currentMonth = new Date()
10
10
 
11
11
  export default function Calendar({ calendarRange, setCalendarRange }: any) {
12
+ const { t } = useTranslation('filterBar')
13
+
12
14
  const defaultCalendarSelected: DateRange = {
13
15
  from: currentMonth,
14
16
  to: addDays(currentMonth, 0),
@@ -19,15 +21,24 @@ export default function Calendar({ calendarRange, setCalendarRange }: any) {
19
21
  }, [])
20
22
 
21
23
  return (
22
- <div className="filter-bar-calendar">
23
- <DayPicker
24
- id="test"
25
- mode="range"
26
- numberOfMonths={2}
27
- defaultMonth={currentMonth}
28
- selected={calendarRange}
29
- onSelect={setCalendarRange}
30
- />
24
+ <div className="will-filter-bar-calendar">
25
+ <div className="will-calendar-filter-header">
26
+ <h3 className="will-calendar-filter-title">{t('calendar.title')}</h3>
27
+ </div>
28
+ <div className="will-calendar-filter-container">
29
+ <DayPicker
30
+ id="will-calendar"
31
+ mode="range"
32
+ showOutsideDays
33
+ fixedWeeks
34
+ numberOfMonths={2}
35
+ weekStartsOn={1}
36
+ max={31}
37
+ defaultMonth={currentMonth}
38
+ selected={calendarRange}
39
+ onSelect={setCalendarRange}
40
+ />
41
+ </div>
31
42
  </div>
32
43
  )
33
44
  }
@@ -1,15 +1,21 @@
1
- .filter-bar-categories {
1
+ .will-filter-bar-categories {
2
2
  text-align: center;
3
3
  }
4
4
 
5
- .categories-filter-inner {
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 {
6
12
  display: flex;
7
13
  align-items: center;
8
14
  justify-content: center;
9
15
  gap: 20px;
10
16
  }
11
17
 
12
- .categories-filter-inner input {
18
+ .will-categories-filter-inner input {
13
19
  cursor: pointer;
14
20
  margin-right: 10px;
15
21
  }
@@ -21,9 +21,9 @@ export default function Categories({ categories, setCategories }: any) {
21
21
  }
22
22
 
23
23
  return (
24
- <div className="filter-bar-categories">
25
- <h3>{t('categories.label')}</h3>
26
- <div className="categories-filter-inner">
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
27
  {categoriesPlaceholder.map((itm, idx) => (
28
28
  <div key={idx}>
29
29
  <input
@@ -1,4 +1,4 @@
1
- .filter-bar-divider {
1
+ .will-filter-bar-divider {
2
2
  width: 1px;
3
3
  margin: 0 10px;
4
4
  height: 35px;
@@ -3,5 +3,5 @@ import React from 'react'
3
3
  import './Divider.css'
4
4
 
5
5
  export default function Divider() {
6
- return <div className="filter-bar-divider" />
6
+ return <div className="will-filter-bar-divider" />
7
7
  }
@@ -1,44 +1,63 @@
1
- .filter-bar-guests {
1
+ .will-filter-bar-guests {
2
2
  text-align: initial;
3
3
  }
4
4
 
5
- .guests-filter-container {
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-label, .will-guests-filter-count {
19
+ font-size: 18px;
20
+ color: var(--will-text)
21
+ }
22
+
23
+ .will-guests-filter-container {
6
24
  display: flex;
7
25
  margin-top: 30px;
8
26
  }
9
27
 
10
- .guests-filter-inner {
28
+ .will-guests-filter-inner {
11
29
  display: flex;
12
30
  align-items: center;
13
31
  }
14
32
 
15
- .guests-filter-inner:not(:last-child) {
33
+ .will-guests-filter-inner:not(:last-child) {
16
34
  margin-right: 50px;
17
35
  }
18
36
 
19
- .guests-filter-inner > span {
37
+ .will-guests-filter-label {
20
38
  display: block;
21
39
  margin-right: 20px;
22
40
  font-weight: bold;
23
41
  }
24
42
 
25
- .guests-filter-inner > div {
43
+ .will-guests-filter-inner > div {
26
44
  display: flex;
27
45
  align-items: center;
28
46
  }
29
47
 
30
- .guests-filter-inner > div > span {
31
- margin: 0 10px;
48
+ .will-guests-filter-count {
49
+ margin: 0 15px;
32
50
  }
33
51
 
34
- .guests-filter-inner > div button {
52
+ .will-guests-filter-button {
35
53
  border-radius: 50%;
36
54
  border: none;
37
- background-color: #CDEEFF;
55
+ background-color: var(--will-onahau);
38
56
  width: 25px;
39
57
  height: 25px;
40
58
  display: flex;
41
59
  justify-content: center;
42
60
  align-items: center;
43
61
  font-size: 20px;
62
+ cursor: pointer;
44
63
  }
@@ -14,29 +14,59 @@ export default function Guests({
14
14
  const { t } = useTranslation('filterBar')
15
15
 
16
16
  return (
17
- <div className="filter-bar-guests">
18
- <h3>{t('guests.title')}</h3>
19
- <p>{t('guests.subtitle')}</p>
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
20
 
21
- <div className="guests-filter-container">
22
- <div className="guests-filter-inner">
23
- <span>{t('guests.adultsLabel')}</span>
21
+ <div className="will-guests-filter-container">
22
+ <div className="will-guests-filter-inner">
23
+ <span className="will-guests-filter-label">
24
+ {t('guests.adultsLabel')}
25
+ </span>
24
26
  <div>
25
- <button onClick={decrementAdults} disabled={guestsAdults < 2}>
27
+ <button
28
+ className="will-guests-filter-button"
29
+ onClick={decrementAdults}
30
+ disabled={guestsAdults < 2}
31
+ style={{
32
+ cursor: guestsAdults < 2 ? 'initial' : 'pointer',
33
+ paddingBottom: '4px',
34
+ }}
35
+ >
26
36
  -
27
37
  </button>
28
- <span>{guestsAdults}</span>
29
- <button onClick={incrementAdults}>+</button>
38
+ <span className="will-guests-filter-count">{guestsAdults}</span>
39
+ <button
40
+ className="will-guests-filter-button"
41
+ onClick={incrementAdults}
42
+ >
43
+ +
44
+ </button>
30
45
  </div>
31
46
  </div>
32
- <div className="guests-filter-inner">
33
- <span>{t('guests.kidsLabel')}</span>
47
+ <div className="will-guests-filter-inner">
48
+ <span className="will-guests-filter-label">
49
+ {t('guests.kidsLabel')}
50
+ </span>
34
51
  <div>
35
- <button onClick={decrementKids} disabled={guestsKids < 1}>
52
+ <button
53
+ className="will-guests-filter-button"
54
+ onClick={decrementKids}
55
+ disabled={guestsKids < 1}
56
+ style={{
57
+ cursor: guestsKids < 1 ? 'initial' : 'pointer',
58
+ paddingBottom: '4px',
59
+ }}
60
+ >
36
61
  -
37
62
  </button>
38
- <span>{guestsKids}</span>
39
- <button onClick={incrementKids}>+</button>
63
+ <span className="will-guests-filter-count">{guestsKids}</span>
64
+ <button
65
+ className="will-guests-filter-button"
66
+ onClick={incrementKids}
67
+ >
68
+ +
69
+ </button>
40
70
  </div>
41
71
  </div>
42
72
  </div>
@@ -1,4 +1,4 @@
1
- .filter-bar-select-button {
1
+ .will-filter-bar-select-button {
2
2
  width: 100%;
3
3
  height: auto;
4
4
  background-color: transparent;
@@ -6,4 +6,6 @@
6
6
  padding: 10px 20px;
7
7
  border-radius: 20px;
8
8
  cursor: pointer;
9
+ font-size: 15px;
10
+ text-align: initial;
9
11
  }
@@ -2,9 +2,13 @@ import React from 'react'
2
2
 
3
3
  import './SelectButton.css'
4
4
 
5
- export default function SelectButton({ label, onClick }: any) {
5
+ export default function SelectButton({ label, onClick, style }: any) {
6
6
  return (
7
- <button className="filter-bar-select-button" onClick={onClick}>
7
+ <button
8
+ className="will-filter-bar-select-button"
9
+ onClick={onClick}
10
+ style={style}
11
+ >
8
12
  {label}
9
13
  </button>
10
14
  )
@@ -1,11 +1,19 @@
1
- .filter-bar-submit-button {
1
+ .will-filter-bar-submit-button {
2
2
  width: auto;
3
3
  height: auto;
4
- background-color: #384265;
5
- color: #fff;
4
+ background-color: var(--will-primary);
5
+ color: var(--will-white);
6
6
  padding: 10px 20px;
7
7
  border-radius: 20px;
8
8
  cursor: pointer;
9
9
  border: none;
10
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;
11
19
  }
@@ -1,11 +1,19 @@
1
1
  import React from 'react'
2
+ import { useTranslation } from 'react-i18next'
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
4
+ import { faSearch } from '@fortawesome/free-solid-svg-icons'
2
5
 
3
6
  import './SubmitButton.css'
4
7
 
5
8
  export default function SubmitButton({ onClick }: any) {
9
+ const { t } = useTranslation('filterBar')
10
+
6
11
  return (
7
- <button className="filter-bar-submit-button" onClick={onClick}>
8
- Search
12
+ <button className="will-filter-bar-submit-button" onClick={onClick}>
13
+ <span>
14
+ <FontAwesomeIcon icon={faSearch} />
15
+ </span>
16
+ {t('submit.label')}
9
17
  </button>
10
18
  )
11
19
  }
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import 'typeface-montserrat'
2
+
1
3
  import Button from './components/Button'
2
4
  import FilterBar from './components/FilterBar'
3
5
 
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "calendar": {
3
3
  "startDate": "Start date",
4
- "endDate": "End date"
4
+ "endDate": "End date",
5
+ "title": "Calendar"
5
6
  },
6
7
  "guests": {
7
8
  "label": "Guests",
@@ -13,5 +14,8 @@
13
14
  "categories": {
14
15
  "label": "Categories",
15
16
  "title": "Category"
17
+ },
18
+ "submit": {
19
+ "label": "Search"
16
20
  }
17
21
  }
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "calendar": {
3
3
  "startDate": "Aloitus päivämäärä",
4
- "endDate": "Päättymis päivämäärä"
4
+ "endDate": "Päättymis päivämäärä",
5
+ "title": "Kalenteri"
5
6
  },
6
7
  "guests": {
7
8
  "label": "Vieraat",
@@ -13,5 +14,8 @@
13
14
  "categories": {
14
15
  "label": "Kategoriat",
15
16
  "title": "Kategoria"
17
+ },
18
+ "submit": {
19
+ "label": "Hae"
16
20
  }
17
21
  }
@@ -1,23 +1,39 @@
1
- :root {
2
- --primary-color: #3498db;
3
- --font-size: 16px;
4
- --box-shadow: 0px 6px 11px 0px #a7a4a480
1
+ .will-root * {
2
+ font-family: 'Montserrat', sans-serif;
5
3
  }
6
4
 
7
- * {
5
+ .will-root {
6
+
8
7
  box-sizing: border-box;
8
+ font-size: 14px;
9
+
10
+ color: #1E1E1E;
11
+
12
+ /* Pallete */
13
+ --will-primary: #374269;
14
+ --will-grey: #ABA7AF;
15
+ --will-white: #fff;
16
+ --will-onahau: #CDEEFF;
17
+ --will-text: #5A5959;
18
+
19
+
20
+ /* Confines */
21
+ --will-box-shadow: 0px 6px 11px 0px #a7a4a480;
9
22
  }
10
23
 
24
+ /* Typography */
11
25
 
26
+ .will-root p, h1, h2, h3, h4, h5, h6, span {
27
+ margin: 0;
28
+ padding: 0;
29
+ }
12
30
 
13
- .will-root {
14
- background-color: aqua;
15
- }
31
+ /* Overrides as themes */
16
32
 
17
33
  .will-root-kis {
18
- background-color: red;
34
+ --will-primary: #374269;
19
35
  }
20
36
 
21
37
  .will-root-paj {
22
- background-color: blue;
38
+ --will-primary: #1897D8;
23
39
  }