@rogieking/figui3 6.19.1 → 6.20.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.
- package/README.md +34 -0
- package/components.css +131 -0
- package/dist/components.css +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +26 -26
- package/fig.js +273 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,6 +125,7 @@ Minimal example:
|
|
|
125
125
|
| [Preview](#preview) | `<fig-preview>` | Thin visual preview layer |
|
|
126
126
|
| [Media](#media) | `<fig-media>` | Shared media host for image/video |
|
|
127
127
|
| [Image](#image) | `<fig-image>` | Image display/upload |
|
|
128
|
+
| [Card](#card) | `<fig-card>` | Media card with label, link, and selection chrome |
|
|
128
129
|
| [Video](#video) | `<fig-video>` | Video display/upload with playback controls |
|
|
129
130
|
| [Avatar](#avatar) | `<fig-avatar>` | Profile image or initials |
|
|
130
131
|
| [Icon](#icon) | `<fig-icon>` | Masked icon from design tokens |
|
|
@@ -1324,6 +1325,39 @@ Use `slot="overlay"` for custom overlay controls. Slotted overlays stay as direc
|
|
|
1324
1325
|
|
|
1325
1326
|
---
|
|
1326
1327
|
|
|
1328
|
+
#### Card
|
|
1329
|
+
|
|
1330
|
+
`<fig-card>` — [demo](https://rog.ie/figui3/#card)
|
|
1331
|
+
|
|
1332
|
+
A media card with a truncated label, optional link, and attribute-only selection chrome. Composes a generated `fig-image` (or an authored `fig-image` / `fig-media` / `fig-preview` child).
|
|
1333
|
+
|
|
1334
|
+
| Attribute | Type | Default | Description |
|
|
1335
|
+
|---|---|---|---|
|
|
1336
|
+
| `src` | string | — | Image URL forwarded to generated `fig-image` |
|
|
1337
|
+
| `alt` | string | `""` | Alt text forwarded to generated `fig-image` |
|
|
1338
|
+
| `label` | string | — | Card title (preferred over `text`) |
|
|
1339
|
+
| `text` | string | — | Alias for `label` |
|
|
1340
|
+
| `sublabel` | string | — | Secondary one-line text under the label |
|
|
1341
|
+
| `href` | string | — | When set, wraps content in a real `<a>` |
|
|
1342
|
+
| `target` | string | — | Forwarded to the `<a>` (`_blank` adds `rel="noopener noreferrer"`) |
|
|
1343
|
+
| `selected` | boolean | `false` | Selected chrome only (no click-toggle) |
|
|
1344
|
+
| `disabled` | boolean | `false` | Dim + non-interactive; no `<a>` when disabled |
|
|
1345
|
+
| `full` | boolean | `false` | Stretch to the available width (cards are already `width: 100%` by default) |
|
|
1346
|
+
| `aspect-ratio` | string | `"1/1"` | Forwarded to generated `fig-image` |
|
|
1347
|
+
| `fit` | string | `"contain"` | Forwarded to generated `fig-image` |
|
|
1348
|
+
| `label-line-clamp` | string | `"1"` | `"1"` or `"2"` line clamp for the label |
|
|
1349
|
+
|
|
1350
|
+
```html
|
|
1351
|
+
<fig-card src="photo.jpg" label="Autumn field"></fig-card>
|
|
1352
|
+
<fig-card src="photo.jpg" label="Shader pill" sublabel="Generative tools/effects" selected></fig-card>
|
|
1353
|
+
<fig-card src="photo.jpg" label="Open asset" href="#asset"></fig-card>
|
|
1354
|
+
<fig-card src="photo.jpg" label="Wide card" aspect-ratio="16/9" full></fig-card>
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
Place cards in a CSS grid for multi-column layouts — there is no built-in columns attribute. Prefer `full` in fluid layouts for consistency with other FigUI controls.
|
|
1358
|
+
|
|
1359
|
+
---
|
|
1360
|
+
|
|
1327
1361
|
#### Video
|
|
1328
1362
|
|
|
1329
1363
|
`<fig-video>`
|
package/components.css
CHANGED
|
@@ -5054,6 +5054,137 @@ fig-chooser {
|
|
|
5054
5054
|
}
|
|
5055
5055
|
}
|
|
5056
5056
|
|
|
5057
|
+
fig-card {
|
|
5058
|
+
--fig-card-label-line-clamp: 1;
|
|
5059
|
+
--fig-card-media-radius: var(--radius-medium);
|
|
5060
|
+
display: block;
|
|
5061
|
+
width: 100%;
|
|
5062
|
+
min-width: 0;
|
|
5063
|
+
|
|
5064
|
+
&[full]:not([full="false"]) {
|
|
5065
|
+
width: 100%;
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5068
|
+
.fig-card-link {
|
|
5069
|
+
display: flex;
|
|
5070
|
+
flex-direction: column;
|
|
5071
|
+
gap: var(--spacer-1);
|
|
5072
|
+
padding: var(--spacer-1);
|
|
5073
|
+
border-radius: 0.5625rem;
|
|
5074
|
+
text-decoration: none;
|
|
5075
|
+
color: inherit;
|
|
5076
|
+
outline: none;
|
|
5077
|
+
box-sizing: border-box;
|
|
5078
|
+
width: 100%;
|
|
5079
|
+
min-width: 0;
|
|
5080
|
+
}
|
|
5081
|
+
|
|
5082
|
+
.fig-card-link:focus-visible {
|
|
5083
|
+
outline: var(--figma-focus-outline);
|
|
5084
|
+
outline-offset: var(--figma-focus-outline-offset);
|
|
5085
|
+
}
|
|
5086
|
+
|
|
5087
|
+
.fig-card-media {
|
|
5088
|
+
position: relative;
|
|
5089
|
+
border-radius: var(--fig-card-media-radius);
|
|
5090
|
+
background: var(--figma-color-bg-secondary);
|
|
5091
|
+
overflow: hidden;
|
|
5092
|
+
min-width: 0;
|
|
5093
|
+
}
|
|
5094
|
+
|
|
5095
|
+
.fig-card-media > fig-image,
|
|
5096
|
+
.fig-card-media > fig-media,
|
|
5097
|
+
.fig-card-media > fig-preview {
|
|
5098
|
+
display: block;
|
|
5099
|
+
width: 100%;
|
|
5100
|
+
max-width: none;
|
|
5101
|
+
gap: 0;
|
|
5102
|
+
border-radius: var(--fig-card-media-radius);
|
|
5103
|
+
}
|
|
5104
|
+
|
|
5105
|
+
.fig-card-media > fig-image > fig-preview,
|
|
5106
|
+
.fig-card-media > fig-media > fig-preview,
|
|
5107
|
+
.fig-card-media > fig-preview {
|
|
5108
|
+
width: 100%;
|
|
5109
|
+
max-width: none;
|
|
5110
|
+
border-radius: var(--fig-card-media-radius);
|
|
5111
|
+
min-height: auto;
|
|
5112
|
+
}
|
|
5113
|
+
|
|
5114
|
+
.fig-card-text {
|
|
5115
|
+
display: flex;
|
|
5116
|
+
flex-direction: column;
|
|
5117
|
+
gap: 0;
|
|
5118
|
+
min-width: 0;
|
|
5119
|
+
}
|
|
5120
|
+
|
|
5121
|
+
.fig-card-text[hidden] {
|
|
5122
|
+
display: none;
|
|
5123
|
+
}
|
|
5124
|
+
|
|
5125
|
+
.fig-card-label {
|
|
5126
|
+
font-size: var(--font-size-small);
|
|
5127
|
+
line-height: var(--line-height);
|
|
5128
|
+
color: var(--figma-color-text);
|
|
5129
|
+
min-width: 0;
|
|
5130
|
+
padding-inline: var(--spacer-1);
|
|
5131
|
+
display: -webkit-box;
|
|
5132
|
+
-webkit-box-orient: vertical;
|
|
5133
|
+
-webkit-line-clamp: var(--fig-card-label-line-clamp);
|
|
5134
|
+
overflow: hidden;
|
|
5135
|
+
word-break: break-word;
|
|
5136
|
+
}
|
|
5137
|
+
|
|
5138
|
+
.fig-card-label[hidden] {
|
|
5139
|
+
display: none;
|
|
5140
|
+
}
|
|
5141
|
+
|
|
5142
|
+
.fig-card-sublabel {
|
|
5143
|
+
font-size: var(--font-size-small);
|
|
5144
|
+
line-height: var(--line-height);
|
|
5145
|
+
color: var(--figma-color-text-secondary);
|
|
5146
|
+
padding-inline: var(--spacer-1);
|
|
5147
|
+
min-width: 0;
|
|
5148
|
+
white-space: nowrap;
|
|
5149
|
+
overflow: hidden;
|
|
5150
|
+
text-overflow: ellipsis;
|
|
5151
|
+
}
|
|
5152
|
+
|
|
5153
|
+
.fig-card-sublabel[hidden] {
|
|
5154
|
+
display: none;
|
|
5155
|
+
}
|
|
5156
|
+
|
|
5157
|
+
&:hover:not([selected]:not([selected="false"])):not(
|
|
5158
|
+
[disabled]:not([disabled="false"])
|
|
5159
|
+
):not([aria-disabled="true"])
|
|
5160
|
+
.fig-card-link {
|
|
5161
|
+
background: var(--figma-color-bg-secondary);
|
|
5162
|
+
}
|
|
5163
|
+
|
|
5164
|
+
&[selected]:not([selected="false"]) .fig-card-link {
|
|
5165
|
+
background: var(--figma-color-bg-selected);
|
|
5166
|
+
}
|
|
5167
|
+
|
|
5168
|
+
&[selected]:not([selected="false"]) .fig-card-media {
|
|
5169
|
+
outline: var(--figma-focus-outline);
|
|
5170
|
+
outline-offset: var(--figma-focus-outline-offset);
|
|
5171
|
+
}
|
|
5172
|
+
|
|
5173
|
+
&[selected]:not([selected="false"])
|
|
5174
|
+
.fig-card-media
|
|
5175
|
+
> :is(fig-image, fig-media)
|
|
5176
|
+
> fig-preview::after,
|
|
5177
|
+
&[selected]:not([selected="false"]) .fig-card-media > fig-preview::after {
|
|
5178
|
+
box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
|
|
5179
|
+
}
|
|
5180
|
+
|
|
5181
|
+
&[disabled]:not([disabled="false"]),
|
|
5182
|
+
&[aria-disabled="true"] {
|
|
5183
|
+
pointer-events: none;
|
|
5184
|
+
opacity: 0.4;
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
|
|
5057
5188
|
fig-choice {
|
|
5058
5189
|
--fig-choice-selection-ring-width: 1px;
|
|
5059
5190
|
--fig-choice-padding: 0px;
|