@godxjp/ui 33.1.0 → 33.2.1

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.
Files changed (37) hide show
  1. package/README.md +4 -4
  2. package/agent/START-HERE.md +6 -6
  3. package/agent/components/Command.json +9 -1
  4. package/agent/components/TranslatableInput.json +92 -0
  5. package/agent/components/TranslatableTextarea.json +84 -0
  6. package/agent/components-index.json +10 -0
  7. package/agent/components.json +185 -1
  8. package/agent/index.json +7 -7
  9. package/agent/llms.txt +7 -7
  10. package/agent/patterns/list-filters.json +1 -1
  11. package/agent/patterns.json +1 -1
  12. package/agent/tokens.json +12 -0
  13. package/dist/components/data-entry/command.d.ts +22 -1
  14. package/dist/components/data-entry/command.js +14 -1
  15. package/dist/components/data-entry/form-field.js +10 -4
  16. package/dist/components/data-entry/index.d.ts +4 -2
  17. package/dist/components/data-entry/index.js +6 -1
  18. package/dist/components/data-entry/translatable-input.d.ts +29 -0
  19. package/dist/components/data-entry/translatable-input.js +184 -0
  20. package/dist/contracts/measurement.json +1 -1
  21. package/dist/i18n/messages/en.json +4 -0
  22. package/dist/i18n/messages/ja.json +4 -0
  23. package/dist/i18n/messages/vi.json +4 -0
  24. package/dist/lib/field-a11y.d.ts +15 -0
  25. package/dist/lib/field-a11y.js +13 -1
  26. package/dist/lib/intl-cache.d.ts +1 -0
  27. package/dist/lib/intl-cache.js +4 -0
  28. package/dist/props/components/data-entry.prop.d.ts +46 -0
  29. package/dist/props/components/index.d.ts +1 -1
  30. package/dist/props/registry.d.ts +51 -0
  31. package/dist/props/registry.js +79 -0
  32. package/dist/styles/control.css +15 -0
  33. package/dist/styles/data-entry-layout.css +25 -0
  34. package/dist/styles/layers.json +19 -1
  35. package/dist/styles.css +1 -1
  36. package/dist/tokens/components/data-entry.css +4 -0
  37. package/package.json +2 -2
@@ -125,6 +125,14 @@ export type CommandProp = {
125
125
  */
126
126
  split?: boolean;
127
127
  };
128
+ export type CommandSeparatorProp = {
129
+ /**
130
+ * Keep the separator while a search query is typed. Default `true` — the opposite of cmdk, which
131
+ * hides it under a query; a `+ Create "<q>"` group only exists while the user types, so the rule
132
+ * above it must stay. `false` restores cmdk's palette behaviour.
133
+ */
134
+ alwaysRender?: boolean;
135
+ };
128
136
  export type InputProp = Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> & {
129
137
  onValueChange?: (value: string) => void;
130
138
  /**
@@ -221,6 +229,43 @@ export type TextareaProp = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
221
229
  /** Character counter — antd `count`. */
222
230
  count?: ControlCountProp;
223
231
  };
