@seed-design/lynx-react 0.0.0-alpha-20260622094810
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/_virtual/_rolldown/runtime.js +13 -0
- package/lib/components/ActionButton/ActionButton.d.ts +49 -0
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -0
- package/lib/components/ActionButton/ActionButton.jsx +158 -0
- package/lib/components/ActionButton/index.d.ts +2 -0
- package/lib/components/ActionButton/index.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.d.ts +35 -0
- package/lib/components/AppBar/AppBar.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.jsx +132 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts +2 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.namespace.js +15 -0
- package/lib/components/AppBar/context.d.ts +13 -0
- package/lib/components/AppBar/context.d.ts.map +1 -0
- package/lib/components/AppBar/context.js +12 -0
- package/lib/components/AppBar/index.d.ts +3 -0
- package/lib/components/AppBar/index.d.ts.map +1 -0
- package/lib/components/AppBar/useAppBar.d.ts +15 -0
- package/lib/components/AppBar/useAppBar.d.ts.map +1 -0
- package/lib/components/AppBar/useAppBar.js +72 -0
- package/lib/components/Badge/Badge.d.ts +14 -0
- package/lib/components/Badge/Badge.d.ts.map +1 -0
- package/lib/components/Badge/Badge.jsx +15 -0
- package/lib/components/Badge/index.d.ts +2 -0
- package/lib/components/Badge/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +87 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.jsx +163 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +2 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.js +18 -0
- package/lib/components/BottomSheet/index.d.ts +3 -0
- package/lib/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/components/Box/Box.d.ts +20 -0
- package/lib/components/Box/Box.d.ts.map +1 -0
- package/lib/components/Box/Box.jsx +14 -0
- package/lib/components/Box/index.d.ts +2 -0
- package/lib/components/Box/index.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts +35 -0
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.jsx +130 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +2 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.namespace.js +12 -0
- package/lib/components/Checkbox/index.d.ts +3 -0
- package/lib/components/Checkbox/index.d.ts.map +1 -0
- package/lib/components/Icon/Icon.d.ts +37 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -0
- package/lib/components/Icon/Icon.jsx +143 -0
- package/lib/components/Icon/index.d.ts +2 -0
- package/lib/components/Icon/index.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts +25 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.jsx +281 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +2 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.js +9 -0
- package/lib/components/ProgressCircle/index.d.ts +3 -0
- package/lib/components/ProgressCircle/index.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.d.ts +34 -0
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.jsx +160 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +2 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.js +12 -0
- package/lib/components/RadioGroup/index.d.ts +3 -0
- package/lib/components/RadioGroup/index.d.ts.map +1 -0
- package/lib/components/Stack/Stack.d.ts +33 -0
- package/lib/components/Stack/Stack.d.ts.map +1 -0
- package/lib/components/Stack/Stack.jsx +39 -0
- package/lib/components/Stack/index.d.ts +2 -0
- package/lib/components/Stack/index.d.ts.map +1 -0
- package/lib/components/Switch/Switch.d.ts +21 -0
- package/lib/components/Switch/Switch.d.ts.map +1 -0
- package/lib/components/Switch/Switch.jsx +101 -0
- package/lib/components/Switch/Switch.namespace.d.ts +2 -0
- package/lib/components/Switch/Switch.namespace.d.ts.map +1 -0
- package/lib/components/Switch/Switch.namespace.js +11 -0
- package/lib/components/Switch/index.d.ts +3 -0
- package/lib/components/Switch/index.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.d.ts +34 -0
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.jsx +57 -0
- package/lib/components/TagGroup/TagGroup.namespace.d.ts +2 -0
- package/lib/components/TagGroup/TagGroup.namespace.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.namespace.js +10 -0
- package/lib/components/TagGroup/index.d.ts +3 -0
- package/lib/components/TagGroup/index.d.ts.map +1 -0
- package/lib/components/Text/Text.d.ts +7 -0
- package/lib/components/Text/Text.d.ts.map +1 -0
- package/lib/components/Text/Text.jsx +28 -0
- package/lib/components/Text/index.d.ts +2 -0
- package/lib/components/Text/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +14 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/hooks/index.d.ts +5 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/useControllableState.d.ts +15 -0
- package/lib/hooks/useControllableState.d.ts.map +1 -0
- package/lib/hooks/useControllableState.js +27 -0
- package/lib/hooks/useIconColor.d.ts +19 -0
- package/lib/hooks/useIconColor.d.ts.map +1 -0
- package/lib/hooks/useIconColor.js +38 -0
- package/lib/hooks/usePressTap.d.ts +27 -0
- package/lib/hooks/usePressTap.d.ts.map +1 -0
- package/lib/hooks/usePressTap.js +35 -0
- package/lib/hooks/useSafeArea.d.ts +19 -0
- package/lib/hooks/useSafeArea.d.ts.map +1 -0
- package/lib/hooks/useSafeArea.js +33 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +29 -0
- package/lib/types.d.ts +51 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/utils/children.d.ts +3 -0
- package/lib/utils/children.d.ts.map +1 -0
- package/lib/utils/children.js +8 -0
- package/lib/utils/create-slot-recipe-context.d.ts +27 -0
- package/lib/utils/create-slot-recipe-context.d.ts.map +1 -0
- package/lib/utils/create-slot-recipe-context.jsx +94 -0
- package/lib/utils/get-seed-class-name.d.ts +22 -0
- package/lib/utils/get-seed-class-name.d.ts.map +1 -0
- package/lib/utils/get-seed-class-name.js +28 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/resolve-recipe-token.d.ts +38 -0
- package/lib/utils/resolve-recipe-token.d.ts.map +1 -0
- package/lib/utils/resolve-recipe-token.js +49 -0
- package/lib/utils/split-multiple-variants-props.d.ts +29 -0
- package/lib/utils/split-multiple-variants-props.d.ts.map +1 -0
- package/lib/utils/split-multiple-variants-props.js +34 -0
- package/lib/utils/styled.d.ts +83 -0
- package/lib/utils/styled.d.ts.map +1 -0
- package/lib/utils/styled.js +144 -0
- package/package.json +54 -0
- package/src/components/ActionButton/ActionButton.test.tsx +167 -0
- package/src/components/ActionButton/ActionButton.tsx +363 -0
- package/src/components/ActionButton/index.ts +1 -0
- package/src/components/AppBar/AppBar.namespace.ts +18 -0
- package/src/components/AppBar/AppBar.test.tsx +270 -0
- package/src/components/AppBar/AppBar.tsx +288 -0
- package/src/components/AppBar/context.ts +27 -0
- package/src/components/AppBar/index.ts +21 -0
- package/src/components/AppBar/useAppBar.ts +100 -0
- package/src/components/Badge/Badge.test.tsx +54 -0
- package/src/components/Badge/Badge.tsx +32 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/BottomSheet/BottomSheet.namespace.ts +24 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +219 -0
- package/src/components/BottomSheet/BottomSheet.tsx +423 -0
- package/src/components/BottomSheet/index.ts +27 -0
- package/src/components/Box/Box.test.tsx +85 -0
- package/src/components/Box/Box.tsx +39 -0
- package/src/components/Box/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.namespace.ts +12 -0
- package/src/components/Checkbox/Checkbox.tsx +282 -0
- package/src/components/Checkbox/index.ts +14 -0
- package/src/components/Icon/Icon.tsx +265 -0
- package/src/components/Icon/index.ts +8 -0
- package/src/components/ProgressCircle/ProgressCircle.namespace.ts +5 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +424 -0
- package/src/components/ProgressCircle/index.ts +9 -0
- package/src/components/RadioGroup/RadioGroup.namespace.ts +12 -0
- package/src/components/RadioGroup/RadioGroup.tsx +320 -0
- package/src/components/RadioGroup/index.ts +14 -0
- package/src/components/Stack/Stack.tsx +97 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Switch/Switch.namespace.ts +10 -0
- package/src/components/Switch/Switch.tsx +200 -0
- package/src/components/Switch/index.ts +12 -0
- package/src/components/TagGroup/TagGroup.namespace.ts +8 -0
- package/src/components/TagGroup/TagGroup.tsx +127 -0
- package/src/components/TagGroup/index.ts +10 -0
- package/src/components/Text/Text.tsx +64 -0
- package/src/components/Text/index.ts +1 -0
- package/src/components/index.ts +13 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useControllableState.test.ts +120 -0
- package/src/hooks/useControllableState.ts +38 -0
- package/src/hooks/useIconColor.test.ts +13 -0
- package/src/hooks/useIconColor.ts +67 -0
- package/src/hooks/usePressTap.test.ts +129 -0
- package/src/hooks/usePressTap.ts +58 -0
- package/src/hooks/useSafeArea.test.ts +83 -0
- package/src/hooks/useSafeArea.ts +56 -0
- package/src/index.ts +4 -0
- package/src/types.ts +76 -0
- package/src/utils/children.ts +13 -0
- package/src/utils/create-slot-recipe-context.test.tsx +96 -0
- package/src/utils/create-slot-recipe-context.tsx +187 -0
- package/src/utils/get-seed-class-name.ts +47 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/resolve-recipe-token.ts +47 -0
- package/src/utils/split-multiple-variants-props.test.ts +61 -0
- package/src/utils/split-multiple-variants-props.ts +59 -0
- package/src/utils/styled.ts +442 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ActionButtonVariantProps } from '@seed-design/lynx-css/recipes/action-button';
|
|
2
|
+
import { LynxElementProps, LynxPressableProps, LynxViewProps } from '../../types';
|
|
3
|
+
import { StyleProps } from '../../utils/styled';
|
|
4
|
+
import { IconProps, PrefixIconProps, SuffixIconProps } from '../Icon/Icon';
|
|
5
|
+
import * as React from "@lynx-js/react";
|
|
6
|
+
interface ActionButtonAccessibilityProps {
|
|
7
|
+
"accessibility-label"?: LynxViewProps["accessibility-label"];
|
|
8
|
+
"accessibility-element"?: LynxViewProps["accessibility-element"];
|
|
9
|
+
"accessibility-traits"?: LynxViewProps["accessibility-traits"];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @platform Lynx
|
|
13
|
+
*
|
|
14
|
+
* 웹 대비 차이:
|
|
15
|
+
* - 아이콘 렌더링: 웹의 SVG `currentColor` 대신 Lynx `<image>` 의 `tint-color` 를
|
|
16
|
+
* `Icon` / `PrefixIcon` / `SuffixIcon` wrapper 가 동기화한다.
|
|
17
|
+
* - 호환 API: 기존 `prefixIcon` / `suffixIcon` / `icon` prop 도 유지한다.
|
|
18
|
+
* - 미지원 prop: `color`, `fontWeight`, `bleedX`, `bleedY` (CSS variable 동적 주입 제한)
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import IconPlusFill from "@karrotmarket/lynx-monochrome-icon/IconPlusFill";
|
|
22
|
+
* import IconChevronDownFill from "@karrotmarket/lynx-monochrome-icon/IconChevronDownFill";
|
|
23
|
+
* import { Icon, PrefixIcon, SuffixIcon } from "@seed-design/lynx-react";
|
|
24
|
+
*
|
|
25
|
+
* // withText (기본)
|
|
26
|
+
* <ActionButton variant="brandSolid">
|
|
27
|
+
* <PrefixIcon icon={<IconPlusFill />} />
|
|
28
|
+
* 라벨
|
|
29
|
+
* <SuffixIcon icon={<IconChevronDownFill />} />
|
|
30
|
+
* </ActionButton>
|
|
31
|
+
*
|
|
32
|
+
* // iconOnly — `<Icon />` child 와 `accessibility-label` 필수
|
|
33
|
+
* <ActionButton
|
|
34
|
+
* layout="iconOnly"
|
|
35
|
+
* variant="neutralSolid"
|
|
36
|
+
* accessibility-label="추가"
|
|
37
|
+
* >
|
|
38
|
+
* <Icon icon={<IconPlusFill />} />
|
|
39
|
+
* </ActionButton>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export interface ActionButtonProps extends Omit<ActionButtonVariantProps, "pressed">, Pick<StyleProps, "flexGrow">, LynxElementProps, LynxPressableProps, ActionButtonAccessibilityProps {
|
|
43
|
+
icon?: IconProps["icon"];
|
|
44
|
+
prefixIcon?: PrefixIconProps["icon"];
|
|
45
|
+
suffixIcon?: SuffixIconProps["icon"];
|
|
46
|
+
}
|
|
47
|
+
export declare const ActionButton: React.ForwardRefExoticComponent<ActionButtonProps & React.RefAttributes<unknown>>;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=ActionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionButton.d.ts","sourceRoot":"","sources":["../../../src/components/ActionButton/ActionButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAI5F,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAIxC,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAIlB,aAAa,EAEd,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMvE,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAiBtB,UAAU,8BAA8B;IACtC,qBAAqB,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC7D,uBAAuB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IACjE,sBAAsB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChE;AA0LD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,EAC/C,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,EAC5B,gBAAgB,EAChB,kBAAkB,EAClB,8BAA8B;IAChC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,YAAY,mFA2EvB,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
2
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
3
|
+
import { toArray } from "../../utils/children.js";
|
|
4
|
+
import { capitalize, resolveRecipeToken } from "../../utils/resolve-recipe-token.js";
|
|
5
|
+
import { resolveFlexValue } from "../../utils/styled.js";
|
|
6
|
+
import { ProgressCircleRange, ProgressCircleRoot } from "../ProgressCircle/ProgressCircle.jsx";
|
|
7
|
+
import { Icon, IconRequired, IconSlotProvider, PrefixIcon, SuffixIcon, getIconSlotName } from "../Icon/Icon.jsx";
|
|
8
|
+
import { actionButton } from "@seed-design/lynx-css/recipes/action-button";
|
|
9
|
+
import { progressCircleVariantMap } from "@seed-design/lynx-css/recipes/progress-circle";
|
|
10
|
+
import { actionButton as actionButton$1 } from "@seed-design/lynx-css/vars/component";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import * as React from "@lynx-js/react";
|
|
13
|
+
import { isValidElement, useMemo } from "@lynx-js/react";
|
|
14
|
+
//#region src/components/ActionButton/ActionButton.tsx
|
|
15
|
+
var { ClassNamesProvider, useClassNames, PropsProvider } = createSlotRecipeContext(actionButton);
|
|
16
|
+
function resolveProgressCircleSize(actionButtonSize) {
|
|
17
|
+
const token = resolveRecipeToken(actionButton$1, [
|
|
18
|
+
`size${capitalize(actionButtonSize ?? "medium")}`,
|
|
19
|
+
"enabled",
|
|
20
|
+
"progressCircle",
|
|
21
|
+
"size"
|
|
22
|
+
]);
|
|
23
|
+
const normalized = token?.endsWith("px") ? token.slice(0, -2) : token;
|
|
24
|
+
return progressCircleVariantMap.size.find((size) => size === normalized) ?? "16";
|
|
25
|
+
}
|
|
26
|
+
var ActionButtonRoot = React.forwardRef((innerProps, ref) => {
|
|
27
|
+
const props = {
|
|
28
|
+
layout: "withText",
|
|
29
|
+
...innerProps
|
|
30
|
+
};
|
|
31
|
+
const [variantProps, otherProps] = actionButton.splitVariantProps(props);
|
|
32
|
+
const classNames = actionButton(variantProps);
|
|
33
|
+
const { className: userClassName, children, ...rest } = otherProps;
|
|
34
|
+
const propsForContext = useMemo(() => variantProps, [
|
|
35
|
+
variantProps.variant,
|
|
36
|
+
variantProps.size,
|
|
37
|
+
variantProps.layout,
|
|
38
|
+
variantProps.pressed,
|
|
39
|
+
variantProps.disabled,
|
|
40
|
+
variantProps.loading
|
|
41
|
+
]);
|
|
42
|
+
const iconSlotContextValue = useMemo(() => ({
|
|
43
|
+
classNames: {
|
|
44
|
+
icon: classNames.icon,
|
|
45
|
+
prefixIcon: classNames.prefixIcon,
|
|
46
|
+
suffixIcon: classNames.suffixIcon
|
|
47
|
+
},
|
|
48
|
+
deps: [
|
|
49
|
+
variantProps.variant ?? null,
|
|
50
|
+
variantProps.disabled ?? false,
|
|
51
|
+
variantProps.loading ?? false,
|
|
52
|
+
variantProps.pressed ?? false
|
|
53
|
+
]
|
|
54
|
+
}), [
|
|
55
|
+
classNames.icon,
|
|
56
|
+
classNames.prefixIcon,
|
|
57
|
+
classNames.suffixIcon,
|
|
58
|
+
variantProps.variant,
|
|
59
|
+
variantProps.disabled,
|
|
60
|
+
variantProps.loading,
|
|
61
|
+
variantProps.pressed
|
|
62
|
+
]);
|
|
63
|
+
return <ClassNamesProvider value={classNames}>
|
|
64
|
+
<PropsProvider value={propsForContext}>
|
|
65
|
+
<IconSlotProvider value={iconSlotContextValue}>
|
|
66
|
+
<view {...ref ? { ref } : {}} {...rest} className={clsx(classNames.root, userClassName)}>
|
|
67
|
+
{children}
|
|
68
|
+
</view>
|
|
69
|
+
</IconSlotProvider>
|
|
70
|
+
</PropsProvider>
|
|
71
|
+
</ClassNamesProvider>;
|
|
72
|
+
});
|
|
73
|
+
ActionButtonRoot.displayName = "ActionButtonRoot";
|
|
74
|
+
var ActionButtonTextSlot = React.forwardRef((props, ref) => {
|
|
75
|
+
const { children, className: userClassName, ...rest } = props;
|
|
76
|
+
const classNames = useClassNames();
|
|
77
|
+
return <text {...ref ? { ref } : {}} {...rest} className={clsx(classNames.text, userClassName)}>
|
|
78
|
+
{children}
|
|
79
|
+
</text>;
|
|
80
|
+
});
|
|
81
|
+
ActionButtonTextSlot.displayName = "ActionButtonTextSlot";
|
|
82
|
+
function ActionButtonContent({ children, isIconOnly, icon, prefixIcon, suffixIcon }) {
|
|
83
|
+
const childArray = toArray(children);
|
|
84
|
+
const prefixIconChildren = [];
|
|
85
|
+
const suffixIconChildren = [];
|
|
86
|
+
const iconChildren = [];
|
|
87
|
+
const textChildren = [];
|
|
88
|
+
for (const child of childArray) {
|
|
89
|
+
const slotName = getIconSlotName(child);
|
|
90
|
+
if (slotName === "prefixIcon") {
|
|
91
|
+
prefixIconChildren.push(child);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (slotName === "suffixIcon") {
|
|
95
|
+
suffixIconChildren.push(child);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (slotName === "icon") {
|
|
99
|
+
iconChildren.push(child);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
textChildren.push(child);
|
|
103
|
+
}
|
|
104
|
+
if (isIconOnly) {
|
|
105
|
+
if (icon != null && isValidElement(icon)) return <Icon icon={icon} />;
|
|
106
|
+
return iconChildren.length > 0 ? <>{iconChildren}</> : null;
|
|
107
|
+
}
|
|
108
|
+
return <>
|
|
109
|
+
{prefixIcon != null && isValidElement(prefixIcon) ? <PrefixIcon icon={prefixIcon} /> : null}
|
|
110
|
+
{prefixIconChildren}
|
|
111
|
+
{textChildren.length > 0 ? <ActionButtonTextSlot>{textChildren}</ActionButtonTextSlot> : null}
|
|
112
|
+
{suffixIconChildren}
|
|
113
|
+
{suffixIcon != null && isValidElement(suffixIcon) ? <SuffixIcon icon={suffixIcon} /> : null}
|
|
114
|
+
</>;
|
|
115
|
+
}
|
|
116
|
+
function ActionButtonLoadingContent(props) {
|
|
117
|
+
const classNames = useClassNames();
|
|
118
|
+
return <view className={classNames.content}>
|
|
119
|
+
<ActionButtonContent {...props} />
|
|
120
|
+
</view>;
|
|
121
|
+
}
|
|
122
|
+
function ActionButtonLoadingIndicator({ size }) {
|
|
123
|
+
const classNames = useClassNames();
|
|
124
|
+
const progressCircleSize = resolveProgressCircleSize(size);
|
|
125
|
+
return <view className={classNames.loadingIndicator}>
|
|
126
|
+
<ProgressCircleRoot size={progressCircleSize} tone="inherit">
|
|
127
|
+
<ProgressCircleRange />
|
|
128
|
+
</ProgressCircleRoot>
|
|
129
|
+
</view>;
|
|
130
|
+
}
|
|
131
|
+
var ActionButton = React.forwardRef((props, ref) => {
|
|
132
|
+
const { children, flexGrow, layout, icon, prefixIcon, suffixIcon, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits = "button", ...variantAndRest } = props;
|
|
133
|
+
const { disabled = false, loading = false } = variantAndRest;
|
|
134
|
+
const isInteractive = !disabled && !loading;
|
|
135
|
+
const isIconOnly = layout === "iconOnly";
|
|
136
|
+
const size = variantAndRest.size;
|
|
137
|
+
if (process.env.NODE_ENV !== "production" && isIconOnly && accessibilityElement && !accessibilityLabel) console.warn("ActionButton: `layout=\"iconOnly\"` requires `accessibility-label` for accessibility.");
|
|
138
|
+
const { pressed, ...pressTapHandlers } = usePressTap({
|
|
139
|
+
disabled: !isInteractive,
|
|
140
|
+
onTap: bindtap,
|
|
141
|
+
mainThreadOnTap: mainThreadBindtap
|
|
142
|
+
});
|
|
143
|
+
return <IconRequired enabled={isIconOnly}>
|
|
144
|
+
<ActionButtonRoot {...variantAndRest} layout={layout} pressed={pressed} ref={ref} style={flexGrow != null ? { flexGrow: resolveFlexValue(flexGrow) } : void 0} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-traits={accessibilityTraits} {...pressTapHandlers}>
|
|
145
|
+
{loading ? <>
|
|
146
|
+
<ActionButtonLoadingIndicator size={size} />
|
|
147
|
+
<ActionButtonLoadingContent isIconOnly={isIconOnly} icon={icon} prefixIcon={prefixIcon} suffixIcon={suffixIcon}>
|
|
148
|
+
{children}
|
|
149
|
+
</ActionButtonLoadingContent>
|
|
150
|
+
</> : <ActionButtonContent isIconOnly={isIconOnly} icon={icon} prefixIcon={prefixIcon} suffixIcon={suffixIcon}>
|
|
151
|
+
{children}
|
|
152
|
+
</ActionButtonContent>}
|
|
153
|
+
</ActionButtonRoot>
|
|
154
|
+
</IconRequired>;
|
|
155
|
+
});
|
|
156
|
+
ActionButton.displayName = "ActionButton";
|
|
157
|
+
//#endregion
|
|
158
|
+
export { ActionButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AppBarVariantProps } from '@seed-design/lynx-css/recipes/app-bar';
|
|
2
|
+
import { AppBarMainVariantProps } from '@seed-design/lynx-css/recipes/app-bar-main';
|
|
3
|
+
import { LynxElementProps, LynxIconElementProps, LynxPressableProps, LynxStyledElementProps, LynxViewProps } from '../../types';
|
|
4
|
+
import * as React from "@lynx-js/react";
|
|
5
|
+
export interface AppBarRootProps extends AppBarVariantProps, LynxStyledElementProps {
|
|
6
|
+
}
|
|
7
|
+
export declare const AppBarRoot: React.ForwardRefExoticComponent<AppBarRootProps & React.RefAttributes<unknown>>;
|
|
8
|
+
export interface AppBarLeftProps extends LynxStyledElementProps {
|
|
9
|
+
bindlayoutchange?: LynxViewProps["bindlayoutchange"];
|
|
10
|
+
}
|
|
11
|
+
export declare const AppBarLeft: React.ForwardRefExoticComponent<AppBarLeftProps & React.RefAttributes<unknown>>;
|
|
12
|
+
export interface AppBarRightProps extends LynxStyledElementProps {
|
|
13
|
+
bindlayoutchange?: LynxViewProps["bindlayoutchange"];
|
|
14
|
+
}
|
|
15
|
+
export declare const AppBarRight: React.ForwardRefExoticComponent<AppBarRightProps & React.RefAttributes<unknown>>;
|
|
16
|
+
export interface AppBarMainProps extends AppBarMainVariantProps, LynxStyledElementProps {
|
|
17
|
+
}
|
|
18
|
+
export declare const AppBarMain: React.ForwardRefExoticComponent<AppBarMainProps & React.RefAttributes<unknown>>;
|
|
19
|
+
export interface AppBarTitleProps extends LynxElementProps {
|
|
20
|
+
}
|
|
21
|
+
export declare const AppBarTitle: React.ForwardRefExoticComponent<AppBarTitleProps & React.RefAttributes<unknown>>;
|
|
22
|
+
export interface AppBarSubtitleProps extends LynxElementProps {
|
|
23
|
+
}
|
|
24
|
+
export declare const AppBarSubtitle: React.ForwardRefExoticComponent<AppBarSubtitleProps & React.RefAttributes<unknown>>;
|
|
25
|
+
export interface AppBarIconButtonProps extends LynxElementProps, LynxPressableProps {
|
|
26
|
+
icon?: React.ReactElement<LynxIconElementProps>;
|
|
27
|
+
"accessibility-label"?: LynxViewProps["accessibility-label"];
|
|
28
|
+
"accessibility-element"?: LynxViewProps["accessibility-element"];
|
|
29
|
+
"accessibility-traits"?: LynxViewProps["accessibility-traits"];
|
|
30
|
+
}
|
|
31
|
+
export declare const AppBarIconButton: React.ForwardRefExoticComponent<AppBarIconButtonProps & React.RefAttributes<unknown>>;
|
|
32
|
+
export interface AppBarSlotProps extends LynxStyledElementProps {
|
|
33
|
+
}
|
|
34
|
+
export declare const AppBarSlot: React.ForwardRefExoticComponent<AppBarSlotProps & React.RefAttributes<unknown>>;
|
|
35
|
+
//# sourceMappingURL=AppBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.d.ts","sourceRoot":"","sources":["../../../src/components/AppBar/AppBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAGxC,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EAEtB,aAAa,EAEd,MAAM,aAAa,CAAC;AAmCrB,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,sBAAsB;CAAG;AAEtF,eAAO,MAAM,UAAU,iFA4BrB,CAAC;AAKH,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,gBAAgB,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,UAAU,iFA0BrB,CAAC;AAGH,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC9D,gBAAgB,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,WAAW,kFA0BtB,CAAC;AAKH,MAAM,WAAW,eAAgB,SAAQ,sBAAsB,EAAE,sBAAsB;CAAG;AAE1F,eAAO,MAAM,UAAU,iFAoCrB,CAAC;AAGH,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;CAAG;AAE7D,eAAO,MAAM,WAAW,kFAatB,CAAC;AAGH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;CAAG;AAEhE,eAAO,MAAM,cAAc,qFAazB,CAAC;AAKH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB,EAAE,kBAAkB;IACjF,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAChD,qBAAqB,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC7D,uBAAuB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IACjE,sBAAsB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChE;AAED,eAAO,MAAM,gBAAgB,uFA4B3B,CAAC;AAGH,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;CAAG;AAElE,eAAO,MAAM,UAAU,iFAarB,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
2
|
+
import { Icon } from "../Icon/Icon.jsx";
|
|
3
|
+
import { AppBarProvider, useAppBarContext } from "./context.js";
|
|
4
|
+
import { getLayoutWidth, getMainLayoutStyle, useAppBar } from "./useAppBar.js";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import * as React from "@lynx-js/react";
|
|
7
|
+
import { appBar } from "@seed-design/lynx-css/recipes/app-bar";
|
|
8
|
+
import { appBarMain } from "@seed-design/lynx-css/recipes/app-bar-main";
|
|
9
|
+
//#region src/components/AppBar/AppBar.tsx
|
|
10
|
+
var { ClassNamesProvider: AppBarClassNamesProvider, useClassNames: useAppBarRecipeClassNames } = createSlotRecipeContext(appBar);
|
|
11
|
+
var { ClassNamesProvider: AppBarMainClassNamesProvider, useClassNames: useAppBarMainRecipeClassNames } = createSlotRecipeContext(appBarMain);
|
|
12
|
+
function useAppBarClassNames(consumer) {
|
|
13
|
+
try {
|
|
14
|
+
return useAppBarRecipeClassNames();
|
|
15
|
+
} catch {
|
|
16
|
+
throw new Error(`<${consumer}/> must be rendered inside <AppBarRoot/>.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function useAppBarMainClassNames(consumer) {
|
|
20
|
+
try {
|
|
21
|
+
return useAppBarMainRecipeClassNames();
|
|
22
|
+
} catch {
|
|
23
|
+
throw new Error(`<${consumer}/> must be rendered inside <AppBarMain/>.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
var AppBarRoot = React.forwardRef((props, ref) => {
|
|
27
|
+
const [variantProps, otherProps] = appBar.splitVariantProps(props);
|
|
28
|
+
const { children, className, style, ...nativeProps } = otherProps;
|
|
29
|
+
const { contextValue, resolvedVariantProps, rootLayoutStyle } = useAppBar(variantProps);
|
|
30
|
+
const classNames = appBar(resolvedVariantProps);
|
|
31
|
+
return <AppBarProvider value={contextValue}>
|
|
32
|
+
<AppBarClassNamesProvider value={classNames}>
|
|
33
|
+
<view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.root, className)} style={{
|
|
34
|
+
"--seed-safe-area-top": contextValue.safeAreaInsetTop,
|
|
35
|
+
"--centered-title-padding-x": contextValue.centeredTitlePaddingX,
|
|
36
|
+
...rootLayoutStyle,
|
|
37
|
+
...style
|
|
38
|
+
}}>
|
|
39
|
+
<view accessibility-elements-hidden className={classNames.background} />
|
|
40
|
+
{children}
|
|
41
|
+
</view>
|
|
42
|
+
</AppBarClassNamesProvider>
|
|
43
|
+
</AppBarProvider>;
|
|
44
|
+
});
|
|
45
|
+
AppBarRoot.displayName = "AppBarRoot";
|
|
46
|
+
var AppBarLeft = React.forwardRef((props, ref) => {
|
|
47
|
+
const { children, className, bindlayoutchange, ...nativeProps } = props;
|
|
48
|
+
const { setLeftWidth } = useAppBarContext("AppBarLeft");
|
|
49
|
+
const classNames = useAppBarClassNames("AppBarLeft");
|
|
50
|
+
const handleLayoutChange = React.useCallback((...args) => {
|
|
51
|
+
bindlayoutchange?.(...args);
|
|
52
|
+
const width = getLayoutWidth(args[0]);
|
|
53
|
+
if (width != null) setLeftWidth(width);
|
|
54
|
+
}, [bindlayoutchange, setLeftWidth]);
|
|
55
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} bindlayoutchange={handleLayoutChange} className={clsx(classNames.left, className)}>
|
|
56
|
+
{children}
|
|
57
|
+
</view>;
|
|
58
|
+
});
|
|
59
|
+
AppBarLeft.displayName = "AppBarLeft";
|
|
60
|
+
var AppBarRight = React.forwardRef((props, ref) => {
|
|
61
|
+
const { children, className, bindlayoutchange, ...nativeProps } = props;
|
|
62
|
+
const { setRightWidth } = useAppBarContext("AppBarRight");
|
|
63
|
+
const classNames = useAppBarClassNames("AppBarRight");
|
|
64
|
+
const handleLayoutChange = React.useCallback((...args) => {
|
|
65
|
+
bindlayoutchange?.(...args);
|
|
66
|
+
const width = getLayoutWidth(args[0]);
|
|
67
|
+
if (width != null) setRightWidth(width);
|
|
68
|
+
}, [bindlayoutchange, setRightWidth]);
|
|
69
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} bindlayoutchange={handleLayoutChange} className={clsx(classNames.right, className)}>
|
|
70
|
+
{children}
|
|
71
|
+
</view>;
|
|
72
|
+
});
|
|
73
|
+
AppBarRight.displayName = "AppBarRight";
|
|
74
|
+
var AppBarMain = React.forwardRef((props, ref) => {
|
|
75
|
+
const { centeredTitlePaddingX, safeAreaInsetTop, sharedVariantProps } = useAppBarContext("AppBarMain");
|
|
76
|
+
const [variantProps, otherProps] = appBarMain.splitVariantProps({
|
|
77
|
+
...sharedVariantProps,
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
const resolvedTheme = variantProps.theme ?? "cupertino";
|
|
81
|
+
const classNames = appBarMain(variantProps);
|
|
82
|
+
const { children, className, style, ...nativeProps } = otherProps;
|
|
83
|
+
const centeredTitleStyle = variantProps.theme === "cupertino" ? {
|
|
84
|
+
paddingLeft: centeredTitlePaddingX,
|
|
85
|
+
paddingRight: centeredTitlePaddingX
|
|
86
|
+
} : void 0;
|
|
87
|
+
return <AppBarMainClassNamesProvider value={classNames}>
|
|
88
|
+
<view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.root, className)} style={{
|
|
89
|
+
...centeredTitleStyle,
|
|
90
|
+
...getMainLayoutStyle(resolvedTheme, safeAreaInsetTop),
|
|
91
|
+
...style
|
|
92
|
+
}}>
|
|
93
|
+
{children}
|
|
94
|
+
</view>
|
|
95
|
+
</AppBarMainClassNamesProvider>;
|
|
96
|
+
});
|
|
97
|
+
AppBarMain.displayName = "AppBarMain";
|
|
98
|
+
var AppBarTitle = React.forwardRef((props, ref) => {
|
|
99
|
+
const { children, className, ...nativeProps } = props;
|
|
100
|
+
const classNames = useAppBarMainClassNames("AppBarTitle");
|
|
101
|
+
return <text {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.title, className)}>
|
|
102
|
+
{children}
|
|
103
|
+
</text>;
|
|
104
|
+
});
|
|
105
|
+
AppBarTitle.displayName = "AppBarTitle";
|
|
106
|
+
var AppBarSubtitle = React.forwardRef((props, ref) => {
|
|
107
|
+
const { children, className, ...nativeProps } = props;
|
|
108
|
+
const classNames = useAppBarMainClassNames("AppBarSubtitle");
|
|
109
|
+
return <text {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.subtitle, className)}>
|
|
110
|
+
{children}
|
|
111
|
+
</text>;
|
|
112
|
+
});
|
|
113
|
+
AppBarSubtitle.displayName = "AppBarSubtitle";
|
|
114
|
+
var AppBarIconButton = React.forwardRef((props, ref) => {
|
|
115
|
+
const { children, className, icon, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits = "button", ...nativeProps } = props;
|
|
116
|
+
const classNames = useAppBarClassNames("AppBarIconButton");
|
|
117
|
+
if (process.env.NODE_ENV !== "production" && accessibilityElement && !accessibilityLabel) console.warn("AppBarIconButton requires `accessibility-label` for accessibility.");
|
|
118
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-traits={accessibilityTraits} className={clsx(classNames.iconButton, className)}>
|
|
119
|
+
{icon ? <Icon className={classNames.icon} icon={icon} /> : children}
|
|
120
|
+
</view>;
|
|
121
|
+
});
|
|
122
|
+
AppBarIconButton.displayName = "AppBarIconButton";
|
|
123
|
+
var AppBarSlot = React.forwardRef((props, ref) => {
|
|
124
|
+
const { children, className, ...nativeProps } = props;
|
|
125
|
+
const classNames = useAppBarClassNames("AppBarSlot");
|
|
126
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.custom, className)}>
|
|
127
|
+
{children}
|
|
128
|
+
</view>;
|
|
129
|
+
});
|
|
130
|
+
AppBarSlot.displayName = "AppBarSlot";
|
|
131
|
+
//#endregion
|
|
132
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AppBarIconButton as IconButton, AppBarLeft as Left, AppBarMain as Main, AppBarRight as Right, AppBarRoot as Root, AppBarSlot as Slot, AppBarSubtitle as Subtitle, AppBarTitle as Title, type AppBarIconButtonProps as IconButtonProps, type AppBarLeftProps as LeftProps, type AppBarMainProps as MainProps, type AppBarRightProps as RightProps, type AppBarRootProps as RootProps, type AppBarSlotProps as SlotProps, type AppBarSubtitleProps as SubtitleProps, type AppBarTitleProps as TitleProps, } from './AppBar';
|
|
2
|
+
//# sourceMappingURL=AppBar.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/AppBar/AppBar.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,UAAU,EAC9B,UAAU,IAAI,IAAI,EAClB,UAAU,IAAI,IAAI,EAClB,WAAW,IAAI,KAAK,EACpB,UAAU,IAAI,IAAI,EAClB,UAAU,IAAI,IAAI,EAClB,cAAc,IAAI,QAAQ,EAC1B,WAAW,IAAI,KAAK,EACpB,KAAK,qBAAqB,IAAI,eAAe,EAC7C,KAAK,eAAe,IAAI,SAAS,EACjC,KAAK,eAAe,IAAI,SAAS,EACjC,KAAK,gBAAgB,IAAI,UAAU,EACnC,KAAK,eAAe,IAAI,SAAS,EACjC,KAAK,eAAe,IAAI,SAAS,EACjC,KAAK,mBAAmB,IAAI,aAAa,EACzC,KAAK,gBAAgB,IAAI,UAAU,GACpC,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle } from "./AppBar.jsx";
|
|
3
|
+
//#region src/components/AppBar/AppBar.namespace.ts
|
|
4
|
+
var AppBar_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
IconButton: () => AppBarIconButton,
|
|
6
|
+
Left: () => AppBarLeft,
|
|
7
|
+
Main: () => AppBarMain,
|
|
8
|
+
Right: () => AppBarRight,
|
|
9
|
+
Root: () => AppBarRoot,
|
|
10
|
+
Slot: () => AppBarSlot,
|
|
11
|
+
Subtitle: () => AppBarSubtitle,
|
|
12
|
+
Title: () => AppBarTitle
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AppBar_namespace_exports };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppBarMainVariantProps } from '@seed-design/lynx-css/recipes/app-bar-main';
|
|
2
|
+
import * as React from "@lynx-js/react";
|
|
3
|
+
export type SharedAppBarVariantProps = Pick<AppBarMainVariantProps, "theme" | "tone" | "transitionStyle">;
|
|
4
|
+
export interface AppBarContextValue {
|
|
5
|
+
centeredTitlePaddingX: string;
|
|
6
|
+
safeAreaInsetTop: string;
|
|
7
|
+
sharedVariantProps: SharedAppBarVariantProps;
|
|
8
|
+
setLeftWidth: (width: number) => void;
|
|
9
|
+
setRightWidth: (width: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const AppBarProvider: React.Provider<AppBarContextValue | null>;
|
|
12
|
+
export declare function useAppBarContext(consumer: string): AppBarContextValue;
|
|
13
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/components/AppBar/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,sBAAsB,EACtB,OAAO,GAAG,MAAM,GAAG,iBAAiB,CACrC,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,wBAAwB,CAAC;IAC7C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAID,eAAO,MAAM,cAAc,2CAAyB,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAMrE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "@lynx-js/react";
|
|
2
|
+
import "@seed-design/lynx-css/recipes/app-bar-main";
|
|
3
|
+
//#region src/components/AppBar/context.ts
|
|
4
|
+
var AppBarContext = React.createContext(null);
|
|
5
|
+
var AppBarProvider = AppBarContext.Provider;
|
|
6
|
+
function useAppBarContext(consumer) {
|
|
7
|
+
const ctx = React.useContext(AppBarContext);
|
|
8
|
+
if (!ctx) throw new Error(`<${consumer}/> must be rendered inside <AppBarRoot/>.`);
|
|
9
|
+
return ctx;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { AppBarProvider, useAppBarContext };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle, type AppBarIconButtonProps, type AppBarLeftProps, type AppBarMainProps, type AppBarRightProps, type AppBarRootProps, type AppBarRootProps as AppBarProps, type AppBarSlotProps, type AppBarSubtitleProps, type AppBarTitleProps, } from './AppBar';
|
|
2
|
+
export * as AppBar from './AppBar.namespace';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,IAAI,WAAW,EACnC,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AppBarVariantProps, AppBarVariant } from '@seed-design/lynx-css/recipes/app-bar';
|
|
2
|
+
import { AppBarMainVariantProps } from '@seed-design/lynx-css/recipes/app-bar-main';
|
|
3
|
+
import { LynxViewProps } from '../../types';
|
|
4
|
+
import { AppBarContextValue } from './context';
|
|
5
|
+
type LayoutChangeHandler = NonNullable<LynxViewProps["bindlayoutchange"]>;
|
|
6
|
+
type AppBarStyleObject = Record<string, string | number>;
|
|
7
|
+
export declare function getLayoutWidth(event: Parameters<LayoutChangeHandler>[0]): number | null;
|
|
8
|
+
export declare function getMainLayoutStyle(theme: AppBarMainVariantProps["theme"], safeAreaInsetTop: string): AppBarStyleObject | undefined;
|
|
9
|
+
export declare function useAppBar(variantProps: AppBarVariantProps): {
|
|
10
|
+
contextValue: AppBarContextValue;
|
|
11
|
+
resolvedVariantProps: Partial< AppBarVariant>;
|
|
12
|
+
rootLayoutStyle: AppBarStyleObject;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=useAppBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppBar.d.ts","sourceRoot":"","sources":["../../../src/components/AppBar/useAppBar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAIzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAA4B,MAAM,WAAW,CAAC;AAO9E,KAAK,mBAAmB,GAAG,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC1E,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAkBzD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAMvF;AAaD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACtC,gBAAgB,EAAE,MAAM,GACvB,iBAAiB,GAAG,SAAS,CAO/B;AAED,wBAAgB,SAAS,CAAC,YAAY,EAAE,kBAAkB;;;;EAoCzD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useSafeArea } from "../../hooks/useSafeArea.js";
|
|
2
|
+
import * as React from "@lynx-js/react";
|
|
3
|
+
//#region src/components/AppBar/useAppBar.ts
|
|
4
|
+
var APP_BAR_HEIGHT_BY_THEME = {
|
|
5
|
+
cupertino: "44px",
|
|
6
|
+
android: "56px"
|
|
7
|
+
};
|
|
8
|
+
function getDefaultAppBarTheme() {
|
|
9
|
+
const systemInfo = globalThis.SystemInfo ?? (typeof SystemInfo === "undefined" ? void 0 : SystemInfo);
|
|
10
|
+
if (systemInfo == null) return "cupertino";
|
|
11
|
+
return systemInfo.platform === "Android" ? "android" : "cupertino";
|
|
12
|
+
}
|
|
13
|
+
function getLayoutWidth(event) {
|
|
14
|
+
const eventWithWidth = event;
|
|
15
|
+
const nextWidth = event.detail?.width ?? event.params?.width ?? eventWithWidth.width;
|
|
16
|
+
if (typeof nextWidth !== "number" || !Number.isFinite(nextWidth)) return null;
|
|
17
|
+
return Math.max(0, nextWidth);
|
|
18
|
+
}
|
|
19
|
+
function getCenteredTitlePadding(leftWidth, rightWidth) {
|
|
20
|
+
return `${Math.max(leftWidth, rightWidth)}px`;
|
|
21
|
+
}
|
|
22
|
+
function getRootLayoutStyle(theme, safeAreaInsetTop) {
|
|
23
|
+
return {
|
|
24
|
+
height: `calc(${APP_BAR_HEIGHT_BY_THEME[theme]} + ${safeAreaInsetTop})`,
|
|
25
|
+
paddingTop: safeAreaInsetTop
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function getMainLayoutStyle(theme, safeAreaInsetTop) {
|
|
29
|
+
if (theme !== "cupertino") return void 0;
|
|
30
|
+
return {
|
|
31
|
+
top: safeAreaInsetTop,
|
|
32
|
+
bottom: "0px"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function useAppBar(variantProps) {
|
|
36
|
+
const { safeAreaInsetTop } = useSafeArea();
|
|
37
|
+
const [leftWidth, setLeftWidth] = React.useState(0);
|
|
38
|
+
const [rightWidth, setRightWidth] = React.useState(0);
|
|
39
|
+
const resolvedTheme = variantProps.theme ?? getDefaultAppBarTheme();
|
|
40
|
+
const resolvedVariantProps = {
|
|
41
|
+
...variantProps,
|
|
42
|
+
theme: resolvedTheme
|
|
43
|
+
};
|
|
44
|
+
const centeredTitlePaddingX = getCenteredTitlePadding(leftWidth, rightWidth);
|
|
45
|
+
const rootLayoutStyle = getRootLayoutStyle(resolvedTheme, safeAreaInsetTop);
|
|
46
|
+
const sharedVariantProps = React.useMemo(() => ({
|
|
47
|
+
theme: resolvedVariantProps.theme,
|
|
48
|
+
tone: resolvedVariantProps.tone,
|
|
49
|
+
transitionStyle: resolvedVariantProps.transitionStyle
|
|
50
|
+
}), [
|
|
51
|
+
resolvedVariantProps.theme,
|
|
52
|
+
resolvedVariantProps.tone,
|
|
53
|
+
resolvedVariantProps.transitionStyle
|
|
54
|
+
]);
|
|
55
|
+
return {
|
|
56
|
+
contextValue: React.useMemo(() => ({
|
|
57
|
+
centeredTitlePaddingX,
|
|
58
|
+
safeAreaInsetTop,
|
|
59
|
+
sharedVariantProps,
|
|
60
|
+
setLeftWidth,
|
|
61
|
+
setRightWidth
|
|
62
|
+
}), [
|
|
63
|
+
centeredTitlePaddingX,
|
|
64
|
+
safeAreaInsetTop,
|
|
65
|
+
sharedVariantProps
|
|
66
|
+
]),
|
|
67
|
+
resolvedVariantProps,
|
|
68
|
+
rootLayoutStyle
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { getLayoutWidth, getMainLayoutStyle, useAppBar };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BadgeVariantProps } from '@seed-design/lynx-css/recipes/badge';
|
|
2
|
+
import { LynxStyledElementProps } from '../../types';
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
/**
|
|
5
|
+
* @platform Lynx
|
|
6
|
+
*
|
|
7
|
+
* 웹 Badge와 동일한 variant surface를 제공하지만, Lynx native `<view>` / `<text>`를
|
|
8
|
+
* 직접 렌더링합니다. Badge는 정적 정보 표시 컴포넌트이므로 press/tap API를 별도
|
|
9
|
+
* 소유하지 않습니다.
|
|
10
|
+
*/
|
|
11
|
+
export interface BadgeProps extends BadgeVariantProps, LynxStyledElementProps {
|
|
12
|
+
}
|
|
13
|
+
export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<unknown>>;
|
|
14
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAEpF,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,WAAW,UAAW,SAAQ,iBAAiB,EAAE,sBAAsB;CAAG;AAEhF,eAAO,MAAM,KAAK,4EAchB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import * as React from "@lynx-js/react";
|
|
3
|
+
import { badge } from "@seed-design/lynx-css/recipes/badge";
|
|
4
|
+
//#region src/components/Badge/Badge.tsx
|
|
5
|
+
var Badge = React.forwardRef((props, ref) => {
|
|
6
|
+
const [variantProps, otherProps] = badge.splitVariantProps(props);
|
|
7
|
+
const classes = badge(variantProps);
|
|
8
|
+
const { children, className, ...nativeProps } = otherProps;
|
|
9
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classes.root, className)}>
|
|
10
|
+
<text className={classes.label}>{children}</text>
|
|
11
|
+
</view>;
|
|
12
|
+
});
|
|
13
|
+
Badge.displayName = "Badge";
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Badge };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC"}
|