@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,43 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, ICON_SIZE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { IconGraphic } from "./icon.js";
|
|
4
|
+
import { OptionPlaceContext } from "./option-place.js";
|
|
5
|
+
import { useContext } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/option.tsx
|
|
8
|
+
const Option = ({ value, label }) => {
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
const place = useContext(OptionPlaceContext);
|
|
11
|
+
const chosen = value !== void 0 && value === place.value;
|
|
12
|
+
if (place.inField) return chosen ? /* @__PURE__ */ jsx(Fragment$1, { children: label }) : null;
|
|
13
|
+
const { choose } = place;
|
|
14
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
15
|
+
type: "button",
|
|
16
|
+
className: "dot-option",
|
|
17
|
+
role: "option",
|
|
18
|
+
"aria-selected": chosen,
|
|
19
|
+
onClick: choose && value !== void 0 ? () => choose(value) : void 0,
|
|
20
|
+
style: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "space-between",
|
|
24
|
+
minHeight: 52,
|
|
25
|
+
padding: "16px 12px",
|
|
26
|
+
border: "none",
|
|
27
|
+
borderBottom: `1px solid ${colors.border}`,
|
|
28
|
+
background: "transparent",
|
|
29
|
+
color: colors.text,
|
|
30
|
+
fontSize: FONT_SIZE.body,
|
|
31
|
+
fontWeight: chosen ? WEIGHTS.bold : WEIGHTS.regular,
|
|
32
|
+
textAlign: "start",
|
|
33
|
+
cursor: "pointer"
|
|
34
|
+
},
|
|
35
|
+
children: [/* @__PURE__ */ jsx("span", { children: label }), chosen ? /* @__PURE__ */ jsx(IconGraphic, {
|
|
36
|
+
name: "check",
|
|
37
|
+
size: ICON_SIZE.medium,
|
|
38
|
+
color: colors.primary
|
|
39
|
+
}) : null]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Option };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SPACE } from "./tokens.js";
|
|
2
|
+
//#region src/components/padding.ts
|
|
3
|
+
const NO_INSETS = {
|
|
4
|
+
top: 0,
|
|
5
|
+
start: 0,
|
|
6
|
+
end: 0,
|
|
7
|
+
bottom: 0
|
|
8
|
+
};
|
|
9
|
+
function insets(block, inline = block) {
|
|
10
|
+
return {
|
|
11
|
+
top: block,
|
|
12
|
+
start: inline,
|
|
13
|
+
end: inline,
|
|
14
|
+
bottom: block
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function paddingStyle(props, own = NO_INSETS) {
|
|
18
|
+
const side = (space, pixels) => space === void 0 ? pixels : SPACE[space];
|
|
19
|
+
return {
|
|
20
|
+
paddingTop: side(props.paddingTop ?? props.padding, own.top),
|
|
21
|
+
paddingInlineStart: side(props.paddingStart ?? props.padding, own.start),
|
|
22
|
+
paddingInlineEnd: side(props.paddingEnd ?? props.padding, own.end),
|
|
23
|
+
paddingBottom: side(props.paddingBottom ?? props.padding, own.bottom)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { insets, paddingStyle };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/components/pressable.ts
|
|
2
|
+
function pressable(press) {
|
|
3
|
+
return {
|
|
4
|
+
role: "button",
|
|
5
|
+
tabIndex: 0,
|
|
6
|
+
onClick: press,
|
|
7
|
+
onKeyDown: (event) => {
|
|
8
|
+
if (event.target !== event.currentTarget) return;
|
|
9
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
press();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { pressable };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { encode } from "../vendor/uqr/dist/index.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/qr-code.tsx
|
|
6
|
+
const DARK = "#000000";
|
|
7
|
+
const LIGHT = "#ffffff";
|
|
8
|
+
const QUIET_ZONE = 2;
|
|
9
|
+
const QRCode = ({ value, size = 200, label }) => {
|
|
10
|
+
const { radius } = useTheme();
|
|
11
|
+
const drawing = useMemo(() => value ? drawCode(value) : null, [value]);
|
|
12
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
13
|
+
className: "dot-qr-code",
|
|
14
|
+
role: "img",
|
|
15
|
+
"aria-label": label ?? value,
|
|
16
|
+
width: size,
|
|
17
|
+
height: size,
|
|
18
|
+
viewBox: drawing ? `0 0 ${drawing.size} ${drawing.size}` : "0 0 1 1",
|
|
19
|
+
shapeRendering: "crispEdges",
|
|
20
|
+
style: {
|
|
21
|
+
display: "block",
|
|
22
|
+
flexShrink: 0,
|
|
23
|
+
overflow: "hidden",
|
|
24
|
+
borderRadius: radius
|
|
25
|
+
},
|
|
26
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
27
|
+
width: "100%",
|
|
28
|
+
height: "100%",
|
|
29
|
+
fill: LIGHT
|
|
30
|
+
}), drawing ? /* @__PURE__ */ jsx("path", {
|
|
31
|
+
d: drawing.path,
|
|
32
|
+
fill: DARK
|
|
33
|
+
}) : null]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
function drawCode(value) {
|
|
37
|
+
let modules;
|
|
38
|
+
try {
|
|
39
|
+
modules = encode(value, {
|
|
40
|
+
ecc: "M",
|
|
41
|
+
border: QUIET_ZONE
|
|
42
|
+
}).data;
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const squares = [];
|
|
47
|
+
modules.forEach((row, y) => {
|
|
48
|
+
row.forEach((dark, x) => {
|
|
49
|
+
if (dark) squares.push(`M${x} ${y}h1v1h-1z`);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
size: modules.length,
|
|
54
|
+
path: squares.join("")
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { QRCode };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SPACE } from "./tokens.js";
|
|
2
|
+
import { paddingStyle } from "./padding.js";
|
|
3
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/scroll.tsx
|
|
7
|
+
const REST_MS = 120;
|
|
8
|
+
const Scroll$1 = ({ gap = "medium", snap = "none", index, onChange, children, ...padding }) => {
|
|
9
|
+
const row = useRef(null);
|
|
10
|
+
const reported = useRef(void 0);
|
|
11
|
+
const resting = useRef(void 0);
|
|
12
|
+
const space = paddingStyle(padding);
|
|
13
|
+
const start = Number(space.paddingInlineStart);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const element = row.current;
|
|
16
|
+
if (index === void 0 || index === reported.current || !element) return;
|
|
17
|
+
const child = element.children[index];
|
|
18
|
+
if (child) {
|
|
19
|
+
reported.current = index;
|
|
20
|
+
element.scrollTo?.({
|
|
21
|
+
left: child.offsetLeft - start,
|
|
22
|
+
behavior: "smooth"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}, [index, start]);
|
|
26
|
+
useEffect(() => () => clearTimeout(resting.current), []);
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
ref: row,
|
|
29
|
+
className: "dot-scroll",
|
|
30
|
+
onScroll: onChange ? () => {
|
|
31
|
+
clearTimeout(resting.current);
|
|
32
|
+
resting.current = setTimeout(() => {
|
|
33
|
+
const element = row.current;
|
|
34
|
+
if (!element) return;
|
|
35
|
+
const left = element.scrollLeft + start;
|
|
36
|
+
const first = [...element.children].findIndex((item) => item.offsetLeft + item.offsetWidth / 2 >= left);
|
|
37
|
+
if (first !== -1 && first !== reported.current) {
|
|
38
|
+
reported.current = first;
|
|
39
|
+
onChange(createEvent("change", { index: first }));
|
|
40
|
+
}
|
|
41
|
+
}, REST_MS);
|
|
42
|
+
} : void 0,
|
|
43
|
+
style: {
|
|
44
|
+
gap: SPACE[gap],
|
|
45
|
+
...space,
|
|
46
|
+
scrollPaddingInlineStart: space.paddingInlineStart,
|
|
47
|
+
scrollPaddingInlineEnd: space.paddingInlineEnd,
|
|
48
|
+
scrollSnapType: snap === "none" ? void 0 : "x mandatory",
|
|
49
|
+
"--dot-scroll-snap": snap === "none" ? "none" : snap
|
|
50
|
+
},
|
|
51
|
+
children
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Scroll$1 as Scroll };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { ICON_SIZE, SPACE } from "./tokens.js";
|
|
3
|
+
import { Field } from "./field.js";
|
|
4
|
+
import { useFieldBox, useFieldNote } from "./field-box.js";
|
|
5
|
+
import { IconGraphic } from "./icon.js";
|
|
6
|
+
import { OptionPlaceContext } from "./option-place.js";
|
|
7
|
+
import { SheetPanel } from "./sheet.js";
|
|
8
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
9
|
+
import { useId, useState } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/select.tsx
|
|
12
|
+
const Select$1 = ({ value, label, placeholder, hint, error, disabled, onChange, children }) => {
|
|
13
|
+
const { colors } = useTheme();
|
|
14
|
+
const [open, setOpen] = useState(false);
|
|
15
|
+
const box = useFieldBox(error, disabled);
|
|
16
|
+
const { noteId, controlAttributes } = useFieldNote(hint, error);
|
|
17
|
+
const labelId = useId();
|
|
18
|
+
const valueId = useId();
|
|
19
|
+
const choose = (next) => {
|
|
20
|
+
setOpen(false);
|
|
21
|
+
onChange?.(createEvent("change", { value: next }));
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, {
|
|
24
|
+
label,
|
|
25
|
+
hint,
|
|
26
|
+
error,
|
|
27
|
+
labelId,
|
|
28
|
+
noteId,
|
|
29
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
className: "dot-select",
|
|
32
|
+
disabled,
|
|
33
|
+
"aria-haspopup": "listbox",
|
|
34
|
+
"aria-labelledby": label ? `${labelId} ${valueId}` : valueId,
|
|
35
|
+
...controlAttributes,
|
|
36
|
+
onClick: () => setOpen(true),
|
|
37
|
+
onFocus: box.onFocus,
|
|
38
|
+
onBlur: box.onBlur,
|
|
39
|
+
style: {
|
|
40
|
+
...box.style,
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
gap: SPACE.medium,
|
|
44
|
+
width: "100%",
|
|
45
|
+
padding: "12px 14px",
|
|
46
|
+
textAlign: "start",
|
|
47
|
+
cursor: disabled ? "default" : "pointer"
|
|
48
|
+
},
|
|
49
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
50
|
+
id: valueId,
|
|
51
|
+
style: { flexGrow: 1 },
|
|
52
|
+
children: value ? /* @__PURE__ */ jsx(OptionPlaceContext.Provider, {
|
|
53
|
+
value: {
|
|
54
|
+
inField: true,
|
|
55
|
+
value,
|
|
56
|
+
choose: void 0
|
|
57
|
+
},
|
|
58
|
+
children
|
|
59
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
60
|
+
style: { color: colors.subtle },
|
|
61
|
+
children: placeholder
|
|
62
|
+
})
|
|
63
|
+
}), /* @__PURE__ */ jsx(IconGraphic, {
|
|
64
|
+
name: "chevron-down",
|
|
65
|
+
size: ICON_SIZE.small,
|
|
66
|
+
color: colors.subtle
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
}), /* @__PURE__ */ jsx(SheetPanel, {
|
|
70
|
+
open,
|
|
71
|
+
title: label,
|
|
72
|
+
onClose: () => setOpen(false),
|
|
73
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
74
|
+
role: "listbox",
|
|
75
|
+
"aria-label": label,
|
|
76
|
+
style: {
|
|
77
|
+
display: "flex",
|
|
78
|
+
flexDirection: "column"
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ jsx(OptionPlaceContext.Provider, {
|
|
81
|
+
value: {
|
|
82
|
+
inField: false,
|
|
83
|
+
value,
|
|
84
|
+
choose
|
|
85
|
+
},
|
|
86
|
+
children
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
})] });
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
export { Select$1 as Select };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactComponent } from "../types.js";
|
|
2
|
+
import "./padding.js";
|
|
3
|
+
import { Sheet } from "@monimesl/dot-core";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
//#region src/components/sheet.d.ts
|
|
6
|
+
declare const Sheet$1: ReactComponent<typeof Sheet>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Sheet$1 as Sheet };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { FONT_FAMILY, useTheme } from "../theme.js";
|
|
2
|
+
import { CARD_RADIUS_SCALE, FONT_SIZE, ICON_SIZE, SPACE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { paddingStyle } from "./padding.js";
|
|
4
|
+
import { IconGraphic } from "./icon.js";
|
|
5
|
+
import { DialogBackdrop } from "../vendor/@base-ui/react/dialog/backdrop/DialogBackdrop.js";
|
|
6
|
+
import { DialogClose } from "../vendor/@base-ui/react/dialog/close/DialogClose.js";
|
|
7
|
+
import { DialogPopup } from "../vendor/@base-ui/react/dialog/popup/DialogPopup.js";
|
|
8
|
+
import { DialogPortal } from "../vendor/@base-ui/react/dialog/portal/DialogPortal.js";
|
|
9
|
+
import { DialogRoot } from "../vendor/@base-ui/react/dialog/root/DialogRoot.js";
|
|
10
|
+
import { DialogTitle } from "../vendor/@base-ui/react/dialog/title/DialogTitle.js";
|
|
11
|
+
import { usePortalContainer } from "../portal.js";
|
|
12
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
//#region src/components/sheet.tsx
|
|
15
|
+
const SheetPanel = ({ open, title, showCloseIcon = false, onClose, children, ...padding }) => {
|
|
16
|
+
const { colors, radius } = useTheme();
|
|
17
|
+
const container = usePortalContainer();
|
|
18
|
+
const corner = radius * CARD_RADIUS_SCALE;
|
|
19
|
+
return /* @__PURE__ */ jsx(DialogRoot, {
|
|
20
|
+
open,
|
|
21
|
+
onOpenChange: (next) => {
|
|
22
|
+
if (!next) onClose();
|
|
23
|
+
},
|
|
24
|
+
children: /* @__PURE__ */ jsxs(DialogPortal, {
|
|
25
|
+
container,
|
|
26
|
+
children: [/* @__PURE__ */ jsx(DialogBackdrop, {
|
|
27
|
+
className: "dot-sheet-backdrop",
|
|
28
|
+
style: {
|
|
29
|
+
position: "fixed",
|
|
30
|
+
inset: 0,
|
|
31
|
+
zIndex: 100,
|
|
32
|
+
background: "rgba(0, 0, 0, 0.4)"
|
|
33
|
+
}
|
|
34
|
+
}), /* @__PURE__ */ jsxs(DialogPopup, {
|
|
35
|
+
className: "dot-sheet",
|
|
36
|
+
"aria-label": title,
|
|
37
|
+
style: {
|
|
38
|
+
position: "fixed",
|
|
39
|
+
insetInline: 0,
|
|
40
|
+
bottom: 0,
|
|
41
|
+
zIndex: 101,
|
|
42
|
+
display: "flex",
|
|
43
|
+
flexDirection: "column",
|
|
44
|
+
gap: SPACE.medium,
|
|
45
|
+
maxHeight: "85vh",
|
|
46
|
+
overflowY: "auto",
|
|
47
|
+
...paddingStyle(padding, {
|
|
48
|
+
top: 16,
|
|
49
|
+
start: 16,
|
|
50
|
+
end: 16,
|
|
51
|
+
bottom: 24
|
|
52
|
+
}),
|
|
53
|
+
borderTopLeftRadius: corner,
|
|
54
|
+
borderTopRightRadius: corner,
|
|
55
|
+
background: colors.surface,
|
|
56
|
+
color: colors.text,
|
|
57
|
+
fontFamily: FONT_FAMILY,
|
|
58
|
+
outline: "none"
|
|
59
|
+
},
|
|
60
|
+
children: [
|
|
61
|
+
title ? /* @__PURE__ */ jsx(DialogTitle, {
|
|
62
|
+
style: {
|
|
63
|
+
margin: 0,
|
|
64
|
+
fontSize: FONT_SIZE.body,
|
|
65
|
+
fontWeight: WEIGHTS.bold,
|
|
66
|
+
lineHeight: "normal",
|
|
67
|
+
textAlign: "center"
|
|
68
|
+
},
|
|
69
|
+
children: title
|
|
70
|
+
}) : null,
|
|
71
|
+
showCloseIcon ? /* @__PURE__ */ jsx(DialogClose, {
|
|
72
|
+
"aria-label": "Close",
|
|
73
|
+
style: {
|
|
74
|
+
position: "absolute",
|
|
75
|
+
top: 10,
|
|
76
|
+
insetInlineEnd: 10,
|
|
77
|
+
display: "flex",
|
|
78
|
+
padding: 4,
|
|
79
|
+
border: "none",
|
|
80
|
+
borderRadius: "50%",
|
|
81
|
+
background: "transparent",
|
|
82
|
+
cursor: "pointer"
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ jsx(IconGraphic, {
|
|
85
|
+
name: "close",
|
|
86
|
+
size: ICON_SIZE.medium,
|
|
87
|
+
color: colors.subtle
|
|
88
|
+
})
|
|
89
|
+
}) : null,
|
|
90
|
+
children
|
|
91
|
+
]
|
|
92
|
+
})]
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const Sheet$1 = ({ open = false, title, showCloseIcon = false, onClose, children, ...padding }) => /* @__PURE__ */ jsx(SheetPanel, {
|
|
97
|
+
...padding,
|
|
98
|
+
open,
|
|
99
|
+
title,
|
|
100
|
+
showCloseIcon,
|
|
101
|
+
onClose: () => onClose?.(createEvent("close")),
|
|
102
|
+
children
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
export { Sheet$1 as Sheet, SheetPanel };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { SPACE } from "./tokens.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/skeleton.tsx
|
|
5
|
+
const LINE_HEIGHT = 12;
|
|
6
|
+
function Bar({ style }) {
|
|
7
|
+
const { colors } = useTheme();
|
|
8
|
+
return /* @__PURE__ */ jsx("div", { style: {
|
|
9
|
+
flexShrink: 0,
|
|
10
|
+
background: colors.muted,
|
|
11
|
+
animation: "dot-skeleton-pulse 1.2s linear infinite",
|
|
12
|
+
...style
|
|
13
|
+
} });
|
|
14
|
+
}
|
|
15
|
+
const Skeleton = ({ shape = "text", lines = 1, height }) => {
|
|
16
|
+
const { radius } = useTheme();
|
|
17
|
+
let content;
|
|
18
|
+
if (shape === "circle") {
|
|
19
|
+
const size = height ?? 40;
|
|
20
|
+
content = /* @__PURE__ */ jsx(Bar, { style: {
|
|
21
|
+
width: size,
|
|
22
|
+
height: size,
|
|
23
|
+
borderRadius: "50%"
|
|
24
|
+
} });
|
|
25
|
+
} else if (shape === "box") content = /* @__PURE__ */ jsx(Bar, { style: {
|
|
26
|
+
width: "100%",
|
|
27
|
+
height: height ?? 80,
|
|
28
|
+
borderRadius: radius
|
|
29
|
+
} });
|
|
30
|
+
else {
|
|
31
|
+
const count = Math.max(1, lines);
|
|
32
|
+
content = Array.from({ length: count }, (_, index) => {
|
|
33
|
+
const last = count > 1 && index === count - 1;
|
|
34
|
+
return /* @__PURE__ */ jsx(Bar, { style: {
|
|
35
|
+
width: last ? "60%" : "100%",
|
|
36
|
+
height: LINE_HEIGHT,
|
|
37
|
+
borderRadius: LINE_HEIGHT / 2
|
|
38
|
+
} }, index);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "dot-skeleton",
|
|
43
|
+
"aria-busy": "true",
|
|
44
|
+
style: {
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
gap: SPACE.medium,
|
|
48
|
+
width: shape === "circle" ? void 0 : "100%",
|
|
49
|
+
flexShrink: shape === "circle" ? 0 : 1
|
|
50
|
+
},
|
|
51
|
+
children: content
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Skeleton };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { ICON_SIZE } from "./tokens.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/spinner.tsx
|
|
5
|
+
function LoadingIcon({ size }) {
|
|
6
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
7
|
+
className: "dot-spinner",
|
|
8
|
+
width: size,
|
|
9
|
+
height: size,
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: 3,
|
|
14
|
+
role: "progressbar",
|
|
15
|
+
"aria-label": "Loading",
|
|
16
|
+
style: { flexShrink: 0 },
|
|
17
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
18
|
+
cx: "12",
|
|
19
|
+
cy: "12",
|
|
20
|
+
r: "9",
|
|
21
|
+
strokeOpacity: .25
|
|
22
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
23
|
+
d: "M21 12a9 9 0 0 0-9-9",
|
|
24
|
+
strokeLinecap: "round",
|
|
25
|
+
children: /* @__PURE__ */ jsx("animateTransform", {
|
|
26
|
+
attributeName: "transform",
|
|
27
|
+
type: "rotate",
|
|
28
|
+
from: "0 12 12",
|
|
29
|
+
to: "360 12 12",
|
|
30
|
+
dur: "0.8s",
|
|
31
|
+
repeatCount: "indefinite"
|
|
32
|
+
})
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const Spinner = ({ size = "medium" }) => {
|
|
37
|
+
const { colors } = useTheme();
|
|
38
|
+
return /* @__PURE__ */ jsx("span", {
|
|
39
|
+
style: {
|
|
40
|
+
display: "inline-flex",
|
|
41
|
+
alignSelf: "center",
|
|
42
|
+
color: colors.primary
|
|
43
|
+
},
|
|
44
|
+
children: /* @__PURE__ */ jsx(LoadingIcon, { size: ICON_SIZE[size] })
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { LoadingIcon, Spinner };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactComponent } from "../types.js";
|
|
2
|
+
import { Tab, Tabs } from "@monimesl/dot-core";
|
|
3
|
+
//#region src/components/tabs.d.ts
|
|
4
|
+
declare const Tabs$1: ReactComponent<typeof Tabs>;
|
|
5
|
+
declare const Tab$1: ReactComponent<typeof Tab>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Tab$1 as Tab, Tabs$1 as Tabs };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { FONT_SIZE, PILL_STYLE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { paddingStyle } from "./padding.js";
|
|
4
|
+
import { TabsRoot } from "../vendor/@base-ui/react/tabs/root/TabsRoot.js";
|
|
5
|
+
import { TabsTab } from "../vendor/@base-ui/react/tabs/tab/TabsTab.js";
|
|
6
|
+
import { TabsList } from "../vendor/@base-ui/react/tabs/list/TabsList.js";
|
|
7
|
+
import { createEvent } from "@monimesl/dot-core";
|
|
8
|
+
import { createContext, useContext } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/tabs.tsx
|
|
11
|
+
const TabsContext = createContext({
|
|
12
|
+
value: void 0,
|
|
13
|
+
segmented: false
|
|
14
|
+
});
|
|
15
|
+
const Tabs$1 = ({ value, variant = "underline", onChange, children, ...padding }) => {
|
|
16
|
+
const { colors, radius } = useTheme();
|
|
17
|
+
const segmented = variant === "segmented";
|
|
18
|
+
return /* @__PURE__ */ jsx(TabsRoot, {
|
|
19
|
+
value: value ?? null,
|
|
20
|
+
onValueChange: (next) => {
|
|
21
|
+
if (next !== null && next !== value) onChange?.(createEvent("change", { value: next }));
|
|
22
|
+
},
|
|
23
|
+
style: paddingStyle(padding),
|
|
24
|
+
children: /* @__PURE__ */ jsx(TabsList, {
|
|
25
|
+
className: "dot-tabs",
|
|
26
|
+
style: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
overflowX: "auto",
|
|
29
|
+
...segmented ? {
|
|
30
|
+
gap: 2,
|
|
31
|
+
padding: 3,
|
|
32
|
+
borderRadius: radius,
|
|
33
|
+
background: colors.muted
|
|
34
|
+
} : { borderBottom: `1px solid ${colors.border}` }
|
|
35
|
+
},
|
|
36
|
+
children: /* @__PURE__ */ jsx(TabsContext.Provider, {
|
|
37
|
+
value: {
|
|
38
|
+
value,
|
|
39
|
+
segmented
|
|
40
|
+
},
|
|
41
|
+
children
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const Tab$1 = ({ value, label, badge }) => {
|
|
47
|
+
const { colors, radius } = useTheme();
|
|
48
|
+
const { value: chosen, segmented } = useContext(TabsContext);
|
|
49
|
+
if (value === void 0) return null;
|
|
50
|
+
const selected = value === chosen;
|
|
51
|
+
let color = colors.subtle;
|
|
52
|
+
if (selected) color = segmented ? colors.text : colors.primary;
|
|
53
|
+
return /* @__PURE__ */ jsxs(TabsTab, {
|
|
54
|
+
className: "dot-tab",
|
|
55
|
+
value,
|
|
56
|
+
style: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
gap: 6,
|
|
61
|
+
flex: "1 0 auto",
|
|
62
|
+
minHeight: segmented ? 36 : 44,
|
|
63
|
+
padding: "0 12px",
|
|
64
|
+
border: "none",
|
|
65
|
+
fontSize: FONT_SIZE.body,
|
|
66
|
+
fontWeight: selected ? WEIGHTS.bold : WEIGHTS.medium,
|
|
67
|
+
whiteSpace: "nowrap",
|
|
68
|
+
color,
|
|
69
|
+
cursor: "pointer",
|
|
70
|
+
...segmented ? {
|
|
71
|
+
borderRadius: Math.max(radius - 2, 0),
|
|
72
|
+
background: selected ? colors.surface : "transparent",
|
|
73
|
+
boxShadow: selected ? "0 1px 3px rgba(0, 0, 0, 0.15)" : "none"
|
|
74
|
+
} : {
|
|
75
|
+
marginBottom: -1,
|
|
76
|
+
background: "transparent",
|
|
77
|
+
borderBottom: `2px solid ${selected ? colors.primary : "transparent"}`
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
children: [label, badge ? /* @__PURE__ */ jsx("span", {
|
|
81
|
+
style: {
|
|
82
|
+
...PILL_STYLE,
|
|
83
|
+
background: colors.primary,
|
|
84
|
+
color: colors.onPrimary
|
|
85
|
+
},
|
|
86
|
+
children: badge
|
|
87
|
+
}) : null]
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { Tab$1 as Tab, Tabs$1 as Tabs };
|