@hopper-ui/components 0.1.0 → 1.0.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/CHANGELOG.md +117 -0
- package/dist/HopperProvider/src/HopperProvider.d.ts +33 -1
- package/dist/HopperProvider/src/HopperProvider.js +2 -1
- package/dist/HopperProvider/src/index.d.ts +1 -0
- package/dist/HopperProvider/src/index.js +2 -1
- package/dist/IconList/src/IconList.css +6 -6
- package/dist/IconList/src/IconList.js +2 -1
- package/dist/IconList/src/IconListContext.js +1 -0
- package/dist/IconList/src/index.css +6 -6
- package/dist/IconList/src/index.js +2 -1
- package/dist/Label/src/Label.css +70 -70
- package/dist/Label/src/Label.js +3 -2
- package/dist/Label/src/LabelContext.js +1 -0
- package/dist/Label/src/index.css +70 -70
- package/dist/Label/src/index.js +3 -2
- package/dist/Link/src/Link.css +165 -0
- package/dist/Link/src/Link.d.ts +33 -0
- package/dist/Link/src/Link.js +11 -0
- package/dist/Link/src/LinkContext.d.ts +8 -0
- package/dist/Link/src/LinkContext.js +2 -0
- package/dist/Link/src/index.css +165 -0
- package/dist/Link/src/index.d.ts +5 -0
- package/dist/Link/src/index.js +11 -0
- package/dist/Spinner/src/Spinner.css +124 -124
- package/dist/Spinner/src/Spinner.d.ts +1 -0
- package/dist/Spinner/src/Spinner.js +5 -4
- package/dist/Spinner/src/SpinnerContext.js +1 -0
- package/dist/Spinner/src/index.css +124 -124
- package/dist/Spinner/src/index.js +5 -4
- package/dist/Text/src/Text.css +67 -67
- package/dist/Text/src/Text.d.ts +2 -3
- package/dist/Text/src/Text.js +5 -2
- package/dist/Text/src/TextContext.js +1 -0
- package/dist/Text/src/index.css +67 -67
- package/dist/Text/src/index.d.ts +1 -1
- package/dist/Text/src/index.js +5 -2
- package/dist/buttons/src/Button.css +634 -435
- package/dist/buttons/src/Button.d.ts +15 -10
- package/dist/buttons/src/Button.js +13 -9
- package/dist/buttons/src/ButtonContext.d.ts +6 -2
- package/dist/buttons/src/ButtonContext.js +1 -0
- package/dist/buttons/src/ButtonGroup.css +38 -0
- package/dist/buttons/src/ButtonGroup.d.ts +40 -0
- package/dist/buttons/src/ButtonGroup.js +83 -0
- package/dist/buttons/src/ButtonGroupContext.d.ts +9 -0
- package/dist/buttons/src/ButtonGroupContext.js +2 -0
- package/dist/buttons/src/index.css +634 -435
- package/dist/buttons/src/index.d.ts +2 -1
- package/dist/buttons/src/index.js +13 -9
- package/dist/checkbox/src/Checkbox.css +292 -0
- package/dist/checkbox/src/Checkbox.d.ts +20 -0
- package/dist/checkbox/src/Checkbox.js +11 -0
- package/dist/checkbox/src/CheckboxContext.d.ts +8 -0
- package/dist/checkbox/src/CheckboxContext.js +2 -0
- package/dist/checkbox/src/CheckboxField.css +119 -0
- package/dist/checkbox/src/CheckboxField.d.ts +26 -0
- package/dist/checkbox/src/CheckboxField.js +7 -0
- package/dist/checkbox/src/CheckboxFieldContext.d.ts +10 -0
- package/dist/checkbox/src/CheckboxFieldContext.js +2 -0
- package/dist/checkbox/src/CheckboxGroup.css +568 -0
- package/dist/checkbox/src/CheckboxGroup.d.ts +30 -0
- package/dist/checkbox/src/CheckboxGroup.js +12 -0
- package/dist/checkbox/src/CheckboxGroupContext.d.ts +8 -0
- package/dist/checkbox/src/CheckboxGroupContext.js +2 -0
- package/dist/checkbox/src/CheckboxList.d.ts +17 -0
- package/dist/checkbox/src/CheckboxList.js +3 -0
- package/dist/checkbox/src/CheckboxListContext.d.ts +10 -0
- package/dist/checkbox/src/CheckboxListContext.js +2 -0
- package/dist/checkbox/src/index.css +568 -0
- package/dist/checkbox/src/index.d.ts +13 -0
- package/dist/checkbox/src/index.js +20 -0
- package/dist/chip/src/Chip.css +261 -0
- package/dist/chip/src/Chip.d.ts +27 -0
- package/dist/chip/src/Chip.js +10 -0
- package/dist/chip/src/ChipContext.d.ts +10 -0
- package/dist/chip/src/ChipContext.js +2 -0
- package/dist/chip/src/index.css +261 -0
- package/dist/chip/src/index.d.ts +7 -0
- package/dist/chip/src/index.js +10 -0
- package/dist/chunk-2EAZPH3M.js +7 -0
- package/dist/chunk-3LRBUQC2.js +43 -0
- package/dist/chunk-4AARNXWE.js +101 -0
- package/dist/chunk-4VVNSXIB.js +7 -0
- package/dist/chunk-5KJ5IKUE.js +69 -0
- package/dist/chunk-5MBJWRZD.js +7 -0
- package/dist/{chunk-SEU4CGZD.js → chunk-65JPI4FL.js} +1 -1
- package/dist/chunk-7ELZ57E5.js +93 -0
- package/dist/chunk-A7TZHALP.js +7 -0
- package/dist/chunk-ACVMW6YD.js +7 -0
- package/dist/{chunk-YLDA2M2E.js → chunk-ANVMQBBG.js} +2 -1
- package/dist/chunk-B7WS4DBA.js +83 -0
- package/dist/chunk-BPM4ETTB.js +35 -0
- package/dist/{chunk-QIOYM2XJ.js → chunk-DFUQTSEV.js} +13 -13
- package/dist/chunk-DGLAGYBD.js +7 -0
- package/dist/chunk-ESVVLTEN.js +7 -0
- package/dist/chunk-FU5CCPLP.js +7 -0
- package/dist/chunk-GXKSX5N5.js +104 -0
- package/dist/chunk-H5YTU3U7.js +20 -0
- package/dist/chunk-H7VJS4MX.js +7 -0
- package/dist/chunk-HVRSS5RT.js +186 -0
- package/dist/chunk-HXI3MEEK.js +27 -0
- package/dist/chunk-I7AMDVGG.js +124 -0
- package/dist/{chunk-XCKF6EU7.js → chunk-IYITZANI.js} +9 -9
- package/dist/chunk-JHY3TXL4.js +101 -0
- package/dist/{chunk-6BEVZRUL.js → chunk-KVDXQMWI.js} +1 -1
- package/dist/chunk-M6UHXS6K.js +58 -0
- package/dist/chunk-MD6IFXLG.js +57 -0
- package/dist/chunk-ME3RBGOT.js +91 -0
- package/dist/chunk-N7YDPVZL.js +7 -0
- package/dist/chunk-NH3IVMXB.js +43 -0
- package/dist/chunk-NKHMUPAP.js +43 -0
- package/dist/chunk-OHPGEHL3.js +83 -0
- package/dist/chunk-VIHBOZVN.js +92 -0
- package/dist/chunk-VJQ7M2BK.js +7 -0
- package/dist/chunk-WDUQUPTE.js +7 -0
- package/dist/chunk-WTKIUAHI.js +7 -0
- package/dist/chunk-YHBJAXUY.js +7 -0
- package/dist/chunk-YSQDPG26.js +27 -0
- package/dist/chunk-YWUIJ6ZQ.js +83 -0
- package/dist/chunk-ZGNK4GWA.js +7 -0
- package/dist/{chunk-XQ3GUEBN.js → chunk-ZQEB3Y3X.js} +8 -9
- package/dist/{chunk-7QUHQYCR.js → chunk-ZWU6DRRZ.js} +1 -1
- package/dist/errorMessage/src/ErrorMessage.css +102 -0
- package/dist/errorMessage/src/ErrorMessage.d.ts +20 -0
- package/dist/errorMessage/src/ErrorMessage.js +9 -0
- package/dist/errorMessage/src/ErrorMessageContext.d.ts +9 -0
- package/dist/errorMessage/src/ErrorMessageContext.js +2 -0
- package/dist/errorMessage/src/index.css +102 -0
- package/dist/errorMessage/src/index.d.ts +6 -0
- package/dist/errorMessage/src/index.js +9 -0
- package/dist/helperMessage/src/HelperMessage.css +94 -0
- package/dist/helperMessage/src/HelperMessage.d.ts +20 -0
- package/dist/helperMessage/src/HelperMessage.js +8 -0
- package/dist/helperMessage/src/HelperMessageContext.d.ts +9 -0
- package/dist/helperMessage/src/HelperMessageContext.js +2 -0
- package/dist/helperMessage/src/index.css +94 -0
- package/dist/helperMessage/src/index.d.ts +6 -0
- package/dist/helperMessage/src/index.js +8 -0
- package/dist/{intl → i18n}/src/index.d.ts +1 -0
- package/dist/i18n/src/index.js +2 -0
- package/dist/i18n/src/useLocalizedString.d.ts +9 -0
- package/dist/i18n/src/useLocalizedString.js +2 -0
- package/dist/layout/src/Flex.js +1 -0
- package/dist/layout/src/Grid.js +1 -1
- package/dist/layout/src/Inline.js +1 -0
- package/dist/layout/src/Stack.js +1 -0
- package/dist/radio/src/Radio.css +293 -0
- package/dist/radio/src/Radio.d.ts +20 -0
- package/dist/radio/src/Radio.js +11 -0
- package/dist/radio/src/RadioContext.d.ts +8 -0
- package/dist/radio/src/RadioContext.js +2 -0
- package/dist/radio/src/RadioField.css +119 -0
- package/dist/radio/src/RadioField.d.ts +26 -0
- package/dist/radio/src/RadioField.js +7 -0
- package/dist/radio/src/RadioFieldContext.d.ts +10 -0
- package/dist/radio/src/RadioFieldContext.js +2 -0
- package/dist/radio/src/RadioGroup.css +570 -0
- package/dist/radio/src/RadioGroup.d.ts +30 -0
- package/dist/radio/src/RadioGroup.js +12 -0
- package/dist/radio/src/RadioGroupContext.d.ts +8 -0
- package/dist/radio/src/RadioGroupContext.js +2 -0
- package/dist/radio/src/RadioList.d.ts +17 -0
- package/dist/radio/src/RadioList.js +3 -0
- package/dist/radio/src/RadioListContext.d.ts +10 -0
- package/dist/radio/src/RadioListContext.js +2 -0
- package/dist/radio/src/index.css +570 -0
- package/dist/radio/src/index.d.ts +13 -0
- package/dist/radio/src/index.js +20 -0
- package/dist/switch/src/Switch.css +236 -0
- package/dist/switch/src/Switch.d.ts +20 -0
- package/dist/switch/src/Switch.js +11 -0
- package/dist/switch/src/SwitchContext.d.ts +8 -0
- package/dist/switch/src/SwitchContext.js +2 -0
- package/dist/switch/src/SwitchField.css +119 -0
- package/dist/switch/src/SwitchField.d.ts +26 -0
- package/dist/switch/src/SwitchField.js +7 -0
- package/dist/switch/src/SwitchFieldContext.d.ts +10 -0
- package/dist/switch/src/SwitchFieldContext.js +2 -0
- package/dist/switch/src/index.css +276 -0
- package/dist/switch/src/index.d.ts +9 -0
- package/dist/switch/src/index.js +13 -0
- package/dist/utils/src/ClearSlots.d.ts +28 -0
- package/dist/utils/src/ClearSlots.js +2 -0
- package/dist/utils/src/SlotProvider.js +1 -0
- package/dist/utils/src/composeClassnameRenderProps.js +2 -0
- package/dist/utils/src/cssModule.js +2 -0
- package/dist/utils/src/index.d.ts +11 -6
- package/dist/utils/src/index.js +8 -4
- package/dist/utils/src/isTextOnlyChildren.js +2 -0
- package/dist/utils/src/{size-adapter.d.ts → sizeAdapter.d.ts} +1 -1
- package/dist/utils/src/sizeAdapter.js +1 -0
- package/dist/utils/src/types.d.ts +17 -5
- package/dist/utils/src/useRenderProps.d.ts +843 -0
- package/dist/utils/src/useRenderProps.js +2 -0
- package/dist/utils/src/useSlot.d.ts +8 -0
- package/dist/utils/src/useSlot.js +2 -0
- package/package.json +32 -27
- package/dist/chunk-GXUPEV64.js +0 -24
- package/dist/chunk-WROQHGG5.js +0 -141
- package/dist/chunk-WRWNRVTG.js +0 -47
- package/dist/intl/src/index.js +0 -1
- package/dist/intl/src/useLocalizedString.d.ts +0 -26
- package/dist/intl/src/useLocalizedString.js +0 -1
- package/dist/utils/src/compose-classname-render-props.js +0 -1
- package/dist/utils/src/css-module.js +0 -1
- package/dist/utils/src/is-text-only-children.js +0 -1
- package/dist/utils/src/size-adapter.js +0 -1
- /package/dist/{chunk-D57ZIX5W.js → chunk-LQICWONC.js} +0 -0
- /package/dist/utils/src/{compose-classname-render-props.d.ts → composeClassnameRenderProps.d.ts} +0 -0
- /package/dist/utils/src/{css-module.d.ts → cssModule.d.ts} +0 -0
- /package/dist/utils/src/{is-text-only-children.d.ts → isTextOnlyChildren.d.ts} +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { RadioFieldContext } from './chunk-DGLAGYBD.js';
|
|
2
|
+
import { RadioGroupContext } from './chunk-5MBJWRZD.js';
|
|
3
|
+
import { RadioListContext } from './chunk-A7TZHALP.js';
|
|
4
|
+
import { RadioContext } from './chunk-FU5CCPLP.js';
|
|
5
|
+
import { ErrorMessageContext } from './chunk-ACVMW6YD.js';
|
|
6
|
+
import { HelperMessageContext } from './chunk-ESVVLTEN.js';
|
|
7
|
+
import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
|
|
8
|
+
import { SlotProvider } from './chunk-M36KANKC.js';
|
|
9
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
10
|
+
import { LabelContext } from './chunk-HVKOIMMW.js';
|
|
11
|
+
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
12
|
+
import { forwardRef } from 'react';
|
|
13
|
+
import { useContextProps, composeRenderProps, RadioGroup as RadioGroup$1 } from 'react-aria-components';
|
|
14
|
+
import { jsx } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
// css-module:./RadioGroup.module.css#css-module
|
|
17
|
+
var RadioGroup_module_default = { "hop-RadioGroup": "RadioGroup-module__hop-RadioGroup___T9TtY", "hop-RadioGroup--bordered": "RadioGroup-module__hop-RadioGroup--bordered___YceTZ", "hop-RadioGroup--sm": "RadioGroup-module__hop-RadioGroup--sm___EXu0Q", "hop-RadioGroup--md": "RadioGroup-module__hop-RadioGroup--md___xNRU8", "hop-RadioGroup__label": "RadioGroup-module__hop-RadioGroup__label___eybbP", "hop-RadioGroup__list": "RadioGroup-module__hop-RadioGroup__list___kk0V7", "hop-RadioGroup__radio": "RadioGroup-module__hop-RadioGroup__radio___rf-mr", "hop-RadioGroup__error-message": "RadioGroup-module__hop-RadioGroup__error-message___wj9r4", "hop-RadioGroup__helper-message": "RadioGroup-module__hop-RadioGroup__helper-message___vyN6b" };
|
|
18
|
+
var GlobalRadioGroupCssSelector = "hop-RadioGroup";
|
|
19
|
+
function RadioGroup(props, ref) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
[props, ref] = useContextProps(props, ref, RadioGroupContext);
|
|
22
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
23
|
+
const {
|
|
24
|
+
className,
|
|
25
|
+
children,
|
|
26
|
+
isDisabled,
|
|
27
|
+
isInvalid,
|
|
28
|
+
orientation: orientationProp = "vertical",
|
|
29
|
+
size: sizeProp = "md",
|
|
30
|
+
style: styleProp,
|
|
31
|
+
variant = "borderless",
|
|
32
|
+
...otherProps
|
|
33
|
+
} = ownProps;
|
|
34
|
+
const orientation = (_a = useResponsiveValue(orientationProp)) != null ? _a : "vertical";
|
|
35
|
+
const size = (_b = useResponsiveValue(sizeProp)) != null ? _b : "md";
|
|
36
|
+
const classNames = composeClassnameRenderProps(
|
|
37
|
+
className,
|
|
38
|
+
GlobalRadioGroupCssSelector,
|
|
39
|
+
cssModule(
|
|
40
|
+
RadioGroup_module_default,
|
|
41
|
+
"hop-RadioGroup",
|
|
42
|
+
size,
|
|
43
|
+
variant
|
|
44
|
+
),
|
|
45
|
+
stylingProps.className
|
|
46
|
+
);
|
|
47
|
+
const style = composeRenderProps(styleProp, (prev) => {
|
|
48
|
+
return {
|
|
49
|
+
...stylingProps.style,
|
|
50
|
+
...prev
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
SlotProvider,
|
|
55
|
+
{
|
|
56
|
+
values: [
|
|
57
|
+
[LabelContext, {
|
|
58
|
+
className: RadioGroup_module_default["hop-RadioGroup__label"],
|
|
59
|
+
size
|
|
60
|
+
}],
|
|
61
|
+
[RadioContext, {
|
|
62
|
+
className: RadioGroup_module_default["hop-RadioGroup__radio"],
|
|
63
|
+
size
|
|
64
|
+
}],
|
|
65
|
+
[RadioFieldContext, {
|
|
66
|
+
className: RadioGroup_module_default["hop-RadioGroup__radio"],
|
|
67
|
+
size,
|
|
68
|
+
isDisabled
|
|
69
|
+
}],
|
|
70
|
+
[RadioListContext, {
|
|
71
|
+
className: RadioGroup_module_default["hop-RadioGroup__list"]
|
|
72
|
+
}],
|
|
73
|
+
[ErrorMessageContext, {
|
|
74
|
+
className: RadioGroup_module_default["hop-RadioGroup__error-message"],
|
|
75
|
+
hideIcon: true
|
|
76
|
+
}],
|
|
77
|
+
[HelperMessageContext, {
|
|
78
|
+
className: RadioGroup_module_default["hop-RadioGroup__helper-message"],
|
|
79
|
+
hideIcon: true
|
|
80
|
+
}]
|
|
81
|
+
],
|
|
82
|
+
children: /* @__PURE__ */ jsx(
|
|
83
|
+
RadioGroup$1,
|
|
84
|
+
{
|
|
85
|
+
ref,
|
|
86
|
+
className: classNames,
|
|
87
|
+
style,
|
|
88
|
+
isInvalid,
|
|
89
|
+
isDisabled,
|
|
90
|
+
orientation,
|
|
91
|
+
...otherProps,
|
|
92
|
+
children
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
var _RadioGroup = forwardRef(RadioGroup);
|
|
99
|
+
_RadioGroup.displayName = "RadioGroup";
|
|
100
|
+
|
|
101
|
+
export { GlobalRadioGroupCssSelector, _RadioGroup };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ErrorMessageContext } from './chunk-ACVMW6YD.js';
|
|
2
|
+
import { useRenderProps } from './chunk-NH3IVMXB.js';
|
|
3
|
+
import { _Text } from './chunk-M6UHXS6K.js';
|
|
4
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
5
|
+
import { WarningIcon } from '@hopper-ui/icons';
|
|
6
|
+
import { useStyledSystem } from '@hopper-ui/styled-system';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import { forwardRef, useContext } from 'react';
|
|
9
|
+
import { FieldErrorContext, useContextProps } from 'react-aria-components';
|
|
10
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
// css-module:./ErrorMessage.module.css#css-module
|
|
13
|
+
var ErrorMessage_module_default = { "hop-ErrorMessage": "ErrorMessage-module__hop-ErrorMessage___ByQ5V", "hop-ErrorMessage__icon": "ErrorMessage-module__hop-ErrorMessage__icon___Z0oW9" };
|
|
14
|
+
var GlobalErrorMessageCssSelector = "hop-ErrorMessage";
|
|
15
|
+
function ErrorMessage(props, ref) {
|
|
16
|
+
const validation = useContext(FieldErrorContext);
|
|
17
|
+
if (!(validation == null ? void 0 : validation.isInvalid)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsx(ErrorMessageInner, { ...props, ref });
|
|
21
|
+
}
|
|
22
|
+
var _ErrorMessage = forwardRef(ErrorMessage);
|
|
23
|
+
_ErrorMessage.displayName = "ErrorMessage";
|
|
24
|
+
var ErrorMessageInner = forwardRef((props, ref) => {
|
|
25
|
+
const validation = useContext(FieldErrorContext);
|
|
26
|
+
[props, ref] = useContextProps(props, ref, ErrorMessageContext);
|
|
27
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
28
|
+
const { className, children, hideIcon = false, style, slot = "errorMessage", ...otherProps } = ownProps;
|
|
29
|
+
const classNames = clsx(
|
|
30
|
+
GlobalErrorMessageCssSelector,
|
|
31
|
+
cssModule(
|
|
32
|
+
ErrorMessage_module_default,
|
|
33
|
+
"hop-ErrorMessage"
|
|
34
|
+
),
|
|
35
|
+
stylingProps.className,
|
|
36
|
+
className
|
|
37
|
+
);
|
|
38
|
+
const mergedStyles = {
|
|
39
|
+
...stylingProps.style,
|
|
40
|
+
...style
|
|
41
|
+
};
|
|
42
|
+
const warningIcon = !hideIcon && /* @__PURE__ */ jsx(WarningIcon, { size: "sm", className: ErrorMessage_module_default["hop-ErrorMessage__icon"] });
|
|
43
|
+
const renderProps = useRenderProps({
|
|
44
|
+
className: classNames,
|
|
45
|
+
children: children ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
warningIcon,
|
|
47
|
+
" ",
|
|
48
|
+
children
|
|
49
|
+
] }) : null,
|
|
50
|
+
defaultChildren: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
|
+
warningIcon,
|
|
52
|
+
" ",
|
|
53
|
+
validation.validationErrors.join(" ")
|
|
54
|
+
] }),
|
|
55
|
+
values: validation
|
|
56
|
+
});
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
_Text,
|
|
59
|
+
{
|
|
60
|
+
...otherProps,
|
|
61
|
+
...renderProps,
|
|
62
|
+
slot,
|
|
63
|
+
ref,
|
|
64
|
+
style: mergedStyles
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export { GlobalErrorMessageCssSelector, _ErrorMessage };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import { composeRenderProps } from 'react-aria-components';
|
|
3
3
|
|
|
4
|
-
// src/utils/src/
|
|
4
|
+
// src/utils/src/composeClassnameRenderProps.ts
|
|
5
5
|
function composeClassnameRenderProps(className, ...classes) {
|
|
6
6
|
return composeRenderProps(className, (prev) => {
|
|
7
7
|
return clsx(
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CheckboxContext } from './chunk-2EAZPH3M.js';
|
|
2
|
+
import { isTextOnlyChildren } from './chunk-ZWU6DRRZ.js';
|
|
3
|
+
import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
|
|
4
|
+
import { _Text } from './chunk-M6UHXS6K.js';
|
|
5
|
+
import { ClearContainerSlots } from './chunk-HXI3MEEK.js';
|
|
6
|
+
import { TextContext } from './chunk-OE5BLFZI.js';
|
|
7
|
+
import { SlotProvider } from './chunk-M36KANKC.js';
|
|
8
|
+
import { IconListContext } from './chunk-DHVVYSLB.js';
|
|
9
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
10
|
+
import { MinusIcon, CheckmarkIcon, IconContext } from '@hopper-ui/icons';
|
|
11
|
+
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
12
|
+
import { forwardRef } from 'react';
|
|
13
|
+
import { useContextProps, composeRenderProps, Checkbox as Checkbox$1 } from 'react-aria-components';
|
|
14
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
// css-module:./Checkbox.module.css#css-module
|
|
17
|
+
var Checkbox_module_default = { "hop-Checkbox": "Checkbox-module__hop-Checkbox___ep2Zx", "hop-Checkbox--sm": "Checkbox-module__hop-Checkbox--sm___B7Muq", "hop-Checkbox--md": "Checkbox-module__hop-Checkbox--md___yGTCh", "hop-Checkbox__icon": "Checkbox-module__hop-Checkbox__icon___lVhXJ", "hop-Checkbox__icon-list": "Checkbox-module__hop-Checkbox__icon-list___PvKOF", "hop-Checkbox__box": "Checkbox-module__hop-Checkbox__box___xJAKj", "hop-Checkbox__check": "Checkbox-module__hop-Checkbox__check___DmYlq", "hop-Checkbox__text": "Checkbox-module__hop-Checkbox__text___voh3D" };
|
|
18
|
+
var GlobalCheckboxCssSelector = "hop-Checkbox";
|
|
19
|
+
function Checkbox(props, ref) {
|
|
20
|
+
var _a;
|
|
21
|
+
[props, ref] = useContextProps(props, ref, CheckboxContext);
|
|
22
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
23
|
+
const {
|
|
24
|
+
className,
|
|
25
|
+
children: childrenProp,
|
|
26
|
+
size: sizeProp = "md",
|
|
27
|
+
style: styleProp,
|
|
28
|
+
...otherProps
|
|
29
|
+
} = ownProps;
|
|
30
|
+
const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
|
|
31
|
+
const classNames = composeClassnameRenderProps(
|
|
32
|
+
className,
|
|
33
|
+
GlobalCheckboxCssSelector,
|
|
34
|
+
cssModule(
|
|
35
|
+
Checkbox_module_default,
|
|
36
|
+
"hop-Checkbox",
|
|
37
|
+
size
|
|
38
|
+
),
|
|
39
|
+
stylingProps.className
|
|
40
|
+
);
|
|
41
|
+
const style = composeRenderProps(styleProp, (prev) => {
|
|
42
|
+
return {
|
|
43
|
+
...stylingProps.style,
|
|
44
|
+
...prev
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const children = composeRenderProps(childrenProp, (prev) => {
|
|
48
|
+
if (prev && isTextOnlyChildren(prev)) {
|
|
49
|
+
return /* @__PURE__ */ jsx(_Text, { children: prev });
|
|
50
|
+
}
|
|
51
|
+
return prev;
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
Checkbox$1,
|
|
55
|
+
{
|
|
56
|
+
ref,
|
|
57
|
+
className: classNames,
|
|
58
|
+
style,
|
|
59
|
+
...otherProps,
|
|
60
|
+
children: (checkboxProps) => {
|
|
61
|
+
const checkboxIconClassName = Checkbox_module_default["hop-Checkbox__check"];
|
|
62
|
+
const icon = checkboxProps.isIndeterminate ? /* @__PURE__ */ jsx(MinusIcon, { size: "sm", className: checkboxIconClassName }) : /* @__PURE__ */ jsx(CheckmarkIcon, { size: "sm", className: checkboxIconClassName });
|
|
63
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64
|
+
/* @__PURE__ */ jsx("div", { className: Checkbox_module_default["hop-Checkbox__box"], children: icon }),
|
|
65
|
+
/* @__PURE__ */ jsx(ClearContainerSlots, { children: /* @__PURE__ */ jsx(
|
|
66
|
+
SlotProvider,
|
|
67
|
+
{
|
|
68
|
+
values: [
|
|
69
|
+
[TextContext, {
|
|
70
|
+
className: Checkbox_module_default["hop-Checkbox__text"],
|
|
71
|
+
size
|
|
72
|
+
}],
|
|
73
|
+
[IconListContext, {
|
|
74
|
+
className: Checkbox_module_default["hop-Checkbox__icon-list"],
|
|
75
|
+
size
|
|
76
|
+
}],
|
|
77
|
+
[IconContext, {
|
|
78
|
+
className: Checkbox_module_default["hop-Checkbox__icon"],
|
|
79
|
+
size
|
|
80
|
+
}]
|
|
81
|
+
],
|
|
82
|
+
children: children(checkboxProps)
|
|
83
|
+
}
|
|
84
|
+
) })
|
|
85
|
+
] });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
var _Checkbox = forwardRef(Checkbox);
|
|
91
|
+
_Checkbox.displayName = "Checkbox";
|
|
92
|
+
|
|
93
|
+
export { GlobalCheckboxCssSelector, _Checkbox };
|
|
@@ -15,6 +15,7 @@ var HopperProvider = (props, ref) => {
|
|
|
15
15
|
withCssVariables = true,
|
|
16
16
|
className,
|
|
17
17
|
navigate,
|
|
18
|
+
useHref,
|
|
18
19
|
...rest
|
|
19
20
|
} = props;
|
|
20
21
|
const classNames = clsx(
|
|
@@ -23,7 +24,7 @@ var HopperProvider = (props, ref) => {
|
|
|
23
24
|
);
|
|
24
25
|
let content = children;
|
|
25
26
|
if (navigate) {
|
|
26
|
-
content = /* @__PURE__ */ jsx(RouterProvider, { navigate, children });
|
|
27
|
+
content = /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children });
|
|
27
28
|
}
|
|
28
29
|
return /* @__PURE__ */ jsx(StyledSystemProvider, { ref, withBodyStyle, colorScheme, withCssVariables, className: classNames, ...rest, children: /* @__PURE__ */ jsx(I18nProvider, { locale, children: content }) });
|
|
29
30
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RadioFieldContext } from './chunk-DGLAGYBD.js';
|
|
2
|
+
import { RadioContext } from './chunk-FU5CCPLP.js';
|
|
3
|
+
import { TextContext } from './chunk-OE5BLFZI.js';
|
|
4
|
+
import { SlotProvider } from './chunk-M36KANKC.js';
|
|
5
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
6
|
+
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import { useId } from 'react-aria';
|
|
10
|
+
import { useContextProps } from 'react-aria-components';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
// css-module:./RadioField.module.css#css-module
|
|
14
|
+
var RadioField_module_default = { "hop-RadioField": "RadioField-module__hop-RadioField___u5q-m", "hop-RadioField--sm": "RadioField-module__hop-RadioField--sm___xyabe", "hop-RadioField--md": "RadioField-module__hop-RadioField--md___RaN8s", "hop-RadioField__description": "RadioField-module__hop-RadioField__description___XKSO3", "hop-RadioField__radio": "RadioField-module__hop-RadioField__radio___hg6Wr" };
|
|
15
|
+
var GlobalRadioFieldCssSelector = "hop-RadioField";
|
|
16
|
+
var RadioToDescriptionSizeAdapter = {
|
|
17
|
+
sm: "xs",
|
|
18
|
+
md: "sm"
|
|
19
|
+
};
|
|
20
|
+
function RadioField(props, ref) {
|
|
21
|
+
var _a;
|
|
22
|
+
[props, ref] = useContextProps(props, ref, RadioFieldContext);
|
|
23
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
24
|
+
const {
|
|
25
|
+
className,
|
|
26
|
+
children,
|
|
27
|
+
isDisabled,
|
|
28
|
+
size: sizeProp = "md",
|
|
29
|
+
style,
|
|
30
|
+
slot,
|
|
31
|
+
...otherProps
|
|
32
|
+
} = ownProps;
|
|
33
|
+
const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
|
|
34
|
+
const classNames = clsx(
|
|
35
|
+
className,
|
|
36
|
+
GlobalRadioFieldCssSelector,
|
|
37
|
+
cssModule(
|
|
38
|
+
RadioField_module_default,
|
|
39
|
+
"hop-RadioField",
|
|
40
|
+
size
|
|
41
|
+
),
|
|
42
|
+
stylingProps.className
|
|
43
|
+
);
|
|
44
|
+
const mergedStyles = {
|
|
45
|
+
...stylingProps.style,
|
|
46
|
+
...style
|
|
47
|
+
};
|
|
48
|
+
const descriptionId = useId();
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
SlotProvider,
|
|
51
|
+
{
|
|
52
|
+
values: [
|
|
53
|
+
[TextContext, {
|
|
54
|
+
id: descriptionId,
|
|
55
|
+
className: RadioField_module_default["hop-RadioField__description"],
|
|
56
|
+
size: RadioToDescriptionSizeAdapter[size]
|
|
57
|
+
}],
|
|
58
|
+
[RadioContext, {
|
|
59
|
+
className: RadioField_module_default["hop-RadioField__radio"],
|
|
60
|
+
size,
|
|
61
|
+
isDisabled,
|
|
62
|
+
"aria-describedby": descriptionId
|
|
63
|
+
}]
|
|
64
|
+
],
|
|
65
|
+
children: /* @__PURE__ */ jsx(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
...otherProps,
|
|
69
|
+
ref,
|
|
70
|
+
className: classNames,
|
|
71
|
+
style: mergedStyles,
|
|
72
|
+
slot: slot != null ? slot : void 0,
|
|
73
|
+
"data-disabled": isDisabled,
|
|
74
|
+
children
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
var _RadioField = forwardRef(RadioField);
|
|
81
|
+
_RadioField.displayName = "RadioField";
|
|
82
|
+
|
|
83
|
+
export { GlobalRadioFieldCssSelector, _RadioField };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { __commonJS, __toESM } from './chunk-YSQDPG26.js';
|
|
2
|
+
import { useLocalizedStringFormatter } from 'react-aria';
|
|
3
|
+
|
|
4
|
+
// src/i18n/intl/en-US.json
|
|
5
|
+
var require_en_US = __commonJS({
|
|
6
|
+
"src/i18n/intl/en-US.json"(exports, module) {
|
|
7
|
+
module.exports = {
|
|
8
|
+
"Button.spinnerAriaLabel": `Loading`,
|
|
9
|
+
"Input.charactersLeft": (args, formatter) => `${formatter.plural(args.charLeft, { "=0": `No characters left`, one: () => `${formatter.number(args.charLeft)} character left`, other: () => `${formatter.number(args.charLeft)} characters left` })}.`
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// src/i18n/intl/fr-CA.json
|
|
15
|
+
var require_fr_CA = __commonJS({
|
|
16
|
+
"src/i18n/intl/fr-CA.json"(exports, module) {
|
|
17
|
+
module.exports = {
|
|
18
|
+
"Button.spinnerAriaLabel": `Chargement en cours`,
|
|
19
|
+
"Input.charactersLeft": (args, formatter) => `${formatter.plural(args.charLeft, { "=0": `Aucun caract\xE8re restant`, one: () => `${formatter.number(args.charLeft)} caract\xE8re restant`, other: () => `${formatter.number(args.charLeft)} caract\xE8res restants` })}.`
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// src/i18n/src/useLocalizedString.tsx
|
|
25
|
+
var import_en_US = __toESM(require_en_US(), 1);
|
|
26
|
+
var import_fr_CA = __toESM(require_fr_CA(), 1);
|
|
27
|
+
var Resources = {
|
|
28
|
+
"en-US": import_en_US.default,
|
|
29
|
+
"fr-CA": import_fr_CA.default
|
|
30
|
+
};
|
|
31
|
+
function useLocalizedString() {
|
|
32
|
+
return useLocalizedStringFormatter(Resources, "@hopper-ui/components");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { useLocalizedString };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { composeClassnameRenderProps } from './chunk-
|
|
1
|
+
import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
|
|
2
2
|
import { SpinnerContext } from './chunk-4ZYV2XLW.js';
|
|
3
|
-
import { _Label } from './chunk-
|
|
4
|
-
import { cssModule } from './chunk-
|
|
3
|
+
import { _Label } from './chunk-IYITZANI.js';
|
|
4
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
5
5
|
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
import { useContextProps, ProgressBar } from 'react-aria-components';
|
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
var
|
|
10
|
+
// css-module:./Spinner.module.css#css-module
|
|
11
|
+
var Spinner_module_default = { "hop-Spinner": "Spinner-module__hop-Spinner___dv6Mx", "spin": "Spinner-module__spin___JyBzF", "hop-Spinner--sm": "Spinner-module__hop-Spinner--sm___UMVNX", "hop-Spinner--md": "Spinner-module__hop-Spinner--md___CkJxN", "hop-Spinner--lg": "Spinner-module__hop-Spinner--lg___Evi6W", "hop-Spinner__track": "Spinner-module__hop-Spinner__track___GfTjA", "hop-Spinner__fill": "Spinner-module__hop-Spinner__fill___v2YK9", "hop-Spinner__label": "Spinner-module__hop-Spinner__label___pDhxi" };
|
|
12
12
|
var GlobalSpinnerCssSelector = "hop-Spinner";
|
|
13
13
|
var SpinnerToLabelSizeAdapter = {
|
|
14
14
|
sm: "xs",
|
|
@@ -31,8 +31,8 @@ var Spinner = (props, ref) => {
|
|
|
31
31
|
className,
|
|
32
32
|
GlobalSpinnerCssSelector,
|
|
33
33
|
cssModule(
|
|
34
|
-
|
|
35
|
-
"hop-
|
|
34
|
+
Spinner_module_default,
|
|
35
|
+
"hop-Spinner",
|
|
36
36
|
size
|
|
37
37
|
),
|
|
38
38
|
stylingProps.className
|
|
@@ -45,8 +45,8 @@ var Spinner = (props, ref) => {
|
|
|
45
45
|
_Label,
|
|
46
46
|
{
|
|
47
47
|
className: cssModule(
|
|
48
|
-
|
|
49
|
-
"hop-
|
|
48
|
+
Spinner_module_default,
|
|
49
|
+
"hop-Spinner__label"
|
|
50
50
|
),
|
|
51
51
|
size: SpinnerToLabelSizeAdapter[size],
|
|
52
52
|
children
|
|
@@ -65,8 +65,8 @@ var Spinner = (props, ref) => {
|
|
|
65
65
|
"div",
|
|
66
66
|
{
|
|
67
67
|
className: cssModule(
|
|
68
|
-
|
|
69
|
-
"hop-
|
|
68
|
+
Spinner_module_default,
|
|
69
|
+
"hop-Spinner__track"
|
|
70
70
|
)
|
|
71
71
|
}
|
|
72
72
|
),
|
|
@@ -74,8 +74,8 @@ var Spinner = (props, ref) => {
|
|
|
74
74
|
"div",
|
|
75
75
|
{
|
|
76
76
|
className: cssModule(
|
|
77
|
-
|
|
78
|
-
"hop-
|
|
77
|
+
Spinner_module_default,
|
|
78
|
+
"hop-Spinner__fill"
|
|
79
79
|
)
|
|
80
80
|
}
|
|
81
81
|
),
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ChipContext } from './chunk-WTKIUAHI.js';
|
|
2
|
+
import { isTextOnlyChildren } from './chunk-ZWU6DRRZ.js';
|
|
3
|
+
import { _Text } from './chunk-M6UHXS6K.js';
|
|
4
|
+
import { TextContext } from './chunk-OE5BLFZI.js';
|
|
5
|
+
import { SlotProvider } from './chunk-M36KANKC.js';
|
|
6
|
+
import { IconListContext } from './chunk-DHVVYSLB.js';
|
|
7
|
+
import { cssModule } from './chunk-KVDXQMWI.js';
|
|
8
|
+
import { IconContext } from '@hopper-ui/icons';
|
|
9
|
+
import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import { forwardRef } from 'react';
|
|
12
|
+
import { useContextProps, DEFAULT_SLOT } from 'react-aria-components';
|
|
13
|
+
import { jsx } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
// css-module:./Chip.module.css#css-module
|
|
16
|
+
var Chip_module_default = { "hop-Chip": "Chip-module__hop-Chip___MIqOt", "hop-Chip--xs": "Chip-module__hop-Chip--xs___lupDe", "hop-Chip--sm": "Chip-module__hop-Chip--sm___n11aW", "hop-Chip--md": "Chip-module__hop-Chip--md___PRA24", "hop-Chip--lg": "Chip-module__hop-Chip--lg___qR9jZ", "hop-Chip--neutral": "Chip-module__hop-Chip--neutral___06cJi", "hop-Chip--progress": "Chip-module__hop-Chip--progress___h1HQQ", "hop-Chip--positive": "Chip-module__hop-Chip--positive___57ub5", "hop-Chip--caution": "Chip-module__hop-Chip--caution___ttdCf", "hop-Chip--negative": "Chip-module__hop-Chip--negative___OXcM5", "hop-Chip--option1": "Chip-module__hop-Chip--option1___wMtVM", "hop-Chip--option2": "Chip-module__hop-Chip--option2___ZQUGF", "hop-Chip--option3": "Chip-module__hop-Chip--option3___Bd35M", "hop-Chip--option4": "Chip-module__hop-Chip--option4___0-Byk", "hop-Chip--option5": "Chip-module__hop-Chip--option5___3tWr5", "hop-Chip--option6": "Chip-module__hop-Chip--option6___DV-En", "hop-Chip--inactive": "Chip-module__hop-Chip--inactive___JC531", "hop-Chip--disabled": "Chip-module__hop-Chip--disabled___Cmxru", "hop-Chip__icon": "Chip-module__hop-Chip__icon___SGRJQ", "hop-Chip__icon-list": "Chip-module__hop-Chip__icon-list___CEqWU", "hop-Chip__text": "Chip-module__hop-Chip__text___7QqU-", "hop-Chip__end-icon": "Chip-module__hop-Chip__end-icon___Ouwqs", "hop-Chip__end-icon-list": "Chip-module__hop-Chip__end-icon-list___whzI-" };
|
|
17
|
+
var GlobalChipCssSelector = "hop-Chip";
|
|
18
|
+
var ChipToTextSizeAdapter = {
|
|
19
|
+
xs: "xs",
|
|
20
|
+
sm: "xs",
|
|
21
|
+
md: "xs",
|
|
22
|
+
lg: "sm"
|
|
23
|
+
};
|
|
24
|
+
function Chip(props, ref) {
|
|
25
|
+
var _a;
|
|
26
|
+
[props, ref] = useContextProps(props, ref, ChipContext);
|
|
27
|
+
const { stylingProps, ...ownProps } = useStyledSystem(props);
|
|
28
|
+
const {
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
size: sizeProp,
|
|
32
|
+
style,
|
|
33
|
+
slot,
|
|
34
|
+
variant = "neutral",
|
|
35
|
+
...otherProps
|
|
36
|
+
} = ownProps;
|
|
37
|
+
const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
|
|
38
|
+
const classNames = clsx(
|
|
39
|
+
className,
|
|
40
|
+
GlobalChipCssSelector,
|
|
41
|
+
cssModule(
|
|
42
|
+
Chip_module_default,
|
|
43
|
+
"hop-Chip",
|
|
44
|
+
size,
|
|
45
|
+
variant
|
|
46
|
+
),
|
|
47
|
+
stylingProps.className
|
|
48
|
+
);
|
|
49
|
+
const mergedStyles = {
|
|
50
|
+
...stylingProps.style,
|
|
51
|
+
...style
|
|
52
|
+
};
|
|
53
|
+
const content = children && isTextOnlyChildren(children) ? /* @__PURE__ */ jsx(_Text, { children }) : children;
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
SlotProvider,
|
|
56
|
+
{
|
|
57
|
+
values: [
|
|
58
|
+
[TextContext, {
|
|
59
|
+
className: Chip_module_default["hop-Chip__text"],
|
|
60
|
+
size: ChipToTextSizeAdapter[size]
|
|
61
|
+
}],
|
|
62
|
+
[IconListContext, {
|
|
63
|
+
slots: {
|
|
64
|
+
[DEFAULT_SLOT]: {
|
|
65
|
+
size: "sm",
|
|
66
|
+
className: Chip_module_default["hop-Chip__icon-list"]
|
|
67
|
+
},
|
|
68
|
+
"end-icon": {
|
|
69
|
+
size: "sm",
|
|
70
|
+
className: Chip_module_default["hop-Chip__end-icon-list"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}],
|
|
74
|
+
[IconContext, {
|
|
75
|
+
slots: {
|
|
76
|
+
[DEFAULT_SLOT]: {
|
|
77
|
+
size: "sm",
|
|
78
|
+
className: Chip_module_default["hop-Chip__icon"]
|
|
79
|
+
},
|
|
80
|
+
"end-icon": {
|
|
81
|
+
size: "sm",
|
|
82
|
+
className: Chip_module_default["hop-Chip__end-icon"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}]
|
|
86
|
+
],
|
|
87
|
+
children: /* @__PURE__ */ jsx(
|
|
88
|
+
"span",
|
|
89
|
+
{
|
|
90
|
+
...otherProps,
|
|
91
|
+
ref,
|
|
92
|
+
className: classNames,
|
|
93
|
+
style: mergedStyles,
|
|
94
|
+
slot: slot != null ? slot : void 0,
|
|
95
|
+
children: content
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
var _Chip = forwardRef(Chip);
|
|
102
|
+
_Chip.displayName = "Chip";
|
|
103
|
+
|
|
104
|
+
export { GlobalChipCssSelector, _Chip };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect } from '@hopper-ui/styled-system';
|
|
2
|
+
import { useState, useRef, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
// src/utils/src/useSlot.ts
|
|
5
|
+
function useSlot() {
|
|
6
|
+
const [hasSlot, setHasSlot] = useState(true);
|
|
7
|
+
const hasRun = useRef(false);
|
|
8
|
+
const ref = useCallback((el) => {
|
|
9
|
+
hasRun.current = true;
|
|
10
|
+
setHasSlot(!!el);
|
|
11
|
+
}, []);
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
if (!hasRun.current) {
|
|
14
|
+
setHasSlot(false);
|
|
15
|
+
}
|
|
16
|
+
}, []);
|
|
17
|
+
return [ref, hasSlot];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { useSlot };
|