@duskmoon-dev/art-components 0.3.3 → 0.4.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/README.md +13 -0
- package/dist/index.js +128 -59
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,6 +50,19 @@ export function Demo() {
|
|
|
50
50
|
`ArtCircularGalleryItem` is exported as the item type for
|
|
51
51
|
`ArtCircularGallery`.
|
|
52
52
|
|
|
53
|
+
`ArtCircularGallery` keeps its image links accessible by default. Use
|
|
54
|
+
`decorative` only when the gallery is purely visual; its links are then removed
|
|
55
|
+
from keyboard tab order. An explicit `aria-hidden` value on the root takes
|
|
56
|
+
precedence.
|
|
57
|
+
|
|
58
|
+
`ArtCsswitch` buttons are keyboard accessible and named by default. Set
|
|
59
|
+
`decorative` when the console is only an illustration; its buttons then leave
|
|
60
|
+
the tab order. An explicit root `aria-hidden` value takes precedence.
|
|
61
|
+
|
|
62
|
+
`ArtGeminiInput` names its default `+` and `>` buttons Add and Send. When
|
|
63
|
+
replacing either glyph with custom icon content, provide an accessible button
|
|
64
|
+
name through `beforeButtonProps` or `afterButtonProps` if the content has none.
|
|
65
|
+
|
|
53
66
|
Most decorative components accept `size="sm" | "default" | "lg"`; `ArtMoon`
|
|
54
67
|
and `ArtSun` also accept `size="xl"`. Components forward refs to their root
|
|
55
68
|
element, accept `className`, `style`, and DuskMoon CSS custom properties through
|
package/dist/index.js
CHANGED
|
@@ -81,12 +81,18 @@ var ArtMountain = forwardRef(({ size = "default", decorative, className, ...prop
|
|
|
81
81
|
...getDecorativeProps(decorative, props),
|
|
82
82
|
...props,
|
|
83
83
|
children: [
|
|
84
|
-
|
|
85
|
-
className: "
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
84
|
+
/* @__PURE__ */ jsx("div", {
|
|
85
|
+
className: "mountains",
|
|
86
|
+
children: Array.from({ length: 4 }, (_, index) => /* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: "mountain"
|
|
88
|
+
}, `mountain-${index}`))
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsx("div", {
|
|
91
|
+
className: "trees",
|
|
92
|
+
children: Array.from({ length: 3 }, (_, index) => /* @__PURE__ */ jsx("div", {
|
|
93
|
+
className: "tree"
|
|
94
|
+
}, `tree-${index}`))
|
|
95
|
+
}),
|
|
90
96
|
/* @__PURE__ */ jsx("div", {
|
|
91
97
|
className: "lights",
|
|
92
98
|
children: Array.from({ length: 9 }, (_, index) => /* @__PURE__ */ jsx("div", {
|
|
@@ -187,20 +193,20 @@ var ArtCircularGallery = forwardRef(({
|
|
|
187
193
|
title = "Gallery",
|
|
188
194
|
items,
|
|
189
195
|
size = "default",
|
|
190
|
-
decorative,
|
|
196
|
+
decorative = false,
|
|
191
197
|
className,
|
|
192
198
|
...props
|
|
193
199
|
}, ref) => {
|
|
194
200
|
const reactId = useId().replaceAll(":", "");
|
|
201
|
+
const decorativeProps = getDecorativeProps(decorative, props);
|
|
202
|
+
const rootAriaHidden = props["aria-hidden"] ?? ("aria-hidden" in decorativeProps ? decorativeProps["aria-hidden"] : undefined);
|
|
203
|
+
const linksAreHidden = rootAriaHidden === true || rootAriaHidden === "true";
|
|
195
204
|
return /* @__PURE__ */ jsxs("div", {
|
|
196
205
|
ref,
|
|
197
206
|
className: cn("art-circular-gallery", sizeClass("art-circular-gallery", size), className),
|
|
198
|
-
...
|
|
207
|
+
...decorativeProps,
|
|
199
208
|
...props,
|
|
200
209
|
children: [
|
|
201
|
-
title ? /* @__PURE__ */ jsx("h1", {
|
|
202
|
-
children: title
|
|
203
|
-
}) : null,
|
|
204
210
|
items.map((item, index) => {
|
|
205
211
|
const id = item.id ?? `${reactId}-gallery-item-${index + 1}`;
|
|
206
212
|
const itemStyle = {
|
|
@@ -215,13 +221,17 @@ var ArtCircularGallery = forwardRef(({
|
|
|
215
221
|
href: item.href ?? `#${id}`,
|
|
216
222
|
target: item.target,
|
|
217
223
|
rel: item.rel,
|
|
224
|
+
tabIndex: linksAreHidden ? -1 : undefined,
|
|
218
225
|
children: /* @__PURE__ */ jsx("img", {
|
|
219
226
|
src: item.src,
|
|
220
227
|
alt: item.alt ?? item.title
|
|
221
228
|
})
|
|
222
229
|
})
|
|
223
230
|
}, id);
|
|
224
|
-
})
|
|
231
|
+
}),
|
|
232
|
+
title ? /* @__PURE__ */ jsx("h1", {
|
|
233
|
+
children: title
|
|
234
|
+
}) : null
|
|
225
235
|
]
|
|
226
236
|
});
|
|
227
237
|
});
|
|
@@ -302,7 +312,10 @@ function Flower({ index }) {
|
|
|
302
312
|
}, leafIndex)),
|
|
303
313
|
/* @__PURE__ */ jsx("div", {
|
|
304
314
|
className: "flower__white-circle"
|
|
305
|
-
})
|
|
315
|
+
}),
|
|
316
|
+
Array.from({ length: 8 }, (_, lightIndex) => /* @__PURE__ */ jsx("div", {
|
|
317
|
+
className: cn("flower__light", `flower__light--${lightIndex + 1}`)
|
|
318
|
+
}, lightIndex))
|
|
306
319
|
]
|
|
307
320
|
}),
|
|
308
321
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -310,10 +323,7 @@ function Flower({ index }) {
|
|
|
310
323
|
children: Array.from({ length: leafCount }, (_, leafIndex) => /* @__PURE__ */ jsx("div", {
|
|
311
324
|
className: cn("flower__line__leaf", `flower__line__leaf--${leafIndex + 1}`)
|
|
312
325
|
}, leafIndex))
|
|
313
|
-
})
|
|
314
|
-
Array.from({ length: 8 }, (_, lightIndex) => /* @__PURE__ */ jsx("div", {
|
|
315
|
-
className: cn("flower__light", `flower__light--${lightIndex + 1}`)
|
|
316
|
-
}, lightIndex))
|
|
326
|
+
})
|
|
317
327
|
]
|
|
318
328
|
});
|
|
319
329
|
}
|
|
@@ -463,7 +473,7 @@ var ArtColorSpin = forwardRef(({ size = "default", decorative, className, ...pro
|
|
|
463
473
|
...props,
|
|
464
474
|
children: /* @__PURE__ */ jsx("ul", {
|
|
465
475
|
children: Array.from({ length: 4 }, (_, index) => /* @__PURE__ */ jsx("li", {
|
|
466
|
-
style: { "--i": index }
|
|
476
|
+
style: { "--i": index + 1 }
|
|
467
477
|
}, index))
|
|
468
478
|
})
|
|
469
479
|
}));
|
|
@@ -489,23 +499,35 @@ var ArtSynthwaveStarfield = forwardRef(({ size = "default", paused = false, deco
|
|
|
489
499
|
]
|
|
490
500
|
}));
|
|
491
501
|
ArtSynthwaveStarfield.displayName = "ArtSynthwaveStarfield";
|
|
492
|
-
function SwitchButton({
|
|
502
|
+
function SwitchButton({
|
|
503
|
+
className,
|
|
504
|
+
label,
|
|
505
|
+
hidden
|
|
506
|
+
}) {
|
|
493
507
|
return /* @__PURE__ */ jsx("button", {
|
|
494
508
|
type: "button",
|
|
495
509
|
className,
|
|
496
|
-
|
|
497
|
-
|
|
510
|
+
"aria-label": label,
|
|
511
|
+
tabIndex: hidden ? -1 : undefined,
|
|
512
|
+
"aria-hidden": hidden || undefined
|
|
498
513
|
});
|
|
499
514
|
}
|
|
500
|
-
function SwitchBar(
|
|
515
|
+
function SwitchBar({
|
|
516
|
+
side,
|
|
517
|
+
hidden
|
|
518
|
+
}) {
|
|
501
519
|
return /* @__PURE__ */ jsxs("div", {
|
|
502
520
|
className: "bar",
|
|
503
521
|
children: [
|
|
504
522
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
505
|
-
className: "sub-lr"
|
|
523
|
+
className: "sub-lr",
|
|
524
|
+
label: `${side} SL`,
|
|
525
|
+
hidden
|
|
506
526
|
}),
|
|
507
527
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
508
|
-
className: "sub-rr"
|
|
528
|
+
className: "sub-rr",
|
|
529
|
+
label: `${side} SR`,
|
|
530
|
+
hidden
|
|
509
531
|
}),
|
|
510
532
|
/* @__PURE__ */ jsx("span", {
|
|
511
533
|
className: "minus-sign"
|
|
@@ -538,62 +560,96 @@ function SwitchConnector() {
|
|
|
538
560
|
]
|
|
539
561
|
});
|
|
540
562
|
}
|
|
541
|
-
function LeftJoycon() {
|
|
563
|
+
function LeftJoycon({ hidden }) {
|
|
542
564
|
return /* @__PURE__ */ jsxs("div", {
|
|
543
565
|
className: "controller",
|
|
544
566
|
children: [
|
|
545
|
-
/* @__PURE__ */ jsx(SwitchBar, {
|
|
567
|
+
/* @__PURE__ */ jsx(SwitchBar, {
|
|
568
|
+
side: "Left",
|
|
569
|
+
hidden
|
|
570
|
+
}),
|
|
546
571
|
/* @__PURE__ */ jsx(SwitchConnector, {}),
|
|
547
572
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
548
|
-
className: "minus"
|
|
573
|
+
className: "minus",
|
|
574
|
+
label: "Minus",
|
|
575
|
+
hidden
|
|
549
576
|
}),
|
|
550
577
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
551
|
-
className: "mushroom round"
|
|
578
|
+
className: "mushroom round",
|
|
579
|
+
label: "Left stick",
|
|
580
|
+
hidden
|
|
552
581
|
}),
|
|
553
582
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
554
|
-
className: "direction arrow up round"
|
|
583
|
+
className: "direction arrow up round",
|
|
584
|
+
label: "Up",
|
|
585
|
+
hidden
|
|
555
586
|
}),
|
|
556
587
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
557
|
-
className: "direction arrow down round"
|
|
588
|
+
className: "direction arrow down round",
|
|
589
|
+
label: "Down",
|
|
590
|
+
hidden
|
|
558
591
|
}),
|
|
559
592
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
560
|
-
className: "direction arrow left round"
|
|
593
|
+
className: "direction arrow left round",
|
|
594
|
+
label: "Left",
|
|
595
|
+
hidden
|
|
561
596
|
}),
|
|
562
597
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
563
|
-
className: "direction arrow right round"
|
|
598
|
+
className: "direction arrow right round",
|
|
599
|
+
label: "Right",
|
|
600
|
+
hidden
|
|
564
601
|
}),
|
|
565
602
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
566
|
-
className: "menu"
|
|
603
|
+
className: "menu",
|
|
604
|
+
label: "Capture",
|
|
605
|
+
hidden
|
|
567
606
|
})
|
|
568
607
|
]
|
|
569
608
|
});
|
|
570
609
|
}
|
|
571
|
-
function RightJoycon() {
|
|
610
|
+
function RightJoycon({ hidden }) {
|
|
572
611
|
return /* @__PURE__ */ jsxs("div", {
|
|
573
612
|
className: "controller right",
|
|
574
613
|
children: [
|
|
575
|
-
/* @__PURE__ */ jsx(SwitchBar, {
|
|
614
|
+
/* @__PURE__ */ jsx(SwitchBar, {
|
|
615
|
+
side: "Right",
|
|
616
|
+
hidden
|
|
617
|
+
}),
|
|
576
618
|
/* @__PURE__ */ jsx(SwitchConnector, {}),
|
|
577
619
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
578
|
-
className: "minus plus"
|
|
620
|
+
className: "minus plus",
|
|
621
|
+
label: "Plus",
|
|
622
|
+
hidden
|
|
579
623
|
}),
|
|
580
624
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
581
|
-
className: "mushroom round"
|
|
625
|
+
className: "mushroom round",
|
|
626
|
+
label: "Right stick",
|
|
627
|
+
hidden
|
|
582
628
|
}),
|
|
583
629
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
584
|
-
className: "direction x round"
|
|
630
|
+
className: "direction x round",
|
|
631
|
+
label: "X",
|
|
632
|
+
hidden
|
|
585
633
|
}),
|
|
586
634
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
587
|
-
className: "direction y round"
|
|
635
|
+
className: "direction y round",
|
|
636
|
+
label: "Y",
|
|
637
|
+
hidden
|
|
588
638
|
}),
|
|
589
639
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
590
|
-
className: "direction a round"
|
|
640
|
+
className: "direction a round",
|
|
641
|
+
label: "A",
|
|
642
|
+
hidden
|
|
591
643
|
}),
|
|
592
644
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
593
|
-
className: "direction b round"
|
|
645
|
+
className: "direction b round",
|
|
646
|
+
label: "B",
|
|
647
|
+
hidden
|
|
594
648
|
}),
|
|
595
649
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
596
|
-
className: "home round"
|
|
650
|
+
className: "home round",
|
|
651
|
+
label: "Home",
|
|
652
|
+
hidden
|
|
597
653
|
})
|
|
598
654
|
]
|
|
599
655
|
});
|
|
@@ -658,18 +714,27 @@ function ComfortGrip() {
|
|
|
658
714
|
]
|
|
659
715
|
});
|
|
660
716
|
}
|
|
661
|
-
var ArtCsswitch = forwardRef(({ size = "default", decorative, className, ...props }, ref) =>
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
})
|
|
717
|
+
var ArtCsswitch = forwardRef(({ size = "default", decorative = false, className, ...props }, ref) => {
|
|
718
|
+
const decorativeProps = getDecorativeProps(decorative, props);
|
|
719
|
+
const rootAriaHidden = props["aria-hidden"] ?? ("aria-hidden" in decorativeProps ? decorativeProps["aria-hidden"] : undefined);
|
|
720
|
+
const controlsAreHidden = rootAriaHidden === true || rootAriaHidden === "true";
|
|
721
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
722
|
+
ref,
|
|
723
|
+
className: cn("art-csswitch", sizeClass("art-csswitch", size), className),
|
|
724
|
+
...decorativeProps,
|
|
725
|
+
...props,
|
|
726
|
+
children: [
|
|
727
|
+
/* @__PURE__ */ jsx(SwitchBody, {}),
|
|
728
|
+
/* @__PURE__ */ jsx(ComfortGrip, {}),
|
|
729
|
+
/* @__PURE__ */ jsx(LeftJoycon, {
|
|
730
|
+
hidden: controlsAreHidden
|
|
731
|
+
}),
|
|
732
|
+
/* @__PURE__ */ jsx(RightJoycon, {
|
|
733
|
+
hidden: controlsAreHidden
|
|
734
|
+
})
|
|
735
|
+
]
|
|
736
|
+
});
|
|
737
|
+
});
|
|
673
738
|
ArtCsswitch.displayName = "ArtCsswitch";
|
|
674
739
|
var ArtCSSwitch = ArtCsswitch;
|
|
675
740
|
var ArtSnowballPreloader = forwardRef(({ size = "default", decorative, className, ...props }, ref) => /* @__PURE__ */ jsxs("div", {
|
|
@@ -694,10 +759,10 @@ var ArtSnowballPreloader = forwardRef(({ size = "default", decorative, className
|
|
|
694
759
|
className: "art-snowball-preloader-ball-texture"
|
|
695
760
|
}),
|
|
696
761
|
/* @__PURE__ */ jsx("div", {
|
|
697
|
-
className: "art-snowball-preloader-ball-
|
|
762
|
+
className: "art-snowball-preloader-ball-outer-shadow"
|
|
698
763
|
}),
|
|
699
764
|
/* @__PURE__ */ jsx("div", {
|
|
700
|
-
className: "art-snowball-preloader-ball-
|
|
765
|
+
className: "art-snowball-preloader-ball-inner-shadow"
|
|
701
766
|
}),
|
|
702
767
|
/* @__PURE__ */ jsx("div", {
|
|
703
768
|
className: "art-snowball-preloader-ball-side-shadows"
|
|
@@ -737,6 +802,8 @@ var ArtGeminiInput = forwardRef(({
|
|
|
737
802
|
type: afterButtonType = "button",
|
|
738
803
|
...restAfterButtonProps
|
|
739
804
|
} = afterButtonProps ?? {};
|
|
805
|
+
const beforeLabel = beforeButtonProps?.["aria-label"] ?? (before === "+" && beforeButtonProps?.["aria-labelledby"] === undefined ? "Add" : undefined);
|
|
806
|
+
const afterLabel = afterButtonProps?.["aria-label"] ?? (after === ">" && afterButtonProps?.["aria-labelledby"] === undefined ? "Send" : undefined);
|
|
740
807
|
return /* @__PURE__ */ jsxs("div", {
|
|
741
808
|
ref,
|
|
742
809
|
className: cn("art-gemini-input", sizeClass("art-gemini-input", size), className),
|
|
@@ -751,8 +818,9 @@ var ArtGeminiInput = forwardRef(({
|
|
|
751
818
|
before !== null ? /* @__PURE__ */ jsx("button", {
|
|
752
819
|
type: beforeButtonType,
|
|
753
820
|
className: cn("art-gemini-input-btn", beforeButtonClassName),
|
|
754
|
-
disabled: disabled || beforeButtonProps?.disabled,
|
|
755
821
|
...restBeforeButtonProps,
|
|
822
|
+
disabled: disabled || beforeButtonProps?.disabled,
|
|
823
|
+
"aria-label": beforeLabel,
|
|
756
824
|
children: before
|
|
757
825
|
}) : null,
|
|
758
826
|
/* @__PURE__ */ jsx("textarea", {
|
|
@@ -762,7 +830,7 @@ var ArtGeminiInput = forwardRef(({
|
|
|
762
830
|
onChange,
|
|
763
831
|
placeholder,
|
|
764
832
|
name,
|
|
765
|
-
rows,
|
|
833
|
+
rows: rows ?? 1,
|
|
766
834
|
disabled,
|
|
767
835
|
readOnly,
|
|
768
836
|
required,
|
|
@@ -771,8 +839,9 @@ var ArtGeminiInput = forwardRef(({
|
|
|
771
839
|
after !== null ? /* @__PURE__ */ jsx("button", {
|
|
772
840
|
type: afterButtonType,
|
|
773
841
|
className: cn("art-gemini-input-btn", afterButtonClassName),
|
|
774
|
-
disabled: disabled || afterButtonProps?.disabled,
|
|
775
842
|
...restAfterButtonProps,
|
|
843
|
+
disabled: disabled || afterButtonProps?.disabled,
|
|
844
|
+
"aria-label": afterLabel,
|
|
776
845
|
children: after
|
|
777
846
|
}) : null
|
|
778
847
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duskmoon-dev/art-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "React components for @duskmoon-dev/css-art pure CSS illustrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": ">=19.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@duskmoon-dev/css-art": "1.
|
|
52
|
+
"@duskmoon-dev/css-art": "1.20.3",
|
|
53
53
|
"@testing-library/react": "16.3.2",
|
|
54
54
|
"@types/react": "19.2.18",
|
|
55
55
|
"@types/react-dom": "19.2.4",
|