@giro-ds/react 11.0.0 → 11.1.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/index.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.esm.js +12 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1038,6 +1038,13 @@ interface VirtualKeyboardProps extends Omit<BaseProps, 'disabled'> {
|
|
|
1038
1038
|
Emoji?: boolean;
|
|
1039
1039
|
/** Placeholder do TextField exibido no modo `fixed` */
|
|
1040
1040
|
textFieldPlaceholder?: string;
|
|
1041
|
+
/** Escala do TextField exibido no modo `fixed` */
|
|
1042
|
+
textFieldScale?: 1 | 1.5 | 2;
|
|
1043
|
+
/**
|
|
1044
|
+
* Controla a exibição da tecla Enter no teclado.
|
|
1045
|
+
* @default true
|
|
1046
|
+
*/
|
|
1047
|
+
showEnterKey?: boolean;
|
|
1041
1048
|
/** Texto de ajuda do TextField exibido no modo `fixed` */
|
|
1042
1049
|
helperText?: string;
|
|
1043
1050
|
/** Sinaliza erro no TextField exibido no modo `fixed` */
|
package/dist/index.esm.js
CHANGED
|
@@ -2663,6 +2663,7 @@ const LAYOUT_DISPLAY = {
|
|
|
2663
2663
|
|
|
2664
2664
|
const EMOTICON_KEY = '{emoticon}';
|
|
2665
2665
|
const DOWN_KEYBOARD_KEY = '{downkeyboard}';
|
|
2666
|
+
const ENTER_KEY = '{enter}';
|
|
2666
2667
|
const removeKeyFromLayout = (layout, key) => Object.fromEntries(Object.entries(layout).map(([layoutName, rows]) => [
|
|
2667
2668
|
layoutName,
|
|
2668
2669
|
rows.map((row) => row.split(key).join(' ').replace(/\s+/g, ' ').trim()),
|
|
@@ -2724,7 +2725,7 @@ const NATIVE_LAYOUTS = {
|
|
|
2724
2725
|
const NATIVE_LAYOUT_KEYS = new Set([
|
|
2725
2726
|
'default', 'numeric',
|
|
2726
2727
|
]);
|
|
2727
|
-
const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFixed = false) => {
|
|
2728
|
+
const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFixed = false, showEnterKey = true) => {
|
|
2728
2729
|
const layout = NATIVE_LAYOUTS[type] ?? NATIVE_LAYOUTS.default ?? null;
|
|
2729
2730
|
if (!layout)
|
|
2730
2731
|
return null;
|
|
@@ -2735,6 +2736,9 @@ const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFi
|
|
|
2735
2736
|
if (!showDownKeyboardButton) {
|
|
2736
2737
|
computedLayout = removeKeyFromLayout(computedLayout, DOWN_KEYBOARD_KEY);
|
|
2737
2738
|
}
|
|
2739
|
+
if (!showEnterKey) {
|
|
2740
|
+
computedLayout = removeKeyFromLayout(computedLayout, ENTER_KEY);
|
|
2741
|
+
}
|
|
2738
2742
|
if (isFixed) {
|
|
2739
2743
|
computedLayout = Object.fromEntries(Object.entries(computedLayout).map(([layoutName, rows]) => [
|
|
2740
2744
|
layoutName,
|
|
@@ -2760,7 +2764,7 @@ const SHIFT_TOGGLES = {
|
|
|
2760
2764
|
alt2: 'alt',
|
|
2761
2765
|
};
|
|
2762
2766
|
|
|
2763
|
-
var styles$j = {"container":"VirtualKeyboard-module__container___A-e0I","layout--numeric":"VirtualKeyboard-module__layout--numeric___zfd7G","
|
|
2767
|
+
var styles$j = {"container":"VirtualKeyboard-module__container___A-e0I","layout--numeric":"VirtualKeyboard-module__layout--numeric___zfd7G","mode--fixed":"VirtualKeyboard-module__mode--fixed___1eFY1","layout--default":"VirtualKeyboard-module__layout--default___qyY1b","textFieldContainer":"VirtualKeyboard-module__textFieldContainer___XxGen","keyboardWrapper":"VirtualKeyboard-module__keyboardWrapper___jryTf","keyboardNumpadActive":"VirtualKeyboard-module__keyboardNumpadActive___jPpJD","overlay":"VirtualKeyboard-module__overlay___a5y7i","overlayOpen":"VirtualKeyboard-module__overlayOpen___hREu-","textFieldWrapper":"VirtualKeyboard-module__textFieldWrapper___bmi-z","keyPreview":"VirtualKeyboard-module__keyPreview___oWaO1","accentMenu":"VirtualKeyboard-module__accentMenu___A6tTy","accentMenuRow":"VirtualKeyboard-module__accentMenuRow___3kbvT","accentOption":"VirtualKeyboard-module__accentOption___ao-Ta"};
|
|
2764
2768
|
|
|
2765
2769
|
const LONG_PRESS_DELAY_MS = 400;
|
|
2766
2770
|
const ACCENT_OPTIONS = {
|
|
@@ -2800,12 +2804,12 @@ const ACCENT_OPTIONS = {
|
|
|
2800
2804
|
* <VirtualKeyboard targetRef={inputRef} value={value} onChange={setValue} />
|
|
2801
2805
|
* ```
|
|
2802
2806
|
*/
|
|
2803
|
-
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, maxLength, Emoji = false, className, id, textFieldPlaceholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, }) => {
|
|
2807
|
+
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, maxLength, Emoji = false, className, id, textFieldPlaceholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, textFieldScale = 1, showEnterKey = true, }) => {
|
|
2804
2808
|
const [layoutName, setLayoutName] = useState('default');
|
|
2805
2809
|
const [capsLockOn, setCapsLockOn] = useState(false);
|
|
2806
2810
|
const [accentMenu, setAccentMenu] = useState(null);
|
|
2807
2811
|
const [accentMenuOffsetX, setAccentMenuOffsetX] = useState(0);
|
|
2808
|
-
const [activeLayout, setActiveLayout] = useState(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed'));
|
|
2812
|
+
const [activeLayout, setActiveLayout] = useState(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey));
|
|
2809
2813
|
const visualType = NATIVE_LAYOUT_KEYS.has(type) ? type : 'default';
|
|
2810
2814
|
const [isOpen, setIsOpen] = useState(variant !== 'native');
|
|
2811
2815
|
const hideTimeoutRef = useRef(null);
|
|
@@ -2918,8 +2922,8 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2918
2922
|
useEffect(() => {
|
|
2919
2923
|
setLayoutName('default');
|
|
2920
2924
|
setCapsLockOn(false);
|
|
2921
|
-
setActiveLayout(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed'));
|
|
2922
|
-
}, [type, Emoji, variant]);
|
|
2925
|
+
setActiveLayout(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey));
|
|
2926
|
+
}, [type, Emoji, variant, showEnterKey]);
|
|
2923
2927
|
useEffect(() => {
|
|
2924
2928
|
if (!Emoji && layoutName === 'emoticon') {
|
|
2925
2929
|
setLayoutName(type === 'numeric' ? 'abc' : 'default');
|
|
@@ -3269,7 +3273,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3269
3273
|
'{bksp}': (baseDisplay['{bksp}'] ?? '').replace(/\s*Apagar$/, ''),
|
|
3270
3274
|
};
|
|
3271
3275
|
}, [visualType, variant]);
|
|
3272
|
-
const keyboardEl = activeLayout ? (jsxs("div", { ref: keyboardWrapperRef, className: styles$j.keyboardWrapper, onPointerDownCapture: handleLongPressStart, onPointerUpCapture: handleLongPressEnd, onPointerLeave: handleLongPressEnd, onPointerCancelCapture: handleLongPressEnd, children: [jsx(Keyboard, { keyboardRef: (instance) => {
|
|
3276
|
+
const keyboardEl = activeLayout ? (jsxs("div", { ref: keyboardWrapperRef, className: clsx(styles$j.keyboardWrapper, ((type === 'numeric' && layoutName === 'default') || layoutName === 'numbers') && styles$j.keyboardNumpadActive), onPointerDownCapture: handleLongPressStart, onPointerUpCapture: handleLongPressEnd, onPointerLeave: handleLongPressEnd, onPointerCancelCapture: handleLongPressEnd, children: [jsx(Keyboard, { keyboardRef: (instance) => {
|
|
3273
3277
|
keyboardInstanceRef.current = instance;
|
|
3274
3278
|
if (instance) {
|
|
3275
3279
|
instance.setInput(valueRef.current);
|
|
@@ -3309,7 +3313,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3309
3313
|
if (variant === 'native' && typeof document !== 'undefined') {
|
|
3310
3314
|
return createPortal(jsx("div", { id: id, className: clsx(styles$j.overlay, { [styles$j.overlayOpen]: isOpen }, styles$j[`layout--${visualType}`], className), children: keyboardEl }), document.body);
|
|
3311
3315
|
}
|
|
3312
|
-
return (jsxs("div", { id: id, className: clsx(styles$j.container, styles$j[`mode--${variant}`], styles$j[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsx("div", { className: styles$j.textFieldContainer, children: jsx(TextField$1, { placeholder: textFieldPlaceholder, value: value, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, readOnly: true, disableAutoComplete: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$j.textFieldWrapper }) })), keyboardEl] }));
|
|
3316
|
+
return (jsxs("div", { id: id, className: clsx(styles$j.container, styles$j[`mode--${variant}`], styles$j[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsx("div", { className: styles$j.textFieldContainer, children: jsx(TextField$1, { placeholder: textFieldPlaceholder, value: value, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, readOnly: true, disableAutoComplete: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$j.textFieldWrapper, scale: textFieldScale }) })), keyboardEl] }));
|
|
3313
3317
|
};
|
|
3314
3318
|
|
|
3315
3319
|
var styles$i = {"container":"TextField-module__container___WJHFR","inputWrapper":"TextField-module__inputWrapper___INjfd","inputContainer":"TextField-module__inputContainer___3EsFJ","icon":"TextField-module__icon___p1vwi","clearButton":"TextField-module__clearButton___kgOot","inputWithIcon":"TextField-module__inputWithIcon___shqkL","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP","attachedToVirtualKeyboard":"TextField-module__attachedToVirtualKeyboard___fuO2O","errorWithMessage":"TextField-module__errorWithMessage___m-5AA","clearButtonIcon":"TextField-module__clearButtonIcon___Z2iyc"};
|