willba-component-library 0.3.0 → 0.3.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "A custom UI component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -25,7 +25,7 @@
25
25
  "react-dom": "^18.2.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@rollup/plugin-commonjs": "^25.0.8",
28
+ "@rollup/plugin-commonjs": "^29.0.0",
29
29
  "@rollup/plugin-json": "^6.1.0",
30
30
  "@rollup/plugin-node-resolve": "^15.3.1",
31
31
  "@rollup/plugin-typescript": "^11.1.6",
@@ -27,7 +27,7 @@ export const Main: Story = {
27
27
  },
28
28
  ],
29
29
  },
30
- fullWidth: true,
30
+ fullWidth: false,
31
31
  language: 'en',
32
32
  redirectUrl: 'http://localhost:4000/',
33
33
  ageCategories: [
@@ -81,9 +81,9 @@ export const Main: Story = {
81
81
  multiSelect: false,
82
82
  data: [
83
83
  {
84
- id: '1',
84
+ id: 1,
85
85
  label: {
86
- en: 'Location 1',
86
+ en: 'Location 1 Location 1 Location 1 Location 1 Location 1 Location 1 Location 1 Location 1 Location 1 Location 1 Location 1 Location 1 Location 1',
87
87
  fi: 'Location 1 fi',
88
88
  },
89
89
  description: {
@@ -94,14 +94,14 @@ export const Main: Story = {
94
94
  '//i0.wp.com/picjumbo.com/wp-content/uploads/beautiful-fall-nature-scenery-free-image.jpeg?w=2210&quality=70',
95
95
  },
96
96
  {
97
- id: '2',
97
+ id: 2,
98
98
  label: {
99
99
  en: 'Location 2',
100
100
  fi: 'Location 2 fi',
101
101
  },
102
102
  },
103
103
  {
104
- id: '3',
104
+ id: 3,
105
105
  label: {
106
106
  en: 'Location 3',
107
107
  fi: 'Location 3 fi',
@@ -114,7 +114,7 @@ export const Main: Story = {
114
114
  '//i0.wp.com/picjumbo.com/wp-content/uploads/beautiful-fall-nature-scenery-free-image.jpeg?w=2210&quality=70',
115
115
  },
116
116
  {
117
- id: '4',
117
+ id: 4,
118
118
  label: {
119
119
  en: 'Location 4',
120
120
  fi: 'Location 4 fi',
@@ -123,7 +123,7 @@ export const Main: Story = {
123
123
  '//i0.wp.com/picjumbo.com/wp-content/uploads/beautiful-fall-nature-scenery-free-image.jpeg?w=2210&quality=70',
124
124
  },
125
125
  {
126
- id: '5',
126
+ id: 5,
127
127
  label: {
128
128
  en: 'Location 5',
129
129
  fi: 'Location 5 fi',
@@ -67,7 +67,7 @@ export type Tab = {
67
67
  }
68
68
 
69
69
  export type Location = {
70
- id: string
70
+ id: number
71
71
  label: Translations
72
72
  description?: Translations
73
73
  imageUrl?: string
@@ -28,22 +28,18 @@
28
28
  }
29
29
 
30
30
  .will-filter-bar-select-button .select-button-description {
31
-
32
31
  color: var(--will-black);
33
32
  font-weight: 400;
34
33
  opacity: 0.5;
35
34
  white-space: nowrap;
36
35
  min-height: 19px;
37
- }
38
-
39
- .will-filter-bar-select-button .select-button-description span {
40
- font: inherit
41
- }
42
-
43
- .will-root.is-full-width .will-filter-bar-select-button .select-button-description {
44
36
  overflow: hidden;
45
37
  text-overflow: ellipsis;
46
- }
38
+ }
39
+
40
+ .will-filter-bar-select-button .select-button-description span {
41
+ font: inherit
42
+ }
47
43
 
48
44
  .will-filter-bar-select-button .select-button-label.active,
49
45
  .will-filter-bar-select-button .select-button-description.active {
@@ -68,7 +68,7 @@ export const useFilterBar = ({
68
68
  // Set selected locations from URL - handle all locationIds
69
69
  if (locations?.data?.length && locationIdParams.length) {
70
70
  const matchedLocations = locations.data.filter((location) =>
71
- locationIdParams.includes(location.id)
71
+ locationIdParams.includes(location.id.toString())
72
72
  )
73
73
  setSelectedLocations(matchedLocations)
74
74
  }
@@ -118,21 +118,27 @@ export const useFilterBar = ({
118
118
  ageCategoryCounts,
119
119
  ageCategories,
120
120
  }),
121
+
122
+ selectedLocations: selectedLocations
123
+ .map((location) => location.id.toString())
124
+ .join(','),
121
125
  }
122
126
 
123
127
  const querySearchParams = new URLSearchParams()
124
128
 
125
129
  for (const [key, value] of Object.entries(newParams)) {
126
130
  if (value) {
127
- querySearchParams.append(key, value.toString())
131
+ if (key === 'selectedLocations' && !!selectedLocations.length) {
132
+ // Append all selected locationIds
133
+ selectedLocations.forEach((location) => {
134
+ querySearchParams.append('locationId', location.id.toString())
135
+ })
136
+ } else {
137
+ querySearchParams.append(key, value.toString())
138
+ }
128
139
  }
129
140
  }
130
141
 
131
- // Append all selected locationIds
132
- selectedLocations.forEach((location) => {
133
- querySearchParams.append('locationId', location.id)
134
- })
135
-
136
142
  handleSelectedFilter(false)
137
143
 
138
144
  if (onSubmit && window.location.href.includes(selectedPath)) {
package/tsconfig.json CHANGED
@@ -13,11 +13,11 @@
13
13
  "strict": true,
14
14
  "forceConsistentCasingInFileNames": true,
15
15
  "module": "esnext",
16
- "moduleResolution": "node",
16
+ "moduleResolution": "bundler",
17
17
  "resolveJsonModule": true,
18
18
  "isolatedModules": true,
19
19
  "noEmit": true,
20
- "jsx": "react",
20
+ "jsx": "react-jsx",
21
21
 
22
22
  "baseUrl": "./",
23
23
  "paths": {