willba-component-library 0.3.26 → 0.4.0

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 (159) hide show
  1. package/README.md +75 -113
  2. package/lib/components/FilterBar/FilterBar.d.ts +1 -1
  3. package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
  4. package/lib/core/i18n/I18nProvider.d.ts +6 -0
  5. package/lib/core/i18n/index.d.ts +1 -0
  6. package/lib/embed.d.ts +18 -0
  7. package/lib/embed.esm.js +74 -0
  8. package/lib/embed.esm.js.map +1 -0
  9. package/lib/embed.umd.js +74 -0
  10. package/lib/embed.umd.js.map +1 -0
  11. package/lib/i18n.d.ts +2 -2
  12. package/lib/index.d.ts +2 -2
  13. package/lib/index.esm.js +1112 -931
  14. package/lib/index.esm.js.map +1 -1
  15. package/lib/index.js +1111 -930
  16. package/lib/index.js.map +1 -1
  17. package/package.json +9 -1
  18. package/.nvmrc +0 -1
  19. package/.storybook/main.ts +0 -17
  20. package/.storybook/preview.ts +0 -15
  21. package/lib/components/FilterBar/components/buttons/index.d.ts +0 -4
  22. package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +0 -13
  23. package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +0 -10
  24. package/lib/components/FilterBar/components/cards/image-card/ImageCard.d.ts +0 -11
  25. package/lib/components/FilterBar/components/cards/index.d.ts +0 -1
  26. package/lib/components/FilterBar/components/categories/Categories.d.ts +0 -8
  27. package/lib/components/FilterBar/components/common/FilterSectionHeader.d.ts +0 -8
  28. package/lib/components/FilterBar/components/dates/Dates.d.ts +0 -17
  29. package/lib/components/FilterBar/components/dates/index.d.ts +0 -1
  30. package/lib/components/FilterBar/components/guests/GuestCount/GuestCount.d.ts +0 -4
  31. package/lib/components/FilterBar/components/guests/Guests.d.ts +0 -12
  32. package/lib/components/FilterBar/components/locations/Locations.d.ts +0 -14
  33. package/lib/components/FilterBar/hooks/useFilterBar.d.ts +0 -32
  34. package/lib/components/FilterBar/hooks/useFilterUi.d.ts +0 -8
  35. package/lib/components/FilterBar/utils/calculateDropdownPosition.d.ts +0 -12
  36. package/lib/components/FilterBar/utils/getLocalizedContent.d.ts +0 -8
  37. package/lib/core/components/buttons/close-button/CloseButton.d.ts +0 -7
  38. package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +0 -14
  39. package/lib/index.umd.js +0 -12489
  40. package/lib/index.umd.js.map +0 -1
  41. package/prettier.config.js +0 -6
  42. package/rollup.config.mjs +0 -63
  43. package/src/assets/IconsSvg.tsx +0 -69
  44. package/src/components/Button/Button.stories.tsx +0 -34
  45. package/src/components/Button/Button.tsx +0 -56
  46. package/src/components/Button/button.css +0 -30
  47. package/src/components/Button/index.ts +0 -1
  48. package/src/components/FilterBar/FilterBar.css +0 -35
  49. package/src/components/FilterBar/FilterBar.stories.tsx +0 -116
  50. package/src/components/FilterBar/FilterBar.tsx +0 -64
  51. package/src/components/FilterBar/FilterBarTypes.ts +0 -71
  52. package/src/components/FilterBar/components/Divider/Divider.css +0 -14
  53. package/src/components/FilterBar/components/Divider/Divider.tsx +0 -7
  54. package/src/components/FilterBar/components/FilterControls/FilterControls.css +0 -22
  55. package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +0 -139
  56. package/src/components/FilterBar/components/FilterPanels/Categories/Categories.css +0 -21
  57. package/src/components/FilterBar/components/FilterPanels/Categories/Categories.tsx +0 -49
  58. package/src/components/FilterBar/components/FilterPanels/Dates/Dates.css +0 -9
  59. package/src/components/FilterBar/components/FilterPanels/Dates/Dates.tsx +0 -60
  60. package/src/components/FilterBar/components/FilterPanels/FilterPanels.css +0 -22
  61. package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +0 -111
  62. package/src/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.css +0 -58
  63. package/src/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.tsx +0 -85
  64. package/src/components/FilterBar/components/FilterPanels/Guests/Guests.css +0 -24
  65. package/src/components/FilterBar/components/FilterPanels/Guests/Guests.tsx +0 -59
  66. package/src/components/FilterBar/components/FilterPanels/Locations/Locations.css +0 -16
  67. package/src/components/FilterBar/components/FilterPanels/Locations/Locations.tsx +0 -94
  68. package/src/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.css +0 -34
  69. package/src/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.tsx +0 -17
  70. package/src/components/FilterBar/components/FilterTabs/FilterTabs.css +0 -10
  71. package/src/components/FilterBar/components/FilterTabs/FilterTabs.tsx +0 -50
  72. package/src/components/FilterBar/components/ImageCard/ImageCard.css +0 -30
  73. package/src/components/FilterBar/components/ImageCard/ImageCard.tsx +0 -45
  74. package/src/components/FilterBar/components/SelectButton/SelectButton.css +0 -76
  75. package/src/components/FilterBar/components/SelectButton/SelectButton.tsx +0 -54
  76. package/src/components/FilterBar/components/TabButton/TabButton.css +0 -36
  77. package/src/components/FilterBar/components/TabButton/TabButton.tsx +0 -23
  78. package/src/components/FilterBar/components/index.ts +0 -6
  79. package/src/components/FilterBar/hooks/index.ts +0 -5
  80. package/src/components/FilterBar/hooks/useFilterActions.tsx +0 -126
  81. package/src/components/FilterBar/hooks/useFilterRefs.tsx +0 -21
  82. package/src/components/FilterBar/hooks/useFilterState.tsx +0 -86
  83. package/src/components/FilterBar/hooks/usePanelPosition.tsx +0 -52
  84. package/src/components/FilterBar/hooks/useScrollInToView.tsx +0 -29
  85. package/src/components/FilterBar/index.ts +0 -3
  86. package/src/components/FilterBar/providers/FilterBarProvider.tsx +0 -172
  87. package/src/components/FilterBar/providers/index.ts +0 -1
  88. package/src/components/FilterBar/utils/ageCategoriesRules.ts +0 -27
  89. package/src/components/FilterBar/utils/index.tsx +0 -3
  90. package/src/components/FilterBar/utils/parseGuests.tsx +0 -65
  91. package/src/components/FilterBar/utils/parseLocations.ts +0 -28
  92. package/src/components/FilterCalendar/FilterCalendar.css +0 -109
  93. package/src/components/FilterCalendar/FilterCalendar.stories.tsx +0 -554
  94. package/src/components/FilterCalendar/FilterCalendar.tsx +0 -115
  95. package/src/components/FilterCalendar/FilterCalendarTypes.ts +0 -11
  96. package/src/components/FilterCalendar/components/Footer.tsx +0 -96
  97. package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +0 -163
  98. package/src/components/FilterCalendar/index.ts +0 -3
  99. package/src/core/components/buttons/CloseButton/CloseButton.css +0 -33
  100. package/src/core/components/buttons/CloseButton/CloseButton.tsx +0 -16
  101. package/src/core/components/buttons/SubmitButton/SubmitButton.css +0 -54
  102. package/src/core/components/buttons/SubmitButton/SubmitButton.tsx +0 -42
  103. package/src/core/components/calendar/Calendar.css +0 -280
  104. package/src/core/components/calendar/Calendar.tsx +0 -253
  105. package/src/core/components/calendar/CalendarTypes.ts +0 -48
  106. package/src/core/components/calendar/hooks/index.ts +0 -3
  107. package/src/core/components/calendar/hooks/useCalendarLoadingSpinner.tsx +0 -19
  108. package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +0 -125
  109. package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +0 -105
  110. package/src/core/components/calendar/utils/calendarSelectionRules.tsx +0 -180
  111. package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +0 -86
  112. package/src/core/components/calendar/utils/disabledDatesByPage.tsx +0 -31
  113. package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +0 -118
  114. package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +0 -75
  115. package/src/core/components/calendar/utils/index.ts +0 -8
  116. package/src/core/components/calendar/utils/nightsCount.tsx +0 -19
  117. package/src/core/components/calendar/utils/parseDate.tsx +0 -17
  118. package/src/core/components/calendar/utils/parseDates.tsx +0 -12
  119. package/src/core/components/index.ts +0 -7
  120. package/src/core/hooks/index.ts +0 -4
  121. package/src/core/hooks/useAutoFocus.tsx +0 -27
  122. package/src/core/hooks/useAwaitRender.tsx +0 -12
  123. package/src/core/hooks/useCloseFilterSection.tsx +0 -29
  124. package/src/core/hooks/useUpdateTranslations.tsx +0 -14
  125. package/src/i18n.ts +0 -27
  126. package/src/index.ts +0 -8
  127. package/src/locales/en/common.json +0 -18
  128. package/src/locales/en/filterBar.json +0 -33
  129. package/src/locales/fi/common.json +0 -19
  130. package/src/locales/fi/filterBar.json +0 -33
  131. package/src/themes/Default.css +0 -69
  132. package/src/themes/useTheme.tsx +0 -27
  133. package/stories/Button.stories.ts +0 -50
  134. package/stories/Button.tsx +0 -53
  135. package/stories/Configure.mdx +0 -364
  136. package/stories/Header.stories.ts +0 -27
  137. package/stories/Header.tsx +0 -70
  138. package/stories/Page.stories.ts +0 -29
  139. package/stories/Page.tsx +0 -91
  140. package/stories/assets/accessibility.png +0 -0
  141. package/stories/assets/accessibility.svg +0 -5
  142. package/stories/assets/addon-library.png +0 -0
  143. package/stories/assets/assets.png +0 -0
  144. package/stories/assets/context.png +0 -0
  145. package/stories/assets/discord.svg +0 -15
  146. package/stories/assets/docs.png +0 -0
  147. package/stories/assets/figma-plugin.png +0 -0
  148. package/stories/assets/github.svg +0 -3
  149. package/stories/assets/share.png +0 -0
  150. package/stories/assets/styling.png +0 -0
  151. package/stories/assets/testing.png +0 -0
  152. package/stories/assets/theming.png +0 -0
  153. package/stories/assets/tutorials.svg +0 -12
  154. package/stories/assets/youtube.svg +0 -4
  155. package/stories/button.css +0 -30
  156. package/stories/header.css +0 -32
  157. package/stories/page.css +0 -69
  158. package/tsconfig.json +0 -29
  159. /package/lib/components/FilterBar/components/{divider → Divider}/Divider.d.ts +0 -0
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.3.26",
3
+ "version": "0.4.0",
4
4
  "description": "A custom UI component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
