@seed-design/lynx-react 0.2.0-alpha.2 → 0.2.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/_virtual/_rolldown/runtime.js +13 -0
- package/lib/components/ActionButton/ActionButton.d.ts +26 -32
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.jsx +139 -120
- package/lib/components/ActionButton/index.d.ts +1 -1
- 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 +22 -27
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +127 -142
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +1 -1
- package/lib/components/BottomSheet/BottomSheet.namespace.js +18 -1
- package/lib/components/BottomSheet/index.d.ts +2 -2
- 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 +14 -30
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.jsx +107 -98
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +1 -1
- package/lib/components/Checkbox/Checkbox.namespace.js +12 -1
- package/lib/components/Checkbox/index.d.ts +2 -2
- 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 +4 -8
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.jsx +255 -260
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.namespace.js +9 -1
- package/lib/components/ProgressCircle/index.d.ts +2 -2
- package/lib/components/RadioGroup/RadioGroup.d.ts +12 -28
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.jsx +134 -118
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +1 -1
- package/lib/components/RadioGroup/RadioGroup.namespace.js +12 -1
- package/lib/components/RadioGroup/index.d.ts +2 -2
- 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 +8 -14
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.jsx +82 -56
- package/lib/components/Switch/Switch.namespace.d.ts +1 -1
- package/lib/components/Switch/Switch.namespace.js +11 -1
- package/lib/components/Switch/index.d.ts +2 -2
- package/lib/components/TagGroup/TagGroup.d.ts +8 -14
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.jsx +42 -39
- package/lib/components/TagGroup/TagGroup.namespace.d.ts +1 -1
- package/lib/components/TagGroup/TagGroup.namespace.js +10 -1
- package/lib/components/TagGroup/index.d.ts +2 -2
- 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 +13 -7
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/index.d.ts +4 -3
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/{use-controllable-state.d.ts → useControllableState.d.ts} +1 -1
- 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/{use-press-tap.d.ts → usePressTap.d.ts} +12 -9
- 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 +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +29 -3
- 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 +13 -12
- package/lib/utils/create-slot-recipe-context.d.ts.map +1 -1
- package/lib/utils/create-slot-recipe-context.jsx +88 -70
- package/lib/utils/get-seed-class-name.d.ts +6 -7
- package/lib/utils/get-seed-class-name.d.ts.map +1 -1
- package/lib/utils/get-seed-class-name.js +26 -37
- package/lib/utils/index.d.ts +4 -4
- package/lib/utils/resolve-recipe-token.js +45 -43
- package/lib/utils/split-multiple-variants-props.js +32 -32
- 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 +9 -9
- package/src/components/ActionButton/ActionButton.test.tsx +167 -0
- package/src/components/ActionButton/ActionButton.tsx +210 -168
- 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.test.tsx +219 -0
- package/src/components/BottomSheet/BottomSheet.tsx +120 -83
- 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.tsx +108 -117
- package/src/components/Icon/Icon.tsx +265 -0
- package/src/components/Icon/index.ts +8 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +39 -25
- package/src/components/RadioGroup/RadioGroup.tsx +100 -118
- package/src/components/Stack/Stack.tsx +97 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Switch/Switch.tsx +61 -52
- package/src/components/TagGroup/TagGroup.tsx +27 -25
- package/src/components/Text/Text.tsx +64 -0
- package/src/components/Text/index.ts +1 -0
- package/src/components/index.ts +6 -0
- package/src/hooks/index.ts +4 -3
- package/src/hooks/{__tests__/use-controllable-state.test.ts → useControllableState.test.ts} +1 -1
- package/src/hooks/useIconColor.test.ts +13 -0
- package/src/hooks/useIconColor.ts +67 -0
- package/src/hooks/{__tests__/use-press-tap.test.ts → usePressTap.test.ts} +1 -1
- package/src/hooks/{use-press-tap.ts → usePressTap.ts} +14 -10
- package/src/hooks/useSafeArea.test.ts +83 -0
- package/src/hooks/useSafeArea.ts +56 -0
- package/src/index.ts +1 -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 +55 -15
- package/src/utils/get-seed-class-name.ts +7 -12
- package/src/utils/{__tests__/split-multiple-variants-props.test.ts → split-multiple-variants-props.test.ts} +1 -1
- package/src/utils/styled.ts +442 -0
- package/lib/components/ActionButton/index.js +0 -1
- package/lib/components/BottomSheet/index.js +0 -2
- package/lib/components/Checkbox/index.js +0 -2
- package/lib/components/ProgressCircle/index.js +0 -2
- package/lib/components/RadioGroup/index.js +0 -2
- package/lib/components/Switch/index.js +0 -2
- package/lib/components/TagGroup/index.js +0 -2
- package/lib/components/index.js +0 -7
- package/lib/hooks/index.js +0 -3
- package/lib/hooks/use-controllable-state.d.ts.map +0 -1
- package/lib/hooks/use-controllable-state.js +0 -27
- package/lib/hooks/use-icon-color.d.ts +0 -15
- package/lib/hooks/use-icon-color.d.ts.map +0 -1
- package/lib/hooks/use-icon-color.js +0 -37
- package/lib/hooks/use-press-tap.d.ts.map +0 -1
- package/lib/hooks/use-press-tap.js +0 -35
- package/lib/utils/index.js +0 -4
- package/src/components/ActionButton/__tests__/ActionButton.test.tsx +0 -35
- package/src/components/BottomSheet/__tests__/BottomSheet.test.tsx +0 -119
- package/src/components/__tests__/ProgressCircle.test.ts +0 -33
- package/src/components/__tests__/exports.test.ts +0 -38
- package/src/components/__tests__/switch.test.ts +0 -34
- package/src/hooks/use-icon-color.ts +0 -51
- package/src/utils/__tests__/create-slot-recipe-context.test.tsx +0 -228
- /package/src/hooks/{use-controllable-state.ts → useControllableState.ts} +0 -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 };
|
|
@@ -1,54 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
}
|
|
10
11
|
/**
|
|
11
12
|
* @platform Lynx
|
|
12
13
|
*
|
|
13
14
|
* 웹 대비 차이:
|
|
14
|
-
* - 아이콘
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
15
|
+
* - 아이콘 렌더링: 웹의 SVG `currentColor` 대신 Lynx `<image>` 의 `tint-color` 를
|
|
16
|
+
* `Icon` / `PrefixIcon` / `SuffixIcon` wrapper 가 동기화한다.
|
|
17
|
+
* - 호환 API: 기존 `prefixIcon` / `suffixIcon` / `icon` prop 도 유지한다.
|
|
17
18
|
* - 미지원 prop: `color`, `fontWeight`, `bleedX`, `bleedY` (CSS variable 동적 주입 제한)
|
|
18
19
|
*
|
|
19
20
|
* ```tsx
|
|
20
21
|
* import IconPlusFill from "@karrotmarket/lynx-monochrome-icon/IconPlusFill";
|
|
21
22
|
* import IconChevronDownFill from "@karrotmarket/lynx-monochrome-icon/IconChevronDownFill";
|
|
23
|
+
* import { Icon, PrefixIcon, SuffixIcon } from "@seed-design/lynx-react";
|
|
22
24
|
*
|
|
23
25
|
* // withText (기본)
|
|
24
|
-
* <ActionButton
|
|
25
|
-
*
|
|
26
|
-
* prefixIcon={<IconPlusFill />}
|
|
27
|
-
* suffixIcon={<IconChevronDownFill />}
|
|
28
|
-
* >
|
|
26
|
+
* <ActionButton variant="brandSolid">
|
|
27
|
+
* <PrefixIcon icon={<IconPlusFill />} />
|
|
29
28
|
* 라벨
|
|
29
|
+
* <SuffixIcon icon={<IconChevronDownFill />} />
|
|
30
30
|
* </ActionButton>
|
|
31
31
|
*
|
|
32
|
-
* // iconOnly —
|
|
32
|
+
* // iconOnly — `<Icon />` child 와 `accessibility-label` 필수
|
|
33
33
|
* <ActionButton
|
|
34
34
|
* layout="iconOnly"
|
|
35
35
|
* variant="neutralSolid"
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* />
|
|
36
|
+
* accessibility-label="추가"
|
|
37
|
+
* >
|
|
38
|
+
* <Icon icon={<IconPlusFill />} />
|
|
39
|
+
* </ActionButton>
|
|
39
40
|
* ```
|
|
40
41
|
*/
|
|
41
|
-
export interface ActionButtonProps extends Omit<ActionButtonVariantProps, "
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
layout?: "withText" | "iconOnly";
|
|
46
|
-
icon?: ReactElement<IconElementProps>;
|
|
47
|
-
prefixIcon?: ReactElement<IconElementProps>;
|
|
48
|
-
suffixIcon?: ReactElement<IconElementProps>;
|
|
49
|
-
"aria-label"?: string;
|
|
50
|
-
bindtap?: () => void;
|
|
51
|
-
"main-thread:bindtap"?: () => void;
|
|
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"];
|
|
52
46
|
}
|
|
53
47
|
export declare const ActionButton: React.ForwardRefExoticComponent<ActionButtonProps & React.RefAttributes<unknown>>;
|
|
54
48
|
export {};
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1,139 +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";
|
|
1
8
|
import { actionButton } from "@seed-design/lynx-css/recipes/action-button";
|
|
2
|
-
import {
|
|
9
|
+
import { progressCircleVariantMap } from "@seed-design/lynx-css/recipes/progress-circle";
|
|
10
|
+
import { actionButton as actionButton$1 } from "@seed-design/lynx-css/vars/component";
|
|
3
11
|
import clsx from "clsx";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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}>
|
|
36
64
|
<PropsProvider value={propsForContext}>
|
|
37
|
-
<
|
|
38
|
-
{
|
|
39
|
-
|
|
65
|
+
<IconSlotProvider value={iconSlotContextValue}>
|
|
66
|
+
<view {...ref ? { ref } : {}} {...rest} className={clsx(classNames.root, userClassName)}>
|
|
67
|
+
{children}
|
|
68
|
+
</view>
|
|
69
|
+
</IconSlotProvider>
|
|
40
70
|
</PropsProvider>
|
|
41
|
-
</ClassNamesProvider
|
|
71
|
+
</ClassNamesProvider>;
|
|
42
72
|
});
|
|
43
73
|
ActionButtonRoot.displayName = "ActionButtonRoot";
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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)}>
|
|
48
78
|
{children}
|
|
49
|
-
</text
|
|
79
|
+
</text>;
|
|
50
80
|
});
|
|
51
81
|
ActionButtonTextSlot.displayName = "ActionButtonTextSlot";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
className: clsx(classNames[slot], childProps.className),
|
|
86
|
-
style: sizeVar != null ? { width: sizeVar, height: sizeVar, ...childProps.style } : childProps.style,
|
|
87
|
-
ref: ref,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function ActionButtonContent({ children, isIconOnly, icon, prefixIcon, suffixIcon, }) {
|
|
91
|
-
if (isIconOnly) {
|
|
92
|
-
return icon != null && isValidElement(icon) ? (<ActionButtonIconSlot icon={icon} slot="icon"/>) : null;
|
|
93
|
-
}
|
|
94
|
-
return (<>
|
|
95
|
-
{prefixIcon != null && isValidElement(prefixIcon) ? (<ActionButtonIconSlot icon={prefixIcon} slot="prefixIcon"/>) : null}
|
|
96
|
-
<ActionButtonTextSlot>{children}</ActionButtonTextSlot>
|
|
97
|
-
{suffixIcon != null && isValidElement(suffixIcon) ? (<ActionButtonIconSlot icon={suffixIcon} slot="suffixIcon"/>) : null}
|
|
98
|
-
</>);
|
|
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
|
+
</>;
|
|
99
115
|
}
|
|
100
116
|
function ActionButtonLoadingContent(props) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<ActionButtonContent {...props}/>
|
|
104
|
-
</view
|
|
117
|
+
const classNames = useClassNames();
|
|
118
|
+
return <view className={classNames.content}>
|
|
119
|
+
<ActionButtonContent {...props} />
|
|
120
|
+
</view>;
|
|
105
121
|
}
|
|
106
122
|
function ActionButtonLoadingIndicator({ size }) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
const classNames = useClassNames();
|
|
124
|
+
const progressCircleSize = resolveProgressCircleSize(size);
|
|
125
|
+
return <view className={classNames.loadingIndicator}>
|
|
126
|
+
<ProgressCircleRoot size={progressCircleSize} tone="inherit">
|
|
110
127
|
<ProgressCircleRange />
|
|
111
128
|
</ProgressCircleRoot>
|
|
112
|
-
</view
|
|
129
|
+
</view>;
|
|
113
130
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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}>
|
|
132
151
|
{children}
|
|
133
|
-
</
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
</ActionButtonContent>)}
|
|
137
|
-
</ActionButtonRoot>);
|
|
152
|
+
</ActionButtonContent>}
|
|
153
|
+
</ActionButtonRoot>
|
|
154
|
+
</IconRequired>;
|
|
138
155
|
});
|
|
139
156
|
ActionButton.displayName = "ActionButton";
|
|
157
|
+
//#endregion
|
|
158
|
+
export { ActionButton };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ActionButton, type ActionButtonProps } from
|
|
1
|
+
export { ActionButton, type ActionButtonProps } from './ActionButton';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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
|