@hopper-ui/components 0.0.10 → 0.1.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/HopperProvider/src/HopperProvider.d.ts +26 -0
  3. package/dist/HopperProvider/src/HopperProvider.js +1 -0
  4. package/dist/HopperProvider/src/index.d.ts +3 -0
  5. package/dist/HopperProvider/src/index.js +1 -0
  6. package/dist/IconList/src/IconList.css +8 -0
  7. package/dist/IconList/src/IconList.d.ts +21 -0
  8. package/dist/IconList/src/IconList.js +3 -0
  9. package/dist/IconList/src/IconListContext.d.ts +10 -0
  10. package/dist/IconList/src/IconListContext.js +1 -0
  11. package/dist/IconList/src/index.css +8 -0
  12. package/dist/IconList/src/index.d.ts +7 -0
  13. package/dist/IconList/src/index.js +3 -0
  14. package/dist/Label/src/Label.css +79 -0
  15. package/dist/Label/src/Label.d.ts +21 -0
  16. package/dist/Label/src/Label.js +3 -0
  17. package/dist/Label/src/LabelContext.d.ts +8 -0
  18. package/dist/Label/src/LabelContext.js +1 -0
  19. package/dist/Label/src/index.css +79 -0
  20. package/dist/Label/src/index.d.ts +5 -0
  21. package/dist/Label/src/index.js +3 -0
  22. package/dist/Spinner/src/Spinner.css +148 -0
  23. package/dist/Spinner/src/Spinner.d.ts +21 -0
  24. package/dist/Spinner/src/Spinner.js +6 -0
  25. package/dist/Spinner/src/SpinnerContext.d.ts +10 -0
  26. package/dist/Spinner/src/SpinnerContext.js +1 -0
  27. package/dist/Spinner/src/index.css +148 -0
  28. package/dist/Spinner/src/index.d.ts +7 -0
  29. package/dist/Spinner/src/index.js +6 -0
  30. package/dist/Text/src/Text.css +79 -0
  31. package/dist/Text/src/Text.d.ts +21 -0
  32. package/dist/Text/src/Text.js +3 -0
  33. package/dist/Text/src/TextContext.d.ts +8 -0
  34. package/dist/Text/src/TextContext.js +1 -0
  35. package/dist/Text/src/index.css +79 -0
  36. package/dist/Text/src/index.d.ts +5 -0
  37. package/dist/Text/src/index.js +3 -0
  38. package/dist/buttons/src/Button.css +468 -0
  39. package/dist/buttons/src/Button.d.ts +35 -0
  40. package/dist/buttons/src/Button.js +14 -0
  41. package/dist/buttons/src/ButtonContext.d.ts +8 -0
  42. package/dist/buttons/src/ButtonContext.js +1 -0
  43. package/dist/buttons/src/index.css +468 -0
  44. package/dist/buttons/src/index.d.ts +5 -0
  45. package/dist/buttons/src/index.js +14 -0
  46. package/dist/chunk-4ZYV2XLW.js +7 -0
  47. package/dist/chunk-6BEVZRUL.js +15 -0
  48. package/dist/chunk-7QUHQYCR.js +15 -0
  49. package/dist/chunk-D57ZIX5W.js +1 -0
  50. package/dist/chunk-DHVVYSLB.js +7 -0
  51. package/dist/chunk-GXUPEV64.js +24 -0
  52. package/dist/chunk-HVKOIMMW.js +7 -0
  53. package/dist/chunk-M36KANKC.js +7 -0
  54. package/dist/chunk-OE5BLFZI.js +7 -0
  55. package/dist/chunk-QIOYM2XJ.js +90 -0
  56. package/dist/chunk-SEU4CGZD.js +14 -0
  57. package/dist/chunk-SNIF7MEM.js +1 -0
  58. package/dist/chunk-TVFC2MJ4.js +58 -0
  59. package/dist/chunk-WMTWFKKP.js +7 -0
  60. package/dist/chunk-WROQHGG5.js +141 -0
  61. package/dist/chunk-WRWNRVTG.js +47 -0
  62. package/dist/chunk-XCKF6EU7.js +46 -0
  63. package/dist/chunk-XQ3GUEBN.js +53 -0
  64. package/dist/chunk-YLDA2M2E.js +33 -0
  65. package/dist/intl/src/index.d.ts +1 -0
  66. package/dist/intl/src/index.js +1 -0
  67. package/dist/intl/src/useLocalizedString.d.ts +26 -0
  68. package/dist/intl/src/useLocalizedString.js +1 -0
  69. package/dist/layout/src/Flex.d.ts +37 -0
  70. package/dist/layout/src/Flex.js +1 -0
  71. package/dist/layout/src/Grid.d.ts +77 -0
  72. package/dist/layout/src/Grid.js +55 -0
  73. package/dist/layout/src/Inline.d.ts +26 -0
  74. package/dist/layout/src/Inline.js +30 -0
  75. package/dist/layout/src/Stack.d.ts +26 -0
  76. package/dist/layout/src/Stack.js +28 -0
  77. package/dist/utils/src/SlotProvider.d.ts +14 -0
  78. package/dist/utils/src/SlotProvider.js +1 -0
  79. package/dist/utils/src/compose-classname-render-props.d.ts +9 -0
  80. package/dist/utils/src/compose-classname-render-props.js +1 -0
  81. package/dist/utils/src/css-module.d.ts +15 -0
  82. package/dist/utils/src/css-module.js +1 -0
  83. package/dist/utils/src/index.d.ts +11 -0
  84. package/dist/utils/src/index.js +6 -0
  85. package/dist/utils/src/is-text-only-children.d.ts +9 -0
  86. package/dist/utils/src/is-text-only-children.js +1 -0
  87. package/dist/utils/src/size-adapter.d.ts +20 -0
  88. package/dist/utils/src/size-adapter.js +1 -0
  89. package/dist/utils/src/types.d.ts +31 -0
  90. package/dist/utils/src/types.js +1 -0
  91. package/package.json +13 -4
  92. package/dist/HopperProvider.d.ts +0 -13
  93. package/dist/HopperProvider.js +0 -1
  94. package/dist/chunk-LBJUDVVS.js +0 -9
  95. package/dist/index.d.ts +0 -3
  96. package/dist/index.js +0 -1
