@seed-design/lynx-react 0.3.1 → 0.4.1
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/lib/components/Field/Field.d.ts +47 -0
- package/lib/components/Field/Field.d.ts.map +1 -0
- package/lib/components/Field/Field.jsx +121 -0
- package/lib/components/Field/Field.namespace.d.ts +2 -0
- package/lib/components/Field/Field.namespace.d.ts.map +1 -0
- package/lib/components/Field/Field.namespace.js +16 -0
- package/lib/components/Field/context.d.ts +19 -0
- package/lib/components/Field/context.d.ts.map +1 -0
- package/lib/components/Field/context.js +10 -0
- package/lib/components/Field/index.d.ts +3 -0
- package/lib/components/Field/index.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.d.ts +42 -0
- package/lib/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.jsx +140 -0
- package/lib/components/KeyboardAvoidingScrollView/context.d.ts +17 -0
- package/lib/components/KeyboardAvoidingScrollView/context.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/context.js +12 -0
- package/lib/components/KeyboardAvoidingScrollView/engine.d.ts +50 -0
- package/lib/components/KeyboardAvoidingScrollView/engine.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/engine.js +259 -0
- package/lib/components/KeyboardAvoidingScrollView/geometry.d.ts +50 -0
- package/lib/components/KeyboardAvoidingScrollView/geometry.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/geometry.js +90 -0
- package/lib/components/KeyboardAvoidingScrollView/index.d.ts +2 -0
- package/lib/components/KeyboardAvoidingScrollView/index.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/keyboard-event-source.d.ts +11 -0
- package/lib/components/KeyboardAvoidingScrollView/keyboard-event-source.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/keyboard-event-source.js +43 -0
- package/lib/components/KeyboardAvoidingScrollView/native-driver.d.ts +34 -0
- package/lib/components/KeyboardAvoidingScrollView/native-driver.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/native-driver.js +133 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.jsx +36 -5
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- package/lib/components/Stack/Stack.jsx +10 -1
- package/lib/components/TagGroup/TagGroup.d.ts +2 -1
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.jsx +2 -1
- package/lib/components/TextField/TextField.d.ts +131 -0
- package/lib/components/TextField/TextField.d.ts.map +1 -0
- package/lib/components/TextField/TextField.jsx +434 -0
- package/lib/components/TextField/TextField.namespace.d.ts +2 -0
- package/lib/components/TextField/TextField.namespace.d.ts.map +1 -0
- package/lib/components/TextField/TextField.namespace.js +14 -0
- package/lib/components/TextField/context.d.ts +22 -0
- package/lib/components/TextField/context.d.ts.map +1 -0
- package/lib/components/TextField/context.js +7 -0
- package/lib/components/TextField/index.d.ts +4 -0
- package/lib/components/TextField/index.d.ts.map +1 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.d.ts +24 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.d.ts.map +1 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.js +47 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/node_modules/.bun/unicode-segmenter@0.14.5/node_modules/unicode-segmenter/_grapheme_data.js +8 -0
- package/lib/node_modules/.bun/unicode-segmenter@0.14.5/node_modules/unicode-segmenter/_incb_data.js +14 -0
- package/lib/node_modules/.bun/unicode-segmenter@0.14.5/node_modules/unicode-segmenter/core.js +68 -0
- package/lib/node_modules/.bun/unicode-segmenter@0.14.5/node_modules/unicode-segmenter/grapheme.js +175 -0
- package/package.json +7 -5
- package/src/components/Field/Field.namespace.ts +19 -0
- package/src/components/Field/Field.test.tsx +81 -0
- package/src/components/Field/Field.tsx +252 -0
- package/src/components/Field/context.ts +26 -0
- package/src/components/Field/index.ts +21 -0
- package/src/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.test.tsx +267 -0
- package/src/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.tsx +299 -0
- package/src/components/KeyboardAvoidingScrollView/context.ts +24 -0
- package/src/components/KeyboardAvoidingScrollView/engine.test.ts +451 -0
- package/src/components/KeyboardAvoidingScrollView/engine.ts +417 -0
- package/src/components/KeyboardAvoidingScrollView/geometry.test.ts +315 -0
- package/src/components/KeyboardAvoidingScrollView/geometry.ts +194 -0
- package/src/components/KeyboardAvoidingScrollView/index.ts +5 -0
- package/src/components/KeyboardAvoidingScrollView/keyboard-event-source.test.ts +122 -0
- package/src/components/KeyboardAvoidingScrollView/keyboard-event-source.ts +75 -0
- package/src/components/KeyboardAvoidingScrollView/native-driver.test.ts +223 -0
- package/src/components/KeyboardAvoidingScrollView/native-driver.ts +248 -0
- package/src/components/ProgressCircle/ProgressCircle.test.tsx +58 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +42 -5
- package/src/components/Stack/Stack.test.tsx +67 -0
- package/src/components/Stack/Stack.tsx +15 -1
- package/src/components/TagGroup/TagGroup.test.tsx +73 -0
- package/src/components/TagGroup/TagGroup.tsx +4 -2
- package/src/components/TextField/TextField.namespace.ts +16 -0
- package/src/components/TextField/TextField.test.tsx +1052 -0
- package/src/components/TextField/TextField.tsx +954 -0
- package/src/components/TextField/context.ts +33 -0
- package/src/components/TextField/index.ts +23 -0
- package/src/components/TextField/useTextFieldWithGraphemes.test.tsx +80 -0
- package/src/components/TextField/useTextFieldWithGraphemes.ts +78 -0
- package/src/components/index.ts +3 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
2
|
+
import type { ReactNode } from "@lynx-js/react";
|
|
3
|
+
import { render } from "@lynx-js/react/testing-library";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
import * as TagGroup from "./TagGroup.namespace";
|
|
7
|
+
|
|
8
|
+
function getRenderedRoot() {
|
|
9
|
+
const root = elementTree.root;
|
|
10
|
+
|
|
11
|
+
if (!root) {
|
|
12
|
+
throw new Error("Expected Lynx render root to exist.");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return root;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function renderTagGroup(separator?: ReactNode) {
|
|
19
|
+
render(
|
|
20
|
+
<TagGroup.Root separator={separator}>
|
|
21
|
+
<TagGroup.Item>
|
|
22
|
+
<TagGroup.ItemLabel>첫 번째</TagGroup.ItemLabel>
|
|
23
|
+
</TagGroup.Item>
|
|
24
|
+
<TagGroup.Item>
|
|
25
|
+
<TagGroup.ItemLabel>두 번째</TagGroup.ItemLabel>
|
|
26
|
+
</TagGroup.Item>
|
|
27
|
+
<TagGroup.Item>
|
|
28
|
+
<TagGroup.ItemLabel>세 번째</TagGroup.ItemLabel>
|
|
29
|
+
</TagGroup.Item>
|
|
30
|
+
</TagGroup.Root>,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe("TagGroup", () => {
|
|
35
|
+
it("trims surrounding whitespace from the default string separator", () => {
|
|
36
|
+
renderTagGroup();
|
|
37
|
+
|
|
38
|
+
const separators = getRenderedRoot().querySelectorAll(".seed-tag-group__separator");
|
|
39
|
+
|
|
40
|
+
expect(separators).toHaveLength(2);
|
|
41
|
+
expect(Array.from(separators, (separator) => separator.textContent)).toEqual(["·", "·"]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("trims surrounding whitespace from a custom string separator", () => {
|
|
45
|
+
renderTagGroup(" \n / \t ");
|
|
46
|
+
|
|
47
|
+
const separators = getRenderedRoot().querySelectorAll(".seed-tag-group__separator");
|
|
48
|
+
|
|
49
|
+
expect(Array.from(separators, (separator) => separator.textContent)).toEqual(["/", "/"]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("preserves a non-string separator node", () => {
|
|
53
|
+
renderTagGroup(<text className="custom-separator"> 구분 </text>);
|
|
54
|
+
|
|
55
|
+
const customSeparators = getRenderedRoot().querySelectorAll(".custom-separator");
|
|
56
|
+
|
|
57
|
+
expect(customSeparators).toHaveLength(2);
|
|
58
|
+
expect(Array.from(customSeparators, (separator) => separator.textContent)).toEqual([
|
|
59
|
+
" 구분 ",
|
|
60
|
+
" 구분 ",
|
|
61
|
+
]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("keeps each separator and following item in the same wrapper", () => {
|
|
65
|
+
renderTagGroup();
|
|
66
|
+
|
|
67
|
+
const wrappers = getRenderedRoot().querySelectorAll(".seed-tag-group__separatorWrapper");
|
|
68
|
+
|
|
69
|
+
expect(wrappers).toHaveLength(2);
|
|
70
|
+
expect(wrappers[0]?.textContent).toBe("·두 번째");
|
|
71
|
+
expect(wrappers[1]?.textContent).toBe("·세 번째");
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -31,7 +31,8 @@ export interface TagGroupRootProps
|
|
|
31
31
|
TagGroupItemVariantProps,
|
|
32
32
|
LynxStyledElementProps {
|
|
33
33
|
/**
|
|
34
|
-
* children 사이에 삽입되는 구분자. 기본값 `"
|
|
34
|
+
* children 사이에 삽입되는 구분자. 기본값 `"·"`.
|
|
35
|
+
* 문자열을 전달하면 앞뒤 공백을 제거합니다.
|
|
35
36
|
*/
|
|
36
37
|
separator?: React.ReactNode;
|
|
37
38
|
}
|
|
@@ -41,6 +42,7 @@ export const TagGroupRoot = React.forwardRef<unknown, TagGroupRootProps>((props,
|
|
|
41
42
|
splitMultipleVariantsProps(props, { tagGroup, tagGroupItem });
|
|
42
43
|
const { children, className, separator = " · ", ...nativeProps } = otherProps;
|
|
43
44
|
const classes = tagGroup(tagGroupVariantProps);
|
|
45
|
+
const normalizedSeparator = typeof separator === "string" ? separator.trim() : separator;
|
|
44
46
|
|
|
45
47
|
const visibleChildren = toArray(children);
|
|
46
48
|
|
|
@@ -61,7 +63,7 @@ export const TagGroupRoot = React.forwardRef<unknown, TagGroupRootProps>((props,
|
|
|
61
63
|
key={(child as React.ReactElement).key ?? index}
|
|
62
64
|
className={classes.separatorWrapper}
|
|
63
65
|
>
|
|
64
|
-
<text className={classes.separator}>{
|
|
66
|
+
<text className={classes.separator}>{normalizedSeparator}</text>
|
|
65
67
|
{child}
|
|
66
68
|
</view>
|
|
67
69
|
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
TextFieldPrefixIcon as PrefixIcon,
|
|
3
|
+
TextFieldPrefixText as PrefixText,
|
|
4
|
+
TextFieldRoot as Root,
|
|
5
|
+
TextFieldSuffixIcon as SuffixIcon,
|
|
6
|
+
TextFieldSuffixText as SuffixText,
|
|
7
|
+
TextFieldInput as Input,
|
|
8
|
+
TextFieldTextarea as Textarea,
|
|
9
|
+
type TextFieldPrefixIconProps as PrefixIconProps,
|
|
10
|
+
type TextFieldPrefixTextProps as PrefixTextProps,
|
|
11
|
+
type TextFieldRootProps as RootProps,
|
|
12
|
+
type TextFieldSuffixIconProps as SuffixIconProps,
|
|
13
|
+
type TextFieldSuffixTextProps as SuffixTextProps,
|
|
14
|
+
type TextFieldInputProps as InputProps,
|
|
15
|
+
type TextFieldTextareaProps as TextareaProps,
|
|
16
|
+
} from "./TextField";
|