@chassis-ui/docs 0.7.0 → 0.9.0-next.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.
@@ -16,120 +16,118 @@ const docsPages = await getDocsPages()
16
16
 
17
17
  <nav class="cxd-links w-100" id="cxd-docs-nav" aria-label="Docs navigation">
18
18
  <menu class="p-0 m-0">
19
- {
20
- sidebar.map((group) => {
21
- const groupSlug = getSlug(group.title)
19
+ {sidebar.map((group) => {
20
+ const groupSlug = getSlug(group.title)
22
21
 
23
- if (group.pages) {
24
- return (
25
- <li
26
- class:list={[
27
- 'cxd-links-group',
28
- groupSlug === Astro.params.slug?.split('/')[0] ? 'active' : undefined
29
- ]}
30
- >
31
- <strong class="cxd-links-heading">
32
- {group.icon && (
33
- <Icon
34
- name={group.icon}
35
- style={group.iconColor && `color: var(--cx-${group.iconColor});`}
36
- />
37
- )}
38
- {group.title}
39
- </strong>
40
- <ul class="nav flex-column cxd-links-nav">
41
- {group.pages?.map((item: SidebarItem) => {
42
- // Handle sub-groups
43
- if (item.group && item.pages) {
44
- return (
45
- <>
46
- <li class="cxd-links-subgroup">{item.group}</li>
47
- {item.pages.map((page: SidebarSubItem) => {
48
- const docSlug = getSlug(page.title)
49
- const unversionedPageSlug = `${groupSlug}/${docSlug}`
50
-
51
- const url = getDocsPath(unversionedPageSlug)
52
- const active = Astro.params.slug === unversionedPageSlug
22
+ if (group.pages) {
23
+ return (
24
+ <li
25
+ class:list={[
26
+ 'cxd-links-group',
27
+ groupSlug === Astro.params.slug?.split('/')[0] ? 'active' : undefined
28
+ ]}
29
+ >
30
+ <strong class="cxd-links-heading">
31
+ {group.icon && (
32
+ <Icon
33
+ name={group.icon}
34
+ style={group.iconColor && `color: var(--cx-${group.iconColor});`}
35
+ />
36
+ )}
37
+ {group.title}
38
+ </strong>
39
+ <ul class="nav flex-column cxd-links-nav">
40
+ {group.pages?.map((item: SidebarItem) => {
41
+ // Handle sub-groups
42
+ if (item.group && item.pages) {
43
+ return (
44
+ <>
45
+ <li class="cxd-links-subgroup">{item.group}</li>
46
+ {item.pages.map((page: SidebarSubItem) => {
47
+ const docSlug = getSlug(page.title)
48
+ const unversionedPageSlug = `${groupSlug}/${docSlug}`
53
49
 
54
- const generatedPage = docsPages.find(
55
- (page) => page.id === unversionedPageSlug
56
- )
50
+ const url = getDocsPath(unversionedPageSlug)
51
+ const active = Astro.params.slug === unversionedPageSlug
57
52
 
58
- // This test should not be necessary, see comments for `getSlug()` in `src/libs/utils.ts`.
59
- if (!generatedPage) {
60
- throw new Error(
61
- `The page '${page.title}' referenced in 'data/sidebar.yml' does not exist at '${url}'.`
62
- )
63
- }
53
+ const generatedPage = docsPages.find(
54
+ (page) => page.id === unversionedPageSlug
55
+ )
64
56
 
65
- return (
66
- <li>
67
- <a
68
- href={url}
69
- class:list={['cxd-links-link', { active }]}
70
- aria-current={active ? 'page' : undefined}
71
- >
72
- {page.title}
73
- </a>
74
- </li>
57
+ // This test should not be necessary, see comments for `getSlug()` in `src/libs/utils.ts`.
58
+ if (!generatedPage) {
59
+ throw new Error(
60
+ `The page '${page.title}' referenced in 'data/sidebar.yml' does not exist at '${url}'.`
75
61
  )
76
- })}
77
- </>
78
- )
79
- }
62
+ }
80
63
 
81
- // Handle regular pages
82
- if (!item.title) {
83
- return null
84
- }
64
+ return (
65
+ <li>
66
+ <a
67
+ href={url}
68
+ class:list={['cxd-links-link', { active }]}
69
+ aria-current={active ? 'page' : undefined}
70
+ >
71
+ {page.title}
72
+ </a>
73
+ </li>
74
+ )
75
+ })}
76
+ </>
77
+ )
78
+ }
85
79
 
86
- const docSlug = getSlug(item.title)
87
- const unversionedPageSlug = `${groupSlug}/${docSlug}`
80
+ // Handle regular pages
81
+ if (!item.title) {
82
+ return null
83
+ }
88
84
 
89
- const url = getDocsPath(unversionedPageSlug)
90
- const active = Astro.params.slug === unversionedPageSlug
85
+ const docSlug = getSlug(item.title)
86
+ const unversionedPageSlug = `${groupSlug}/${docSlug}`
91
87
 
92
- const generatedPage = docsPages.find((page) => page.id === unversionedPageSlug)
88
+ const url = getDocsPath(unversionedPageSlug)
89
+ const active = Astro.params.slug === unversionedPageSlug
93
90
 
94
- // This test should not be necessary, see comments for `getSlug()` in `src/libs/utils.ts`.
95
- if (!generatedPage) {
96
- throw new Error(
97
- `The page '${item.title}' referenced in 'data/sidebar.yml' does not exist at '${url}'.`
98
- )
99
- }
91
+ const generatedPage = docsPages.find((page) => page.id === unversionedPageSlug)
100
92
 
101
- return (
102
- <li>
103
- <a
104
- href={url}
105
- class:list={['cxd-links-link', { active }]}
106
- aria-current={active ? 'page' : undefined}
107
- >
108
- {item.title}
109
- </a>
110
- </li>
93
+ // This test should not be necessary, see comments for `getSlug()` in `src/libs/utils.ts`.
94
+ if (!generatedPage) {
95
+ throw new Error(
96
+ `The page '${item.title}' referenced in 'data/sidebar.yml' does not exist at '${url}'.`
111
97
  )
112
- })}
113
- </ul>
114
- </li>
115
- )
116
- } else {
117
- const active = Astro.params.slug === groupSlug
98
+ }
118
99
 
119
- return (
120
- <>
121
- <li class="cxd-links-span-all mt-2xs mb-md mx-lg border-top" />
122
- <a
123
- href={getDocsPath(`${groupSlug}/`)}
124
- class:list={['cxd-links-link cxd-links-span-all', { active }]}
125
- aria-current={active ? 'page' : undefined}
126
- >
127
- {group.title}
128
- </a>
129
- </>
130
- )
131
- }
132
- })
133
- }
100
+ return (
101
+ <li>
102
+ <a
103
+ href={url}
104
+ class:list={['cxd-links-link', { active }]}
105
+ aria-current={active ? 'page' : undefined}
106
+ >
107
+ {item.title}
108
+ </a>
109
+ </li>
110
+ )
111
+ })}
112
+ </ul>
113
+ </li>
114
+ )
115
+ } else {
116
+ const active = Astro.params.slug === groupSlug
117
+
118
+ return (
119
+ <>
120
+ <li class="cxd-links-span-all mt-2xs mb-md mx-lg border-top" />
121
+ <a
122
+ href={getDocsPath(`${groupSlug}/`)}
123
+ class:list={['cxd-links-link cxd-links-span-all', { active }]}
124
+ aria-current={active ? 'page' : undefined}
125
+ >
126
+ {group.title}
127
+ </a>
128
+ </>
129
+ )
130
+ }
131
+ })}
134
132
  </menu>
135
133
  </nav>
@@ -44,13 +44,11 @@ const headerClasses = [
44
44
 
45
45
  <div class={cardClasses}>
46
46
  <div class={headerClasses}>
47
- {
48
- icon && (
49
- <div class="feature-thumb">
50
- <Icon name={icon} class="feature-icon icon-3xl md:icon-4xl" sprite="" />
51
- </div>
52
- )
53
- }
47
+ {icon && (
48
+ <div class="feature-thumb">
49
+ <Icon name={icon} class="feature-icon icon-3xl md:icon-4xl" sprite="" />
50
+ </div>
51
+ )}
54
52
  <div>
55
53
  <h3 class="feature-title font-lg md:font-xl mb-3xs md:mb-2xs">
56
54
  <slot name="title" />
@@ -27,16 +27,14 @@ let entryLevel = level ? level + 1 : 1
27
27
  ---
28
28
 
29
29
  <ul>
30
- {
31
- toc.map(({ children, slug, text }) => {
32
- return (
33
- <li>
34
- <a href={`#${slug}`} class={`level-${entryLevel}`}>
35
- {text}
36
- </a>
37
- {children.length > 0 && <Astro.self entries={children} level={entryLevel} />}
38
- </li>
39
- )
40
- })
41
- }
30
+ {toc.map(({ children, slug, text }) => {
31
+ return (
32
+ <li>
33
+ <a href={`#${slug}`} class={`level-${entryLevel}`}>
34
+ {text}
35
+ </a>
36
+ {children.length > 0 && <Astro.self entries={children} level={entryLevel} />}
37
+ </li>
38
+ )
39
+ })}
42
40
  </ul>
@@ -26,9 +26,12 @@ const { layout } = Astro.props
26
26
  data-cx-placement="bottom-end"
27
27
  >
28
28
  <Icon name="circle-half-solid" class="theme-icon-active" />
29
- <span class=`${layout === 'examples' ? 'visually-hidden' : 'lg:d-none ms-xs'}` id="cxd-theme-text"
30
- >Toggle theme</span
29
+ <span
30
+ class=`${layout === 'examples' ? 'visually-hidden' : 'lg:d-none ms-xs'}`
31
+ id="cxd-theme-text"
31
32
  >
33
+ Toggle theme
34
+ </span>
32
35
  </button>
33
36
  <ul class="menu" role="menu" aria-label="Theme options">
34
37
  <li>
@@ -13,19 +13,17 @@ interface Props {
13
13
  const { attr } = Astro.props
14
14
  ---
15
15
 
16
- {
17
- attr ? (
18
- <figure>
19
- <blockquote class="blockquote">
20
- <slot />
21
- </blockquote>
22
- <figcaption class="attribution">
23
- <Fragment set:html={attr} />
24
- </figcaption>
25
- </figure>
26
- ) : (
16
+ {attr ? (
17
+ <figure>
27
18
  <blockquote class="blockquote">
28
19
  <slot />
29
20
  </blockquote>
30
- )
31
- }
21
+ <figcaption class="attribution">
22
+ <Fragment set:html={attr} />
23
+ </figcaption>
24
+ </figure>
25
+ ) : (
26
+ <blockquote class="blockquote">
27
+ <slot />
28
+ </blockquote>
29
+ )}
@@ -15,6 +15,6 @@ const { tooltip = 'This feature is only available in CSS and not in Figma compon
15
15
  Astro.props
16
16
  ---
17
17
 
18
- <span class="badge lg info smooth mb-md rounded-md" data-cx-toggle="tooltip" title={tooltip}
19
- >CSS Only</span
20
- >
18
+ <span class="badge lg info smooth mb-md rounded-md" data-cx-toggle="tooltip" title={tooltip}>
19
+ CSS Only
20
+ </span>
@@ -164,103 +164,86 @@ if (codeToDisplay && detectedLang) {
164
164
  })
165
165
  </script>
166
166
 
167
- {
168
- nestedInExample && !noToolbar && (
169
- <div class="cxd-snippet-toolbar">
170
- {file ? (
171
- <a
172
- class="text-decoration-none font-code fg-subtle text-uppercase"
173
- href={fileUrl}
174
- target="_blank"
175
- rel="noopener noreferrer"
176
- >
177
- {file}
178
- </a>
179
- ) : (
180
- <small class="font-code fg-subtle text-uppercase">{displayLang}</small>
167
+ {nestedInExample && !noToolbar && (
168
+ <div class="cxd-snippet-toolbar">
169
+ {file ? (
170
+ <a
171
+ class="text-decoration-none font-code fg-subtle text-uppercase"
172
+ href={fileUrl}
173
+ target="_blank"
174
+ rel="noopener noreferrer"
175
+ >
176
+ {file}
177
+ </a>
178
+ ) : (
179
+ <small class="font-code fg-subtle text-uppercase">{displayLang}</small>
180
+ )}
181
+ <div class="d-flex ms-auto gap-2xs">
182
+ {hasPreview && (
183
+ <>
184
+ <button
185
+ type="button"
186
+ class="button-mode"
187
+ title="Toggle color mode"
188
+ aria-label="Toggle color mode"
189
+ onclick="toggleTheme(this)"
190
+ >
191
+ <Icon name="swatchbook-solid" />
192
+ </button>
193
+ <span class="vr mx-2xs" />
194
+ <button
195
+ type="button"
196
+ class="button-edit"
197
+ title="Try it on StackBlitz"
198
+ aria-label="Try it on StackBlitz"
199
+ data-sb-js-snippet={addStackblitzJs ? true : undefined}
200
+ >
201
+ <Icon name="lightning-solid" />
202
+ </button>
203
+ </>
181
204
  )}
182
- <div class="d-flex ms-auto gap-2xs">
183
- {hasPreview && (
184
- <>
185
- <button
186
- type="button"
187
- class="button-mode"
188
- title="Toggle color mode"
189
- aria-label="Toggle color mode"
190
- onclick="toggleTheme(this)"
191
- >
192
- <Icon name="swatchbook-solid" />
193
- </button>
194
- <span class="vr mx-2xs" />
195
- <button
196
- type="button"
197
- class="button-edit"
198
- title="Try it on StackBlitz"
199
- aria-label="Try it on StackBlitz"
200
- data-sb-js-snippet={addStackblitzJs ? true : undefined}
201
- >
202
- <Icon name="lightning-solid" />
203
- </button>
204
- </>
205
- )}
206
- <button
207
- type="button"
208
- class="button-clipboard"
209
- title="Copy to clipboard"
210
- aria-label="Copy to clipboard"
211
- >
212
- <Icon name="clipboard-outline" />
213
- </button>
214
- </div>
205
+ <button
206
+ type="button"
207
+ class="button-clipboard"
208
+ title="Copy to clipboard"
209
+ aria-label="Copy to clipboard"
210
+ >
211
+ <Icon name="clipboard-outline" />
212
+ </button>
215
213
  </div>
216
- )
217
- }
214
+ </div>
215
+ )}
218
216
 
219
- {
220
- nestedInExample ? (
221
- <>
222
- {highlightedCode ? (
223
- <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
224
- <Fragment set:html={highlightedCode} />
225
- </div>
226
- ) : (
227
- <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
228
- {/* prettier-ignore */}
229
- <pre class={className} tabindex="0"><slot /></pre>
230
- </div>
231
- )}
232
- </>
233
- ) : (
234
- <div class:list={['cxd-code-snippet', containerClass]} data-pagefind-ignore>
235
- {!noToolbar && (
236
- <div class="cxd-snippet-toolbar">
237
- {file ? (
238
- <a
239
- class="text-decoration-none font-code fg-subtle"
240
- href={fileUrl}
241
- target="_blank"
242
- rel="noopener noreferrer"
243
- >
244
- {file}
245
- </a>
246
- ) : (
247
- <small class="font-code fg-subtle text-uppercase">{displayLang}</small>
248
- )}
249
- <div class="d-flex ms-auto gap-2xs">
250
- <button
251
- type="button"
252
- class="button-clipboard"
253
- title="Copy to clipboard"
254
- aria-label="Copy to clipboard"
255
- >
256
- <Icon name="clipboard-outline" />
257
- </button>
258
- </div>
259
- </div>
260
- )}
261
- <slot name="pre" />
262
- {!Astro.slots.has('pre') && noToolbar ? (
263
- <div class="cxd-clipboard">
217
+ {nestedInExample ? (
218
+ <>
219
+ {highlightedCode ? (
220
+ <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
221
+ <Fragment set:html={highlightedCode} />
222
+ </div>
223
+ ) : (
224
+ <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
225
+ {/* prettier-ignore */}
226
+ <pre class={className} tabindex="0"><slot /></pre>
227
+ </div>
228
+ )}
229
+ </>
230
+ ) : (
231
+ <div class:list={['cxd-code-snippet', containerClass]} data-pagefind-ignore>
232
+ {!noToolbar && (
233
+ <div class="cxd-snippet-toolbar">
234
+ {file ? (
235
+ <a
236
+ class="text-decoration-none font-code fg-subtle"
237
+ href={fileUrl}
238
+ target="_blank"
239
+ rel="noopener noreferrer"
240
+ >
241
+ {file}
242
+ </a>
243
+ ) : (
244
+ <small class="font-code fg-subtle text-uppercase">{displayLang}</small>
245
+ )}
246
+ <div class="d-flex ms-auto gap-2xs">
264
247
  <button
265
248
  type="button"
266
249
  class="button-clipboard"
@@ -270,18 +253,31 @@ if (codeToDisplay && detectedLang) {
270
253
  <Icon name="clipboard-outline" />
271
254
  </button>
272
255
  </div>
273
- ) : null}
256
+ </div>
257
+ )}
258
+ <slot name="pre" />
259
+ {!Astro.slots.has('pre') && noToolbar ? (
260
+ <div class="cxd-clipboard">
261
+ <button
262
+ type="button"
263
+ class="button-clipboard"
264
+ title="Copy to clipboard"
265
+ aria-label="Copy to clipboard"
266
+ >
267
+ <Icon name="clipboard-outline" />
268
+ </button>
269
+ </div>
270
+ ) : null}
274
271
 
275
- {highlightedCode ? (
276
- <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
277
- <Fragment set:html={highlightedCode} />
278
- </div>
279
- ) : (
280
- <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
281
- {/* prettier-ignore */}
282
- <pre class={className} tabindex="0"><slot /></pre>
283
- </div>
284
- )}
285
- </div>
286
- )
287
- }
272
+ {highlightedCode ? (
273
+ <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
274
+ <Fragment set:html={highlightedCode} />
275
+ </div>
276
+ ) : (
277
+ <div class:list={['cxd-code', { 'line-numbers': lineNumbers }]}>
278
+ {/* prettier-ignore */}
279
+ <pre class={className} tabindex="0"><slot /></pre>
280
+ </div>
281
+ )}
282
+ </div>
283
+ )}
@@ -13,6 +13,4 @@ interface Props {
13
13
  const { version } = Astro.props
14
14
  ---
15
15
 
16
- <span class="badge lg warning smooth mb-md rounded-md">
17
- Deprecated in v{version}
18
- </span>
16
+ <span class="badge lg warning smooth mb-md rounded-md">Deprecated in v{version}</span>
@@ -97,37 +97,33 @@ const simplifiedMarkup = sourceMarkup
97
97
  ---
98
98
 
99
99
  <div class="cxd-example-snippet cxd-code-snippet not-prose" data-pagefind-ignore>
100
- {
101
- showPreview && (
102
- <div id={id} class:list={['cxd-example m-0 border-0 context', className]}>
103
- {!showMarkup && (
104
- <div class="cxd-mode">
105
- <button
106
- type="button"
107
- class="button-mode"
108
- title="Toggle color mode"
109
- aria-label="Toggle color mode"
110
- onclick="toggleTheme(this)"
111
- >
112
- <Icon name="swatchbook-solid" />
113
- </button>
114
- </div>
115
- )}
116
- <Fragment set:html={markup} />
117
- </div>
118
- )
119
- }
120
- {
121
- showMarkup && (
122
- <Code
123
- code={simplifiedMarkup}
124
- lang={lang}
125
- file={file}
126
- lineNumbers={lineNumbers}
127
- nestedInExample={true}
128
- addStackblitzJs={addStackblitzJs}
129
- hasPreview={showPreview}
130
- />
131
- )
132
- }
100
+ {showPreview && (
101
+ <div id={id} class:list={['cxd-example m-0 border-0 context', className]}>
102
+ {!showMarkup && (
103
+ <div class="cxd-mode">
104
+ <button
105
+ type="button"
106
+ class="button-mode"
107
+ title="Toggle color mode"
108
+ aria-label="Toggle color mode"
109
+ onclick="toggleTheme(this)"
110
+ >
111
+ <Icon name="swatchbook-solid" />
112
+ </button>
113
+ </div>
114
+ )}
115
+ <Fragment set:html={markup} />
116
+ </div>
117
+ )}
118
+ {showMarkup && (
119
+ <Code
120
+ code={simplifiedMarkup}
121
+ lang={lang}
122
+ file={file}
123
+ lineNumbers={lineNumbers}
124
+ nestedInExample={true}
125
+ addStackblitzJs={addStackblitzJs}
126
+ hasPreview={showPreview}
127
+ />
128
+ )}
133
129
  </div>