@cooperco/cooper-component-library 0.1.0 → 0.1.1

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,94 +1,94 @@
1
1
  {
2
- "name": "@cooperco/cooper-component-library",
3
- "private": false,
4
- "version": "0.1.0",
5
- "type": "module",
6
- "files": [
7
- "dist",
8
- "src/components/",
9
- "src/assets/"
10
- ],
11
- "main": "./dist/component-lib.umd.cjs",
12
- "module": "./dist/component-lib.js",
13
- "exports": {
14
- ".": {
15
- "import": "./dist/component-lib.js",
16
- "require": "./dist/component-lib.umd.cjs"
17
- },
18
- "./dist/style.css": {
19
- "import": "./dist/style.css",
20
- "require": "./dist/style.css"
21
- },
22
- "./components/*": "./dist/components/*",
23
- "./assets/*": "./dist/assets/*"
24
- },
25
- "scripts": {
26
- "dev": "vite",
27
- "check-types": "vue-tsc --noEmit",
28
- "build": "vite build",
29
- "preview": "vite preview",
30
- "tail": "tailwind-config-viewer -o",
31
- "storybook": "storybook dev -p 6006",
32
- "build-storybook": "storybook build",
33
- "chromatic": "chromatic --exit-zero-on-changes",
34
- "prepare": "husky",
35
- "lint": "eslint . --no-fix",
36
- "lint:fix": "eslint . --fix --quiet"
37
- },
38
- "dependencies": {
39
- "@primevue/themes": "^4.0.0",
40
- "primeicons": "^7.0.0",
41
- "primevue": "^3.0.0",
42
- "tailwind-merge": "^2.4.0",
43
- "vite-plugin-turbosnap": "^1.0.3",
44
- "vue": "^3.0.0"
45
- },
46
- "devDependencies": {
47
- "@cooperco/contentful-cli-migrations": "^0.5.0",
48
- "@chromatic-com/storybook": "^1.6.1",
49
- "@eslint/js": "^9.4.0",
50
- "@storybook/addon-essentials": "^8.2.8",
51
- "@storybook/addon-interactions": "^8.2.8",
52
- "@storybook/addon-links": "^8.2.8",
53
- "@storybook/blocks": "^8.2.8",
54
- "@storybook/builder-vite": "^8.2.8",
55
- "@storybook/test": "^8.2.8",
56
- "@storybook/vue3": "^8.2.8",
57
- "@storybook/vue3-vite": "^8.2.8",
58
- "@tsconfig/node18": "^18.2.4",
59
- "@vitejs/plugin-vue": "^5.0.4",
60
- "@vue/tsconfig": "^0.5.1",
61
- "autoprefixer": "^10.4.19",
62
- "chromatic": "^11.4.0",
63
- "eslint": "^8.57.0",
64
- "eslint-config-prettier": "^9.1.0",
65
- "eslint-plugin-vue": "^9.26.0",
66
- "globals": "^15.3.0",
67
- "husky": "^9.1.4",
68
- "jsdom": "^24.1.0",
69
- "lint-staged": "^15.2.8",
70
- "postcss": "^8.4.38",
71
- "prettier": "3.3.1",
72
- "storybook": "^8.2.8",
73
- "storybook-vue3-router": "^5.0.0",
74
- "tailwind-config-viewer": "^2.0.2",
75
- "tailwindcss": "^3.4.3",
76
- "typescript": "~5.3.3",
77
- "typescript-eslint": "^7.17.0",
78
- "unplugin-vue-components": "^0.27.0",
79
- "vite": "^5.2.0",
80
- "vue-eslint-parser": "^9.4.3",
81
- "vue-router": "^4.4.3",
82
- "vue-tsc": "^2.0.29"
83
- },
84
- "peerDependencies": {
85
- "primevue": "^3.0.0",
86
- "tailwindcss": "^3.0.0",
87
- "vue": "^3.0.0"
88
- },
89
- "lint-staged": {
90
- "*.{json,js,ts,jsx,tsx,html,vue}": [
91
- "prettier --write --ignore-unknown"
92
- ]
93
- }
94
- }
2
+ "name": "@cooperco/cooper-component-library",
3
+ "private": false,
4
+ "version": "0.1.1",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "src/components/",
9
+ "src/assets/",
10
+ "src/config/"
11
+ ],
12
+ "main": "./dist/component-lib.umd.cjs",
13
+ "module": "./dist/component-lib.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/component-lib.js",
17
+ "require": "./dist/component-lib.umd.cjs"
18
+ },
19
+ "./dist/style.css": {
20
+ "import": "./dist/style.css",
21
+ "require": "./dist/style.css"
22
+ },
23
+ "./components/*": "./dist/components/*",
24
+ "./assets/*": "./dist/assets/*"
25
+ },
26
+ "dependencies": {
27
+ "@primevue/themes": "^4.0.0",
28
+ "primeicons": "^7.0.0",
29
+ "primevue": "^3.0.0",
30
+ "tailwind-merge": "^2.4.0",
31
+ "vite-plugin-turbosnap": "^1.0.3",
32
+ "vue": "^3.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@chromatic-com/storybook": "^1.6.1",
36
+ "@cooperco/contentful-cli-migrations": "^0.5.0",
37
+ "@eslint/js": "^9.4.0",
38
+ "@storybook/addon-essentials": "^8.2.8",
39
+ "@storybook/addon-interactions": "^8.2.8",
40
+ "@storybook/addon-links": "^8.2.8",
41
+ "@storybook/blocks": "^8.2.8",
42
+ "@storybook/builder-vite": "^8.2.8",
43
+ "@storybook/test": "^8.2.8",
44
+ "@storybook/vue3": "^8.2.8",
45
+ "@storybook/vue3-vite": "^8.2.8",
46
+ "@tsconfig/node18": "^18.2.4",
47
+ "@vitejs/plugin-vue": "^5.0.4",
48
+ "@vue/tsconfig": "^0.5.1",
49
+ "autoprefixer": "^10.4.19",
50
+ "chromatic": "^11.4.0",
51
+ "eslint": "^8.57.0",
52
+ "eslint-config-prettier": "^9.1.0",
53
+ "eslint-plugin-vue": "^9.26.0",
54
+ "globals": "^15.3.0",
55
+ "husky": "^9.1.4",
56
+ "jsdom": "^24.1.0",
57
+ "lint-staged": "^15.2.8",
58
+ "postcss": "^8.4.38",
59
+ "prettier": "3.3.1",
60
+ "storybook": "^8.2.8",
61
+ "storybook-vue3-router": "^5.0.0",
62
+ "tailwind-config-viewer": "^2.0.2",
63
+ "tailwindcss": "^3.4.4",
64
+ "typescript": "~5.3.3",
65
+ "typescript-eslint": "^7.17.0",
66
+ "unplugin-vue-components": "^0.27.0",
67
+ "vite": "^5.2.0",
68
+ "vue-eslint-parser": "^9.4.3",
69
+ "vue-router": "^4.4.3",
70
+ "vue-tsc": "^2.0.29"
71
+ },
72
+ "peerDependencies": {
73
+ "primevue": "^3.0.0",
74
+ "tailwindcss": "^3.0.0",
75
+ "vue": "^3.0.0"
76
+ },
77
+ "lint-staged": {
78
+ "*.{json,js,ts,jsx,tsx,html,vue}": [
79
+ "prettier --write --ignore-unknown"
80
+ ]
81
+ },
82
+ "scripts": {
83
+ "dev": "vite",
84
+ "check-types": "vue-tsc --noEmit",
85
+ "build": "vite build",
86
+ "preview": "vite preview",
87
+ "tail": "tailwind-config-viewer -o",
88
+ "storybook": "storybook dev -p 6006",
89
+ "build-storybook": "storybook build",
90
+ "chromatic": "chromatic --exit-zero-on-changes",
91
+ "lint": "eslint . --no-fix",
92
+ "lint:fix": "eslint . --fix --quiet"
93
+ }
94
+ }
@@ -0,0 +1,261 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { twMerge } from 'tailwind-merge'
3
+ import { ComponentPassthrough } from '../types'
4
+ import { ContainerModulePassthrough } from '../components/ContainerModule/ContainerModule'
5
+ import { AccordionItemPassthrough } from '../components/Accordion/AccordionItem'
6
+ import { AccordionPassthrough } from '../components/Accordion/Accordion'
7
+ import { CarouselPassthrough } from '../components/CarouselModule/CarouselModule'
8
+ import { ContentModulePassthrough } from '../components/ContentModule/ContentModule'
9
+ import { TestimonialModulePassthrough } from '../components/TestimonialModule/TestimonialModule'
10
+ import { TileContentPassthrough } from '../components/TileContent/TileContent'
11
+ import { CTAPassthrough } from '../components/CTA/CTA'
12
+
13
+ export const DEFAULT_PASSTHROUGH: ComponentPassthrough = {
14
+ headline:
15
+ 'mb-12 text-4xl md:text-5xl font-bold leading-tight text-center text-primary',
16
+ subheadline: 'mb-2',
17
+ content: '',
18
+ description: '',
19
+ start: '',
20
+ center: '',
21
+ end: '',
22
+ container: 'max-w-[1024px] mx-auto',
23
+ }
24
+
25
+ interface GenericComponentPassthrough
26
+ extends ComponentPassthrough,
27
+ AccordionPassthrough,
28
+ AccordionItemPassthrough,
29
+ CarouselPassthrough,
30
+ ContainerModulePassthrough,
31
+ ContentModulePassthrough,
32
+ CTAPassthrough,
33
+ TestimonialModulePassthrough,
34
+ TileContentPassthrough {}
35
+
36
+ /**
37
+ * TODO: Need to define the types for the passthroughs.
38
+ * REMOVE eslint-disable once types are defined
39
+ */
40
+ export const combinePassthroughs = <
41
+ PtType extends GenericComponentPassthrough,
42
+ OverrideType extends GenericComponentPassthrough,
43
+ >(
44
+ passthrough: PtType,
45
+ overrides: OverrideType
46
+ ) => {
47
+ const built: GenericComponentPassthrough = {}
48
+
49
+ // First combine the core passthroughs
50
+ for (const key in passthrough) {
51
+ ;(built as any)[key] = twMerge(
52
+ (passthrough as any)[key] ?? '',
53
+ (overrides as any)[key] ?? ''
54
+ )
55
+ }
56
+
57
+ // Combine any overrides
58
+ for (const key in overrides) {
59
+ ;(built as any)[key] = twMerge(
60
+ (built as any)[key] ?? '',
61
+ (overrides as any)[key] ?? ''
62
+ )
63
+ }
64
+
65
+ return built
66
+ }
67
+
68
+ export interface AccordionPtVariants {
69
+ List: AccordionPassthrough
70
+ Tile: AccordionPassthrough
71
+ }
72
+
73
+ export const AccordionPt: AccordionPtVariants = {
74
+ List: combinePassthroughs(DEFAULT_PASSTHROUGH, {
75
+ container: 'flex flex-col',
76
+ }),
77
+ Tile: combinePassthroughs(DEFAULT_PASSTHROUGH, {
78
+ container: 'flex flex-wrap gap-4 items-stretch relative',
79
+ // we should make the "has-.." class programmatic, so it goes off the height of the opened item.
80
+ root: 'mb-0 relative transition-all duration-200 has-[.active]:mb-[550px]',
81
+ }),
82
+ }
83
+
84
+ export const AccordionItemPt = combinePassthroughs(DEFAULT_PASSTHROUGH, {
85
+ headline: 'text-lg md:text-lg mb-0 *:text-left',
86
+ image: 'w-14 mr-4',
87
+ })
88
+
89
+ export const AccordionListItemPt = combinePassthroughs(AccordionItemPt, {
90
+ root: 'border-b first:border-t first:border-t-black border-b-black',
91
+ headline:
92
+ 'text-primary-950 text-xl md:text-xl py-6 pr-2 *:text-left font-bold ',
93
+ icon: 'text-primary-950',
94
+ content: 'pb-6',
95
+ })
96
+
97
+ export const AccordionTileItemPt = combinePassthroughs(AccordionItemPt, {
98
+ root: ' w-full md:w-[23%]',
99
+ headline:
100
+ 'transition-height mb-0 h-[90%] duration-200 py-16 md:text-3xl text-3xl text-center relative rounded-2xl text-white h-[90%] bg-primary group-[.active]:rounded-t-2lg group-[.active]:rounded-b-none group-[.active]:h-full flex items-center justify-center',
101
+ button:
102
+ 'h-full w-fit text-center *:text-center justify-center md:*:[word-spacing:100px]', // word-spacing so that text wraps when not in mobile
103
+ icon: 'absolute top-4 right-6',
104
+ content:
105
+ 'group-[.first]:rounded-tl-none group-[.last]:rounded-tr-none transition-opacity duration-200 opacity-0 left-0 absolute w-full p-12 text-white rounded-2xl bg-primary group-[.active]:opacity-100',
106
+ })
107
+
108
+ export const CarouselModulePt = combinePassthroughs(DEFAULT_PASSTHROUGH, {})
109
+
110
+ export const CarouselModuleAltPt = combinePassthroughs(DEFAULT_PASSTHROUGH, {})
111
+
112
+ export const ContainerCollectionModulePt = combinePassthroughs(
113
+ DEFAULT_PASSTHROUGH,
114
+ {
115
+ root: 'px-8 md:px-0',
116
+ content: 'max-w-[1024px]',
117
+ }
118
+ )
119
+
120
+ export interface ContainerModulePtVariants {
121
+ Hero: ContainerModulePassthrough
122
+ Centered: ContainerModulePassthrough
123
+ }
124
+
125
+ export const ContainerModulePt: ContainerModulePtVariants = {
126
+ Centered: combinePassthroughs(DEFAULT_PASSTHROUGH, {
127
+ root: 'px-8 md:px-0',
128
+ inner: 'h-full mx-auto max-w-[1024px]',
129
+ fullWidthContent: 'max-w-full w-full',
130
+ }),
131
+ Hero: combinePassthroughs(DEFAULT_PASSTHROUGH, {
132
+ root: 'md:h-[500px] mb-12',
133
+ inner: 'md:flex md:items-center h-full py-16 px-4 md:px-16 mb-8',
134
+ headline:
135
+ 'md:text-left text-primary-950 text-[8.75vmin] md:text-6xl text-center',
136
+ }),
137
+ }
138
+
139
+ export const ContentModulePt = combinePassthroughs(DEFAULT_PASSTHROUGH, {
140
+ root: 'p-5',
141
+ headline: 'mb-4 text-4xl md:text-4xl',
142
+ description: '',
143
+ ctas: 'mt-4',
144
+ cta: '',
145
+ })
146
+
147
+ export interface CTAPtVariants {
148
+ fill: CTAPassthrough
149
+ logo: CTAPassthrough
150
+ link: CTAPassthrough
151
+ outline: CTAPassthrough
152
+ }
153
+
154
+ export const CTAPt: CTAPtVariants = {
155
+ link: {
156
+ logo: 'p-2 bg-[#18a589] rounded-full',
157
+ },
158
+ logo: {
159
+ logo: 'p-2 bg-[#18a589] rounded-full',
160
+ },
161
+ fill: {},
162
+ outline: {},
163
+ }
164
+
165
+ export const FooterNavigationPt = combinePassthroughs(DEFAULT_PASSTHROUGH, {})
166
+
167
+ export const ImagePt = combinePassthroughs(DEFAULT_PASSTHROUGH, {})
168
+
169
+ export const LogoCollectionModulePt = combinePassthroughs(
170
+ DEFAULT_PASSTHROUGH,
171
+ {}
172
+ )
173
+
174
+ export const NavigationElementPt = combinePassthroughs(DEFAULT_PASSTHROUGH, {
175
+ icon: 'ps-2 text-xs',
176
+ })
177
+
178
+ export const PrimaryNavigationPt = combinePassthroughs(DEFAULT_PASSTHROUGH, {})
179
+
180
+ export const SplitModulePt = combinePassthroughs(DEFAULT_PASSTHROUGH, {
181
+ root: 'px-8 md:px-0',
182
+ content:
183
+ 'max-w-[1024px] flex justify-evenly gap-4 mx-auto flex-col md:flex-row',
184
+ })
185
+
186
+ export const TestimonialModulePt = combinePassthroughs(DEFAULT_PASSTHROUGH, {
187
+ headline: 'text-primary-950',
188
+ quote: 'text-primary-950 text-lg font-bold',
189
+ text: 'space-y-4 w-full md:w-1/2',
190
+ author: 'text-lg text-gray-600',
191
+ details: 'text-lg text-gray-600',
192
+ media: 'md:w-1/2 w-full',
193
+ })
194
+
195
+ export interface TileCollectionPtVariants {
196
+ IconTile: ComponentPassthrough
197
+ ImageTile: ComponentPassthrough
198
+ VideoTile: ComponentPassthrough
199
+ TextTile: ComponentPassthrough
200
+ ImageStackedAnimatedTile: ComponentPassthrough
201
+ }
202
+
203
+ export const TileCollectionModulePt = combinePassthroughs(DEFAULT_PASSTHROUGH, {
204
+ root: 'px-8 md:px-0',
205
+ })
206
+
207
+ export const TileContentPt = {
208
+ root: 'w-full md:w-[48%] lg:w-[30%] relative flex-auto rounded overflow-visible mx-auto shadow-none flex-none !m-0',
209
+ label:
210
+ 'bg-[#18a589] w-[120px] p-2 rounded-[50%] rounded-lg text-2xl text-white flex items-center justify-center leading-none font-bold absolute right-[-4%] top-8',
211
+ numericLabel:
212
+ 'absolute rounded-full bg-primary w-[25%] h-[25%] left-4 top-8 md:left-0 md:top-2 text-4xl text-white font-bold flex items-center justify-center',
213
+ headline: 'mb-4 text-4xl md:text-3xl text-center text-primary-950 font-bold',
214
+ // media: 'h-auto w-full mx-auto mb-8 flex items-center justify-center',
215
+ cta: 'text-xl *:font-bold mx-auto text-center font-bold',
216
+ ctas: 'flex gap-2',
217
+ container: 'h-full',
218
+ description: 'leading-normal text-lg',
219
+ body: 'h-full flex flex-col justify-between',
220
+ footer: 'font-bold text-center mt-4 space-y-2',
221
+ footerContent: 'font-bold text-center',
222
+ }
223
+
224
+ export const TileContentIconTilePt = combinePassthroughs(TileContentPt, {
225
+ root: 'bg-white rounded-2xl p-8',
226
+ ctas: 'text-center',
227
+ media: 'mb-6 mx-auto',
228
+ numericLabel:
229
+ 'bg-[#18a589] w-[50px] p-2 rounded-[50%] h-[40px] rounded-lg text-3xl md:text-3xl text-white flex items-center justify-center leading-none font-bold absolute left-[-4%] md:left-[-4%] top-8 md:top-8',
230
+ })
231
+
232
+ export const TileContentImageStackedAnimatedTilePt = combinePassthroughs(
233
+ TileContentPt,
234
+ {
235
+ root: '!w-full',
236
+ inner: 'justify-center',
237
+ label:
238
+ 'rounded-full flex items-center justify-center font-bold absolute text-white bg-primary z-20 w-auto w-20 h-20 text-4xl rounded-full font-bold',
239
+ media: 'flex-[1_0_26%] md:flex-[1_0_20%]',
240
+ headline: 'font-bold text-left max-w-[400px]',
241
+ subheadline:
242
+ 'text-[4.5vmin] md:text-3xl font-bold text-white max-w-[400px]',
243
+ description: 'text-lg max-w-[400px]',
244
+ }
245
+ )
246
+ export const TileContentImageTilePt = combinePassthroughs(TileContentPt, {
247
+ media: 'relative mb-4 md:w-3/4 mx-auto',
248
+ })
249
+ export const TileContentTextTilePt = combinePassthroughs(TileContentPt, {
250
+ ctas: 'flex-col gap-4',
251
+ description: 'text-center',
252
+ })
253
+ export const TileContentVideoTilePt = combinePassthroughs(TileContentPt, {
254
+ root: 'bg-white p-8 rounded-xl',
255
+ headline: 'text-3xl md:text-3xl mb-2 text-primary font-bold',
256
+ subheadline: 'text-base md:text-base text-primary-950 text-center',
257
+ media: 'mb-4 mt-6',
258
+ description: 'text-left',
259
+ })
260
+
261
+ export const VideoPt = combinePassthroughs(DEFAULT_PASSTHROUGH, {})