@azx-pbc/axiom-form-builder 0.0.0-stage → 0.0.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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +231 -2
  3. package/dist/bridge/index.d.ts +12 -0
  4. package/dist/bridge/index.d.ts.map +1 -0
  5. package/dist/bridge/index.js +10 -0
  6. package/dist/bridge/index.js.map +1 -0
  7. package/dist/bridge/inspector-commands.d.ts +55 -0
  8. package/dist/bridge/inspector-commands.d.ts.map +1 -0
  9. package/dist/bridge/inspector-commands.js +532 -0
  10. package/dist/bridge/inspector-commands.js.map +1 -0
  11. package/dist/bridge/rule-context.d.ts +57 -0
  12. package/dist/bridge/rule-context.d.ts.map +1 -0
  13. package/dist/bridge/rule-context.js +302 -0
  14. package/dist/bridge/rule-context.js.map +1 -0
  15. package/dist/index.d.ts +32 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +28 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/inspector.d.ts +125 -0
  20. package/dist/inspector.d.ts.map +1 -0
  21. package/dist/inspector.js +2 -0
  22. package/dist/inspector.js.map +1 -0
  23. package/dist/reference/ReferencePicker.d.ts +59 -0
  24. package/dist/reference/ReferencePicker.d.ts.map +1 -0
  25. package/dist/reference/ReferencePicker.js +145 -0
  26. package/dist/reference/ReferencePicker.js.map +1 -0
  27. package/dist/reference/index.d.ts +13 -0
  28. package/dist/reference/index.d.ts.map +1 -0
  29. package/dist/reference/index.js +11 -0
  30. package/dist/reference/index.js.map +1 -0
  31. package/dist/reference/token.d.ts +44 -0
  32. package/dist/reference/token.d.ts.map +1 -0
  33. package/dist/reference/token.js +141 -0
  34. package/dist/reference/token.js.map +1 -0
  35. package/dist/reference/types.d.ts +49 -0
  36. package/dist/reference/types.d.ts.map +1 -0
  37. package/dist/reference/types.js +2 -0
  38. package/dist/reference/types.js.map +1 -0
  39. package/dist/rules/ConditionEditor.d.ts +38 -0
  40. package/dist/rules/ConditionEditor.d.ts.map +1 -0
  41. package/dist/rules/ConditionEditor.js +79 -0
  42. package/dist/rules/ConditionEditor.js.map +1 -0
  43. package/dist/rules/RuleBuilder.d.ts +76 -0
  44. package/dist/rules/RuleBuilder.d.ts.map +1 -0
  45. package/dist/rules/RuleBuilder.js +336 -0
  46. package/dist/rules/RuleBuilder.js.map +1 -0
  47. package/dist/rules/RuleList.d.ts +45 -0
  48. package/dist/rules/RuleList.d.ts.map +1 -0
  49. package/dist/rules/RuleList.js +62 -0
  50. package/dist/rules/RuleList.js.map +1 -0
  51. package/dist/rules/RuleMessageEditor.d.ts +38 -0
  52. package/dist/rules/RuleMessageEditor.d.ts.map +1 -0
  53. package/dist/rules/RuleMessageEditor.js +38 -0
  54. package/dist/rules/RuleMessageEditor.js.map +1 -0
  55. package/dist/rules/ValidationEditor.d.ts +60 -0
  56. package/dist/rules/ValidationEditor.d.ts.map +1 -0
  57. package/dist/rules/ValidationEditor.js +299 -0
  58. package/dist/rules/ValidationEditor.js.map +1 -0
  59. package/dist/rules/condition.d.ts +12 -0
  60. package/dist/rules/condition.d.ts.map +1 -0
  61. package/dist/rules/condition.js +46 -0
  62. package/dist/rules/condition.js.map +1 -0
  63. package/dist/rules/expression.d.ts +57 -0
  64. package/dist/rules/expression.d.ts.map +1 -0
  65. package/dist/rules/expression.js +286 -0
  66. package/dist/rules/expression.js.map +1 -0
  67. package/dist/rules/index.d.ts +28 -0
  68. package/dist/rules/index.d.ts.map +1 -0
  69. package/dist/rules/index.js +19 -0
  70. package/dist/rules/index.js.map +1 -0
  71. package/dist/rules/messages.d.ts +64 -0
  72. package/dist/rules/messages.d.ts.map +1 -0
  73. package/dist/rules/messages.js +114 -0
  74. package/dist/rules/messages.js.map +1 -0
  75. package/dist/rules/operators.d.ts +25 -0
  76. package/dist/rules/operators.d.ts.map +1 -0
  77. package/dist/rules/operators.js +128 -0
  78. package/dist/rules/operators.js.map +1 -0
  79. package/dist/rules/sentence.d.ts +151 -0
  80. package/dist/rules/sentence.d.ts.map +1 -0
  81. package/dist/rules/sentence.js +527 -0
  82. package/dist/rules/sentence.js.map +1 -0
  83. package/dist/rules/templates.d.ts +163 -0
  84. package/dist/rules/templates.d.ts.map +1 -0
  85. package/dist/rules/templates.js +560 -0
  86. package/dist/rules/templates.js.map +1 -0
  87. package/dist/rules/types.d.ts +209 -0
  88. package/dist/rules/types.d.ts.map +1 -0
  89. package/dist/rules/types.js +2 -0
  90. package/dist/rules/types.js.map +1 -0
  91. package/dist/rules/validation-editor-api.d.ts +12 -0
  92. package/dist/rules/validation-editor-api.d.ts.map +1 -0
  93. package/dist/rules/validation-editor-api.js +12 -0
  94. package/dist/rules/validation-editor-api.js.map +1 -0
  95. package/dist/rules/validation.d.ts +27 -0
  96. package/dist/rules/validation.d.ts.map +1 -0
  97. package/dist/rules/validation.js +184 -0
  98. package/dist/rules/validation.js.map +1 -0
  99. package/dist/styles.css +900 -0
  100. package/package.json +65 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleBuilder.js","sourceRoot":"","sources":["../../src/rules/RuleBuilder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AASxB,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K,IACH,CACT,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAQrB;IACC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC;IAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,YAAG,SAAS,EAAC,UAAU,YAAE,KAAK,CAAC,SAAS,GAAK,CAAC;IAC/E,OAAO,CACL,iBAAO,SAAS,EAAC,WAAW,EAAC,OAAO,EAAE,KAAK,CAAC,EAAE,aAC5C,eAAM,SAAS,EAAC,kBAAkB,YAAE,KAAK,CAAC,KAAK,GAAQ,EACvD,iBACE,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,YAE7D,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,iBAA6B,KAAK,EAAE,MAAM,CAAC,OAAO,YAC/C,MAAM,CAAC,KAAK,IADF,MAAM,CAAC,OAAO,CAElB,CACV,CAAC,GACK,IACH,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { useId, useRef } from 'react';\nimport type { ReactElement } from 'react';\nimport { ReferencePicker } from '../reference/ReferencePicker.js';\nimport type { ReferencePickerLabels } from '../reference/ReferencePicker.js';\nimport { insertReferenceAtCaret } from '../reference/token.js';\nimport { ConditionEditor } from './ConditionEditor.js';\nimport type { ConditionEditorLabels } from './ConditionEditor.js';\nimport { defaultConditionDraft } from './condition.js';\nimport { rowContext } from './expression.js';\nimport {\n DEFAULT_RULE_SENTENCE_LABELS,\n deriveRuleSentence,\n renderRuleSentence,\n} from './sentence.js';\nimport type { RuleSentenceLabels } from './sentence.js';\nimport {\n defaultKeyFieldIds,\n defaultRuleTemplateDraft,\n ruleBuilderBuild,\n ruleTemplateNeedsMessage,\n templatesForContext,\n} from './templates.js';\nimport type {\n EmittedRule,\n RuleBuild,\n RuleProblem,\n RuleTemplateDefinition,\n RuleTemplateDraft,\n} from './templates.js';\nimport type { RuleContext, RuleField } from './types.js';\nimport { ValidationEditor } from './ValidationEditor.js';\nimport type { ValidationEditorLabels } from './ValidationEditor.js';\n\n/** The overridable chrome the rule builder uses. */\nexport interface RuleBuilderLabels {\n readonly template: string;\n readonly ruleId: string;\n readonly messageKey: string;\n readonly field: string;\n /** The numeric question a total is written into; distinct from a condition's question. */\n readonly totalField: string;\n readonly target: string;\n readonly targetField: string;\n readonly targetSection: string;\n readonly show: string;\n readonly hide: string;\n readonly table: string;\n readonly column: string;\n readonly condition: string;\n readonly formula: string;\n readonly addReference: string;\n readonly hard: string;\n readonly preview: string;\n readonly sentence: string;\n readonly expression: string;\n readonly advanced: string;\n readonly commit: string;\n readonly ready: string;\n readonly notReady: string;\n readonly noTables: string;\n readonly keyField: string;\n readonly outputColumn: string;\n readonly chooseTable: string;\n readonly noField: string;\n readonly noColumn: string;\n readonly templateLabel: (template: RuleTemplateDefinition) => string;\n readonly problem: (problem: RuleProblem) => string;\n}\n\nconst DEFAULT_LABELS: RuleBuilderLabels = {\n template: 'What it does',\n ruleId: 'Check name (optional)',\n messageKey: 'Message name',\n field: 'Question',\n totalField: 'Question to total',\n target: 'Applies to',\n targetField: 'One question',\n targetSection: 'A section',\n show: 'Show',\n hide: 'Hide',\n table: 'Table',\n column: 'Column',\n condition: 'Condition',\n formula: 'Formula',\n addReference: 'Insert a question',\n hard: 'A hard blocker cannot be overridden',\n preview: 'What this check will say',\n sentence: 'This check says',\n expression: 'Condition',\n advanced: 'Advanced',\n commit: 'Add check',\n ready: 'Ready to add.',\n notReady: 'Not ready yet.',\n noTables: 'Add a table question to use this template.',\n keyField: 'Column that identifies a row',\n outputColumn: 'Output column (optional)',\n chooseTable: 'Choose a table',\n noField: 'There is no question to choose.',\n noColumn: 'This table has no columns.',\n templateLabel: (template: RuleTemplateDefinition) => template.label,\n problem: defaultProblem,\n};\n\nfunction defaultProblem(problem: RuleProblem): string {\n switch (problem.code) {\n case 'missing-field':\n return 'Choose a question.';\n case 'missing-table':\n return 'Choose a table.';\n case 'missing-column':\n return 'Choose a column.';\n case 'missing-section':\n return 'Choose a section.';\n case 'table-columns-missing':\n return 'That table has no columns.';\n case 'missing-message-key':\n return 'Give this check a message.';\n case 'missing-source':\n return 'Write the formula this check calculates.';\n case 'key-count':\n return `This table takes ${String(problem.expected)} key field${problem.expected === 1 ? '' : 's'}, not ${String(problem.actual)}.`;\n case 'expression':\n switch (problem.problem.code) {\n case 'missing-operand':\n return 'Choose a value to compare with.';\n case 'empty-list':\n return 'Add at least one value to the list.';\n case 'invalid-literal':\n return problem.problem.detail;\n case 'unprintable':\n return `This condition cannot be shown: ${problem.problem.detail}`;\n case 'missing-field':\n return `There is no question or row field named ${problem.problem.fieldId}.`;\n case 'missing-table':\n return 'That table is no longer in the form.';\n case 'unsupported-primitive':\n return 'This answer cannot be typed here.';\n }\n }\n}\n\n/** The rule builder's props: a draft in, a changed draft out, and a complete rule on commit. */\nexport interface RuleBuilderProps {\n readonly value: RuleTemplateDraft;\n readonly context: RuleContext;\n readonly onChange: (draft: RuleTemplateDraft) => void;\n readonly onCommit?: ((rule: EmittedRule) => void) | undefined;\n readonly labels?: Partial<RuleBuilderLabels> | undefined;\n readonly validationLabels?: Partial<ValidationEditorLabels> | undefined;\n readonly conditionLabels?: Partial<ConditionEditorLabels> | undefined;\n readonly sentenceLabels?: Partial<RuleSentenceLabels> | undefined;\n readonly referencePickerLabels?: Partial<ReferencePickerLabels> | undefined;\n readonly disabled?: boolean | undefined;\n readonly id?: string | undefined;\n readonly className?: string | undefined;\n /**\n * The host's message slot for a template that raises a sentence.\n *\n * A host with its own message control supplies the key the store will mint (or any non-empty\n * placeholder, since the store mints from the rule id) and the builder stops rendering its own\n * key field; an empty string keeps the template incomplete, which is how the host says \"no\n * message yet\". Absent means the author edits the key here, which is the default.\n */\n readonly messageKey?: string | undefined;\n}\n\n/**\n * Sentence templates that compile to rules.\n *\n * The draft is controlled and the expression is built as a tree and printed by the compiler's\n * printer on every change, so the source under the sentence is what will be stored. `onCommit`\n * receives the `EmittedRule` only when the draft is complete and the compiler accepts it; a draft\n * that is not ready still renders its sentence and the reason it is not ready.\n */\nexport function RuleBuilder(props: RuleBuilderProps): ReactElement {\n const labels: RuleBuilderLabels = { ...DEFAULT_LABELS, ...props.labels };\n const reactId = useId();\n const baseId = props.id ?? `axb-rule-builder-${reactId}`;\n // The host's key is part of the draft the template builds from, so readiness and the emitted\n // sentence agree with the message the author wrote in the host's control.\n const draft =\n props.messageKey === undefined ? props.value : { ...props.value, messageKey: props.messageKey };\n const build = ruleBuilderBuild(draft, props.context);\n const sentenceRule =\n build.rule === undefined ? undefined : { ...build.rule, ruleId: build.rule.ruleId ?? '' };\n const sentence =\n sentenceRule === undefined\n ? labels.notReady\n : renderRuleSentence(deriveRuleSentence(sentenceRule, props.context), {\n ...DEFAULT_RULE_SENTENCE_LABELS,\n ...props.sentenceLabels,\n });\n const expression = displayExpression(build);\n const templates = templatesForContext(props.context);\n\n return (\n <div className={['axb-rule-builder', props.className].filter(Boolean).join(' ')}>\n <div className=\"axb-validation__row\">\n <label className=\"axb-field\" htmlFor={`${baseId}-template`}>\n <span className=\"axb-field__label\">{labels.template}</span>\n <select\n id={`${baseId}-template`}\n className=\"axb-select\"\n value={props.value.template}\n disabled={props.disabled === true}\n onChange={(event) => {\n const template = event.currentTarget.value;\n const known = templates.find((definition) => definition.id === template);\n if (known === undefined) return;\n props.onChange(defaultRuleTemplateDraft(known.id, props.context));\n }}\n >\n {templates.map((template) => (\n <option key={template.id} value={template.id}>\n {labels.templateLabel(template)}\n </option>\n ))}\n </select>\n </label>\n <label className=\"axb-field\" htmlFor={`${baseId}-rule-id`}>\n <span className=\"axb-field__label\">{labels.ruleId}</span>\n <input\n id={`${baseId}-rule-id`}\n className=\"axb-input axb-input--mono\"\n type=\"text\"\n value={props.value.ruleId ?? ''}\n disabled={props.disabled === true}\n onChange={(event) => {\n const value = event.currentTarget.value;\n props.onChange(setRuleId(props.value, value));\n }}\n />\n </label>\n </div>\n <TemplateFields\n draft={props.value}\n context={props.context}\n labels={labels}\n explicitAddReferenceLabel={props.labels?.addReference}\n validationLabels={props.validationLabels}\n conditionLabels={props.conditionLabels}\n referencePickerLabels={props.referencePickerLabels}\n disabled={props.disabled === true}\n baseId={baseId}\n onChange={props.onChange}\n />\n {props.messageKey === undefined && needsMessage(props.value) ? (\n <label className=\"axb-field\">\n <span className=\"axb-field__label\">{labels.messageKey}</span>\n <input\n className=\"axb-input axb-input--mono\"\n type=\"text\"\n value={props.value.messageKey ?? ''}\n disabled={props.disabled === true}\n onChange={(event) => {\n const value = event.currentTarget.value;\n props.onChange(setMessageKey(props.value, value));\n }}\n />\n </label>\n ) : null}\n <div className=\"axb-rule-preview\">\n <p className=\"axb-rule-preview__sentence\">\n <span className=\"axb-rule-preview__label\">{labels.sentence}</span> {sentence}\n </p>\n {expression === undefined ? null : (\n <details className=\"axb-advanced\">\n <summary>{labels.advanced}</summary>\n <p className=\"axb-rule-preview__expression\">\n <span className=\"axb-rule-preview__label\">{labels.expression}</span>{' '}\n <code>{expression}</code>\n </p>\n </details>\n )}\n {build.problems.length === 0 ? null : (\n <ul className=\"axb-problems\" aria-label={labels.notReady}>\n {build.problems.map((problem, index) => (\n <li key={`${problem.code}-${String(index)}`} className=\"axb-problem\">\n {labels.problem(problem)}\n </li>\n ))}\n </ul>\n )}\n {build.diagnostics.length === 0 ? null : (\n <ul className=\"axb-problems\" aria-label={labels.notReady}>\n {build.diagnostics.map((diagnostic) => (\n <li key={`${diagnostic.code}-${String(diagnostic.offset)}`} className=\"axb-problem\">\n <code>{diagnostic.code}</code> {diagnostic.detail}\n </li>\n ))}\n </ul>\n )}\n {/*\n The live region holds the verdict, not the transcript: the sentence and the problem list\n above change on every keystroke, and a polite region around them would re-announce the\n whole preview per character. Readiness flips only when the draft becomes usable.\n */}\n <p className={build.ready ? 'axb-ready' : 'axb-hint'} role=\"status\" aria-live=\"polite\">\n {build.ready ? labels.ready : labels.notReady}\n </p>\n </div>\n {props.onCommit === undefined ? null : (\n <button\n type=\"button\"\n className=\"axb-button axb-button--primary\"\n disabled={props.disabled === true || !build.ready || build.rule === undefined}\n onClick={() => {\n if (build.rule !== undefined) props.onCommit?.(build.rule);\n }}\n >\n {labels.commit}\n </button>\n )}\n </div>\n );\n}\n\nfunction TemplateFields(props: {\n readonly draft: RuleTemplateDraft;\n readonly context: RuleContext;\n readonly labels: RuleBuilderLabels;\n readonly explicitAddReferenceLabel: string | undefined;\n readonly validationLabels: Partial<ValidationEditorLabels> | undefined;\n readonly conditionLabels: Partial<ConditionEditorLabels> | undefined;\n readonly referencePickerLabels: Partial<ReferencePickerLabels> | undefined;\n readonly disabled: boolean;\n readonly baseId: string;\n readonly onChange: (draft: RuleTemplateDraft) => void;\n}): ReactElement {\n const draft = props.draft;\n switch (draft.template) {\n case 'require':\n return (\n <div className=\"axb-template-fields\">\n <FieldSelect\n id={`${props.baseId}-require-field`}\n label={props.labels.field}\n emptyText={props.labels.noField}\n fields={props.context.fields.filter((field) => field.primitive !== 'array')}\n value={draft.fieldId}\n disabled={props.disabled}\n onChange={(fieldId) => props.onChange({ ...draft, fieldId })}\n />\n <label className=\"axb-check\">\n <input\n type=\"checkbox\"\n checked={draft.condition !== undefined}\n disabled={props.disabled}\n onChange={(event) => {\n if (event.currentTarget.checked) {\n props.onChange({\n ...draft,\n condition: defaultConditionDraft(props.context),\n });\n } else {\n const { condition: _condition, ...rest } = draft;\n props.onChange(rest);\n }\n }}\n />\n <span>{props.labels.condition}</span>\n </label>\n {draft.condition === undefined ? null : (\n <ConditionEditor\n value={draft.condition}\n context={props.context}\n labels={props.conditionLabels}\n validationLabels={props.validationLabels}\n referencePickerLabels={props.referencePickerLabels}\n disabled={props.disabled}\n onChange={(condition) => props.onChange({ ...draft, condition })}\n />\n )}\n </div>\n );\n case 'show-hide':\n return (\n <div className=\"axb-template-fields\">\n <label className=\"axb-field\">\n <span className=\"axb-field__label\">{props.labels.target}</span>\n <select\n className=\"axb-select\"\n value={draft.target.kind}\n disabled={props.disabled}\n onChange={(event) => {\n const kind = event.currentTarget.value;\n if (kind === 'section') {\n const section = props.context.sections?.[0];\n props.onChange({\n ...draft,\n target: { kind: 'section', sectionId: section?.sectionId ?? '' },\n });\n } else {\n props.onChange({\n ...draft,\n target: { kind: 'field', fieldId: firstFieldId(props.context) },\n });\n }\n }}\n >\n <option value=\"field\">{props.labels.targetField}</option>\n <option value=\"section\">{props.labels.targetSection}</option>\n </select>\n </label>\n {draft.target.kind === 'field' ? (\n <FieldSelect\n id={`${props.baseId}-show-field`}\n label={props.labels.field}\n emptyText={props.labels.noField}\n fields={props.context.fields}\n value={draft.target.fieldId}\n disabled={props.disabled}\n onChange={(fieldId) =>\n props.onChange({ ...draft, target: { kind: 'field', fieldId } })\n }\n />\n ) : (\n <label className=\"axb-field\">\n <span className=\"axb-field__label\">{props.labels.targetSection}</span>\n <select\n className=\"axb-select\"\n value={draft.target.sectionId}\n disabled={props.disabled}\n onChange={(event) =>\n props.onChange({\n ...draft,\n target: { kind: 'section', sectionId: event.currentTarget.value },\n })\n }\n >\n {(props.context.sections ?? []).map((section) => (\n <option key={section.sectionId} value={section.sectionId}>\n {section.label}\n </option>\n ))}\n </select>\n </label>\n )}\n <label className=\"axb-field\">\n <span className=\"axb-field__label\">{props.labels.show}</span>\n <select\n className=\"axb-select\"\n value={draft.mode}\n disabled={props.disabled}\n onChange={(event) => {\n const mode = event.currentTarget.value;\n if (mode === 'show' || mode === 'hide') {\n props.onChange({ ...draft, mode });\n }\n }}\n >\n <option value=\"show\">{props.labels.show}</option>\n <option value=\"hide\">{props.labels.hide}</option>\n </select>\n </label>\n <ConditionEditor\n value={draft.condition}\n context={props.context}\n labels={props.conditionLabels}\n validationLabels={props.validationLabels}\n referencePickerLabels={props.referencePickerLabels}\n disabled={props.disabled}\n onChange={(condition) => props.onChange({ ...draft, condition })}\n />\n </div>\n );\n case 'calculate-total':\n return (\n <div className=\"axb-template-fields\">\n <FieldSelect\n id={`${props.baseId}-total-target`}\n label={props.labels.totalField}\n emptyText={props.labels.noField}\n fields={targetFields(props.context.fields, 'number')}\n value={draft.fieldId}\n disabled={props.disabled}\n onChange={(fieldId) => props.onChange({ ...draft, fieldId })}\n />\n <TableFieldSelect\n id={`${props.baseId}-total-table`}\n label={props.labels.table}\n fields={props.context.fields}\n value={draft.tableFieldId}\n disabled={props.disabled}\n labels={props.labels}\n onChange={(tableFieldId) => {\n const table = props.context.fields.find((field) => field.fieldId === tableFieldId);\n props.onChange({\n ...draft,\n tableFieldId,\n columnFieldId: table?.columns?.[0]?.fieldId ?? '',\n });\n }}\n />\n <ColumnSelect\n id={`${props.baseId}-total-column`}\n label={props.labels.column}\n emptyText={props.labels.noColumn}\n table={props.context.fields.find((field) => field.fieldId === draft.tableFieldId)}\n value={draft.columnFieldId}\n disabled={props.disabled}\n onChange={(columnFieldId) => props.onChange({ ...draft, columnFieldId })}\n />\n </div>\n );\n case 'calculate-count':\n case 'calculate-any':\n case 'calculate-all': {\n const table = props.context.fields.find((field) => field.fieldId === draft.tableFieldId);\n const row = table === undefined ? props.context : rowContext(table, props.context.tables);\n return (\n <div className=\"axb-template-fields\">\n <FieldSelect\n id={`${props.baseId}-aggregate-target`}\n label={props.labels.field}\n emptyText={props.labels.noField}\n fields={targetFields(\n props.context.fields,\n draft.template === 'calculate-count' ? 'integer' : 'boolean',\n )}\n value={draft.fieldId}\n disabled={props.disabled}\n onChange={(fieldId) => props.onChange({ ...draft, fieldId })}\n />\n <TableFieldSelect\n id={`${props.baseId}-aggregate-table`}\n label={props.labels.table}\n fields={props.context.fields}\n value={draft.tableFieldId}\n disabled={props.disabled}\n labels={props.labels}\n onChange={(tableFieldId) => {\n const next = props.context.fields.find((field) => field.fieldId === tableFieldId);\n const nextRow =\n next === undefined ? props.context : rowContext(next, props.context.tables);\n props.onChange({\n ...draft,\n tableFieldId,\n condition: defaultConditionDraft(nextRow),\n });\n }}\n />\n <ConditionEditor\n value={draft.condition}\n context={row}\n labels={props.conditionLabels}\n validationLabels={props.validationLabels}\n referencePickerLabels={props.referencePickerLabels}\n disabled={props.disabled}\n onChange={(condition) => props.onChange({ ...draft, condition })}\n />\n </div>\n );\n }\n case 'calculate-formula':\n return (\n <div className=\"axb-template-fields\">\n <FieldSelect\n id={`${props.baseId}-formula-target`}\n label={props.labels.field}\n emptyText={props.labels.noField}\n fields={props.context.fields.filter((field) => field.primitive !== 'array')}\n value={draft.fieldId}\n disabled={props.disabled}\n onChange={(fieldId) => props.onChange({ ...draft, fieldId })}\n />\n <FormulaField\n draft={draft}\n context={props.context}\n labels={props.labels}\n explicitAddReferenceLabel={props.explicitAddReferenceLabel}\n referencePickerLabels={props.referencePickerLabels}\n disabled={props.disabled}\n onChange={props.onChange}\n />\n </div>\n );\n case 'check':\n return (\n <ValidationEditor\n value={draft.validation}\n context={props.context}\n labels={props.validationLabels}\n referencePickerLabels={props.referencePickerLabels}\n disabled={props.disabled}\n // The builder's own preview already states the expression, so the embedded editor keeps\n // its controls and does not mount a second live region beside the builder's.\n showExpression={false}\n onChange={(validation) => props.onChange({ ...draft, validation })}\n />\n );\n case 'no-duplicate':\n return (\n <div className=\"axb-template-fields\">\n <TableFieldSelect\n id={`${props.baseId}-unique-table`}\n label={props.labels.table}\n fields={props.context.fields}\n value={draft.tableFieldId}\n disabled={props.disabled}\n labels={props.labels}\n onChange={(tableFieldId) => {\n const table = props.context.fields.find((field) => field.fieldId === tableFieldId);\n props.onChange({\n ...draft,\n tableFieldId,\n columnFieldId: table?.columns?.[0]?.fieldId ?? '',\n });\n }}\n />\n <ColumnSelect\n id={`${props.baseId}-unique-column`}\n label={props.labels.column}\n emptyText={props.labels.noColumn}\n table={props.context.fields.find((field) => field.fieldId === draft.tableFieldId)}\n value={draft.columnFieldId}\n disabled={props.disabled}\n onChange={(columnFieldId) => props.onChange({ ...draft, columnFieldId })}\n />\n </div>\n );\n case 'block-submission':\n return (\n <div className=\"axb-template-fields\">\n <ConditionEditor\n value={draft.condition}\n context={props.context}\n labels={props.conditionLabels}\n validationLabels={props.validationLabels}\n referencePickerLabels={props.referencePickerLabels}\n disabled={props.disabled}\n onChange={(condition) => props.onChange({ ...draft, condition })}\n />\n <label className=\"axb-check\">\n <input\n type=\"checkbox\"\n checked={draft.hard}\n disabled={props.disabled}\n onChange={(event) => props.onChange({ ...draft, hard: event.currentTarget.checked })}\n />\n <span>{props.labels.hard}</span>\n </label>\n </div>\n );\n case 'choose-from-table': {\n const table = props.context.tables?.find((candidate) => candidate.tableId === draft.tableId);\n const keyColumns = table?.columns?.filter((column) => column.role === 'key') ?? [];\n return (\n <div className=\"axb-template-fields\">\n <FieldSelect\n id={`${props.baseId}-choose-target`}\n label={props.labels.field}\n emptyText={props.labels.noField}\n fields={props.context.fields.filter((field) => field.primitive !== 'array')}\n value={draft.fieldId}\n disabled={props.disabled}\n onChange={(fieldId) => props.onChange({ ...draft, fieldId })}\n />\n <label className=\"axb-field\">\n <span className=\"axb-field__label\">{props.labels.table}</span>\n <select\n className=\"axb-select\"\n value={draft.tableId}\n disabled={props.disabled}\n onChange={(event) => {\n const next = props.context.tables?.find(\n (candidate) => candidate.tableId === event.currentTarget.value,\n );\n props.onChange({\n ...draft,\n tableId: event.currentTarget.value,\n keyFieldIds: defaultKeyFieldIds(next, props.context.fields),\n });\n }}\n >\n {(props.context.tables ?? [])\n .filter((candidate) => candidate.kind === 'decision_table')\n .map((candidate) => (\n <option key={candidate.tableId} value={candidate.tableId}>\n {candidate.label}\n </option>\n ))}\n </select>\n </label>\n {keyColumns.map((column, index) => (\n <FieldSelect\n key={column.columnId}\n id={`${props.baseId}-key-${String(index)}`}\n label={`${props.labels.keyField}: ${column.label}`}\n emptyText={props.labels.noField}\n fields={props.context.fields.filter((field) => field.primitive === column.primitive)}\n value={draft.keyFieldIds[index] ?? ''}\n disabled={props.disabled}\n onChange={(fieldId) => {\n const keys = [...draft.keyFieldIds];\n keys[index] = fieldId;\n props.onChange({ ...draft, keyFieldIds: keys });\n }}\n />\n ))}\n <label className=\"axb-field\">\n <span className=\"axb-field__label\">{props.labels.outputColumn}</span>\n <select\n className=\"axb-select\"\n value={draft.outputColumnId ?? ''}\n disabled={props.disabled}\n onChange={(event) => {\n const value = event.currentTarget.value;\n if (value.length === 0) {\n const { outputColumnId: _output, ...rest } = draft;\n props.onChange(rest);\n } else {\n props.onChange({ ...draft, outputColumnId: value });\n }\n }}\n >\n <option value=\"\">—</option>\n {(table?.columns ?? [])\n .filter((column) => column.role === 'output')\n .map((column) => (\n <option key={column.columnId} value={column.columnId}>\n {column.label}\n </option>\n ))}\n </select>\n </label>\n </div>\n );\n }\n }\n}\n\nfunction FormulaField(props: {\n readonly draft: Extract<RuleTemplateDraft, { template: 'calculate-formula' }>;\n readonly context: RuleContext;\n readonly labels: RuleBuilderLabels;\n readonly explicitAddReferenceLabel: string | undefined;\n readonly referencePickerLabels: Partial<ReferencePickerLabels> | undefined;\n readonly disabled: boolean;\n readonly onChange: (draft: RuleTemplateDraft) => void;\n}): ReactElement {\n const textarea = useRef<HTMLTextAreaElement | null>(null);\n const pickerLabels: Partial<ReferencePickerLabels> = {\n ...props.referencePickerLabels,\n label:\n props.explicitAddReferenceLabel ??\n props.referencePickerLabels?.label ??\n props.labels.addReference,\n };\n return (\n <div className=\"axb-formula\">\n <label className=\"axb-field\">\n <span className=\"axb-field__label\">{props.labels.formula}</span>\n <textarea\n ref={textarea}\n className=\"axb-textarea axb-input--mono\"\n rows={3}\n value={props.draft.source}\n disabled={props.disabled}\n onChange={(event) =>\n props.onChange({ ...props.draft, source: event.currentTarget.value })\n }\n />\n </label>\n <ReferencePicker\n fields={props.context.fields}\n disabled={props.disabled}\n labels={pickerLabels}\n onPick={(reference) => {\n const element = textarea.current;\n const source = props.draft.source;\n const start = element?.selectionStart ?? source.length;\n const end = element?.selectionEnd ?? start;\n const inserted = insertReferenceAtCaret(source, start, end, reference.fieldId);\n props.onChange({ ...props.draft, source: inserted.value });\n // React commits a discrete event's update before the microtask, so the textarea holds\n // the new source when the caret is placed after the inserted id.\n queueMicrotask(() => {\n const element = textarea.current;\n if (element === null) return;\n element.focus();\n element.setSelectionRange(inserted.caret, inserted.caret);\n });\n }}\n />\n </div>\n );\n}\n\nfunction needsMessage(draft: RuleTemplateDraft): boolean {\n return ruleTemplateNeedsMessage(draft.template);\n}\n\nfunction setRuleId(draft: RuleTemplateDraft, value: string): RuleTemplateDraft {\n if (value.length === 0) {\n const { ruleId: _ruleId, ...rest } = draft;\n return rest;\n }\n return { ...draft, ruleId: value };\n}\n\nfunction setMessageKey(draft: RuleTemplateDraft, value: string): RuleTemplateDraft {\n if (value.length === 0) {\n const { messageKey: _messageKey, ...rest } = draft;\n return rest;\n }\n return { ...draft, messageKey: value };\n}\n\nfunction displayExpression(build: RuleBuild): string | undefined {\n const rule = build.rule;\n if (rule === undefined) return build.source;\n if (rule.gate !== undefined) return rule.gate.items[0]?.expr;\n return rule.expr;\n}\n\nfunction firstFieldId(context: RuleContext): string {\n return context.fields.find((field) => field.primitive !== 'array')?.fieldId ?? '';\n}\n\nfunction targetFields(\n fields: readonly RuleField[],\n target: 'number' | 'integer' | 'boolean',\n): readonly RuleField[] {\n return fields.filter((field) => {\n switch (target) {\n case 'number':\n return (\n field.primitive === 'integer' ||\n field.primitive === 'decimal' ||\n field.primitive === 'money'\n );\n case 'integer':\n return field.primitive === 'integer';\n case 'boolean':\n return field.primitive === 'boolean';\n }\n });\n}\n\nfunction FieldSelect(props: {\n readonly id: string;\n readonly label: string;\n readonly fields: readonly RuleField[];\n readonly value: string;\n readonly disabled: boolean;\n readonly emptyText: string;\n readonly onChange: (fieldId: string) => void;\n}): ReactElement {\n const groups = new Map<string, RuleField[]>();\n for (const field of props.fields) {\n const key = `${field.pageLabel ?? ''}\\u0000${field.sectionLabel ?? ''}`;\n const group = groups.get(key);\n if (group === undefined) groups.set(key, [field]);\n else group.push(field);\n }\n if (props.fields.length === 0) {\n return <p className=\"axb-hint\">{props.emptyText}</p>;\n }\n return (\n <label className=\"axb-field\" htmlFor={props.id}>\n <span className=\"axb-field__label\">{props.label}</span>\n <select\n id={props.id}\n className=\"axb-select\"\n value={props.value}\n disabled={props.disabled}\n onChange={(event) => props.onChange(event.currentTarget.value)}\n >\n {[...groups].map(([key, fields]) => {\n const [first] = fields;\n return (\n <optgroup key={key} label={first?.sectionLabel ?? first?.pageLabel ?? ''}>\n {fields.map((field) => (\n <option key={field.fieldId} value={field.fieldId}>\n {field.label}\n </option>\n ))}\n </optgroup>\n );\n })}\n </select>\n </label>\n );\n}\n\nfunction TableFieldSelect(props: {\n readonly id: string;\n readonly label: string;\n readonly fields: readonly RuleField[];\n readonly value: string;\n readonly disabled: boolean;\n readonly labels: RuleBuilderLabels;\n readonly onChange: (fieldId: string) => void;\n}): ReactElement {\n const tables = props.fields.filter((field) => field.primitive === 'array');\n if (tables.length === 0) {\n return <p className=\"axb-hint\">{props.labels.noTables}</p>;\n }\n return (\n <label className=\"axb-field\" htmlFor={props.id}>\n <span className=\"axb-field__label\">{props.label}</span>\n <select\n id={props.id}\n className=\"axb-select\"\n value={props.value}\n disabled={props.disabled}\n onChange={(event) => props.onChange(event.currentTarget.value)}\n >\n {tables.map((field) => (\n <option key={field.fieldId} value={field.fieldId}>\n {field.label}\n </option>\n ))}\n </select>\n </label>\n );\n}\n\nfunction ColumnSelect(props: {\n readonly id: string;\n readonly label: string;\n readonly table: RuleField | undefined;\n readonly value: string;\n readonly disabled: boolean;\n readonly emptyText: string;\n readonly onChange: (columnId: string) => void;\n}): ReactElement {\n const columns = props.table?.columns ?? [];\n if (columns.length === 0) return <p className=\"axb-hint\">{props.emptyText}</p>;\n return (\n <label className=\"axb-field\" htmlFor={props.id}>\n <span className=\"axb-field__label\">{props.label}</span>\n <select\n id={props.id}\n className=\"axb-select\"\n value={props.value}\n disabled={props.disabled}\n onChange={(event) => props.onChange(event.currentTarget.value)}\n >\n {columns.map((column) => (\n <option key={column.fieldId} value={column.fieldId}>\n {column.label}\n </option>\n ))}\n </select>\n </label>\n );\n}\n"]}
@@ -0,0 +1,45 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { RuleSentenceLabels } from './sentence.js';
3
+ import type { ReadableRule, RuleContext, RuleStatus } from './types.js';
4
+ /** The overridable chrome a rule list uses. */
5
+ export interface RuleListLabels {
6
+ readonly empty: string;
7
+ readonly expression: string;
8
+ readonly advanced: string;
9
+ readonly message: string;
10
+ readonly edit: (ruleText: string) => string;
11
+ readonly remove: (ruleText: string) => string;
12
+ readonly editText: string;
13
+ readonly removeText: string;
14
+ readonly status: Readonly<Record<RuleStatus, string>>;
15
+ readonly kind: Readonly<Record<ReadableRule['kind'], string>>;
16
+ }
17
+ /** The rule list's props: rules and their latest statuses in, edit/remove commands out. */
18
+ export interface RuleListProps {
19
+ readonly rules: readonly ReadableRule[];
20
+ readonly context: RuleContext;
21
+ readonly statuses?: Readonly<Record<string, RuleStatus>> | undefined;
22
+ /**
23
+ * The host's resolved copy, by message key, in the language the list is showing.
24
+ *
25
+ * The document stores keys, not text, so a list that read the document would print
26
+ * `rule.r_quantity` at an author. The host already resolves every key for the panels it renders;
27
+ * this is the same map, and a key the caller omits keeps the key in the developer disclosure.
28
+ */
29
+ readonly messages?: Readonly<Record<string, string>> | undefined;
30
+ readonly onEdit?: ((ruleId: string) => void) | undefined;
31
+ readonly onRemove?: ((ruleId: string) => void) | undefined;
32
+ readonly labels?: Partial<RuleListLabels> | undefined;
33
+ readonly sentenceLabels?: Partial<RuleSentenceLabels> | undefined;
34
+ readonly className?: string | undefined;
35
+ }
36
+ /**
37
+ * Every declared rule as one English sentence, its own expression, and its latest status.
38
+ *
39
+ * The sentence is derived from the rule's shape: a comparison, a uniqueness test, a compute over a
40
+ * comprehension, a gate item. A shape the reader does not recognise is labelled with the
41
+ * catalogue's `advanced` member and shown as the source it already is: a rule list never guesses a
42
+ * meaning for an expression it cannot read.
43
+ */
44
+ export declare function RuleList(props: RuleListProps): ReactElement;
45
+ //# sourceMappingURL=RuleList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleList.d.ts","sourceRoot":"","sources":["../../src/rules/RuleList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExE,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/D;AA4BD,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;IACrE;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IACtD,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC;IAClE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAyE3D"}
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { parseSource, sourceOf } from './expression.js';
3
+ import { DEFAULT_RULE_SENTENCE_LABELS, deriveRuleSentence, renderRuleSentence, } from './sentence.js';
4
+ const DEFAULT_LABELS = {
5
+ empty: 'No checks yet.',
6
+ expression: 'Condition',
7
+ advanced: 'Advanced',
8
+ message: 'Message',
9
+ edit: (ruleText) => `Edit ${ruleText}`,
10
+ remove: (ruleText) => `Remove ${ruleText}`,
11
+ editText: 'Edit',
12
+ removeText: 'Remove',
13
+ status: {
14
+ pass: 'Passes',
15
+ fail: 'Fails',
16
+ 'not-answered': 'Not answered',
17
+ },
18
+ kind: {
19
+ validate: 'Check',
20
+ visible: 'Show or hide',
21
+ required: 'Required',
22
+ enabled: 'Enable or disable',
23
+ compute: 'Calculate',
24
+ defaultCompute: 'Default',
25
+ gate: 'Submit blocker',
26
+ screen: 'Warning screen',
27
+ },
28
+ };
29
+ /**
30
+ * Every declared rule as one English sentence, its own expression, and its latest status.
31
+ *
32
+ * The sentence is derived from the rule's shape: a comparison, a uniqueness test, a compute over a
33
+ * comprehension, a gate item. A shape the reader does not recognise is labelled with the
34
+ * catalogue's `advanced` member and shown as the source it already is: a rule list never guesses a
35
+ * meaning for an expression it cannot read.
36
+ */
37
+ export function RuleList(props) {
38
+ const labels = { ...DEFAULT_LABELS, ...props.labels };
39
+ const sentenceLabels = {
40
+ ...DEFAULT_RULE_SENTENCE_LABELS,
41
+ ...props.sentenceLabels,
42
+ };
43
+ if (props.rules.length === 0) {
44
+ return _jsx("p", { className: props.className, children: labels.empty });
45
+ }
46
+ return (_jsx("ul", { className: ['axb-rule-list', props.className].filter(Boolean).join(' '), children: props.rules.map((rule) => {
47
+ const status = props.statuses?.[rule.ruleId] ?? 'not-answered';
48
+ const sentence = deriveRuleSentence(rule, props.context);
49
+ const text = renderRuleSentence(sentence, sentenceLabels);
50
+ const expression = canonicalExpression(rule.expr);
51
+ return (_jsxs("li", { className: "axb-rule-list__item", "data-rule": rule.ruleId, children: [_jsxs("div", { className: "axb-rule-list__head", children: [_jsx("p", { className: "axb-rule-list__sentence", children: text }), _jsx("span", { className: `axb-badge axb-badge--${status}`, children: labels.status[status] })] }), rule.messageKey === undefined ||
52
+ (props.messages?.[rule.messageKey] ?? '') === '' ? null : (_jsx("p", { className: "axb-rule-list__message-text", "data-rule-message": "", children: props.messages?.[rule.messageKey] })), _jsxs("details", { className: "axb-advanced", children: [_jsx("summary", { children: labels.advanced }), _jsxs("p", { className: "axb-rule-list__meta", children: [_jsx("code", { children: rule.ruleId }), _jsx("span", { className: "axb-rule-list__kind", children: labels.kind[rule.kind] }), rule.messageKey === undefined ? null : (_jsxs("span", { className: "axb-rule-list__message", children: [labels.message, " ", _jsx("code", { children: rule.messageKey })] }))] }), _jsxs("p", { className: "axb-rule-list__expression", children: [_jsx("span", { className: "axb-rule-list__label", children: labels.expression }), ' ', _jsx("code", { children: expression })] })] }), props.onEdit === undefined && props.onRemove === undefined ? null : (_jsxs("div", { className: "axb-rule-list__actions", children: [props.onEdit === undefined ? null : (_jsx("button", { type: "button", className: "axb-button axb-button--quiet", "aria-label": labels.edit(text), onClick: () => props.onEdit?.(rule.ruleId), children: labels.editText })), props.onRemove === undefined ? null : (_jsx("button", { type: "button", className: "axb-button axb-button--quiet axb-button--danger", "aria-label": labels.remove(text), onClick: () => props.onRemove?.(rule.ruleId), children: labels.removeText }))] }))] }, rule.ruleId));
53
+ }) }));
54
+ }
55
+ /** The canonical source of a stored rule expression, or the stored text when it does not parse. */
56
+ function canonicalExpression(source) {
57
+ const parsed = parseSource(source);
58
+ if (!parsed.ok)
59
+ return source;
60
+ return sourceOf(parsed.node) ?? source;
61
+ }
62
+ //# sourceMappingURL=RuleList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleList.js","sourceRoot":"","sources":["../../src/rules/RuleList.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAkBvB,MAAM,cAAc,GAAmB;IACrC,KAAK,EAAE,gBAAgB;IACvB,UAAU,EAAE,WAAW;IACvB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,QAAQ,EAAE;IACtC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,QAAQ,EAAE;IAC1C,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAA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AC,CAAC,CACnE,eAAK,SAAS,EAAC,wBAAwB,aACpC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACnC,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,8BAA8B,gBAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,YAEzC,MAAM,CAAC,QAAQ,GACT,CACV,EACA,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACrC,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,iDAAiD,gBAC/C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,YAE3C,MAAM,CAAC,UAAU,GACX,CACV,IACG,CACP,KAlDM,IAAI,CAAC,MAAM,CAmDf,CACN,CAAC;QACJ,CAAC,CAAC,GACC,CACN,CAAC;AACJ,CAAC;AAED,mGAAmG;AACnG,SAAS,mBAAmB,CAAC,MAAc;IACzC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC;IAC9B,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;AACzC,CAAC","sourcesContent":["import type { ReactElement } from 'react';\nimport { parseSource, sourceOf } from './expression.js';\nimport {\n DEFAULT_RULE_SENTENCE_LABELS,\n deriveRuleSentence,\n renderRuleSentence,\n} from './sentence.js';\nimport type { RuleSentenceLabels } from './sentence.js';\nimport type { ReadableRule, RuleContext, RuleStatus } from './types.js';\n\n/** The overridable chrome a rule list uses. */\nexport interface RuleListLabels {\n readonly empty: string;\n readonly expression: string;\n readonly advanced: string;\n readonly message: string;\n readonly edit: (ruleText: string) => string;\n readonly remove: (ruleText: string) => string;\n readonly editText: string;\n readonly removeText: string;\n readonly status: Readonly<Record<RuleStatus, string>>;\n readonly kind: Readonly<Record<ReadableRule['kind'], string>>;\n}\n\nconst DEFAULT_LABELS: RuleListLabels = {\n empty: 'No checks yet.',\n expression: 'Condition',\n advanced: 'Advanced',\n message: 'Message',\n edit: (ruleText) => `Edit ${ruleText}`,\n remove: (ruleText) => `Remove ${ruleText}`,\n editText: 'Edit',\n removeText: 'Remove',\n status: {\n pass: 'Passes',\n fail: 'Fails',\n 'not-answered': 'Not answered',\n },\n kind: {\n validate: 'Check',\n visible: 'Show or hide',\n required: 'Required',\n enabled: 'Enable or disable',\n compute: 'Calculate',\n defaultCompute: 'Default',\n gate: 'Submit blocker',\n screen: 'Warning screen',\n },\n};\n\n/** The rule list's props: rules and their latest statuses in, edit/remove commands out. */\nexport interface RuleListProps {\n readonly rules: readonly ReadableRule[];\n readonly context: RuleContext;\n readonly statuses?: Readonly<Record<string, RuleStatus>> | undefined;\n /**\n * The host's resolved copy, by message key, in the language the list is showing.\n *\n * The document stores keys, not text, so a list that read the document would print\n * `rule.r_quantity` at an author. The host already resolves every key for the panels it renders;\n * this is the same map, and a key the caller omits keeps the key in the developer disclosure.\n */\n readonly messages?: Readonly<Record<string, string>> | undefined;\n readonly onEdit?: ((ruleId: string) => void) | undefined;\n readonly onRemove?: ((ruleId: string) => void) | undefined;\n readonly labels?: Partial<RuleListLabels> | undefined;\n readonly sentenceLabels?: Partial<RuleSentenceLabels> | undefined;\n readonly className?: string | undefined;\n}\n\n/**\n * Every declared rule as one English sentence, its own expression, and its latest status.\n *\n * The sentence is derived from the rule's shape: a comparison, a uniqueness test, a compute over a\n * comprehension, a gate item. A shape the reader does not recognise is labelled with the\n * catalogue's `advanced` member and shown as the source it already is: a rule list never guesses a\n * meaning for an expression it cannot read.\n */\nexport function RuleList(props: RuleListProps): ReactElement {\n const labels: RuleListLabels = { ...DEFAULT_LABELS, ...props.labels };\n const sentenceLabels: RuleSentenceLabels = {\n ...DEFAULT_RULE_SENTENCE_LABELS,\n ...props.sentenceLabels,\n };\n if (props.rules.length === 0) {\n return <p className={props.className}>{labels.empty}</p>;\n }\n return (\n <ul className={['axb-rule-list', props.className].filter(Boolean).join(' ')}>\n {props.rules.map((rule) => {\n const status = props.statuses?.[rule.ruleId] ?? 'not-answered';\n const sentence = deriveRuleSentence(rule, props.context);\n const text = renderRuleSentence(sentence, sentenceLabels);\n const expression = canonicalExpression(rule.expr);\n return (\n <li key={rule.ruleId} className=\"axb-rule-list__item\" data-rule={rule.ruleId}>\n <div className=\"axb-rule-list__head\">\n <p className=\"axb-rule-list__sentence\">{text}</p>\n <span className={`axb-badge axb-badge--${status}`}>{labels.status[status]}</span>\n </div>\n {rule.messageKey === undefined ||\n (props.messages?.[rule.messageKey] ?? '') === '' ? null : (\n <p className=\"axb-rule-list__message-text\" data-rule-message=\"\">\n {props.messages?.[rule.messageKey]}\n </p>\n )}\n <details className=\"axb-advanced\">\n <summary>{labels.advanced}</summary>\n <p className=\"axb-rule-list__meta\">\n <code>{rule.ruleId}</code>\n <span className=\"axb-rule-list__kind\">{labels.kind[rule.kind]}</span>\n {rule.messageKey === undefined ? null : (\n <span className=\"axb-rule-list__message\">\n {labels.message} <code>{rule.messageKey}</code>\n </span>\n )}\n </p>\n <p className=\"axb-rule-list__expression\">\n <span className=\"axb-rule-list__label\">{labels.expression}</span>{' '}\n <code>{expression}</code>\n </p>\n </details>\n {props.onEdit === undefined && props.onRemove === undefined ? null : (\n <div className=\"axb-rule-list__actions\">\n {props.onEdit === undefined ? null : (\n <button\n type=\"button\"\n className=\"axb-button axb-button--quiet\"\n aria-label={labels.edit(text)}\n onClick={() => props.onEdit?.(rule.ruleId)}\n >\n {labels.editText}\n </button>\n )}\n {props.onRemove === undefined ? null : (\n <button\n type=\"button\"\n className=\"axb-button axb-button--quiet axb-button--danger\"\n aria-label={labels.remove(text)}\n onClick={() => props.onRemove?.(rule.ruleId)}\n >\n {labels.removeText}\n </button>\n )}\n </div>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\n/** The canonical source of a stored rule expression, or the stored text when it does not parse. */\nfunction canonicalExpression(source: string): string {\n const parsed = parseSource(source);\n if (!parsed.ok) return source;\n return sourceOf(parsed.node) ?? source;\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { MessageCatalogue } from './messages.js';
3
+ /** The overridable chrome a rule message editor uses. */
4
+ export interface RuleMessageLabels {
5
+ readonly title: string;
6
+ readonly messageKey: string;
7
+ readonly keyPlaceholder: string;
8
+ readonly keyReadOnly: string;
9
+ readonly locale: string;
10
+ readonly text: string;
11
+ readonly missing: string;
12
+ readonly defaultTag: string;
13
+ readonly copyFromDefault: string;
14
+ readonly copyAllMissing: string;
15
+ readonly noDefault: string;
16
+ readonly keyRequired: string;
17
+ }
18
+ /** The rule message editor's props: a catalogue in, the next catalogue out. */
19
+ export interface RuleMessageEditorProps {
20
+ readonly messageKey: string;
21
+ readonly catalogue: MessageCatalogue;
22
+ readonly onChange: (catalogue: MessageCatalogue) => void;
23
+ readonly onMessageKeyChange?: ((messageKey: string) => void) | undefined;
24
+ readonly labels?: Partial<RuleMessageLabels> | undefined;
25
+ readonly disabled?: boolean | undefined;
26
+ readonly id?: string | undefined;
27
+ readonly className?: string | undefined;
28
+ }
29
+ /**
30
+ * A rule's message key and its text in every declared locale, side by side.
31
+ *
32
+ * Missing locales are flagged rather than filled with an invisible fallback: `translateMessage`
33
+ * states the source of text a renderer would show, and this editor shows what is actually stored.
34
+ * "Copy from the main language" fills only the languages that have no text, so an existing
35
+ * translation is never overwritten.
36
+ */
37
+ export declare function RuleMessageEditor(props: RuleMessageEditorProps): ReactElement;
38
+ //# sourceMappingURL=RuleMessageEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleMessageEditor.d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AAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAkI7E"}
@@ -0,0 +1,38 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { copyMessageFromDefault, messageRows, setMessageText, translateMessage, } from './messages.js';
4
+ const DEFAULT_LABELS = {
5
+ title: 'Message',
6
+ messageKey: 'Message name',
7
+ keyPlaceholder: 'message.name',
8
+ keyReadOnly: 'This message already has a name.',
9
+ locale: 'Language',
10
+ text: 'Text',
11
+ missing: 'Missing',
12
+ defaultTag: 'Main language',
13
+ copyFromDefault: 'Copy from the main language',
14
+ copyAllMissing: 'Copy the main text into the languages with no text',
15
+ noDefault: 'The main language has no text for this message.',
16
+ keyRequired: 'Name this message before you edit a language.',
17
+ };
18
+ /**
19
+ * A rule's message key and its text in every declared locale, side by side.
20
+ *
21
+ * Missing locales are flagged rather than filled with an invisible fallback: `translateMessage`
22
+ * states the source of text a renderer would show, and this editor shows what is actually stored.
23
+ * "Copy from the main language" fills only the languages that have no text, so an existing
24
+ * translation is never overwritten.
25
+ */
26
+ export function RuleMessageEditor(props) {
27
+ const labels = { ...DEFAULT_LABELS, ...props.labels };
28
+ const reactId = useId();
29
+ const baseId = props.id ?? `axb-message-${reactId}`;
30
+ const rows = messageRows(props.catalogue, props.messageKey);
31
+ const defaultText = translateMessage(props.catalogue, props.messageKey, props.catalogue.defaultLocale).text;
32
+ const missingCount = rows.filter((row) => row.missing).length;
33
+ return (_jsxs("div", { className: ['axb-messages', props.className].filter(Boolean).join(' '), children: [_jsxs("div", { className: "axb-messages__head", children: [_jsx("h3", { className: "axb-messages__title", children: labels.title }), _jsxs("div", { className: "axb-field", children: [_jsx("label", { className: "axb-field__label", htmlFor: `${baseId}-key`, children: labels.messageKey }), props.onMessageKeyChange === undefined ? (_jsx("code", { id: `${baseId}-key`, className: "axb-messages__key", title: labels.keyReadOnly, children: props.messageKey.length === 0 ? '—' : props.messageKey })) : (_jsx("input", { id: `${baseId}-key`, className: "axb-input axb-input--mono", type: "text", value: props.messageKey, disabled: props.disabled === true, placeholder: labels.keyPlaceholder, onChange: (event) => props.onMessageKeyChange?.(event.currentTarget.value) }))] })] }), props.messageKey.length === 0 ? (_jsx("p", { className: "axb-hint", children: labels.keyRequired })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "axb-messages__toolbar", children: [_jsx("button", { type: "button", className: "axb-button", disabled: props.disabled === true || defaultText === undefined || missingCount === 0, onClick: () => props.onChange(copyMessageFromDefault(props.catalogue, props.messageKey)), children: labels.copyAllMissing }), defaultText === undefined ? (_jsx("span", { className: "axb-hint", children: labels.noDefault })) : null] }), _jsxs("table", { className: "axb-messages__table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: labels.locale }), _jsx("th", { scope: "col", children: labels.text }), _jsx("th", { scope: "col", children: _jsx("span", { className: "axb-visually-hidden", children: labels.copyFromDefault }) })] }) }), _jsx("tbody", { children: rows.map((row) => (_jsxs("tr", { className: row.missing ? 'axb-messages__row--missing' : undefined, children: [_jsxs("th", { scope: "row", className: "axb-messages__locale", children: [_jsx("span", { children: row.locale }), row.isDefault ? (_jsx("span", { className: "axb-messages__default", children: labels.defaultTag })) : null, row.missing ? (_jsx("span", { className: "axb-messages__missing", children: labels.missing })) : null] }), _jsxs("td", { children: [_jsx("label", { className: "axb-visually-hidden", htmlFor: `${baseId}-${row.locale}`, children: `${labels.text} (${row.locale})` }), _jsx("textarea", { id: `${baseId}-${row.locale}`, className: "axb-textarea", rows: 2, value: row.text ?? '', disabled: props.disabled === true, onChange: (event) => props.onChange(setMessageText(props.catalogue, props.messageKey, row.locale, event.currentTarget.value)) })] }), _jsx("td", { children: _jsx("button", { type: "button", className: "axb-button axb-button--quiet", disabled: props.disabled === true ||
34
+ row.isDefault ||
35
+ defaultText === undefined ||
36
+ row.text === defaultText, onClick: () => props.onChange(copyMessageFromDefault(props.catalogue, props.messageKey, row.locale)), children: labels.copyFromDefault }) })] }, row.locale))) })] })] }))] }));
37
+ }
38
+ //# sourceMappingURL=RuleMessageEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleMessageEditor.js","sourceRoot":"","sources":["../../src/rules/RuleMessageEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAmBvB,MAAM,cAAc,GAAsB;IACxC,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,cAAc;IAC1B,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,kCAAkC;IAC/C,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,eAAe;IAC3B,eAAe,EAAE,6BAA6B;IAC9C,cAAc,EAAE,oDAAoD;IACpE,SAAS,EAAE,iDAAiD;IAC5D,WAAW,EAAE,+CAA+C;CAC7D,CAAC;AAcF;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,MAAM,GAAsB,EAAE,GAAG,cAAc,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;IACzE,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,IAAI,eAAe,OAAO,EAAE,CAAC;IACpD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,gBAAgB,CAClC,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,UAAU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,CAAC","sourcesContent":["import { useId } from 'react';\nimport type { ReactElement } from 'react';\nimport {\n copyMessageFromDefault,\n messageRows,\n setMessageText,\n translateMessage,\n} from './messages.js';\nimport type { MessageCatalogue } from './messages.js';\n\n/** The overridable chrome a rule message editor uses. */\nexport interface RuleMessageLabels {\n readonly title: string;\n readonly messageKey: string;\n readonly keyPlaceholder: string;\n readonly keyReadOnly: string;\n readonly locale: string;\n readonly text: string;\n readonly missing: string;\n readonly defaultTag: string;\n readonly copyFromDefault: string;\n readonly copyAllMissing: string;\n readonly noDefault: string;\n readonly keyRequired: string;\n}\n\nconst DEFAULT_LABELS: RuleMessageLabels = {\n title: 'Message',\n messageKey: 'Message name',\n keyPlaceholder: 'message.name',\n keyReadOnly: 'This message already has a name.',\n locale: 'Language',\n text: 'Text',\n missing: 'Missing',\n defaultTag: 'Main language',\n copyFromDefault: 'Copy from the main language',\n copyAllMissing: 'Copy the main text into the languages with no text',\n noDefault: 'The main language has no text for this message.',\n keyRequired: 'Name this message before you edit a language.',\n};\n\n/** The rule message editor's props: a catalogue in, the next catalogue out. */\nexport interface RuleMessageEditorProps {\n readonly messageKey: string;\n readonly catalogue: MessageCatalogue;\n readonly onChange: (catalogue: MessageCatalogue) => void;\n readonly onMessageKeyChange?: ((messageKey: string) => void) | undefined;\n readonly labels?: Partial<RuleMessageLabels> | undefined;\n readonly disabled?: boolean | undefined;\n readonly id?: string | undefined;\n readonly className?: string | undefined;\n}\n\n/**\n * A rule's message key and its text in every declared locale, side by side.\n *\n * Missing locales are flagged rather than filled with an invisible fallback: `translateMessage`\n * states the source of text a renderer would show, and this editor shows what is actually stored.\n * \"Copy from the main language\" fills only the languages that have no text, so an existing\n * translation is never overwritten.\n */\nexport function RuleMessageEditor(props: RuleMessageEditorProps): ReactElement {\n const labels: RuleMessageLabels = { ...DEFAULT_LABELS, ...props.labels };\n const reactId = useId();\n const baseId = props.id ?? `axb-message-${reactId}`;\n const rows = messageRows(props.catalogue, props.messageKey);\n const defaultText = translateMessage(\n props.catalogue,\n props.messageKey,\n props.catalogue.defaultLocale,\n ).text;\n const missingCount = rows.filter((row) => row.missing).length;\n\n return (\n <div className={['axb-messages', props.className].filter(Boolean).join(' ')}>\n <div className=\"axb-messages__head\">\n <h3 className=\"axb-messages__title\">{labels.title}</h3>\n <div className=\"axb-field\">\n <label className=\"axb-field__label\" htmlFor={`${baseId}-key`}>\n {labels.messageKey}\n </label>\n {props.onMessageKeyChange === undefined ? (\n <code id={`${baseId}-key`} className=\"axb-messages__key\" title={labels.keyReadOnly}>\n {props.messageKey.length === 0 ? '—' : props.messageKey}\n </code>\n ) : (\n <input\n id={`${baseId}-key`}\n className=\"axb-input axb-input--mono\"\n type=\"text\"\n value={props.messageKey}\n disabled={props.disabled === true}\n placeholder={labels.keyPlaceholder}\n onChange={(event) => props.onMessageKeyChange?.(event.currentTarget.value)}\n />\n )}\n </div>\n </div>\n {props.messageKey.length === 0 ? (\n <p className=\"axb-hint\">{labels.keyRequired}</p>\n ) : (\n <>\n <div className=\"axb-messages__toolbar\">\n <button\n type=\"button\"\n className=\"axb-button\"\n disabled={props.disabled === true || defaultText === undefined || missingCount === 0}\n onClick={() =>\n props.onChange(copyMessageFromDefault(props.catalogue, props.messageKey))\n }\n >\n {labels.copyAllMissing}\n </button>\n {defaultText === undefined ? (\n <span className=\"axb-hint\">{labels.noDefault}</span>\n ) : null}\n </div>\n <table className=\"axb-messages__table\">\n <thead>\n <tr>\n <th scope=\"col\">{labels.locale}</th>\n <th scope=\"col\">{labels.text}</th>\n <th scope=\"col\">\n <span className=\"axb-visually-hidden\">{labels.copyFromDefault}</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {rows.map((row) => (\n <tr\n key={row.locale}\n className={row.missing ? 'axb-messages__row--missing' : undefined}\n >\n <th scope=\"row\" className=\"axb-messages__locale\">\n <span>{row.locale}</span>\n {row.isDefault ? (\n <span className=\"axb-messages__default\">{labels.defaultTag}</span>\n ) : null}\n {row.missing ? (\n <span className=\"axb-messages__missing\">{labels.missing}</span>\n ) : null}\n </th>\n <td>\n <label className=\"axb-visually-hidden\" htmlFor={`${baseId}-${row.locale}`}>\n {`${labels.text} (${row.locale})`}\n </label>\n <textarea\n id={`${baseId}-${row.locale}`}\n className=\"axb-textarea\"\n rows={2}\n value={row.text ?? ''}\n disabled={props.disabled === true}\n onChange={(event) =>\n props.onChange(\n setMessageText(\n props.catalogue,\n props.messageKey,\n row.locale,\n event.currentTarget.value,\n ),\n )\n }\n />\n </td>\n <td>\n <button\n type=\"button\"\n className=\"axb-button axb-button--quiet\"\n disabled={\n props.disabled === true ||\n row.isDefault ||\n defaultText === undefined ||\n row.text === defaultText\n }\n onClick={() =>\n props.onChange(\n copyMessageFromDefault(props.catalogue, props.messageKey, row.locale),\n )\n }\n >\n {labels.copyFromDefault}\n </button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </>\n )}\n </div>\n );\n}\n"]}
@@ -0,0 +1,60 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { ReferencePickerLabels } from '../reference/ReferencePicker.js';
3
+ import type { ExpressionProblem, RuleContext, RuleField, ValidationDraft, ValidationOperator } from './types.js';
4
+ /** The overridable chrome a validation editor uses; no document text lives here. */
5
+ export interface ValidationEditorLabels {
6
+ readonly field: string;
7
+ readonly operator: string;
8
+ readonly operandMode: string;
9
+ readonly valueMode: string;
10
+ readonly fieldMode: string;
11
+ readonly listMode: string;
12
+ readonly tableMode: string;
13
+ readonly value: string;
14
+ readonly chooseField: string;
15
+ readonly chooseListField: string;
16
+ readonly chooseTable: string;
17
+ readonly addValue: string;
18
+ readonly removeValue: (index: number) => string;
19
+ readonly lower: string;
20
+ readonly upper: string;
21
+ readonly pattern: string;
22
+ readonly patternPlaceholder: string;
23
+ readonly advanced: string;
24
+ readonly expression: string;
25
+ readonly expressionValid: string;
26
+ readonly expressionInvalid: string;
27
+ readonly noFields: string;
28
+ readonly noneNeeded: string;
29
+ readonly emptyList: string;
30
+ readonly chooseValue: string;
31
+ readonly yes: string;
32
+ readonly no: string;
33
+ readonly placeholder: (primitive: RuleField['primitive']) => string | undefined;
34
+ readonly problem: (problem: ExpressionProblem) => string;
35
+ readonly operators: Readonly<Partial<Record<ValidationOperator, string>>>;
36
+ }
37
+ /** One editor's props: a draft in, a changed draft out, and the context it is checked against. */
38
+ export interface ValidationEditorProps {
39
+ readonly value: ValidationDraft;
40
+ readonly context: RuleContext;
41
+ readonly onChange: (draft: ValidationDraft) => void;
42
+ readonly labels?: Partial<ValidationEditorLabels> | undefined;
43
+ readonly referencePickerLabels?: Partial<ReferencePickerLabels> | undefined;
44
+ readonly disabled?: boolean | undefined;
45
+ readonly id?: string | undefined;
46
+ readonly className?: string | undefined;
47
+ /** Hide the expression preview inside a condition tree, where the parent shows one. */
48
+ readonly showExpression?: boolean | undefined;
49
+ }
50
+ /**
51
+ * One field's validation, with an operand editor shaped by the operator.
52
+ *
53
+ * The draft is controlled: every edit calls `onChange` with a complete next draft, and the
54
+ * operator/field combination is kept valid by falling back to an operator the field supports.
55
+ * The expression preview is the printer's canonical source and, when the draft is complete, the
56
+ * compiler's verdict on it. `ReferencePicker` is how an author names another field by its label
57
+ * rather than typing `f_total_area_sqm`.
58
+ */
59
+ export declare function ValidationEditor(props: ValidationEditorProps): ReactElement;
60
+ //# sourceMappingURL=ValidationEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationEditor.d.ts","sourceRoot":"","sources":["../../src/rules/ValidationEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAO7E,OAAO,KAAK,EACV,iBAAiB,EAEjB,WAAW,EACX,SAAS,EACT,eAAe,EACf,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAGpB,oFAAoF;AACpF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;I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