@monimesl/dot-renderer-react 0.1.0-alpha.10
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/README.md +43 -0
- package/dist/LICENSE-PHOSPHOR +21 -0
- package/dist/_virtual/_rolldown/runtime.js +14 -0
- package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
- package/dist/color.js +105 -0
- package/dist/components/amount-input.d.ts +6 -0
- package/dist/components/amount-input.js +106 -0
- package/dist/components/button.d.ts +6 -0
- package/dist/components/button.js +42 -0
- package/dist/components/carousel.d.ts +6 -0
- package/dist/components/carousel.js +254 -0
- package/dist/components/chip.d.ts +6 -0
- package/dist/components/chip.js +41 -0
- package/dist/components/code-input.d.ts +6 -0
- package/dist/components/code-input.js +97 -0
- package/dist/components/detail-row.d.ts +6 -0
- package/dist/components/detail-row.js +40 -0
- package/dist/components/divider.d.ts +6 -0
- package/dist/components/divider.js +18 -0
- package/dist/components/empty-state.d.ts +6 -0
- package/dist/components/empty-state.js +66 -0
- package/dist/components/feedback.d.ts +8 -0
- package/dist/components/feedback.js +85 -0
- package/dist/components/field-box.js +44 -0
- package/dist/components/field.js +43 -0
- package/dist/components/footer.d.ts +6 -0
- package/dist/components/footer.js +24 -0
- package/dist/components/grid.d.ts +7 -0
- package/dist/components/grid.js +98 -0
- package/dist/components/icon-artwork.js +74 -0
- package/dist/components/icon.d.ts +6 -0
- package/dist/components/icon.js +40 -0
- package/dist/components/image.d.ts +6 -0
- package/dist/components/image.js +40 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.js +72 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +86 -0
- package/dist/components/link.d.ts +6 -0
- package/dist/components/link.js +39 -0
- package/dist/components/list.d.ts +7 -0
- package/dist/components/list.js +143 -0
- package/dist/components/option-place.js +9 -0
- package/dist/components/option.d.ts +6 -0
- package/dist/components/option.js +43 -0
- package/dist/components/padding.d.ts +2 -0
- package/dist/components/padding.js +27 -0
- package/dist/components/pressable.js +17 -0
- package/dist/components/qr-code.d.ts +6 -0
- package/dist/components/qr-code.js +58 -0
- package/dist/components/scroll.d.ts +6 -0
- package/dist/components/scroll.js +55 -0
- package/dist/components/select.d.ts +6 -0
- package/dist/components/select.js +92 -0
- package/dist/components/sheet.d.ts +8 -0
- package/dist/components/sheet.js +105 -0
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +55 -0
- package/dist/components/spinner.d.ts +6 -0
- package/dist/components/spinner.js +48 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.js +91 -0
- package/dist/components/text-area.d.ts +6 -0
- package/dist/components/text-area.js +42 -0
- package/dist/components/text.d.ts +6 -0
- package/dist/components/text.js +46 -0
- package/dist/components/toast.d.ts +6 -0
- package/dist/components/toast.js +56 -0
- package/dist/components/toggles.d.ts +9 -0
- package/dist/components/toggles.js +149 -0
- package/dist/components/tokens.js +37 -0
- package/dist/components/tones.js +24 -0
- package/dist/components/typed-text.js +28 -0
- package/dist/components/view.d.ts +6 -0
- package/dist/components/view.js +51 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +35 -0
- package/dist/page-root.d.ts +2 -0
- package/dist/page-root.js +20 -0
- package/dist/portal.js +8 -0
- package/dist/react-host/19.3.0/react-dom-client.js +3 -0
- package/dist/react-host/19.3.0/react-dom.js +3 -0
- package/dist/react-host/19.3.0/react-host.js +59 -0
- package/dist/react-host/19.3.0/react-jsx-runtime.js +3 -0
- package/dist/react-host/19.3.0/react.js +3 -0
- package/dist/renderer.d.ts +17 -0
- package/dist/renderer.js +33 -0
- package/dist/root.d.ts +10 -0
- package/dist/root.js +51 -0
- package/dist/styles.css +95 -0
- package/dist/theme.d.ts +25 -0
- package/dist/theme.js +84 -0
- package/dist/types.d.ts +7 -0
- package/dist/vendor/@base-ui/react/checkbox/indicator/CheckboxIndicator.js +51 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRoot.js +265 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/checkbox/utils/getCheckboxStateAttributesMapping.js +15 -0
- package/dist/vendor/@base-ui/react/checkbox-group/CheckboxGroupContext.js +10 -0
- package/dist/vendor/@base-ui/react/dialog/backdrop/DialogBackdrop.js +40 -0
- package/dist/vendor/@base-ui/react/dialog/close/DialogClose.js +39 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopup.js +92 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupCssVars.js +8 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupDataAttributes.js +7 -0
- package/dist/vendor/@base-ui/react/dialog/portal/DialogPortal.js +38 -0
- package/dist/vendor/@base-ui/react/dialog/portal/DialogPortalContext.js +13 -0
- package/dist/vendor/@base-ui/react/dialog/root/DialogRoot.js +16 -0
- package/dist/vendor/@base-ui/react/dialog/root/DialogRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/dialog/root/useDialogRoot.js +77 -0
- package/dist/vendor/@base-ui/react/dialog/root/useRenderDialogRoot.js +65 -0
- package/dist/vendor/@base-ui/react/dialog/store/DialogStore.js +70 -0
- package/dist/vendor/@base-ui/react/dialog/title/DialogTitle.js +25 -0
- package/dist/vendor/@base-ui/react/dialog/utils/stateAttributesMapping.js +17 -0
- package/dist/vendor/@base-ui/react/field/control/FieldControlDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/field/item/FieldItemContext.js +10 -0
- package/dist/vendor/@base-ui/react/field/root/useFieldValidation.js +18 -0
- package/dist/vendor/@base-ui/react/fieldset/root/FieldsetRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingFocusManager.js +477 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingPortal.js +165 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingRootStore.js +65 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingTree.js +22 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useDismiss.js +373 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.js +58 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/composite.js +40 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/constants.js +5 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/createAttribute.js +6 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/createEventEmitter.js +18 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/element.js +26 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/enqueueFocus.js +25 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/event.js +25 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/markOthers.js +116 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/nodes.js +16 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/tabbable.js +135 -0
- package/dist/vendor/@base-ui/react/internals/TransitionStatusDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/internals/composite/composite.js +89 -0
- package/dist/vendor/@base-ui/react/internals/composite/constants.js +4 -0
- package/dist/vendor/@base-ui/react/internals/composite/item/CompositeItem.js +21 -0
- package/dist/vendor/@base-ui/react/internals/composite/item/useCompositeItem.js +31 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/CompositeList.js +180 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/CompositeListContext.js +15 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/useCompositeListItem.js +54 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRoot.js +62 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/useCompositeRoot.js +170 -0
- package/dist/vendor/@base-ui/react/internals/constants.js +18 -0
- package/dist/vendor/@base-ui/react/internals/createBaseUIEventDetails.js +40 -0
- package/dist/vendor/@base-ui/react/internals/direction-context/DirectionContext.js +10 -0
- package/dist/vendor/@base-ui/react/internals/field-constants/constants.js +33 -0
- package/dist/vendor/@base-ui/react/internals/field-register-control/useRegisterFieldControl.js +40 -0
- package/dist/vendor/@base-ui/react/internals/field-root-context/FieldRootContext.js +45 -0
- package/dist/vendor/@base-ui/react/internals/form-context/FormContext.js +18 -0
- package/dist/vendor/@base-ui/react/internals/getStateAttributesProps.js +17 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/LabelableContext.js +24 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.js +35 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/useLabelableId.js +57 -0
- package/dist/vendor/@base-ui/react/internals/reason-parts.js +14 -0
- package/dist/vendor/@base-ui/react/internals/serializeValue.js +12 -0
- package/dist/vendor/@base-ui/react/internals/stateAttributesMapping.js +11 -0
- package/dist/vendor/@base-ui/react/internals/use-button/useButton.js +137 -0
- package/dist/vendor/@base-ui/react/internals/useAnimationsFinished.js +94 -0
- package/dist/vendor/@base-ui/react/internals/useBaseUiId.js +13 -0
- package/dist/vendor/@base-ui/react/internals/useOpenChangeComplete.js +28 -0
- package/dist/vendor/@base-ui/react/internals/useRenderElement.js +109 -0
- package/dist/vendor/@base-ui/react/internals/useTransitionStatus.js +70 -0
- package/dist/vendor/@base-ui/react/internals/useValueChanged.js +15 -0
- package/dist/vendor/@base-ui/react/merge-props/mergeProps.js +153 -0
- package/dist/vendor/@base-ui/react/radio/indicator/RadioIndicator.js +46 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRoot.js +179 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/radio/utils/stateAttributesMapping.js +14 -0
- package/dist/vendor/@base-ui/react/radio-group/RadioGroup.js +170 -0
- package/dist/vendor/@base-ui/react/radio-group/RadioGroupContext.js +10 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRoot.js +170 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/switch/stateAttributesMapping.js +12 -0
- package/dist/vendor/@base-ui/react/switch/thumb/SwitchThumb.js +25 -0
- package/dist/vendor/@base-ui/react/tabs/list/TabsList.js +98 -0
- package/dist/vendor/@base-ui/react/tabs/list/TabsListContext.js +13 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRoot.js +213 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRootContext.js +16 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRootDataAttributes.js +8 -0
- package/dist/vendor/@base-ui/react/tabs/root/stateAttributesMapping.js +5 -0
- package/dist/vendor/@base-ui/react/tabs/tab/TabsTab.js +137 -0
- package/dist/vendor/@base-ui/react/utils/CommonPopupDataAttributes.js +24 -0
- package/dist/vendor/@base-ui/react/utils/CommonTriggerDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/utils/FocusGuard.js +32 -0
- package/dist/vendor/@base-ui/react/utils/InternalBackdrop.js +30 -0
- package/dist/vendor/@base-ui/react/utils/dispatchClickWithModifiers.js +25 -0
- package/dist/vendor/@base-ui/react/utils/popupStateMapping.js +22 -0
- package/dist/vendor/@base-ui/react/utils/popups/popupStoreUtils.js +247 -0
- package/dist/vendor/@base-ui/react/utils/popups/popupTriggerMap.js +96 -0
- package/dist/vendor/@base-ui/react/utils/popups/store.js +94 -0
- package/dist/vendor/@base-ui/react/utils/resolveClassName.js +13 -0
- package/dist/vendor/@base-ui/react/utils/resolveRef.js +11 -0
- package/dist/vendor/@base-ui/react/utils/resolveStyle.js +13 -0
- package/dist/vendor/@base-ui/react/utils/useFocusableWhenDisabled.js +30 -0
- package/dist/vendor/@base-ui/utils/addEventListener.js +12 -0
- package/dist/vendor/@base-ui/utils/createLogOnce.js +20 -0
- package/dist/vendor/@base-ui/utils/empty.js +6 -0
- package/dist/vendor/@base-ui/utils/error.js +5 -0
- package/dist/vendor/@base-ui/utils/fastHooks.js +68 -0
- package/dist/vendor/@base-ui/utils/formatErrorMessage.js +27 -0
- package/dist/vendor/@base-ui/utils/getDefaultFormSubmitter.js +25 -0
- package/dist/vendor/@base-ui/utils/getReactElementRef.js +14 -0
- package/dist/vendor/@base-ui/utils/inertValue.js +8 -0
- package/dist/vendor/@base-ui/utils/isElementDisabled.js +6 -0
- package/dist/vendor/@base-ui/utils/mergeCleanups.js +14 -0
- package/dist/vendor/@base-ui/utils/mergeObjects.js +11 -0
- package/dist/vendor/@base-ui/utils/owner.js +7 -0
- package/dist/vendor/@base-ui/utils/platform/engine.js +8 -0
- package/dist/vendor/@base-ui/utils/platform/env.js +6 -0
- package/dist/vendor/@base-ui/utils/platform/os.js +15 -0
- package/dist/vendor/@base-ui/utils/platform/screen-reader.js +9 -0
- package/dist/vendor/@base-ui/utils/platform/shared.js +36 -0
- package/dist/vendor/@base-ui/utils/reactVersion.js +8 -0
- package/dist/vendor/@base-ui/utils/safeReact.js +13 -0
- package/dist/vendor/@base-ui/utils/shadowDom.js +26 -0
- package/dist/vendor/@base-ui/utils/store/ReactStore.js +181 -0
- package/dist/vendor/@base-ui/utils/store/Store.js +102 -0
- package/dist/vendor/@base-ui/utils/store/useStore.js +97 -0
- package/dist/vendor/@base-ui/utils/useAnimationFrame.js +87 -0
- package/dist/vendor/@base-ui/utils/useControlled.js +52 -0
- package/dist/vendor/@base-ui/utils/useId.js +32 -0
- package/dist/vendor/@base-ui/utils/useIsoLayoutEffect.js +7 -0
- package/dist/vendor/@base-ui/utils/useMergedRefs.js +87 -0
- package/dist/vendor/@base-ui/utils/useOnMount.js +12 -0
- package/dist/vendor/@base-ui/utils/useRefWithInit.js +18 -0
- package/dist/vendor/@base-ui/utils/useScrollLock.js +206 -0
- package/dist/vendor/@base-ui/utils/useStableCallback.js +38 -0
- package/dist/vendor/@base-ui/utils/useTimeout.js +43 -0
- package/dist/vendor/@base-ui/utils/useValueAsRef.js +27 -0
- package/dist/vendor/@base-ui/utils/visuallyHidden.js +23 -0
- package/dist/vendor/@base-ui/utils/warn.js +5 -0
- package/dist/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js +49 -0
- package/dist/vendor/uqr/dist/index.js +858 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +74 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +77 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +69 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +64 -0
- package/dist/vendor/use-sync-external-store/shim/index.js +11 -0
- package/dist/vendor/use-sync-external-store/shim/with-selector.js +11 -0
- package/package.json +61 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Field } from "./field.js";
|
|
2
|
+
import { useFieldBox, useFieldNote } from "./field-box.js";
|
|
3
|
+
import { useTypedText } from "./typed-text.js";
|
|
4
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/text-area.tsx
|
|
7
|
+
const TextArea$1 = ({ value, placeholder, label, hint, error, rows = 3, maxLength, disabled, onChange }) => {
|
|
8
|
+
const [text, typeText] = useTypedText(value, onChange !== void 0);
|
|
9
|
+
const box = useFieldBox(error, disabled);
|
|
10
|
+
const { noteId, controlAttributes } = useFieldNote(hint, error);
|
|
11
|
+
return /* @__PURE__ */ jsx(Field, {
|
|
12
|
+
label,
|
|
13
|
+
hint,
|
|
14
|
+
error,
|
|
15
|
+
noteId,
|
|
16
|
+
children: /* @__PURE__ */ jsx("textarea", {
|
|
17
|
+
className: "dot-text-area",
|
|
18
|
+
value: text,
|
|
19
|
+
placeholder,
|
|
20
|
+
rows,
|
|
21
|
+
maxLength,
|
|
22
|
+
disabled,
|
|
23
|
+
...controlAttributes,
|
|
24
|
+
onFocus: box.onFocus,
|
|
25
|
+
onBlur: box.onBlur,
|
|
26
|
+
onChange: (event) => {
|
|
27
|
+
const next = event.currentTarget.value;
|
|
28
|
+
typeText(next);
|
|
29
|
+
onChange?.(createEvent("change", { value: next }));
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
...box.style,
|
|
33
|
+
width: "100%",
|
|
34
|
+
padding: "12px 14px",
|
|
35
|
+
outline: "none",
|
|
36
|
+
resize: "none"
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { TextArea$1 as TextArea };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { paddingStyle } from "./padding.js";
|
|
4
|
+
import { toneColor } from "./tones.js";
|
|
5
|
+
import { createContext, useContext } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/text.tsx
|
|
8
|
+
const InsideText = createContext(false);
|
|
9
|
+
const Text = ({ variant = "body", tone, weight, align, maxLines, children, ...padding }) => {
|
|
10
|
+
const { colors } = useTheme();
|
|
11
|
+
const nested = useContext(InsideText);
|
|
12
|
+
const defaultWeight = variant === "title" ? "bold" : "regular";
|
|
13
|
+
const style = {
|
|
14
|
+
display: nested ? "inline" : "block",
|
|
15
|
+
margin: 0,
|
|
16
|
+
fontSize: FONT_SIZE[variant],
|
|
17
|
+
lineHeight: "normal",
|
|
18
|
+
fontWeight: WEIGHTS[weight ?? defaultWeight],
|
|
19
|
+
letterSpacing: "normal",
|
|
20
|
+
color: tone ? toneColor(colors, tone) : "inherit",
|
|
21
|
+
textAlign: align,
|
|
22
|
+
...paddingStyle(padding)
|
|
23
|
+
};
|
|
24
|
+
if (maxLines) {
|
|
25
|
+
style.display = "-webkit-box";
|
|
26
|
+
style.WebkitLineClamp = maxLines;
|
|
27
|
+
style.WebkitBoxOrient = "vertical";
|
|
28
|
+
style.overflow = "hidden";
|
|
29
|
+
}
|
|
30
|
+
const content = /* @__PURE__ */ jsx(InsideText.Provider, {
|
|
31
|
+
value: true,
|
|
32
|
+
children
|
|
33
|
+
});
|
|
34
|
+
if (variant === "title" && !nested) return /* @__PURE__ */ jsx("h2", {
|
|
35
|
+
className: "dot-text",
|
|
36
|
+
style,
|
|
37
|
+
children: content
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsx("span", {
|
|
40
|
+
className: "dot-text",
|
|
41
|
+
style,
|
|
42
|
+
children: content
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Text };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, ICON_SIZE, SPACE } from "./tokens.js";
|
|
3
|
+
import { STATUS_ICONS } from "./tones.js";
|
|
4
|
+
import { IconGraphic } from "./icon.js";
|
|
5
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
6
|
+
import { useEffect, useEffectEvent, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/toast.tsx
|
|
9
|
+
const Toast$1 = ({ message, tone = "default", duration = 2500, onHide }) => {
|
|
10
|
+
const { colors, radius } = useTheme();
|
|
11
|
+
const [hidden, setHidden] = useState(false);
|
|
12
|
+
const [previousMessage, setPreviousMessage] = useState(message);
|
|
13
|
+
if (message !== previousMessage) {
|
|
14
|
+
setPreviousMessage(message);
|
|
15
|
+
setHidden(false);
|
|
16
|
+
}
|
|
17
|
+
const hide = useEffectEvent(() => {
|
|
18
|
+
setHidden(true);
|
|
19
|
+
onHide?.(createEvent("hide"));
|
|
20
|
+
});
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!message) return;
|
|
23
|
+
const timer = setTimeout(hide, duration);
|
|
24
|
+
return () => clearTimeout(timer);
|
|
25
|
+
}, [message, duration]);
|
|
26
|
+
if (!message || hidden) return null;
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: "dot-toast",
|
|
29
|
+
role: "status",
|
|
30
|
+
style: {
|
|
31
|
+
position: "fixed",
|
|
32
|
+
top: SPACE.large,
|
|
33
|
+
left: "50%",
|
|
34
|
+
transform: "translateX(-50%)",
|
|
35
|
+
zIndex: 110,
|
|
36
|
+
display: "flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
gap: SPACE.medium,
|
|
39
|
+
maxWidth: "calc(100% - 32px)",
|
|
40
|
+
width: "max-content",
|
|
41
|
+
padding: "10px 16px",
|
|
42
|
+
borderRadius: radius,
|
|
43
|
+
background: colors.primary,
|
|
44
|
+
color: colors.onPrimary,
|
|
45
|
+
fontSize: FONT_SIZE.body,
|
|
46
|
+
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.2)"
|
|
47
|
+
},
|
|
48
|
+
children: [tone === "default" ? null : /* @__PURE__ */ jsx(IconGraphic, {
|
|
49
|
+
name: STATUS_ICONS[tone],
|
|
50
|
+
size: ICON_SIZE.medium,
|
|
51
|
+
color: colors.onPrimary
|
|
52
|
+
}), /* @__PURE__ */ jsx("span", { children: message })]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Toast$1 as Toast };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactComponent } from "../types.js";
|
|
2
|
+
import { Checkbox, Radio, RadioGroup, Switch } from "@monimesl/dot-core";
|
|
3
|
+
//#region src/components/toggles.d.ts
|
|
4
|
+
declare const Switch$1: ReactComponent<typeof Switch>;
|
|
5
|
+
declare const Checkbox$1: ReactComponent<typeof Checkbox>;
|
|
6
|
+
declare const RadioGroup$1: ReactComponent<typeof RadioGroup>;
|
|
7
|
+
declare const Radio$1: ReactComponent<typeof Radio>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Checkbox$1 as Checkbox, Radio$1 as Radio, RadioGroup$1 as RadioGroup, Switch$1 as Switch };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { DISABLED_OPACITY, FONT_SIZE, ICON_SIZE, SPACE } from "./tokens.js";
|
|
3
|
+
import { FieldLabel } from "./field.js";
|
|
4
|
+
import { IconGraphic } from "./icon.js";
|
|
5
|
+
import { CheckboxRoot } from "../vendor/@base-ui/react/checkbox/root/CheckboxRoot.js";
|
|
6
|
+
import { CheckboxIndicator } from "../vendor/@base-ui/react/checkbox/indicator/CheckboxIndicator.js";
|
|
7
|
+
import { RadioRoot } from "../vendor/@base-ui/react/radio/root/RadioRoot.js";
|
|
8
|
+
import { RadioIndicator } from "../vendor/@base-ui/react/radio/indicator/RadioIndicator.js";
|
|
9
|
+
import { RadioGroup as RadioGroup$2 } from "../vendor/@base-ui/react/radio-group/RadioGroup.js";
|
|
10
|
+
import { SwitchRoot } from "../vendor/@base-ui/react/switch/root/SwitchRoot.js";
|
|
11
|
+
import { SwitchThumb } from "../vendor/@base-ui/react/switch/thumb/SwitchThumb.js";
|
|
12
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
13
|
+
import { useId } from "react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
//#region src/components/toggles.tsx
|
|
16
|
+
function rowStyle(colors, disabled) {
|
|
17
|
+
return {
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
gap: 12,
|
|
21
|
+
width: "100%",
|
|
22
|
+
padding: "6px 0",
|
|
23
|
+
border: "none",
|
|
24
|
+
background: "transparent",
|
|
25
|
+
color: colors.text,
|
|
26
|
+
fontSize: FONT_SIZE.body,
|
|
27
|
+
textAlign: "start",
|
|
28
|
+
opacity: disabled ? DISABLED_OPACITY : 1,
|
|
29
|
+
cursor: disabled ? "default" : "pointer"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function ChoiceMark({ round, checked, children }) {
|
|
33
|
+
const { colors } = useTheme();
|
|
34
|
+
const filled = checked && !round;
|
|
35
|
+
return /* @__PURE__ */ jsx("span", {
|
|
36
|
+
style: {
|
|
37
|
+
display: "flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
width: 22,
|
|
42
|
+
height: 22,
|
|
43
|
+
borderRadius: round ? "50%" : 6,
|
|
44
|
+
border: `2px solid ${checked ? colors.primary : colors.subtle}`,
|
|
45
|
+
background: filled ? colors.primary : "transparent"
|
|
46
|
+
},
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const Switch$1 = ({ checked = false, label, disabled, onChange }) => {
|
|
51
|
+
const { colors } = useTheme();
|
|
52
|
+
return /* @__PURE__ */ jsxs(SwitchRoot, {
|
|
53
|
+
className: "dot-switch",
|
|
54
|
+
checked,
|
|
55
|
+
disabled,
|
|
56
|
+
onCheckedChange: (next) => onChange?.(createEvent("change", { checked: next })),
|
|
57
|
+
style: {
|
|
58
|
+
...rowStyle(colors, disabled),
|
|
59
|
+
justifyContent: "space-between"
|
|
60
|
+
},
|
|
61
|
+
children: [label ? /* @__PURE__ */ jsx("span", { children: label }) : null, /* @__PURE__ */ jsx("span", {
|
|
62
|
+
style: {
|
|
63
|
+
position: "relative",
|
|
64
|
+
flexShrink: 0,
|
|
65
|
+
width: 44,
|
|
66
|
+
height: 26,
|
|
67
|
+
borderRadius: 13,
|
|
68
|
+
background: checked ? colors.primary : colors.subtle,
|
|
69
|
+
transition: "background 0.2s"
|
|
70
|
+
},
|
|
71
|
+
children: /* @__PURE__ */ jsx(SwitchThumb, { style: {
|
|
72
|
+
position: "absolute",
|
|
73
|
+
top: 2,
|
|
74
|
+
left: checked ? 20 : 2,
|
|
75
|
+
width: 22,
|
|
76
|
+
height: 22,
|
|
77
|
+
borderRadius: "50%",
|
|
78
|
+
background: colors.surface,
|
|
79
|
+
transition: "left 0.2s"
|
|
80
|
+
} })
|
|
81
|
+
})]
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const Checkbox$1 = ({ checked = false, label, disabled, onChange }) => {
|
|
85
|
+
const { colors } = useTheme();
|
|
86
|
+
return /* @__PURE__ */ jsxs(CheckboxRoot, {
|
|
87
|
+
className: "dot-checkbox",
|
|
88
|
+
checked,
|
|
89
|
+
disabled,
|
|
90
|
+
onCheckedChange: (next) => onChange?.(createEvent("change", { checked: next })),
|
|
91
|
+
style: rowStyle(colors, disabled),
|
|
92
|
+
children: [/* @__PURE__ */ jsx(ChoiceMark, {
|
|
93
|
+
round: false,
|
|
94
|
+
checked,
|
|
95
|
+
children: /* @__PURE__ */ jsx(CheckboxIndicator, {
|
|
96
|
+
style: { display: "flex" },
|
|
97
|
+
children: /* @__PURE__ */ jsx(IconGraphic, {
|
|
98
|
+
name: "check",
|
|
99
|
+
size: ICON_SIZE.small,
|
|
100
|
+
color: colors.onPrimary
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
}), label ? /* @__PURE__ */ jsx("span", { children: label }) : null]
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const RadioGroup$1 = ({ value, label, disabled = false, onChange, children }) => {
|
|
107
|
+
const labelId = useId();
|
|
108
|
+
return /* @__PURE__ */ jsxs(RadioGroup$2, {
|
|
109
|
+
className: "dot-radio-group",
|
|
110
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
111
|
+
value: value ?? "",
|
|
112
|
+
disabled,
|
|
113
|
+
onValueChange: (next) => onChange?.(createEvent("change", { value: String(next) })),
|
|
114
|
+
style: {
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column",
|
|
117
|
+
gap: SPACE.small
|
|
118
|
+
},
|
|
119
|
+
children: [label ? /* @__PURE__ */ jsx(FieldLabel, {
|
|
120
|
+
id: labelId,
|
|
121
|
+
children: label
|
|
122
|
+
}) : null, children]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const Radio$1 = ({ value, label, disabled }) => {
|
|
126
|
+
const { colors } = useTheme();
|
|
127
|
+
if (value === void 0) return null;
|
|
128
|
+
return /* @__PURE__ */ jsx(RadioRoot, {
|
|
129
|
+
className: "dot-radio",
|
|
130
|
+
value,
|
|
131
|
+
disabled,
|
|
132
|
+
style: (state) => rowStyle(colors, state.disabled),
|
|
133
|
+
render: (props, state) => /* @__PURE__ */ jsxs("span", {
|
|
134
|
+
...props,
|
|
135
|
+
children: [/* @__PURE__ */ jsx(ChoiceMark, {
|
|
136
|
+
round: true,
|
|
137
|
+
checked: state.checked,
|
|
138
|
+
children: /* @__PURE__ */ jsx(RadioIndicator, { style: {
|
|
139
|
+
width: 10,
|
|
140
|
+
height: 10,
|
|
141
|
+
borderRadius: "50%",
|
|
142
|
+
background: colors.primary
|
|
143
|
+
} })
|
|
144
|
+
}), label ? /* @__PURE__ */ jsx("span", { children: label }) : null]
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
//#endregion
|
|
149
|
+
export { Checkbox$1 as Checkbox, Radio$1 as Radio, RadioGroup$1 as RadioGroup, Switch$1 as Switch };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/components/tokens.ts
|
|
2
|
+
const SPACE = {
|
|
3
|
+
none: 0,
|
|
4
|
+
small: 4,
|
|
5
|
+
medium: 8,
|
|
6
|
+
large: 16
|
|
7
|
+
};
|
|
8
|
+
const FONT_SIZE = {
|
|
9
|
+
caption: 13,
|
|
10
|
+
body: 15,
|
|
11
|
+
title: 20
|
|
12
|
+
};
|
|
13
|
+
const WEIGHTS = {
|
|
14
|
+
regular: 400,
|
|
15
|
+
medium: 500,
|
|
16
|
+
bold: 600
|
|
17
|
+
};
|
|
18
|
+
const CARD_RADIUS_SCALE = 1.5;
|
|
19
|
+
const DISABLED_OPACITY = .6;
|
|
20
|
+
const ICON_SIZE = {
|
|
21
|
+
small: 16,
|
|
22
|
+
medium: 20,
|
|
23
|
+
large: 28
|
|
24
|
+
};
|
|
25
|
+
const PILL_STYLE = {
|
|
26
|
+
boxSizing: "content-box",
|
|
27
|
+
minWidth: 18,
|
|
28
|
+
minHeight: 16,
|
|
29
|
+
padding: "1px 6px",
|
|
30
|
+
borderRadius: 9,
|
|
31
|
+
fontSize: 11,
|
|
32
|
+
fontWeight: WEIGHTS.bold,
|
|
33
|
+
lineHeight: "16px",
|
|
34
|
+
textAlign: "center"
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { CARD_RADIUS_SCALE, DISABLED_OPACITY, FONT_SIZE, ICON_SIZE, PILL_STYLE, SPACE, WEIGHTS };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/components/tones.ts
|
|
2
|
+
const STATUS_ICONS = {
|
|
3
|
+
default: "info",
|
|
4
|
+
info: "info",
|
|
5
|
+
success: "success",
|
|
6
|
+
warning: "warning",
|
|
7
|
+
danger: "error"
|
|
8
|
+
};
|
|
9
|
+
function toneColor(colors, tone) {
|
|
10
|
+
switch (tone) {
|
|
11
|
+
case "default": return colors.text;
|
|
12
|
+
case "muted": return colors.subtle;
|
|
13
|
+
default: return colors[tone];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function toneBackground(colors, tone) {
|
|
17
|
+
if (tone === "default" || tone === "muted") return colors.muted;
|
|
18
|
+
return withOpacity(colors[tone], .14);
|
|
19
|
+
}
|
|
20
|
+
function withOpacity(color, opacity) {
|
|
21
|
+
return `${color}${Math.round(opacity * 255).toString(16).padStart(2, "0")}`;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { STATUS_ICONS, toneBackground, toneColor };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
//#region src/components/typed-text.ts
|
|
3
|
+
function useTypedText(value, sendsChanges, show = (text) => text) {
|
|
4
|
+
const [text, setText] = useState(() => show(value ?? ""));
|
|
5
|
+
const [awaitingEcho, setAwaitingEcho] = useState([]);
|
|
6
|
+
const [previousValue, setPreviousValue] = useState(value);
|
|
7
|
+
if (value !== previousValue) {
|
|
8
|
+
setPreviousValue(value);
|
|
9
|
+
const echo = awaitingEcho.indexOf(value ?? "");
|
|
10
|
+
if (echo >= 0) setAwaitingEcho(awaitingEcho.slice(echo + 1));
|
|
11
|
+
else {
|
|
12
|
+
setAwaitingEcho([]);
|
|
13
|
+
setText(show(value ?? ""));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const type = (next, sent = next) => {
|
|
17
|
+
setText(next);
|
|
18
|
+
if (sendsChanges && value !== void 0) setAwaitingEcho([...awaitingEcho, sent]);
|
|
19
|
+
};
|
|
20
|
+
const reshow = (next) => setText(next);
|
|
21
|
+
return [
|
|
22
|
+
text,
|
|
23
|
+
type,
|
|
24
|
+
reshow
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { useTypedText };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { CARD_RADIUS_SCALE, SPACE } from "./tokens.js";
|
|
3
|
+
import { insets, paddingStyle } from "./padding.js";
|
|
4
|
+
import { pressable } from "./pressable.js";
|
|
5
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/view.tsx
|
|
8
|
+
const ALIGN = {
|
|
9
|
+
stretch: "stretch",
|
|
10
|
+
start: "flex-start",
|
|
11
|
+
center: "center",
|
|
12
|
+
end: "flex-end"
|
|
13
|
+
};
|
|
14
|
+
const JUSTIFY = {
|
|
15
|
+
start: "flex-start",
|
|
16
|
+
center: "center",
|
|
17
|
+
end: "flex-end",
|
|
18
|
+
between: "space-between"
|
|
19
|
+
};
|
|
20
|
+
const View$1 = ({ direction = "column", gap = "medium", align = "stretch", justify = "start", wrap = false, grow = false, variant = "plain", onTap, children, ...padding }) => {
|
|
21
|
+
const { colors, radius } = useTheme();
|
|
22
|
+
const card = variant === "card";
|
|
23
|
+
const style = {
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexDirection: direction,
|
|
26
|
+
alignItems: ALIGN[align],
|
|
27
|
+
justifyContent: JUSTIFY[justify],
|
|
28
|
+
flexWrap: wrap ? "wrap" : "nowrap",
|
|
29
|
+
gap: SPACE[gap],
|
|
30
|
+
...paddingStyle(padding, card ? insets(SPACE.large) : void 0),
|
|
31
|
+
cursor: onTap ? "pointer" : void 0
|
|
32
|
+
};
|
|
33
|
+
if (grow) {
|
|
34
|
+
style.flexGrow = 1;
|
|
35
|
+
style.minWidth = 0;
|
|
36
|
+
}
|
|
37
|
+
if (card) {
|
|
38
|
+
style.background = colors.surface;
|
|
39
|
+
style.border = `1px solid ${colors.border}`;
|
|
40
|
+
style.borderRadius = radius * CARD_RADIUS_SCALE;
|
|
41
|
+
}
|
|
42
|
+
const press = onTap ? pressable(() => onTap(createEvent("tap"))) : void 0;
|
|
43
|
+
return /* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "dot-view",
|
|
45
|
+
style,
|
|
46
|
+
...press,
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { View$1 as View };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Wrapper } from "./root.js";
|
|
2
|
+
import { BuiltinReactComponents, ReactComponent, ReactComponents } from "./types.js";
|
|
3
|
+
import { CreateReactRendererOptions, ReactRendererOptions, createReactRenderer, reactRenderer } from "./renderer.js";
|
|
4
|
+
import { AmountInput } from "./components/amount-input.js";
|
|
5
|
+
import { Button } from "./components/button.js";
|
|
6
|
+
import { Carousel } from "./components/carousel.js";
|
|
7
|
+
import { Chip } from "./components/chip.js";
|
|
8
|
+
import { CodeInput } from "./components/code-input.js";
|
|
9
|
+
import { DetailRow } from "./components/detail-row.js";
|
|
10
|
+
import { Divider } from "./components/divider.js";
|
|
11
|
+
import { EmptyState } from "./components/empty-state.js";
|
|
12
|
+
import { Badge, Notice, ProgressBar } from "./components/feedback.js";
|
|
13
|
+
import { Footer } from "./components/footer.js";
|
|
14
|
+
import { Grid, GridItem } from "./components/grid.js";
|
|
15
|
+
import { Icon } from "./components/icon.js";
|
|
16
|
+
import { Image } from "./components/image.js";
|
|
17
|
+
import { Input } from "./components/input.js";
|
|
18
|
+
import { Link } from "./components/link.js";
|
|
19
|
+
import { List, ListItem } from "./components/list.js";
|
|
20
|
+
import { Option } from "./components/option.js";
|
|
21
|
+
import { QRCode } from "./components/qr-code.js";
|
|
22
|
+
import { Scroll } from "./components/scroll.js";
|
|
23
|
+
import { Select } from "./components/select.js";
|
|
24
|
+
import { Sheet } from "./components/sheet.js";
|
|
25
|
+
import { Skeleton } from "./components/skeleton.js";
|
|
26
|
+
import { Spinner } from "./components/spinner.js";
|
|
27
|
+
import { Tab, Tabs } from "./components/tabs.js";
|
|
28
|
+
import { Text } from "./components/text.js";
|
|
29
|
+
import { TextArea } from "./components/text-area.js";
|
|
30
|
+
import { Toast } from "./components/toast.js";
|
|
31
|
+
import { Checkbox, Radio, RadioGroup, Switch } from "./components/toggles.js";
|
|
32
|
+
import { View } from "./components/view.js";
|
|
33
|
+
import "./components/index.js";
|
|
34
|
+
import { ResolvedColors, ResolvedTheme, resolveTheme, useTheme } from "./theme.js";
|
|
35
|
+
export { AmountInput, Badge, type BuiltinReactComponents, Button, Carousel, Checkbox, Chip, CodeInput, type CreateReactRendererOptions, DetailRow, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, ProgressBar, QRCode, Radio, RadioGroup, type ReactComponent, type ReactComponents, type ReactRendererOptions, type ResolvedColors, type ResolvedTheme, Scroll, Select, Sheet, Skeleton, Spinner, Switch, Tab, Tabs, Text, TextArea, Toast, View, type Wrapper, createReactRenderer, reactRenderer as default, resolveTheme, useTheme };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { resolveTheme, useTheme } from "./theme.js";
|
|
2
|
+
import { AmountInput } from "./components/amount-input.js";
|
|
3
|
+
import { Spinner } from "./components/spinner.js";
|
|
4
|
+
import { Button } from "./components/button.js";
|
|
5
|
+
import { Carousel } from "./components/carousel.js";
|
|
6
|
+
import { Icon } from "./components/icon.js";
|
|
7
|
+
import { Chip } from "./components/chip.js";
|
|
8
|
+
import { CodeInput } from "./components/code-input.js";
|
|
9
|
+
import { DetailRow } from "./components/detail-row.js";
|
|
10
|
+
import { Divider } from "./components/divider.js";
|
|
11
|
+
import { EmptyState } from "./components/empty-state.js";
|
|
12
|
+
import { Badge, Notice, ProgressBar } from "./components/feedback.js";
|
|
13
|
+
import { Footer } from "./components/footer.js";
|
|
14
|
+
import { Grid, GridItem } from "./components/grid.js";
|
|
15
|
+
import { Image } from "./components/image.js";
|
|
16
|
+
import { Input } from "./components/input.js";
|
|
17
|
+
import { Link } from "./components/link.js";
|
|
18
|
+
import { List, ListItem } from "./components/list.js";
|
|
19
|
+
import { Option } from "./components/option.js";
|
|
20
|
+
import { QRCode } from "./components/qr-code.js";
|
|
21
|
+
import { Scroll } from "./components/scroll.js";
|
|
22
|
+
import { Sheet } from "./components/sheet.js";
|
|
23
|
+
import { Select } from "./components/select.js";
|
|
24
|
+
import { Skeleton } from "./components/skeleton.js";
|
|
25
|
+
import { Tab, Tabs } from "./components/tabs.js";
|
|
26
|
+
import { Text } from "./components/text.js";
|
|
27
|
+
import { TextArea } from "./components/text-area.js";
|
|
28
|
+
import { Toast } from "./components/toast.js";
|
|
29
|
+
import { Checkbox, Radio, RadioGroup, Switch } from "./components/toggles.js";
|
|
30
|
+
import { View } from "./components/view.js";
|
|
31
|
+
import { createReactRenderer, reactRenderer } from "./renderer.js";
|
|
32
|
+
//#region src/index.ts
|
|
33
|
+
var src_default = reactRenderer;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { AmountInput, Badge, Button, Carousel, Checkbox, Chip, CodeInput, DetailRow, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, ProgressBar, QRCode, Radio, RadioGroup, Scroll, Select, Sheet, Skeleton, Spinner, Switch, Tab, Tabs, Text, TextArea, Toast, View, createReactRenderer, src_default as default, resolveTheme, useTheme };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { toList, toText } from "@monimesl/dot-core";
|
|
2
|
+
import { Fragment, createElement, useMemo, useSyncExternalStore } from "react";
|
|
3
|
+
//#region src/page-root.tsx
|
|
4
|
+
function PageRoot({ page, components }) {
|
|
5
|
+
const state = useSyncExternalStore(page.subscribe, page.getState);
|
|
6
|
+
const context = useMemo(() => ({
|
|
7
|
+
h(type, props, ...children) {
|
|
8
|
+
const component = components[type];
|
|
9
|
+
if (!component) throw new Error(`The renderer has no component for <${type}>. Check the tag's name, or pass a component for it to the renderer.`);
|
|
10
|
+
return createElement(component, props, ...children);
|
|
11
|
+
},
|
|
12
|
+
text: toText,
|
|
13
|
+
on: (handler, data) => page.on(handler, data),
|
|
14
|
+
each: (items, render, key) => createElement(Fragment, null, toList(items).map((item, index) => createElement(Fragment, { key: key ? String(key(item, index)) : index }, ...render(item, index))))
|
|
15
|
+
}), [page, components]);
|
|
16
|
+
if (!state) return null;
|
|
17
|
+
return page.viewRenderer(state, context);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { PageRoot };
|
package/dist/portal.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
//#region src/portal.ts
|
|
3
|
+
const PortalContainerContext = createContext(null);
|
|
4
|
+
function usePortalContainer() {
|
|
5
|
+
return useContext(PortalContainerContext) ?? void 0;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { PortalContainerContext, usePortalContainer };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ReactDom } from './react-host.js';
|
|
2
|
+
export default ReactDom;
|
|
3
|
+
export const { __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, browser, createPortal, flushSync, preconnect, prefetchDNS, preinit, preinitModule, preload, preloadModule, requestFormReset, unstable_batchedUpdates, useFormState, useFormStatus, version } = ReactDom;
|