@@ -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 };
@@ -0,0 +1,30 @@
1
+ import { _Flex } from '../../chunk-TVFC2MJ4.js';
2
+ import { forwardRef } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ function Inline(props, ref) {
6
+ const {
7
+ alignX,
8
+ alignY = "center",
9
+ gap = "inline-md",
10
+ wrap = true,
11
+ reverse,
12
+ ...rest
13
+ } = props;
14
+ return /* @__PURE__ */ jsx(
15
+ _Flex,
16
+ {
17
+ ref,
18
+ alignItems: alignY,
19
+ justifyContent: alignX,
20
+ direction: reverse ? "row-reverse" : "row",
21
+ gap,
22
+ wrap,
23
+ ...rest
24
+ }
25
+ );
26
+ }
27
+ var _Inline = forwardRef(Inline);
28
+ _Inline.displayName = "Inline";
29
+
30
+ export { _Inline as Inline };
@@ -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 StackProps 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 align-items property.
12
+ */
13
+ alignX?: FlexProps["alignItems"];
14
+ /**
15
+ * An alias for the css justify-content property.
16
+ */
17
+ alignY?: FlexProps["justifyContent"];
18
+ }
19
+ /**
20
+ * The Stack pattern is a layout primitive that can be used to stack elements in the vertical direction and apply a space between them.
21
+ *
22
+ * [View Documentation](TODO)
23
+ */
24
+ declare const _Stack: react.ForwardRefExoticComponent<Omit<StackProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
25
+
26
+ export { _Stack as Stack, type StackProps };
@@ -0,0 +1,28 @@
1
+ import { _Flex } from '../../chunk-TVFC2MJ4.js';
2
+ import { forwardRef } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ function Stack(props, ref) {
6
+ const {
7
+ reverse,
8
+ alignX,
9
+ alignY,
10
+ gap = "stack-md",
11
+ ...rest
12
+ } = props;
13
+ return /* @__PURE__ */ jsx(
14
+ _Flex,
15
+ {
16
+ ref,
17
+ alignItems: alignX,
18
+ justifyContent: alignY,
19
+ direction: reverse ? "column-reverse" : "column",
20
+ gap,
21
+ ...rest
22
+ }
23
+ );
24
+ }
25
+ var _Stack = forwardRef(Stack);
26
+ _Stack.displayName = "Stack";
27
+
28
+ export { _Stack as Stack };
@@ -0,0 +1,14 @@
1
+ import { ComponentProps } from 'react';
2
+ import { Provider } from 'react-aria-components';
3
+
4
+ /**
5
+ * In complex components, you may need to provide many contexts. The SlotProvider component is a utility that makes it
6
+ * easier to provide multiple React contexts without manually nesting them.
7
+ * This can be achieved by passing pairs of contexts and values as an array to the values prop.
8
+ *
9
+ * [View Documentation](TODO)
10
+ */
11
+ declare const SlotProvider: typeof Provider;
12
+ type SlotProviderProps = ComponentProps<typeof SlotProvider>;
13
+
14
+ export { SlotProvider, type SlotProviderProps };
@@ -0,0 +1 @@
1
+ export { SlotProvider } from '../../chunk-M36KANKC.js';
@@ -0,0 +1,9 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ /**
4
+ * Composes classnames for render props in React components using cslx.
5
+ * Allows combining a base classname, render prop function, and additional classes.
6
+ */
7
+ declare function composeClassnameRenderProps<T>(className: string | undefined | ((renderProps: T) => string), ...classes: ClassValue[]): (renderProps: T) => string;
8
+
9
+ export { composeClassnameRenderProps };
@@ -0,0 +1 @@
1
+ export { composeClassnameRenderProps } from '../../chunk-SEU4CGZD.js';
@@ -0,0 +1,15 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ /**
4
+ * Generates CSS module classnames for a given component with modifiers.
5
+ * Utilizes the provided CSS modules object and component name to create classnames.
6
+ * @param cssModules - The CSS modules object to use for classname lookups.
7
+ * @example
8
+ * const result = cssModule(styles, 'hop-button', 'lg', 'primary');
9
+ * // result = "hop-button--lg hop-button--primary"
10
+ */
11
+ declare function cssModule(cssModules: {
12
+ [key: string]: string;
13
+ }, componentName: string, ...modifiers: ClassValue[]): string;
14
+
15
+ export { cssModule };
@@ -0,0 +1 @@
1
+ export { cssModule } from '../../chunk-6BEVZRUL.js';
@@ -0,0 +1,11 @@
1
+ export { cssModule } from './css-module.js';
2
+ export { composeClassnameRenderProps } from './compose-classname-render-props.js';
3
+ export { Size, SizeAdapter } from './size-adapter.js';
4
+ export { BaseComponentProps, DOMProps, RenderProps, StyleProps, StyleRenderProps } from './types.js';
5
+ export { isTextOnlyChildren } from './is-text-only-children.js';
6
+ export { SlotProvider, SlotProviderProps } from './SlotProvider.js';
7
+ import 'clsx';
8
+ import '@hopper-ui/styled-system';
9
+ import 'react';
10
+ import '@react-types/shared';
11
+ import 'react-aria-components';
@@ -0,0 +1,6 @@
1
+ import '../../chunk-D57ZIX5W.js';
2
+ import '../../chunk-SNIF7MEM.js';
3
+ export { isTextOnlyChildren } from '../../chunk-7QUHQYCR.js';
4
+ export { composeClassnameRenderProps } from '../../chunk-SEU4CGZD.js';
5
+ export { SlotProvider } from '../../chunk-M36KANKC.js';
6
+ export { cssModule } from '../../chunk-6BEVZRUL.js';
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ /**
4
+ * Determines whether the provided React children consist only of text content.
5
+ * This function unwraps children wrapped in React Fragments.
6
+ */
7
+ declare function isTextOnlyChildren(children: ReactNode): boolean;
8
+
9
+ export { isTextOnlyChildren };
@@ -0,0 +1 @@
1
+ export { isTextOnlyChildren } from '../../chunk-7QUHQYCR.js';
@@ -0,0 +1,20 @@
1
+ import { ResponsiveProp } from '@hopper-ui/styled-system';
2
+
3
+ /**
4
+ * Represents possible sizes for components.
5
+ */
6
+ type Size = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "inherit";
7
+ type ExtractPossibleSizes<T> = T extends ResponsiveProp<infer U> ? NonNullable<U> : never;
8
+ type SafeExtract<T> = ExtractPossibleSizes<T> extends Size ? ExtractPossibleSizes<T> : never;
9
+ /**
10
+ * Represents a mapping between sizes of type A and sizes of type B.
11
+ * @example
12
+ * const SpinnerToLabelSizeAdapter: SizeAdapter<SpinnerProps["size"], LabelProps["size"]> = {
13
+ * sm: "xs",
14
+ * md: "sm",
15
+ * lg: "md"
16
+ * };
17
+ */
18
+ type SizeAdapter<A, B> = Record<SafeExtract<A>, SafeExtract<B>>;
19
+
20
+ export type { Size, SizeAdapter };
@@ -0,0 +1 @@
1
+ import '../../chunk-D57ZIX5W.js';
@@ -0,0 +1,31 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { DOMProps as DOMProps$1, AriaLabelingProps } from '@react-types/shared';
3
+ import { SlotProps } from 'react-aria-components';
4
+
5
+ /**
6
+ * Taken from https://github.com/adobe/react-spectrum/blob/main/packages/react-aria-components/src/utils.tsx
7
+ */
8
+ interface StyleProps {
9
+ /** The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. */
10
+ className?: string;
11
+ /** The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. */
12
+ style?: CSSProperties;
13
+ }
14
+ interface DOMProps extends StyleProps, DOMProps$1 {
15
+ /** The children of the component. */
16
+ children?: ReactNode;
17
+ }
18
+ interface StyleRenderProps<T> {
19
+ /** The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. */
20
+ className?: string | ((values: T) => string);
21
+ /** The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. */
22
+ style?: CSSProperties | ((values: T) => CSSProperties);
23
+ }
24
+ interface RenderProps<T> extends StyleRenderProps<T> {
25
+ /** The children of the component. A function may be provided to alter the children based on component state. */
26
+ children?: ReactNode | ((values: T) => ReactNode);
27
+ }
28
+ interface BaseComponentProps extends DOMProps, AriaLabelingProps, SlotProps {
29
+ }
30
+
31
+ export type { BaseComponentProps, DOMProps, RenderProps, StyleProps, StyleRenderProps };
@@ -0,0 +1 @@
1
+ import '../../chunk-SNIF7MEM.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hopper-ui/components",
3
3
  "author": "Workleap",
