@seed-design/lynx-react 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/lib/components/Accordion/Accordion.d.ts +56 -0
- package/lib/components/Accordion/Accordion.d.ts.map +1 -0
- package/lib/components/Accordion/Accordion.jsx +210 -0
- package/lib/components/Accordion/Accordion.namespace.d.ts +2 -0
- package/lib/components/Accordion/Accordion.namespace.d.ts.map +1 -0
- package/lib/components/Accordion/Accordion.namespace.js +17 -0
- package/lib/components/Accordion/index.d.ts +3 -0
- package/lib/components/Accordion/index.d.ts.map +1 -0
- package/lib/components/ActionButton/ActionButton.jsx +6 -6
- package/lib/components/AppBar/AppBar.jsx +1 -1
- package/lib/components/Badge/Badge.jsx +1 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +6 -3
- package/lib/components/Box/Box.jsx +1 -1
- package/lib/components/Callout/Callout.d.ts +32 -0
- package/lib/components/Callout/Callout.d.ts.map +1 -0
- package/lib/components/Callout/Callout.jsx +113 -0
- package/lib/components/Callout/Callout.namespace.d.ts +2 -0
- package/lib/components/Callout/Callout.namespace.d.ts.map +1 -0
- package/lib/components/Callout/Callout.namespace.js +13 -0
- package/lib/components/Callout/index.d.ts +3 -0
- package/lib/components/Callout/index.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.jsx +36 -5
- package/lib/components/Chip/Chip.d.ts +66 -0
- package/lib/components/Chip/Chip.d.ts.map +1 -0
- package/lib/components/Chip/Chip.jsx +159 -0
- package/lib/components/Chip/Chip.namespace.d.ts +2 -0
- package/lib/components/Chip/Chip.namespace.d.ts.map +1 -0
- package/lib/components/Chip/Chip.namespace.js +16 -0
- package/lib/components/Chip/index.d.ts +3 -0
- package/lib/components/Chip/index.d.ts.map +1 -0
- package/lib/components/Divider/Divider.d.ts +31 -0
- package/lib/components/Divider/Divider.d.ts.map +1 -0
- package/lib/components/Divider/Divider.jsx +26 -0
- package/lib/components/Divider/index.d.ts +2 -0
- package/lib/components/Divider/index.d.ts.map +1 -0
- package/lib/components/Field/Field.jsx +1 -1
- package/lib/components/Icon/Icon.jsx +2 -2
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.jsx +38 -7
- package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- package/lib/components/Stack/Stack.jsx +11 -2
- package/lib/components/Switch/Switch.jsx +2 -2
- package/lib/components/Tabs/Tabs.d.ts +59 -0
- package/lib/components/Tabs/Tabs.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.jsx +406 -0
- package/lib/components/Tabs/Tabs.namespace.d.ts +2 -0
- package/lib/components/Tabs/Tabs.namespace.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.namespace.js +14 -0
- package/lib/components/Tabs/index.d.ts +3 -0
- package/lib/components/Tabs/index.d.ts.map +1 -0
- 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 +4 -3
- package/lib/components/Text/Text.jsx +2 -2
- package/lib/components/TextField/TextField.d.ts +20 -2
- package/lib/components/TextField/TextField.d.ts.map +1 -1
- package/lib/components/TextField/TextField.jsx +25 -9
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/useIconColor.d.ts +2 -1
- package/lib/hooks/useIconColor.d.ts.map +1 -1
- package/lib/hooks/useIconColor.js +29 -5
- package/lib/hooks/usePressTap.d.ts.map +1 -1
- package/lib/hooks/usePressTap.js +1 -0
- package/lib/index.js +14 -5
- package/lib/utils/create-slot-recipe-context.jsx +1 -1
- package/package.json +3 -3
- package/src/components/Accordion/Accordion.namespace.ts +22 -0
- package/src/components/Accordion/Accordion.test.tsx +129 -0
- package/src/components/Accordion/Accordion.tsx +453 -0
- package/src/components/Accordion/index.ts +24 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +24 -0
- package/src/components/BottomSheet/BottomSheet.tsx +14 -2
- package/src/components/Callout/Callout.namespace.ts +14 -0
- package/src/components/Callout/Callout.test.tsx +188 -0
- package/src/components/Callout/Callout.tsx +272 -0
- package/src/components/Callout/index.ts +16 -0
- package/src/components/Checkbox/Checkbox.test.tsx +176 -0
- package/src/components/Checkbox/Checkbox.tsx +36 -2
- package/src/components/Chip/Chip.namespace.ts +20 -0
- package/src/components/Chip/Chip.test.tsx +113 -0
- package/src/components/Chip/Chip.tsx +373 -0
- package/src/components/Chip/index.ts +22 -0
- package/src/components/Divider/Divider.test.tsx +73 -0
- package/src/components/Divider/Divider.tsx +76 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Icon/Icon.test.tsx +129 -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/Tabs/Tabs.namespace.ts +16 -0
- package/src/components/Tabs/Tabs.test.tsx +181 -0
- package/src/components/Tabs/Tabs.tsx +706 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/TagGroup/TagGroup.test.tsx +73 -0
- package/src/components/TagGroup/TagGroup.tsx +4 -2
- package/src/components/TextField/TextField.test.tsx +163 -35
- package/src/components/TextField/TextField.tsx +61 -19
- package/src/components/index.ts +5 -0
- package/src/hooks/useIconColor.ts +43 -5
- package/src/hooks/usePressTap.test.ts +13 -0
- package/src/hooks/usePressTap.ts +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TabsVariantProps } from '@seed-design/lynx-css/recipes/tabs';
|
|
2
|
+
import { IntrinsicElements } from '@lynx-js/types';
|
|
3
|
+
import { LynxAccessibilityProps, LynxStyledElementProps } from '../../types';
|
|
4
|
+
import * as React from "@lynx-js/react";
|
|
5
|
+
type NativeViewPagerProps = IntrinsicElements["viewpager"];
|
|
6
|
+
type TabsPublicVariantProps = Omit<TabsVariantProps, "selected" | "disabled" | "inCarousel">;
|
|
7
|
+
/**
|
|
8
|
+
* @platform Lynx
|
|
9
|
+
*
|
|
10
|
+
* 웹 대비 미지원 기능:
|
|
11
|
+
* - `orientation`: Lynx Tabs는 수평 방향만 지원
|
|
12
|
+
* - `lazyMount`, `unmountOnExit`: native viewpager가 모든 page slot을 유지해야 함
|
|
13
|
+
* - 키보드 포커스와 roving tabindex
|
|
14
|
+
*/
|
|
15
|
+
export interface TabsRootProps extends TabsPublicVariantProps, LynxStyledElementProps {
|
|
16
|
+
value?: string;
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onValueChange?: (value: string) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const TabsRoot: React.ForwardRefExoticComponent<TabsRootProps & React.RefAttributes<unknown>>;
|
|
21
|
+
export interface TabsListProps extends LynxStyledElementProps {
|
|
22
|
+
}
|
|
23
|
+
export declare const TabsList: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<unknown>>;
|
|
24
|
+
export interface TabsTriggerProps extends LynxStyledElementProps {
|
|
25
|
+
value: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
"accessibility-label"?: LynxAccessibilityProps["accessibility-label"];
|
|
28
|
+
}
|
|
29
|
+
export declare const TabsTrigger: React.ForwardRefExoticComponent<TabsTriggerProps & React.RefAttributes<unknown>>;
|
|
30
|
+
export interface TabsIndicatorProps extends LynxStyledElementProps {
|
|
31
|
+
}
|
|
32
|
+
export declare const TabsIndicator: React.ForwardRefExoticComponent<TabsIndicatorProps & React.RefAttributes<unknown>>;
|
|
33
|
+
export interface TabsContentProps extends LynxStyledElementProps {
|
|
34
|
+
value: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const TabsContent: React.ForwardRefExoticComponent<TabsContentProps & React.RefAttributes<unknown>>;
|
|
37
|
+
/**
|
|
38
|
+
* @platform Lynx
|
|
39
|
+
*
|
|
40
|
+
* native viewpager를 사용하므로 웹의 `loop`, `autoHeight`, `dragThreshold`,
|
|
41
|
+
* `carouselPreventDrag`는 지원하지 않습니다.
|
|
42
|
+
*/
|
|
43
|
+
export interface TabsCarouselProps extends LynxStyledElementProps {
|
|
44
|
+
swipeable?: boolean;
|
|
45
|
+
/** iOS 뒤로가기 제스처를 우선하는 화면 왼쪽 가장자리 너비입니다. */
|
|
46
|
+
iosBackGestureEdgeWidth?: number;
|
|
47
|
+
onSettle?: () => void;
|
|
48
|
+
onSwipeStart?: () => void;
|
|
49
|
+
onSwipeEnd?: () => void;
|
|
50
|
+
}
|
|
51
|
+
export declare const TabsCarousel: React.ForwardRefExoticComponent<TabsCarouselProps & React.RefAttributes<unknown>>;
|
|
52
|
+
export interface TabsCarouselCameraProps extends LynxStyledElementProps {
|
|
53
|
+
bindchange?: NativeViewPagerProps["bindchange"];
|
|
54
|
+
bindwillchange?: NativeViewPagerProps["bindwillchange"];
|
|
55
|
+
bindoffsetchange?: NativeViewPagerProps["bindoffsetchange"];
|
|
56
|
+
}
|
|
57
|
+
export declare const TabsCarouselCamera: React.ForwardRefExoticComponent<TabsCarouselCameraProps & React.RefAttributes<unknown>>;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EACV,iBAAiB,EAMlB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAIrB,KAAK,oBAAoB,GAA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AAW,uBAAwB,SAAQ,sBAAsB;IACrE,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,cAAc,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IACxD,gBAAgB,CAAC,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;CAC7D;AAED,eAAO,MAAM,kBAAkB,yFAmH9B,CAAC"}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
4
|
+
import * as React from "@lynx-js/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { tabs } from "@seed-design/lynx-css/recipes/tabs";
|
|
7
|
+
//#region src/components/Tabs/Tabs.tsx
|
|
8
|
+
var { ClassNamesProvider, useClassNames } = createSlotRecipeContext(tabs);
|
|
9
|
+
function invokeSelectTab(pager, index, smooth) {
|
|
10
|
+
"background only";
|
|
11
|
+
if (!pager || index < 0) return;
|
|
12
|
+
try {
|
|
13
|
+
pager.invoke({
|
|
14
|
+
method: "selectTab",
|
|
15
|
+
params: {
|
|
16
|
+
index,
|
|
17
|
+
smooth
|
|
18
|
+
}
|
|
19
|
+
}).exec();
|
|
20
|
+
} catch {}
|
|
21
|
+
}
|
|
22
|
+
function invokeScrollToOffset(list, offset) {
|
|
23
|
+
"background only";
|
|
24
|
+
if (!list || offset < 0) return;
|
|
25
|
+
try {
|
|
26
|
+
list.invoke({
|
|
27
|
+
method: "scrollTo",
|
|
28
|
+
params: {
|
|
29
|
+
offset,
|
|
30
|
+
smooth: true
|
|
31
|
+
}
|
|
32
|
+
}).exec();
|
|
33
|
+
} catch {}
|
|
34
|
+
}
|
|
35
|
+
function getLayoutRect(event) {
|
|
36
|
+
const width = event.detail?.width ?? event.params?.width;
|
|
37
|
+
const left = event.detail?.left ?? event.params?.left;
|
|
38
|
+
if (!Number.isFinite(width) || !Number.isFinite(left)) return null;
|
|
39
|
+
return {
|
|
40
|
+
width: Math.max(0, width),
|
|
41
|
+
left
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
var TabsContext = React.createContext(null);
|
|
45
|
+
function useTabsContext(consumer) {
|
|
46
|
+
const context = React.useContext(TabsContext);
|
|
47
|
+
if (!context) throw new Error(`<${consumer}/> must be rendered inside <TabsRoot/>.`);
|
|
48
|
+
return context;
|
|
49
|
+
}
|
|
50
|
+
var TabsCarouselContext = React.createContext(null);
|
|
51
|
+
var TabsCarouselCameraContext = React.createContext(null);
|
|
52
|
+
function useTabsCarouselCameraContext() {
|
|
53
|
+
return React.useContext(TabsCarouselCameraContext) ?? false;
|
|
54
|
+
}
|
|
55
|
+
function useTabsCarouselContext(consumer) {
|
|
56
|
+
const context = React.useContext(TabsCarouselContext);
|
|
57
|
+
if (!context) throw new Error(`<${consumer}/> must be rendered inside <TabsCarousel/>.`);
|
|
58
|
+
return context;
|
|
59
|
+
}
|
|
60
|
+
var TabsRoot = React.forwardRef((props, ref) => {
|
|
61
|
+
const [variantProps, otherProps] = tabs.splitVariantProps(props);
|
|
62
|
+
const { children, className, style, value: valueProp, defaultValue, onValueChange, ...nativeProps } = otherProps;
|
|
63
|
+
const classNames = tabs(variantProps);
|
|
64
|
+
const [value, setValueInternal] = useControllableState({
|
|
65
|
+
value: valueProp,
|
|
66
|
+
defaultValue,
|
|
67
|
+
onChange(nextValue) {
|
|
68
|
+
"background only";
|
|
69
|
+
if (nextValue !== void 0) onValueChange?.(nextValue);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const [items, setItems] = React.useState([]);
|
|
73
|
+
const [contentValues, setContentValues] = React.useState([]);
|
|
74
|
+
const [indicatorValue, setIndicatorValue] = React.useState();
|
|
75
|
+
const [triggerRects, setTriggerRects] = React.useState({});
|
|
76
|
+
const [listLeft, setListLeft] = React.useState(0);
|
|
77
|
+
const listRef = React.useRef(null);
|
|
78
|
+
const pagerRef = React.useRef(null);
|
|
79
|
+
const indicatorRef = React.useMainThreadRef(null);
|
|
80
|
+
const pagerValues = React.useMemo(() => contentValues.filter((contentValue) => !items.find((item) => item.value === contentValue)?.disabled), [contentValues, items]);
|
|
81
|
+
const visualValue = indicatorValue ?? value;
|
|
82
|
+
const indicatorIndex = items.findIndex((item) => item.value === visualValue);
|
|
83
|
+
const selectedPagerIndex = value === void 0 ? -1 : pagerValues.indexOf(value);
|
|
84
|
+
const selectedRect = value === void 0 ? void 0 : triggerRects[value];
|
|
85
|
+
const selectedOffset = selectedRect ? Math.max(0, selectedRect.left - listLeft) : null;
|
|
86
|
+
const setListNode = React.useCallback((node) => {
|
|
87
|
+
listRef.current = node;
|
|
88
|
+
if (node && selectedOffset !== null) invokeScrollToOffset(node, selectedOffset);
|
|
89
|
+
}, [selectedOffset]);
|
|
90
|
+
const setPagerNode = React.useCallback((node) => {
|
|
91
|
+
pagerRef.current = node;
|
|
92
|
+
if (node && selectedPagerIndex >= 0) invokeSelectTab(node, selectedPagerIndex, false);
|
|
93
|
+
}, [selectedPagerIndex]);
|
|
94
|
+
const registerTrigger = React.useCallback((triggerValue, disabled) => {
|
|
95
|
+
setItems((current) => {
|
|
96
|
+
if (current.some((item) => item.value === triggerValue)) return current;
|
|
97
|
+
return [...current, {
|
|
98
|
+
value: triggerValue,
|
|
99
|
+
disabled
|
|
100
|
+
}];
|
|
101
|
+
});
|
|
102
|
+
return () => {
|
|
103
|
+
"background only";
|
|
104
|
+
setItems((current) => current.filter((item) => item.value !== triggerValue));
|
|
105
|
+
setTriggerRects((current) => {
|
|
106
|
+
const next = { ...current };
|
|
107
|
+
delete next[triggerValue];
|
|
108
|
+
return next;
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
}, []);
|
|
112
|
+
const registerContent = React.useCallback((contentValue) => {
|
|
113
|
+
setContentValues((current) => current.includes(contentValue) ? current : [...current, contentValue]);
|
|
114
|
+
return () => {
|
|
115
|
+
"background only";
|
|
116
|
+
setContentValues((current) => current.filter((value) => value !== contentValue));
|
|
117
|
+
};
|
|
118
|
+
}, []);
|
|
119
|
+
const updateTriggerDisabled = React.useCallback((triggerValue, disabled) => {
|
|
120
|
+
setItems((current) => current.map((item) => item.value === triggerValue && item.disabled !== disabled ? {
|
|
121
|
+
...item,
|
|
122
|
+
disabled
|
|
123
|
+
} : item));
|
|
124
|
+
}, []);
|
|
125
|
+
const updateTriggerRect = React.useCallback((triggerValue, rect) => {
|
|
126
|
+
setTriggerRects((current) => {
|
|
127
|
+
const previous = current[triggerValue];
|
|
128
|
+
if (previous?.left === rect.left && previous.width === rect.width) return current;
|
|
129
|
+
return {
|
|
130
|
+
...current,
|
|
131
|
+
[triggerValue]: rect
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
}, []);
|
|
135
|
+
const selectValue = React.useCallback((nextValue) => {
|
|
136
|
+
setIndicatorValue(void 0);
|
|
137
|
+
setValueInternal(nextValue);
|
|
138
|
+
}, [setValueInternal]);
|
|
139
|
+
const handlePagerWillChange = React.useCallback((targetIndex) => {
|
|
140
|
+
setIndicatorValue(pagerValues[targetIndex]);
|
|
141
|
+
}, [pagerValues]);
|
|
142
|
+
const handlePagerChange = React.useCallback((targetIndex) => {
|
|
143
|
+
const nextValue = pagerValues[targetIndex];
|
|
144
|
+
if (nextValue === void 0) return;
|
|
145
|
+
setIndicatorValue(void 0);
|
|
146
|
+
setValueInternal(nextValue);
|
|
147
|
+
}, [pagerValues, setValueInternal]);
|
|
148
|
+
React.useEffect(() => {
|
|
149
|
+
"background only";
|
|
150
|
+
if (selectedPagerIndex >= 0) invokeSelectTab(pagerRef.current, selectedPagerIndex, false);
|
|
151
|
+
if (selectedOffset !== null) invokeScrollToOffset(listRef.current, selectedOffset);
|
|
152
|
+
}, [selectedPagerIndex, selectedOffset]);
|
|
153
|
+
const contextValue = React.useMemo(() => ({
|
|
154
|
+
value,
|
|
155
|
+
visualValue,
|
|
156
|
+
variantProps,
|
|
157
|
+
items,
|
|
158
|
+
pagerValues,
|
|
159
|
+
indicatorIndex,
|
|
160
|
+
selectedPagerIndex,
|
|
161
|
+
indicatorRef,
|
|
162
|
+
listLeft,
|
|
163
|
+
triggerRects,
|
|
164
|
+
registerTrigger,
|
|
165
|
+
registerContent,
|
|
166
|
+
updateTriggerDisabled,
|
|
167
|
+
updateTriggerRect,
|
|
168
|
+
setListLeft,
|
|
169
|
+
setListRef: setListNode,
|
|
170
|
+
setPagerRef: setPagerNode,
|
|
171
|
+
selectValue,
|
|
172
|
+
handlePagerWillChange,
|
|
173
|
+
handlePagerChange
|
|
174
|
+
}), [
|
|
175
|
+
value,
|
|
176
|
+
visualValue,
|
|
177
|
+
variantProps,
|
|
178
|
+
items,
|
|
179
|
+
pagerValues,
|
|
180
|
+
indicatorIndex,
|
|
181
|
+
selectedPagerIndex,
|
|
182
|
+
indicatorRef,
|
|
183
|
+
listLeft,
|
|
184
|
+
triggerRects,
|
|
185
|
+
registerTrigger,
|
|
186
|
+
registerContent,
|
|
187
|
+
updateTriggerDisabled,
|
|
188
|
+
updateTriggerRect,
|
|
189
|
+
setListNode,
|
|
190
|
+
setPagerNode,
|
|
191
|
+
selectValue,
|
|
192
|
+
handlePagerWillChange,
|
|
193
|
+
handlePagerChange
|
|
194
|
+
]);
|
|
195
|
+
return <TabsContext.Provider value={contextValue}>
|
|
196
|
+
<ClassNamesProvider value={classNames}>
|
|
197
|
+
<view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.root, className)} style={style}>
|
|
198
|
+
{children}
|
|
199
|
+
</view>
|
|
200
|
+
</ClassNamesProvider>
|
|
201
|
+
</TabsContext.Provider>;
|
|
202
|
+
});
|
|
203
|
+
TabsRoot.displayName = "TabsRoot";
|
|
204
|
+
var TabsList = React.forwardRef((props, ref) => {
|
|
205
|
+
const { children, className, style, ...nativeProps } = props;
|
|
206
|
+
const classNames = useClassNames();
|
|
207
|
+
const { setListLeft, setListRef } = useTabsContext("TabsList");
|
|
208
|
+
const mergedRef = React.useCallback((node) => {
|
|
209
|
+
setListRef(node);
|
|
210
|
+
if (typeof ref === "function") ref(node);
|
|
211
|
+
else if (ref) ref.current = node;
|
|
212
|
+
}, [ref, setListRef]);
|
|
213
|
+
const handleLayoutChange = React.useCallback((...args) => {
|
|
214
|
+
"background only";
|
|
215
|
+
const rect = getLayoutRect(args[0]);
|
|
216
|
+
if (rect) setListLeft(rect.left);
|
|
217
|
+
}, [setListLeft]);
|
|
218
|
+
return <scroll-view ref={mergedRef} {...nativeProps} scroll-orientation="horizontal" scroll-bar-enable={false} bindlayoutchange={handleLayoutChange} accessibility-element={false} accessibility-traits="tabbar" className={clsx(classNames.list, className)} style={style}>
|
|
219
|
+
<view className={classNames.listContent}>{children}</view>
|
|
220
|
+
</scroll-view>;
|
|
221
|
+
});
|
|
222
|
+
TabsList.displayName = "TabsList";
|
|
223
|
+
var TabsTrigger = React.forwardRef((props, ref) => {
|
|
224
|
+
const { children, className, style, value: triggerValue, disabled = false, "accessibility-label": accessibilityLabel, ...nativeProps } = props;
|
|
225
|
+
const context = useTabsContext("TabsTrigger");
|
|
226
|
+
const selected = context.value === triggerValue;
|
|
227
|
+
const visuallySelected = context.visualValue === triggerValue;
|
|
228
|
+
React.useEffect(() => {
|
|
229
|
+
"background only";
|
|
230
|
+
return context.registerTrigger(triggerValue, disabled);
|
|
231
|
+
}, [context.registerTrigger, triggerValue]);
|
|
232
|
+
React.useEffect(() => {
|
|
233
|
+
"background only";
|
|
234
|
+
context.updateTriggerDisabled(triggerValue, disabled);
|
|
235
|
+
}, [
|
|
236
|
+
context.updateTriggerDisabled,
|
|
237
|
+
triggerValue,
|
|
238
|
+
disabled
|
|
239
|
+
]);
|
|
240
|
+
const { pressed: _pressed, ...pressHandlers } = usePressTap({
|
|
241
|
+
disabled,
|
|
242
|
+
onTap: React.useCallback(() => {
|
|
243
|
+
"background only";
|
|
244
|
+
context.selectValue(triggerValue);
|
|
245
|
+
}, [context.selectValue, triggerValue])
|
|
246
|
+
});
|
|
247
|
+
const handleLayoutChange = React.useCallback((...args) => {
|
|
248
|
+
"background only";
|
|
249
|
+
const rect = getLayoutRect(args[0]);
|
|
250
|
+
if (rect) context.updateTriggerRect(triggerValue, rect);
|
|
251
|
+
}, [context.updateTriggerRect, triggerValue]);
|
|
252
|
+
const triggerClasses = tabs({
|
|
253
|
+
...context.variantProps,
|
|
254
|
+
selected: visuallySelected,
|
|
255
|
+
disabled
|
|
256
|
+
});
|
|
257
|
+
const label = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
258
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} {...pressHandlers} flatten={false} bindlayoutchange={handleLayoutChange} accessibility-element={true} accessibility-role-description="tab" accessibility-label={accessibilityLabel ?? label} accessibility-value={selected ? "selected" : "not selected"} accessibility-traits={disabled ? "disabled" : selected ? "selected" : "button"} className={clsx(triggerClasses.trigger, className)} style={style}>
|
|
259
|
+
<text className={triggerClasses.triggerLabel}>{children}</text>
|
|
260
|
+
</view>;
|
|
261
|
+
});
|
|
262
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
263
|
+
var TabsIndicator = React.forwardRef((props, ref) => {
|
|
264
|
+
const { className, style, ...nativeProps } = props;
|
|
265
|
+
const classNames = useClassNames();
|
|
266
|
+
const { indicatorRef, items, listLeft, indicatorIndex, triggerRects } = useTabsContext("TabsIndicator");
|
|
267
|
+
const position = indicatorIndex;
|
|
268
|
+
const lowerIndex = Math.max(0, Math.floor(position));
|
|
269
|
+
const upperIndex = Math.min(items.length - 1, Math.ceil(position));
|
|
270
|
+
const progress = Math.max(0, Math.min(1, position - lowerIndex));
|
|
271
|
+
const lowerRect = triggerRects[items[lowerIndex]?.value ?? ""];
|
|
272
|
+
const upperRect = triggerRects[items[upperIndex]?.value ?? ""] ?? lowerRect;
|
|
273
|
+
const x = lowerRect ? lowerRect.left - listLeft + ((upperRect?.left ?? lowerRect.left) - lowerRect.left) * progress : 0;
|
|
274
|
+
const width = lowerRect ? lowerRect.width + ((upperRect?.width ?? lowerRect.width) - lowerRect.width) * progress : 0;
|
|
275
|
+
return <view {...ref ? { ref } : {}} main-thread:ref={indicatorRef} {...nativeProps} accessibility-elements-hidden={true} className={clsx(classNames.indicator, className)} style={{
|
|
276
|
+
"--tabs-indicator-x": `${x}px`,
|
|
277
|
+
"--tabs-indicator-width": `${width}px`,
|
|
278
|
+
...style
|
|
279
|
+
}} />;
|
|
280
|
+
});
|
|
281
|
+
TabsIndicator.displayName = "TabsIndicator";
|
|
282
|
+
var TabsContent = React.forwardRef((props, ref) => {
|
|
283
|
+
const { children, className, style, value: contentValue, ...nativeProps } = props;
|
|
284
|
+
const tabsContext = useTabsContext("TabsContent");
|
|
285
|
+
const inCarousel = useTabsCarouselCameraContext();
|
|
286
|
+
const selected = tabsContext.value === contentValue;
|
|
287
|
+
const disabled = tabsContext.items.find((item) => item.value === contentValue)?.disabled ?? false;
|
|
288
|
+
const contentClasses = tabs({
|
|
289
|
+
...tabsContext.variantProps,
|
|
290
|
+
selected,
|
|
291
|
+
inCarousel
|
|
292
|
+
});
|
|
293
|
+
React.useEffect(() => {
|
|
294
|
+
"background only";
|
|
295
|
+
if (inCarousel) return tabsContext.registerContent(contentValue);
|
|
296
|
+
}, [
|
|
297
|
+
inCarousel,
|
|
298
|
+
tabsContext.registerContent,
|
|
299
|
+
contentValue
|
|
300
|
+
]);
|
|
301
|
+
const content = <view {...ref ? { ref } : {}} {...nativeProps} accessibility-elements-hidden={!selected} accessibility-role-description="tabpanel" accessibility-value={selected ? "selected" : "not selected"} className={clsx(contentClasses.content, className)} style={style}>
|
|
302
|
+
{children}
|
|
303
|
+
</view>;
|
|
304
|
+
if (inCarousel) {
|
|
305
|
+
if (disabled) return null;
|
|
306
|
+
return <viewpager-item>{content}</viewpager-item>;
|
|
307
|
+
}
|
|
308
|
+
return content;
|
|
309
|
+
});
|
|
310
|
+
TabsContent.displayName = "TabsContent";
|
|
311
|
+
var TabsCarousel = React.forwardRef((props, ref) => {
|
|
312
|
+
const { children, className, style, swipeable = false, iosBackGestureEdgeWidth = 32, onSettle, onSwipeStart, onSwipeEnd, ...nativeProps } = props;
|
|
313
|
+
const classNames = useClassNames();
|
|
314
|
+
const contextValue = React.useMemo(() => ({
|
|
315
|
+
swipeable,
|
|
316
|
+
iosBackGestureEdgeWidth,
|
|
317
|
+
onSettle,
|
|
318
|
+
onSwipeStart,
|
|
319
|
+
onSwipeEnd
|
|
320
|
+
}), [
|
|
321
|
+
swipeable,
|
|
322
|
+
iosBackGestureEdgeWidth,
|
|
323
|
+
onSettle,
|
|
324
|
+
onSwipeStart,
|
|
325
|
+
onSwipeEnd
|
|
326
|
+
]);
|
|
327
|
+
return <TabsCarouselContext.Provider value={contextValue}>
|
|
328
|
+
<view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.carousel, className)} style={style}>
|
|
329
|
+
{children}
|
|
330
|
+
</view>
|
|
331
|
+
</TabsCarouselContext.Provider>;
|
|
332
|
+
});
|
|
333
|
+
TabsCarousel.displayName = "TabsCarousel";
|
|
334
|
+
var TabsCarouselCamera = React.forwardRef((props, ref) => {
|
|
335
|
+
const { children, className, style, bindchange, bindwillchange, bindoffsetchange, ...nativeProps } = props;
|
|
336
|
+
const classNames = useClassNames();
|
|
337
|
+
const tabsContext = useTabsContext("TabsCarouselCamera");
|
|
338
|
+
const carouselContext = useTabsCarouselContext("TabsCarouselCamera");
|
|
339
|
+
const swipingRef = React.useRef(false);
|
|
340
|
+
const { indicatorRef, pagerValues, listLeft, triggerRects } = tabsContext;
|
|
341
|
+
const indicatorRects = pagerValues.map((value) => triggerRects[value] ?? null);
|
|
342
|
+
const mergedRef = React.useCallback((node) => {
|
|
343
|
+
tabsContext.setPagerRef(node);
|
|
344
|
+
if (typeof ref === "function") ref(node);
|
|
345
|
+
else if (ref) ref.current = node;
|
|
346
|
+
}, [ref, tabsContext.setPagerRef]);
|
|
347
|
+
const handleWillChange = React.useCallback((event) => {
|
|
348
|
+
"background only";
|
|
349
|
+
bindwillchange?.(event);
|
|
350
|
+
if (event.detail.isDragged) {
|
|
351
|
+
tabsContext.handlePagerWillChange(event.detail.index);
|
|
352
|
+
if (!swipingRef.current) {
|
|
353
|
+
swipingRef.current = true;
|
|
354
|
+
carouselContext.onSwipeStart?.();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}, [
|
|
358
|
+
bindwillchange,
|
|
359
|
+
carouselContext.onSwipeStart,
|
|
360
|
+
tabsContext.handlePagerWillChange
|
|
361
|
+
]);
|
|
362
|
+
const handleChange = React.useCallback((event) => {
|
|
363
|
+
"background only";
|
|
364
|
+
bindchange?.(event);
|
|
365
|
+
tabsContext.handlePagerChange(event.detail.index);
|
|
366
|
+
carouselContext.onSettle?.();
|
|
367
|
+
if (swipingRef.current || event.detail.isDragged) {
|
|
368
|
+
swipingRef.current = false;
|
|
369
|
+
carouselContext.onSwipeEnd?.();
|
|
370
|
+
}
|
|
371
|
+
}, [
|
|
372
|
+
bindchange,
|
|
373
|
+
carouselContext.onSettle,
|
|
374
|
+
carouselContext.onSwipeEnd,
|
|
375
|
+
tabsContext.handlePagerChange
|
|
376
|
+
]);
|
|
377
|
+
const handleOffsetChange = React.useCallback((event) => {
|
|
378
|
+
"background only";
|
|
379
|
+
bindoffsetchange?.(event);
|
|
380
|
+
}, [bindoffsetchange]);
|
|
381
|
+
function handleIndicatorOffsetChange(event) {
|
|
382
|
+
"main thread";
|
|
383
|
+
const position = Number(event.detail.offset);
|
|
384
|
+
if (!Number.isFinite(position)) return;
|
|
385
|
+
const lowerIndex = Math.max(0, Math.floor(position));
|
|
386
|
+
const upperIndex = Math.min(indicatorRects.length - 1, Math.ceil(position));
|
|
387
|
+
const progress = Math.max(0, Math.min(1, position - lowerIndex));
|
|
388
|
+
const lowerRect = indicatorRects[lowerIndex];
|
|
389
|
+
const upperRect = indicatorRects[upperIndex] ?? lowerRect;
|
|
390
|
+
if (!lowerRect) return;
|
|
391
|
+
const x = lowerRect.left - listLeft + ((upperRect?.left ?? lowerRect.left) - lowerRect.left) * progress;
|
|
392
|
+
const width = lowerRect.width + ((upperRect?.width ?? lowerRect.width) - lowerRect.width) * progress;
|
|
393
|
+
indicatorRef.current?.setStyleProperties({
|
|
394
|
+
"--tabs-indicator-x": `${x}px`,
|
|
395
|
+
"--tabs-indicator-width": `${width}px`
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
return <viewpager ref={mergedRef} {...nativeProps} initial-select-index={Math.max(0, tabsContext.selectedPagerIndex)} enable-scroll={carouselContext.swipeable} ios-gesture-offset={carouselContext.iosBackGestureEdgeWidth} bindwillchange={handleWillChange} bindchange={handleChange} bindoffsetchange={handleOffsetChange} main-thread:bindoffsetchange={handleIndicatorOffsetChange} className={clsx(classNames.carouselCamera, className)} style={style}>
|
|
399
|
+
<TabsCarouselCameraContext.Provider value={true}>
|
|
400
|
+
{children}
|
|
401
|
+
</TabsCarouselCameraContext.Provider>
|
|
402
|
+
</viewpager>;
|
|
403
|
+
});
|
|
404
|
+
TabsCarouselCamera.displayName = "TabsCarouselCamera";
|
|
405
|
+
//#endregion
|
|
406
|
+
export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { TabsCarousel as Carousel, TabsCarouselCamera as CarouselCamera, TabsContent as Content, TabsIndicator as Indicator, TabsList as List, TabsRoot as Root, TabsTrigger as Trigger, type TabsCarouselCameraProps as CarouselCameraProps, type TabsCarouselProps as CarouselProps, type TabsContentProps as ContentProps, type TabsIndicatorProps as IndicatorProps, type TabsListProps as ListProps, type TabsRootProps as RootProps, type TabsTriggerProps as TriggerProps, } from './Tabs';
|
|
2
|
+
//# sourceMappingURL=Tabs.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,QAAQ,EACxB,kBAAkB,IAAI,cAAc,EACpC,WAAW,IAAI,OAAO,EACtB,aAAa,IAAI,SAAS,EAC1B,QAAQ,IAAI,IAAI,EAChB,QAAQ,IAAI,IAAI,EAChB,WAAW,IAAI,OAAO,EACtB,KAAK,uBAAuB,IAAI,mBAAmB,EACnD,KAAK,iBAAiB,IAAI,aAAa,EACvC,KAAK,gBAAgB,IAAI,YAAY,EACrC,KAAK,kBAAkB,IAAI,cAAc,EACzC,KAAK,aAAa,IAAI,SAAS,EAC/B,KAAK,aAAa,IAAI,SAAS,EAC/B,KAAK,gBAAgB,IAAI,YAAY,GACtC,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger } from "./Tabs.jsx";
|
|
3
|
+
//#region src/components/Tabs/Tabs.namespace.ts
|
|
4
|
+
var Tabs_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Carousel: () => TabsCarousel,
|
|
6
|
+
CarouselCamera: () => TabsCarouselCamera,
|
|
7
|
+
Content: () => TabsContent,
|
|
8
|
+
Indicator: () => TabsIndicator,
|
|
9
|
+
List: () => TabsList,
|
|
10
|
+
Root: () => TabsRoot,
|
|
11
|
+
Trigger: () => TabsTrigger
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Tabs_namespace_exports };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC"}
|
|
@@ -14,7 +14,8 @@ import * as React from "@lynx-js/react";
|
|
|
14
14
|
*/
|
|
15
15
|
export interface TagGroupRootProps extends TagGroupVariantProps, TagGroupItemVariantProps, LynxStyledElementProps {
|
|
16
16
|
/**
|
|
17
|
-
* children 사이에 삽입되는 구분자. 기본값 `"
|
|
17
|
+
* children 사이에 삽입되는 구분자. 기본값 `"·"`.
|
|
18
|
+
* 문자열을 전달하면 앞뒤 공백을 제거합니다.
|
|
18
19
|
*/
|
|
19
20
|
separator?: React.ReactNode;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC9F,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAA4B,MAAM,aAAa,CAAC;AAIpF,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOpE;;;;;;;;GAQG;AACH,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,wBAAwB,EACxB,sBAAsB;IACxB
|
|
1
|
+
{"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC9F,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAA4B,MAAM,aAAa,CAAC;AAIpF,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOpE;;;;;;;;GAQG;AACH,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,wBAAwB,EACxB,sBAAsB;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,mFAkCvB,CAAC;AAKH;;;;;GAKG;AACH,MAAM,WAAW,iBACf,SAAQ,wBAAwB,EAC9B,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAC9B,sBAAsB;CAAG;AAE7B,eAAO,MAAM,YAAY,mFAmBvB,CAAC;AAKH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;CAAG;AAEzE,eAAO,MAAM,iBAAiB,wFAY5B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
2
1
|
import { toArray } from "../../utils/children.js";
|
|
2
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
3
3
|
import { useStyleProps } from "../../utils/styled.js";
|
|
4
4
|
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
5
|
-
import clsx from "clsx";
|
|
6
5
|
import * as React from "@lynx-js/react";
|
|
6
|
+
import clsx from "clsx";
|
|
7
7
|
import { tagGroup } from "@seed-design/lynx-css/recipes/tag-group";
|
|
8
8
|
import { tagGroupItem } from "@seed-design/lynx-css/recipes/tag-group-item";
|
|
9
9
|
//#region src/components/TagGroup/TagGroup.tsx
|
|
@@ -15,13 +15,14 @@ var TagGroupRoot = React.forwardRef((props, ref) => {
|
|
|
15
15
|
});
|
|
16
16
|
const { children, className, separator = " · ", ...nativeProps } = otherProps;
|
|
17
17
|
const classes = tagGroup(tagGroupVariantProps);
|
|
18
|
+
const normalizedSeparator = typeof separator === "string" ? separator.trim() : separator;
|
|
18
19
|
const visibleChildren = toArray(children);
|
|
19
20
|
return <PropsProvider value={tagGroupItemVariantProps}>
|
|
20
21
|
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
|
|
21
22
|
{visibleChildren.map((child, index) => {
|
|
22
23
|
if (index === 0) return child;
|
|
23
24
|
return <view key={child.key ?? index} className={classes.separatorWrapper}>
|
|
24
|
-
<text className={classes.separator}>{
|
|
25
|
+
<text className={classes.separator}>{normalizedSeparator}</text>
|
|
25
26
|
{child}
|
|
26
27
|
</view>;
|
|
27
28
|
})}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { handleColor, handleFontSize, handleFontWeight, handleLineHeight } from "../../utils/styled.js";
|
|
2
|
-
import { typography } from "@seed-design/lynx-css/vars/component";
|
|
3
|
-
import clsx from "clsx";
|
|
4
2
|
import * as React from "@lynx-js/react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { typography } from "@seed-design/lynx-css/vars/component";
|
|
5
5
|
//#region src/components/Text/Text.tsx
|
|
6
6
|
function capitalize(value) {
|
|
7
7
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
@@ -44,13 +44,22 @@ export interface TextFieldInputProps extends NativeTextControlProps {
|
|
|
44
44
|
maxlength?: NativeInputProps["maxlength"];
|
|
45
45
|
readonly?: NativeInputProps["readonly"];
|
|
46
46
|
disabled?: NativeInputProps["disabled"];
|
|
47
|
+
/**
|
|
48
|
+
* 포커스할 때 시스템 키보드를 표시한다.
|
|
49
|
+
* `undefined`가 native attribute로 전달되지 않도록 `true`를 명시적으로 적용한다.
|
|
50
|
+
* @defaultValue true
|
|
51
|
+
*/
|
|
47
52
|
"show-soft-input-on-focus"?: NativeInputProps["show-soft-input-on-focus"];
|
|
48
53
|
"input-filter"?: NativeInputProps["input-filter"];
|
|
49
54
|
type?: NativeInputProps["type"];
|
|
50
55
|
"ios-auto-correct"?: NativeInputProps["ios-auto-correct"];
|
|
51
56
|
"ios-spell-check"?: NativeInputProps["ios-spell-check"];
|
|
52
57
|
"android-fullscreen-mode"?: NativeInputProps["android-fullscreen-mode"];
|
|
53
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Android host window의 soft input mode를 지정한다.
|
|
60
|
+
* `undefined`가 native attribute로 전달되지 않도록 `"unspecified"`를 명시적으로 적용한다.
|
|
61
|
+
* @defaultValue "unspecified"
|
|
62
|
+
*/
|
|
54
63
|
"android-set-soft-input-mode"?: AndroidSetSoftInputMode;
|
|
55
64
|
bindfocus?: NativeInputProps["bindfocus"];
|
|
56
65
|
bindblur?: NativeInputProps["bindblur"];
|
|
@@ -80,6 +89,11 @@ export interface TextFieldTextareaProps extends NativeTextControlProps {
|
|
|
80
89
|
"line-spacing"?: NativeTextareaProps["line-spacing"];
|
|
81
90
|
readonly?: NativeTextareaProps["readonly"];
|
|
82
91
|
disabled?: NativeTextareaProps["disabled"];
|
|
92
|
+
/**
|
|
93
|
+
* 포커스할 때 시스템 키보드를 표시한다.
|
|
94
|
+
* `undefined`가 native attribute로 전달되지 않도록 `true`를 명시적으로 적용한다.
|
|
95
|
+
* @defaultValue true
|
|
96
|
+
*/
|
|
83
97
|
"show-soft-input-on-focus"?: NativeTextareaProps["show-soft-input-on-focus"];
|
|
84
98
|
"input-filter"?: NativeTextareaProps["input-filter"];
|
|
85
99
|
"enable-scroll-bar"?: NativeTextareaProps["enable-scroll-bar"];
|
|
@@ -88,7 +102,11 @@ export interface TextFieldTextareaProps extends NativeTextControlProps {
|
|
|
88
102
|
"ios-spell-check"?: NativeTextareaProps["ios-spell-check"];
|
|
89
103
|
/** Android의 fullscreen extract input을 활성화한다. @defaultValue false */
|
|
90
104
|
"android-fullscreen-mode"?: NativeTextareaProps["android-fullscreen-mode"];
|
|
91
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Android host window의 soft input mode를 지정한다.
|
|
107
|
+
* `undefined`가 native attribute로 전달되지 않도록 `"unspecified"`를 명시적으로 적용한다.
|
|
108
|
+
* @defaultValue "unspecified"
|
|
109
|
+
*/
|
|
92
110
|
"android-set-soft-input-mode"?: AndroidSetSoftInputMode;
|
|
93
111
|
bindfocus?: NativeTextareaProps["bindfocus"];
|
|
94
112
|
bindblur?: NativeTextareaProps["bindblur"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAa,KAAK,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAIjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAG/F,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAa,KAAK,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAIjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAG/F,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AA+BpE;;;;;;GAMG;AACH,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAC5C,sBAAsB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,mEAAmE;IACnE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,aAAa,qFAuHzB,CAAC;AAKF,KAAK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