@godxjp/ui 33.13.0 → 33.15.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.
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ export type { PersonaProp, PersonaProp as PersonaProps, } from "../../props/components/data-display.prop.js";
3
+ /** A person's identity, independent of row chrome, navigation and account actions. */
4
+ export declare const Persona: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> & {
5
+ name: string;
6
+ description?: string;
7
+ avatarSrc?: string;
8
+ avatarFallback?: React.ReactNode;
9
+ trailing?: React.ReactNode;
10
+ size?: Extract<import("../../props/index.js").SizeProp, "sm" | "md">;
11
+ } & React.RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../../lib/utils.js";
5
+ import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
6
+ const Persona = React.forwardRef(
7
+ ({ name, description, avatarSrc, avatarFallback, trailing, size = "md", className, ...props }, ref) => /* @__PURE__ */ jsxs(
8
+ "span",
9
+ {
10
+ ref,
11
+ "data-slot": "persona",
12
+ "data-size": size,
13
+ className: cn("ui-persona", className),
14
+ ...props,
15
+ children: [
16
+ /* @__PURE__ */ jsxs(Avatar, { size, "aria-hidden": "true", children: [
17
+ avatarSrc ? /* @__PURE__ */ jsx(AvatarImage, { src: avatarSrc, alt: "" }) : null,
18
+ /* @__PURE__ */ jsx(AvatarFallback, { children: avatarFallback ?? Array.from(name)[0] })
19
+ ] }),
20
+ /* @__PURE__ */ jsxs("span", { "data-slot": "persona-body", children: [
21
+ /* @__PURE__ */ jsxs("span", { "data-slot": "persona-name-line", children: [
22
+ /* @__PURE__ */ jsx("span", { "data-slot": "persona-name", dir: "auto", title: name, children: name }),
23
+ trailing != null ? /* @__PURE__ */ jsx("span", { "data-slot": "persona-trailing", children: trailing }) : null
24
+ ] }),
25
+ description != null ? /* @__PURE__ */ jsx("span", { "data-slot": "persona-description", dir: "auto", title: description, children: description }) : null
26
+ ] })
27
+ ]
28
+ }
29
+ )
30
+ );
31
+ Persona.displayName = "Persona";
32
+ export {
33
+ Persona
34
+ };
@@ -119,6 +119,7 @@ function Upload({
119
119
  const fieldName = React.useContext(FieldNameContext);
120
120
  const triggerId = React.useId();
121
121
  const selectionId = React.useId();
122
+ const dropzoneHintId = React.useId();
122
123
  const triggerRef = React.useRef(null);
123
124
  const ownAriaLabel = fieldA11y["aria-label"];
124
125
  const callerAriaLabel = !fieldLabelledBy || fieldName && ownAriaLabel !== fieldName.label ? ownAriaLabel : void 0;
@@ -476,6 +477,12 @@ function Upload({
476
477
  if (!disabled && openFileDialogOnClick) inputRef.current?.click();
477
478
  };
478
479
  if (variant === "dropzone") {
480
+ const hintText = t("dataEntry.upload.dropzoneHint");
481
+ const named = triggerA11y(hintText);
482
+ const dropzoneA11y = callerAriaLabel !== void 0 ? { ...named, "aria-label": callerAriaLabel } : {
483
+ ...named,
484
+ "aria-labelledby": named["aria-labelledby"] ? `${fieldLabelledBy} ${dropzoneHintId}` : dropzoneHintId
485
+ };
479
486
  return /* @__PURE__ */ jsxs("div", { ...pasteProps, className: cn("ui-stack-sm", className), children: [
480
487
  hiddenInput,
481
488
  liveRegion,
@@ -487,8 +494,7 @@ function Upload({
487
494
  role: openFileDialogOnClick ? "button" : "group",
488
495
  tabIndex: disabled ? -1 : 0,
489
496
  "aria-disabled": disabled,
490
- ...triggerA11y(t("dataEntry.upload.dropzoneLabel")),
491
- "aria-label": callerAriaLabel ?? t("dataEntry.upload.dropzoneLabel"),
497
+ ...dropzoneA11y,
492
498
  onClick: openPicker,
493
499
  onKeyDown: (e) => {
494
500
  if (e.key === "Enter" || e.key === " ") {
@@ -515,7 +521,7 @@ function Upload({
515
521
  className: "ui-upload-dropzone",
516
522
  children: [
517
523
  /* @__PURE__ */ jsx(UploadIcon, { className: "ui-upload-dropzone-icon", "aria-hidden": "true" }),
518
- /* @__PURE__ */ jsx("p", { className: "ui-upload-dropzone-hint", children: t("dataEntry.upload.dropzoneHint") }),
524
+ /* @__PURE__ */ jsx("p", { id: dropzoneHintId, className: "ui-upload-dropzone-hint", children: t("dataEntry.upload.dropzoneHint") }),
519
525
  /* @__PURE__ */ jsx("p", { className: "ui-upload-dropzone-meta", children: t("dataEntry.upload.dropzoneMeta") })
520
526
  ]
521
527
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$comment": "AUTO-GENERATED by scripts/gen-measurement-contract.mjs — do not edit. Read this instead of guessing: docs/MEASUREMENT-CONTRACT.md.",
3
- "version": "33.13.0",
3
+ "version": "33.15.0",
4
4
  "targetSize": {
5
5
  "standard": "WCAG 2.2 SC 2.5.8 Target Size (Minimum), level AA — 24×24 CSS px",
6
6
  "min": 24,
@@ -74,7 +74,6 @@
74
74
  "presetEmpty": "Empty"
75
75
  },
76
76
  "upload": {
77
- "dropzoneLabel": "Upload files",
78
77
  "dropzoneHint": "Drag and drop files here, or click to browse",
79
78
  "dropzoneMeta": "Selected files appear here.",
80
79
  "buttonLabel": "Choose file",
@@ -73,7 +73,6 @@
73
73
  "presetEmpty": "空"
74
74
  },
75
75
  "upload": {
76
- "dropzoneLabel": "ファイルをアップロード",
77
76
  "dropzoneHint": "ここにドラッグ&ドロップ、またはクリックして選択",
78
77
  "dropzoneMeta": "選択したファイルはここに表示されます。",
79
78
  "buttonLabel": "ファイルを選択",
@@ -73,7 +73,6 @@
73
73
  "presetEmpty": "Trống"
74
74
  },
75
75
  "upload": {
76
- "dropzoneLabel": "Tải file lên",
77
76
  "dropzoneHint": "Kéo thả file vào đây, hoặc bấm để chọn",
78
77
  "dropzoneMeta": "Tệp đã chọn sẽ hiển thị tại đây.",
79
78
  "buttonLabel": "Chọn file",
@@ -1424,3 +1424,13 @@ export type TextDiffProp = Omit<React.HTMLAttributes<HTMLDivElement>, "children"
1424
1424
  lang?: string;
1425
1425
  className?: ClassNameProp;
1426
1426
  };
1427
+ /** @see Persona — static identity; pass translated labels and badge content from the consumer. */
1428
+ export type PersonaProp = Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> & {
1429
+ name: string;
1430
+ description?: string;
1431
+ avatarSrc?: string;
1432
+ avatarFallback?: React.ReactNode;
1433
+ /** Optional inline badge beside the name, never part of the clipped name. */
1434
+ trailing?: React.ReactNode;
1435
+ size?: Extract<SizeProp, "sm" | "md">;
1436
+ };
@@ -2171,6 +2171,11 @@ export declare const COMPONENT_PROP_REGISTRY: {
2171
2171
  readonly file: "components/data-display.prop.ts";
2172
2172
  readonly vocabulary: readonly ["ColumnDefProp", "DensityProp", "SortStateProp", "SelectedIdsProp", "GetRowLabelProp", "HandlerProp", "TablePresetProp", "TableColumnPriorityProp", "BreakpointProp", "ColumnFixedProp", "ColumnFilterItemProp", "ColumnFilterStateProp", "ColumnSorterProp", "TableRowSelectionProp", "TableSelectionBuiltInProp", "TableSelectAllMatchingProp", "TableExpandableProp", "TableSummaryProp", "TableScrollProp", "TableStickyProp", "OnRowProp", "TablePaginationProp", "TablePaginationPositionProp", "SortDirectionProp", "OnColumnFilterChangeProp"];
2173
2173
  };
2174
+ readonly PersonaProp: {
2175
+ readonly group: "data-display";
2176
+ readonly file: "components/data-display.prop.ts";
2177
+ readonly vocabulary: readonly ["SizeProp", "ClassNameProp", "DescriptionProp"];
2178
+ };
2174
2179
  readonly ListRowDensityProp: {
2175
2180
  readonly group: "data-display";
2176
2181
  readonly file: "components/data-display.prop.ts";
@@ -2651,6 +2651,11 @@ const COMPONENT_PROP_REGISTRY = {
2651
2651
  "OnColumnFilterChangeProp"
2652
2652
  ]
2653
2653
  },
2654
+ PersonaProp: {
2655
+ group: "data-display",
2656
+ file: "components/data-display.prop.ts",
2657
+ vocabulary: ["SizeProp", "ClassNameProp", "DescriptionProp"]
2658
+ },
2654
2659
  ListRowDensityProp: {
2655
2660
  group: "data-display",
2656
2661
  file: "components/data-display.prop.ts",
@@ -1,4 +1,62 @@
1
1
  @layer components {
2
+ .ui-persona {
3
+ display: flex;
4
+ align-items: center;
5
+ flex-wrap: nowrap;
6
+ min-inline-size: 0;
7
+ max-inline-size: 100%;
8
+ gap: var(--persona-avatar-gap, var(--space-2));
9
+ }
10
+
11
+ .ui-persona [data-slot="persona-body"] {
12
+ display: flex;
13
+ flex-direction: column;
14
+ flex: 1;
15
+ min-inline-size: 0;
16
+ gap: var(--persona-label-gap, 0);
17
+ }
18
+
19
+ .ui-persona [data-slot="persona-name-line"] {
20
+ display: flex;
21
+ align-items: center;
22
+ min-inline-size: 0;
23
+ gap: var(--persona-trailing-gap, var(--space-1));
24
+ }
25
+
26
+ .ui-persona [data-slot="persona-name"],
27
+ .ui-persona [data-slot="persona-description"] {
28
+ display: block;
29
+ min-inline-size: 0;
30
+ overflow: hidden;
31
+ text-overflow: ellipsis;
32
+ white-space: nowrap;
33
+ text-align: start;
34
+ line-height: var(--persona-label-line-height);
35
+ }
36
+
37
+ .ui-persona [data-slot="persona-name"] {
38
+ font-size: var(--persona-name-font-size, var(--font-size-sm));
39
+ font-weight: var(--persona-name-font-weight, var(--font-weight-medium));
40
+ color: var(--persona-name-color, hsl(var(--foreground)));
41
+ }
42
+
43
+ .ui-persona[data-size="sm"] [data-slot="persona-name"] {
44
+ font-size: var(--persona-name-font-size-sm, var(--font-size-xs));
45
+ }
46
+
47
+ .ui-persona [data-slot="persona-description"] {
48
+ align-self: flex-start;
49
+ max-inline-size: 100%;
50
+ font-size: var(--persona-description-font-size, var(--font-size-xs));
51
+ color: var(--persona-description-color, hsl(var(--muted-foreground)));
52
+ }
53
+
54
+ .ui-persona [data-slot="persona-trailing"] {
55
+ flex: none;
56
+ display: inline-flex;
57
+ white-space: nowrap;
58
+ }
59
+
2
60
  .ui-avatar {
3
61
  position: relative;
4
62
  display: inline-flex;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "33.13.0",
2
+ "version": "33.15.0",
3
3
  "generatedBy": "scripts/gen-style-layers.mjs — do not edit by hand; run `pnpm gen:style-layers`",
4
4
  "base": "base.css",
5
5
  "fonts": "fonts.css",
@@ -768,6 +768,11 @@
768
768
  "form-layout.css"
769
769
  ]
770
770
  },
771
+ "Persona": {
772
+ "layers": [
773
+ "data-display-layout.css"
774
+ ]
775
+ },
771
776
  "PieChart": {
772
777
  "layers": [
773
778
  "layout.css",
@@ -646,6 +646,12 @@
646
646
  table-layout: fixed;
647
647
  }
648
648
 
649
+ .ui-data-table-surface[data-table-layout="fixed"]
650
+ [data-slot="table-cell"]:not(.ui-data-table-ellipsis) {
651
+ white-space: normal;
652
+ overflow-wrap: anywhere;
653
+ }
654
+
649
655
  .ui-data-table-scroll[data-scroll-y] {
650
656
  overflow-y: auto;
651
657
  max-block-size: var(--table-scroll-block-size, none);
@@ -1050,22 +1056,24 @@
1050
1056
  display: block;
1051
1057
 
1052
1058
  height: auto;
1053
- border: var(--stroke-hairline) solid hsl(var(--border));
1054
- border-radius: var(--radius-md, calc(var(--radius) / var(--radius-ratio)));
1059
+
1060
+ border: 0;
1061
+ border-block-end: var(--stroke-hairline) solid hsl(var(--border));
1062
+ border-radius: 0;
1055
1063
  padding: var(--table-stacked-collection-card-padding-y)
1056
- var(
1057
- --table-stacked-collection-card-padding-x,
1058
- calc(var(--card-space-inset) - var(--stroke-hairline))
1059
- );
1064
+ var(--table-stacked-collection-card-padding-x, var(--card-space-inset));
1060
1065
  margin-block-end: var(--table-stacked-collection-card-gap);
1061
1066
  }
1062
1067
 
1063
1068
  [data-collapse-below="sm"] .ui-table-row:last-child {
1064
1069
  margin-block-end: 0;
1070
+ border-block-end-width: 0;
1065
1071
  }
1066
1072
 
1067
1073
  [data-collapse-below="sm"] [data-slot="table-cell"] {
1068
1074
  display: block;
1075
+
1076
+ inline-size: auto !important;
1069
1077
  padding-block: var(--table-stacked-collection-cell-padding-y);
1070
1078
 
1071
1079
  padding-inline: var(--table-stacked-collection-cell-padding-x);
@@ -1107,22 +1115,24 @@
1107
1115
  display: block;
1108
1116
 
1109
1117
  height: auto;
1110
- border: var(--stroke-hairline) solid hsl(var(--border));
1111
- border-radius: var(--radius-md, calc(var(--radius) / var(--radius-ratio)));
1118
+
1119
+ border: 0;
1120
+ border-block-end: var(--stroke-hairline) solid hsl(var(--border));
1121
+ border-radius: 0;
1112
1122
  padding: var(--table-stacked-collection-card-padding-y)
1113
- var(
1114
- --table-stacked-collection-card-padding-x,
1115
- calc(var(--card-space-inset) - var(--stroke-hairline))
1116
- );
1123
+ var(--table-stacked-collection-card-padding-x, var(--card-space-inset));
1117
1124
  margin-block-end: var(--table-stacked-collection-card-gap);
1118
1125
  }
1119
1126
 
1120
1127
  [data-collapse-below="md"] .ui-table-row:last-child {
1121
1128
  margin-block-end: 0;
1129
+ border-block-end-width: 0;
1122
1130
  }
1123
1131
 
1124
1132
  [data-collapse-below="md"] [data-slot="table-cell"] {
1125
1133
  display: block;
1134
+
1135
+ inline-size: auto !important;
1126
1136
  padding-block: var(--table-stacked-collection-cell-padding-y);
1127
1137
  padding-inline: var(--table-stacked-collection-cell-padding-x);
1128
1138
  white-space: normal;
@@ -1162,22 +1172,24 @@
1162
1172
  display: block;
1163
1173
 
1164
1174
  height: auto;
1165
- border: var(--stroke-hairline) solid hsl(var(--border));
1166
- border-radius: var(--radius-md, calc(var(--radius) / var(--radius-ratio)));
1175
+
1176
+ border: 0;
1177
+ border-block-end: var(--stroke-hairline) solid hsl(var(--border));
1178
+ border-radius: 0;
1167
1179
  padding: var(--table-stacked-collection-card-padding-y)
1168
- var(
1169
- --table-stacked-collection-card-padding-x,
1170
- calc(var(--card-space-inset) - var(--stroke-hairline))
1171
- );
1180
+ var(--table-stacked-collection-card-padding-x, var(--card-space-inset));
1172
1181
  margin-block-end: var(--table-stacked-collection-card-gap);
1173
1182
  }
1174
1183
 
1175
1184
  [data-collapse-below="lg"] .ui-table-row:last-child {
1176
1185
  margin-block-end: 0;
1186
+ border-block-end-width: 0;
1177
1187
  }
1178
1188
 
1179
1189
  [data-collapse-below="lg"] [data-slot="table-cell"] {
1180
1190
  display: block;
1191
+
1192
+ inline-size: auto !important;
1181
1193
  padding-block: var(--table-stacked-collection-cell-padding-y);
1182
1194
  padding-inline: var(--table-stacked-collection-cell-padding-x);
1183
1195
  white-space: normal;
@@ -1217,22 +1229,24 @@
1217
1229
  display: block;
1218
1230
 
1219
1231
  height: auto;
1220
- border: var(--stroke-hairline) solid hsl(var(--border));
1221
- border-radius: var(--radius-md, calc(var(--radius) / var(--radius-ratio)));
1232
+
1233
+ border: 0;
1234
+ border-block-end: var(--stroke-hairline) solid hsl(var(--border));
1235
+ border-radius: 0;
1222
1236
  padding: var(--table-stacked-collection-card-padding-y)
1223
- var(
1224
- --table-stacked-collection-card-padding-x,
1225
- calc(var(--card-space-inset) - var(--stroke-hairline))
1226
- );
1237
+ var(--table-stacked-collection-card-padding-x, var(--card-space-inset));
1227
1238
  margin-block-end: var(--table-stacked-collection-card-gap);
1228
1239
  }
1229
1240
 
1230
1241
  [data-collapse-below="xl"] .ui-table-row:last-child {
1231
1242
  margin-block-end: 0;
1243
+ border-block-end-width: 0;
1232
1244
  }
1233
1245
 
1234
1246
  [data-collapse-below="xl"] [data-slot="table-cell"] {
1235
1247
  display: block;
1248
+
1249
+ inline-size: auto !important;
1236
1250
  padding-block: var(--table-stacked-collection-cell-padding-y);
1237
1251
  padding-inline: var(--table-stacked-collection-cell-padding-x);
1238
1252
  white-space: normal;