@mindlogic-ai/logician-ui 5.0.0-alpha.7 → 5.0.0-alpha.8
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/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +10 -2
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.mjs +10 -2
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/translations/Defaults.translations.json.js +9 -0
- package/dist/translations/Defaults.translations.json.js.map +1 -1
- package/dist/translations/Defaults.translations.json.mjs +9 -1
- package/dist/translations/Defaults.translations.json.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.tsx +15 -2
- package/src/translations/Defaults.translations.json +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAA8B,MAAM,gBAAgB,CAAC;AA0K5E,eAAO,MAAM,MAAM,gEAA0C,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var react = require('@chakra-ui/react');
|
|
7
|
+
var useTranslate = require('../../hooks/useTranslate.js');
|
|
7
8
|
var focusRing = require('../../utils/focusRing.js');
|
|
8
9
|
var mergeCss = require('../../utils/mergeCss.js');
|
|
9
10
|
var polymorphic = require('../../types/polymorphic.js');
|
|
@@ -31,7 +32,14 @@ const ButtonImpl = React.forwardRef(({ variant: variantProp, isDestructive: isDe
|
|
|
31
32
|
// 4.x callers (untyped JS, `as any`) can still hand us `colorPalette` and
|
|
32
33
|
// an old variant name. Strip it so it never reaches Chakra's own recipe,
|
|
33
34
|
// and map the pair onto a 5.0 role — see `Button.legacy.ts`.
|
|
34
|
-
const { colorPalette: legacyPalette, ...rest } = restWithLegacy;
|
|
35
|
+
const { colorPalette: legacyPalette, loadingText: loadingTextProp, ...rest } = restWithLegacy;
|
|
36
|
+
// A busy button says what it is doing: 처리 중 unless the call site names
|
|
37
|
+
// the verb (저장 중). `loadingText={null}` opts out — spinner only, and the
|
|
38
|
+
// button keeps its width.
|
|
39
|
+
const translate = useTranslate.useTranslate();
|
|
40
|
+
const loadingText = loadingTextProp === undefined
|
|
41
|
+
? translate('processing')
|
|
42
|
+
: (loadingTextProp ?? undefined);
|
|
35
43
|
let variant = variantProp ?? 'subtle';
|
|
36
44
|
let isDestructive = isDestructiveProp;
|
|
37
45
|
if (Button_legacy.isLegacyButtonProps('button', legacyPalette, variantProp)) {
|
|
@@ -104,7 +112,7 @@ const ButtonImpl = React.forwardRef(({ variant: variantProp, isDestructive: isDe
|
|
|
104
112
|
// Two clocks on one element — the press is faster than the colour
|
|
105
113
|
// change — so the shorthand is written out and only the reduced-motion
|
|
106
114
|
// guard comes from the vocabulary.
|
|
107
|
-
transition: Button_styles.buttonTransition, animationStyle: "composite", ref: ref, "data-variant": variant, "data-destructive": isDestructive || undefined, ...rest,
|
|
115
|
+
transition: Button_styles.buttonTransition, animationStyle: "composite", ref: ref, "data-variant": variant, "data-destructive": isDestructive || undefined, loadingText: loadingText, ...rest,
|
|
108
116
|
// The `action` icon rule lives in `css` (a nested selector cannot be a
|
|
109
117
|
// style prop); merged so a call site's `css` adds to it.
|
|
110
118
|
css: mergeCss.mergeCss(base.css, cssProp), children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":[null],"names":["forwardRef","isLegacyButtonProps","resolveLegacyButtonVariant","warnLegacyButtonProps","getButtonStyles","_jsx","ChakraButton","mergeCss","focusRing","buttonTransition","polymorphic"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":[null],"names":["forwardRef","useTranslate","isLegacyButtonProps","resolveLegacyButtonVariant","warnLegacyButtonProps","getButtonStyles","_jsx","ChakraButton","mergeCss","focusRing","buttonTransition","polymorphic"],"mappings":";;;;;;;;;;;;;AAgBA;;;;;;;;;;;;;;;;AAgBG;AACH,MAAM,UAAU,GAAGA,gBAAU,CAC3B,CACE,EACE,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,iBAAiB,GAAG,KAAK,EACxC,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,YAAY,EACvB,GAAG,EAAE,OAAO,EACZ,GAAG,cAAc,EAClB,EACD,GAAG,KACD;;;;AAIF,IAAA,MAAM,EACJ,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,GAAG,IAAI,EACR,GAAG,cAAoE;;;;AAIxE,IAAA,MAAM,SAAS,GAAGC,yBAAY,EAAE;AAChC,IAAA,MAAM,WAAW,GACf,eAAe,KAAK;AAClB,UAAE,SAAS,CAAC,YAAY;AACxB,WAAG,eAAe,IAAI,SAAS,CAAC;AAEpC,IAAA,IAAI,OAAO,GAAkB,WAAW,IAAI,QAAQ;IACpD,IAAI,aAAa,GAAG,iBAAiB;IACrC,IAAIC,iCAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE;QAC7D,MAAM,QAAQ,GAAGC,wCAA0B,CACzC,QAAQ,EACR,aAAa,EACb,WAAW,CACZ;QACDC,mCAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,CAAC;AACrE,QAAA,OAAO,GAAG,QAAQ,CAAC,OAAO;AAC1B,QAAA,aAAa,GAAG,aAAa,IAAI,QAAQ,CAAC,aAAa;IACzD;IAEA,MAAM,IAAI,GAAGC,6BAAe,CAAC,OAAO,EAAE,aAAa,CAAC;;;IAIpD,MAAM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I,SAAS,EAC5C,WAAW,EAAE,WAAW,EAAA,GACpB,IAAI;;;AAGR,QAAA,GAAG,EAAEF,iBAAQ,CAAC,IAAI,CAAC,GAAoC,EAAE,OAAO,CAAC,EAAA,QAAA,EAEhE,QAAQ,EAAA,CACI;AAEnB,CAAC,CACF;AAED;;;;;;AAMG;AACH,UAAU,CAAC,WAAW,GAAG,QAAQ;MAEpB,MAAM,GAAGG,uBAAW,CAAiB,UAAU;;;;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { Button as Button$1 } from '@chakra-ui/react';
|
|
5
|
+
import { useTranslate } from '../../hooks/useTranslate.mjs';
|
|
5
6
|
import { focusRing } from '../../utils/focusRing.mjs';
|
|
6
7
|
import { mergeCss } from '../../utils/mergeCss.mjs';
|
|
7
8
|
import { polymorphic } from '../../types/polymorphic.mjs';
|
|
@@ -29,7 +30,14 @@ const ButtonImpl = forwardRef(({ variant: variantProp, isDestructive: isDestruct
|
|
|
29
30
|
// 4.x callers (untyped JS, `as any`) can still hand us `colorPalette` and
|
|
30
31
|
// an old variant name. Strip it so it never reaches Chakra's own recipe,
|
|
31
32
|
// and map the pair onto a 5.0 role — see `Button.legacy.ts`.
|
|
32
|
-
const { colorPalette: legacyPalette, ...rest } = restWithLegacy;
|
|
33
|
+
const { colorPalette: legacyPalette, loadingText: loadingTextProp, ...rest } = restWithLegacy;
|
|
34
|
+
// A busy button says what it is doing: 처리 중 unless the call site names
|
|
35
|
+
// the verb (저장 중). `loadingText={null}` opts out — spinner only, and the
|
|
36
|
+
// button keeps its width.
|
|
37
|
+
const translate = useTranslate();
|
|
38
|
+
const loadingText = loadingTextProp === undefined
|
|
39
|
+
? translate('processing')
|
|
40
|
+
: (loadingTextProp ?? undefined);
|
|
33
41
|
let variant = variantProp ?? 'subtle';
|
|
34
42
|
let isDestructive = isDestructiveProp;
|
|
35
43
|
if (isLegacyButtonProps('button', legacyPalette, variantProp)) {
|
|
@@ -102,7 +110,7 @@ const ButtonImpl = forwardRef(({ variant: variantProp, isDestructive: isDestruct
|
|
|
102
110
|
// Two clocks on one element — the press is faster than the colour
|
|
103
111
|
// change — so the shorthand is written out and only the reduced-motion
|
|
104
112
|
// guard comes from the vocabulary.
|
|
105
|
-
transition: buttonTransition, animationStyle: "composite", ref: ref, "data-variant": variant, "data-destructive": isDestructive || undefined, ...rest,
|
|
113
|
+
transition: buttonTransition, animationStyle: "composite", ref: ref, "data-variant": variant, "data-destructive": isDestructive || undefined, loadingText: loadingText, ...rest,
|
|
106
114
|
// The `action` icon rule lives in `css` (a nested selector cannot be a
|
|
107
115
|
// style prop); merged so a call site's `css` adds to it.
|
|
108
116
|
css: mergeCss(base.css, cssProp), children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":[null],"names":["_jsx","ChakraButton"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":[null],"names":["_jsx","ChakraButton"],"mappings":";;;;;;;;;;;AAgBA;;;;;;;;;;;;;;;;AAgBG;AACH,MAAM,UAAU,GAAG,UAAU,CAC3B,CACE,EACE,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,iBAAiB,GAAG,KAAK,EACxC,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,YAAY,EACvB,GAAG,EAAE,OAAO,EACZ,GAAG,cAAc,EAClB,EACD,GAAG,KACD;;;;AAIF,IAAA,MAAM,EACJ,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,GAAG,IAAI,EACR,GAAG,cAAoE;;;;AAIxE,IAAA,MAAM,SAAS,GAAG,YAAY,EAAE;AAChC,IAAA,MAAM,WAAW,GACf,eAAe,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,GACb,MAAM;;;;;;;;AAQV,QAAA,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAC1C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC;;;;;;AAM7C,QAAA,SAAS,EAAE,QAAQ,CACjB,WAAW,IAAI,MAAM,GAAG,MAAM,CAAC,SAAS,GAAG,SAAS;;;QAGpD,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,GAAG,UAAU,GAAG,aAAa,EAAE,EACrD,YAAY,CACb,KACG,SAAS,EACb,MAAM,EAAC,SAAS;;;AAGhB,QAAA,KAAK,EAAC,GAAG;;;;QAIT,UAAU,EAAE,gBAAgB,EAC5B,cAAc,EAAC,WAAW,EAC1B,GAAG,EAAE,GAAG,kBACM,OAAO,EAAA,kBAAA,EACH,aAAa,IAAI,SAAS,EAC5C,WAAW,EAAE,WAAW,EAAA,GACpB,IAAI;;;AAGR,QAAA,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAoC,EAAE,OAAO,CAAC,EAAA,QAAA,EAEhE,QAAQ,EAAA,CACI;AAEnB,CAAC,CACF;AAED;;;;;;AAMG;AACH,UAAU,CAAC,WAAW,GAAG,QAAQ;MAEpB,MAAM,GAAG,WAAW,CAAiB,UAAU;;;;"}
|
|
@@ -220,6 +220,13 @@ var downloading = {
|
|
|
220
220
|
ja: "ダウンロード中",
|
|
221
221
|
es: "Descargando"
|
|
222
222
|
};
|
|
223
|
+
var processing = {
|
|
224
|
+
ko: "처리 중",
|
|
225
|
+
en: "Processing",
|
|
226
|
+
zh: "处理中",
|
|
227
|
+
ja: "処理中",
|
|
228
|
+
es: "Procesando"
|
|
229
|
+
};
|
|
223
230
|
var deleting = {
|
|
224
231
|
ko: "삭제 중",
|
|
225
232
|
en: "Deleting",
|
|
@@ -273,6 +280,7 @@ var defaultTranslations = {
|
|
|
273
280
|
es: "Eliminar"
|
|
274
281
|
},
|
|
275
282
|
downloading: downloading,
|
|
283
|
+
processing: processing,
|
|
276
284
|
deleting: deleting,
|
|
277
285
|
close: close
|
|
278
286
|
};
|
|
@@ -301,6 +309,7 @@ exports.page = page;
|
|
|
301
309
|
exports.pagination_items_per_page = pagination_items_per_page;
|
|
302
310
|
exports.pagination_range_text = pagination_range_text;
|
|
303
311
|
exports.previous = previous;
|
|
312
|
+
exports.processing = processing;
|
|
304
313
|
exports.refresh_page = refresh_page;
|
|
305
314
|
exports.see_less = see_less;
|
|
306
315
|
exports.see_more = see_more;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Defaults.translations.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Defaults.translations.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -216,6 +216,13 @@ var downloading = {
|
|
|
216
216
|
ja: "ダウンロード中",
|
|
217
217
|
es: "Descargando"
|
|
218
218
|
};
|
|
219
|
+
var processing = {
|
|
220
|
+
ko: "처리 중",
|
|
221
|
+
en: "Processing",
|
|
222
|
+
zh: "处理中",
|
|
223
|
+
ja: "処理中",
|
|
224
|
+
es: "Procesando"
|
|
225
|
+
};
|
|
219
226
|
var deleting = {
|
|
220
227
|
ko: "삭제 중",
|
|
221
228
|
en: "Deleting",
|
|
@@ -269,9 +276,10 @@ var defaultTranslations = {
|
|
|
269
276
|
es: "Eliminar"
|
|
270
277
|
},
|
|
271
278
|
downloading: downloading,
|
|
279
|
+
processing: processing,
|
|
272
280
|
deleting: deleting,
|
|
273
281
|
close: close
|
|
274
282
|
};
|
|
275
283
|
|
|
276
|
-
export { anonymous, clear, close, component, copied, copy, copy_error_details, defaultTranslations as default, deleting, download, downloading, error_boundary_default_message, error_boundary_subtitle, error_boundary_title, error_details_copied, error_id, get_started, go_next_page_button, month_range_placeholder, next, page, pagination_items_per_page, pagination_range_text, previous, refresh_page, see_less, see_more, support_help_text, support_information, time, try_again, unknown, upload_your_file, user_id };
|
|
284
|
+
export { anonymous, clear, close, component, copied, copy, copy_error_details, defaultTranslations as default, deleting, download, downloading, error_boundary_default_message, error_boundary_subtitle, error_boundary_title, error_details_copied, error_id, get_started, go_next_page_button, month_range_placeholder, next, page, pagination_items_per_page, pagination_range_text, previous, processing, refresh_page, see_less, see_more, support_help_text, support_information, time, try_again, unknown, upload_your_file, user_id };
|
|
277
285
|
//# sourceMappingURL=Defaults.translations.json.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Defaults.translations.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Defaults.translations.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import { Button as ChakraButton, SystemStyleObject } from '@chakra-ui/react';
|
|
3
3
|
|
|
4
|
+
import { useTranslate } from '@/hooks/useTranslate';
|
|
4
5
|
import { focusRing } from '@/utils/focusRing';
|
|
5
6
|
import { mergeCss } from '@/utils/mergeCss';
|
|
6
7
|
|
|
@@ -49,8 +50,19 @@ const ButtonImpl = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
49
50
|
// 4.x callers (untyped JS, `as any`) can still hand us `colorPalette` and
|
|
50
51
|
// an old variant name. Strip it so it never reaches Chakra's own recipe,
|
|
51
52
|
// and map the pair onto a 5.0 role — see `Button.legacy.ts`.
|
|
52
|
-
const {
|
|
53
|
-
|
|
53
|
+
const {
|
|
54
|
+
colorPalette: legacyPalette,
|
|
55
|
+
loadingText: loadingTextProp,
|
|
56
|
+
...rest
|
|
57
|
+
} = restWithLegacy as typeof restWithLegacy & { colorPalette?: unknown };
|
|
58
|
+
// A busy button says what it is doing: 처리 중 unless the call site names
|
|
59
|
+
// the verb (저장 중). `loadingText={null}` opts out — spinner only, and the
|
|
60
|
+
// button keeps its width.
|
|
61
|
+
const translate = useTranslate();
|
|
62
|
+
const loadingText =
|
|
63
|
+
loadingTextProp === undefined
|
|
64
|
+
? translate('processing')
|
|
65
|
+
: (loadingTextProp ?? undefined);
|
|
54
66
|
|
|
55
67
|
let variant: ButtonVariant = variantProp ?? 'subtle';
|
|
56
68
|
let isDestructive = isDestructiveProp;
|
|
@@ -149,6 +161,7 @@ const ButtonImpl = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
149
161
|
ref={ref}
|
|
150
162
|
data-variant={variant}
|
|
151
163
|
data-destructive={isDestructive || undefined}
|
|
164
|
+
loadingText={loadingText}
|
|
152
165
|
{...rest}
|
|
153
166
|
// The `action` icon rule lives in `css` (a nested selector cannot be a
|
|
154
167
|
// style prop); merged so a call site's `css` adds to it.
|