@aleph-alpha/ui-library 2.5.2 → 2.6.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.
@@ -1,2 +1,2 @@
1
1
  export { default as UiFileItem } from './UiFileItem.vue';
2
- export type { UiFileItemProps } from './types';
2
+ export type { UiFileItemMediaTone, UiFileItemProps, UiFileItemSize, } from './types';
@@ -1,6 +1,7 @@
1
1
  import { UiFileTypeProps, UiFileTypeTone } from './types';
2
2
  declare const _default: import('vue').DefineComponent<UiFileTypeProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiFileTypeProps> & Readonly<{}>, {
3
3
  icon: string;
4
+ loading: boolean;
4
5
  error: boolean;
5
6
  filename: string;
6
7
  tone: UiFileTypeTone;
@@ -30,4 +30,9 @@ export interface UiFileTypeProps {
30
30
  * other prop. Use to indicate an upload/validation failure.
31
31
  */
32
32
  error?: boolean;
33
+ /**
34
+ * Use during upload/processing — the colored tone signals "success",
35
+ * so it shouldn't appear until the file is fully accepted.
36
+ */
37
+ loading?: boolean;
33
38
  }
@@ -49148,7 +49148,8 @@ const DY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49148
49148
  filename: { default: void 0 },
49149
49149
  tone: { default: void 0 },
49150
49150
  icon: { default: void 0 },
49151
- error: { type: Boolean, default: !1 }
49151
+ error: { type: Boolean, default: !1 },
49152
+ loading: { type: Boolean, default: !1 }
49152
49153
  },