4
- "version": "0.0.10",
4
+ "version": "0.1.0",
5
5
  "description": "The components package.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -33,10 +33,14 @@
33
33
  ],
34
34
  "peerDependencies": {
35
35
  "react": "*",
36
- "react-dom": "*"
36
+ "react-dom": "*",
37
+ "@hopper-ui/styled-system": "*",
38
+ "react-aria-components": "^1.1.0",
39
+ "react-aria": "^3.32.0"
37
40
  },
38
41
  "dependencies": {
39
- "@hopper-ui/styled-system": "0.2.8"
42
+ "clsx": "^2.1.0",
43
+ "@hopper-ui/icons": "1.5.0"
40
44
  },
41
45
  "devDependencies": {
42
46
  "@swc/core": "1.3.106",
@@ -44,6 +48,7 @@
44
48
  "@swc/jest": "0.2.31",
45
49
  "@testing-library/jest-dom": "6.3.0",
46
50
  "@testing-library/react": "14.1.2",
51
+ "@testing-library/user-event": "14.5.2",
47
52
  "@types/jest": "29.5.11",
48
53
  "@types/react": "18.2.48",
49
54
  "@types/react-dom": "18.2.18",
@@ -52,14 +57,18 @@
52
57
  "@workleap/swc-configs": "2.1.2",
53
58
  "@workleap/tsup-configs": "3.0.1",
54
59
  "@workleap/typescript-configs": "3.0.2",
60
+ "identity-obj-proxy": "3.0.0",
55
61
  "jest": "29.7.0",
56
62
  "jest-environment-jsdom": "29.7.0",
57
63
  "react": "18.2.0",
64
+ "react-aria": "3.32.1",
65
+ "react-aria-components": "1.1.0",
58
66
  "react-dom": "18.2.0",
59
67
  "react-test-renderer": "18.2.0",
60
68
  "ts-jest": "29.1.2",
61
69
  "tsup": "8.0.1",
62
- "typescript": "5.3.3"
70
+ "typescript": "5.3.3",
71
+ "@hopper-ui/styled-system": "1.0.0"
63
72
  },
