@salemcobalt/ui 0.2.0-rc.21 → 0.2.0-rc.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/styles.css CHANGED
@@ -1,9 +1,10 @@
1
- /* @salemcobalt/ui 0.2.0-rc.21 — requires @salemcobalt/tokens/css. */
1
+ /* @salemcobalt/ui 0.2.0-rc.22 — requires @salemcobalt/tokens/css. */
2
2
  @layer sc {
3
3
  /* ---- base.css ---- */
4
4
  /* Shared: focus ring, reduced motion. Component files follow. */
5
5
  .sc-focus-ring:focus-visible,
6
6
  .sc-button:focus-visible,
7
+ .sc-avatar-button:focus-visible,
7
8
  .sc-card[data-interactive]:focus-visible,
8
9
  .sc-dialog__close:focus-visible,
9
10
  .sc-menu__item:focus-visible,
@@ -5689,4 +5690,112 @@
5689
5690
  margin: 0;
5690
5691
  }
5691
5692
 
5693
+ /* ---- avatar.css ---- */
5694
+ /* ---- Avatar ---------------------------------------------------------------- */
5695
+ /* Sizes follow the control heights (so compact density shrinks them too), xs the 24px icon. The tint alone is about
5696
+ 1.0-1.4:1 on the surfaces, so the 1px ring (avatar.ring, 3:1 on the fill and every surface) draws the circle. It is
5697
+ an overlay, so it also edges a picture. */
5698
+ .sc-avatar {
5699
+ --_size: var(--sc-size-control-md);
5700
+ --_fs: var(--sc-font-size-sm);
5701
+ --_ring: var(--sc-border-width-hairline);
5702
+ position: relative;
5703
+ display: inline-grid;
5704
+ place-items: center;
5705
+ flex: none;
5706
+ box-sizing: border-box;
5707
+ inline-size: var(--_size);
5708
+ block-size: var(--_size);
5709
+ overflow: hidden;
5710
+ border-radius: var(--sc-radius-full);
5711
+ background: var(--sc-color-avatar-fill);
5712
+ color: var(--sc-color-avatar-text);
5713
+ font-family: var(--sc-font-family-sans);
5714
+ font-size: var(--_fs);
5715
+ font-weight: var(--sc-font-weight-semibold);
5716
+ line-height: 1;
5717
+ letter-spacing: 0;
5718
+ white-space: nowrap;
5719
+ user-select: none;
5720
+ vertical-align: middle;
5721
+ }
5722
+ .sc-avatar::after {
5723
+ content: '';
5724
+ position: absolute;
5725
+ inset: 0;
5726
+ border-radius: inherit;
5727
+ box-shadow: inset 0 0 0 var(--_ring) var(--sc-color-avatar-ring);
5728
+ pointer-events: none;
5729
+ transition: box-shadow var(--sc-duration-fast) var(--sc-ease-standard);
5730
+ }
5731
+ .sc-avatar[data-size='xs'] {
5732
+ --_size: var(--sc-size-icon-xl);
5733
+ --_fs: var(--sc-font-size-xs);
5734
+ }
5735
+ .sc-avatar[data-size='sm'] {
5736
+ --_size: var(--sc-size-control-sm);
5737
+ --_fs: var(--sc-font-size-xs);
5738
+ }
5739
+ .sc-avatar[data-size='lg'] {
5740
+ --_size: var(--sc-size-control-lg);
5741
+ --_fs: var(--sc-font-size-md);
5742
+ }
5743
+ .sc-avatar__image {
5744
+ position: absolute;
5745
+ inset: 0;
5746
+ inline-size: 100%;
5747
+ block-size: 100%;
5748
+ object-fit: cover;
5749
+ }
5750
+ .sc-avatar__fallback {
5751
+ display: contents;
5752
+ }
5753
+ /* No name and no initials: a person glyph at 60% of the circle. */
5754
+ .sc-avatar__icon {
5755
+ font-size: calc(var(--_size) * 0.6);
5756
+ }
5757
+
5758
+ /* ---- AvatarButton ---------------------------------------------------------- */
5759
+ .sc-avatar-button {
5760
+ position: relative;
5761
+ display: inline-grid;
5762
+ flex: none;
5763
+ padding: 0;
5764
+ border: 0;
5765
+ border-radius: var(--sc-radius-full);
5766
+ background: none;
5767
+ color: inherit;
5768
+ font: inherit;
5769
+ text-decoration: none;
5770
+ cursor: pointer;
5771
+ }
5772
+ .sc-avatar-button:hover > .sc-avatar,
5773
+ .sc-avatar-button[data-popup-open] > .sc-avatar,
5774
+ .sc-avatar-button[aria-expanded='true'] > .sc-avatar {
5775
+ --_ring: var(--sc-border-width-focus);
5776
+ }
5777
+ .sc-avatar-button:disabled {
5778
+ opacity: 0.5;
5779
+ cursor: not-allowed;
5780
+ }
5781
+ .sc-avatar-button:disabled:hover > .sc-avatar {
5782
+ --_ring: var(--sc-border-width-hairline);
5783
+ }
5784
+ /* 44px hit area on touch without changing layout, as on Button. */
5785
+ @media (pointer: coarse) {
5786
+ .sc-avatar-button::after {
5787
+ content: '';
5788
+ position: absolute;
5789
+ inset: 50% auto auto 50%;
5790
+ translate: -50% -50%;
5791
+ inline-size: max(100%, var(--sc-size-touch-target));
5792
+ block-size: max(100%, var(--sc-size-touch-target));
5793
+ }
5794
+ }
5795
+ @media (prefers-reduced-motion: reduce) {
5796
+ .sc-avatar::after {
5797
+ transition: none;
5798
+ }
5799
+ }
5800
+
5692
5801
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salemcobalt/ui",
3
- "version": "0.2.0-rc.21",
3
+ "version": "0.2.0-rc.22",
4
4
  "description": "React components for the Salem Cobalt design system: Button, IconButton, Icon set, BroomIcon, Badge, Card, Stack, Inline, Kbd, Dialog, FullScreenFlow, Tooltip, Menu, Popover, PriorityNav, Toolbar, Banner, Spinner, Progress, Tabs, Input, Textarea, Select, FileInput, Checkbox, Switch, Heading, Text, Table, Stat, Chip, Disclosure, EmptyState, Skeleton, Score, ReasonList, WordDiff, Quote; TextEditor (CodeMirror 6, inline word diffs) at @salemcobalt/ui/editor.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -46,7 +46,7 @@
46
46
  "diff": "^8.0.4",
47
47
  "react": "^19.0.0",
48
48
  "react-dom": "^19.0.0",
49
- "@salemcobalt/tokens": "^0.2.0-rc.21"
49
+ "@salemcobalt/tokens": "^0.2.0-rc.22"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@codemirror/commands": {
@@ -109,7 +109,7 @@
109
109
  "tsup": "^9.0.0",
110
110
  "typescript": "^5.9.3",
111
111
  "vitest": "^5.0.5",
112
- "@salemcobalt/tokens": "^0.2.0-rc.21"
112
+ "@salemcobalt/tokens": "^0.2.0-rc.22"
113
113
  },
114
114
  "publishConfig": {
115
115
  "access": "public"