@happyvertical/smrt-assets 0.60.16 → 0.60.18

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.
@@ -99,11 +99,11 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
99
99
  ];
100
100
  </script>
101
101
 
102
- <div class="asset-toolbar" data-smrt-component="AssetToolbar">
103
- <div class="asset-toolbar__left">
102
+ <div class="smrt-asset-toolbar__root" data-smrt-component="AssetToolbar">
103
+ <div class="smrt-asset-toolbar__left" data-smrt-part="group">
104
104
  <!-- Search -->
105
- <div class="asset-toolbar__search">
106
- <span class="search-icon" aria-hidden="true">
105
+ <div class="smrt-asset-toolbar__search" data-smrt-part="field">
106
+ <span class="smrt-asset-toolbar__search-icon" data-smrt-part="icon" aria-hidden="true">
107
107
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
108
108
  <circle cx="11" cy="11" r="8"></circle>
109
109
  <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
@@ -111,14 +111,13 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
111
111
  </span>
112
112
  <Input
113
113
  type="search"
114
- class="search-field"
115
114
  placeholder={t(M['assets.asset_toolbar.search_placeholder'])}
116
115
  value={searchValue}
117
116
  oninput={handleSearch}
118
117
  aria-label={t(M['assets.asset_toolbar.search_assets'])}
119
118
  />
