@thunderid/react 1.15.1 → 1.17.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/cjs/components/management/AgentCreate/AgentCreate.cjs.map +1 -1
- package/dist/cjs/components/management/AgentDetails/BaseAgentDetails.cjs +1 -1
- package/dist/cjs/components/management/AgentDetails/BaseAgentDetails.cjs.map +1 -1
- package/dist/cjs/components/management/FlowVariables/BaseFlowVariables.cjs +210 -0
- package/dist/cjs/components/management/FlowVariables/BaseFlowVariables.cjs.map +1 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariableField.cjs +162 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariableField.cjs.map +1 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariables.styles.cjs +123 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariables.styles.cjs.map +1 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariablesForm.cjs +50 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariablesForm.cjs.map +1 -0
- package/dist/cjs/components/management/SharedFlowList/BaseSharedFlowList.cjs +78 -0
- package/dist/cjs/components/management/SharedFlowList/BaseSharedFlowList.cjs.map +1 -0
- package/dist/cjs/components/management/SharedFlowList/SharedFlowList.cjs +69 -0
- package/dist/cjs/components/management/SharedFlowList/SharedFlowList.cjs.map +1 -0
- package/dist/cjs/hooks/management/useFlowVariables.cjs +107 -0
- package/dist/cjs/hooks/management/useFlowVariables.cjs.map +1 -0
- package/dist/cjs/index.cjs +48 -0
- package/dist/components/management/AgentCreate/AgentCreate.d.ts +2 -2
- package/dist/components/management/AgentCreate/AgentCreate.d.ts.map +1 -1
- package/dist/components/management/AgentCreate/AgentCreate.js.map +1 -1
- package/dist/components/management/AgentDetails/BaseAgentDetails.js +1 -1
- package/dist/components/management/AgentDetails/BaseAgentDetails.js.map +1 -1
- package/dist/components/management/FlowVariables/BaseFlowVariables.d.ts +124 -0
- package/dist/components/management/FlowVariables/BaseFlowVariables.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/BaseFlowVariables.js +206 -0
- package/dist/components/management/FlowVariables/BaseFlowVariables.js.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariableField.d.ts +46 -0
- package/dist/components/management/FlowVariables/FlowVariableField.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariableField.js +158 -0
- package/dist/components/management/FlowVariables/FlowVariableField.js.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.d.ts +11 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.js +121 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.js.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.d.ts +30 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.js +47 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.js.map +1 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.d.ts +53 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.d.ts.map +1 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.js +76 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.js.map +1 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.d.ts +32 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.d.ts.map +1 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.js +65 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.js.map +1 -0
- package/dist/hooks/management/useFlowVariables.d.ts +84 -0
- package/dist/hooks/management/useFlowVariables.d.ts.map +1 -0
- package/dist/hooks/management/useFlowVariables.js +104 -0
- package/dist/hooks/management/useFlowVariables.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/package.json +2 -2
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { cx } from "../../../styles/emotion.js";
|
|
2
|
+
import useTheme_default from "../../../contexts/Theme/useTheme.js";
|
|
3
|
+
import useTranslation_default from "../../../hooks/useTranslation.js";
|
|
4
|
+
import Toggle_default from "../../primitives/Toggle/Toggle.js";
|
|
5
|
+
import TextField_default from "../../primitives/TextField/TextField.js";
|
|
6
|
+
import Select_default from "../../primitives/Select/Select.js";
|
|
7
|
+
import FlowVariables_styles_default from "./FlowVariables.styles.js";
|
|
8
|
+
import { bem, withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
9
|
+
import { useId } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
//#region src/components/management/FlowVariables/FlowVariableField.tsx
|
|
13
|
+
const INPUT_TYPES = {
|
|
14
|
+
DATE_INPUT: "date",
|
|
15
|
+
EMAIL_INPUT: "email",
|
|
16
|
+
NUMBER_INPUT: "number",
|
|
17
|
+
PHONE_INPUT: "tel",
|
|
18
|
+
TEXT_INPUT: "text"
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* One variable as the delegated admin sees it, in a card: its label and description, whether it is customized
|
|
22
|
+
* or follows the default, the input its type calls for, and what the default is. A variable the unit may not set
|
|
23
|
+
* is shown as set by its owner.
|
|
24
|
+
*/
|
|
25
|
+
const FlowVariableField = ({ action, className, defaultValue, definition, disabled, editable = true, error, hint, onChange, options = [], ownerName, value }) => {
|
|
26
|
+
const { theme, colorScheme } = useTheme_default();
|
|
27
|
+
const styles = FlowVariables_styles_default(theme, colorScheme);
|
|
28
|
+
const { t } = useTranslation_default();
|
|
29
|
+
const id = useId();
|
|
30
|
+
const descriptionId = definition.description ? `${id}-description` : void 0;
|
|
31
|
+
const label = definition.label ?? definition.identifier;
|
|
32
|
+
const isSelect = definition.type === "SELECT" || definition.type === "CONNECTION_SELECT";
|
|
33
|
+
const isDefault = value === defaultValue;
|
|
34
|
+
const display = (shown) => {
|
|
35
|
+
if (shown === void 0) return "";
|
|
36
|
+
if (typeof shown === "boolean") return t(shown ? "admin.flowVariables.on" : "admin.flowVariables.off");
|
|
37
|
+
return isSelect ? options.find((option) => String(option.value) === String(shown))?.label ?? String(shown) : String(shown);
|
|
38
|
+
};
|
|
39
|
+
const renderControl = () => {
|
|
40
|
+
switch (definition.type) {
|
|
41
|
+
case "BOOLEAN_INPUT": return /* @__PURE__ */ jsx(Toggle_default, {
|
|
42
|
+
id,
|
|
43
|
+
"aria-label": label,
|
|
44
|
+
"aria-describedby": descriptionId,
|
|
45
|
+
checked: value === true,
|
|
46
|
+
disabled: disabled === true || !editable,
|
|
47
|
+
error,
|
|
48
|
+
onChange: (event) => onChange(event.target.checked)
|
|
49
|
+
});
|
|
50
|
+
case "SELECT":
|
|
51
|
+
case "CONNECTION_SELECT": {
|
|
52
|
+
const handleSelect = (event) => {
|
|
53
|
+
const chosen = (definition.options ?? []).find((option) => String(option) === event.target.value);
|
|
54
|
+
onChange(event.target.value === "" && defaultValue !== void 0 ? defaultValue : chosen ?? event.target.value);
|
|
55
|
+
};
|
|
56
|
+
return /* @__PURE__ */ jsx(Select_default, {
|
|
57
|
+
id,
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
"aria-describedby": descriptionId,
|
|
60
|
+
disabled,
|
|
61
|
+
emptyText: t("admin.flowVariables.no_options"),
|
|
62
|
+
error,
|
|
63
|
+
options,
|
|
64
|
+
placeholder: defaultValue === void 0 || defaultValue === "" ? t("admin.flowVariables.select_placeholder") : t("admin.flowVariables.use_default", { default: display(defaultValue) }),
|
|
65
|
+
value: isDefault || value === void 0 ? "" : String(value),
|
|
66
|
+
onChange: handleSelect
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
default: return /* @__PURE__ */ jsx(TextField_default, {
|
|
70
|
+
id,
|
|
71
|
+
"aria-label": label,
|
|
72
|
+
"aria-describedby": descriptionId,
|
|
73
|
+
disabled,
|
|
74
|
+
error,
|
|
75
|
+
max: definition.max,
|
|
76
|
+
min: definition.min,
|
|
77
|
+
placeholder: defaultValue === void 0 || defaultValue === "" ? t("admin.flowVariables.enter_value") : display(defaultValue),
|
|
78
|
+
type: INPUT_TYPES[definition.type] ?? "text",
|
|
79
|
+
value: value === void 0 ? "" : String(value),
|
|
80
|
+
onChange: (event) => {
|
|
81
|
+
const raw = event.target.value;
|
|
82
|
+
onChange(definition.type === "NUMBER_INPUT" && raw !== "" && !Number.isNaN(Number(raw)) ? Number(raw) : raw);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
88
|
+
className: cx(withVendorCSSClassPrefix(bem("flow-variables", "field")), withVendorCSSClassPrefix(bem("flow-variables", "field", definition.type.toLowerCase())), styles["card"], !editable && styles["cardLocked"], className),
|
|
89
|
+
"data-variable": definition.identifier,
|
|
90
|
+
"data-editable": editable,
|
|
91
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
92
|
+
className: styles["header"],
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: styles["headerText"],
|
|
96
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
97
|
+
htmlFor: id,
|
|
98
|
+
className: styles["label"],
|
|
99
|
+
children: label
|
|
100
|
+
}), definition.description && /* @__PURE__ */ jsx("p", {
|
|
101
|
+
id: descriptionId,
|
|
102
|
+
className: styles["description"],
|
|
103
|
+
children: definition.description
|
|
104
|
+
})]
|
|
105
|
+
}),
|
|
106
|
+
editable && !isDefault && /* @__PURE__ */ jsx("span", {
|
|
107
|
+
className: styles["chipCustomized"],
|
|
108
|
+
"data-testid": "flow-variable-status",
|
|
109
|
+
children: t("admin.flowVariables.status.customized")
|
|
110
|
+
}),
|
|
111
|
+
action
|
|
112
|
+
]
|
|
113
|
+
}), editable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
114
|
+
renderControl(),
|
|
115
|
+
hint && /* @__PURE__ */ jsx("p", {
|
|
116
|
+
className: styles["hint"],
|
|
117
|
+
children: hint
|
|
118
|
+
}),
|
|
119
|
+
!isDefault && defaultValue !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
120
|
+
className: styles["hint"],
|
|
121
|
+
children: t("admin.flowVariables.default_hint", { default: display(defaultValue) })
|
|
122
|
+
})
|
|
123
|
+
] }) : /* @__PURE__ */ jsxs("div", {
|
|
124
|
+
className: styles["lockedLine"],
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
127
|
+
width: "16",
|
|
128
|
+
height: "16",
|
|
129
|
+
viewBox: "0 0 24 24",
|
|
130
|
+
fill: "none",
|
|
131
|
+
stroke: "currentColor",
|
|
132
|
+
strokeWidth: "1.7",
|
|
133
|
+
strokeLinecap: "round",
|
|
134
|
+
strokeLinejoin: "round",
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
137
|
+
x: "5",
|
|
138
|
+
y: "11",
|
|
139
|
+
width: "14",
|
|
140
|
+
height: "9",
|
|
141
|
+
rx: "2"
|
|
142
|
+
}), /* @__PURE__ */ jsx("path", { d: "M8 11V8a4 4 0 018 0v3" })]
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
145
|
+
t("admin.flowVariables.locked", { owner: ownerName ?? t("admin.flowVariables.owner_fallback") }),
|
|
146
|
+
" · ",
|
|
147
|
+
display(value)
|
|
148
|
+
] }),
|
|
149
|
+
definition.type === "BOOLEAN_INPUT" && renderControl()
|
|
150
|
+
]
|
|
151
|
+
})]
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
var FlowVariableField_default = FlowVariableField;
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
export { FlowVariableField_default as default };
|
|
158
|
+
//# sourceMappingURL=FlowVariableField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowVariableField.js","names":["INPUT_TYPES: Partial<Record<FlowVariableDefinition['type'], string>>","FlowVariableField: FC<FlowVariableFieldProps>","useTheme","styles: Record<string, string>","useStyles","useTranslation","id: string","descriptionId: string | undefined","label: string","isSelect: boolean","isDefault: boolean","Toggle","chosen: FlowVariableValue | undefined","Select","TextField","raw: string"],"sources":["../../../../src/components/management/FlowVariables/FlowVariableField.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n FlowVariableDefinition,\n FlowVariableValue,\n SelectOption,\n bem,\n withVendorCSSClassPrefix,\n} from '@thunderid/browser';\nimport {ChangeEvent, FC, ReactElement, ReactNode, useId} from 'react';\nimport useStyles from './FlowVariables.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../hooks/useTranslation';\nimport {cx} from '../../../styles/emotion';\nimport Select from '../../primitives/Select/Select';\nimport TextField from '../../primitives/TextField/TextField';\nimport Toggle from '../../primitives/Toggle/Toggle';\n\nexport interface FlowVariableFieldProps {\n /**\n * Extra content at the end of the label row, such as a control a host adds while the variable is being designed.\n */\n action?: ReactNode;\n className?: string;\n /**\n * The value the variable has until the unit sets its own, which a sharing policy may have set.\n */\n defaultValue?: FlowVariableValue;\n definition: FlowVariableDefinition;\n disabled?: boolean;\n /**\n * Whether the unit may set its own value. A variable it may not set is shown as set by its owner.\n * @default true\n */\n editable?: boolean;\n /**\n * The error to show under the field.\n */\n error?: string;\n /**\n * Extra text under the input, such as where the choices come from.\n */\n hint?: ReactNode;\n onChange: (value: FlowVariableValue) => void;\n /**\n * The choices of a `SELECT` or `CONNECTION_SELECT`, as {@link getFlowVariableOptions} returns them.\n */\n options?: SelectOption[];\n /**\n * Who set the variable, shown while it is not editable.\n */\n ownerName?: string;\n value: FlowVariableValue | undefined;\n}\n\nconst INPUT_TYPES: Partial<Record<FlowVariableDefinition['type'], string>> = {\n DATE_INPUT: 'date',\n EMAIL_INPUT: 'email',\n NUMBER_INPUT: 'number',\n PHONE_INPUT: 'tel',\n TEXT_INPUT: 'text',\n};\n\n/**\n * One variable as the delegated admin sees it, in a card: its label and description, whether it is customized\n * or follows the default, the input its type calls for, and what the default is. A variable the unit may not set\n * is shown as set by its owner.\n */\nconst FlowVariableField: FC<FlowVariableFieldProps> = ({\n action,\n className,\n defaultValue,\n definition,\n disabled,\n editable = true,\n error,\n hint,\n onChange,\n options = [],\n ownerName,\n value,\n}: FlowVariableFieldProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const {t} = useTranslation();\n const id: string = useId();\n const descriptionId: string | undefined = definition.description ? `${id}-description` : undefined;\n const label: string = definition.label ?? definition.identifier;\n const isSelect: boolean = definition.type === 'SELECT' || definition.type === 'CONNECTION_SELECT';\n const isDefault: boolean = value === defaultValue;\n\n const display = (shown: FlowVariableValue | undefined): string => {\n if (shown === undefined) {\n return '';\n }\n if (typeof shown === 'boolean') {\n return t(shown ? 'admin.flowVariables.on' : 'admin.flowVariables.off');\n }\n\n return isSelect\n ? (options.find((option: SelectOption) => String(option.value) === String(shown))?.label ?? String(shown))\n : String(shown);\n };\n\n const renderControl = (): ReactElement => {\n switch (definition.type) {\n case 'BOOLEAN_INPUT':\n return (\n <Toggle\n id={id}\n aria-label={label}\n aria-describedby={descriptionId}\n checked={value === true}\n disabled={disabled === true || !editable}\n error={error}\n onChange={(event: ChangeEvent<HTMLInputElement>): void => onChange(event.target.checked)}\n />\n );\n case 'SELECT':\n case 'CONNECTION_SELECT': {\n const handleSelect = (event: ChangeEvent<HTMLSelectElement>): void => {\n const chosen: FlowVariableValue | undefined = (definition.options ?? []).find(\n (option: FlowVariableValue) => String(option) === event.target.value,\n );\n\n // The first entry, the default, clears the choice.\n onChange(\n event.target.value === '' && defaultValue !== undefined ? defaultValue : (chosen ?? event.target.value),\n );\n };\n\n return (\n <Select\n id={id}\n aria-label={label}\n aria-describedby={descriptionId}\n disabled={disabled}\n emptyText={t('admin.flowVariables.no_options')}\n error={error}\n options={options}\n placeholder={\n defaultValue === undefined || defaultValue === ''\n ? t('admin.flowVariables.select_placeholder')\n : t('admin.flowVariables.use_default', {default: display(defaultValue)})\n }\n value={isDefault || value === undefined ? '' : String(value)}\n onChange={handleSelect}\n />\n );\n }\n default:\n return (\n <TextField\n id={id}\n aria-label={label}\n aria-describedby={descriptionId}\n disabled={disabled}\n error={error}\n max={definition.max}\n min={definition.min}\n placeholder={\n defaultValue === undefined || defaultValue === ''\n ? t('admin.flowVariables.enter_value')\n : display(defaultValue)\n }\n type={INPUT_TYPES[definition.type] ?? 'text'}\n value={value === undefined ? '' : String(value)}\n onChange={(event: ChangeEvent<HTMLInputElement>): void => {\n const raw: string = event.target.value;\n\n onChange(\n definition.type === 'NUMBER_INPUT' && raw !== '' && !Number.isNaN(Number(raw)) ? Number(raw) : raw,\n );\n }}\n />\n );\n }\n };\n\n return (\n <section\n className={cx(\n withVendorCSSClassPrefix(bem('flow-variables', 'field')),\n withVendorCSSClassPrefix(bem('flow-variables', 'field', definition.type.toLowerCase())),\n styles['card'],\n !editable && styles['cardLocked'],\n className,\n )}\n data-variable={definition.identifier}\n data-editable={editable}\n >\n <div className={styles['header']}>\n <div className={styles['headerText']}>\n <label htmlFor={id} className={styles['label']}>\n {label}\n </label>\n {definition.description && (\n <p id={descriptionId} className={styles['description']}>\n {definition.description}\n </p>\n )}\n </div>\n {editable && !isDefault && (\n <span className={styles['chipCustomized']} data-testid=\"flow-variable-status\">\n {t('admin.flowVariables.status.customized')}\n </span>\n )}\n {action}\n </div>\n {editable ? (\n <>\n {renderControl()}\n {hint && <p className={styles['hint']}>{hint}</p>}\n {!isDefault && defaultValue !== undefined && (\n <p className={styles['hint']}>{t('admin.flowVariables.default_hint', {default: display(defaultValue)})}</p>\n )}\n </>\n ) : (\n <div className={styles['lockedLine']}>\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.7\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect x=\"5\" y=\"11\" width=\"14\" height=\"9\" rx=\"2\" />\n <path d=\"M8 11V8a4 4 0 018 0v3\" />\n </svg>\n <span>\n {t('admin.flowVariables.locked', {owner: ownerName ?? t('admin.flowVariables.owner_fallback')})}\n {' · '}\n {display(value)}\n </span>\n {definition.type === 'BOOLEAN_INPUT' && renderControl()}\n </div>\n )}\n </section>\n );\n};\n\nexport default FlowVariableField;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Theme } from '@thunderid/browser';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the styles of the flow variables form.
|
|
4
|
+
*
|
|
5
|
+
* @param theme - The theme object containing design tokens.
|
|
6
|
+
* @param colorScheme - The current color scheme, used for memoization.
|
|
7
|
+
* @returns The CSS class names for each part.
|
|
8
|
+
*/
|
|
9
|
+
declare const useStyles: (theme: Theme, colorScheme: string) => Record<string, string>;
|
|
10
|
+
export default useStyles;
|
|
11
|
+
//# sourceMappingURL=FlowVariables.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowVariables.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/management/FlowVariables/FlowVariables.styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAIzC;;;;;;GAMG;AACH,QAAA,MAAM,SAAS,GAAI,OAAO,KAAK,EAAE,aAAa,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CA0GlD,CAAC;AAE3B,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { css } from "../../../styles/emotion.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/management/FlowVariables/FlowVariables.styles.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates the styles of the flow variables form.
|
|
7
|
+
*
|
|
8
|
+
* @param theme - The theme object containing design tokens.
|
|
9
|
+
* @param colorScheme - The current color scheme, used for memoization.
|
|
10
|
+
* @returns The CSS class names for each part.
|
|
11
|
+
*/
|
|
12
|
+
const useStyles = (theme, colorScheme) => useMemo(() => {
|
|
13
|
+
const unit = theme.vars.spacing.unit;
|
|
14
|
+
const chip = css`
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
padding: 2px calc(${unit} * 1.25);
|
|
19
|
+
border-radius: 999px;
|
|
20
|
+
border: 1px solid ${theme.vars.colors.border};
|
|
21
|
+
font-size: ${theme.vars.typography.fontSizes.xs};
|
|
22
|
+
font-weight: ${theme.vars.typography.fontWeights.medium};
|
|
23
|
+
color: ${theme.vars.colors.text.secondary};
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
`;
|
|
26
|
+
return {
|
|
27
|
+
actions: css`
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: ${unit};
|
|
31
|
+
`,
|
|
32
|
+
actionsSpacer: css`
|
|
33
|
+
flex-grow: 1;
|
|
34
|
+
`,
|
|
35
|
+
card: css`
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: calc(${unit} * 2);
|
|
39
|
+
padding: calc(${unit} * 2.5) calc(${unit} * 3);
|
|
40
|
+
background: ${theme.vars.colors.background.surface};
|
|
41
|
+
border: 1px solid ${theme.vars.colors.border};
|
|
42
|
+
border-radius: ${theme.vars.borderRadius.large};
|
|
43
|
+
`,
|
|
44
|
+
cardLocked: css`
|
|
45
|
+
background: ${theme.vars.colors.background.disabled};
|
|
46
|
+
`,
|
|
47
|
+
chip,
|
|
48
|
+
chipCustomized: css`
|
|
49
|
+
${chip}
|
|
50
|
+
border-color: ${theme.vars.colors.success.main};
|
|
51
|
+
color: ${theme.vars.colors.success.main};
|
|
52
|
+
`,
|
|
53
|
+
description: css`
|
|
54
|
+
margin: calc(${unit} / 4) 0 0;
|
|
55
|
+
color: ${theme.vars.colors.text.secondary};
|
|
56
|
+
font-size: ${theme.vars.typography.fontSizes.sm};
|
|
57
|
+
`,
|
|
58
|
+
empty: css`
|
|
59
|
+
margin: 0;
|
|
60
|
+
color: ${theme.vars.colors.text.secondary};
|
|
61
|
+
`,
|
|
62
|
+
form: css`
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
gap: calc(${unit} * 2.5);
|
|
66
|
+
max-width: 880px;
|
|
67
|
+
`,
|
|
68
|
+
header: css`
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: flex-start;
|
|
71
|
+
gap: calc(${unit} * 1.5);
|
|
72
|
+
`,
|
|
73
|
+
headerText: css`
|
|
74
|
+
flex-grow: 1;
|
|
75
|
+
min-width: 0;
|
|
76
|
+
`,
|
|
77
|
+
hint: css`
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-wrap: wrap;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: calc(${unit} * 1.25);
|
|
82
|
+
margin: 0;
|
|
83
|
+
color: ${theme.vars.colors.text.secondary};
|
|
84
|
+
font-size: ${theme.vars.typography.fontSizes.xs};
|
|
85
|
+
`,
|
|
86
|
+
label: css`
|
|
87
|
+
font-size: ${theme.vars.typography.fontSizes.md};
|
|
88
|
+
font-weight: ${theme.vars.typography.fontWeights.medium};
|
|
89
|
+
color: ${theme.vars.colors.text.primary};
|
|
90
|
+
`,
|
|
91
|
+
link: css`
|
|
92
|
+
padding: 0;
|
|
93
|
+
border: 0;
|
|
94
|
+
background: none;
|
|
95
|
+
font: inherit;
|
|
96
|
+
font-weight: ${theme.vars.typography.fontWeights.medium};
|
|
97
|
+
color: ${theme.vars.colors.primary.main};
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
&:hover {
|
|
100
|
+
text-decoration: underline;
|
|
101
|
+
}
|
|
102
|
+
`,
|
|
103
|
+
lockedLine: css`
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: calc(${unit} * 1.25);
|
|
107
|
+
color: ${theme.vars.colors.text.secondary};
|
|
108
|
+
font-size: ${theme.vars.typography.fontSizes.sm};
|
|
109
|
+
`,
|
|
110
|
+
scope: css`
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: calc(${unit} * 1.5);
|
|
114
|
+
`
|
|
115
|
+
};
|
|
116
|
+
}, [theme, colorScheme]);
|
|
117
|
+
var FlowVariables_styles_default = useStyles;
|
|
118
|
+
|
|
119
|
+
//#endregion
|
|
120
|
+
export { FlowVariables_styles_default as default };
|
|
121
|
+
//# sourceMappingURL=FlowVariables.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowVariables.styles.js","names":["unit: string","chip: string"],"sources":["../../../../src/components/management/FlowVariables/FlowVariables.styles.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates the styles of the flow variables form.\n *\n * @param theme - The theme object containing design tokens.\n * @param colorScheme - The current color scheme, used for memoization.\n * @returns The CSS class names for each part.\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const unit: string = theme.vars.spacing.unit;\n const chip: string = css`\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n padding: 2px calc(${unit} * 1.25);\n border-radius: 999px;\n border: 1px solid ${theme.vars.colors.border};\n font-size: ${theme.vars.typography.fontSizes.xs};\n font-weight: ${theme.vars.typography.fontWeights.medium};\n color: ${theme.vars.colors.text.secondary};\n white-space: nowrap;\n `;\n\n return {\n actions: css`\n display: flex;\n align-items: center;\n gap: ${unit};\n `,\n actionsSpacer: css`\n flex-grow: 1;\n `,\n card: css`\n display: flex;\n flex-direction: column;\n gap: calc(${unit} * 2);\n padding: calc(${unit} * 2.5) calc(${unit} * 3);\n background: ${theme.vars.colors.background.surface};\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.large};\n `,\n cardLocked: css`\n background: ${theme.vars.colors.background.disabled};\n `,\n chip,\n chipCustomized: css`\n ${chip}\n border-color: ${theme.vars.colors.success.main};\n color: ${theme.vars.colors.success.main};\n `,\n description: css`\n margin: calc(${unit} / 4) 0 0;\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n `,\n empty: css`\n margin: 0;\n color: ${theme.vars.colors.text.secondary};\n `,\n form: css`\n display: flex;\n flex-direction: column;\n gap: calc(${unit} * 2.5);\n max-width: 880px;\n `,\n header: css`\n display: flex;\n align-items: flex-start;\n gap: calc(${unit} * 1.5);\n `,\n headerText: css`\n flex-grow: 1;\n min-width: 0;\n `,\n hint: css`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: calc(${unit} * 1.25);\n margin: 0;\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.xs};\n `,\n label: css`\n font-size: ${theme.vars.typography.fontSizes.md};\n font-weight: ${theme.vars.typography.fontWeights.medium};\n color: ${theme.vars.colors.text.primary};\n `,\n link: css`\n padding: 0;\n border: 0;\n background: none;\n font: inherit;\n font-weight: ${theme.vars.typography.fontWeights.medium};\n color: ${theme.vars.colors.primary.main};\n cursor: pointer;\n &:hover {\n text-decoration: underline;\n }\n `,\n lockedLine: css`\n display: flex;\n align-items: center;\n gap: calc(${unit} * 1.25);\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n `,\n scope: css`\n display: flex;\n align-items: center;\n gap: calc(${unit} * 1.5);\n `,\n };\n }, [theme, colorScheme]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,aAAa,OAAc,gBAC/B,cAAc;CACZ,MAAMA,OAAe,MAAM,KAAK,QAAQ;CACxC,MAAMC,OAAe,GAAG;;;;0BAIF,KAAK;;0BAEL,MAAM,KAAK,OAAO,OAAO;mBAChC,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,YAAY,OAAO;eAC/C,MAAM,KAAK,OAAO,KAAK,UAAU;;;AAI5C,QAAO;EACL,SAAS,GAAG;;;eAGH,KAAK;;EAEd,eAAe,GAAG;;;EAGlB,MAAM,GAAG;;;oBAGK,KAAK;wBACD,KAAK,eAAe,KAAK;sBAC3B,MAAM,KAAK,OAAO,WAAW,QAAQ;4BAC/B,MAAM,KAAK,OAAO,OAAO;yBAC5B,MAAM,KAAK,aAAa,MAAM;;EAEjD,YAAY,GAAG;sBACC,MAAM,KAAK,OAAO,WAAW,SAAS;;EAEtD;EACA,gBAAgB,GAAG;UACf,KAAK;wBACS,MAAM,KAAK,OAAO,QAAQ,KAAK;iBACtC,MAAM,KAAK,OAAO,QAAQ,KAAK;;EAE1C,aAAa,GAAG;uBACC,KAAK;iBACX,MAAM,KAAK,OAAO,KAAK,UAAU;qBAC7B,MAAM,KAAK,WAAW,UAAU,GAAG;;EAElD,OAAO,GAAG;;iBAEC,MAAM,KAAK,OAAO,KAAK,UAAU;;EAE5C,MAAM,GAAG;;;oBAGK,KAAK;;;EAGnB,QAAQ,GAAG;;;oBAGG,KAAK;;EAEnB,YAAY,GAAG;;;;EAIf,MAAM,GAAG;;;;oBAIK,KAAK;;iBAER,MAAM,KAAK,OAAO,KAAK,UAAU;qBAC7B,MAAM,KAAK,WAAW,UAAU,GAAG;;EAElD,OAAO,GAAG;qBACK,MAAM,KAAK,WAAW,UAAU,GAAG;uBACjC,MAAM,KAAK,WAAW,YAAY,OAAO;iBAC/C,MAAM,KAAK,OAAO,KAAK,QAAQ;;EAE1C,MAAM,GAAG;;;;;uBAKQ,MAAM,KAAK,WAAW,YAAY,OAAO;iBAC/C,MAAM,KAAK,OAAO,QAAQ,KAAK;;;;;;EAM1C,YAAY,GAAG;;;oBAGD,KAAK;iBACR,MAAM,KAAK,OAAO,KAAK,UAAU;qBAC7B,MAAM,KAAK,WAAW,UAAU,GAAG;;EAElD,OAAO,GAAG;;;oBAGI,KAAK;;EAEpB;GACA,CAAC,OAAO,YAAY,CAAC;AAE1B,mCAAe"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FlowVariableValues } from '@thunderid/browser';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { BaseFlowVariablesProps } from './BaseFlowVariables';
|
|
4
|
+
export type FlowVariablesFormProps = Omit<BaseFlowVariablesProps, 'connections' | 'error' | 'initialValues' | 'isSubmitting' | 'onSubmit' | 'overlay' | 'variables'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Identifier of the flow whose variables are configured.
|
|
7
|
+
*/
|
|
8
|
+
flowId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Called with the saved overrides.
|
|
11
|
+
*/
|
|
12
|
+
onSaved?: (values: FlowVariableValues) => void;
|
|
13
|
+
/**
|
|
14
|
+
* The organization unit the overrides belong to.
|
|
15
|
+
*/
|
|
16
|
+
ouId: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Lets a delegated admin override the variables a flow declares for their organization unit. It loads the
|
|
20
|
+
* variables the flow shares with the unit and the values the unit has set, shows them as a form, and saves
|
|
21
|
+
* the values that differ from their defaults.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <FlowVariablesForm flowId={flowId} ouId={ouId} onSaved={() => toast('Saved')} />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare const FlowVariablesForm: FC<FlowVariablesFormProps>;
|
|
29
|
+
export default FlowVariablesForm;
|
|
30
|
+
//# sourceMappingURL=FlowVariablesForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowVariablesForm.d.ts","sourceRoot":"","sources":["../../../../src/components/management/FlowVariables/FlowVariablesForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,kBAAkB,EAA2B,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAC,EAAE,EAAe,MAAM,OAAO,CAAC;AACvC,OAA0B,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAK9E,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,sBAAsB,EACtB,aAAa,GAAG,OAAO,GAAG,eAAe,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAClG,GAAG;IACF;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;GASG;AACH,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAgDjD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import useTranslation_default from "../../../hooks/useTranslation.js";
|
|
2
|
+
import Spinner_default from "../../primitives/Spinner/Spinner.js";
|
|
3
|
+
import BaseFlowVariables_default from "./BaseFlowVariables.js";
|
|
4
|
+
import useFlowVariables_default from "../../../hooks/management/useFlowVariables.js";
|
|
5
|
+
import { toManagementErrorMessage } from "@thunderid/browser";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/management/FlowVariables/FlowVariablesForm.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Lets a delegated admin override the variables a flow declares for their organization unit. It loads the
|
|
11
|
+
* variables the flow shares with the unit and the values the unit has set, shows them as a form, and saves
|
|
12
|
+
* the values that differ from their defaults.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <FlowVariablesForm flowId={flowId} ouId={ouId} onSaved={() => toast('Saved')} />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
const FlowVariablesForm = ({ flowId, onSaved, ouId, preferences, title,...rest }) => {
|
|
20
|
+
const { t } = useTranslation_default(preferences?.i18n);
|
|
21
|
+
const { connections, definitions, error, isLoaded, isSaving, overlay, overrides, save, saveError } = useFlowVariables_default({
|
|
22
|
+
flowId,
|
|
23
|
+
onSaved,
|
|
24
|
+
ouId
|
|
25
|
+
});
|
|
26
|
+
const handleSubmit = (_values, changed) => {
|
|
27
|
+
save(changed);
|
|
28
|
+
};
|
|
29
|
+
if (!isLoaded && !error) return /* @__PURE__ */ jsx(Spinner_default, {});
|
|
30
|
+
return /* @__PURE__ */ jsx(BaseFlowVariables_default, {
|
|
31
|
+
title: title ?? t("admin.flowVariables.title"),
|
|
32
|
+
variables: definitions,
|
|
33
|
+
connections,
|
|
34
|
+
initialValues: overrides,
|
|
35
|
+
overlay,
|
|
36
|
+
isSubmitting: isSaving,
|
|
37
|
+
error: error ? toManagementErrorMessage(t, error, "admin.flowVariables.load_error") : toManagementErrorMessage(t, saveError, "admin.flowVariables.error"),
|
|
38
|
+
onSubmit: handleSubmit,
|
|
39
|
+
preferences,
|
|
40
|
+
...rest
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var FlowVariablesForm_default = FlowVariablesForm;
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { FlowVariablesForm_default as default };
|
|
47
|
+
//# sourceMappingURL=FlowVariablesForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowVariablesForm.js","names":["FlowVariablesForm: FC<FlowVariablesFormProps>","useTranslation","useFlowVariables","Spinner","BaseFlowVariables"],"sources":["../../../../src/components/management/FlowVariables/FlowVariablesForm.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {FlowVariableValues, toManagementErrorMessage} from '@thunderid/browser';\nimport {FC, ReactElement} from 'react';\nimport BaseFlowVariables, {BaseFlowVariablesProps} from './BaseFlowVariables';\nimport useFlowVariables, {UseFlowVariablesResult} from '../../../hooks/management/useFlowVariables';\nimport useTranslation from '../../../hooks/useTranslation';\nimport Spinner from '../../primitives/Spinner/Spinner';\n\nexport type FlowVariablesFormProps = Omit<\n BaseFlowVariablesProps,\n 'connections' | 'error' | 'initialValues' | 'isSubmitting' | 'onSubmit' | 'overlay' | 'variables'\n> & {\n /**\n * Identifier of the flow whose variables are configured.\n */\n flowId: string;\n /**\n * Called with the saved overrides.\n */\n onSaved?: (values: FlowVariableValues) => void;\n /**\n * The organization unit the overrides belong to.\n */\n ouId: string;\n};\n\n/**\n * Lets a delegated admin override the variables a flow declares for their organization unit. It loads the\n * variables the flow shares with the unit and the values the unit has set, shows them as a form, and saves\n * the values that differ from their defaults.\n *\n * @example\n * ```tsx\n * <FlowVariablesForm flowId={flowId} ouId={ouId} onSaved={() => toast('Saved')} />\n * ```\n */\nconst FlowVariablesForm: FC<FlowVariablesFormProps> = ({\n flowId,\n onSaved,\n ouId,\n preferences,\n title,\n ...rest\n}: FlowVariablesFormProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n const {\n connections,\n definitions,\n error,\n isLoaded,\n isSaving,\n overlay,\n overrides,\n save,\n saveError,\n }: UseFlowVariablesResult = useFlowVariables({flowId, onSaved, ouId});\n\n // Only what differs from the default is an override; the rest keeps following the default.\n const handleSubmit = (_values: FlowVariableValues, changed: FlowVariableValues): void => {\n void save(changed);\n };\n\n if (!isLoaded && !error) {\n return <Spinner />;\n }\n\n return (\n <BaseFlowVariables\n title={title ?? t('admin.flowVariables.title')}\n variables={definitions}\n connections={connections}\n initialValues={overrides}\n overlay={overlay}\n isSubmitting={isSaving}\n error={\n error\n ? toManagementErrorMessage(t, error, 'admin.flowVariables.load_error')\n : toManagementErrorMessage(t, saveError, 'admin.flowVariables.error')\n }\n onSubmit={handleSubmit}\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default FlowVariablesForm;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,MAAMA,qBAAiD,EACrD,QACA,SACA,MACA,aACA,MACA,GAAG,WACuC;CAC1C,MAAM,EAAC,MAAKC,uBAAe,aAAa,KAAK;CAC7C,MAAM,EACJ,aACA,aACA,OACA,UACA,UACA,SACA,WACA,MACA,cAC0BC,yBAAiB;EAAC;EAAQ;EAAS;EAAK,CAAC;CAGrE,MAAM,gBAAgB,SAA6B,YAAsC;AACvF,EAAK,KAAK,QAAQ;;AAGpB,KAAI,CAAC,YAAY,CAAC,MAChB,QAAO,oBAACC,oBAAU;AAGpB,QACE,oBAACC;EACC,OAAO,SAAS,EAAE,4BAA4B;EAC9C,WAAW;EACE;EACb,eAAe;EACN;EACT,cAAc;EACd,OACE,QACI,yBAAyB,GAAG,OAAO,iCAAiC,GACpE,yBAAyB,GAAG,WAAW,4BAA4B;EAEzE,UAAU;EACG;EACb,GAAI;GACJ;;AAIN,gCAAe"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ManagedFlow, Preferences } from '@thunderid/browser';
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { AdminListRenderProps } from '../shared/AdminListRenderProps';
|
|
4
|
+
/**
|
|
5
|
+
* What {@link BaseSharedFlowList} hands its `children` render function. `flows` and `rows` are the same array.
|
|
6
|
+
*/
|
|
7
|
+
export type BaseSharedFlowListRenderProps = AdminListRenderProps<ManagedFlow> & {
|
|
8
|
+
flows: ManagedFlow[];
|
|
9
|
+
};
|
|
10
|
+
export interface BaseSharedFlowListProps {
|
|
11
|
+
/**
|
|
12
|
+
* Controls rendered next to the title.
|
|
13
|
+
*/
|
|
14
|
+
actions?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Renders custom UI in place of the default table. Receives the flows, the default columns, the loading and
|
|
17
|
+
* error state, and the pagination and selection handlers.
|
|
18
|
+
*/
|
|
19
|
+
children?: (props: BaseSharedFlowListRenderProps) => ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
error?: string | null;
|
|
23
|
+
flows: ManagedFlow[];
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Page size.
|
|
27
|
+
* @default 20
|
|
28
|
+
*/
|
|
29
|
+
limit?: number;
|
|
30
|
+
offset?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Called with the offset of the page to show. Pagination is hidden when omitted.
|
|
33
|
+
*/
|
|
34
|
+
onPageChange?: (offset: number) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Called when a flow is chosen. Rows are selectable only when set.
|
|
37
|
+
*/
|
|
38
|
+
onSelect?: (flow: ManagedFlow) => void;
|
|
39
|
+
preferences?: Preferences;
|
|
40
|
+
selectedFlowId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Heading of the list. Pass an empty string to hide it.
|
|
43
|
+
*/
|
|
44
|
+
title?: string;
|
|
45
|
+
totalResults?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Lists flows with their handle and type. Holds no data of its own: pass the page of flows and handle selection
|
|
49
|
+
* and pagination.
|
|
50
|
+
*/
|
|
51
|
+
declare const BaseSharedFlowList: FC<BaseSharedFlowListProps>;
|
|
52
|
+
export default BaseSharedFlowList;
|
|
53
|
+
//# sourceMappingURL=BaseSharedFlowList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseSharedFlowList.d.ts","sourceRoot":"","sources":["../../../../src/components/management/SharedFlowList/BaseSharedFlowList.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAC,EAAE,EAAgB,SAAS,EAAC,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,oBAAoB,CAAC,WAAW,CAAC,GAAG;IAC9E,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,SAAS,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAkFnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import useTranslation_default from "../../../hooks/useTranslation.js";
|
|
2
|
+
import DataTable_default from "../../primitives/DataTable/DataTable.js";
|
|
3
|
+
import AdminSection_default from "../shared/AdminSection.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/management/SharedFlowList/BaseSharedFlowList.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Lists flows with their handle and type. Holds no data of its own: pass the page of flows and handle selection
|
|
9
|
+
* and pagination.
|
|
10
|
+
*/
|
|
11
|
+
const BaseSharedFlowList = ({ actions, children, className, description, error = null, flows, isLoading = false, limit = 20, offset = 0, onPageChange, onSelect, preferences, selectedFlowId, title, totalResults }) => {
|
|
12
|
+
const { t } = useTranslation_default(preferences?.i18n);
|
|
13
|
+
const columns = [
|
|
14
|
+
{
|
|
15
|
+
header: t("admin.flows.list.columns.name"),
|
|
16
|
+
id: "name",
|
|
17
|
+
render: (flow) => flow.name
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
header: t("admin.flows.list.columns.handle"),
|
|
21
|
+
id: "handle",
|
|
22
|
+
render: (flow) => flow.handle ? /* @__PURE__ */ jsx("code", { children: flow.handle }) : null
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
header: t("admin.flows.list.columns.type"),
|
|
26
|
+
id: "type",
|
|
27
|
+
render: (flow) => flow.flowType
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
if (children) return /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className,
|
|
32
|
+
children: children({
|
|
33
|
+
columns,
|
|
34
|
+
error,
|
|
35
|
+
flows,
|
|
36
|
+
isLoading,
|
|
37
|
+
limit,
|
|
38
|
+
offset,
|
|
39
|
+
onPageChange,
|
|
40
|
+
onSelect,
|
|
41
|
+
rows: flows,
|
|
42
|
+
selectedRowId: selectedFlowId,
|
|
43
|
+
totalResults: totalResults ?? flows.length
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
return /* @__PURE__ */ jsx(AdminSection_default, {
|
|
47
|
+
block: "shared-flow-list",
|
|
48
|
+
className,
|
|
49
|
+
title: title ?? t("admin.flows.list.title"),
|
|
50
|
+
description,
|
|
51
|
+
actions,
|
|
52
|
+
preferences,
|
|
53
|
+
children: /* @__PURE__ */ jsx(DataTable_default, {
|
|
54
|
+
caption: title?.length ? title : t("admin.flows.list.title"),
|
|
55
|
+
columns,
|
|
56
|
+
rows: flows,
|
|
57
|
+
getRowId: (flow) => flow.id,
|
|
58
|
+
isLoading,
|
|
59
|
+
error,
|
|
60
|
+
emptyText: t("admin.flows.list.empty"),
|
|
61
|
+
onRowClick: onSelect,
|
|
62
|
+
selectedRowId: selectedFlowId,
|
|
63
|
+
pagination: onPageChange ? {
|
|
64
|
+
limit,
|
|
65
|
+
offset,
|
|
66
|
+
onChange: onPageChange,
|
|
67
|
+
total: totalResults ?? flows.length
|
|
68
|
+
} : void 0
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
var BaseSharedFlowList_default = BaseSharedFlowList;
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { BaseSharedFlowList_default as default };
|
|
76
|
+
//# sourceMappingURL=BaseSharedFlowList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseSharedFlowList.js","names":["BaseSharedFlowList: FC<BaseSharedFlowListProps>","useTranslation","columns: DataTableColumn<ManagedFlow>[]","AdminSection","DataTable"],"sources":["../../../../src/components/management/SharedFlowList/BaseSharedFlowList.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ManagedFlow, Preferences} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\nimport useTranslation from '../../../hooks/useTranslation';\nimport DataTable, {DataTableColumn} from '../../primitives/DataTable/DataTable';\nimport {AdminListRenderProps} from '../shared/AdminListRenderProps';\nimport AdminSection from '../shared/AdminSection';\n\n/**\n * What {@link BaseSharedFlowList} hands its `children` render function. `flows` and `rows` are the same array.\n */\nexport type BaseSharedFlowListRenderProps = AdminListRenderProps<ManagedFlow> & {\n flows: ManagedFlow[];\n};\n\nexport interface BaseSharedFlowListProps {\n /**\n * Controls rendered next to the title.\n */\n actions?: ReactNode;\n /**\n * Renders custom UI in place of the default table. Receives the flows, the default columns, the loading and\n * error state, and the pagination and selection handlers.\n */\n children?: (props: BaseSharedFlowListRenderProps) => ReactNode;\n className?: string;\n description?: string;\n error?: string | null;\n flows: ManagedFlow[];\n isLoading?: boolean;\n /**\n * Page size.\n * @default 20\n */\n limit?: number;\n offset?: number;\n /**\n * Called with the offset of the page to show. Pagination is hidden when omitted.\n */\n onPageChange?: (offset: number) => void;\n /**\n * Called when a flow is chosen. Rows are selectable only when set.\n */\n onSelect?: (flow: ManagedFlow) => void;\n preferences?: Preferences;\n selectedFlowId?: string;\n /**\n * Heading of the list. Pass an empty string to hide it.\n */\n title?: string;\n totalResults?: number;\n}\n\n/**\n * Lists flows with their handle and type. Holds no data of its own: pass the page of flows and handle selection\n * and pagination.\n */\nconst BaseSharedFlowList: FC<BaseSharedFlowListProps> = ({\n actions,\n children,\n className,\n description,\n error = null,\n flows,\n isLoading = false,\n limit = 20,\n offset = 0,\n onPageChange,\n onSelect,\n preferences,\n selectedFlowId,\n title,\n totalResults,\n}: BaseSharedFlowListProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n\n const columns: DataTableColumn<ManagedFlow>[] = [\n {\n header: t('admin.flows.list.columns.name'),\n id: 'name',\n render: (flow: ManagedFlow): ReactNode => flow.name,\n },\n {\n header: t('admin.flows.list.columns.handle'),\n id: 'handle',\n render: (flow: ManagedFlow): ReactNode => (flow.handle ? <code>{flow.handle}</code> : null),\n },\n {\n header: t('admin.flows.list.columns.type'),\n id: 'type',\n render: (flow: ManagedFlow): ReactNode => flow.flowType,\n },\n ];\n\n if (children) {\n return (\n <div className={className}>\n {children({\n columns,\n error,\n flows,\n isLoading,\n limit,\n offset,\n onPageChange,\n onSelect,\n rows: flows,\n selectedRowId: selectedFlowId,\n totalResults: totalResults ?? flows.length,\n })}\n </div>\n );\n }\n\n return (\n <AdminSection\n block=\"shared-flow-list\"\n className={className}\n title={title ?? t('admin.flows.list.title')}\n description={description}\n actions={actions}\n preferences={preferences}\n >\n <DataTable\n caption={title?.length ? title : t('admin.flows.list.title')}\n columns={columns}\n rows={flows}\n getRowId={(flow: ManagedFlow): string => flow.id}\n isLoading={isLoading}\n error={error}\n emptyText={t('admin.flows.list.empty')}\n onRowClick={onSelect}\n selectedRowId={selectedFlowId}\n pagination={\n onPageChange ? {limit, offset, onChange: onPageChange, total: totalResults ?? flows.length} : undefined\n }\n />\n </AdminSection>\n );\n};\n\nexport default BaseSharedFlowList;\n"],"mappings":";;;;;;;;;;AA2DA,MAAMA,sBAAmD,EACvD,SACA,UACA,WACA,aACA,QAAQ,MACR,OACA,YAAY,OACZ,QAAQ,IACR,SAAS,GACT,cACA,UACA,aACA,gBACA,OACA,mBAC2C;CAC3C,MAAM,EAAC,MAAKC,uBAAe,aAAa,KAAK;CAE7C,MAAMC,UAA0C;EAC9C;GACE,QAAQ,EAAE,gCAAgC;GAC1C,IAAI;GACJ,SAAS,SAAiC,KAAK;GAChD;EACD;GACE,QAAQ,EAAE,kCAAkC;GAC5C,IAAI;GACJ,SAAS,SAAkC,KAAK,SAAS,oBAAC,oBAAM,KAAK,SAAc,GAAG;GACvF;EACD;GACE,QAAQ,EAAE,gCAAgC;GAC1C,IAAI;GACJ,SAAS,SAAiC,KAAK;GAChD;EACF;AAED,KAAI,SACF,QACE,oBAAC;EAAe;YACb,SAAS;GACR;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,MAAM;GACN,eAAe;GACf,cAAc,gBAAgB,MAAM;GACrC,CAAC;GACE;AAIV,QACE,oBAACC;EACC,OAAM;EACK;EACX,OAAO,SAAS,EAAE,yBAAyB;EAC9B;EACJ;EACI;YAEb,oBAACC;GACC,SAAS,OAAO,SAAS,QAAQ,EAAE,yBAAyB;GACnD;GACT,MAAM;GACN,WAAW,SAA8B,KAAK;GACnC;GACJ;GACP,WAAW,EAAE,yBAAyB;GACtC,YAAY;GACZ,eAAe;GACf,YACE,eAAe;IAAC;IAAO;IAAQ,UAAU;IAAc,OAAO,gBAAgB,MAAM;IAAO,GAAG;IAEhG;GACW;;AAInB,iCAAe"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { BaseSharedFlowListProps } from './BaseSharedFlowList';
|
|
3
|
+
export type SharedFlowListProps = Omit<BaseSharedFlowListProps, 'error' | 'flows' | 'isLoading' | 'offset' | 'onPageChange' | 'totalResults'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Restricts the list to one flow type, for example `AUTHENTICATION`.
|
|
6
|
+
*/
|
|
7
|
+
flowType?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The organization unit to list the flows of: the ones it owns and the ones shared with it.
|
|
10
|
+
*/
|
|
11
|
+
ouId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Which of those flows to list: the ones shared with the unit, the ones it owns, or both. The server reports
|
|
14
|
+
* the ownership of each flow, and the list narrows to it, so a narrowed list reads the first page of at most
|
|
15
|
+
* 100 flows and pages through the matches.
|
|
16
|
+
* @default 'shared'
|
|
17
|
+
*/
|
|
18
|
+
ownership?: 'all' | 'owned' | 'shared';
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Lists the flows shared with an organization unit, or the ones it owns, or both, a page at a time. Choosing a flow reports it
|
|
22
|
+
* through `onSelect`, so the application decides what to open, for example `FlowVariablesForm` for that flow.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <SharedFlowList ouId={ouId} onSelect={(flow) => setSelectedFlowId(flow.id)} />
|
|
27
|
+
* {selectedFlowId && <FlowVariablesForm flowId={selectedFlowId} ouId={ouId} />}
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare const SharedFlowList: FC<SharedFlowListProps>;
|
|
31
|
+
export default SharedFlowList;
|
|
32
|
+
//# sourceMappingURL=SharedFlowList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedFlowList.d.ts","sourceRoot":"","sources":["../../../../src/components/management/SharedFlowList/SharedFlowList.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAC,EAAE,EAAkC,MAAM,OAAO,CAAC;AAC1D,OAA2B,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAKjF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,uBAAuB,EACvB,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,cAAc,GAAG,cAAc,CAC7E,GAAG;IACF;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;CACxC,CAAC;AAIF;;;;;;;;;GASG;AACH,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA4C3C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|