@enonic/ui-kit 0.4.0 → 0.5.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/README.md +78 -8
- package/dist/dialog/action-dialog-context.d.ts +22 -0
- package/dist/dialog/action-dialog-context.js +21 -0
- package/dist/dialog/action-dialog-context.js.map +1 -0
- package/dist/dialog/action-dialog.d.ts +135 -0
- package/dist/dialog/action-dialog.js +213 -0
- package/dist/dialog/action-dialog.js.map +1 -0
- package/dist/dialog/delete-confirm.d.ts +33 -0
- package/dist/dialog/delete-confirm.js +80 -0
- package/dist/dialog/delete-confirm.js.map +1 -0
- package/dist/dialog/delete-expectation.d.ts +17 -0
- package/dist/dialog/delete-expectation.js +13 -0
- package/dist/dialog/delete-expectation.js.map +1 -0
- package/dist/dialog/dialog-preset.d.ts +34 -0
- package/dist/dialog/dialog-preset.js +38 -0
- package/dist/dialog/dialog-preset.js.map +1 -0
- package/dist/dialog/gate-match.d.ts +6 -0
- package/dist/dialog/gate-match.js +11 -0
- package/dist/dialog/gate-match.js.map +1 -0
- package/dist/dialog/gate.d.ts +31 -0
- package/dist/dialog/gate.js +72 -0
- package/dist/dialog/gate.js.map +1 -0
- package/dist/dialog/use-close-guard.d.ts +34 -0
- package/dist/dialog/use-close-guard.js +40 -0
- package/dist/dialog/use-close-guard.js.map +1 -0
- package/dist/filter/filter-fields.d.ts +33 -0
- package/dist/filter/filter-fields.js +72 -0
- package/dist/filter/filter-fields.js.map +1 -0
- package/dist/filter/filter-input.d.ts +35 -0
- package/dist/filter/filter-input.js +441 -0
- package/dist/filter/filter-input.js.map +1 -0
- package/dist/filter/filter-input.phrases.d.ts +26 -0
- package/dist/filter/filter-input.phrases.js +26 -0
- package/dist/filter/filter-input.phrases.js.map +1 -0
- package/dist/filter/filter-query.d.ts +40 -0
- package/dist/filter/filter-query.js +61 -0
- package/dist/filter/filter-query.js.map +1 -0
- package/dist/i18n/fill-phrase.d.ts +10 -0
- package/dist/i18n/fill-phrase.js +25 -0
- package/dist/i18n/fill-phrase.js.map +1 -0
- package/dist/i18n/phrases.d.ts +14 -0
- package/dist/i18n/phrases.js +23 -0
- package/dist/i18n/phrases.js.map +1 -0
- package/dist/i18n/use-phrases.d.ts +9 -0
- package/dist/i18n/use-phrases.js +11 -0
- package/dist/i18n/use-phrases.js.map +1 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +15 -0
- package/package.json +34 -6
- package/preset.css +6 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region src/filter/filter-query.ts
|
|
2
|
+
const EMPTY_FILTER = [];
|
|
3
|
+
function fieldTerm(field, value) {
|
|
4
|
+
return {
|
|
5
|
+
kind: "field",
|
|
6
|
+
field,
|
|
7
|
+
value
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function isTextTerm(term) {
|
|
11
|
+
return term.kind === "text";
|
|
12
|
+
}
|
|
13
|
+
function isFieldTerm(term) {
|
|
14
|
+
return term.kind === "field";
|
|
15
|
+
}
|
|
16
|
+
/** A key that tells terms apart in a list, stable across renders; a tuple, so no id can collide with another kind. */
|
|
17
|
+
function termKey(term) {
|
|
18
|
+
return JSON.stringify(isTextTerm(term) ? [term.kind, term.text.toLowerCase()] : [
|
|
19
|
+
term.kind,
|
|
20
|
+
term.field,
|
|
21
|
+
term.value
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
/** The free text of a query as one string, the text terms joined by a space. */
|
|
25
|
+
function textOf(query) {
|
|
26
|
+
return query.filter(isTextTerm).map(({ text }) => text).join(" ");
|
|
27
|
+
}
|
|
28
|
+
/** Every value the query holds for a field. Empty narrows nothing, the reading every multi-select filter takes. */
|
|
29
|
+
function valuesOf(query, field) {
|
|
30
|
+
const values = /* @__PURE__ */ new Set();
|
|
31
|
+
for (const term of query) if (!isTextTerm(term) && term.field === field) values.add(term.value);
|
|
32
|
+
return values;
|
|
33
|
+
}
|
|
34
|
+
/** Text is compared without regard to case, as the matching reads it; a value by its id, exactly. */
|
|
35
|
+
function sameTerm(a, b) {
|
|
36
|
+
if (isTextTerm(a) || isTextTerm(b)) return isTextTerm(a) && isTextTerm(b) && a.text.toLowerCase() === b.text.toLowerCase();
|
|
37
|
+
return a.field === b.field && a.value === b.value;
|
|
38
|
+
}
|
|
39
|
+
/** A text term from what was typed, or nothing for a blank. */
|
|
40
|
+
function textTerm(typed) {
|
|
41
|
+
const text = typed.trim();
|
|
42
|
+
return text.length === 0 ? void 0 : {
|
|
43
|
+
kind: "text",
|
|
44
|
+
text
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** The query with a term added at the end; one it already holds leaves it unchanged. */
|
|
48
|
+
function withTerm(query, term) {
|
|
49
|
+
return query.some((held) => sameTerm(held, term)) ? query : [...query, term];
|
|
50
|
+
}
|
|
51
|
+
function withoutTerm(query, index) {
|
|
52
|
+
return query.filter((_, at) => at !== index);
|
|
53
|
+
}
|
|
54
|
+
/** The query with a term taken out if it holds it, and added at the end if it does not. */
|
|
55
|
+
function toggledTerm(query, term) {
|
|
56
|
+
return query.some((candidate) => sameTerm(candidate, term)) ? query.filter((candidate) => !sameTerm(candidate, term)) : [...query, term];
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { EMPTY_FILTER, fieldTerm, isFieldTerm, isTextTerm, sameTerm, termKey, textOf, textTerm, toggledTerm, valuesOf, withTerm, withoutTerm };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=filter-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-query.js","names":[],"sources":["../../src/filter/filter-query.ts"],"sourcesContent":["/**\n * One term of a filter: a value of a named field, or free text. Ids, never labels — what a term\n * is called is the business of whoever offers the fields. Discriminated by `kind`, so a term shape\n * added later fails to compile where it is not handled instead of passing for one of these.\n */\nexport type FieldTerm = { kind: 'field'; field: string; value: string };\nexport type TextTerm = { kind: 'text'; text: string };\nexport type FilterTerm = FieldTerm | TextTerm;\n\n/** What a list is narrowed by, in the order the terms were added. */\nexport type FilterQuery = readonly FilterTerm[];\n\nexport const EMPTY_FILTER: FilterQuery = [];\n\nexport function fieldTerm(field: string, value: string): FieldTerm {\n return { kind: 'field', field, value };\n}\n\nexport function isTextTerm(term: FilterTerm): term is TextTerm {\n return term.kind === 'text';\n}\n\nexport function isFieldTerm(term: FilterTerm): term is FieldTerm {\n return term.kind === 'field';\n}\n\n/** A key that tells terms apart in a list, stable across renders; a tuple, so no id can collide with another kind. */\nexport function termKey(term: FilterTerm): string {\n return JSON.stringify(\n isTextTerm(term) ? [term.kind, term.text.toLowerCase()] : [term.kind, term.field, term.value],\n );\n}\n\n/** The free text of a query as one string, the text terms joined by a space. */\nexport function textOf(query: FilterQuery): string {\n return query\n .filter(isTextTerm)\n .map(({ text }) => text)\n .join(' ');\n}\n\n/** Every value the query holds for a field. Empty narrows nothing, the reading every multi-select filter takes. */\nexport function valuesOf(query: FilterQuery, field: string): ReadonlySet<string> {\n const values = new Set<string>();\n for (const term of query) {\n if (!isTextTerm(term) && term.field === field) {\n values.add(term.value);\n }\n }\n return values;\n}\n\n/** Text is compared without regard to case, as the matching reads it; a value by its id, exactly. */\nexport function sameTerm(a: FilterTerm, b: FilterTerm): boolean {\n if (isTextTerm(a) || isTextTerm(b)) {\n return isTextTerm(a) && isTextTerm(b) && a.text.toLowerCase() === b.text.toLowerCase();\n }\n\n return a.field === b.field && a.value === b.value;\n}\n\n/** A text term from what was typed, or nothing for a blank. */\nexport function textTerm(typed: string): TextTerm | undefined {\n const text = typed.trim();\n return text.length === 0 ? undefined : { kind: 'text', text };\n}\n\n/** The query with a term added at the end; one it already holds leaves it unchanged. */\nexport function withTerm(query: FilterQuery, term: FilterTerm): FilterQuery {\n return query.some((held) => sameTerm(held, term)) ? query : [...query, term];\n}\n\nexport function withoutTerm(query: FilterQuery, index: number): FilterQuery {\n return query.filter((_, at) => at !== index);\n}\n\n/** The query with a term taken out if it holds it, and added at the end if it does not. */\nexport function toggledTerm(query: FilterQuery, term: FilterTerm): FilterQuery {\n const held = query.some((candidate) => sameTerm(candidate, term));\n return held ? query.filter((candidate) => !sameTerm(candidate, term)) : [...query, term];\n}\n"],"mappings":";AAYA,MAAa,eAA4B,CAAC;AAE1C,SAAgB,UAAU,OAAe,OAA0B;CACjE,OAAO;EAAE,MAAM;EAAS;EAAO;CAAM;AACvC;AAEA,SAAgB,WAAW,MAAoC;CAC7D,OAAO,KAAK,SAAS;AACvB;AAEA,SAAgB,YAAY,MAAqC;CAC/D,OAAO,KAAK,SAAS;AACvB;;AAGA,SAAgB,QAAQ,MAA0B;CAChD,OAAO,KAAK,UACV,WAAW,IAAI,IAAI,CAAC,KAAK,MAAM,KAAK,KAAK,YAAY,CAAC,IAAI;EAAC,KAAK;EAAM,KAAK;EAAO,KAAK;CAAK,CAC9F;AACF;;AAGA,SAAgB,OAAO,OAA4B;CACjD,OAAO,MACJ,OAAO,UAAU,CAAC,CAClB,KAAK,EAAE,WAAW,IAAI,CAAC,CACvB,KAAK,GAAG;AACb;;AAGA,SAAgB,SAAS,OAAoB,OAAoC;CAC/E,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,WAAW,IAAI,KAAK,KAAK,UAAU,OACtC,OAAO,IAAI,KAAK,KAAK;CAGzB,OAAO;AACT;;AAGA,SAAgB,SAAS,GAAe,GAAwB;CAC9D,IAAI,WAAW,CAAC,KAAK,WAAW,CAAC,GAC/B,OAAO,WAAW,CAAC,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,YAAY,MAAM,EAAE,KAAK,YAAY;CAGvF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE;AAC9C;;AAGA,SAAgB,SAAS,OAAqC;CAC5D,MAAM,OAAO,MAAM,KAAK;CACxB,OAAO,KAAK,WAAW,IAAI,KAAA,IAAY;EAAE,MAAM;EAAQ;CAAK;AAC9D;;AAGA,SAAgB,SAAS,OAAoB,MAA+B;CAC1E,OAAO,MAAM,MAAM,SAAS,SAAS,MAAM,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,OAAO,IAAI;AAC7E;AAEA,SAAgB,YAAY,OAAoB,OAA4B;CAC1E,OAAO,MAAM,QAAQ,GAAG,OAAO,OAAO,KAAK;AAC7C;;AAGA,SAAgB,YAAY,OAAoB,MAA+B;CAE7E,OADa,MAAM,MAAM,cAAc,SAAS,WAAW,IAAI,CACrD,IAAI,MAAM,QAAQ,cAAc,CAAC,SAAS,WAAW,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,IAAI;AACzF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/i18n/fill-phrase.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A phrase with its `{n}` placeholders replaced by values that are not strings — a node to render
|
|
4
|
+
* a name in bold inside a sentence the translator sees whole. A placeholder with no value stays as
|
|
5
|
+
* written, as `localize` leaves it.
|
|
6
|
+
*/
|
|
7
|
+
declare function fillPhrase<T>(phrase: string, values: readonly T[]): (string | T)[];
|
|
8
|
+
//#endregion
|
|
9
|
+
export { fillPhrase };
|
|
10
|
+
//# sourceMappingURL=fill-phrase.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/i18n/fill-phrase.ts
|
|
2
|
+
/**
|
|
3
|
+
* A phrase with its `{n}` placeholders replaced by values that are not strings — a node to render
|
|
4
|
+
* a name in bold inside a sentence the translator sees whole. A placeholder with no value stays as
|
|
5
|
+
* written, as `localize` leaves it.
|
|
6
|
+
*/
|
|
7
|
+
function fillPhrase(phrase, values) {
|
|
8
|
+
const parts = [];
|
|
9
|
+
let last = 0;
|
|
10
|
+
for (const match of phrase.matchAll(/\{(\d+)\}/g)) {
|
|
11
|
+
const value = values[Number(match[1])];
|
|
12
|
+
if (value === void 0) continue;
|
|
13
|
+
const text = phrase.slice(last, match.index);
|
|
14
|
+
if (text !== "") parts.push(text);
|
|
15
|
+
parts.push(value);
|
|
16
|
+
last = match.index + match[0].length;
|
|
17
|
+
}
|
|
18
|
+
const rest = phrase.slice(last);
|
|
19
|
+
if (rest !== "") parts.push(rest);
|
|
20
|
+
return parts;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { fillPhrase };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=fill-phrase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill-phrase.js","names":[],"sources":["../../src/i18n/fill-phrase.ts"],"sourcesContent":["/**\n * A phrase with its `{n}` placeholders replaced by values that are not strings — a node to render\n * a name in bold inside a sentence the translator sees whole. A placeholder with no value stays as\n * written, as `localize` leaves it.\n */\nexport function fillPhrase<T>(phrase: string, values: readonly T[]): (string | T)[] {\n const parts: (string | T)[] = [];\n let last = 0;\n\n for (const match of phrase.matchAll(/\\{(\\d+)\\}/g)) {\n const value = values[Number(match[1])];\n if (value === undefined) {\n continue;\n }\n const text = phrase.slice(last, match.index);\n if (text !== '') {\n parts.push(text);\n }\n parts.push(value);\n last = match.index + match[0].length;\n }\n\n const rest = phrase.slice(last);\n if (rest !== '') {\n parts.push(rest);\n }\n\n return parts;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,WAAc,QAAgB,QAAsC;CAClF,MAAM,QAAwB,CAAC;CAC/B,IAAI,OAAO;CAEX,KAAK,MAAM,SAAS,OAAO,SAAS,YAAY,GAAG;EACjD,MAAM,QAAQ,OAAO,OAAO,MAAM,EAAE;EACpC,IAAI,UAAU,KAAA,GACZ;EAEF,MAAM,OAAO,OAAO,MAAM,MAAM,MAAM,KAAK;EAC3C,IAAI,SAAS,IACX,MAAM,KAAK,IAAI;EAEjB,MAAM,KAAK,KAAK;EAChB,OAAO,MAAM,QAAQ,MAAM,EAAE,CAAC;CAChC;CAEA,MAAM,OAAO,OAAO,MAAM,IAAI;CAC9B,IAAI,SAAS,IACX,MAAM,KAAK,IAAI;CAGjB,OAAO;AACT"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/i18n/phrases.d.ts
|
|
2
|
+
declare const uiKitPhrases: Readonly<{
|
|
3
|
+
readonly 'enonic.uiKit.dialog.cancel': 'Cancel';
|
|
4
|
+
readonly 'enonic.uiKit.dialog.confirm': 'Confirm';
|
|
5
|
+
readonly 'enonic.uiKit.dialog.delete': 'Delete';
|
|
6
|
+
readonly 'enonic.uiKit.dialog.keep': 'Keep editing';
|
|
7
|
+
} & {
|
|
8
|
+
readonly 'enonic.uiKit.gate.hint': 'Type {0} to confirm';
|
|
9
|
+
readonly 'enonic.uiKit.gate.mismatch': '{1} does not match {0}';
|
|
10
|
+
}>;
|
|
11
|
+
type UiKitPhraseKey = keyof typeof uiKitPhrases;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { UiKitPhraseKey, uiKitPhrases };
|
|
14
|
+
//# sourceMappingURL=phrases.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { mergePhrases } from "@enonic/ui-utils";
|
|
2
|
+
//#region src/i18n/phrases.ts
|
|
3
|
+
/**
|
|
4
|
+
* Every text the package renders, in English, keyed `enonic.uiKit.<area>.<name>`. An application
|
|
5
|
+
* translates them through the `Translate` it hands `@enonic/ui`'s `I18nProvider`; a key it has no
|
|
6
|
+
* text for renders this English. `comparePhrases` from `@enonic/ui-utils` tells an application
|
|
7
|
+
* which of these its bundle lacks.
|
|
8
|
+
*/
|
|
9
|
+
const dialogPhrases = {
|
|
10
|
+
"enonic.uiKit.dialog.cancel": "Cancel",
|
|
11
|
+
"enonic.uiKit.dialog.confirm": "Confirm",
|
|
12
|
+
"enonic.uiKit.dialog.delete": "Delete",
|
|
13
|
+
"enonic.uiKit.dialog.keep": "Keep editing"
|
|
14
|
+
};
|
|
15
|
+
const gatePhrases = {
|
|
16
|
+
"enonic.uiKit.gate.hint": "Type {0} to confirm",
|
|
17
|
+
"enonic.uiKit.gate.mismatch": "{1} does not match {0}"
|
|
18
|
+
};
|
|
19
|
+
const uiKitPhrases = mergePhrases([dialogPhrases, gatePhrases]);
|
|
20
|
+
//#endregion
|
|
21
|
+
export { dialogPhrases, gatePhrases, uiKitPhrases };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=phrases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phrases.js","names":[],"sources":["../../src/i18n/phrases.ts"],"sourcesContent":["import { mergePhrases } from '@enonic/ui-utils';\n\n/**\n * Every text the package renders, in English, keyed `enonic.uiKit.<area>.<name>`. An application\n * translates them through the `Translate` it hands `@enonic/ui`'s `I18nProvider`; a key it has no\n * text for renders this English. `comparePhrases` from `@enonic/ui-utils` tells an application\n * which of these its bundle lacks.\n */\nexport const dialogPhrases = {\n 'enonic.uiKit.dialog.cancel': 'Cancel',\n 'enonic.uiKit.dialog.confirm': 'Confirm',\n 'enonic.uiKit.dialog.delete': 'Delete',\n 'enonic.uiKit.dialog.keep': 'Keep editing',\n} as const;\n\nexport const gatePhrases = {\n 'enonic.uiKit.gate.hint': 'Type {0} to confirm',\n 'enonic.uiKit.gate.mismatch': '{1} does not match {0}',\n} as const;\n\nexport const uiKitPhrases = mergePhrases([dialogPhrases, gatePhrases]);\n\nexport type UiKitPhraseKey = keyof typeof uiKitPhrases;\n"],"mappings":";;;;;;;;AAQA,MAAa,gBAAgB;CAC3B,8BAA8B;CAC9B,+BAA+B;CAC/B,8BAA8B;CAC9B,4BAA4B;AAC9B;AAEA,MAAa,cAAc;CACzB,0BAA0B;CAC1B,8BAA8B;AAChC;AAEA,MAAa,eAAe,aAAa,CAAC,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UiKitPhraseKey } from "./phrases.js";
|
|
2
|
+
import { PhraseValue } from "@enonic/ui-utils";
|
|
3
|
+
//#region src/i18n/use-phrases.d.ts
|
|
4
|
+
type UiKitTranslate = (key: UiKitPhraseKey, ...values: PhraseValue[]) => string;
|
|
5
|
+
/** The package's labels, through the application's `Translate` where it has a word. */
|
|
6
|
+
declare function useUiKitPhrases(): UiKitTranslate;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { UiKitTranslate, useUiKitPhrases };
|
|
9
|
+
//# sourceMappingURL=use-phrases.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { uiKitPhrases } from "./phrases.js";
|
|
2
|
+
import { usePhrases } from "@enonic/ui";
|
|
3
|
+
//#region src/i18n/use-phrases.ts
|
|
4
|
+
/** The package's labels, through the application's `Translate` where it has a word. */
|
|
5
|
+
function useUiKitPhrases() {
|
|
6
|
+
return usePhrases(uiKitPhrases);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { useUiKitPhrases };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=use-phrases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-phrases.js","names":[],"sources":["../../src/i18n/use-phrases.ts"],"sourcesContent":["import { usePhrases } from '@enonic/ui';\nimport type { PhraseValue } from '@enonic/ui-utils';\n\nimport { uiKitPhrases, type UiKitPhraseKey } from './phrases';\n\nexport type UiKitTranslate = (key: UiKitPhraseKey, ...values: PhraseValue[]) => string;\n\n/** The package's labels, through the application's `Translate` where it has a word. */\nexport function useUiKitPhrases(): UiKitTranslate {\n return usePhrases(uiKitPhrases);\n}\n"],"mappings":";;;;AAQA,SAAgB,kBAAkC;CAChD,OAAO,WAAW,YAAY;AAChC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { ActionDialogContextValue, ActionDialogOpenChangeDetails, useActionDialog } from "./dialog/action-dialog-context.js";
|
|
2
|
+
import { ActionDialog, ActionDialogActionProps, ActionDialogBodyProps, ActionDialogContentProps, ActionDialogFooterProps, ActionDialogRootProps, DialogIntent, DialogSize, FooterQuestion } from "./dialog/action-dialog.js";
|
|
3
|
+
import { DeleteTarget, deleteExpectation } from "./dialog/delete-expectation.js";
|
|
4
|
+
import { DeleteConfirm, DeleteConfirmProps } from "./dialog/delete-confirm.js";
|
|
5
|
+
import { DialogPreset, DialogPresetConfirmProps } from "./dialog/dialog-preset.js";
|
|
6
|
+
import { Gate, GateHintProps, GateInputProps } from "./dialog/gate.js";
|
|
7
|
+
import { matchesExpected } from "./dialog/gate-match.js";
|
|
8
|
+
import { CloseGuard, CloseGuardOptions, useCloseGuard } from "./dialog/use-close-guard.js";
|
|
9
|
+
import { EMPTY_FILTER, FieldTerm, FilterQuery, FilterTerm, TextTerm, fieldTerm, isFieldTerm, isTextTerm, sameTerm, termKey, textOf, textTerm, toggledTerm, valuesOf, withTerm, withoutTerm } from "./filter/filter-query.js";
|
|
10
|
+
import { FilterField, FilterValue } from "./filter/filter-fields.js";
|
|
11
|
+
import { FilterInput, FilterInputProps } from "./filter/filter-input.js";
|
|
12
|
+
import { FilterInputPhraseKey, filterInputPhrases } from "./filter/filter-input.phrases.js";
|
|
13
|
+
import { fillPhrase } from "./i18n/fill-phrase.js";
|
|
14
|
+
import { UiKitPhraseKey, uiKitPhrases } from "./i18n/phrases.js";
|
|
15
|
+
import { UiKitTranslate, useUiKitPhrases } from "./i18n/use-phrases.js";
|
|
16
|
+
export { ActionDialog, type ActionDialogActionProps, type ActionDialogBodyProps, type ActionDialogContentProps, type ActionDialogContextValue, type ActionDialogFooterProps, type ActionDialogOpenChangeDetails, type ActionDialogRootProps, type CloseGuard, type CloseGuardOptions, DeleteConfirm, type DeleteConfirmProps, type DeleteTarget, type DialogIntent, DialogPreset, type DialogPresetConfirmProps, type DialogSize, EMPTY_FILTER, type FieldTerm, type FilterField, FilterInput, type FilterInputPhraseKey, type FilterInputProps, type FilterQuery, type FilterTerm, type FilterValue, type FooterQuestion, Gate, type GateHintProps, type GateInputProps, type TextTerm, type UiKitPhraseKey, type UiKitTranslate, deleteExpectation, fieldTerm, fillPhrase, filterInputPhrases, isFieldTerm, isTextTerm, matchesExpected, sameTerm, termKey, textOf, textTerm, toggledTerm, uiKitPhrases, useActionDialog, useCloseGuard, useUiKitPhrases, valuesOf, withTerm, withoutTerm };
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useActionDialog } from "./dialog/action-dialog-context.js";
|
|
2
|
+
import { uiKitPhrases } from "./i18n/phrases.js";
|
|
3
|
+
import { useUiKitPhrases } from "./i18n/use-phrases.js";
|
|
4
|
+
import { ActionDialog } from "./dialog/action-dialog.js";
|
|
5
|
+
import { deleteExpectation } from "./dialog/delete-expectation.js";
|
|
6
|
+
import { fillPhrase } from "./i18n/fill-phrase.js";
|
|
7
|
+
import { matchesExpected } from "./dialog/gate-match.js";
|
|
8
|
+
import { Gate } from "./dialog/gate.js";
|
|
9
|
+
import { DeleteConfirm } from "./dialog/delete-confirm.js";
|
|
10
|
+
import { DialogPreset } from "./dialog/dialog-preset.js";
|
|
11
|
+
import { useCloseGuard } from "./dialog/use-close-guard.js";
|
|
12
|
+
import { EMPTY_FILTER, fieldTerm, isFieldTerm, isTextTerm, sameTerm, termKey, textOf, textTerm, toggledTerm, valuesOf, withTerm, withoutTerm } from "./filter/filter-query.js";
|
|
13
|
+
import { filterInputPhrases } from "./filter/filter-input.phrases.js";
|
|
14
|
+
import { FilterInput } from "./filter/filter-input.js";
|
|
15
|
+
export { ActionDialog, DeleteConfirm, DialogPreset, EMPTY_FILTER, FilterInput, Gate, deleteExpectation, fieldTerm, fillPhrase, filterInputPhrases, isFieldTerm, isTextTerm, matchesExpected, sameTerm, termKey, textOf, textTerm, toggledTerm, uiKitPhrases, useActionDialog, useCloseGuard, useUiKitPhrases, valuesOf, withTerm, withoutTerm };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic/ui-kit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Composite React components with behaviour:
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Composite React components with behaviour: the dialog shell and its confirmations, layouts, toolbars, browse screens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
7
7
|
"enonic",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"directory": "packages/ui-kit"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"preset.css"
|
|
26
27
|
],
|
|
27
28
|
"type": "module",
|
|
28
29
|
"sideEffects": false,
|
|
@@ -32,22 +33,49 @@
|
|
|
32
33
|
".": {
|
|
33
34
|
"types": "./dist/index.d.ts",
|
|
34
35
|
"import": "./dist/index.js"
|
|
35
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"./preset.css": "./preset.css"
|
|
36
38
|
},
|
|
37
39
|
"publishConfig": {
|
|
38
40
|
"access": "public",
|
|
39
41
|
"provenance": false
|
|
40
42
|
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@enonic/ui-utils": "^0.5.0",
|
|
45
|
+
"lucide-react": "^1.48.0"
|
|
46
|
+
},
|
|
41
47
|
"devDependencies": {
|
|
48
|
+
"@enonic/ui": "^1.4.0",
|
|
49
|
+
"@radix-ui/react-slot": "^1.2.0",
|
|
50
|
+
"@storybook/preact-vite": "~10.6.0",
|
|
51
|
+
"@testing-library/preact": "~3.2.4",
|
|
52
|
+
"@testing-library/user-event": "~14.6.7",
|
|
53
|
+
"@types/node": "^26.6.3",
|
|
42
54
|
"@types/react": "^19.2.18",
|
|
43
55
|
"@types/react-dom": "^19.2.4",
|
|
56
|
+
"happy-dom": "~20.14.5",
|
|
44
57
|
"preact": "^10.29.8",
|
|
45
58
|
"publint": "^0.3.24",
|
|
46
59
|
"typescript": "^7.0.2",
|
|
47
|
-
"vite-plus": "0.2.9"
|
|
60
|
+
"vite-plus": "0.2.9",
|
|
61
|
+
"vitest": "4.1.10"
|
|
48
62
|
},
|
|
49
63
|
"peerDependencies": {
|
|
50
|
-
"
|
|
64
|
+
"@enonic/ui": "^1.4.0",
|
|
65
|
+
"preact": ">=10.0.0",
|
|
66
|
+
"react": "^19.0.0",
|
|
67
|
+
"react-dom": "^19.0.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"preact": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"react": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"react-dom": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
51
79
|
},
|
|
52
80
|
"engines": {
|
|
53
81
|
"node": ">=22.12.0"
|
package/preset.css
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The kit's components carry Tailwind classes and ship no CSS: a consumer's Tailwind build
|
|
3
|
+
* generates the utilities it finds in `dist`. `@import '@enonic/ui-kit/preset.css'` after the
|
|
4
|
+
* `@enonic/ui` preset points that build here; the tokens the classes use are `@enonic/ui`'s.
|
|
5
|
+
*/
|
|
6
|
+
@source './dist';
|