@akonwi/mica 0.1.1 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/mica.css +108 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -28,7 +28,7 @@ form validation) comes from the browser, not from a runtime.
28
28
  first-class distribution channel, not a workaround:
29
29
 
30
30
  ```sh
31
- curl -O https://raw.githubusercontent.com/akonwi/mica/v0.1.0/mica.css
31
+ curl -O https://raw.githubusercontent.com/akonwi/mica/v0.2.0/mica.css
32
32
  ```
33
33
 
34
34
  **npm** — for toolchains:
@@ -44,7 +44,7 @@ import "@akonwi/mica/mica.css";
44
44
  **CDN** — for trying it out:
45
45
 
46
46
  ```html
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@akonwi/mica@0.1/mica.css">
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@akonwi/mica@0.2/mica.css">
48
48
  ```
49
49
 
50
50
  ## The three tiers
package/mica.css CHANGED
@@ -616,6 +616,63 @@
616
616
  }
617
617
  }
618
618
 
619
+ /* segmented control: native radios fused into one control. The input
620
+ remains the form/keyboard/AT primitive; the label carries the visual
621
+ state because inputs cannot safely own pseudo-elements. */
622
+ :where(m-segmented) {
623
+ display: inline-flex;
624
+ inline-size: fit-content;
625
+ border: 1px solid var(--color-border-strong);
626
+ border-radius: var(--radius-sm);
627
+ }
628
+
629
+ :where(m-segmented) > :where(label) {
630
+ position: relative;
631
+ display: grid;
632
+ place-items: center;
633
+ min-block-size: var(--control-height);
634
+ padding-inline: var(--space-sm);
635
+ margin: 0;
636
+ font-size: 0.875rem;
637
+ font-weight: 400;
638
+ line-height: 1;
639
+ cursor: pointer;
640
+ user-select: none;
641
+ }
642
+
643
+ :where(m-segmented) > :where(label + label) {
644
+ border-inline-start: 1px solid var(--color-border-strong);
645
+ }
646
+
647
+ :where(m-segmented) > :where(label) > :where(input[type="radio"]) {
648
+ position: absolute;
649
+ inline-size: 1px;
650
+ block-size: 1px;
651
+ margin: -1px;
652
+ padding: 0;
653
+ overflow: hidden;
654
+ clip-path: inset(50%);
655
+ white-space: nowrap;
656
+ }
657
+
658
+ :where(m-segmented) > :where(label):has(> input:checked) {
659
+ background: var(--color-primary);
660
+ color: var(--color-on-primary);
661
+ font-weight: 600;
662
+ }
663
+
664
+ :where(m-segmented) > :where(label):has(> input:focus-visible) {
665
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
666
+ outline-offset: var(--focus-ring-offset);
667
+ z-index: 1;
668
+ }
669
+
670
+ :where(m-segmented) > :where(label):has(> input:disabled) {
671
+ color: var(--color-text-muted);
672
+ cursor: not-allowed;
673
+ opacity: 0.55;
674
+ }
675
+
619
676
  /* switch: a checkbox wearing a track; the thumb is a positioned
620
677
  gradient (pseudo-elements don't render on inputs). square, per the
621
678
  design language — a solid linear-gradient block */
@@ -664,6 +721,57 @@
664
721
  cursor: not-allowed;
665
722
  }
666
723
 
724
+ /* --- badge: quiet metadata, not a control ------------------------ */
725
+ :where(m-badge) {
726
+ display: inline-flex;
727
+ align-items: center;
728
+ justify-content: center;
729
+ min-inline-size: var(--m-badge-min-width, auto);
730
+ min-block-size: 1.5rem;
731
+ padding-inline: var(--m-badge-padding, var(--space-xs));
732
+ border: 1px solid var(--m-badge-border, var(--color-border));
733
+ border-radius: var(--radius-sm);
734
+ background: var(--m-badge-background, transparent);
735
+ color: var(--m-badge-color, var(--color-text-muted));
736
+ font-family: var(--m-badge-font, inherit);
737
+ font-size: 0.75rem;
738
+ font-weight: 500;
739
+ font-variant-numeric: var(--m-badge-numerals, normal);
740
+ line-height: 1;
741
+ white-space: nowrap;
742
+ }
743
+
744
+ :where(m-badge[variant="primary"]) {
745
+ --m-badge-border: var(--color-primary);
746
+ --m-badge-background: var(--color-primary);
747
+ --m-badge-color: var(--color-on-primary);
748
+ }
749
+
750
+ :where(m-badge[variant="success"]) {
751
+ --m-badge-border: var(--color-success-border);
752
+ --m-badge-background: var(--color-success-surface);
753
+ --m-badge-color: var(--color-success-text);
754
+ }
755
+
756
+ :where(m-badge[variant="warning"]) {
757
+ --m-badge-border: var(--color-warn-border);
758
+ --m-badge-background: var(--color-warn-surface);
759
+ --m-badge-color: var(--color-warn-text);
760
+ }
761
+
762
+ :where(m-badge[variant="danger"]) {
763
+ --m-badge-border: var(--color-danger-border);
764
+ --m-badge-background: var(--color-danger-surface);
765
+ --m-badge-color: var(--color-danger-text);
766
+ }
767
+
768
+ :where(m-badge[count]) {
769
+ --m-badge-min-width: 1.5rem;
770
+ --m-badge-padding: var(--space-2xs);
771
+ --m-badge-font: var(--font-mono);
772
+ --m-badge-numerals: tabular-nums;
773
+ }
774
+
667
775
  /* --- content: tables, lists, code, quotes ------------------------ */
668
776
  :where(table) {
669
777
  inline-size: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akonwi/mica",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Custom elements. Native behavior. Nearly no JavaScript.",
5
5
  "keywords": [
6
6
  "css",