@contentful/experience-design-system-cli 2.37.1-dev-build-f56fd7cd.0 → 2.37.1-dev-build-05c9c394.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/dist/app.js CHANGED
@@ -18167,7 +18167,7 @@ function FieldForm({
18167
18167
  var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
18168
18168
  function credentialsPurpose(tokensOnly) {
18169
18169
  const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
18170
- return `${use}. If you skip, files are saved locally and nothing is pushed.`;
18170
+ return `${use}.`;
18171
18171
  }
18172
18172
  function normalize(values) {
18173
18173
  return {
@@ -18230,82 +18230,13 @@ var MENU = [
18230
18230
  { choice: "continue", label: "Continue", description: "Check the credentials and go on" },
18231
18231
  { choice: "edit", label: "Edit", description: "Change the credentials" }
18232
18232
  ];
18233
- function CredentialsReview({
18234
- values,
18235
- subtitle,
18236
- notice,
18237
- validating,
18238
- onChoose,
18239
- children
18240
- }) {
18241
- const [focus, setFocus] = useState9(0);
18242
- useInput11((_input, key) => {
18243
- if (validating) return;
18244
- if (key.escape) onChoose("quit");
18245
- else if (key.return) onChoose(MENU[focus].choice);
18246
- else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
18247
- else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
18248
- });
18249
- const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
18250
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
18251
- /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
18252
- /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
18253
- /* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
18254
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18255
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
18256
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18257
- /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "ACTIONS" }),
18258
- MENU.map((item, index) => {
18259
- const focused = index === focus;
18260
- return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
18261
- /* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
18262
- /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.text, children: item.label }) }),
18263
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
18264
- ] }, item.choice);
18265
- }),
18266
- /* @__PURE__ */ jsxs14(
18267
- Box14,
18268
- {
18269
- flexDirection: "column",
18270
- marginTop: 1,
18271
- borderStyle: "single",
18272
- borderColor: PALETTE.border,
18273
- borderBottom: false,
18274
- borderLeft: false,
18275
- borderRight: false,
18276
- children: [
18277
- /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.muted, children: "SPACE" }),
18278
- FIELDS2.map((field) => {
18279
- const value = values[field.key];
18280
- return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { color: value ? PALETTE.text : PALETTE.muted, children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
18281
- })
18282
- ]
18283
- }
18284
- ),
18285
- notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18286
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18287
- /* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
18288
- "\u2717 ",
18289
- notice.text
18290
- ] })
18291
- ] }),
18292
- validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18293
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18294
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
18295
- ] }),
18296
- children,
18297
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18298
- /* @__PURE__ */ jsx15(
18299
- ControlHints,
18300
- {
18301
- hints: [
18302
- { keys: "\u2191/\u2193", label: "move" },
18303
- { keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
18304
- { keys: "Esc", label: "back" }
18305
- ]
18306
- }
18307
- )
18308
- ] })
18233
+ function SectionLabel({ label, active = false }) {
18234
+ const columns = useTerminalWidth();
18235
+ const rule = "\u2500".repeat(Math.max(2, columns - label.length - 8));
18236
+ return /* @__PURE__ */ jsxs14(Text14, { color: PALETTE.border, dimColor: !active, children: [
18237
+ "\u2500\u2500 ",
18238
+ /* @__PURE__ */ jsx15(Text14, { color: active ? PALETTE.accent : PALETTE.muted, children: label }),
18239
+ ` ${rule}`
18309
18240
  ] });
18310
18241
  }
18311
18242
  function CredentialsScreen({
@@ -18328,6 +18259,9 @@ function CredentialsScreen({
18328
18259
  const [validating, setValidating] = useState9(false);
18329
18260
  const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
18330
18261
  const [editing, setEditing] = useState9(!prefilled);
18262
+ const [focus, setFocus] = useState9(0);
18263
+ const [active, setActive] = useState9(0);
18264
+ const [beforeEdit, setBeforeEdit] = useState9(initialValues);
18331
18265
  const submit = async () => {
18332
18266
  const credentials = normalize(values);
18333
18267
  if (missingField(credentials)) {
@@ -18340,56 +18274,116 @@ function CredentialsScreen({
18340
18274
  if (result.ok) onDone({ skipped: false, credentials });
18341
18275
  else setNotice({ kind: "error", text: result.error });
18342
18276
  };
18343
- const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
18344
18277
  const choose = (choice) => {
18345
18278
  if (choice === "continue") void submit();
18346
18279
  else if (choice === "edit") {
18347
18280
  setNotice(null);
18281
+ setBeforeEdit(values);
18282
+ setActive(0);
18348
18283
  setEditing(true);
18349
18284
  } else onBack();
18350
18285
  };
18351
- if (!editing) {
18352
- return /* @__PURE__ */ jsx15(CredentialsReview, { values, subtitle, notice, validating, onChoose: choose, children: !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18286
+ const stopEditing = () => {
18287
+ setEditing(false);
18288
+ setFocus(0);
18289
+ };
18290
+ useInput11((_input, key) => {
18291
+ if (validating) return;
18292
+ if (editing) {
18293
+ if (key.escape) {
18294
+ if (!prefilled) onBack();
18295
+ else {
18296
+ setValues(beforeEdit);
18297
+ setNotice(null);
18298
+ stopEditing();
18299
+ }
18300
+ } else if (key.upArrow) setActive((current) => (current - 1 + FIELDS2.length) % FIELDS2.length);
18301
+ else if (key.downArrow || key.tab) setActive((current) => (current + 1) % FIELDS2.length);
18302
+ return;
18303
+ }
18304
+ if (key.escape) choose("quit");
18305
+ else if (key.return) choose(MENU[focus].choice);
18306
+ else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
18307
+ else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
18308
+ });
18309
+ const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
18310
+ const changed = !isUnchanged(normalize(values), initialValues);
18311
+ return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
18312
+ /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
18313
+ /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
18314
+ /* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
18353
18315
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
18354
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
18355
- ] }) });
18356
- }
18357
- return /* @__PURE__ */ jsxs14(
18358
- FieldForm,
18359
- {
18360
- header: /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
18361
- title: "Contentful Credentials",
18362
- subtitle,
18363
- fields: FIELDS2,
18364
- values,
18365
- onChange: (key, value) => {
18366
- setValues((current) => ({ ...current, [key]: value }));
18367
- setNotice(null);
18368
- },
18369
- enterAdvances: true,
18370
- onSave: () => void submit(),
18371
- saveLabel: "continue",
18372
- onQuit: prefilled ? () => setEditing(false) : onBack,
18373
- quitLabel: prefilled ? "stop editing" : "back",
18374
- notice,
18375
- busy: validating,
18376
- children: [
18377
- !prefilled && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18378
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18379
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
18380
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
18381
- ] }),
18382
- validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18383
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18384
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
18385
- ] }),
18386
- !validating && !notice && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18387
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
18388
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
18316
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
18317
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
18318
+ /* @__PURE__ */ jsx15(SectionLabel, { label: "Actions", active: !editing }),
18319
+ MENU.map((item, index) => {
18320
+ const focused = !editing && index === focus;
18321
+ return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
18322
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
18323
+ /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : editing ? PALETTE.muted : PALETTE.text, children: item.label }) }),
18324
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
18325
+ ] }, item.choice);
18326
+ }),
18327
+ /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", marginTop: 1, children: [
18328
+ /* @__PURE__ */ jsx15(SectionLabel, { label: "Space", active: editing }),
18329
+ FIELDS2.map((field, index) => {
18330
+ const open = editing && index === active;
18331
+ const value = values[field.key];
18332
+ const display = field.masked ? "\u2022".repeat(value.length) : value;
18333
+ return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
18334
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
18335
+ /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
18336
+ open ? /* @__PURE__ */ jsx15(
18337
+ ClearableTextInput,
18338
+ {
18339
+ value,
18340
+ onChange: (next) => {
18341
+ setValues((current) => ({ ...current, [field.key]: next }));
18342
+ setNotice(null);
18343
+ },
18344
+ onSubmit: stopEditing,
18345
+ mask: field.masked ? "\u2022" : void 0
18346
+ }
18347
+ ) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
18348
+ ] }, field.key);
18349
+ })
18350
+ ] }),
18351
+ notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18352
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
18353
+ /* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
18354
+ "\u2717 ",
18355
+ notice.text
18389
18356
  ] })
18390
- ]
18391
- }
18392
- );
18357
+ ] }),
18358
+ validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18359
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
18360
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
18361
+ ] }),
18362
+ !prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18363
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
18364
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
18365
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
18366
+ ] }),
18367
+ changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18368
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
18369
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
18370
+ ] }),
18371
+ editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
18372
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
18373
+ /* @__PURE__ */ jsx15(
18374
+ ControlHints,
18375
+ {
18376
+ hints: [
18377
+ { keys: "\u2191/\u2193", label: "field" },
18378
+ { keys: "\u23CE", label: "save" },
18379
+ { keys: "Ctrl+D", label: "clear" },
18380
+ { keys: "Esc", label: prefilled ? "cancel" : "back" }
18381
+ ]
18382
+ }
18383
+ )
18384
+ ] })
18385
+ ] })
18386
+ ] });
18393
18387
  }