49153
49154
  setup(e) {
49154
49155
  const t = e, a = {
@@ -49177,7 +49178,7 @@ const DY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49177
49178
  if (!t.filename) return o;
49178
49179
  const p = n(t.filename);
49179
49180
  return a[p] ?? o;
49180
- }), s = C(() => t.error ? "default" : t.tone || r.value.tone), d = C(() => t.error ? "circle-alert" : t.icon || r.value.icon), c = {
49181
+ }), s = C(() => t.error || t.loading ? "default" : t.tone || r.value.tone), d = C(() => t.error ? "circle-alert" : t.icon || r.value.icon), c = {
49181
49182
  default: "bg-background-surface-muted-subtle",
49182
49183
  "accent-pink": "bg-background-accent-pink",
49183
49184
  "accent-soft": "bg-background-accent-soft",
@@ -49335,8 +49336,9 @@ const DY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49335
49336
  filename: e.filename,
49336
49337
  tone: e.mediaTone,
49337
49338
  icon: e.mediaIcon,
49338
- error: s.value
49339
- }, null, 8, ["filename", "tone", "icon", "error"]),
49339
+ error: s.value,
49340
+ loading: d.value
49341
+ }, null, 8, ["filename", "tone", "icon", "error", "loading"]),
49340
49342
  te("div", {
49341
49343
  "data-slot": "file-item-content",
49342
49344
  class: H(f.value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-alpha/ui-library",
3
- "version": "2.5.2",
3
+ "version": "2.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/system/lib.js",
@@ -78,7 +78,7 @@
78
78
  "vue-router": "4.6.4",
79
79
  "vue-tsc": "^2.2.12",
80
80
  "wait-on": "9.0.3",
81
- "@aleph-alpha/eslint-config-frontend": "0.5.0",
81
+ "@aleph-alpha/eslint-config-frontend": "0.6.0",
82
82
  "@aleph-alpha/prettier-config-frontend": "2.1.0",
83
83
  "@aleph-alpha/tsconfig-frontend": "0.6.0"
84
84
  },
@@ -113,7 +113,7 @@
113
113
  "shiki": "^3.0.0",
114
114
  "tailwind-merge": "^3.4.0",
115
115
  "vue-sonner": "^2.0.9",
116
- "@aleph-alpha/config-css": "1.1.0"
116
+ "@aleph-alpha/config-css": "1.2.0"
117
117
  },
118
118
  "scripts": {
119
119
  "build": "node scripts/prepare-build.cjs && vite build",
@@ -5,11 +5,15 @@ import UiFileItem from './UiFileItem.vue';
5
5
  * `UiFileItem` is a single-row primitive that represents a file with
6
6
  * optional progress, error, and a remove control. Use it inside file-upload
7
7
  * flows or attachment lists; for the full uploader, see `UiFileUpload` pattern.
8
+ *
9
+ * Beta until the `background/accent/{pink,yellow}` design tokens are synced
10
+ * from Figma into `tokens.json` — the file-type badge currently sources them
11
+ * from static fallbacks in `config.js` (see `getStaticTokenVars`).
8
12
  */
9
13
  const meta: Meta<typeof UiFileItem> = {
10
14
  title: 'Components/UiFileItem',
11
15
  component: UiFileItem,
12
- tags: ['autodocs'],
16
+ tags: ['autodocs', 'beta'],
13
17
  args: {
14
18
  filename: 'document.pdf',
15
19
  typeLabel: 'PDF',
@@ -241,19 +245,22 @@ function onRemove() {}
241
245
  <template>
242
246
  <UiFileItem
243
247
  size="small"
244
- filename="Filename.pdf"
245
- type-label="PDF"
246
- size-label="12 MB"
248
+ filename="quarterly-report.csv"
249
+ type-label="CSV"
250
+ size-label="320 KB"
247
251
  @remove="onRemove"
248
252
  />
249
253
  </template>`;
250
254
 
251
- /** Small size · success. Pink media is derived from the `.pdf` filename. */
255
+ /**
256
+ * Small size · success. Yellow media + `table-2` icon are derived from the
257
+ * `.csv` filename
258
+ */
252
259
  export const SmallSuccess: Story = {
253
260
  args: {
254
- filename: 'Filename.pdf',
255
- typeLabel: 'PDF',
256
- sizeLabel: '12 MB',
261
+ filename: 'quarterly-report.csv',
262
+ typeLabel: 'CSV',
263
+ sizeLabel: '320 KB',
257
264
  progress: null,
258
265
  error: '',
259
266
  size: 'small',
@@ -301,9 +308,9 @@ import { UiFileItem } from '@aleph-alpha/ui-library'
301
308
 
302
309
  <template>
303
310
  <UiFileItem
304
- filename="sent.pdf"
305
- type-label="PDF"
306
- size-label="2 MB"
311
+ filename="release-notes.md"
312
+ type-label="MD"
313
+ size-label="14 KB"
307
314
  :removable="false"
308
315
  />
309
316
  </template>`;
@@ -311,9 +318,9 @@ import { UiFileItem } from '@aleph-alpha/ui-library'
311
318
  /** Read-only preview: no close icon. */
312
319
  export const NonRemovable: Story = {
313
320
  args: {
314
- filename: 'sent.pdf',
315
- typeLabel: 'PDF',
316
- sizeLabel: '2 MB',
321
+ filename: 'release-notes.md',
322
+ typeLabel: 'MD',
323
+ sizeLabel: '14 KB',
317
324
  progress: null,
318
325
  error: '',
319
326
  disabled: false,
@@ -109,6 +109,7 @@ const progressClass = computed(() =>
109
109
  :tone="mediaTone"
110
110
  :icon="mediaIcon"
111
111
  :error="isError"
112
+ :loading="isWithProgress"
112
113
  />
113
114
 
114
115
  <div data-slot="file-item-content" :class="contentClass">
@@ -1,2 +1,6 @@
1
1
  export { default as UiFileItem } from './UiFileItem.vue';
2
- export type { UiFileItemProps } from './types';
2
+ export type {
3
+ UiFileItemMediaTone,
4
+ UiFileItemProps,
5
+ UiFileItemSize,
6
+ } from './types';
@@ -14,6 +14,7 @@ const props = withDefaults(defineProps<UiFileTypeProps>(), {
14
14
  tone: undefined,
15
15
  icon: undefined,
16
16
  error: false,
17
+ loading: false,
17
18
  });
18
19
 
19
20
  /** Visual preset (tone + icon) for a known file extension. */
@@ -68,12 +69,8 @@ const filePreset = computed<FileTypePreset>(() => {
68
69
  return FILE_TYPE_PRESETS[ext] ?? DEFAULT_PRESET;
69
70
  });
70
71
 
71
- // Resolved tone/icon: `error` short-circuits to the neutral preset; an
72
- // explicit prop wins over the filename-derived preset. Truthy checks (`||`)
73
- // rather than nullish (`??`) so empty strings from text-based controls
74
- // (Storybook, form inputs) fall back to the auto-derived value.
75
72
  const resolvedTone = computed<UiFileTypeTone>(() => {
76
- if (props.error) return 'default';
73
+ if (props.error || props.loading) return 'default';
77
74
  return props.tone || filePreset.value.tone;
78
75
  });
79
76
 
@@ -30,6 +30,15 @@ describe('UiFileType', () => {
30
30
  expect(badge?.querySelector('svg.lucide-circle-alert')).not.toBeNull();
31
31
  });
32
32
 
33
+ test('loading forces the neutral badge but keeps the filename icon', () => {
34
+ const { container } = render(UiFileType, {
35
+ props: { filename: 'data.csv', loading: true },
36
+ });
37
+ const badge = container.querySelector('[data-slot="file-type"]');
38
+ expect(badge?.getAttribute('data-tone')).toBe('default');
39
+ expect(badge?.querySelector('svg.lucide-table-2')).not.toBeNull();
40
+ });
41
+
33
42
  test('explicit tone and icon props override the auto-derived values', () => {
34
43
  const { container } = render(UiFileType, {
35
44
  props: { filename: 'archive.zip', tone: 'accent-pink', icon: 'star' },
@@ -35,4 +35,9 @@ export interface UiFileTypeProps {
35
35
  * other prop. Use to indicate an upload/validation failure.
36
36
  */
37
37
  error?: boolean;
38
+ /**
39
+ * Use during upload/processing — the colored tone signals "success",
40
+ * so it shouldn't appear until the file is fully accepted.
41
+ */
42
+ loading?: boolean;
38
43
  }