7
7
  "types": "lib/index.d.ts",
8
+ "files": [
9
+ "lib"
10
+ ],
8
11
  "scripts": {
9
12
  "test": "echo \"Error: no test specified\" && exit 1",
10
13
  "storybook": "storybook dev -p 6006",
@@ -15,6 +18,8 @@
15
18
  "license": "MIT",
16
19
  "dependencies": {
17
20
  "classnames": "^2.5.1",
21
+ "date-fns": "2.30.0",
22
+ "i18next": "23.16.8",
18
23
  "react-day-picker": "8.8.0",
19
24
  "react-i18next": "^13.5.0",
20
25
  "react-icons": "^4.12.0",
@@ -28,6 +33,8 @@
28
33
  "@rollup/plugin-commonjs": "^29.0.0",
29
34
  "@rollup/plugin-json": "^6.1.0",
30
35
  "@rollup/plugin-node-resolve": "^15.3.1",
36
+ "@rollup/plugin-replace": "6.0.3",
37
+ "@rollup/plugin-terser": "1.0.0",
31
38
  "@rollup/plugin-typescript": "^11.1.6",
32
39
  "@storybook/addon-docs": "^10.2.10",
33
40
  "@storybook/addon-links": "^10.2.10",
@@ -36,6 +43,7 @@
36
43
  "@storybook/react-vite": "^10.2.10",
37
44
  "@storybook/testing-library": "^0.2.2",
38
45
  "@types/react": "^18.3.28",
46
+ "@types/react-dom": "18.3.7",
39
47
  "@vitejs/plugin-react": "^5.1.4",
40
48
  "postcss": "^8.4.27",
41
49
  "react": "^18.3.1",
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 24.13.0
@@ -1,17 +0,0 @@
1
- import type { StorybookConfig } from "@storybook/react-vite";
2
-
3
- const config: StorybookConfig = {
4
- stories: ["../src/**/*.stories.tsx"],
5
-
6
- addons: [
7
- "@storybook/addon-links",
8
- "@storybook/addon-onboarding",
9
- "@storybook/addon-docs"
10
- ],
11
-
12
- framework: {
13
- name: "@storybook/react-vite",
14
- options: {},
15
- }
16
- };
17
- export default config;
@@ -1,15 +0,0 @@
1
- import type { Preview } from "@storybook/react-vite";
2
-
3
- const preview: Preview = {
4
- parameters: {
5
- actions: { argTypesRegex: "^on[A-Z].*" },
6
- controls: {
7
- matchers: {
8
- color: /(background|color)$/i,
9
- date: /Date$/,
10
- },
11
- },
12
- },
13
- };
14
-
15
- export default preview;
@@ -1,4 +0,0 @@
1
- export { CloseButton } from '../../../../core/components/buttons/close-button/CloseButton';
2
- export { SubmitButton } from '../../../../core/components/buttons/submit-button/SubmitButton';
3
- export { SelectButton } from './select-button/SelectButton';
4
- export { TabButton } from './tab-button/TabButton';
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import './SelectButton.css';
3
- type Props = {
4
- label: string;
5
- onClick: () => void;
6
- description: string;
7
- active?: boolean;
8
- disabled?: boolean;
9
- ariaExpanded?: boolean;
10
- ariaControls?: string;
11
- };
12
- export declare const SelectButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLButtonElement>>;
13
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import './TabButton.css';
3
- type Props = {
4
- onClick?: () => void;
5
- label: string;
6
- active?: boolean;
7
- mode?: string;
8
- };
9
- export declare const TabButton: ({ onClick, label, active, mode }: Props) => React.JSX.Element;
10
- export {};
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import './ImageCard.css';
3
- type Props = {
4
- title?: string;
5
- description?: string | null;
6
- imageUrl?: string | null;
7
- isSelected: boolean;
8
- onClick?: () => void;
9
- };
10
- export declare const ImageCard: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
11
- export {};
@@ -1 +0,0 @@
1
- export { ImageCard } from './image-card/ImageCard';
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import './Categories.css';
3
- type Props = {
4
- categories: any;
5
- setCategories: any;
6
- };
7
- export declare const Categories: ({ categories, setCategories }: Props) => React.JSX.Element;
8
- export {};
@@ -1,8 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import './FilterSectionHeader.css';
3
- type Props = {
4
- title: string;
5
- action?: ReactNode;
6
- };
7
- export declare const FilterSectionHeader: ({ title, action }: Props) => React.JSX.Element;
8
- export {};
@@ -1,17 +0,0 @@
1
- import React, { RefObject } from 'react';
2
- import { DateRange } from 'react-day-picker';
3
- import { DisableCalendarDates } from '../../../../core/components/calendar/CalendarTypes';
4
- import './Dates.css';
5
- type Props = {
6
- ref: RefObject<HTMLDivElement>;
7
- onClose?: () => void;
8
- autoFocus?: boolean;
9
- calendarRange: DateRange | undefined;
10
- setCalendarRange: (range: DateRange | undefined) => void;
11
- disableCalendarDates?: DisableCalendarDates;
12
- selectedPath?: string;
13
- language?: string;
14
- filtersRef?: RefObject<HTMLDivElement>;
15
- };
16
- export declare const Dates: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
- export {};
@@ -1 +0,0 @@
1
- export { Dates } from './Dates';
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { GuestsCountPropsType } from '../../../FilterBarTypes';
3
- import './GuestCount.css';
4
- export declare const GuestCount: FC<GuestsCountPropsType>;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { AgeCategoryCount, AgeCategoryType } from '../../FilterBarTypes';
3
- import './Guests.css';
4
- type Props = {
5
- ageCategories: AgeCategoryType[];
6
- updateGuestsCount: (arg1: string, arg2: number) => void;
7
- ageCategoryCounts: AgeCategoryCount;
8
- autoFocus?: boolean;
9
- onClose?: () => void;
10
- };
11
- export declare const Guests: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
12
- export {};
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import './Locations.css';
3
- import { Location } from '../../FilterBarTypes';
4
- type Props = {
5
- locations?: Location[];
6
- language?: string;
7
- selectedLocations: Location[];
8
- setSelectedLocations: (locations: Location[]) => void;
9
- autoFocus?: boolean;
10
- multiSelect?: boolean;
11
- onClose?: () => void;
12
- };
13
- export declare const Locations: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
14
- export {};
@@ -1,32 +0,0 @@
1
- import { DateRange } from 'react-day-picker';
2
- import { AgeCategoryCount, AgeCategoryType, Filters, Tab, Location } from '../FilterBarTypes';
3
- type Props = {
4
- redirectUrl?: string;
5
- ageCategories?: AgeCategoryType[];
6
- onSubmit?: ((val: Filters) => void) | null;
7
- tabs?: Tab[];
8
- locations?: {
9
- multiSelect: boolean;
10
- data: Location[];
11
- };
12
- };
13
- export declare const useFilterBar: ({ redirectUrl, ageCategories, onSubmit, tabs, locations, }: Props) => {
14
- selectedFilter: string | boolean;
15
- ageCategoryCounts: AgeCategoryCount;
16
- categories: number;
17
- calendarRange: DateRange | undefined;
18
- selectedPath: string;
19
- innerLoading: boolean;
20
- selectedLocations: Location[];
21
- setSelectedLocations: import("react").Dispatch<import("react").SetStateAction<Location[]>>;
22
- setCalendarRange: import("react").Dispatch<import("react").SetStateAction<DateRange | undefined>>;
23
- setSelectedFilter: import("react").Dispatch<import("react").SetStateAction<string | boolean>>;
24
- setAgeCategoryCounts: import("react").Dispatch<import("react").SetStateAction<AgeCategoryCount>>;
25
- setCategories: import("react").Dispatch<import("react").SetStateAction<number>>;
26
- handleSelectedFilter: (id: string | boolean) => void;
27
- handleSubmit: () => void;
28
- updateGuestsCount: (id: string, newCount: number) => void;
29
- handleResetFilters: () => void;
30
- setSelectedPath: import("react").Dispatch<import("react").SetStateAction<string>>;
31
- };
32
- export {};
@@ -1,8 +0,0 @@
1
- export declare const useFilterUi: (selectedFilter: string | boolean) => {
2
- previouslyFocusedButtonRef: import("react").MutableRefObject<HTMLButtonElement | null>;
3
- isMobile: boolean;
4
- tabsRef: import("react").MutableRefObject<HTMLDivElement | null>;
5
- panelRef: import("react").MutableRefObject<HTMLDivElement | null>;
6
- buttonRefs: import("react").MutableRefObject<Record<string, HTMLButtonElement | null>>;
7
- filtersRef: import("react").MutableRefObject<HTMLDivElement | null>;
8
- };
@@ -1,12 +0,0 @@
1
- import { CSSProperties, RefObject } from 'react';
2
- import { FilterSections } from '../FilterBarTypes';
3
- type CalculateDropdownPositionParams = {
4
- filterSection: FilterSections;
5
- headerRef: RefObject<HTMLDivElement>;
6
- locationsButtonRef: RefObject<HTMLButtonElement>;
7
- datesButtonRef: RefObject<HTMLButtonElement>;
8
- guestsButtonRef: RefObject<HTMLButtonElement>;
9
- isMobile: boolean;
10
- };
11
- export declare const calculateDropdownPosition: ({ filterSection, headerRef, locationsButtonRef, datesButtonRef, guestsButtonRef, isMobile, }: CalculateDropdownPositionParams) => CSSProperties;
12
- export {};
@@ -1,8 +0,0 @@
1
- import { LocaleTranslation } from '../FilterBarTypes';
2
- type Props = {
3
- contents: LocaleTranslation;
4
- locale: string;
5
- fallbackLocale?: string;
6
- };
7
- export declare const getLocalizedContent: ({ contents, locale, fallbackLocale, }: Props) => string | undefined;
8
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import './CloseButton.css';
3
- interface CloseButtonPropsType {
4
- handleClose: () => void;
5
- }
6
- export declare const CloseButton: ({ handleClose }: CloseButtonPropsType) => React.JSX.Element;
7
- export {};
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { ReactNode } from 'react';
3
- import './SubmitButton.css';
4
- type SubmitButtonVariant = 'text' | 'full';
5
- type Props = {
6
- onClick?: () => void;
7
- startIcon?: ReactNode;
8
- label?: string;
9
- disabled?: boolean;
10
- isLoading?: boolean;
11
- variant?: SubmitButtonVariant;
12
- };
13
- export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, variant, }: Props) => React.JSX.Element;
14
- export {};