120
119
  {#if searchValue}
121
- <Button variant="ghost" size="sm" class="search-clear" onclick={handleClearSearch} aria-label={t(M['assets.asset_toolbar.clear_search'])}>
120
+ <Button variant="ghost" size="sm" onclick={handleClearSearch} aria-label={t(M['assets.asset_toolbar.clear_search'])}>
122
121
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
123
122
  <line x1="18" y1="6" x2="6" y2="18"></line>
124
123
  <line x1="6" y1="6" x2="18" y2="18"></line>
@@ -128,7 +127,7 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
128
127
  </div>
129
128
 
130
129
  <!-- Type Filter -->
131
- <Select class="asset-toolbar__select" value={typeValue} onchange={handleTypeFilter} aria-label={t(M['assets.asset_toolbar.filter_by_type'])}>
130
+ <Select value={typeValue} onchange={handleTypeFilter} aria-label={t(M['assets.asset_toolbar.filter_by_type'])}>
132
131
  <option value="">{t(M['assets.asset_toolbar.all_types'])}</option>
133
132
  <option value="image">Images</option>
134
133
  <option value="video">Videos</option>
@@ -137,7 +136,7 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
137
136
  </Select>
138
137
 
139
138
  <!-- Sort -->
140
- <Select class="asset-toolbar__select" value={sortValue} onchange={handleSortChange} aria-label={t(M['assets.asset_toolbar.sort_assets'])}>
139
+ <Select value={sortValue} onchange={handleSortChange} aria-label={t(M['assets.asset_toolbar.sort_assets'])}>
141
140
  <option value="createdAt:desc">{t(M['assets.asset_toolbar.newest_first'])}</option>
142
141
  <option value="createdAt:asc">{t(M['assets.asset_toolbar.oldest_first'])}</option>
143
142
  <option value="name:asc">{t(M['assets.asset_toolbar.name_a_z'])}</option>
@@ -146,13 +145,12 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
146
145
  </Select>
147
146
  </div>
148
147
 
149
- <div class="asset-toolbar__right">
148
+ <div class="smrt-asset-toolbar__right" data-smrt-part="actions">
150
149
  <!-- View Toggle -->
151
- <div class="view-toggle" role="group" aria-label={t(M['assets.asset_toolbar.view_mode'])}>
150
+ <div class="smrt-asset-toolbar__view-toggle" data-smrt-part="group" role="group" aria-label={t(M['assets.asset_toolbar.view_mode'])}>
152
151
  {#each views as v (v.key)}
153
152
  <Button
154
153
  variant={view === v.key ? 'primary' : 'ghost'}
155
- class="view-toggle__btn"
156
154
  onclick={() => (onviewchange ?? onViewChange)(v.key)}
157
155
  aria-label={t(M['assets.asset_toolbar.view_label'], { label: v.label })}
158
156
  aria-pressed={view === v.key}
@@ -181,7 +179,6 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
181
179
  <!-- Upload Button -->
182
180
  <Button
183
181
  variant="primary"
184
- class="upload-btn"
185
182
  onclick={() => (onupload ?? onUpload)()}
186
183
  >
187
184
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -196,19 +193,16 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
196
193
 
197
194
  <style>
198
195
  @layer smrt.reset, smrt.structure, smrt.theme;
199
- @layer smrt.theme {
200
- .asset-toolbar {
196
+ @layer smrt.structure {
197
+ .smrt-asset-toolbar__root {
201
198
  display: flex;
202
199
  align-items: center;
203
200
  justify-content: space-between;
204
201
  gap: var(--smrt-spacing-3, 0.75rem);
205
202
  padding: var(--smrt-spacing-3, 0.75rem) var(--smrt-spacing-4, 1rem);
206
- background: var(--smrt-color-surface);
207
- border-bottom: var(--smrt-hairline);
208
203
  flex-wrap: wrap;
209
204
  }
210
-
211
- .asset-toolbar__left {
205
+ .smrt-asset-toolbar__left {
212
206
  display: flex;
213
207
  align-items: center;
214
208
  gap: var(--smrt-spacing-2, 0.5rem);
@@ -216,160 +210,186 @@ const views: { key: AssetViewMode; label: string; icon: string }[] = [
216
210
  min-width: 0;
217
211
  flex-wrap: wrap;
218
212
  }
219
-
220
- .asset-toolbar__right {
213
+ .smrt-asset-toolbar__right {
221
214
  display: flex;
222
215
  align-items: center;
223
216
  gap: var(--smrt-spacing-2, 0.5rem);
224
217
  flex-shrink: 0;
225
218
  }
226
-
227
219
  /* Search */
228
- .asset-toolbar__search {
220
+ .smrt-asset-toolbar__search {
229
221
  display: flex;
230
222
  align-items: center;
231
223
  flex: 1;
232
224
  min-width: 180px;
233
225
  max-width: 320px;
234
226
  height: 36px;
227
+ }
228
+ .smrt-asset-toolbar__search-icon {
229
+ display: flex;
230
+ align-items: center;
231
+ padding-left: var(--smrt-spacing-2, 0.5rem);
232
+ }
233
+ /* The search field renders via <Input> (issue #1589). It sits inside the
234
+ bordered .smrt-asset-toolbar__search shell, so the overrides strip the
235
+ primitive's own border/background/box-shadow to keep it transparent and
236
+ reach the child <input> through :global() scoping. */
237
+ .smrt-asset-toolbar__search :global([data-smrt-component="Input"]) {
238
+ flex: 1;
239
+ padding: var(--smrt-spacing-1, 0.25rem) var(--smrt-spacing-2, 0.5rem);
240
+ min-width: 0;
241
+ }
242
+ .smrt-asset-toolbar__search :global([data-smrt-component="Input"]::-webkit-search-cancel-button) {
243
+ display: none;
244
+ }
245
+ /* The clear control renders via <Button> (issue #1589). The overrides shape it
246
+ into a small round icon button and reach the child <button> via :global()
247
+ scoping. */
248
+ .smrt-asset-toolbar__search :global([data-smrt-component="Button"]) {
249
+ width: 24px;
250
+ height: 24px;
251
+ margin-right: var(--smrt-spacing-1, 0.25rem);
252
+ padding: 0;
253
+ }
254
+ /* Selects render via <Select> (issue #1589). The base select primitive owns
255
+ the chevron + focus ring; these overrides pin the toolbar-matching 36px
256
+ height, container-low fill, and width, and reach the child <select> through
257
+ :global() scoping. */
258
+ .smrt-asset-toolbar__left :global([data-smrt-component="Select"]) {
259
+ width: auto;
260
+ height: 36px;
261
+ padding: 0 var(--smrt-spacing-8, 2rem) 0 var(--smrt-spacing-3, 0.75rem);
262
+ cursor: pointer;
263
+ }
264
+ /* View Toggle */
265
+ .smrt-asset-toolbar__view-toggle {
266
+ display: flex;
267
+ overflow: hidden;
268
+ }
269
+ /* The toggle buttons render via <Button> (issue #1589); the active state is
270
+ the `primary` variant, the inactive state the `ghost` variant. These overrides
271
+ give the buttons their square icon footprint and the segmented divider, and
272
+ reach the child <button> via :global() scoping. */
273
+ .smrt-asset-toolbar__view-toggle :global([data-smrt-component="Button"]) {
274
+ width: 36px;
275
+ height: 36px;
276
+ padding: 0;
277
+ }
278
+ /* Upload Button — renders via <Button variant="primary"> (issue #1589). The
279
+ primary variant owns the fill/hover; the override only pins the
280
+ toolbar-matching 36px height and gap, reaching the child <button> via
281
+ :global() scoping. */
282
+ .smrt-asset-toolbar__right > :global([data-smrt-component="Button"]) {
283
+ gap: var(--smrt-spacing-1, 0.25rem);
284
+ height: 36px;
285
+ padding: 0 var(--smrt-spacing-3, 0.75rem);
286
+ }
287
+ @media (max-width: 640px) {
288
+ .smrt-asset-toolbar__root {
289
+ flex-direction: column;
290
+ align-items: stretch;
291
+ }
292
+ .smrt-asset-toolbar__left {
293
+ flex-direction: column;
294
+ }
295
+ .smrt-asset-toolbar__search {
296
+ max-width: none;
297
+ }
298
+ .smrt-asset-toolbar__right {
299
+ justify-content: space-between;
300
+ }
301
+ }
302
+ }
303
+
304
+ @layer smrt.theme {
305
+ .smrt-asset-toolbar__root {
306
+ background: var(--smrt-color-surface);
307
+ border-bottom: var(--smrt-hairline);
308
+ }
309
+ /* Search */
310
+ .smrt-asset-toolbar__search {
235
311
  background: var(--smrt-color-surface-container-low);
236
312
  border: var(--smrt-hairline);
237
313
  border-radius: var(--smrt-radius-medium, 0.5rem);
238
314
  transition: border-color 150ms ease;
239
315
  }
240
-
241
- .asset-toolbar__search:focus-within {
316
+ .smrt-asset-toolbar__search:focus-within {
242
317
  border-color: var(--smrt-color-primary);
243
318
  box-shadow: 0 0 0 2px var(--smrt-color-primary-container, rgba(0, 90, 193, 0.1));
244
319
  }
245
-
246
- .search-icon {
247
- display: flex;
248
- align-items: center;
249
- padding-left: var(--smrt-spacing-2, 0.5rem);
320
+ .smrt-asset-toolbar__search-icon {
250
321
  color: var(--smrt-color-on-surface-variant);
251
322
  }
252
-
253
- /* The search field renders via <Input class="search-field"> (issue #1589). It
254
- sits inside the bordered .asset-toolbar__search shell, so the overrides strip
255
- the primitive's own border/background/box-shadow to keep it transparent and
256
- reach the child <input> through :global() scoping. */
257
- .asset-toolbar__search :global(.search-field) {
258
- flex: 1;
323
+ /* The search field renders via <Input> (issue #1589). It sits inside the
324
+ bordered .smrt-asset-toolbar__search shell, so the overrides strip the
325
+ primitive's own border/background/box-shadow to keep it transparent and
326
+ reach the child <input> through :global() scoping. */
327
+ .smrt-asset-toolbar__search :global([data-smrt-component="Input"]) {
259
328
  border: none;
260
329
  border-radius: 0;
261
330
  background: transparent;
262
331
  box-shadow: none;
263
- padding: var(--smrt-spacing-1, 0.25rem) var(--smrt-spacing-2, 0.5rem);
264
332
  font-family: inherit;
265
333
  font-size: var(--smrt-typography-body-medium-size, 0.875rem);
266
334
  color: var(--smrt-color-on-surface);
267
335
  outline: none;
268
- min-width: 0;
269
336
  }
270
-
271
- .asset-toolbar__search :global(.search-field:focus) {
337
+ .smrt-asset-toolbar__search :global([data-smrt-component="Input"]:focus) {
272
338
  border: none;
273
339
  box-shadow: none;
274
340
  }
275
-
276
- .asset-toolbar__search :global(.search-field::placeholder) {
341
+ .smrt-asset-toolbar__search :global([data-smrt-component="Input"]::placeholder) {
277
342
  color: var(--smrt-color-on-surface-variant);
278
343
  }
279
-
280
- .asset-toolbar__search :global(.search-field::-webkit-search-cancel-button) {
281
- display: none;
282
- }
283
-
284
- /* search-clear renders via <Button class="search-clear"> (issue #1589). The
285
- overrides shape it into a small round icon button and reach the child
286
- <button> via :global() scoping. */
287
- .asset-toolbar__search :global(.search-clear) {
288
- width: 24px;
289
- height: 24px;
290
- margin-right: var(--smrt-spacing-1, 0.25rem);
291
- padding: 0;
344
+ /* The clear control renders via <Button> (issue #1589). The overrides shape it
345
+ into a small round icon button and reach the child <button> via :global()
346
+ scoping. */
347
+ .smrt-asset-toolbar__search :global([data-smrt-component="Button"]) {
292
348
  border: none;
293
349
  background: transparent;
294
350
  color: var(--smrt-color-on-surface-variant);
295
351
  border-radius: var(--smrt-radius-full);
296
352
  }
297
-
298
- .asset-toolbar__search :global(.search-clear:hover) {
353
+ .smrt-asset-toolbar__search :global([data-smrt-component="Button"]:hover) {
299
354
  color: var(--smrt-color-on-surface);
300
355
  background: var(--smrt-color-surface-container);
301
356
  }
302
-
303
- /* Selects render via <Select class="asset-toolbar__select"> (issue #1589). The
304
- base .select primitive owns the chevron + focus ring; these overrides pin the
305
- toolbar-matching 36px height, container-low fill, and width, and reach the
306
- child <select> through :global() scoping. */
307
- .asset-toolbar__left :global(.asset-toolbar__select) {
308
- width: auto;
309
- height: 36px;
310
- padding: 0 var(--smrt-spacing-8, 2rem) 0 var(--smrt-spacing-3, 0.75rem);
357
+ /* Selects render via <Select> (issue #1589). The base select primitive owns
358
+ the chevron + focus ring; these overrides pin the toolbar-matching 36px
359
+ height, container-low fill, and width, and reach the child <select> through
360
+ :global() scoping. */
361
+ .smrt-asset-toolbar__left :global([data-smrt-component="Select"]) {
311
362
  background-color: var(--smrt-color-surface-container-low);
312
363
  border: var(--smrt-hairline);
313
364
  border-radius: var(--smrt-radius-medium, 0.5rem);
314
365
  font-family: inherit;
315
366
  font-size: var(--smrt-typography-body-medium-size, 0.875rem);
316
367
  color: var(--smrt-color-on-surface);
317
- cursor: pointer;
318
368
  }
319
-
320
369
  /* View Toggle */
321
- .view-toggle {
322
- display: flex;
370
+ .smrt-asset-toolbar__view-toggle {
323
371
  border: var(--smrt-hairline);
324
372
  border-radius: var(--smrt-radius-medium, 0.5rem);
325
- overflow: hidden;
326
373
  }
327
-
328
- /* view-toggle__btn renders via <Button> (issue #1589); the active state is the
329
- `primary` variant, the inactive state the `ghost` variant. These overrides
330
- give the buttons their square icon footprint and the segmented divider, and
331
- reach the child <button> via :global() scoping. */
332
- .view-toggle :global(.view-toggle__btn) {
333
- width: 36px;
334
- height: 36px;
335
- padding: 0;
374
+ /* The toggle buttons render via <Button> (issue #1589); the active state is
375
+ the `primary` variant, the inactive state the `ghost` variant. These overrides
376
+ give the buttons their square icon footprint and the segmented divider, and
377
+ reach the child <button> via :global() scoping. */
378
+ .smrt-asset-toolbar__view-toggle :global([data-smrt-component="Button"]) {
336
379
  border: none;
337
380
  border-radius: 0;
338
381
  }
339
-
340
- .view-toggle :global(.view-toggle__btn:not(:last-child)) {
382
+ .smrt-asset-toolbar__view-toggle :global([data-smrt-component="Button"]:not(:last-child)) {
341
383
  border-right: var(--smrt-hairline);
342
384
  }
343
-
344
- /* Upload Button — renders via <Button variant="primary" class="upload-btn">
345
- (issue #1589). The primary variant owns the fill/hover; the override only
346
- pins the toolbar-matching 36px height and gap, reaching the child <button>
347
- via :global() scoping. */
348
- .asset-toolbar__right :global(.upload-btn) {
349
- gap: var(--smrt-spacing-1, 0.25rem);
350
- height: 36px;
351
- padding: 0 var(--smrt-spacing-3, 0.75rem);
385
+ /* Upload Button — renders via <Button variant="primary"> (issue #1589). The
386
+ primary variant owns the fill/hover; the override only pins the
387
+ toolbar-matching 36px height and gap, reaching the child <button> via
388
+ :global() scoping. */
389
+ .smrt-asset-toolbar__right > :global([data-smrt-component="Button"]) {
352
390
  font-size: var(--smrt-typography-body-medium-size, 0.875rem);
353
391
  font-weight: var(--smrt-typography-weight-medium, 500);
354
392
  }
355
-
356
- @media (max-width: 640px) {
357
- .asset-toolbar {
358
- flex-direction: column;
359
- align-items: stretch;
360
- }
361
-
362
- .asset-toolbar__left {
363
- flex-direction: column;
364
- }
365
-
366
- .asset-toolbar__search {
367
- max-width: none;
368
- }
369
-
370
- .asset-toolbar__right {
371
- justify-content: space-between;
372
- }
373
- }
374
393
  }
394
+
375
395
  </style>