@yatoday/astro-ui 0.6.6 → 0.6.10
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/components/CallToAction/types.ts +1 -1
- package/components/Card1/types.ts +1 -1
- package/components/Card3/types.ts +1 -1
- package/components/Card4/types.ts +1 -1
- package/components/HeroSection/HeroSection.astro +7 -5
- package/components/WidgetSwiperPhotoSlider/WidgetSwiperPhotoSlider.astro +1 -1
- package/index.js +1 -0
- package/package.json +1 -2
- package/utils/URLUtils.ts +2 -2
- package/utils/slugify.ts +82 -0
|
@@ -7,7 +7,7 @@ export type Card1Props = {
|
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
9
|
icon?: string;
|
|
10
|
-
callToAction?: string | ToAction
|
|
10
|
+
callToAction?: string | ToAction | Array<string | ToAction>;
|
|
11
11
|
data?: NameValue[];
|
|
12
12
|
links?: Link[];
|
|
13
13
|
badge?: string;
|
|
@@ -21,10 +21,12 @@ const img = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const {
|
|
24
|
-
container: containerClass = 'h-96',
|
|
24
|
+
container: containerClass = 'bg-zinc-700 text-zinc-200 h-96',
|
|
25
25
|
image: imageClass = '',
|
|
26
|
+
content: contentClass = '',
|
|
26
27
|
title: titleClass = '',
|
|
27
28
|
description: descriptionClass = '',
|
|
29
|
+
action: actionClass = 'w-full',
|
|
28
30
|
} = classes;
|
|
29
31
|
|
|
30
32
|
const WrapperHeaderTag = asHeader;
|
|
@@ -32,13 +34,13 @@ const WrapperHeaderTag = asHeader;
|
|
|
32
34
|
|
|
33
35
|
<div
|
|
34
36
|
class={twMerge(
|
|
35
|
-
'swiper-slide overflow-hidden
|
|
37
|
+
'swiper-slide overflow-hidden dark:bg-card dark:text-card-foreground',
|
|
36
38
|
containerClass
|
|
37
39
|
)}
|
|
38
40
|
>
|
|
39
41
|
<div class="slide flex flex-col-reverse justify-between md:flex-row h-full">
|
|
40
42
|
<div class="w-full flex items-center justify-center">
|
|
41
|
-
<div class="p-6 md:px-12 lg:px-20 xl:px-24 w-full h-full md:h-auto">
|
|
43
|
+
<div class={twMerge("p-6 md:px-12 lg:px-20 xl:px-24 w-full h-full md:h-auto", contentClass)}>
|
|
42
44
|
<slot />
|
|
43
45
|
{
|
|
44
46
|
title && description && (
|
|
@@ -46,7 +48,7 @@ const WrapperHeaderTag = asHeader;
|
|
|
46
48
|
<div class="mb-6">
|
|
47
49
|
<WrapperHeaderTag
|
|
48
50
|
class={twMerge(
|
|
49
|
-
'text-
|
|
51
|
+
'text-base md:text-lg xl:text-2xl font-medium md:font-semibold mb-2',
|
|
50
52
|
titleClass
|
|
51
53
|
)}
|
|
52
54
|
>
|
|
@@ -56,7 +58,7 @@ const WrapperHeaderTag = asHeader;
|
|
|
56
58
|
</div>
|
|
57
59
|
{callToAction && (
|
|
58
60
|
<Button
|
|
59
|
-
class={twMerge('transition hover:translate-y-0.5 w-full',
|
|
61
|
+
class={twMerge('transition hover:translate-y-0.5 w-full', actionClass)}
|
|
60
62
|
{...callToAction}
|
|
61
63
|
/>
|
|
62
64
|
)}
|
|
@@ -62,7 +62,7 @@ const imagePaths = Object.keys(images).filter((imagePath) => {
|
|
|
62
62
|
width={400}
|
|
63
63
|
height={400}
|
|
64
64
|
sizes="(max-width: 900px) 400px, 900px"
|
|
65
|
-
class="w-full md:h-full group-hover:scale-105 transition duration-300"
|
|
65
|
+
class="aspect-square w-full md:h-full group-hover:scale-105 transition duration-300"
|
|
66
66
|
/>
|
|
67
67
|
</a>
|
|
68
68
|
</swiper-slide>
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yatoday/astro-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.10",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "husky",
|
|
7
7
|
"pre-commit": "lint-staged",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"create-component": "node scripts/createComponent.js"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"limax": "4.1.0",
|
|
27
26
|
"lodash.merge": "^4.6.2",
|
|
28
27
|
"photoswipe": "^5.4.4",
|
|
29
28
|
"swiper": "^11.2.5",
|
package/utils/URLUtils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import slugify from '../utils/slugify';
|
|
2
2
|
import { trim } from './utils';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -39,7 +39,7 @@ export const createPath = (...params: string[]): string => {
|
|
|
39
39
|
export const cleanSlug = (text: string = ''): string =>
|
|
40
40
|
trimSlash(text)
|
|
41
41
|
.split('/')
|
|
42
|
-
.map((a: string) =>
|
|
42
|
+
.map((a: string) => slugify(a))
|
|
43
43
|
.join('/');
|
|
44
44
|
|
|
45
45
|
/**
|
package/utils/slugify.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
replacement?: string;
|
|
3
|
+
remove?: RegExp;
|
|
4
|
+
lower?: boolean;
|
|
5
|
+
strict?: boolean;
|
|
6
|
+
trim?: boolean;
|
|
7
|
+
locale?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface LocaleMap {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface CharMap {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const charMap: CharMap = JSON.parse(
|
|
19
|
+
'{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E\'","Ը":"Y\'","Թ":"T\'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C\'","Կ":"K","Հ":"H","Ձ":"D\'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R\'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P\'","Ք":"Q\'","Օ":"O\'\'","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"\'","’":"\'","“":"\\\"","”":"\\\"","„":"\\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}'
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const locales: Record<string, LocaleMap> = JSON.parse(
|
|
23
|
+
'{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}'
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
function replace(string: string, options?: string | Options): string {
|
|
27
|
+
if (typeof string !== 'string') {
|
|
28
|
+
throw new Error('slugify: string argument expected');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const resolvedOptions: Options =
|
|
32
|
+
typeof options === 'string' ? { replacement: options } : options || {};
|
|
33
|
+
|
|
34
|
+
const locale: LocaleMap = locales[resolvedOptions.locale || ''] || {};
|
|
35
|
+
const replacement: string = resolvedOptions.replacement === undefined ? '-' : resolvedOptions.replacement;
|
|
36
|
+
const trim: boolean = resolvedOptions.trim === undefined ? true : resolvedOptions.trim;
|
|
37
|
+
|
|
38
|
+
// Define a regular expression to remove single and double quotes
|
|
39
|
+
const quotesAndSpecialCharsToRemove = /['"]+/g;
|
|
40
|
+
|
|
41
|
+
let slug = string
|
|
42
|
+
.normalize()
|
|
43
|
+
.replace(quotesAndSpecialCharsToRemove, '') // Remove quotes
|
|
44
|
+
.split('')
|
|
45
|
+
.reduce((result, ch) => {
|
|
46
|
+
let appendChar: string | undefined = locale[ch];
|
|
47
|
+
if (appendChar === undefined) appendChar = charMap[ch];
|
|
48
|
+
if (appendChar === undefined) appendChar = ch;
|
|
49
|
+
if (appendChar === replacement) appendChar = ' ';
|
|
50
|
+
return result + appendChar;
|
|
51
|
+
}, '')
|
|
52
|
+
.replace(resolvedOptions.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, '');
|
|
53
|
+
|
|
54
|
+
if (resolvedOptions.strict) {
|
|
55
|
+
slug = slug.replace(/[^A-Za-z0-9\s]/g, '');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (trim) {
|
|
59
|
+
slug = slug.trim();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
slug = slug.replace(/\s+/g, replacement);
|
|
63
|
+
|
|
64
|
+
if (resolvedOptions.lower) {
|
|
65
|
+
slug = slug.toLowerCase();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return slug;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
replace.extend = (customMap: CharMap): void => {
|
|
72
|
+
Object.assign(charMap, customMap);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Export as a module
|
|
76
|
+
export default replace;
|
|
77
|
+
|
|
78
|
+
// For CommonJS compatibility (as in the original code)
|
|
79
|
+
if (typeof exports === 'object') {
|
|
80
|
+
module.exports = replace;
|
|
81
|
+
module.exports.default = replace;
|
|
82
|
+
}
|