@jackcrane/ui 0.1.21 → 0.1.22

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/dist/jcui.cjs.js CHANGED
@@ -217,7 +217,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
217
217
  transform: rotate(360deg);
218
218
  }
219
219
  }
220
- ._card_1ywyn_1 {
220
+ ._card_1wvfe_1 {
221
221
  border-width: var(--border-thickness);
222
222
  border-style: solid;
223
223
  font-size: 1rem;
@@ -226,120 +226,122 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
226
226
  display: flex;
227
227
  flex-direction: column;
228
228
  }
229
- ._pageBackground_1ywyn_11 {
229
+ ._pageBackground_1wvfe_11 {
230
230
  --card-bg: var(--body-bg);
231
231
  --button-bg: var(--body-bg);
232
232
  --card-color: var(--body-color);
233
233
  background-color: var(--body-bg);
234
234
  }
235
- ._card_1ywyn_1 ._title_1ywyn_18 {
235
+ ._card_1wvfe_1 ._title_1wvfe_18 {
236
236
  font-size: 1.25rem;
237
237
  padding: 0.5rem 1rem;
238
238
  border-bottom: var(--border-thickness) solid var(--border-color);
239
239
  background-color: var(--card-bg);
240
240
  }
241
- ._card_1ywyn_1 ._titleCollapsed_1ywyn_25 {
241
+ ._card_1wvfe_1 ._titleCollapsed_1wvfe_25 {
242
242
  border-bottom: 0;
243
243
  }
244
- ._card_1ywyn_1 ._titleContent_1ywyn_29 {
244
+ ._card_1wvfe_1 ._titleContent_1wvfe_29 {
245
245
  display: flex;
246
246
  align-items: center;
247
247
  gap: 0.5rem;
248
248
  }
249
- ._card_1ywyn_1 ._chevronButton_1ywyn_35 {
250
- margin-left: auto;
251
- border: 0;
252
- background: transparent;
253
- color: inherit;
254
- padding: 0;
255
- display: flex;
256
- align-items: center;
249
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35 {
257
250
  cursor: pointer;
258
251
  }
259
- ._card_1ywyn_1 ._chevron_1ywyn_35 {
252
+ ._card_1wvfe_1 ._chevron_1wvfe_39 {
253
+ margin-left: auto;
260
254
  width: 0.5rem;
261
255
  height: 0.5rem;
262
256
  border-right: 2px solid currentColor;
263
257
  border-bottom: 2px solid currentColor;
264
258
  transition: transform 0.2s ease;
265
259
  flex-shrink: 0;
266
- cursor: pointer;
260
+ cursor: inherit;
267
261
  }
268
- ._card_1ywyn_1 ._chevronExpanded_1ywyn_56 {
262
+ ._card_1wvfe_1 ._chevronExpanded_1wvfe_50 {
269
263
  transform: rotate(45deg);
270
264
  }
271
- ._card_1ywyn_1 ._chevronCollapsed_1ywyn_60 {
265
+ ._card_1wvfe_1 ._chevronCollapsed_1wvfe_54 {
272
266
  transform: rotate(-45deg);
273
267
  }
274
- ._card_1ywyn_1 ._content_1ywyn_64 {
268
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:hover ._chevronExpanded_1wvfe_50,
269
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:focus-visible ._chevronExpanded_1wvfe_50 {
270
+ transform: rotate(30deg);
271
+ }
272
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:hover ._chevronCollapsed_1wvfe_54,
273
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:focus-visible ._chevronCollapsed_1wvfe_54 {
274
+ transform: rotate(-30deg);
275
+ }
276
+ ._card_1wvfe_1 ._content_1wvfe_68 {
275
277
  display: grid;
276
278
  grid-template-rows: 1fr;
277
279
  transition:
278
280
  grid-template-rows 0.2s ease,
279
281
  opacity 0.2s ease;
280
282
  }
281
- ._card_1ywyn_1 ._contentInner_1ywyn_72 {
283
+ ._card_1wvfe_1 ._contentInner_1wvfe_76 {
282
284
  overflow: hidden;
283
285
  min-height: 0;
284
286
  display: flex;
285
287
  flex-direction: column;
286
288
  }
287
- ._card_1ywyn_1 ._contentCollapsed_1ywyn_79 {
289
+ ._card_1wvfe_1 ._contentCollapsed_1wvfe_83 {
288
290
  grid-template-rows: 0fr;
289
291
  opacity: 0;
290
292
  }
291
- ._card_1ywyn_1 ._body_1ywyn_84 {
293
+ ._card_1wvfe_1 ._body_1wvfe_88 {
292
294
  padding: 0.5rem 1rem;
293
295
  width: 100%;
294
296
  }
295
- ._card_1ywyn_1 ._footer_1ywyn_89 {
297
+ ._card_1wvfe_1 ._footer_1wvfe_93 {
296
298
  border-top: var(--border-thickness) solid var(--border-color);
297
299
  flex: 1;
298
300
  background-color: var(--card-bg);
299
301
  padding: 0.5rem 1rem;
300
302
  }
301
- ._large_1ywyn_96 ._body_1ywyn_84,
302
- ._large_1ywyn_96 ._title_1ywyn_18 {
303
+ ._large_1wvfe_100 ._body_1wvfe_88,
304
+ ._large_1wvfe_100 ._title_1wvfe_18 {
303
305
  font-size: 1.25rem;
304
306
  padding: 0.75rem 1.25rem;
305
307
  }
306
- ._small_1ywyn_102 ._body_1ywyn_84,
307
- ._small_1ywyn_102 ._title_1ywyn_18 {
308
+ ._small_1wvfe_106 ._body_1wvfe_88,
309
+ ._small_1wvfe_106 ._title_1wvfe_18 {
308
310
  font-size: 0.75rem;
309
311
  padding: 0.25rem 0.5rem;
310
312
  }
311
313
  /* Variants */
312
- ._primary_1ywyn_110 {
314
+ ._primary_1wvfe_114 {
313
315
  --card-bg: var(--primary-color-100);
314
316
  --border-color: var(--primary-color-300);
315
317
  --border-accent-color: var(--primary-color-600);
316
318
  --card-color: var(--primary-color-800);
317
319
  }
318
- ._success_1ywyn_117 {
320
+ ._success_1wvfe_121 {
319
321
  --card-bg: var(--success-color-100);
320
322
  --border-color: var(--success-color-300);
321
323
  --border-accent-color: var(--success-color-600);
322
324
  --card-color: var(--success-color-800);
323
325
  }
324
- ._warning_1ywyn_124 {
326
+ ._warning_1wvfe_128 {
325
327
  --card-bg: var(--warning-color-100);
326
328
  --border-color: var(--warning-color-300);
327
329
  --border-accent-color: var(--warning-color-600);
328
330
  --card-color: var(--warning-color-800);
329
331
  }
330
- ._danger_1ywyn_131 {
332
+ ._danger_1wvfe_135 {
331
333
  --card-bg: var(--danger-color-100);
332
334
  --border-color: var(--danger-color-300);
333
335
  --border-accent-color: var(--danger-color-600);
334
336
  --card-color: var(--danger-color-800);
335
337
  }
336
- ._info_1ywyn_138 {
338
+ ._info_1wvfe_142 {
337
339
  --card-bg: var(--info-color-100);
338
340
  --border-color: var(--info-color-300);
339
341
  --border-accent-color: var(--info-color-600);
340
342
  --card-color: var(--info-color-800);
341
343
  }
342
- ._secondary_1ywyn_145 {
344
+ ._secondary_1wvfe_149 {
343
345
  --card-bg: var(--secondary-color-100);
344
346
  --border-color: var(--secondary-color-300);
345
347
  --border-accent-color: var(--secondary-color-600);
@@ -2665,35 +2667,35 @@ function requireClassnames() {
2665
2667
  }
2666
2668
  var classnamesExports = requireClassnames();
2667
2669
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
2668
- const card = "_card_1ywyn_1";
2669
- const pageBackground$3 = "_pageBackground_1ywyn_11";
2670
- const title$1 = "_title_1ywyn_18";
2671
- const titleCollapsed = "_titleCollapsed_1ywyn_25";
2672
- const titleContent = "_titleContent_1ywyn_29";
2673
- const chevronButton = "_chevronButton_1ywyn_35";
2674
- const chevron = "_chevron_1ywyn_35";
2675
- const chevronExpanded = "_chevronExpanded_1ywyn_56";
2676
- const chevronCollapsed = "_chevronCollapsed_1ywyn_60";
2677
- const content$4 = "_content_1ywyn_64";
2678
- const contentInner = "_contentInner_1ywyn_72";
2679
- const contentCollapsed = "_contentCollapsed_1ywyn_79";
2680
- const body$1 = "_body_1ywyn_84";
2681
- const footer$1 = "_footer_1ywyn_89";
2682
- const large$7 = "_large_1ywyn_96";
2683
- const small$7 = "_small_1ywyn_102";
2684
- const primary$9 = "_primary_1ywyn_110";
2685
- const success$9 = "_success_1ywyn_117";
2686
- const warning$9 = "_warning_1ywyn_124";
2687
- const danger$9 = "_danger_1ywyn_131";
2688
- const info$9 = "_info_1ywyn_138";
2689
- const secondary$9 = "_secondary_1ywyn_145";
2670
+ const card = "_card_1wvfe_1";
2671
+ const pageBackground$3 = "_pageBackground_1wvfe_11";
2672
+ const title$1 = "_title_1wvfe_18";
2673
+ const titleCollapsed = "_titleCollapsed_1wvfe_25";
2674
+ const titleContent = "_titleContent_1wvfe_29";
2675
+ const titleInteractive = "_titleInteractive_1wvfe_35";
2676
+ const chevron = "_chevron_1wvfe_39";
2677
+ const chevronExpanded = "_chevronExpanded_1wvfe_50";
2678
+ const chevronCollapsed = "_chevronCollapsed_1wvfe_54";
2679
+ const content$4 = "_content_1wvfe_68";
2680
+ const contentInner = "_contentInner_1wvfe_76";
2681
+ const contentCollapsed = "_contentCollapsed_1wvfe_83";
2682
+ const body$1 = "_body_1wvfe_88";
2683
+ const footer$1 = "_footer_1wvfe_93";
2684
+ const large$7 = "_large_1wvfe_100";
2685
+ const small$7 = "_small_1wvfe_106";
2686
+ const primary$9 = "_primary_1wvfe_114";
2687
+ const success$9 = "_success_1wvfe_121";
2688
+ const warning$9 = "_warning_1wvfe_128";
2689
+ const danger$9 = "_danger_1wvfe_135";
2690
+ const info$9 = "_info_1wvfe_142";
2691
+ const secondary$9 = "_secondary_1wvfe_149";
2690
2692
  const styles$b = {
2691
2693
  card,
2692
2694
  pageBackground: pageBackground$3,
2693
2695
  title: title$1,
2694
2696
  titleCollapsed,
2695
2697
  titleContent,
2696
- chevronButton,
2698
+ titleInteractive,
2697
2699
  chevron,
2698
2700
  chevronExpanded,
2699
2701
  chevronCollapsed,
@@ -2732,6 +2734,15 @@ function Card({
2732
2734
  }
2733
2735
  onCollapseChange?.(!isCollapsed2);
2734
2736
  };
2737
+ const handleKeyDown = (event) => {
2738
+ if (!isCollapsible) {
2739
+ return;
2740
+ }
2741
+ if (event.key === "Enter" || event.key === " ") {
2742
+ event.preventDefault();
2743
+ handleCollapseToggle();
2744
+ }
2745
+ };
2735
2746
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2736
2747
  "div",
2737
2748
  {
@@ -2751,27 +2762,24 @@ function Card({
2751
2762
  className: classNames(
2752
2763
  styles$b.title,
2753
2764
  hatchStyles.hatch,
2754
- isCollapsed2 && styles$b.titleCollapsed
2765
+ isCollapsed2 && styles$b.titleCollapsed,
2766
+ isCollapsible && styles$b.titleInteractive
2755
2767
  ),
2768
+ onClick: isCollapsible ? handleCollapseToggle : void 0,
2769
+ onKeyDown: isCollapsible ? handleKeyDown : void 0,
2770
+ role: isCollapsible ? "button" : void 0,
2771
+ tabIndex: isCollapsible ? 0 : void 0,
2772
+ "aria-expanded": isCollapsible ? !isCollapsed2 : void 0,
2773
+ "aria-label": isCollapsible ? isCollapsed2 ? "Expand card" : "Collapse card" : void 0,
2756
2774
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$b.titleContent, children: [
2757
2775
  title2,
2758
2776
  isCollapsible && /* @__PURE__ */ jsxRuntimeExports.jsx(
2759
- "button",
2777
+ "span",
2760
2778
  {
2761
- type: "button",
2762
- className: styles$b.chevronButton,
2763
- onClick: handleCollapseToggle,
2764
- "aria-label": isCollapsed2 ? "Expand card" : "Collapse card",
2765
- "aria-expanded": !isCollapsed2,
2766
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2767
- "span",
2768
- {
2769
- "aria-hidden": "true",
2770
- className: classNames(
2771
- styles$b.chevron,
2772
- isCollapsed2 ? styles$b.chevronCollapsed : styles$b.chevronExpanded
2773
- )
2774
- }
2779
+ "aria-hidden": "true",
2780
+ className: classNames(
2781
+ styles$b.chevron,
2782
+ isCollapsed2 ? styles$b.chevronCollapsed : styles$b.chevronExpanded
2775
2783
  )
2776
2784
  }
2777
2785
  )
package/dist/jcui.es.js CHANGED
@@ -217,7 +217,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
217
217
  transform: rotate(360deg);
218
218
  }
219
219
  }
220
- ._card_1ywyn_1 {
220
+ ._card_1wvfe_1 {
221
221
  border-width: var(--border-thickness);
222
222
  border-style: solid;
223
223
  font-size: 1rem;
@@ -226,120 +226,122 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
226
226
  display: flex;
227
227
  flex-direction: column;
228
228
  }
229
- ._pageBackground_1ywyn_11 {
229
+ ._pageBackground_1wvfe_11 {
230
230
  --card-bg: var(--body-bg);
231
231
  --button-bg: var(--body-bg);
232
232
  --card-color: var(--body-color);
233
233
  background-color: var(--body-bg);
234
234
  }
235
- ._card_1ywyn_1 ._title_1ywyn_18 {
235
+ ._card_1wvfe_1 ._title_1wvfe_18 {
236
236
  font-size: 1.25rem;
237
237
  padding: 0.5rem 1rem;
238
238
  border-bottom: var(--border-thickness) solid var(--border-color);
239
239
  background-color: var(--card-bg);
240
240
  }
241
- ._card_1ywyn_1 ._titleCollapsed_1ywyn_25 {
241
+ ._card_1wvfe_1 ._titleCollapsed_1wvfe_25 {
242
242
  border-bottom: 0;
243
243
  }
244
- ._card_1ywyn_1 ._titleContent_1ywyn_29 {
244
+ ._card_1wvfe_1 ._titleContent_1wvfe_29 {
245
245
  display: flex;
246
246
  align-items: center;
247
247
  gap: 0.5rem;
248
248
  }
249
- ._card_1ywyn_1 ._chevronButton_1ywyn_35 {
250
- margin-left: auto;
251
- border: 0;
252
- background: transparent;
253
- color: inherit;
254
- padding: 0;
255
- display: flex;
256
- align-items: center;
249
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35 {
257
250
  cursor: pointer;
258
251
  }
259
- ._card_1ywyn_1 ._chevron_1ywyn_35 {
252
+ ._card_1wvfe_1 ._chevron_1wvfe_39 {
253
+ margin-left: auto;
260
254
  width: 0.5rem;
261
255
  height: 0.5rem;
262
256
  border-right: 2px solid currentColor;
263
257
  border-bottom: 2px solid currentColor;
264
258
  transition: transform 0.2s ease;
265
259
  flex-shrink: 0;
266
- cursor: pointer;
260
+ cursor: inherit;
267
261
  }
268
- ._card_1ywyn_1 ._chevronExpanded_1ywyn_56 {
262
+ ._card_1wvfe_1 ._chevronExpanded_1wvfe_50 {
269
263
  transform: rotate(45deg);
270
264
  }
271
- ._card_1ywyn_1 ._chevronCollapsed_1ywyn_60 {
265
+ ._card_1wvfe_1 ._chevronCollapsed_1wvfe_54 {
272
266
  transform: rotate(-45deg);
273
267
  }
274
- ._card_1ywyn_1 ._content_1ywyn_64 {
268
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:hover ._chevronExpanded_1wvfe_50,
269
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:focus-visible ._chevronExpanded_1wvfe_50 {
270
+ transform: rotate(30deg);
271
+ }
272
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:hover ._chevronCollapsed_1wvfe_54,
273
+ ._card_1wvfe_1 ._titleInteractive_1wvfe_35:focus-visible ._chevronCollapsed_1wvfe_54 {
274
+ transform: rotate(-30deg);
275
+ }
276
+ ._card_1wvfe_1 ._content_1wvfe_68 {
275
277
  display: grid;
276
278
  grid-template-rows: 1fr;
277
279
  transition:
278
280
  grid-template-rows 0.2s ease,
279
281
  opacity 0.2s ease;
280
282
  }
281
- ._card_1ywyn_1 ._contentInner_1ywyn_72 {
283
+ ._card_1wvfe_1 ._contentInner_1wvfe_76 {
282
284
  overflow: hidden;
283
285
  min-height: 0;
284
286
  display: flex;
285
287
  flex-direction: column;
286
288
  }
287
- ._card_1ywyn_1 ._contentCollapsed_1ywyn_79 {
289
+ ._card_1wvfe_1 ._contentCollapsed_1wvfe_83 {
288
290
  grid-template-rows: 0fr;
289
291
  opacity: 0;
290
292
  }
291
- ._card_1ywyn_1 ._body_1ywyn_84 {
293
+ ._card_1wvfe_1 ._body_1wvfe_88 {
292
294
  padding: 0.5rem 1rem;
293
295
  width: 100%;
294
296
  }
295
- ._card_1ywyn_1 ._footer_1ywyn_89 {
297
+ ._card_1wvfe_1 ._footer_1wvfe_93 {
296
298
  border-top: var(--border-thickness) solid var(--border-color);
297
299
  flex: 1;
298
300
  background-color: var(--card-bg);
299
301
  padding: 0.5rem 1rem;
300
302
  }
301
- ._large_1ywyn_96 ._body_1ywyn_84,
302
- ._large_1ywyn_96 ._title_1ywyn_18 {
303
+ ._large_1wvfe_100 ._body_1wvfe_88,
304
+ ._large_1wvfe_100 ._title_1wvfe_18 {
303
305
  font-size: 1.25rem;
304
306
  padding: 0.75rem 1.25rem;
305
307
  }
306
- ._small_1ywyn_102 ._body_1ywyn_84,
307
- ._small_1ywyn_102 ._title_1ywyn_18 {
308
+ ._small_1wvfe_106 ._body_1wvfe_88,
309
+ ._small_1wvfe_106 ._title_1wvfe_18 {
308
310
  font-size: 0.75rem;
309
311
  padding: 0.25rem 0.5rem;
310
312
  }
311
313
  /* Variants */
312
- ._primary_1ywyn_110 {
314
+ ._primary_1wvfe_114 {
313
315
  --card-bg: var(--primary-color-100);
314
316
  --border-color: var(--primary-color-300);
315
317
  --border-accent-color: var(--primary-color-600);
316
318
  --card-color: var(--primary-color-800);
317
319
  }
318
- ._success_1ywyn_117 {
320
+ ._success_1wvfe_121 {
319
321
  --card-bg: var(--success-color-100);
320
322
  --border-color: var(--success-color-300);
321
323
  --border-accent-color: var(--success-color-600);
322
324
  --card-color: var(--success-color-800);
323
325
  }
324
- ._warning_1ywyn_124 {
326
+ ._warning_1wvfe_128 {
325
327
  --card-bg: var(--warning-color-100);
326
328
  --border-color: var(--warning-color-300);
327
329
  --border-accent-color: var(--warning-color-600);
328
330
  --card-color: var(--warning-color-800);
329
331
  }
330
- ._danger_1ywyn_131 {
332
+ ._danger_1wvfe_135 {
331
333
  --card-bg: var(--danger-color-100);
332
334
  --border-color: var(--danger-color-300);
333
335
  --border-accent-color: var(--danger-color-600);
334
336
  --card-color: var(--danger-color-800);
335
337
  }
336
- ._info_1ywyn_138 {
338
+ ._info_1wvfe_142 {
337
339
  --card-bg: var(--info-color-100);
338
340
  --border-color: var(--info-color-300);
339
341
  --border-accent-color: var(--info-color-600);
340
342
  --card-color: var(--info-color-800);
341
343
  }
342
- ._secondary_1ywyn_145 {
344
+ ._secondary_1wvfe_149 {
343
345
  --card-bg: var(--secondary-color-100);
344
346
  --border-color: var(--secondary-color-300);
345
347
  --border-accent-color: var(--secondary-color-600);
@@ -2647,35 +2649,35 @@ function requireClassnames() {
2647
2649
  }
2648
2650
  var classnamesExports = requireClassnames();
2649
2651
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
2650
- const card = "_card_1ywyn_1";
2651
- const pageBackground$3 = "_pageBackground_1ywyn_11";
2652
- const title$1 = "_title_1ywyn_18";
2653
- const titleCollapsed = "_titleCollapsed_1ywyn_25";
2654
- const titleContent = "_titleContent_1ywyn_29";
2655
- const chevronButton = "_chevronButton_1ywyn_35";
2656
- const chevron = "_chevron_1ywyn_35";
2657
- const chevronExpanded = "_chevronExpanded_1ywyn_56";
2658
- const chevronCollapsed = "_chevronCollapsed_1ywyn_60";
2659
- const content$4 = "_content_1ywyn_64";
2660
- const contentInner = "_contentInner_1ywyn_72";
2661
- const contentCollapsed = "_contentCollapsed_1ywyn_79";
2662
- const body$1 = "_body_1ywyn_84";
2663
- const footer$1 = "_footer_1ywyn_89";
2664
- const large$7 = "_large_1ywyn_96";
2665
- const small$7 = "_small_1ywyn_102";
2666
- const primary$9 = "_primary_1ywyn_110";
2667
- const success$9 = "_success_1ywyn_117";
2668
- const warning$9 = "_warning_1ywyn_124";
2669
- const danger$9 = "_danger_1ywyn_131";
2670
- const info$9 = "_info_1ywyn_138";
2671
- const secondary$9 = "_secondary_1ywyn_145";
2652
+ const card = "_card_1wvfe_1";
2653
+ const pageBackground$3 = "_pageBackground_1wvfe_11";
2654
+ const title$1 = "_title_1wvfe_18";
2655
+ const titleCollapsed = "_titleCollapsed_1wvfe_25";
2656
+ const titleContent = "_titleContent_1wvfe_29";
2657
+ const titleInteractive = "_titleInteractive_1wvfe_35";
2658
+ const chevron = "_chevron_1wvfe_39";
2659
+ const chevronExpanded = "_chevronExpanded_1wvfe_50";
2660
+ const chevronCollapsed = "_chevronCollapsed_1wvfe_54";
2661
+ const content$4 = "_content_1wvfe_68";
2662
+ const contentInner = "_contentInner_1wvfe_76";
2663
+ const contentCollapsed = "_contentCollapsed_1wvfe_83";
2664
+ const body$1 = "_body_1wvfe_88";
2665
+ const footer$1 = "_footer_1wvfe_93";
2666
+ const large$7 = "_large_1wvfe_100";
2667
+ const small$7 = "_small_1wvfe_106";
2668
+ const primary$9 = "_primary_1wvfe_114";
2669
+ const success$9 = "_success_1wvfe_121";
2670
+ const warning$9 = "_warning_1wvfe_128";
2671
+ const danger$9 = "_danger_1wvfe_135";
2672
+ const info$9 = "_info_1wvfe_142";
2673
+ const secondary$9 = "_secondary_1wvfe_149";
2672
2674
  const styles$b = {
2673
2675
  card,
2674
2676
  pageBackground: pageBackground$3,
2675
2677
  title: title$1,
2676
2678
  titleCollapsed,
2677
2679
  titleContent,
2678
- chevronButton,
2680
+ titleInteractive,
2679
2681
  chevron,
2680
2682
  chevronExpanded,
2681
2683
  chevronCollapsed,
@@ -2714,6 +2716,15 @@ function Card({
2714
2716
  }
2715
2717
  onCollapseChange?.(!isCollapsed2);
2716
2718
  };
2719
+ const handleKeyDown = (event) => {
2720
+ if (!isCollapsible) {
2721
+ return;
2722
+ }
2723
+ if (event.key === "Enter" || event.key === " ") {
2724
+ event.preventDefault();
2725
+ handleCollapseToggle();
2726
+ }
2727
+ };
2717
2728
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2718
2729
  "div",
2719
2730
  {
@@ -2733,27 +2744,24 @@ function Card({
2733
2744
  className: classNames(
2734
2745
  styles$b.title,
2735
2746
  hatchStyles.hatch,
2736
- isCollapsed2 && styles$b.titleCollapsed
2747
+ isCollapsed2 && styles$b.titleCollapsed,
2748
+ isCollapsible && styles$b.titleInteractive
2737
2749
  ),
2750
+ onClick: isCollapsible ? handleCollapseToggle : void 0,
2751
+ onKeyDown: isCollapsible ? handleKeyDown : void 0,
2752
+ role: isCollapsible ? "button" : void 0,
2753
+ tabIndex: isCollapsible ? 0 : void 0,
2754
+ "aria-expanded": isCollapsible ? !isCollapsed2 : void 0,
2755
+ "aria-label": isCollapsible ? isCollapsed2 ? "Expand card" : "Collapse card" : void 0,
2738
2756
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$b.titleContent, children: [
2739
2757
  title2,
2740
2758
  isCollapsible && /* @__PURE__ */ jsxRuntimeExports.jsx(
2741
- "button",
2759
+ "span",
2742
2760
  {
2743
- type: "button",
2744
- className: styles$b.chevronButton,
2745
- onClick: handleCollapseToggle,
2746
- "aria-label": isCollapsed2 ? "Expand card" : "Collapse card",
2747
- "aria-expanded": !isCollapsed2,
2748
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2749
- "span",
2750
- {
2751
- "aria-hidden": "true",
2752
- className: classNames(
2753
- styles$b.chevron,
2754
- isCollapsed2 ? styles$b.chevronCollapsed : styles$b.chevronExpanded
2755
- )
2756
- }
2761
+ "aria-hidden": "true",
2762
+ className: classNames(
2763
+ styles$b.chevron,
2764
+ isCollapsed2 ? styles$b.chevronCollapsed : styles$b.chevronExpanded
2757
2765
  )
2758
2766
  }
2759
2767
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackcrane/ui",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/jcui.cjs.js",