232
+ /**
233
+ * One translatable field's per-locale values, keyed by BCP-47 tag: `{ ja: "…", en: "…", vi: "…" }`.
234
+ * A locale with no key (or `""`) is empty. The shape a `*_translations` backend (Astrotomic,
235
+ * Spatie translatable, Rails Mobility) already sends.
236
+ */
237
+ export type TranslatableValue = Partial<Record<string, string>>;
238
+ /** The locale + value contract shared by {@link TranslatableInputProp} and {@link TranslatableTextareaProp}. */
239
+ type TranslatableFieldProp = {
240
+ /** Controlled per-locale values. */
241
+ value?: ValueProp<TranslatableValue>;
242
+ /** Uncontrolled initial per-locale values. */
243
+ defaultValue?: DefaultValueProp<TranslatableValue>;
244
+ /** The WHOLE map after an edit — every other locale's text is carried over untouched. */
245
+ onValueChange?: OnValueChangeProp<TranslatableValue>;
246
+ /**
247
+ * The locales the field edits, in tab order. Default: every locale registered with the app
248
+ * (`getRegisteredLocales()` — the built-in `vi`/`en`/`ja` plus `registerLocale(...)`).
249
+ */
250
+ locales?: readonly string[];
251
+ /** The locale tab selected first. Default: the AppProvider's active locale when it is in `locales`. */
252
+ defaultLocale?: string;
253
+ /**
254
+ * The locale whose text shows as the placeholder of an EMPTY locale. Default: the AppProvider's
255
+ * `fallbackLocale`, or the first of `locales` when that is not one of them.
256
+ */
257
+ fallbackLocale?: string;
258
+ /**
259
+ * Per-locale validation messages. A locale that has one gets an error mark on its tab (a glyph
260
+ * plus screen-reader text, never colour alone); the ACTIVE locale's message sets `aria-invalid`
261
+ * and is shown by the enclosing `FormField` (or under the field when there is none).
262
+ */
263
+ errors?: Partial<Record<string, ErrorProp>>;
264
+ };
265
+ /** @see TranslatableInput — one `Input` holding a value per locale, switched by locale tabs. */
266
+ export type TranslatableInputProp = Omit<InputProp, "value" | "defaultValue" | "onValueChange" | "lang"> & TranslatableFieldProp;
267
+ /** @see TranslatableTextarea — the `Textarea` counterpart of {@link TranslatableInputProp}. */
268
+ export type TranslatableTextareaProp = Omit<TextareaProp, "value" | "defaultValue" | "onValueChange" | "lang"> & TranslatableFieldProp;
224
269
  /**
225
270
  * @see NumberInput — localized numeric spinbutton (composes `Input` + step `Button`s).
226
271
  * `value`/`defaultValue`/`onValueChange` carry a `number | null` (null = empty). `step` drives both
@@ -2469,3 +2514,4 @@ export type EmojiPickerProp = {
2469
2514
  id?: IdProp;
2470
2515
  className?: ClassNameProp;
2471
2516
  };
2517
+ export {};
@@ -1,6 +1,6 @@
1
1
  export type { AppLauncherApp, AppLauncherGroup, AppLauncherLabels, AppLauncherProp, AppShellProp, AuthFooterProp, AuthIdentityProp, OrgSwitcherLabels, OrgSwitcherOrganization, OrgSwitcherProp, DragAxisProp, DragBoundsProp, DraggablePanelLabels, DraggablePanelPlacementProp, DraggablePanelPositionProp, DraggablePanelProp, PageContainerExtraProp, PageContainerProp, PageInsetProp, SidebarItemProp, SidebarProductProp, SidebarProp, SidebarSectionProp, TopbarProp, } from "./layout.prop.js";
2
2
  export type { ButtonProp } from "./general.prop.js";
3
- export type { CommandProp, InputProp, TextareaProp, FormFieldProp, SearchInputProp, CheckboxProp, CheckboxGroupProp, ChoiceOptionProp, RadioProp, RadioGroupProp, SwitchProp, SliderProp, CalendarProp, DatePickerProp, TimePickerProp, ColorPickerProp, ColorPickerPresetProp, UploadProp, UploadFileItemProp, UploadVariantProp, TreeOptionProp, TreeFieldNamesProp, CascaderProp, TreeSelectProp, ShowCheckedStrategyProp, TransferProp, TransferItemProp, } from "./data-entry.prop.js";
3
+ export type { CommandProp, CommandSeparatorProp, InputProp, TextareaProp, FormFieldProp, SearchInputProp, CheckboxProp, CheckboxGroupProp, ChoiceOptionProp, RadioProp, RadioGroupProp, SwitchProp, SliderProp, CalendarProp, DatePickerProp, TimePickerProp, ColorPickerProp, ColorPickerPresetProp, UploadProp, UploadFileItemProp, UploadVariantProp, TreeOptionProp, TreeFieldNamesProp, CascaderProp, TreeSelectProp, ShowCheckedStrategyProp, TransferProp, TransferItemProp, } from "./data-entry.prop.js";
4
4
  export type { AvatarProp, EmptyStateProp, DescriptionsProp, DescriptionsItemProp, BadgeProp, DataTableProp, QrCodeProp, } from "./data-display.prop.js";
5
5
  export type { ChartDatum, ChartSeriesProp, LineChartProp, BarChartProp, AreaChartProp, PieChartProp, } from "./charts.prop.js";
6
6
  export type { AlertQueryErrorProp, AuthExpiryProviderProp, AlertProp, DialogProp, DialogContentProp, AlertTitleProp, AlertContentProp, AlertDescriptionProp, AlertActionsProp, SheetResponsiveProp, SkeletonRowsProp, } from "./feedback.prop.js";
@@ -1641,11 +1641,62 @@ export declare const COMPONENT_PROP_REGISTRY: {
1641
1641
  readonly reason: "antd List `split` — ruled-list presentation (row dividers, 0 list padding) for option/checkbox lists; the rest of the root API is cmdk's (gh#699).";
1642
1642
  }];
1643
1643
  };
1644
+ readonly CommandSeparatorProp: {
1645
+ readonly group: "data-entry";
1646
+ readonly file: "components/data-entry.prop.ts";
1647
+ readonly vocabulary: readonly [{
1648
+ readonly field: "alwaysRender";
1649
+ readonly local: true;
1650
+ readonly reason: "cmdk's own Command.Separator prop name, kept so the cmdk docs still apply; only its default differs (true) so the rule stays above a `+ Create` group while the user types (gh#1335).";
1651
+ }];
1652
+ };
1644
1653
  readonly TextareaProp: {
1645
1654
  readonly group: "data-entry";
1646
1655
  readonly file: "components/data-entry.prop.ts";
1647
1656
  readonly vocabulary: readonly ["PlaceholderProp", "DisabledProp", "ValueProp", "DefaultValueProp", "OnChangeProp", "IdProp", "ClassNameProp"];
1648
1657
  };
1658
+ readonly TranslatableInputProp: {
1659
+ readonly group: "data-entry";
1660
+ readonly file: "components/data-entry.prop.ts";
1661
+ readonly vocabulary: readonly ["ValueProp", "DefaultValueProp", "OnValueChangeProp", "SizeProp", "PlaceholderProp", "DisabledProp", "IdProp", "ClassNameProp", {
1662
+ readonly field: "locales";
1663
+ readonly local: true;
1664
+ readonly reason: "The BCP-47 tags the field edits, in tab order (gh#1336). Defaults to the app's registered locales; a per-field list, not a value.";
1665
+ }, {
1666
+ readonly field: "defaultLocale";
1667
+ readonly local: true;
1668
+ readonly reason: "The locale tab selected first — the AppProvider's own `defaultLocale` spelling, scoped to one field. Defaults to the active app locale.";
1669
+ }, {
1670
+ readonly field: "fallbackLocale";
1671
+ readonly local: true;
1672
+ readonly reason: "The locale whose text an EMPTY locale shows as its placeholder — the AppProvider's own `fallbackLocale` spelling, scoped to one field.";
1673
+ }, {
1674
+ readonly field: "errors";
1675
+ readonly local: true;
1676
+ readonly reason: "Per-locale validation messages keyed by BCP-47 tag; marks each locale's tab and sends the ACTIVE one through FormField. `error` (one message) cannot say which locale failed.";
1677
+ }];
1678
+ };
1679
+ readonly TranslatableTextareaProp: {
1680
+ readonly group: "data-entry";
1681
+ readonly file: "components/data-entry.prop.ts";
1682
+ readonly vocabulary: readonly ["ValueProp", "DefaultValueProp", "OnValueChangeProp", "SizeProp", "PlaceholderProp", "DisabledProp", "IdProp", "ClassNameProp", {
1683
+ readonly field: "locales";
1684
+ readonly local: true;
1685
+ readonly reason: "The BCP-47 tags the field edits, in tab order (gh#1336). Defaults to the app's registered locales; a per-field list, not a value.";
1686
+ }, {
1687
+ readonly field: "defaultLocale";
1688
+ readonly local: true;
1689
+ readonly reason: "The locale tab selected first — the AppProvider's own `defaultLocale` spelling, scoped to one field. Defaults to the active app locale.";
1690
+ }, {
1691
+ readonly field: "fallbackLocale";
1692
+ readonly local: true;
1693
+ readonly reason: "The locale whose text an EMPTY locale shows as its placeholder — the AppProvider's own `fallbackLocale` spelling, scoped to one field.";
1694
+ }, {
1695
+ readonly field: "errors";
1696
+ readonly local: true;
1697
+ readonly reason: "Per-locale validation messages keyed by BCP-47 tag; marks each locale's tab and sends the ACTIVE one through FormField. `error` (one message) cannot say which locale failed.";
1698
+ }];
1699
+ };
1649
1700
  readonly NumberInputProp: {
1650
1701
  readonly group: "data-entry";
1651
1702
  readonly file: "components/data-entry.prop.ts";
@@ -1854,6 +1854,17 @@ const COMPONENT_PROP_REGISTRY = {
1854
1854
  }
1855
1855
  ]
1856
1856
  },
1857
+ CommandSeparatorProp: {
1858
+ group: "data-entry",
1859
+ file: "components/data-entry.prop.ts",
1860
+ vocabulary: [
1861
+ {
1862
+ field: "alwaysRender",
1863
+ local: true,
1864
+ reason: "cmdk's own Command.Separator prop name, kept so the cmdk docs still apply; only its default differs (true) so the rule stays above a `+ Create` group while the user types (gh#1335)."
1865
+ }
1866
+ ]
1867
+ },
1857
1868
  TextareaProp: {
1858
1869
  group: "data-entry",
1859
1870
  file: "components/data-entry.prop.ts",
@@ -1867,6 +1878,74 @@ const COMPONENT_PROP_REGISTRY = {
1867
1878
  "ClassNameProp"
1868
1879
  ]
1869
1880
  },
1881
+ TranslatableInputProp: {
1882
+ group: "data-entry",
1883
+ file: "components/data-entry.prop.ts",
1884
+ vocabulary: [
1885
+ "ValueProp",
1886
+ "DefaultValueProp",
1887
+ "OnValueChangeProp",
1888
+ "SizeProp",
1889
+ "PlaceholderProp",
1890
+ "DisabledProp",
1891
+ "IdProp",
1892
+ "ClassNameProp",
1893
+ {
1894
+ field: "locales",
1895
+ local: true,
1896
+ reason: "The BCP-47 tags the field edits, in tab order (gh#1336). Defaults to the app's registered locales; a per-field list, not a value."
1897
+ },
1898
+ {
1899
+ field: "defaultLocale",
1900
+ local: true,
1901
+ reason: "The locale tab selected first \u2014 the AppProvider's own `defaultLocale` spelling, scoped to one field. Defaults to the active app locale."
1902
+ },
1903
+ {
1904
+ field: "fallbackLocale",
1905
+ local: true,
1906
+ reason: "The locale whose text an EMPTY locale shows as its placeholder \u2014 the AppProvider's own `fallbackLocale` spelling, scoped to one field."
1907
+ },
1908
+ {
1909
+ field: "errors",
1910
+ local: true,
1911
+ reason: "Per-locale validation messages keyed by BCP-47 tag; marks each locale's tab and sends the ACTIVE one through FormField. `error` (one message) cannot say which locale failed."
1912
+ }
1913
+ ]
1914
+ },
1915
+ TranslatableTextareaProp: {
1916
+ group: "data-entry",
1917
+ file: "components/data-entry.prop.ts",
1918
+ vocabulary: [
1919
+ "ValueProp",
1920
+ "DefaultValueProp",
1921
+ "OnValueChangeProp",
1922
+ "SizeProp",
1923
+ "PlaceholderProp",
1924
+ "DisabledProp",
1925
+ "IdProp",
1926
+ "ClassNameProp",
1927
+ {
1928
+ field: "locales",
1929
+ local: true,
1930
+ reason: "The BCP-47 tags the field edits, in tab order (gh#1336). Defaults to the app's registered locales; a per-field list, not a value."
1931
+ },
1932
+ {
1933
+ field: "defaultLocale",
1934
+ local: true,
1935
+ reason: "The locale tab selected first \u2014 the AppProvider's own `defaultLocale` spelling, scoped to one field. Defaults to the active app locale."
1936
+ },
1937
+ {
1938
+ field: "fallbackLocale",
1939
+ local: true,
1940
+ reason: "The locale whose text an EMPTY locale shows as its placeholder \u2014 the AppProvider's own `fallbackLocale` spelling, scoped to one field."
1941
+ },
1942
+ {
1943
+ field: "errors",
1944
+ local: true,
1945
+ reason: "Per-locale validation messages keyed by BCP-47 tag; marks each locale's tab and sends the ACTIVE one through FormField. `error` (one message) cannot say which locale failed."
1946
+ }
1947
+ ]
1948
+ },
1870
1949
  NumberInputProp: {
1871
1950
  group: "data-entry",
1872
1951
  file: "components/data-entry.prop.ts",
@@ -966,6 +966,17 @@
966
966
  opacity: 0.5;
967
967
  }
968
968
 
969
+ .ui-command-separator {
970
+ height: var(--command-item-divider-width, var(--stroke-hairline));
971
+ margin-block: var(--command-group-padding);
972
+ background: hsl(var(--command-item-divider-color, var(--border)));
973
+ }
974
+
975
+ .ui-command-group[hidden] + .ui-command-separator,
976
+ .ui-command-separator:has(+ .ui-command-group[hidden]) {
977
+ display: none;
978
+ }
979
+
969
980
  .ui-command[data-split] .ui-command-group {
970
981
  padding: var(--command-list-split-padding);
971
982
  }
@@ -990,6 +1001,10 @@
990
1001
  hsl(var(--command-item-divider-color, var(--border)));
991
1002
  }
992
1003
 
1004
+ .ui-command[data-split] .ui-command-separator {
1005
+ display: none;
1006
+ }
1007
+
993
1008
  [data-slot="dialog-content"].ui-command-palette {
994
1009
  top: var(--command-palette-inset-top);
995
1010
  width: min(
@@ -868,3 +868,28 @@
868
868
  border-radius: var(--radius-md);
869
869
  }
870
870
  }
871
+
872
+ @layer components {
873
+
874
+ .ui-translatable-field {
875
+ display: flex;
876
+ flex-direction: column;
877
+ align-items: stretch;
878
+ gap: var(--translatable-field-gap);
879
+ min-inline-size: 0;
880
+ }
881
+ .ui-translatable-field-tabs {
882
+ align-self: flex-start;
883
+ max-inline-size: 100%;
884
+ }
885
+ .ui-translatable-field-panel {
886
+ min-inline-size: 0;
887
+ }
888
+
889
+ .ui-translatable-field-error-mark {
890
+ inline-size: var(--translatable-field-error-icon-size);
891
+ block-size: var(--translatable-field-error-icon-size);
892
+ flex: none;
893
+ color: hsl(var(--text-error));
894
+ }
895
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "33.1.0",
2
+ "version": "33.2.1",
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",
@@ -1097,6 +1097,24 @@
1097
1097
  "navigation-layout.css"
1098
1098
  ]
1099
1099
  },
1100
+ "TranslatableInput": {
1101
+ "layers": [
1102
+ "control.css",
1103
+ "toggle.css",
1104
+ "dialog-layout.css",
1105
+ "data-entry-layout.css",
1106
+ "navigation-layout.css"
1107
+ ]
1108
+ },
1109
+ "TranslatableTextarea": {
1110
+ "layers": [
1111
+ "control.css",
1112
+ "toggle.css",
1113
+ "dialog-layout.css",
1114
+ "data-entry-layout.css",
1115
+ "navigation-layout.css"
1116
+ ]
1117
+ },
1100
1118
  "Tree": {
1101
1119
  "layers": [
1102
1120
  "layout.css",