geez-input 1.0.0 → 1.0.2
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 +2 -65
- package/dist/assets/main.css +1 -0
- package/dist/components/geez-input.d.ts +33 -2
- package/dist/components/geez-textarea.d.ts +33 -2
- package/dist/components/utils.d.ts +5 -0
- package/dist/main.d.ts +2 -24
- package/dist/main.js +96 -94
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -7,8 +7,6 @@ A type-safe React library for Geez (Ethiopic) script input with phonetic keyboar
|
|
|
7
7
|
- **Type-Safe**: Built with TypeScript for full type safety with comprehensive JSDoc documentation
|
|
8
8
|
- **Phonetic Keyboard**: Intuitive Latin-to-Geez transformation following standard conventions
|
|
9
9
|
- **Customizable Components**: Pre-styled input and textarea components with toggle support
|
|
10
|
-
- **React Hook**: `useGeez` hook for custom implementations
|
|
11
|
-
- **Tree-Shakeable**: Optimized bundle size with CSS code splitting
|
|
12
10
|
- **Form Library Support**: Works with React Hook Form, Formik, and other form libraries
|
|
13
11
|
- **Controlled & Uncontrolled**: Full support for both component patterns
|
|
14
12
|
|
|
@@ -73,27 +71,6 @@ function MyForm() {
|
|
|
73
71
|
}
|
|
74
72
|
```
|
|
75
73
|
|
|
76
|
-
## Hook API
|
|
77
|
-
|
|
78
|
-
### useGeez
|
|
79
|
-
|
|
80
|
-
For custom implementations, use the `useGeez` hook:
|
|
81
|
-
|
|
82
|
-
```tsx
|
|
83
|
-
import { useGeez } from 'geez-input'
|
|
84
|
-
|
|
85
|
-
function CustomInput() {
|
|
86
|
-
const { onKeyDown } = useGeez({
|
|
87
|
-
enabled: true,
|
|
88
|
-
onTransform: (result) => {
|
|
89
|
-
console.log('Transformed:', result)
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
return <input onKeyDown={onKeyDown} />
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
74
|
## Phonetic Guide
|
|
98
75
|
|
|
99
76
|
The library uses intuitive phonetic mappings:
|
|
@@ -148,39 +125,9 @@ Props:
|
|
|
148
125
|
- `className?: string` - Additional CSS classes
|
|
149
126
|
- `...TextareaHTMLAttributes` - All standard HTML textarea attributes
|
|
150
127
|
|
|
151
|
-
### Hooks
|
|
152
|
-
|
|
153
|
-
#### useGeez(options)
|
|
154
|
-
|
|
155
|
-
Options:
|
|
156
|
-
- `enabled?: boolean` - Enable/disable transformation (default: `true`)
|
|
157
|
-
- `onTransform?: (result: EngineResult) => void` - Callback after each transformation
|
|
158
|
-
|
|
159
|
-
Returns:
|
|
160
|
-
- `onKeyDown: KeyboardEventHandler` - Event handler for keyboard events
|
|
161
|
-
|
|
162
|
-
### Engine
|
|
163
|
-
|
|
164
|
-
#### GeezEngine.transform(textBefore, textAfter, key)
|
|
165
|
-
|
|
166
|
-
Core transformation method:
|
|
167
|
-
- `textBefore: string` - Text before cursor
|
|
168
|
-
- `textAfter: string` - Text after cursor
|
|
169
|
-
- `key: string` - Key pressed
|
|
170
|
-
- Returns: `EngineResult`
|
|
171
|
-
|
|
172
128
|
## TypeScript Support
|
|
173
129
|
|
|
174
|
-
The library is written in TypeScript and provides comprehensive type definitions
|
|
175
|
-
|
|
176
|
-
```tsx
|
|
177
|
-
import type {
|
|
178
|
-
GeezOptions,
|
|
179
|
-
EngineResult,
|
|
180
|
-
PhoneticMap,
|
|
181
|
-
SyllableMap
|
|
182
|
-
} from 'geez-input'
|
|
183
|
-
```
|
|
130
|
+
The library is written in TypeScript and provides comprehensive type definitions for all component props.
|
|
184
131
|
|
|
185
132
|
## Browser Support
|
|
186
133
|
|
|
@@ -194,15 +141,5 @@ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for det
|
|
|
194
141
|
|
|
195
142
|
## License
|
|
196
143
|
|
|
197
|
-
MIT
|
|
198
|
-
|
|
199
|
-
## Links
|
|
200
|
-
|
|
201
|
-
- [GitHub Repository](https://github.com/yourusername/geez-library)
|
|
202
|
-
- [NPM Package](https://www.npmjs.com/package/geez-input)
|
|
203
|
-
- [Documentation Site](https://geez-library.vercel.app)
|
|
204
|
-
- [Issue Tracker](https://github.com/yourusername/geez-library/issues)
|
|
205
|
-
|
|
206
|
-
## Credits
|
|
144
|
+
MIT [LICENSE](LICENSE)
|
|
207
145
|
|
|
208
|
-
Built with TypeScript, React, and Vite.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.geez-input-wrapper{position:relative;width:100%}.geez-input-field{width:100%;background-color:var(--geez-bg-paper, #fefefe);border:2px solid var(--geez-border-gold, rgba(212, 175, 55, .2));outline:none;padding:1rem;font-family:var(--geez-font-serif, Georgia, serif);font-size:1.125rem;transition:all .2s ease}.geez-input-field:focus{border-color:var(--geez-border-crimson, #dc143c)}.geez-input-toggle{position:absolute;right:1rem;top:50%;transform:translateY(-50%);padding:.375rem .75rem;border-radius:.375rem;transition:all .2s ease;z-index:10;font-weight:600;font-size:.875rem;border:none;cursor:pointer}.geez-input-toggle--active{background-color:var(--geez-bg-crimson, #dc143c);color:var(--geez-text-white, #ffffff)}.geez-input-toggle--inactive{background-color:var(--geez-bg-gold-light, rgba(212, 175, 55, .1));color:var(--geez-text-gold, #d4af37)}.geez-textarea-wrapper{position:relative;width:100%}.geez-textarea-field{width:100%;background-color:var(--geez-bg-paper, #fefefe);border:2px solid var(--geez-border-gold, rgba(212, 175, 55, .2));outline:none;padding:1.5rem;font-family:var(--geez-font-serif, Georgia, serif);font-size:1.125rem;line-height:1.75;transition:all .2s ease;min-height:150px}.geez-textarea-field:focus{border-color:var(--geez-border-crimson, #dc143c)}.geez-textarea-toggle{position:absolute;right:1rem;top:1rem;padding:.375rem .75rem;border-radius:.375rem;transition:all .2s ease;z-index:10;font-weight:600;font-size:.875rem;border:none;cursor:pointer}.geez-textarea-toggle--active{background-color:var(--geez-bg-crimson, #dc143c);color:var(--geez-text-white, #ffffff)}.geez-textarea-toggle--inactive{background-color:var(--geez-bg-gold-light, rgba(212, 175, 55, .1));color:var(--geez-text-gold, #d4af37)}
|
|
@@ -12,7 +12,15 @@ export interface GeezInputProps extends React.InputHTMLAttributes<HTMLInputEleme
|
|
|
12
12
|
/**
|
|
13
13
|
* Additional CSS classes to apply to the input wrapper
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
wrapperClassName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Additional CSS classes to apply to the input field
|
|
18
|
+
*/
|
|
19
|
+
inputClassName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Additional CSS classes to apply to the toggle button
|
|
22
|
+
*/
|
|
23
|
+
buttonClassName?: string;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Styled input component with built-in Geez phonetic keyboard support
|
|
@@ -22,7 +30,8 @@ export interface GeezInputProps extends React.InputHTMLAttributes<HTMLInputEleme
|
|
|
22
30
|
* - Phonetic transformation (type 'hello' → 'ሀልሎ')
|
|
23
31
|
* - Full support for controlled and uncontrolled component patterns
|
|
24
32
|
* - Forward ref support for form libraries
|
|
25
|
-
* - Styled with
|
|
33
|
+
* - Styled with CSS classes that can be customized via className props
|
|
34
|
+
* - Supports Tailwind CSS, CSS modules, or any CSS framework
|
|
26
35
|
*
|
|
27
36
|
* @example
|
|
28
37
|
* \`\`\`tsx
|
|
@@ -53,5 +62,27 @@ export interface GeezInputProps extends React.InputHTMLAttributes<HTMLInputEleme
|
|
|
53
62
|
* return <GeezInput {...register('name')} />
|
|
54
63
|
* }
|
|
55
64
|
* \`\`\`
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* \`\`\`tsx
|
|
68
|
+
* // Custom styling with Tailwind CSS
|
|
69
|
+
* <GeezInput
|
|
70
|
+
* wrapperClassName="mb-4"
|
|
71
|
+
* inputClassName="rounded-lg shadow-md"
|
|
72
|
+
* buttonClassName="hover:opacity-80"
|
|
73
|
+
* placeholder="Type here..."
|
|
74
|
+
* />
|
|
75
|
+
* \`\`\`
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* \`\`\`tsx
|
|
79
|
+
* // Custom styling with CSS classes
|
|
80
|
+
* <GeezInput
|
|
81
|
+
* wrapperClassName="my-custom-wrapper"
|
|
82
|
+
* inputClassName="my-custom-input"
|
|
83
|
+
* buttonClassName="my-custom-button"
|
|
84
|
+
* placeholder="Type here..."
|
|
85
|
+
* />
|
|
86
|
+
* \`\`\`
|
|
56
87
|
*/
|
|
57
88
|
export declare const GeezInput: React.ForwardRefExoticComponent<GeezInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -12,7 +12,15 @@ export interface GeezTextAreaProps extends React.TextareaHTMLAttributes<HTMLText
|
|
|
12
12
|
/**
|
|
13
13
|
* Additional CSS classes to apply to the textarea wrapper
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
wrapperClassName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Additional CSS classes to apply to the textarea field
|
|
18
|
+
*/
|
|
19
|
+
textareaClassName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Additional CSS classes to apply to the toggle button
|
|
22
|
+
*/
|
|
23
|
+
buttonClassName?: string;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Styled textarea component with built-in Geez phonetic keyboard support
|
|
@@ -22,7 +30,8 @@ export interface GeezTextAreaProps extends React.TextareaHTMLAttributes<HTMLText
|
|
|
22
30
|
* - Phonetic transformation for longer text
|
|
23
31
|
* - Full support for controlled and uncontrolled component patterns
|
|
24
32
|
* - Forward ref support for form libraries
|
|
25
|
-
* - Styled with
|
|
33
|
+
* - Styled with CSS classes that can be customized via className props
|
|
34
|
+
* - Supports Tailwind CSS, CSS modules, or any CSS framework
|
|
26
35
|
* - Minimum height of 150px for comfortable writing
|
|
27
36
|
*
|
|
28
37
|
* @example
|
|
@@ -51,5 +60,27 @@ export interface GeezTextAreaProps extends React.TextareaHTMLAttributes<HTMLText
|
|
|
51
60
|
* // Start with English mode
|
|
52
61
|
* <GeezTextArea defaultGeez={false} placeholder="Type here..." />
|
|
53
62
|
* \`\`\`
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* \`\`\`tsx
|
|
66
|
+
* // Custom styling with Tailwind CSS
|
|
67
|
+
* <GeezTextArea
|
|
68
|
+
* wrapperClassName="mb-4"
|
|
69
|
+
* textareaClassName="rounded-lg shadow-md resize-none"
|
|
70
|
+
* buttonClassName="hover:opacity-80"
|
|
71
|
+
* placeholder="Write here..."
|
|
72
|
+
* />
|
|
73
|
+
* \`\`\`
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* \`\`\`tsx
|
|
77
|
+
* // Custom styling with CSS classes
|
|
78
|
+
* <GeezTextArea
|
|
79
|
+
* wrapperClassName="my-custom-wrapper"
|
|
80
|
+
* textareaClassName="my-custom-textarea"
|
|
81
|
+
* buttonClassName="my-custom-button"
|
|
82
|
+
* placeholder="Write here..."
|
|
83
|
+
* />
|
|
84
|
+
* \`\`\`
|
|
54
85
|
*/
|
|
55
86
|
export declare const GeezTextArea: React.ForwardRefExoticComponent<GeezTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
package/dist/main.d.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Geez Input Library - Phonetic keyboard support for Geez/Ethiopic script in React
|
|
4
4
|
*
|
|
5
|
-
* This library provides React components
|
|
5
|
+
* This library provides React components for typing in Geez (Ethiopic) script
|
|
6
6
|
* using Latin phonetic characters. It supports Amharic, Tigrinya, and other languages
|
|
7
7
|
* written in the Geez script.
|
|
8
8
|
*
|
|
9
9
|
* ## Quick Start
|
|
10
10
|
*
|
|
11
11
|
* \`\`\`tsx
|
|
12
|
-
* import { GeezInput, GeezTextArea
|
|
12
|
+
* import { GeezInput, GeezTextArea } from 'geez-input'
|
|
13
13
|
*
|
|
14
14
|
* function App() {
|
|
15
15
|
* return (
|
|
@@ -26,28 +26,6 @@
|
|
|
26
26
|
* ### Components
|
|
27
27
|
* - {@link GeezInput} - Styled input with Geez keyboard
|
|
28
28
|
* - {@link GeezTextArea} - Styled textarea with Geez keyboard
|
|
29
|
-
*
|
|
30
|
-
* ### Hooks
|
|
31
|
-
* - {@link useGeez} - Hook for custom implementations
|
|
32
|
-
*
|
|
33
|
-
* ### Engine
|
|
34
|
-
* - {@link GeezEngine} - Core transformation engine
|
|
35
|
-
*
|
|
36
|
-
* ### Types
|
|
37
|
-
* - {@link GeezOptions} - Configuration options
|
|
38
|
-
* - {@link EngineResult} - Transformation result
|
|
39
|
-
* - {@link PhoneticMap} - Character mapping type
|
|
40
|
-
* - {@link SyllableMap} - Syllable mapping type
|
|
41
|
-
*
|
|
42
|
-
* ### Mappings
|
|
43
|
-
* - {@link CONSONANTS} - Base consonant mappings
|
|
44
|
-
* - {@link SYLLABLES} - Syllable form mappings
|
|
45
|
-
* - {@link PUNCTUATION} - Punctuation mappings
|
|
46
|
-
* - {@link MULTI_CONSONANTS} - Multi-character consonants
|
|
47
29
|
*/
|
|
48
|
-
export * from './engine';
|
|
49
|
-
export * from './use-geez';
|
|
50
|
-
export * from './types';
|
|
51
|
-
export * from './mapping';
|
|
52
30
|
export * from './components/geez-input';
|
|
53
31
|
export * from './components/geez-textarea';
|
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as v, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as S, forwardRef as y, useState as N } from "react";
|
|
3
|
+
import './assets/main.css';const A = {
|
|
4
4
|
h: "ህ",
|
|
5
5
|
l: "ል",
|
|
6
6
|
m: "ም",
|
|
@@ -40,7 +40,7 @@ const f = {
|
|
|
40
40
|
A: "ኣ",
|
|
41
41
|
E: "ኤ",
|
|
42
42
|
O: "ዖ"
|
|
43
|
-
},
|
|
43
|
+
}, g = {
|
|
44
44
|
አ: {
|
|
45
45
|
a: "አ",
|
|
46
46
|
e: "አ",
|
|
@@ -384,13 +384,13 @@ const f = {
|
|
|
384
384
|
o: "ቮ",
|
|
385
385
|
ua: "ቯ"
|
|
386
386
|
}
|
|
387
|
-
},
|
|
387
|
+
}, z = {
|
|
388
388
|
ስh: "ሽ",
|
|
389
389
|
ችh: "ች",
|
|
390
390
|
ንy: "ኝ",
|
|
391
391
|
ዝh: "ዥ",
|
|
392
392
|
ጽh: "ፁ"
|
|
393
|
-
},
|
|
393
|
+
}, b = {
|
|
394
394
|
":": "፡",
|
|
395
395
|
"፡:": "።",
|
|
396
396
|
"።:": "፡",
|
|
@@ -398,7 +398,7 @@ const f = {
|
|
|
398
398
|
"፣,": "፤",
|
|
399
399
|
";": "፤"
|
|
400
400
|
};
|
|
401
|
-
class
|
|
401
|
+
class T {
|
|
402
402
|
/**
|
|
403
403
|
* Transform input text based on a new key press
|
|
404
404
|
*
|
|
@@ -430,50 +430,50 @@ class S {
|
|
|
430
430
|
* // → { transformedValue: 'ሽ', newCursorPosition: 1, isReplacement: true }
|
|
431
431
|
* \`\`\`
|
|
432
432
|
*/
|
|
433
|
-
static transform(e, a,
|
|
434
|
-
const n = e.slice(-1),
|
|
435
|
-
if (
|
|
433
|
+
static transform(e, a, i) {
|
|
434
|
+
const n = e.slice(-1), s = n + i;
|
|
435
|
+
if (b[s])
|
|
436
436
|
return {
|
|
437
|
-
transformedValue: e.slice(0, -1) +
|
|
437
|
+
transformedValue: e.slice(0, -1) + b[s] + a,
|
|
438
438
|
newCursorPosition: e.length,
|
|
439
439
|
isReplacement: !0
|
|
440
440
|
};
|
|
441
|
-
if (
|
|
441
|
+
if (b[i])
|
|
442
442
|
return {
|
|
443
|
-
transformedValue: e +
|
|
443
|
+
transformedValue: e + b[i] + a,
|
|
444
444
|
newCursorPosition: e.length + 1,
|
|
445
445
|
isReplacement: !1
|
|
446
446
|
};
|
|
447
|
-
if (
|
|
447
|
+
if (z[s])
|
|
448
448
|
return {
|
|
449
|
-
transformedValue: e.slice(0, -1) +
|
|
449
|
+
transformedValue: e.slice(0, -1) + z[s] + a,
|
|
450
450
|
newCursorPosition: e.length,
|
|
451
451
|
isReplacement: !0
|
|
452
452
|
};
|
|
453
|
-
if (
|
|
453
|
+
if (g[n] && g[n][i])
|
|
454
454
|
return {
|
|
455
|
-
transformedValue: e.slice(0, -1) +
|
|
455
|
+
transformedValue: e.slice(0, -1) + g[n][i] + a,
|
|
456
456
|
newCursorPosition: e.length,
|
|
457
457
|
isReplacement: !0
|
|
458
458
|
};
|
|
459
|
-
if (["a", "e", "i"].includes(
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
459
|
+
if (["a", "e", "i"].includes(i)) {
|
|
460
|
+
const t = this.findSadisBase(n);
|
|
461
|
+
if (t && g[t]) {
|
|
462
|
+
const l = i + i;
|
|
463
|
+
if (g[t][l])
|
|
464
464
|
return {
|
|
465
|
-
transformedValue: e.slice(0, -1) +
|
|
465
|
+
transformedValue: e.slice(0, -1) + g[t][l] + a,
|
|
466
466
|
newCursorPosition: e.length,
|
|
467
467
|
isReplacement: !0
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
return
|
|
472
|
-
transformedValue: e +
|
|
471
|
+
return A[i] ? {
|
|
472
|
+
transformedValue: e + A[i] + a,
|
|
473
473
|
newCursorPosition: e.length + 1,
|
|
474
474
|
isReplacement: !1
|
|
475
475
|
} : {
|
|
476
|
-
transformedValue: e +
|
|
476
|
+
transformedValue: e + i + a,
|
|
477
477
|
newCursorPosition: e.length + 1,
|
|
478
478
|
isReplacement: !1
|
|
479
479
|
};
|
|
@@ -496,14 +496,14 @@ class S {
|
|
|
496
496
|
* \`\`\`
|
|
497
497
|
*/
|
|
498
498
|
static findSadisBase(e) {
|
|
499
|
-
for (const [a,
|
|
500
|
-
if (a === e || Object.values(
|
|
499
|
+
for (const [a, i] of Object.entries(g))
|
|
500
|
+
if (a === e || Object.values(i).includes(e)) return a;
|
|
501
501
|
return null;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
const
|
|
505
|
-
const { enabled: e = !0, onTransform: a } =
|
|
506
|
-
return { onKeyDown:
|
|
504
|
+
const D = (r = {}) => {
|
|
505
|
+
const { enabled: e = !0, onTransform: a } = r;
|
|
506
|
+
return { onKeyDown: S(
|
|
507
507
|
(n) => {
|
|
508
508
|
if (!e || [
|
|
509
509
|
"Backspace",
|
|
@@ -521,108 +521,110 @@ const z = (c = {}) => {
|
|
|
521
521
|
"PageDown"
|
|
522
522
|
].includes(n.key) || n.ctrlKey || n.metaKey || n.key.length !== 1 || n.altKey) return;
|
|
523
523
|
n.preventDefault();
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
let
|
|
527
|
-
typeof InputEvent < "u" ?
|
|
524
|
+
const t = n.currentTarget, { selectionStart: l, selectionEnd: h, value: p } = t, o = p.substring(0, l || 0), w = p.substring(h || 0), c = T.transform(o, w, n.key), d = Object.getOwnPropertyDescriptor(t.constructor.prototype, "value");
|
|
525
|
+
d && d.set ? d.set.bind(t)(c.transformedValue) : t.value = c.transformedValue;
|
|
526
|
+
let E;
|
|
527
|
+
typeof InputEvent < "u" ? E = new InputEvent("input", {
|
|
528
528
|
bubbles: !0,
|
|
529
529
|
cancelable: !0,
|
|
530
530
|
inputType: "insertText",
|
|
531
531
|
data: n.key
|
|
532
|
-
}) :
|
|
533
|
-
const
|
|
532
|
+
}) : E = new Event("input", { bubbles: !0, cancelable: !0 }), t.dispatchEvent(E);
|
|
533
|
+
const u = new Event("change", {
|
|
534
534
|
bubbles: !0,
|
|
535
535
|
cancelable: !0
|
|
536
536
|
});
|
|
537
|
-
|
|
538
|
-
if (document.activeElement ===
|
|
537
|
+
t.dispatchEvent(u), requestAnimationFrame(() => {
|
|
538
|
+
if (document.activeElement === t)
|
|
539
539
|
try {
|
|
540
|
-
|
|
540
|
+
t.setSelectionRange(c.newCursorPosition, c.newCursorPosition);
|
|
541
541
|
} catch {
|
|
542
542
|
}
|
|
543
|
-
}), a && a(
|
|
543
|
+
}), a && a(c);
|
|
544
544
|
},
|
|
545
545
|
[e, a]
|
|
546
546
|
) };
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
547
|
+
};
|
|
548
|
+
function m(...r) {
|
|
549
|
+
return r.filter(Boolean).join(" ");
|
|
550
|
+
}
|
|
551
|
+
const G = y(
|
|
552
|
+
({ defaultGeez: r = !0, wrapperClassName: e, inputClassName: a, buttonClassName: i, className: n, onChange: s, onKeyDown: t, value: l, ...h }, p) => {
|
|
553
|
+
const [o, w] = N(r), { onKeyDown: c } = D({ enabled: o }), d = (u) => {
|
|
554
|
+
c(u), t && t(u);
|
|
555
|
+
}, E = (u) => {
|
|
556
|
+
s && s(u);
|
|
557
|
+
};
|
|
558
|
+
return /* @__PURE__ */ v("div", { className: m("geez-input-wrapper", e), children: [
|
|
559
|
+
/* @__PURE__ */ f(
|
|
555
560
|
"input",
|
|
556
561
|
{
|
|
557
|
-
...
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
a && a(s);
|
|
564
|
-
},
|
|
565
|
-
className: `w-full bg-paper border-2 border-gold/20 focus:border-crimson outline-none p-4 font-serif text-lg transition-all ${e || ""}`
|
|
562
|
+
...h,
|
|
563
|
+
...l !== void 0 && { value: l },
|
|
564
|
+
ref: p,
|
|
565
|
+
onKeyDown: d,
|
|
566
|
+
onChange: E,
|
|
567
|
+
className: m("geez-input-field", n, a)
|
|
566
568
|
}
|
|
567
569
|
),
|
|
568
|
-
/* @__PURE__ */
|
|
570
|
+
/* @__PURE__ */ f(
|
|
569
571
|
"button",
|
|
570
572
|
{
|
|
571
573
|
type: "button",
|
|
572
|
-
onClick: () =>
|
|
573
|
-
className:
|
|
574
|
-
|
|
574
|
+
onClick: () => w(!o),
|
|
575
|
+
className: m(
|
|
576
|
+
"geez-input-toggle",
|
|
577
|
+
o ? "geez-input-toggle--active" : "geez-input-toggle--inactive",
|
|
578
|
+
i
|
|
579
|
+
),
|
|
580
|
+
title: o ? "Switch to English" : "Switch to Ge'ez",
|
|
575
581
|
tabIndex: -1,
|
|
576
|
-
children:
|
|
582
|
+
children: o ? "አማ" : "EN"
|
|
577
583
|
}
|
|
578
584
|
)
|
|
579
585
|
] });
|
|
580
586
|
}
|
|
581
587
|
);
|
|
582
|
-
|
|
583
|
-
const
|
|
584
|
-
({ defaultGeez:
|
|
585
|
-
const [
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
b(s), t && t(s);
|
|
590
|
-
}, u = (s) => {
|
|
591
|
-
a && a(s);
|
|
588
|
+
G.displayName = "GeezInput";
|
|
589
|
+
const P = y(
|
|
590
|
+
({ defaultGeez: r = !0, wrapperClassName: e, textareaClassName: a, buttonClassName: i, className: n, onChange: s, onKeyDown: t, value: l, ...h }, p) => {
|
|
591
|
+
const [o, w] = N(r), { onKeyDown: c } = D({ enabled: o }), d = (u) => {
|
|
592
|
+
c(u), t && t(u);
|
|
593
|
+
}, E = (u) => {
|
|
594
|
+
s && s(u);
|
|
592
595
|
};
|
|
593
|
-
return /* @__PURE__ */ v("div", { className:
|
|
594
|
-
/* @__PURE__ */
|
|
596
|
+
return /* @__PURE__ */ v("div", { className: m("geez-textarea-wrapper", e), children: [
|
|
597
|
+
/* @__PURE__ */ f(
|
|
595
598
|
"textarea",
|
|
596
599
|
{
|
|
597
|
-
...
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
600
|
+
...h,
|
|
601
|
+
...l !== void 0 && { value: l },
|
|
602
|
+
ref: p,
|
|
603
|
+
onKeyDown: d,
|
|
604
|
+
onChange: E,
|
|
605
|
+
className: m("geez-textarea-field", n, a)
|
|
602
606
|
}
|
|
603
607
|
),
|
|
604
|
-
/* @__PURE__ */
|
|
608
|
+
/* @__PURE__ */ f(
|
|
605
609
|
"button",
|
|
606
610
|
{
|
|
607
611
|
type: "button",
|
|
608
|
-
onClick: () =>
|
|
609
|
-
className:
|
|
610
|
-
|
|
612
|
+
onClick: () => w(!o),
|
|
613
|
+
className: m(
|
|
614
|
+
"geez-textarea-toggle",
|
|
615
|
+
o ? "geez-textarea-toggle--active" : "geez-textarea-toggle--inactive",
|
|
616
|
+
i
|
|
617
|
+
),
|
|
618
|
+
title: o ? "Switch to English" : "Switch to Ge'ez",
|
|
611
619
|
tabIndex: -1,
|
|
612
|
-
children:
|
|
620
|
+
children: o ? "አማ" : "EN"
|
|
613
621
|
}
|
|
614
622
|
)
|
|
615
623
|
] });
|
|
616
624
|
}
|
|
617
625
|
);
|
|
618
|
-
|
|
626
|
+
P.displayName = "GeezTextArea";
|
|
619
627
|
export {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
P as GeezInput,
|
|
623
|
-
T as GeezTextArea,
|
|
624
|
-
w as MULTI_CONSONANTS,
|
|
625
|
-
m as PUNCTUATION,
|
|
626
|
-
r as SYLLABLES,
|
|
627
|
-
z as useGeez
|
|
628
|
+
G as GeezInput,
|
|
629
|
+
P as GeezTextArea
|
|
628
630
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geez-input",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Type-safe React library for Geez (Ethiopic) script input with phonetic keyboard support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"geez",
|
|
@@ -13,16 +13,20 @@
|
|
|
13
13
|
"input",
|
|
14
14
|
"phonetic"
|
|
15
15
|
],
|
|
16
|
-
"homepage": "https://github.com/
|
|
16
|
+
"homepage": "https://github.com/onesamket/geez-input#readme",
|
|
17
17
|
"bugs": {
|
|
18
|
-
"url": "https://github.com/
|
|
18
|
+
"url": "https://github.com/onesamket/geez-input/issues"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/
|
|
22
|
+
"url": "https://github.com/onesamket/geez-input.git"
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
|
-
"author":
|
|
25
|
+
"author":{
|
|
26
|
+
"name": "Tewodros Birhanu",
|
|
27
|
+
"email": "onesamket@gmail.com",
|
|
28
|
+
"url": "https://github.com/onesamket"
|
|
29
|
+
},
|
|
26
30
|
"sideEffects": [
|
|
27
31
|
"**/*.css"
|
|
28
32
|
],
|