willba-component-library 0.1.55 → 0.1.56

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.1.55",
3
+ "version": "0.1.56",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -6,6 +6,11 @@
6
6
  position: relative;
7
7
  }
8
8
 
9
+ .will-root.is-full-width {
10
+ width: 100%;
11
+ min-width: auto;
12
+ }
13
+
9
14
  .will-filter-bar {
10
15
  box-sizing: border-box;
11
16
  position: relative;
@@ -15,6 +15,7 @@ type Story = StoryObj<typeof FilterBar>
15
15
 
16
16
  export const Primary: Story = {
17
17
  args: {
18
+ fullWidth: true,
18
19
  language: '',
19
20
  redirectUrl: '',
20
21
  ageCategories: [
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { useTranslation } from 'react-i18next'
3
3
 
4
4
  import useTheme, { Palette } from '../../themes/useTheme'
@@ -38,6 +38,7 @@ export type FilterBarProps = {
38
38
  palette?: Palette
39
39
  currentViewApply?: string
40
40
  onSubmit?: ((val: Filters) => void) | null
41
+ fullWidth: boolean
41
42
  }
42
43
 
43
44
  export default function FilterBar({
@@ -47,6 +48,7 @@ export default function FilterBar({
47
48
  palette,
48
49
  currentViewApply,
49
50
  onSubmit,
51
+ fullWidth,
50
52
  }: FilterBarProps) {
51
53
  const themePalette = useTheme({ palette })
52
54
 
@@ -87,12 +89,26 @@ export default function FilterBar({
87
89
  // Handle close filter section
88
90
  const { filtersRef } = useCloseFilterSection({ handleSelectedFilter })
89
91
 
92
+ // Display component after fully loaded
93
+ const [initialRenderComplete, setInitialRenderComplete] =
94
+ useState<boolean>(false)
95
+
96
+ useEffect(() => {
97
+ setInitialRenderComplete(true)
98
+ }, [])
99
+
100
+ if (!initialRenderComplete) return
101
+ //----/----
102
+
90
103
  // Parsed data for filter section description
91
104
  const parsedDates = parseDates({ calendarRange })
92
105
  const parsedGuests = parseGuests({ ageCategoryCounts, ageCategories })
93
106
 
94
107
  return (
95
- <div className={`will-root`} style={themePalette}>
108
+ <div
109
+ className={`will-root ${fullWidth ? 'is-full-width' : ''}`}
110
+ style={themePalette}
111
+ >
96
112
  {!currentViewApply && (
97
113
  <div
98
114
  className="will-filter-bar-tabs"
@@ -31,8 +31,12 @@
31
31
  opacity: 0.8;
32
32
 
33
33
  white-space: nowrap;
34
- /* overflow: hidden;
35
- text-overflow: ellipsis; */
34
+
35
+ }
36
+
37
+ .will-root.is-full-width .will-filter-bar-select-button .select-button-description {
38
+ overflow: hidden;
39
+ text-overflow: ellipsis;
36
40
  }
37
41
 
38
42
  .will-filter-bar-select-button .select-button-label.active,
@@ -10,7 +10,7 @@ export const parseGuests = ({ ageCategoryCounts, ageCategories }: Props) =>
10
10
  const ageCategory = ageCategories.find((c) => c.id === key[key.length - 1])
11
11
 
12
12
  if (ageCategory && value) {
13
- acc += `${acc ? ' -' : ''} ${
13
+ acc += `${acc ? ' |' : ''} ${
14
14
  ageCategory.name
15
15
  }: <span style="display: inline-block; width: 21px">${value}</span>`
16
16
  }