64
73
  "scripts": {
65
74
  "dev": "tsup --config ./tsup.dev.ts",
@@ -1,13 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { StyledSystemProviderProps } from '@hopper-ui/styled-system';
3
-
4
- type HopperProviderProps = StyledSystemProviderProps;
5
- /**
6
- * HopperProvider is required to be rendered at the root of your application. It is responsible for:
7
- * - Adding CSS variables to the document
8
- * - Managing color scheme (light, dark, auto)
9
- * - Optionally adding body styles to the document
10
- */
11
- declare function HopperProvider({ children, withBodyStyle, colorScheme, withCssVariables, ...rest }: HopperProviderProps): react_jsx_runtime.JSX.Element;
12
-
13
- export { HopperProvider, type HopperProviderProps };
@@ -1 +0,0 @@
1
- export { HopperProvider } from './chunk-LBJUDVVS.js';
@@ -1,9 +0,0 @@
1
- import { StyledSystemProvider } from '@hopper-ui/styled-system';
2
- import { jsx } from 'react/jsx-runtime';
3
-
4
- // src/HopperProvider/src/HopperProvider.tsx
5
- function HopperProvider({ children, withBodyStyle = false, colorScheme = "light", withCssVariables = true, ...rest }) {
6
- return /* @__PURE__ */ jsx(StyledSystemProvider, { withBodyStyle, colorScheme, withCssVariables, ...rest, children });
7
- }
8
-
9
- export { HopperProvider };
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { HopperProvider, HopperProviderProps } from './HopperProvider.js';
2
- import 'react/jsx-runtime';
3
- import '@hopper-ui/styled-system';
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- export { HopperProvider } from './chunk-LBJUDVVS.js';