18394
18388
 
18395
18389
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts
package/dist/index.js CHANGED
@@ -20610,7 +20610,7 @@ var init_FieldForm = __esm({
20610
20610
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
20611
20611
  function credentialsPurpose(tokensOnly) {
20612
20612
  const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
20613
- return `${use}. If you skip, files are saved locally and nothing is pushed.`;
20613
+ return `${use}.`;
20614
20614
  }
20615
20615
  function normalize(values) {
20616
20616
  return {
@@ -20686,82 +20686,13 @@ var init_validate4 = __esm({
20686
20686
  import { useRef as useRef2, useState as useState9 } from "react";
20687
20687
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
20688
20688
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
20689
- function CredentialsReview({
20690
- values,
20691
- subtitle,
20692
- notice,
20693
- validating,
20694
- onChoose,
20695
- children
20696
- }) {
20697
- const [focus, setFocus] = useState9(0);
20698
- useInput11((_input, key) => {
20699
- if (validating) return;
20700
- if (key.escape) onChoose("quit");
20701
- else if (key.return) onChoose(MENU[focus].choice);
20702
- else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
20703
- else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
20704
- });
20705
- const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
20706
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
20707
- /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
20708
- /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
20709
- /* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
20710
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20711
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
20712
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20713
- /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "ACTIONS" }),
20714
- MENU.map((item, index) => {
20715
- const focused = index === focus;
20716
- return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
20717
- /* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
20718
- /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.text, children: item.label }) }),
20719
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
20720
- ] }, item.choice);
20721
- }),
20722
- /* @__PURE__ */ jsxs14(
20723
- Box14,
20724
- {
20725
- flexDirection: "column",
20726
- marginTop: 1,
20727
- borderStyle: "single",
20728
- borderColor: PALETTE.border,
20729
- borderBottom: false,
20730
- borderLeft: false,
20731
- borderRight: false,
20732
- children: [
20733
- /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.muted, children: "SPACE" }),
20734
- FIELDS2.map((field) => {
20735
- const value = values[field.key];
20736
- return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { color: value ? PALETTE.text : PALETTE.muted, children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
20737
- })
20738
- ]
20739
- }
20740
- ),
20741
- notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20742
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20743
- /* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
20744
- "\u2717 ",
20745
- notice.text
20746
- ] })
20747
- ] }),
20748
- validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20749
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20750
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
20751
- ] }),
20752
- children,
20753
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20754
- /* @__PURE__ */ jsx15(
20755
- ControlHints,
20756
- {
20757
- hints: [
20758
- { keys: "\u2191/\u2193", label: "move" },
20759
- { keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
20760
- { keys: "Esc", label: "back" }
20761
- ]
20762
- }
20763
- )
20764
- ] })
20689
+ function SectionLabel({ label, active = false }) {
20690
+ const columns = useTerminalWidth();
20691
+ const rule = "\u2500".repeat(Math.max(2, columns - label.length - 8));
20692
+ return /* @__PURE__ */ jsxs14(Text14, { color: PALETTE.border, dimColor: !active, children: [
20693
+ "\u2500\u2500 ",
20694
+ /* @__PURE__ */ jsx15(Text14, { color: active ? PALETTE.accent : PALETTE.muted, children: label }),
20695
+ ` ${rule}`
20765
20696
  ] });
20766
20697
  }
20767
20698
  function CredentialsScreen({
@@ -20784,6 +20715,9 @@ function CredentialsScreen({
20784
20715
  const [validating, setValidating] = useState9(false);
20785
20716
  const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
20786
20717
  const [editing, setEditing] = useState9(!prefilled);
20718
+ const [focus, setFocus] = useState9(0);
20719
+ const [active, setActive] = useState9(0);
20720
+ const [beforeEdit, setBeforeEdit] = useState9(initialValues);
20787
20721
  const submit = async () => {
20788
20722
  const credentials = normalize(values);
20789
20723
  if (missingField(credentials)) {
@@ -20796,56 +20730,116 @@ function CredentialsScreen({
20796
20730
  if (result.ok) onDone({ skipped: false, credentials });
20797
20731
  else setNotice({ kind: "error", text: result.error });
20798
20732
  };
20799
- const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
20800
20733
  const choose = (choice) => {
20801
20734
  if (choice === "continue") void submit();
20802
20735
  else if (choice === "edit") {
20803
20736
  setNotice(null);
20737
+ setBeforeEdit(values);
20738
+ setActive(0);
20804
20739
  setEditing(true);
20805
20740
  } else onBack();
20806
20741
  };
20807
- if (!editing) {
20808
- return /* @__PURE__ */ jsx15(CredentialsReview, { values, subtitle, notice, validating, onChoose: choose, children: !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20742
+ const stopEditing = () => {
20743
+ setEditing(false);
20744
+ setFocus(0);
20745
+ };
20746
+ useInput11((_input, key) => {
20747
+ if (validating) return;
20748
+ if (editing) {
20749
+ if (key.escape) {
20750
+ if (!prefilled) onBack();
20751
+ else {
20752
+ setValues(beforeEdit);
20753
+ setNotice(null);
20754
+ stopEditing();
20755
+ }
20756
+ } else if (key.upArrow) setActive((current) => (current - 1 + FIELDS2.length) % FIELDS2.length);
20757
+ else if (key.downArrow || key.tab) setActive((current) => (current + 1) % FIELDS2.length);
20758
+ return;
20759
+ }
20760
+ if (key.escape) choose("quit");
20761
+ else if (key.return) choose(MENU[focus].choice);
20762
+ else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
20763
+ else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
20764
+ });
20765
+ const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
20766
+ const changed = !isUnchanged(normalize(values), initialValues);
20767
+ return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
20768
+ /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
20769
+ /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
20770
+ /* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
20809
20771
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
20810
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
20811
- ] }) });
20812
- }
20813
- return /* @__PURE__ */ jsxs14(
20814
- FieldForm,
20815
- {
20816
- header: /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
20817
- title: "Contentful Credentials",
20818
- subtitle,
20819
- fields: FIELDS2,
20820
- values,
20821
- onChange: (key, value) => {
20822
- setValues((current) => ({ ...current, [key]: value }));
20823
- setNotice(null);
20824
- },
20825
- enterAdvances: true,
20826
- onSave: () => void submit(),
20827
- saveLabel: "continue",
20828
- onQuit: prefilled ? () => setEditing(false) : onBack,
20829
- quitLabel: prefilled ? "stop editing" : "back",
20830
- notice,
20831
- busy: validating,
20832
- children: [
20833
- !prefilled && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20834
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20835
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
20836
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
20837
- ] }),
20838
- validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20839
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20840
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
20841
- ] }),
20842
- !validating && !notice && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20843
- /* @__PURE__ */ jsx15(Text14, { children: " " }),
20844
- /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
20772
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
20773
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
20774
+ /* @__PURE__ */ jsx15(SectionLabel, { label: "Actions", active: !editing }),
20775
+ MENU.map((item, index) => {
20776
+ const focused = !editing && index === focus;
20777
+ return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
20778
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
20779
+ /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : editing ? PALETTE.muted : PALETTE.text, children: item.label }) }),
20780
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
20781
+ ] }, item.choice);
20782
+ }),
20783
+ /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", marginTop: 1, children: [
20784
+ /* @__PURE__ */ jsx15(SectionLabel, { label: "Space", active: editing }),
20785
+ FIELDS2.map((field, index) => {
20786
+ const open = editing && index === active;
20787
+ const value = values[field.key];
20788
+ const display = field.masked ? "\u2022".repeat(value.length) : value;
20789
+ return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
20790
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
20791
+ /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
20792
+ open ? /* @__PURE__ */ jsx15(
20793
+ ClearableTextInput,
20794
+ {
20795
+ value,
20796
+ onChange: (next) => {
20797
+ setValues((current) => ({ ...current, [field.key]: next }));
20798
+ setNotice(null);
20799
+ },
20800
+ onSubmit: stopEditing,
20801
+ mask: field.masked ? "\u2022" : void 0
20802
+ }
20803
+ ) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
20804
+ ] }, field.key);
20805
+ })
20806
+ ] }),
20807
+ notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20808
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
20809
+ /* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
20810
+ "\u2717 ",
20811
+ notice.text
20845
20812
  ] })
20846
- ]
20847
- }
20848
- );
20813
+ ] }),
20814
+ validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20815
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
20816
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
20817
+ ] }),
20818
+ !prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20819
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
20820
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
20821
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
20822
+ ] }),
20823
+ changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20824
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
20825
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
20826
+ ] }),
20827
+ editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
20828
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
20829
+ /* @__PURE__ */ jsx15(
20830
+ ControlHints,
20831
+ {
20832
+ hints: [
20833
+ { keys: "\u2191/\u2193", label: "field" },
20834
+ { keys: "\u23CE", label: "save" },
20835
+ { keys: "Ctrl+D", label: "clear" },
20836
+ { keys: "Esc", label: prefilled ? "cancel" : "back" }
20837
+ ]
20838
+ }
20839
+ )
20840
+ ] })
20841
+ ] })
20842
+ ] });
20849
20843
  }
20850
20844
  var FIELDS2, MENU;
20851
20845
  var init_screen5 = __esm({
@@ -20853,8 +20847,10 @@ var init_screen5 = __esm({
20853
20847
  "use strict";
20854
20848
  init_theme();
20855
20849
  init_FieldForm();
20850
+ init_ClearableTextInput();
20856
20851
  init_ControlHints();
20857
20852
  init_StepHeader();
20853
+ init_use_terminal_width();
20858
20854
  init_logic8();
20859
20855
  init_validate4();
20860
20856
  FIELDS2 = [
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-f56fd7cd.0",
3
+ "version": "2.37.1-dev-build-05c9c394.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-f56fd7cd.0",
3
+ "version": "2.37.1-dev-build-05c9c394.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,8 +45,8 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-types": "2.37.1-dev-build-f56fd7cd.0",
49
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-f56fd7cd.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-05c9c394.0",
49
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-05c9c394.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",