@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,97 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { DISABLED_OPACITY, SPACE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { Field } from "./field.js";
|
|
4
|
+
import { fieldBorderColor, useFieldNote } from "./field-box.js";
|
|
5
|
+
import { useTypedText } from "./typed-text.js";
|
|
6
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/code-input.tsx
|
|
10
|
+
const CodeInput$1 = ({ value, length = 6, label, hint, error, secure, disabled, onChange, onComplete }) => {
|
|
11
|
+
const { colors, radius } = useTheme();
|
|
12
|
+
const [text, typeText] = useTypedText(value, onChange !== void 0);
|
|
13
|
+
const [focused, setFocused] = useState(false);
|
|
14
|
+
const { noteId, controlAttributes } = useFieldNote(hint, error);
|
|
15
|
+
const count = Math.max(1, Math.round(length));
|
|
16
|
+
const digits = text.slice(0, count);
|
|
17
|
+
const next = Math.min(digits.length, count - 1);
|
|
18
|
+
const boxes = Array.from({ length: count }, (_, index) => {
|
|
19
|
+
const digit = digits[index];
|
|
20
|
+
const borderColor = fieldBorderColor(colors, error, focused && index === next);
|
|
21
|
+
return /* @__PURE__ */ jsx("span", {
|
|
22
|
+
style: {
|
|
23
|
+
display: "flex",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
flex: "1 1 0",
|
|
27
|
+
maxWidth: 52,
|
|
28
|
+
height: 52,
|
|
29
|
+
border: `1.5px solid ${borderColor}`,
|
|
30
|
+
borderRadius: radius,
|
|
31
|
+
background: colors.surface,
|
|
32
|
+
fontSize: 22,
|
|
33
|
+
fontWeight: WEIGHTS.bold
|
|
34
|
+
},
|
|
35
|
+
children: digit !== void 0 && secure ? /* @__PURE__ */ jsx("span", {
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
style: {
|
|
38
|
+
width: 12,
|
|
39
|
+
height: 12,
|
|
40
|
+
borderRadius: "50%",
|
|
41
|
+
background: colors.text
|
|
42
|
+
}
|
|
43
|
+
}) : digit
|
|
44
|
+
}, index);
|
|
45
|
+
});
|
|
46
|
+
return /* @__PURE__ */ jsx(Field, {
|
|
47
|
+
label,
|
|
48
|
+
hint,
|
|
49
|
+
error,
|
|
50
|
+
noteId,
|
|
51
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
52
|
+
className: "dot-code-input",
|
|
53
|
+
style: {
|
|
54
|
+
position: "relative",
|
|
55
|
+
display: "flex",
|
|
56
|
+
gap: SPACE.medium,
|
|
57
|
+
color: colors.text,
|
|
58
|
+
opacity: disabled ? DISABLED_OPACITY : 1
|
|
59
|
+
},
|
|
60
|
+
children: [boxes, /* @__PURE__ */ jsx("input", {
|
|
61
|
+
value: digits,
|
|
62
|
+
inputMode: "numeric",
|
|
63
|
+
autoComplete: "one-time-code",
|
|
64
|
+
maxLength: count,
|
|
65
|
+
disabled,
|
|
66
|
+
...controlAttributes,
|
|
67
|
+
onFocus: () => setFocused(true),
|
|
68
|
+
onBlur: () => setFocused(false),
|
|
69
|
+
onSelect: (event) => {
|
|
70
|
+
const input = event.currentTarget;
|
|
71
|
+
const end = input.value.length;
|
|
72
|
+
if (input.selectionStart !== end || input.selectionEnd !== end) input.setSelectionRange(end, end);
|
|
73
|
+
},
|
|
74
|
+
onChange: (event) => {
|
|
75
|
+
const typed = event.currentTarget.value.replace(/\D/g, "").slice(0, count);
|
|
76
|
+
if (typed === digits) return;
|
|
77
|
+
typeText(typed);
|
|
78
|
+
onChange?.(createEvent("change", { value: typed }));
|
|
79
|
+
if (typed.length === count) onComplete?.(createEvent("complete", { value: typed }));
|
|
80
|
+
},
|
|
81
|
+
style: {
|
|
82
|
+
position: "absolute",
|
|
83
|
+
inset: 0,
|
|
84
|
+
width: "100%",
|
|
85
|
+
height: "100%",
|
|
86
|
+
padding: 0,
|
|
87
|
+
border: "none",
|
|
88
|
+
opacity: 0,
|
|
89
|
+
fontSize: 16,
|
|
90
|
+
cursor: disabled ? "default" : "text"
|
|
91
|
+
}
|
|
92
|
+
})]
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
export { CodeInput$1 as CodeInput };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { insets, paddingStyle } from "./padding.js";
|
|
4
|
+
import { toneColor } from "./tones.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/detail-row.tsx
|
|
7
|
+
const DetailRow = ({ label, value, tone, weight = "regular", ...padding }) => {
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: "dot-detail-row",
|
|
11
|
+
style: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "baseline",
|
|
14
|
+
justifyContent: "space-between",
|
|
15
|
+
gap: 16,
|
|
16
|
+
...paddingStyle(padding, insets(6, 0)),
|
|
17
|
+
fontSize: FONT_SIZE.body,
|
|
18
|
+
lineHeight: "normal"
|
|
19
|
+
},
|
|
20
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
21
|
+
style: {
|
|
22
|
+
flexShrink: 0,
|
|
23
|
+
maxWidth: "50%",
|
|
24
|
+
color: colors.subtle
|
|
25
|
+
},
|
|
26
|
+
children: label
|
|
27
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
28
|
+
style: {
|
|
29
|
+
minWidth: 0,
|
|
30
|
+
textAlign: "end",
|
|
31
|
+
overflowWrap: "anywhere",
|
|
32
|
+
color: toneColor(colors, tone ?? "default"),
|
|
33
|
+
fontWeight: WEIGHTS[weight]
|
|
34
|
+
},
|
|
35
|
+
children: value
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { DetailRow };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/divider.tsx
|
|
4
|
+
const Divider = () => {
|
|
5
|
+
const { colors } = useTheme();
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
className: "dot-divider",
|
|
8
|
+
role: "separator",
|
|
9
|
+
style: {
|
|
10
|
+
alignSelf: "stretch",
|
|
11
|
+
flexShrink: 0,
|
|
12
|
+
height: 1,
|
|
13
|
+
background: colors.border
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Divider };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, ICON_SIZE, SPACE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { insets, paddingStyle } from "./padding.js";
|
|
4
|
+
import { IconGraphic } from "./icon.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/empty-state.tsx
|
|
7
|
+
const EmptyState = ({ icon, title, text, children, ...padding }) => {
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: "dot-empty-state",
|
|
11
|
+
style: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
gap: SPACE.medium,
|
|
16
|
+
...paddingStyle(padding, insets(32, 16)),
|
|
17
|
+
textAlign: "center",
|
|
18
|
+
color: colors.text
|
|
19
|
+
},
|
|
20
|
+
children: [
|
|
21
|
+
icon ? /* @__PURE__ */ jsx("span", {
|
|
22
|
+
style: {
|
|
23
|
+
display: "flex",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
width: 64,
|
|
27
|
+
height: 64,
|
|
28
|
+
borderRadius: "50%",
|
|
29
|
+
background: colors.muted
|
|
30
|
+
},
|
|
31
|
+
children: /* @__PURE__ */ jsx(IconGraphic, {
|
|
32
|
+
name: icon,
|
|
33
|
+
size: ICON_SIZE.large,
|
|
34
|
+
color: colors.subtle
|
|
35
|
+
})
|
|
36
|
+
}) : null,
|
|
37
|
+
title ? /* @__PURE__ */ jsx("span", {
|
|
38
|
+
style: {
|
|
39
|
+
fontSize: 17,
|
|
40
|
+
fontWeight: WEIGHTS.bold,
|
|
41
|
+
lineHeight: "normal"
|
|
42
|
+
},
|
|
43
|
+
children: title
|
|
44
|
+
}) : null,
|
|
45
|
+
text ? /* @__PURE__ */ jsx("span", {
|
|
46
|
+
style: {
|
|
47
|
+
maxWidth: 300,
|
|
48
|
+
fontSize: FONT_SIZE.body,
|
|
49
|
+
lineHeight: "normal",
|
|
50
|
+
color: colors.subtle
|
|
51
|
+
},
|
|
52
|
+
children: text
|
|
53
|
+
}) : null,
|
|
54
|
+
children ? /* @__PURE__ */ jsx("div", {
|
|
55
|
+
style: {
|
|
56
|
+
display: "flex",
|
|
57
|
+
gap: SPACE.medium,
|
|
58
|
+
paddingTop: SPACE.small
|
|
59
|
+
},
|
|
60
|
+
children
|
|
61
|
+
}) : null
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { EmptyState };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactComponent } from "../types.js";
|
|
2
|
+
import { Badge, Notice, ProgressBar } from "@monimesl/dot-core";
|
|
3
|
+
//#region src/components/feedback.d.ts
|
|
4
|
+
declare const ProgressBar$1: ReactComponent<typeof ProgressBar>;
|
|
5
|
+
declare const Notice$1: ReactComponent<typeof Notice>;
|
|
6
|
+
declare const Badge$1: ReactComponent<typeof Badge>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Badge$1 as Badge, Notice$1 as Notice, ProgressBar$1 as ProgressBar };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, ICON_SIZE, SPACE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { insets, paddingStyle } from "./padding.js";
|
|
4
|
+
import { STATUS_ICONS, toneBackground, toneColor } from "./tones.js";
|
|
5
|
+
import { IconGraphic } from "./icon.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/feedback.tsx
|
|
8
|
+
const ProgressBar = ({ value = 0 }) => {
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
const percent = Math.min(100, Math.max(0, value));
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: "dot-progress-bar",
|
|
13
|
+
role: "progressbar",
|
|
14
|
+
"aria-valuemin": 0,
|
|
15
|
+
"aria-valuemax": 100,
|
|
16
|
+
"aria-valuenow": percent,
|
|
17
|
+
style: {
|
|
18
|
+
width: "100%",
|
|
19
|
+
height: 6,
|
|
20
|
+
borderRadius: 3,
|
|
21
|
+
background: colors.muted,
|
|
22
|
+
overflow: "hidden"
|
|
23
|
+
},
|
|
24
|
+
children: /* @__PURE__ */ jsx("div", { style: {
|
|
25
|
+
width: `${percent}%`,
|
|
26
|
+
height: "100%",
|
|
27
|
+
background: colors.primary,
|
|
28
|
+
transition: "width 0.2s"
|
|
29
|
+
} })
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const Notice = ({ tone = "default", title, children, ...padding }) => {
|
|
33
|
+
const { colors, radius } = useTheme();
|
|
34
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "dot-notice",
|
|
36
|
+
role: tone === "danger" ? "alert" : "status",
|
|
37
|
+
style: {
|
|
38
|
+
display: "flex",
|
|
39
|
+
gap: SPACE.medium,
|
|
40
|
+
...paddingStyle(padding, insets(12, 14)),
|
|
41
|
+
borderRadius: radius,
|
|
42
|
+
background: toneBackground(colors, tone),
|
|
43
|
+
color: colors.text,
|
|
44
|
+
fontSize: FONT_SIZE.body,
|
|
45
|
+
lineHeight: "normal"
|
|
46
|
+
},
|
|
47
|
+
children: [/* @__PURE__ */ jsx(IconGraphic, {
|
|
48
|
+
name: STATUS_ICONS[tone],
|
|
49
|
+
size: ICON_SIZE.medium,
|
|
50
|
+
color: toneColor(colors, tone)
|
|
51
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
52
|
+
style: {
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: "column",
|
|
55
|
+
gap: 2,
|
|
56
|
+
minWidth: 0
|
|
57
|
+
},
|
|
58
|
+
children: [title ? /* @__PURE__ */ jsx("span", {
|
|
59
|
+
style: { fontWeight: WEIGHTS.bold },
|
|
60
|
+
children: title
|
|
61
|
+
}) : null, children ? /* @__PURE__ */ jsx("span", { children }) : null]
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const Badge = ({ tone = "default", children }) => {
|
|
66
|
+
const { colors } = useTheme();
|
|
67
|
+
return /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "dot-badge",
|
|
69
|
+
style: {
|
|
70
|
+
display: "inline-flex",
|
|
71
|
+
width: "fit-content",
|
|
72
|
+
padding: "2px 8px",
|
|
73
|
+
borderRadius: 999,
|
|
74
|
+
background: toneBackground(colors, tone),
|
|
75
|
+
color: toneColor(colors, tone),
|
|
76
|
+
fontSize: FONT_SIZE.caption,
|
|
77
|
+
fontWeight: WEIGHTS.bold,
|
|
78
|
+
lineHeight: "normal",
|
|
79
|
+
whiteSpace: "nowrap"
|
|
80
|
+
},
|
|
81
|
+
children
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { Badge, Notice, ProgressBar };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { DISABLED_OPACITY } from "./tokens.js";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
//#region src/components/field-box.ts
|
|
5
|
+
const BARE_INPUT_STYLE = {
|
|
6
|
+
flexGrow: 1,
|
|
7
|
+
minWidth: 0,
|
|
8
|
+
border: "none",
|
|
9
|
+
outline: "none",
|
|
10
|
+
background: "transparent",
|
|
11
|
+
color: "inherit"
|
|
12
|
+
};
|
|
13
|
+
function fieldBorderColor(colors, error, focused) {
|
|
14
|
+
if (error) return colors.danger;
|
|
15
|
+
return focused ? colors.primary : colors.border;
|
|
16
|
+
}
|
|
17
|
+
function useFieldBox(error, disabled) {
|
|
18
|
+
const { colors, radius } = useTheme();
|
|
19
|
+
const [focused, setFocused] = useState(false);
|
|
20
|
+
return {
|
|
21
|
+
style: {
|
|
22
|
+
border: `1px solid ${fieldBorderColor(colors, error, focused)}`,
|
|
23
|
+
borderRadius: radius,
|
|
24
|
+
background: colors.surface,
|
|
25
|
+
color: colors.text,
|
|
26
|
+
fontSize: 16,
|
|
27
|
+
opacity: disabled ? DISABLED_OPACITY : 1
|
|
28
|
+
},
|
|
29
|
+
onFocus: () => setFocused(true),
|
|
30
|
+
onBlur: () => setFocused(false)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function useFieldNote(hint, error) {
|
|
34
|
+
const noteId = useId();
|
|
35
|
+
return {
|
|
36
|
+
noteId,
|
|
37
|
+
controlAttributes: {
|
|
38
|
+
"aria-invalid": error ? true : void 0,
|
|
39
|
+
"aria-describedby": error || hint ? noteId : void 0
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { BARE_INPUT_STYLE, fieldBorderColor, useFieldBox, useFieldNote };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, SPACE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/field.tsx
|
|
5
|
+
function Field({ label, hint, error, labelId, noteId, children }) {
|
|
6
|
+
const { colors } = useTheme();
|
|
7
|
+
const note = error || hint;
|
|
8
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
9
|
+
className: "dot-field",
|
|
10
|
+
style: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
gap: SPACE.small
|
|
14
|
+
},
|
|
15
|
+
children: [
|
|
16
|
+
label ? /* @__PURE__ */ jsx(FieldLabel, {
|
|
17
|
+
id: labelId,
|
|
18
|
+
children: label
|
|
19
|
+
}) : null,
|
|
20
|
+
children,
|
|
21
|
+
note ? /* @__PURE__ */ jsx("span", {
|
|
22
|
+
id: noteId,
|
|
23
|
+
style: {
|
|
24
|
+
fontSize: FONT_SIZE.caption,
|
|
25
|
+
color: error ? colors.danger : colors.subtle
|
|
26
|
+
},
|
|
27
|
+
children: note
|
|
28
|
+
}) : null
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function FieldLabel({ id, children }) {
|
|
33
|
+
return /* @__PURE__ */ jsx("span", {
|
|
34
|
+
id,
|
|
35
|
+
style: {
|
|
36
|
+
fontSize: FONT_SIZE.caption,
|
|
37
|
+
fontWeight: WEIGHTS.medium
|
|
38
|
+
},
|
|
39
|
+
children
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Field, FieldLabel };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { SPACE } from "./tokens.js";
|
|
3
|
+
import { insets, paddingStyle } from "./padding.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/footer.tsx
|
|
6
|
+
const Footer = ({ children, ...padding }) => {
|
|
7
|
+
const { colors } = useTheme();
|
|
8
|
+
return /* @__PURE__ */ jsx("footer", {
|
|
9
|
+
className: "dot-footer",
|
|
10
|
+
style: {
|
|
11
|
+
position: "sticky",
|
|
12
|
+
bottom: 0,
|
|
13
|
+
marginTop: "auto",
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
gap: SPACE.medium,
|
|
17
|
+
...paddingStyle(padding, insets(SPACE.medium, 0)),
|
|
18
|
+
background: colors.background
|
|
19
|
+
},
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Footer };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactComponent } from "../types.js";
|
|
2
|
+
import { Grid, GridItem } from "@monimesl/dot-core";
|
|
3
|
+
//#region src/components/grid.d.ts
|
|
4
|
+
declare const Grid$1: ReactComponent<typeof Grid>;
|
|
5
|
+
declare const GridItem$1: ReactComponent<typeof GridItem>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Grid$1 as Grid, GridItem$1 as GridItem };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { CARD_RADIUS_SCALE, FONT_SIZE, PILL_STYLE, SPACE } from "./tokens.js";
|
|
3
|
+
import { paddingStyle } from "./padding.js";
|
|
4
|
+
import { IconGraphic } from "./icon.js";
|
|
5
|
+
import { pressable } from "./pressable.js";
|
|
6
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/grid.tsx
|
|
9
|
+
const TILE_SIZE = 52;
|
|
10
|
+
const Grid$1 = ({ columns = 4, gap = "medium", children, ...padding }) => /* @__PURE__ */ jsx("div", {
|
|
11
|
+
className: "dot-grid",
|
|
12
|
+
style: {
|
|
13
|
+
display: "grid",
|
|
14
|
+
gridTemplateColumns: `repeat(${Math.max(1, Math.round(columns))}, minmax(0, 1fr))`,
|
|
15
|
+
gap: SPACE[gap],
|
|
16
|
+
...paddingStyle(padding)
|
|
17
|
+
},
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
const GridItem$1 = ({ label, icon, image, badge, onTap }) => {
|
|
21
|
+
const { colors, radius } = useTheme();
|
|
22
|
+
let picture = null;
|
|
23
|
+
if (image) picture = /* @__PURE__ */ jsx("img", {
|
|
24
|
+
src: image,
|
|
25
|
+
alt: "",
|
|
26
|
+
width: TILE_SIZE,
|
|
27
|
+
height: TILE_SIZE,
|
|
28
|
+
style: {
|
|
29
|
+
display: "block",
|
|
30
|
+
width: "100%",
|
|
31
|
+
height: "100%",
|
|
32
|
+
borderRadius: "inherit",
|
|
33
|
+
objectFit: "cover"
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
else if (icon) picture = /* @__PURE__ */ jsx(IconGraphic, {
|
|
37
|
+
name: icon,
|
|
38
|
+
size: 24,
|
|
39
|
+
color: "currentColor"
|
|
40
|
+
});
|
|
41
|
+
const press = onTap ? pressable(() => onTap(createEvent("tap"))) : void 0;
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "dot-grid-item",
|
|
44
|
+
...press,
|
|
45
|
+
style: {
|
|
46
|
+
position: "relative",
|
|
47
|
+
display: "flex",
|
|
48
|
+
flexDirection: "column",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
gap: 6,
|
|
51
|
+
padding: "4px 0",
|
|
52
|
+
cursor: press ? "pointer" : void 0
|
|
53
|
+
},
|
|
54
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
55
|
+
style: {
|
|
56
|
+
position: "relative",
|
|
57
|
+
display: "flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
flexShrink: 0,
|
|
61
|
+
width: TILE_SIZE,
|
|
62
|
+
height: TILE_SIZE,
|
|
63
|
+
borderRadius: radius * CARD_RADIUS_SCALE,
|
|
64
|
+
background: colors.muted,
|
|
65
|
+
color: colors.primary
|
|
66
|
+
},
|
|
67
|
+
children: [picture, badge ? /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "dot-grid-badge",
|
|
69
|
+
style: {
|
|
70
|
+
...PILL_STYLE,
|
|
71
|
+
position: "absolute",
|
|
72
|
+
top: -3,
|
|
73
|
+
insetInlineEnd: -10,
|
|
74
|
+
minHeight: 0,
|
|
75
|
+
lineHeight: "13px",
|
|
76
|
+
background: colors.danger,
|
|
77
|
+
color: colors.surface
|
|
78
|
+
},
|
|
79
|
+
children: badge
|
|
80
|
+
}) : null]
|
|
81
|
+
}), label ? /* @__PURE__ */ jsx("span", {
|
|
82
|
+
style: {
|
|
83
|
+
display: "-webkit-box",
|
|
84
|
+
overflow: "hidden",
|
|
85
|
+
width: "100%",
|
|
86
|
+
WebkitLineClamp: 2,
|
|
87
|
+
WebkitBoxOrient: "vertical",
|
|
88
|
+
color: colors.text,
|
|
89
|
+
fontSize: FONT_SIZE.caption,
|
|
90
|
+
lineHeight: "normal",
|
|
91
|
+
textAlign: "center"
|
|
92
|
+
},
|
|
93
|
+
children: label
|
|
94
|
+
}) : null]
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { Grid$1 as Grid, GridItem$1 as GridItem };
|