@contentrain/astro-kit 0.34.3 → 0.36.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.
package/catalog.json CHANGED
@@ -626,6 +626,11 @@
626
626
  "label": "Image description",
627
627
  "description": "What the image shows, for readers who cannot see it; empty when it is decoration."
628
628
  },
629
+ "icon": {
630
+ "type": "image",
631
+ "label": "Icon",
632
+ "description": "A small image above the title (decoration)."
633
+ },
629
634
  "eyebrow": {
630
635
  "type": "string",
631
636
  "label": "Eyebrow",
@@ -791,6 +796,7 @@
791
796
  "items[].linkLabel": "items[].link_label",
792
797
  "items[].image": "items[].image",
793
798
  "items[].imageAlt": "items[].image_alt",
799
+ "items[].icon": "items[].icon",
794
800
  "items[].eyebrow": "items[].eyebrow"
795
801
  }
796
802
  },
@@ -4566,6 +4572,10 @@
4566
4572
  "type": "string",
4567
4573
  "description": "Locale the date is written in (site.language)."
4568
4574
  },
4575
+ "timeZone": {
4576
+ "type": "string",
4577
+ "description": "Time zone the date is read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC."
4578
+ },
4569
4579
  "image": {
4570
4580
  "type": "object",
4571
4581
  "fields": {
@@ -4804,6 +4814,11 @@
4804
4814
  "content": false,
4805
4815
  "description": "BCP 47 locale the dates are written in (site.language)."
4806
4816
  },
4817
+ "timeZone": {
4818
+ "type": "string",
4819
+ "content": false,
4820
+ "description": "Time zone the dates are read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC."
4821
+ },
4807
4822
  "surface": {
4808
4823
  "type": "string",
4809
4824
  "content": false,
@@ -42,6 +42,8 @@ interface Item {
42
42
  /** The image's address (or, until 0.7, an `ImageInput`). */
43
43
  image?: ImageSource | undefined
44
44
  imageAlt?: string | undefined
45
+ /** A small image (an icon) above the title: decoration, so it has no alt (an icon box's svg, a feature's mark). */
46
+ icon?: string | undefined
45
47
  eyebrow?: string | undefined
46
48
  }
47
49
 
@@ -79,6 +81,7 @@ const headingId = title ? `cards-${title.toLowerCase().replace(/[^a-z0-9]+/g, '-
79
81
  {items.map(item => (
80
82
  <li class={card()}>
81
83
  {imageOf(item.image, item.imageAlt) && <div class={media()}><KitImage image={imageOf(item.image, item.imageAlt)!} sizes="(min-width: 1024px) 33vw, (min-width: 640px) 50vw, 100vw" class="aspect-[3/2] w-full object-cover transition duration-300 group-hover:scale-[1.02]" /></div>}
84
+ {item.icon && <KitImage image={{ src: item.icon, alt: '' }} class="h-10 w-10 object-contain" />}
82
85
  {item.eyebrow && <p class="text-sm font-medium text-accent-text">{item.eyebrow}</p>}
83
86
  <CardHeading class={cardTitle()}>
84
87
  {item.href && !item.linkLabel
@@ -4,5 +4,6 @@
4
4
  { "name": "four-elevated-inverse", "props": { "columns": "4", "style": "elevated", "tone": "inverse", "headingLevel": 3, "title": "Team", "items": [{ "title": "Mira Kovač", "text": "Editor", "image": { "src": "/kit-fixtures/avatar-1.svg", "alt": "Mira Kovač", "width": 96, "height": 96 } }, { "title": "Jon Ade", "text": "Engineer", "image": { "src": "/kit-fixtures/avatar-2.svg", "alt": "Jon Ade", "width": 96, "height": 96 } }, { "title": "Lea Park", "text": "Designer", "image": { "src": "/kit-fixtures/avatar-3.svg", "alt": "Lea Park", "width": 96, "height": 96 } }, { "title": "Sam Ortiz", "text": "Producer" }] } },
5
5
  { "name": "accent", "props": { "tone": "accent", "columns": "3", "items": [{ "title": "Fast", "text": "Static HTML, one stylesheet." }, { "title": "Editable", "text": "Content in Contentrain Studio." }, { "title": "Kept", "text": "Every address survives." }] } },
6
6
  {"name": "measured-columns", "props": {"title": "Services", "measured": {"containerPx": 1140, "padY": 80, "columns": {"390": 1, "768": 2, "1280": 4}, "gap": 30, "radius": 4, "bg": {"color": "#f4f1ea"}}, "items": [{"title": "Audits", "text": "Where a site loses readers."}, {"title": "Builds", "text": "Static and fast."}, {"title": "Hosting", "text": "Managed for you."}, {"title": "Care", "text": "Kept up to date."}]}},
7
+ {"name": "icon-boxes", "props": {"columns": "3", "align": "center", "items": [{"title": "Design", "text": "Layouts built around your products.", "icon": "/kit-fixtures/icon-1.svg"}, {"title": "Build", "text": "Fast pages that stay fast.", "icon": "/kit-fixtures/icon-1.svg"}, {"title": "Grow", "text": "Monthly reports you can read in five minutes.", "icon": "/kit-fixtures/icon-1.svg"}]}},
7
8
  {"name": "link-labels", "props": {"columns": "4", "align": "center", "items": [{"title": "Kasko", "href": "/urunlerimiz/kasko/", "linkLabel": "Teklif Al"}, {"title": "Trafik Sigortası", "href": "/urunlerimiz/trafik-sigortasi/", "linkLabel": "Teklif Al"}, {"title": "Konut Sigortası", "href": "/urunlerimiz/konut-sigortasi/", "linkLabel": "Teklif Al"}, {"title": "Tamamlayıcı Sağlık"}]}}
8
9
  ]
@@ -99,6 +99,11 @@
99
99
  "label": "Image description",
100
100
  "description": "What the image shows, for readers who cannot see it; empty when it is decoration."
101
101
  },
102
+ "icon": {
103
+ "type": "image",
104
+ "label": "Icon",
105
+ "description": "A small image above the title (decoration)."
106
+ },
102
107
  "eyebrow": {
103
108
  "type": "string",
104
109
  "label": "Eyebrow",
@@ -44,6 +44,8 @@ interface Props {
44
44
  date?: Date | string | undefined
45
45
  /** BCP 47 locale the date is written in (site.language). */
46
46
  locale?: string | undefined
47
+ /** The time zone the date is read in (the site's, an IANA name or a `±hh:mm` offset); absent, UTC. */
48
+ timeZone?: string | undefined
47
49
  image?: ImageInput | undefined
48
50
  category?: LinkInput | undefined
49
51
  author?: string | undefined
@@ -63,11 +65,11 @@ interface Props {
63
65
  imageAspect?: string | undefined
64
66
  }
65
67
 
66
- const { title, href, excerpt, date: rawDate, locale = 'en', image, category, author, headingLevel = 2, layout, surface, byline, linkTitle, excerptLines, sizes, imageHeight, imageAspect } = Astro.props
68
+ const { title, href, excerpt, date: rawDate, locale = 'en', timeZone = 'UTC', image, category, author, headingLevel = 2, layout, surface, byline, linkTitle, excerptLines, sizes, imageHeight, imageAspect } = Astro.props
67
69
  const date = rawDate === undefined ? undefined : new Date(rawDate)
68
70
  const slots = card({ layout, surface, byline })
69
71
  const below = byline === 'below'
70
- const shown = date?.toLocaleDateString(locale, { dateStyle: 'long', timeZone: 'UTC' })
72
+ const shown = date?.toLocaleDateString(locale, { dateStyle: 'long', timeZone })
71
73
  const imageStyle = imageHeight ? `height:${imageHeight}` : imageAspect ? `aspect-ratio:${imageAspect}` : undefined
72
74
  const Heading = `h${headingLevel}` as 'h2' | 'h3'
73
75
  ---
@@ -16,6 +16,7 @@
16
16
  "excerpt": { "type": "text", "description": "Summary (posts.excerpt)." },
17
17
  "date": { "type": "datetime", "description": "Publication date (posts.published_at)." },
18
18
  "locale": { "type": "string", "description": "Locale the date is written in (site.language)." },
19
+ "timeZone": { "type": "string", "description": "Time zone the date is read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC." },
19
20
  "image": { "type": "object", "fields": { "src": { "type": "image", "required": true }, "alt": { "type": "string", "required": true }, "width": { "type": "integer" }, "height": { "type": "integer" } }, "description": "Cover (posts.cover → media)." },
20
21
  "category": { "type": "object", "fields": { "label": { "type": "string", "required": true }, "href": { "type": "url", "required": true } }, "description": "Primary category and its archive." },
21
22
  "author": { "type": "string", "description": "Author name (posts.author → authors.name)." },
@@ -61,6 +61,8 @@ interface Props {
61
61
  excerptLines?: 2 | 3 | 4 | undefined
62
62
  /** BCP 47 locale the dates are written in. */
63
63
  locale?: string | undefined
64
+ /** The time zone the dates are read in (the site's: an IANA name or a `±hh:mm` offset); absent, UTC. */
65
+ timeZone?: string | undefined
64
66
  /** Card surface: none, or each post its own card. */
65
67
  surface?: 'plain' | 'card' | undefined
66
68
  /** Where the full archive lives; with `moreLabel` a link follows the list. */
@@ -72,7 +74,7 @@ interface Props {
72
74
  id?: string | undefined
73
75
  }
74
76
 
75
- const { heading, intro, posts, layout = 'grid', columns, showImage = true, showExcerpt = true, showAuthor = true, showCategory = true, excerptLines, locale, surface, moreHref, moreLabel, tone, measured, id = 'posts' } = Astro.props
77
+ const { heading, intro, posts, layout = 'grid', columns, showImage = true, showExcerpt = true, showAuthor = true, showCategory = true, excerptLines, locale, timeZone, surface, moreHref, moreLabel, tone, measured, id = 'posts' } = Astro.props
76
78
  const s = list({ layout, columns })
77
79
  const headingId = heading ? `${id}-title` : undefined
78
80
  // Cards sit one heading level under the section's; with no section heading they are the page's h2s.
@@ -98,6 +100,7 @@ const cardLayout = (i: number) => layout === 'compact' ? 'minimal' : layout ===
98
100
  excerpt={showExcerpt && layout !== 'compact' ? post.excerpt : undefined}
99
101
  date={post.date}
100
102
  locale={locale}
103
+ timeZone={timeZone}
101
104
  image={showImage && layout !== 'compact' ? post.image : undefined}
102
105
  category={showCategory && layout !== 'compact' ? post.category : undefined}
103
106
  author={showAuthor && layout !== 'compact' ? post.author : undefined}
@@ -141,6 +141,11 @@
141
141
  "content": false,
142
142
  "description": "BCP 47 locale the dates are written in (site.language)."
143
143
  },
144
+ "timeZone": {
145
+ "type": "string",
146
+ "content": false,
147
+ "description": "Time zone the dates are read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC."
148
+ },
144
149
  "surface": {
145
150
  "type": "string",
146
151
  "content": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/astro-kit",
3
- "version": "0.34.3",
3
+ "version": "0.36.0",
4
4
  "license": "MIT",
5
5
  "description": "Copy-in Astro components for Contentrain sites (shadcn model): typed props, tailwind-variants, zero JavaScript by default — with a machine-readable catalog",
6
6
  "type": "module",