@hopper-ui/components 0.0.11 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/HopperProvider/src/HopperProvider.d.ts +26 -0
- package/dist/HopperProvider/src/HopperProvider.js +1 -0
- package/dist/HopperProvider/src/index.d.ts +3 -0
- package/dist/HopperProvider/src/index.js +1 -0
- package/dist/IconList/src/IconList.css +8 -0
- package/dist/IconList/src/IconList.d.ts +21 -0
- package/dist/IconList/src/IconList.js +3 -0
- package/dist/IconList/src/IconListContext.d.ts +10 -0
- package/dist/IconList/src/IconListContext.js +1 -0
- package/dist/IconList/src/index.css +8 -0
- package/dist/IconList/src/index.d.ts +7 -0
- package/dist/IconList/src/index.js +3 -0
- package/dist/Label/src/Label.css +79 -0
- package/dist/Label/src/Label.d.ts +21 -0
- package/dist/Label/src/Label.js +3 -0
- package/dist/Label/src/LabelContext.d.ts +8 -0
- package/dist/Label/src/LabelContext.js +1 -0
- package/dist/Label/src/index.css +79 -0
- package/dist/Label/src/index.d.ts +5 -0
- package/dist/Label/src/index.js +3 -0
- package/dist/Spinner/src/Spinner.css +148 -0
- package/dist/Spinner/src/Spinner.d.ts +21 -0
- package/dist/Spinner/src/Spinner.js +6 -0
- package/dist/Spinner/src/SpinnerContext.d.ts +10 -0
- package/dist/Spinner/src/SpinnerContext.js +1 -0
- package/dist/Spinner/src/index.css +148 -0
- package/dist/Spinner/src/index.d.ts +7 -0
- package/dist/Spinner/src/index.js +6 -0
- package/dist/Text/src/Text.css +79 -0
- package/dist/Text/src/Text.d.ts +21 -0
- package/dist/Text/src/Text.js +3 -0
- package/dist/Text/src/TextContext.d.ts +8 -0
- package/dist/Text/src/TextContext.js +1 -0
- package/dist/Text/src/index.css +79 -0
- package/dist/Text/src/index.d.ts +5 -0
- package/dist/Text/src/index.js +3 -0
- package/dist/buttons/src/Button.css +468 -0
- package/dist/buttons/src/Button.d.ts +35 -0
- package/dist/buttons/src/Button.js +14 -0
- package/dist/buttons/src/ButtonContext.d.ts +8 -0
- package/dist/buttons/src/ButtonContext.js +1 -0
- package/dist/buttons/src/index.css +468 -0
- package/dist/buttons/src/index.d.ts +5 -0
- package/dist/buttons/src/index.js +14 -0
- package/dist/chunk-4ZYV2XLW.js +7 -0
- package/dist/chunk-65JPI4FL.js +14 -0
- package/dist/chunk-A2IN7HC4.js +53 -0
- package/dist/chunk-CMJUZLSA.js +46 -0
- package/dist/chunk-DHVVYSLB.js +7 -0
- package/dist/chunk-GXUPEV64.js +24 -0
- package/dist/chunk-HVKOIMMW.js +7 -0
- package/dist/chunk-JGYEQS4H.js +90 -0
- package/dist/chunk-KVDXQMWI.js +15 -0
- package/dist/chunk-LQICWONC.js +1 -0
- package/dist/chunk-M36KANKC.js +7 -0
- package/dist/chunk-OE5BLFZI.js +7 -0
- package/dist/chunk-SNIF7MEM.js +1 -0
- package/dist/chunk-TNWWLZEQ.js +47 -0
- package/dist/chunk-TVFC2MJ4.js +58 -0
- package/dist/chunk-WMTWFKKP.js +7 -0
- package/dist/chunk-YLDA2M2E.js +33 -0
- package/dist/chunk-Z34Z6LYX.js +141 -0
- package/dist/chunk-ZWU6DRRZ.js +15 -0
- package/dist/intl/src/index.d.ts +1 -0
- package/dist/intl/src/index.js +1 -0
- package/dist/intl/src/useLocalizedString.d.ts +26 -0
- package/dist/intl/src/useLocalizedString.js +1 -0
- package/dist/layout/src/Flex.d.ts +37 -0
- package/dist/layout/src/Flex.js +1 -0
- package/dist/layout/src/Grid.d.ts +77 -0
- package/dist/layout/src/Grid.js +55 -0
- package/dist/layout/src/Inline.d.ts +26 -0
- package/dist/layout/src/Inline.js +30 -0
- package/dist/layout/src/Stack.d.ts +26 -0
- package/dist/layout/src/Stack.js +28 -0
- package/dist/utils/src/SlotProvider.d.ts +14 -0
- package/dist/utils/src/SlotProvider.js +1 -0
- package/dist/utils/src/composeClassnameRenderProps.d.ts +9 -0
- package/dist/utils/src/composeClassnameRenderProps.js +1 -0
- package/dist/utils/src/cssModule.d.ts +15 -0
- package/dist/utils/src/cssModule.js +1 -0
- package/dist/utils/src/index.d.ts +11 -0
- package/dist/utils/src/index.js +6 -0
- package/dist/utils/src/isTextOnlyChildren.d.ts +9 -0
- package/dist/utils/src/isTextOnlyChildren.js +1 -0
- package/dist/utils/src/sizeAdapter.d.ts +20 -0
- package/dist/utils/src/sizeAdapter.js +1 -0
- package/dist/utils/src/types.d.ts +31 -0
- package/dist/utils/src/types.js +1 -0
- package/package.json +13 -4
- package/dist/HopperProvider.d.ts +0 -13
- package/dist/HopperProvider.js +0 -1
- package/dist/chunk-LBJUDVVS.js +0 -9
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
|
|
2
|
+
import { SpinnerContext } from './chunk-4ZYV2XLW.js';
|
|
3
|
+
import { _Label } from './chunk-CMJUZLSA.js';
|
|
4
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
5
|
+
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
|
+
import { useContextProps, ProgressBar } from 'react-aria-components';
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
// src/Spinner/src/Spinner.module.css
|
|
11
|
+
var Spinner_default = {};
|
|
12
|
+
var GlobalSpinnerCssSelector = "hop-Spinner";
|
|
13
|
+
var SpinnerToLabelSizeAdapter = {
|
|
14
|
+
sm: "xs",
|
|
15
|
+
md: "sm",
|
|
16
|
+
lg: "md"
|
|
17
|
+
};
|
|
18
|
+
var Spinner = (props, ref) => {
|
|
19
|
+
var _a;
|
|
20
|
+
[props, ref] = useContextProps(props, ref, SpinnerContext);
|
|
21
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
22
|
+
const {
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
size: sizeProp,
|
|
26
|
+
children,
|
|
27
|
+
...otherProps
|
|
28
|
+
} = ownProps;
|
|
29
|
+
const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
|
|
30
|
+
const classNames = composeClassnameRenderProps(
|
|
31
|
+
className,
|
|
32
|
+
GlobalSpinnerCssSelector,
|
|
33
|
+
cssModule(
|
|
34
|
+
Spinner_default,
|
|
35
|
+
"hop-Spinner",
|
|
36
|
+
size
|
|
37
|
+
),
|
|
38
|
+
stylingProps.className
|
|
39
|
+
);
|
|
40
|
+
const mergedStyles = {
|
|
41
|
+
...stylingProps.style,
|
|
42
|
+
...style
|
|
43
|
+
};
|
|
44
|
+
const labelMarkup = children && /* @__PURE__ */ jsx(
|
|
45
|
+
_Label,
|
|
46
|
+
{
|
|
47
|
+
className: cssModule(
|
|
48
|
+
Spinner_default,
|
|
49
|
+
"hop-Spinner__label"
|
|
50
|
+
),
|
|
51
|
+
size: SpinnerToLabelSizeAdapter[size],
|
|
52
|
+
children
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
return /* @__PURE__ */ jsxs(
|
|
56
|
+
ProgressBar,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
isIndeterminate: true,
|
|
60
|
+
className: classNames,
|
|
61
|
+
style: mergedStyles,
|
|
62
|
+
...otherProps,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: cssModule(
|
|
68
|
+
Spinner_default,
|
|
69
|
+
"hop-Spinner__track"
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: cssModule(
|
|
77
|
+
Spinner_default,
|
|
78
|
+
"hop-Spinner__fill"
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
labelMarkup
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
var _Spinner = forwardRef(Spinner);
|
|
88
|
+
_Spinner.displayName = "Spinner";
|
|
89
|
+
|
|
90
|
+
export { GlobalSpinnerCssSelector, _Spinner };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
|
|
3
|
+
// src/utils/src/cssModule.ts
|
|
4
|
+
function cssModule(cssModules, componentName, ...modifiers) {
|
|
5
|
+
const classes = clsx(modifiers).split(" ").filter((x) => x && x !== "");
|
|
6
|
+
return classes.reduce((acc, className) => {
|
|
7
|
+
const mergedClassName = `${componentName}--${className}`;
|
|
8
|
+
if (cssModules[mergedClassName]) {
|
|
9
|
+
acc.push(cssModules[mergedClassName]);
|
|
10
|
+
}
|
|
11
|
+
return acc;
|
|
12
|
+
}, [cssModules[componentName]]).join(" ");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { cssModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TextContext } from './chunk-OE5BLFZI.js';
|
|
2
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
3
|
+
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { useContextProps, Text as Text$1 } from 'react-aria-components';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
// src/Text/src/Text.module.css
|
|
10
|
+
var Text_default = {};
|
|
11
|
+
var GlobalTextCssSelector = "hop-Text";
|
|
12
|
+
var DefaultTextSlot = "text";
|
|
13
|
+
function Text(props, ref) {
|
|
14
|
+
[props, ref] = useContextProps({ ...props, slot: props.slot || DefaultTextSlot }, ref, TextContext);
|
|
15
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
16
|
+
const { className, size: sizeProp, children, style, ...otherProps } = ownProps;
|
|
17
|
+
const size = useResponsiveValue(sizeProp != null ? sizeProp : "md");
|
|
18
|
+
const classNames = clsx(
|
|
19
|
+
GlobalTextCssSelector,
|
|
20
|
+
cssModule(
|
|
21
|
+
Text_default,
|
|
22
|
+
"hop-Text",
|
|
23
|
+
size
|
|
24
|
+
),
|
|
25
|
+
stylingProps.className,
|
|
26
|
+
className
|
|
27
|
+
);
|
|
28
|
+
const mergedStyles = {
|
|
29
|
+
...stylingProps.style,
|
|
30
|
+
...style
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
Text$1,
|
|
34
|
+
{
|
|
35
|
+
...otherProps,
|
|
36
|
+
ref,
|
|
37
|
+
elementType: "span",
|
|
38
|
+
className: classNames,
|
|
39
|
+
style: mergedStyles,
|
|
40
|
+
children
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
var _Text = forwardRef(Text);
|
|
45
|
+
_Text.displayName = "Text";
|
|
46
|
+
|
|
47
|
+
export { GlobalTextCssSelector, _Text };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useResponsiveValue, Div } from '@hopper-ui/styled-system';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/layout/src/Flex.tsx
|
|
6
|
+
function Flex(props, ref) {
|
|
7
|
+
const {
|
|
8
|
+
direction,
|
|
9
|
+
inline,
|
|
10
|
+
basis,
|
|
11
|
+
grow,
|
|
12
|
+
shrink,
|
|
13
|
+
wrap: wrapProp,
|
|
14
|
+
alignItems: alignItemsProp,
|
|
15
|
+
justifyContent: justifyContentProp,
|
|
16
|
+
alignContent: alignContentProp,
|
|
17
|
+
...otherProps
|
|
18
|
+
} = props;
|
|
19
|
+
const wrap = useResponsiveValue(wrapProp);
|
|
20
|
+
const alignItems = useResponsiveValue(alignItemsProp);
|
|
21
|
+
const justifyContent = useResponsiveValue(justifyContentProp);
|
|
22
|
+
const alignContent = useResponsiveValue(alignContentProp);
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
Div,
|
|
25
|
+
{
|
|
26
|
+
ref,
|
|
27
|
+
display: inline ? "inline-flex" : "flex",
|
|
28
|
+
flexDirection: direction,
|
|
29
|
+
flexBasis: basis,
|
|
30
|
+
flexGrow: grow,
|
|
31
|
+
flexShrink: shrink,
|
|
32
|
+
flexWrap: flexWrapValue(wrap),
|
|
33
|
+
alignItems: flexAlignValue(alignItems),
|
|
34
|
+
justifyContent: flexAlignValue(justifyContent),
|
|
35
|
+
alignContent: flexAlignValue(alignContent),
|
|
36
|
+
...otherProps
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function flexAlignValue(value) {
|
|
41
|
+
if (value === "start") {
|
|
42
|
+
return "flex-start";
|
|
43
|
+
}
|
|
44
|
+
if (value === "end") {
|
|
45
|
+
return "flex-end";
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
function flexWrapValue(value) {
|
|
50
|
+
if (typeof value === "boolean") {
|
|
51
|
+
return value ? "wrap" : "nowrap";
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
var _Flex = forwardRef(Flex);
|
|
56
|
+
_Flex.displayName = "Flex";
|
|
57
|
+
|
|
58
|
+
export { _Flex };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StyledSystemProvider } from '@hopper-ui/styled-system';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { I18nProvider, RouterProvider } from 'react-aria-components';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/HopperProvider/src/HopperProvider.tsx
|
|
8
|
+
var GlobalHopperProviderCssSelector = "hop-HopperProvider";
|
|
9
|
+
var HopperProvider = (props, ref) => {
|
|
10
|
+
const {
|
|
11
|
+
children,
|
|
12
|
+
locale,
|
|
13
|
+
withBodyStyle = false,
|
|
14
|
+
colorScheme = "light",
|
|
15
|
+
withCssVariables = true,
|
|
16
|
+
className,
|
|
17
|
+
navigate,
|
|
18
|
+
...rest
|
|
19
|
+
} = props;
|
|
20
|
+
const classNames = clsx(
|
|
21
|
+
GlobalHopperProviderCssSelector,
|
|
22
|
+
className
|
|
23
|
+
);
|
|
24
|
+
let content = children;
|
|
25
|
+
if (navigate) {
|
|
26
|
+
content = /* @__PURE__ */ jsx(RouterProvider, { navigate, children });
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(StyledSystemProvider, { ref, withBodyStyle, colorScheme, withCssVariables, className: classNames, ...rest, children: /* @__PURE__ */ jsx(I18nProvider, { locale, children: content }) });
|
|
29
|
+
};
|
|
30
|
+
var _HopperProvider = forwardRef(HopperProvider);
|
|
31
|
+
_HopperProvider.displayName = "HopperProvider";
|
|
32
|
+
|
|
33
|
+
export { GlobalHopperProviderCssSelector, _HopperProvider };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { isTextOnlyChildren } from './chunk-ZWU6DRRZ.js';
|
|
2
|
+
import { useLocalizedString } from './chunk-GXUPEV64.js';
|
|
3
|
+
import { _Spinner } from './chunk-JGYEQS4H.js';
|
|
4
|
+
import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
|
|
5
|
+
import { _Text } from './chunk-TNWWLZEQ.js';
|
|
6
|
+
import { TextContext } from './chunk-OE5BLFZI.js';
|
|
7
|
+
import { ButtonContext } from './chunk-WMTWFKKP.js';
|
|
8
|
+
import { SlotProvider } from './chunk-M36KANKC.js';
|
|
9
|
+
import { IconListContext } from './chunk-DHVVYSLB.js';
|
|
10
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
11
|
+
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
12
|
+
import { forwardRef } from 'react';
|
|
13
|
+
import { useContextProps, composeRenderProps, Button as Button$1 } from 'react-aria-components';
|
|
14
|
+
import { useId } from 'react-aria';
|
|
15
|
+
import { IconContext } from '@hopper-ui/icons';
|
|
16
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
17
|
+
|
|
18
|
+
// src/buttons/src/Button.module.css
|
|
19
|
+
var Button_default = {};
|
|
20
|
+
var GlobalButtonCssSelector = "hop-Button";
|
|
21
|
+
var DefaultButtonSlot = "button";
|
|
22
|
+
var Button = (props, ref) => {
|
|
23
|
+
[props, ref] = useContextProps({ ...props, slot: props.slot || DefaultButtonSlot }, ref, ButtonContext);
|
|
24
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
25
|
+
const stringFormatter = useLocalizedString();
|
|
26
|
+
const {
|
|
27
|
+
className,
|
|
28
|
+
children: childrenProp,
|
|
29
|
+
size: sizeProp = "md",
|
|
30
|
+
fluid: fluidProp,
|
|
31
|
+
variant = "primary",
|
|
32
|
+
onClick,
|
|
33
|
+
onPress: onPressProp,
|
|
34
|
+
isDisabled,
|
|
35
|
+
isLoading,
|
|
36
|
+
style: styleProp,
|
|
37
|
+
...otherProps
|
|
38
|
+
} = ownProps;
|
|
39
|
+
if (onPressProp && onClick) {
|
|
40
|
+
console.warn("[Hopper] The onClick prop is an alias for onPress and should not be used in conjunction with it. Use one or the other.");
|
|
41
|
+
}
|
|
42
|
+
const onPress = onPressProp != null ? onPressProp : onClick;
|
|
43
|
+
const isInteractionDisabled = isDisabled || isLoading;
|
|
44
|
+
const size = useResponsiveValue(sizeProp);
|
|
45
|
+
const fluid = useResponsiveValue(fluidProp);
|
|
46
|
+
const classNames = composeClassnameRenderProps(
|
|
47
|
+
className,
|
|
48
|
+
GlobalButtonCssSelector,
|
|
49
|
+
cssModule(
|
|
50
|
+
Button_default,
|
|
51
|
+
"hop-Button",
|
|
52
|
+
variant,
|
|
53
|
+
size,
|
|
54
|
+
fluid && "fluid",
|
|
55
|
+
isLoading && "loading"
|
|
56
|
+
),
|
|
57
|
+
stylingProps.className
|
|
58
|
+
);
|
|
59
|
+
const children = composeRenderProps(childrenProp, (prev) => {
|
|
60
|
+
if (isTextOnlyChildren(prev)) {
|
|
61
|
+
return /* @__PURE__ */ jsx(_Text, { children: prev });
|
|
62
|
+
}
|
|
63
|
+
return prev;
|
|
64
|
+
});
|
|
65
|
+
const style = composeRenderProps(styleProp, (prev) => {
|
|
66
|
+
return {
|
|
67
|
+
...stylingProps.style,
|
|
68
|
+
...prev
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
const spinnerId = useId();
|
|
72
|
+
const hasAriaLabel = !!props["aria-label"] || !!props["aria-labelledby"];
|
|
73
|
+
const isLoadingAriaLiveLabel = `${hasAriaLabel ? props["aria-label"] : ""} ${stringFormatter.format("button.pending")}`.trim();
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
SlotProvider,
|
|
76
|
+
{
|
|
77
|
+
values: [
|
|
78
|
+
[IconListContext, {
|
|
79
|
+
slots: {
|
|
80
|
+
icon: {
|
|
81
|
+
className: Button_default["hop-Button__icon-list"]
|
|
82
|
+
},
|
|
83
|
+
"end-icon": {
|
|
84
|
+
className: Button_default["hop-Button__end-icon-list"]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}],
|
|
88
|
+
[IconContext, {
|
|
89
|
+
slots: {
|
|
90
|
+
icon: {
|
|
91
|
+
className: Button_default["hop-Button__icon"],
|
|
92
|
+
size: "md"
|
|
93
|
+
},
|
|
94
|
+
"end-icon": {
|
|
95
|
+
className: Button_default["hop-Button__end-icon"],
|
|
96
|
+
size: "md"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}],
|
|
100
|
+
[TextContext, {
|
|
101
|
+
slots: {
|
|
102
|
+
text: {
|
|
103
|
+
className: Button_default["hop-Button__text"],
|
|
104
|
+
size
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}]
|
|
108
|
+
],
|
|
109
|
+
children: /* @__PURE__ */ jsx(
|
|
110
|
+
Button$1,
|
|
111
|
+
{
|
|
112
|
+
ref,
|
|
113
|
+
className: classNames,
|
|
114
|
+
style,
|
|
115
|
+
"data-loading": isLoading,
|
|
116
|
+
onPress,
|
|
117
|
+
isDisabled: isInteractionDisabled,
|
|
118
|
+
...otherProps,
|
|
119
|
+
children: (buttonProps) => {
|
|
120
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
121
|
+
children(buttonProps),
|
|
122
|
+
isLoading && /* @__PURE__ */ jsx(
|
|
123
|
+
_Spinner,
|
|
124
|
+
{
|
|
125
|
+
id: spinnerId,
|
|
126
|
+
size: "lg",
|
|
127
|
+
"aria-label": isLoadingAriaLiveLabel,
|
|
128
|
+
className: Button_default["hop-Button__Spinner"]
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
] });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
var _Button = forwardRef(Button);
|
|
139
|
+
_Button.displayName = "Button";
|
|
140
|
+
|
|
141
|
+
export { GlobalButtonCssSelector, _Button };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Children, isValidElement, Fragment } from 'react';
|
|
2
|
+
|
|
3
|
+
// src/utils/src/isTextOnlyChildren.ts
|
|
4
|
+
function isTextOnlyChildren(children) {
|
|
5
|
+
const resolvedChildren = resolveChildren(children);
|
|
6
|
+
return typeof resolvedChildren === "string" || Children.toArray(resolvedChildren).every((c) => !isValidElement(c));
|
|
7
|
+
}
|
|
8
|
+
function resolveChildren(children) {
|
|
9
|
+
if (isValidElement(children) && children.type === Fragment) {
|
|
10
|
+
return resolveChildren(children.props.children);
|
|
11
|
+
}
|
|
12
|
+
return children;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { isTextOnlyChildren };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLocalizedString } from './useLocalizedString.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLocalizedString } from '../../chunk-GXUPEV64.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const Resources: {
|
|
2
|
+
"en-US": {
|
|
3
|
+
"button.pending": string;
|
|
4
|
+
};
|
|
5
|
+
"fr-CA": {
|
|
6
|
+
"button.pending": string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare function useLocalizedString(): LocalizedStringFormatter;
|
|
10
|
+
/**
|
|
11
|
+
* LocalizedStringFormatter is not exported from react-aria, so we have to define it here.
|
|
12
|
+
* Without this, the build will fail with the following error:
|
|
13
|
+
* packages/components build:
|
|
14
|
+
* src/intl/src/useLocalizedString.tsx(11,17): error TS2742:
|
|
15
|
+
* The inferred type of 'useLocalizedString' cannot be named without a reference to
|
|
16
|
+
* .pnpm/@internationalized+string@3.2.1/node_modules/@internationalized/string'.
|
|
17
|
+
* This is likely not portable. A type annotation is necessary.
|
|
18
|
+
*
|
|
19
|
+
* I proposed a PR to export LocalizedStringFormatter from react-aria.
|
|
20
|
+
* https://github.com/adobe/react-spectrum/pull/6014
|
|
21
|
+
*/
|
|
22
|
+
interface LocalizedStringFormatter {
|
|
23
|
+
format: (key: keyof typeof Resources[keyof typeof Resources], variables?: Record<string, string | number | boolean>) => string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { useLocalizedString };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLocalizedString } from '../../chunk-GXUPEV64.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { DivProps, ResponsiveProp } from '@hopper-ui/styled-system';
|
|
3
|
+
|
|
4
|
+
interface FlexProps extends Omit<DivProps, "display" | "flexDirection" | "flexWrap" | "flexBasis" | "flexGrow" | "flexShrink"> {
|
|
5
|
+
/**
|
|
6
|
+
* The flex direction of the container. Can be row, column, row-reverse or column-reverse.
|
|
7
|
+
*/
|
|
8
|
+
direction?: DivProps["flexDirection"];
|
|
9
|
+
/**
|
|
10
|
+
* Whether to wrap the flex items. The value can also be a boolean.
|
|
11
|
+
*/
|
|
12
|
+
wrap?: DivProps["flexWrap"] | ResponsiveProp<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* An alias for the css flex-basis property.
|
|
15
|
+
*/
|
|
16
|
+
basis?: DivProps["flexBasis"];
|
|
17
|
+
/**
|
|
18
|
+
* An alias for the css flex-grow property.
|
|
19
|
+
*/
|
|
20
|
+
grow?: DivProps["flexGrow"];
|
|
21
|
+
/**
|
|
22
|
+
* An alias for the css flex-shrink property.
|
|
23
|
+
*/
|
|
24
|
+
shrink?: DivProps["flexShrink"];
|
|
25
|
+
/**
|
|
26
|
+
* Whether to display the flex container as an inline element.
|
|
27
|
+
*/
|
|
28
|
+
inline?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The Flex component is used to create a flex container and provides some shortcuts for the flex properties.
|
|
32
|
+
*
|
|
33
|
+
* [View Documentation](TODO)
|
|
34
|
+
*/
|
|
35
|
+
declare const _Flex: react.ForwardRefExoticComponent<Omit<FlexProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
|
|
37
|
+
export { _Flex as Flex, type FlexProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { _Flex as Flex } from '../../chunk-TVFC2MJ4.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { DivProps, UNSAFE_SizingValue, CssGrid } from '@hopper-ui/styled-system';
|
|
3
|
+
|
|
4
|
+
interface GridProps extends Omit<DivProps, "display" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "gridAutoColumns" | "gridAutoFlow" | "UNSAFE_gridAutoRows" | "UNSAFE_gridTemplateColumns" | "UNSAFE_gridTemplateRows" | "UNSAFE_gridAutoColumns"> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether or not the element generate line breaks before or after himself.
|
|
7
|
+
*/
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* An alias for the css grid-auto-rows property.
|
|
11
|
+
*/
|
|
12
|
+
autoRows?: DivProps["gridAutoRows"];
|
|
13
|
+
/**
|
|
14
|
+
* An alias for the css grid-template-areas property.
|
|
15
|
+
*/
|
|
16
|
+
areas?: DivProps["gridTemplateAreas"];
|
|
17
|
+
/**
|
|
18
|
+
* An alias for the css grid-template-columns property.
|
|
19
|
+
*/
|
|
20
|
+
templateColumns?: DivProps["gridTemplateColumns"];
|
|
21
|
+
/**
|
|
22
|
+
* An alias for the css grid-template-rows property.
|
|
23
|
+
*/
|
|
24
|
+
templateRows?: DivProps["gridTemplateRows"];
|
|
25
|
+
/**
|
|
26
|
+
* An alias for the css grid-auto-columns property.
|
|
27
|
+
*/
|
|
28
|
+
autoColumns?: DivProps["gridAutoColumns"];
|
|
29
|
+
/**
|
|
30
|
+
* An alias for the css grid-auto-flow property.
|
|
31
|
+
*/
|
|
32
|
+
autoFlow?: DivProps["gridAutoFlow"];
|
|
33
|
+
/**
|
|
34
|
+
* An alias for the css grid-auto-rows property.
|
|
35
|
+
*/
|
|
36
|
+
UNSAFE_autoRows?: DivProps["UNSAFE_gridAutoRows"];
|
|
37
|
+
/**
|
|
38
|
+
* An alias for the css grid-template-columns property.
|
|
39
|
+
*/
|
|
40
|
+
UNSAFE_templateColumns?: DivProps["UNSAFE_gridTemplateColumns"];
|
|
41
|
+
/**
|
|
42
|
+
* An alias for the css grid-template-rows property.
|
|
43
|
+
*/
|
|
44
|
+
UNSAFE_templateRows?: DivProps["UNSAFE_gridTemplateRows"];
|
|
45
|
+
/**
|
|
46
|
+
* An alias for the css grid-auto-columns property.
|
|
47
|
+
*/
|
|
48
|
+
UNSAFE_autoColumns?: DivProps["UNSAFE_gridAutoColumns"];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Can be used to make a repeating fragment of the columns or rows list.
|
|
52
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/repeat).
|
|
53
|
+
* @param count - The number of times to repeat the fragment.
|
|
54
|
+
* @param repeat - The fragment to repeat.
|
|
55
|
+
*/
|
|
56
|
+
declare function repeat(count: number | "auto-fill" | "auto-fit", repetition: UNSAFE_SizingValue | UNSAFE_SizingValue[]): CssGrid;
|
|
57
|
+
/**
|
|
58
|
+
* Defines a size range greater than or equal to min and less than or equal to max.
|
|
59
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/minmax).
|
|
60
|
+
* @param min - The minimum size.
|
|
61
|
+
* @param max - The maximum size.
|
|
62
|
+
*/
|
|
63
|
+
declare function minmax(min: UNSAFE_SizingValue, max: UNSAFE_SizingValue): CssGrid;
|
|
64
|
+
/**
|
|
65
|
+
* Clamps a given size to an available size.
|
|
66
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content).
|
|
67
|
+
* @param dimension - The size to clamp.
|
|
68
|
+
*/
|
|
69
|
+
declare function fitContent(dimension: UNSAFE_SizingValue): CssGrid;
|
|
70
|
+
/**
|
|
71
|
+
* The Grid component is used to create a grid container and provides some shortcuts for the grid properties.
|
|
72
|
+
*
|
|
73
|
+
* [View Documentation](TODO)
|
|
74
|
+
*/
|
|
75
|
+
declare const _Grid: react.ForwardRefExoticComponent<Omit<GridProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
|
|
77
|
+
export { _Grid as Grid, type GridProps, fitContent, minmax, repeat };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Div, getSizingValue } from '@hopper-ui/styled-system';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/layout/src/Grid.tsx
|
|
6
|
+
function Grid(props, ref) {
|
|
7
|
+
const {
|
|
8
|
+
autoRows,
|
|
9
|
+
areas,
|
|
10
|
+
templateColumns,
|
|
11
|
+
templateRows,
|
|
12
|
+
autoColumns,
|
|
13
|
+
autoFlow,
|
|
14
|
+
inline,
|
|
15
|
+
UNSAFE_autoRows,
|
|
16
|
+
UNSAFE_templateColumns,
|
|
17
|
+
UNSAFE_templateRows,
|
|
18
|
+
UNSAFE_autoColumns,
|
|
19
|
+
...otherProps
|
|
20
|
+
} = props;
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Div,
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
display: inline ? "inline-grid" : "grid",
|
|
26
|
+
gridAutoRows: autoRows,
|
|
27
|
+
gridTemplateAreas: areas,
|
|
28
|
+
gridTemplateColumns: templateColumns,
|
|
29
|
+
gridTemplateRows: templateRows,
|
|
30
|
+
gridAutoColumns: autoColumns,
|
|
31
|
+
gridAutoFlow: autoFlow,
|
|
32
|
+
UNSAFE_gridAutoRows: UNSAFE_autoRows,
|
|
33
|
+
UNSAFE_gridTemplateColumns: UNSAFE_templateColumns,
|
|
34
|
+
UNSAFE_gridTemplateRows: UNSAFE_templateRows,
|
|
35
|
+
UNSAFE_gridAutoColumns: UNSAFE_autoColumns,
|
|
36
|
+
...otherProps
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function repeat(count, repetition) {
|
|
41
|
+
return `repeat(${count}, ${Array.isArray(repetition) ? interpolateGridTemplateArray(repetition) : getSizingValue(repetition)})`;
|
|
42
|
+
}
|
|
43
|
+
function minmax(min, max) {
|
|
44
|
+
return `minmax(${getSizingValue(min)}, ${getSizingValue(max)})`;
|
|
45
|
+
}
|
|
46
|
+
function fitContent(dimension) {
|
|
47
|
+
return `fit-content(${getSizingValue(dimension)})`;
|
|
48
|
+
}
|
|
49
|
+
function interpolateGridTemplateArray(values) {
|
|
50
|
+
return values.map((x) => getSizingValue(x)).join(" ");
|
|
51
|
+
}
|
|
52
|
+
var _Grid = forwardRef(Grid);
|
|
53
|
+
_Grid.displayName = "Inline";
|
|
54
|
+
|
|
55
|
+
export { _Grid as Grid, fitContent, minmax, repeat };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FlexProps } from './Flex.js';
|
|
3
|
+
import '@hopper-ui/styled-system';
|
|
4
|
+
|
|
5
|
+
interface InlineProps extends Omit<FlexProps, "direction" | "alignItems" | "justifyContent"> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether or not to reverse the order of the elements.
|
|
8
|
+
*/
|
|
9
|
+
reverse?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* An alias for the css justify-content property.
|
|
12
|
+
*/
|
|
13
|
+
alignX?: FlexProps["justifyContent"];
|
|
14
|
+
/**
|
|
15
|
+
* An alias for the css align-items property.
|
|
16
|
+
*/
|
|
17
|
+
alignY?: FlexProps["alignItems"];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The Inline pattern is a layout primitive that can be used to stack elements in the horizontal direction and apply a space between them.
|
|
21
|
+
*
|
|
22
|
+
* [View Documentation](TODO)
|
|
23
|
+
*/
|
|
24
|
+
declare const _Inline: react.ForwardRefExoticComponent<Omit<InlineProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
|
|
26
|
+
export { _Inline as Inline, type InlineProps };
|