@nation-a/ui 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1037 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1037 -54
- package/dist/index.js.map +1 -1
- package/dist/styled-system/styles.css +187 -28
- package/dist/types/components/Button/Button.stories.d.ts +9 -0
- package/dist/types/components/Dialog/Dialog.stories.d.ts +9 -0
- package/dist/types/components/Dialog/dialog.recipe.d.ts +1 -1
- package/dist/types/components/Dialog/index.d.ts +9 -2
- package/dist/types/components/IconButton/IconButton.stories.d.ts +10 -0
- package/dist/types/components/Navigation/Navigation.stories.d.ts +6 -0
- package/dist/types/components/Navigation/index.d.ts +30 -0
- package/dist/types/components/Navigation/navigation.recipe.d.ts +2 -0
- package/dist/types/components/Spinner/Spinner.stories.d.ts +7 -0
- package/dist/types/components/Tag/Tag.stories.d.ts +10 -0
- package/dist/types/components/Tag/index.d.ts +13 -0
- package/dist/types/components/Tag/tag.recipe.d.ts +27 -0
- package/dist/types/components/Text/Text.stories.d.ts +6 -0
- package/dist/types/components/Text/index.d.ts +2 -1
- package/dist/types/components/Text/text.recipe.d.ts +11 -0
- package/dist/types/components/index.d.ts +2 -0
- package/package.json +23 -4
package/dist/index.js
CHANGED
|
@@ -575,6 +575,8 @@ function toArray$1(v2) {
|
|
|
575
575
|
if (!v2) return [];
|
|
576
576
|
return Array.isArray(v2) ? v2 : [v2];
|
|
577
577
|
}
|
|
578
|
+
var first = (v2) => v2[0];
|
|
579
|
+
var last = (v2) => v2[v2.length - 1];
|
|
578
580
|
var isString = (v2) => typeof v2 === "string";
|
|
579
581
|
var isFunction = (v2) => typeof v2 === "function";
|
|
580
582
|
var fnToString = Function.prototype.toString;
|
|
@@ -611,6 +613,7 @@ function ensure(c, m2) {
|
|
|
611
613
|
if (c == null) throw new Error(m2);
|
|
612
614
|
}
|
|
613
615
|
var isObject = (v2) => typeof v2 === "object" && v2 !== null;
|
|
616
|
+
var dataAttr = (guard) => guard ? "" : void 0;
|
|
614
617
|
var ELEMENT_NODE = 1;
|
|
615
618
|
var DOCUMENT_NODE = 9;
|
|
616
619
|
var DOCUMENT_FRAGMENT_NODE = 11;
|
|
@@ -627,6 +630,7 @@ function isRootElement(node) {
|
|
|
627
630
|
var isNode = (el) => isObject(el) && el.nodeType !== void 0;
|
|
628
631
|
var isShadowRoot = (el) => isNode(el) && el.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in el;
|
|
629
632
|
var isInputElement = (el) => isHTMLElement(el) && el.localName === "input";
|
|
633
|
+
var isAnchorElement = (el) => !!(el == null ? void 0 : el.matches("a[href]"));
|
|
630
634
|
var isElementVisible = (el) => {
|
|
631
635
|
if (!isHTMLElement(el)) return false;
|
|
632
636
|
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
@@ -697,8 +701,20 @@ function getPlatform() {
|
|
|
697
701
|
const agent = navigator.userAgentData;
|
|
698
702
|
return (agent == null ? void 0 : agent.platform) ?? navigator.platform;
|
|
699
703
|
}
|
|
704
|
+
function getUserAgent() {
|
|
705
|
+
const ua2 = navigator.userAgentData;
|
|
706
|
+
if (ua2 && Array.isArray(ua2.brands)) {
|
|
707
|
+
return ua2.brands.map(({ brand, version }) => `${brand}/${version}`).join(" ");
|
|
708
|
+
}
|
|
709
|
+
return navigator.userAgent;
|
|
710
|
+
}
|
|
700
711
|
var pt = (v2) => isDom() && v2.test(getPlatform());
|
|
712
|
+
var ua = (v2) => isDom() && v2.test(getUserAgent());
|
|
713
|
+
var vn = (v2) => isDom() && v2.test(navigator.vendor);
|
|
701
714
|
var isMac = () => pt(/^Mac/);
|
|
715
|
+
var isSafari = () => isApple() && vn(/apple/i);
|
|
716
|
+
var isFirefox = () => ua(/firefox\//i);
|
|
717
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
702
718
|
var isIos = () => pt(/iP(hone|ad|od)|iOS/);
|
|
703
719
|
function getComposedPath(event) {
|
|
704
720
|
var _a, _b, _c;
|
|
@@ -708,9 +724,39 @@ function getEventTarget(event) {
|
|
|
708
724
|
const composedPath = getComposedPath(event);
|
|
709
725
|
return (composedPath == null ? void 0 : composedPath[0]) ?? event.target;
|
|
710
726
|
}
|
|
727
|
+
var isSelfTarget = (event) => {
|
|
728
|
+
return contains(event.currentTarget, getEventTarget(event));
|
|
729
|
+
};
|
|
730
|
+
function isComposingEvent(event) {
|
|
731
|
+
return getNativeEvent(event).isComposing;
|
|
732
|
+
}
|
|
711
733
|
var isContextMenuEvent = (e) => {
|
|
712
734
|
return e.button === 2 || isMac() && e.ctrlKey && e.button === 0;
|
|
713
735
|
};
|
|
736
|
+
var keyMap = {
|
|
737
|
+
Up: "ArrowUp",
|
|
738
|
+
Down: "ArrowDown",
|
|
739
|
+
Esc: "Escape",
|
|
740
|
+
" ": "Space",
|
|
741
|
+
",": "Comma",
|
|
742
|
+
Left: "ArrowLeft",
|
|
743
|
+
Right: "ArrowRight"
|
|
744
|
+
};
|
|
745
|
+
var rtlKeyMap = {
|
|
746
|
+
ArrowLeft: "ArrowRight",
|
|
747
|
+
ArrowRight: "ArrowLeft"
|
|
748
|
+
};
|
|
749
|
+
function getEventKey(event, options = {}) {
|
|
750
|
+
const { dir = "ltr", orientation = "horizontal" } = options;
|
|
751
|
+
let key = event.key;
|
|
752
|
+
key = keyMap[key] ?? key;
|
|
753
|
+
const isRtl = dir === "rtl" && orientation === "horizontal";
|
|
754
|
+
if (isRtl && key in rtlKeyMap) key = rtlKeyMap[key];
|
|
755
|
+
return key;
|
|
756
|
+
}
|
|
757
|
+
function getNativeEvent(event) {
|
|
758
|
+
return event.nativeEvent ?? event;
|
|
759
|
+
}
|
|
714
760
|
var addDomEvent = (target, eventName, handler, options) => {
|
|
715
761
|
const node = typeof target === "function" ? target() : target;
|
|
716
762
|
node == null ? void 0 : node.addEventListener(eventName, handler, options);
|
|
@@ -789,6 +835,26 @@ function raf$2(fn) {
|
|
|
789
835
|
cleanup == null ? void 0 : cleanup();
|
|
790
836
|
};
|
|
791
837
|
}
|
|
838
|
+
function queueBeforeEvent(el, type, cb) {
|
|
839
|
+
const cancelTimer = raf$2(() => {
|
|
840
|
+
el.removeEventListener(type, exec, true);
|
|
841
|
+
cb();
|
|
842
|
+
});
|
|
843
|
+
const exec = () => {
|
|
844
|
+
cancelTimer();
|
|
845
|
+
cb();
|
|
846
|
+
};
|
|
847
|
+
el.addEventListener(type, exec, { once: true, capture: true });
|
|
848
|
+
return cancelTimer;
|
|
849
|
+
}
|
|
850
|
+
function clickIfLink(el) {
|
|
851
|
+
const click = () => el.click();
|
|
852
|
+
if (isFirefox()) {
|
|
853
|
+
queueBeforeEvent(el, "keyup", click);
|
|
854
|
+
} else {
|
|
855
|
+
queueMicrotask(click);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
792
858
|
function getNearestOverflowAncestor(el) {
|
|
793
859
|
const parentNode = getParentNode$1(el);
|
|
794
860
|
if (isRootElement(parentNode)) return getDocument(parentNode).body;
|
|
@@ -801,6 +867,28 @@ function isOverflowElement(el) {
|
|
|
801
867
|
const { overflow, overflowX, overflowY, display } = win.getComputedStyle(el);
|
|
802
868
|
return OVERFLOW_RE.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
803
869
|
}
|
|
870
|
+
function queryAll(root, selector) {
|
|
871
|
+
return Array.from((root == null ? void 0 : root.querySelectorAll(selector)) ?? []);
|
|
872
|
+
}
|
|
873
|
+
var defaultItemToId = (v2) => v2.id;
|
|
874
|
+
function itemById(v2, id, itemToId = defaultItemToId) {
|
|
875
|
+
return v2.find((item) => itemToId(item) === id);
|
|
876
|
+
}
|
|
877
|
+
function indexOfId(v2, id, itemToId = defaultItemToId) {
|
|
878
|
+
const item = itemById(v2, id, itemToId);
|
|
879
|
+
return item ? v2.indexOf(item) : -1;
|
|
880
|
+
}
|
|
881
|
+
function nextById(v2, id, loop2 = true) {
|
|
882
|
+
let idx = indexOfId(v2, id);
|
|
883
|
+
idx = loop2 ? (idx + 1) % v2.length : Math.min(idx + 1, v2.length - 1);
|
|
884
|
+
return v2[idx];
|
|
885
|
+
}
|
|
886
|
+
function prevById(v2, id, loop2 = true) {
|
|
887
|
+
let idx = indexOfId(v2, id);
|
|
888
|
+
if (idx === -1) return loop2 ? v2[v2.length - 1] : null;
|
|
889
|
+
idx = loop2 ? (idx - 1 + v2.length) % v2.length : Math.max(0, idx - 1);
|
|
890
|
+
return v2[idx];
|
|
891
|
+
}
|
|
804
892
|
var cleanups = /* @__PURE__ */ new WeakMap();
|
|
805
893
|
function set(element, key, setup) {
|
|
806
894
|
if (!cleanups.has(element)) {
|
|
@@ -917,6 +1005,25 @@ function mergeProps(...args) {
|
|
|
917
1005
|
}
|
|
918
1006
|
return result;
|
|
919
1007
|
}
|
|
1008
|
+
function createGuards() {
|
|
1009
|
+
return {
|
|
1010
|
+
and: (...guards) => {
|
|
1011
|
+
return function andGuard(params) {
|
|
1012
|
+
return guards.every((str) => params.guard(str));
|
|
1013
|
+
};
|
|
1014
|
+
},
|
|
1015
|
+
or: (...guards) => {
|
|
1016
|
+
return function orGuard(params) {
|
|
1017
|
+
return guards.some((str) => params.guard(str));
|
|
1018
|
+
};
|
|
1019
|
+
},
|
|
1020
|
+
not: (guard) => {
|
|
1021
|
+
return function notGuard(params) {
|
|
1022
|
+
return !params.guard(guard);
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
920
1027
|
function createMachine(config2) {
|
|
921
1028
|
return config2;
|
|
922
1029
|
}
|
|
@@ -1813,7 +1920,7 @@ const [PresenceProvider, usePresenceContext] = createContext({
|
|
|
1813
1920
|
providerName: "<PresenceProvider />"
|
|
1814
1921
|
});
|
|
1815
1922
|
const splitPresenceProps = (props) => createSplitProps()(props, ["immediate", "lazyMount", "onExitComplete", "present", "unmountOnExit"]);
|
|
1816
|
-
function connect$
|
|
1923
|
+
function connect$2(service, _normalize) {
|
|
1817
1924
|
const { state, send, context: context2 } = service;
|
|
1818
1925
|
const present = state.matches("mounted", "unmountSuspended");
|
|
1819
1926
|
return {
|
|
@@ -1828,7 +1935,7 @@ function connect$1(service, _normalize) {
|
|
|
1828
1935
|
}
|
|
1829
1936
|
};
|
|
1830
1937
|
}
|
|
1831
|
-
var machine$
|
|
1938
|
+
var machine$2 = createMachine({
|
|
1832
1939
|
props({ props: props2 }) {
|
|
1833
1940
|
return { ...props2, present: !!props2.present };
|
|
1834
1941
|
},
|
|
@@ -1995,8 +2102,8 @@ const usePresence = (props = {}) => {
|
|
|
1995
2102
|
present,
|
|
1996
2103
|
onExitComplete: useEvent(props.onExitComplete)
|
|
1997
2104
|
};
|
|
1998
|
-
const service = useMachine(machine$
|
|
1999
|
-
const api = connect$
|
|
2105
|
+
const service = useMachine(machine$2, machineProps);
|
|
2106
|
+
const api = connect$2(service);
|
|
2000
2107
|
if (api.present) {
|
|
2001
2108
|
wasEverPresent.current = true;
|
|
2002
2109
|
}
|
|
@@ -2154,6 +2261,12 @@ const DialogBackdrop = forwardRef((props, ref) => {
|
|
|
2154
2261
|
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) });
|
|
2155
2262
|
});
|
|
2156
2263
|
DialogBackdrop.displayName = "DialogBackdrop";
|
|
2264
|
+
const DialogCloseTrigger = forwardRef((props, ref) => {
|
|
2265
|
+
const dialog = useDialogContext();
|
|
2266
|
+
const mergedProps = mergeProps(dialog.getCloseTriggerProps(), props);
|
|
2267
|
+
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
2268
|
+
});
|
|
2269
|
+
DialogCloseTrigger.displayName = "DialogCloseTrigger";
|
|
2157
2270
|
const DialogContent = forwardRef((props, ref) => {
|
|
2158
2271
|
const dialog = useDialogContext();
|
|
2159
2272
|
const presence = usePresenceContext();
|
|
@@ -2769,7 +2882,7 @@ function preventBodyScroll(_document) {
|
|
|
2769
2882
|
body.removeAttribute(LOCK_CLASSNAME);
|
|
2770
2883
|
};
|
|
2771
2884
|
}
|
|
2772
|
-
var anatomy = createAnatomy("dialog").parts(
|
|
2885
|
+
var anatomy$1 = createAnatomy("dialog").parts(
|
|
2773
2886
|
"trigger",
|
|
2774
2887
|
"backdrop",
|
|
2775
2888
|
"positioner",
|
|
@@ -2778,7 +2891,7 @@ var anatomy = createAnatomy("dialog").parts(
|
|
|
2778
2891
|
"description",
|
|
2779
2892
|
"closeTrigger"
|
|
2780
2893
|
);
|
|
2781
|
-
var parts = anatomy.build();
|
|
2894
|
+
var parts$1 = anatomy$1.build();
|
|
2782
2895
|
var getPositionerId = (ctx2) => {
|
|
2783
2896
|
var _a;
|
|
2784
2897
|
return ((_a = ctx2.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx2.id}:positioner`;
|
|
@@ -2787,11 +2900,11 @@ var getBackdropId = (ctx2) => {
|
|
|
2787
2900
|
var _a;
|
|
2788
2901
|
return ((_a = ctx2.ids) == null ? void 0 : _a.backdrop) ?? `dialog:${ctx2.id}:backdrop`;
|
|
2789
2902
|
};
|
|
2790
|
-
var getContentId = (ctx2) => {
|
|
2903
|
+
var getContentId$1 = (ctx2) => {
|
|
2791
2904
|
var _a;
|
|
2792
2905
|
return ((_a = ctx2.ids) == null ? void 0 : _a.content) ?? `dialog:${ctx2.id}:content`;
|
|
2793
2906
|
};
|
|
2794
|
-
var getTriggerId = (ctx2) => {
|
|
2907
|
+
var getTriggerId$1 = (ctx2) => {
|
|
2795
2908
|
var _a;
|
|
2796
2909
|
return ((_a = ctx2.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx2.id}:trigger`;
|
|
2797
2910
|
};
|
|
@@ -2807,14 +2920,14 @@ var getCloseTriggerId = (ctx2) => {
|
|
|
2807
2920
|
var _a;
|
|
2808
2921
|
return ((_a = ctx2.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx2.id}:close`;
|
|
2809
2922
|
};
|
|
2810
|
-
var getContentEl = (ctx2) => ctx2.getById(getContentId(ctx2));
|
|
2923
|
+
var getContentEl$1 = (ctx2) => ctx2.getById(getContentId$1(ctx2));
|
|
2811
2924
|
var getPositionerEl = (ctx2) => ctx2.getById(getPositionerId(ctx2));
|
|
2812
2925
|
var getBackdropEl = (ctx2) => ctx2.getById(getBackdropId(ctx2));
|
|
2813
|
-
var getTriggerEl = (ctx2) => ctx2.getById(getTriggerId(ctx2));
|
|
2926
|
+
var getTriggerEl$1 = (ctx2) => ctx2.getById(getTriggerId$1(ctx2));
|
|
2814
2927
|
var getTitleEl = (ctx2) => ctx2.getById(getTitleId(ctx2));
|
|
2815
2928
|
var getDescriptionEl = (ctx2) => ctx2.getById(getDescriptionId(ctx2));
|
|
2816
2929
|
var getCloseTriggerEl = (ctx2) => ctx2.getById(getCloseTriggerId(ctx2));
|
|
2817
|
-
function connect(service, normalize) {
|
|
2930
|
+
function connect$1(service, normalize) {
|
|
2818
2931
|
const { state, send, context: context2, prop, scope } = service;
|
|
2819
2932
|
const ariaLabel = prop("aria-label");
|
|
2820
2933
|
const open = state.matches("open");
|
|
@@ -2827,14 +2940,14 @@ function connect(service, normalize) {
|
|
|
2827
2940
|
},
|
|
2828
2941
|
getTriggerProps() {
|
|
2829
2942
|
return normalize.button({
|
|
2830
|
-
...parts.trigger.attrs,
|
|
2943
|
+
...parts$1.trigger.attrs,
|
|
2831
2944
|
dir: prop("dir"),
|
|
2832
|
-
id: getTriggerId(scope),
|
|
2945
|
+
id: getTriggerId$1(scope),
|
|
2833
2946
|
"aria-haspopup": "dialog",
|
|
2834
2947
|
type: "button",
|
|
2835
2948
|
"aria-expanded": open,
|
|
2836
2949
|
"data-state": open ? "open" : "closed",
|
|
2837
|
-
"aria-controls": getContentId(scope),
|
|
2950
|
+
"aria-controls": getContentId$1(scope),
|
|
2838
2951
|
onClick(event) {
|
|
2839
2952
|
if (event.defaultPrevented) return;
|
|
2840
2953
|
send({ type: "TOGGLE" });
|
|
@@ -2843,7 +2956,7 @@ function connect(service, normalize) {
|
|
|
2843
2956
|
},
|
|
2844
2957
|
getBackdropProps() {
|
|
2845
2958
|
return normalize.element({
|
|
2846
|
-
...parts.backdrop.attrs,
|
|
2959
|
+
...parts$1.backdrop.attrs,
|
|
2847
2960
|
dir: prop("dir"),
|
|
2848
2961
|
hidden: !open,
|
|
2849
2962
|
id: getBackdropId(scope),
|
|
@@ -2852,7 +2965,7 @@ function connect(service, normalize) {
|
|
|
2852
2965
|
},
|
|
2853
2966
|
getPositionerProps() {
|
|
2854
2967
|
return normalize.element({
|
|
2855
|
-
...parts.positioner.attrs,
|
|
2968
|
+
...parts$1.positioner.attrs,
|
|
2856
2969
|
dir: prop("dir"),
|
|
2857
2970
|
id: getPositionerId(scope),
|
|
2858
2971
|
style: {
|
|
@@ -2863,11 +2976,11 @@ function connect(service, normalize) {
|
|
|
2863
2976
|
getContentProps() {
|
|
2864
2977
|
const rendered = context2.get("rendered");
|
|
2865
2978
|
return normalize.element({
|
|
2866
|
-
...parts.content.attrs,
|
|
2979
|
+
...parts$1.content.attrs,
|
|
2867
2980
|
dir: prop("dir"),
|
|
2868
2981
|
role: prop("role"),
|
|
2869
2982
|
hidden: !open,
|
|
2870
|
-
id: getContentId(scope),
|
|
2983
|
+
id: getContentId$1(scope),
|
|
2871
2984
|
tabIndex: -1,
|
|
2872
2985
|
"data-state": open ? "open" : "closed",
|
|
2873
2986
|
"aria-modal": true,
|
|
@@ -2878,21 +2991,21 @@ function connect(service, normalize) {
|
|
|
2878
2991
|
},
|
|
2879
2992
|
getTitleProps() {
|
|
2880
2993
|
return normalize.element({
|
|
2881
|
-
...parts.title.attrs,
|
|
2994
|
+
...parts$1.title.attrs,
|
|
2882
2995
|
dir: prop("dir"),
|
|
2883
2996
|
id: getTitleId(scope)
|
|
2884
2997
|
});
|
|
2885
2998
|
},
|
|
2886
2999
|
getDescriptionProps() {
|
|
2887
3000
|
return normalize.element({
|
|
2888
|
-
...parts.description.attrs,
|
|
3001
|
+
...parts$1.description.attrs,
|
|
2889
3002
|
dir: prop("dir"),
|
|
2890
3003
|
id: getDescriptionId(scope)
|
|
2891
3004
|
});
|
|
2892
3005
|
},
|
|
2893
3006
|
getCloseTriggerProps() {
|
|
2894
3007
|
return normalize.button({
|
|
2895
|
-
...parts.closeTrigger.attrs,
|
|
3008
|
+
...parts$1.closeTrigger.attrs,
|
|
2896
3009
|
dir: prop("dir"),
|
|
2897
3010
|
id: getCloseTriggerId(scope),
|
|
2898
3011
|
type: "button",
|
|
@@ -2905,7 +3018,7 @@ function connect(service, normalize) {
|
|
|
2905
3018
|
}
|
|
2906
3019
|
};
|
|
2907
3020
|
}
|
|
2908
|
-
var machine = createMachine({
|
|
3021
|
+
var machine$1 = createMachine({
|
|
2909
3022
|
props({ props: props2, scope }) {
|
|
2910
3023
|
const alertDialog = props2.role === "alertdialog";
|
|
2911
3024
|
const initialFocusEl = alertDialog ? () => getCloseTriggerEl(scope) : void 0;
|
|
@@ -3001,11 +3114,11 @@ var machine = createMachine({
|
|
|
3001
3114
|
},
|
|
3002
3115
|
effects: {
|
|
3003
3116
|
trackDismissableElement({ scope, send, prop }) {
|
|
3004
|
-
const getContentEl2 = () => getContentEl(scope);
|
|
3117
|
+
const getContentEl2 = () => getContentEl$1(scope);
|
|
3005
3118
|
return trackDismissableElement(getContentEl2, {
|
|
3006
3119
|
defer: true,
|
|
3007
3120
|
pointerBlocking: prop("modal"),
|
|
3008
|
-
exclude: [getTriggerEl(scope)],
|
|
3121
|
+
exclude: [getTriggerEl$1(scope)],
|
|
3009
3122
|
onInteractOutside(event) {
|
|
3010
3123
|
var _a;
|
|
3011
3124
|
(_a = prop("onInteractOutside")) == null ? void 0 : _a(event);
|
|
@@ -3034,7 +3147,7 @@ var machine = createMachine({
|
|
|
3034
3147
|
},
|
|
3035
3148
|
trapFocus({ scope, prop }) {
|
|
3036
3149
|
if (!prop("trapFocus") || !prop("modal")) return;
|
|
3037
|
-
const contentEl = () => getContentEl(scope);
|
|
3150
|
+
const contentEl = () => getContentEl$1(scope);
|
|
3038
3151
|
return trapFocus(contentEl, {
|
|
3039
3152
|
preventScroll: true,
|
|
3040
3153
|
returnFocusOnDeactivate: !!prop("restoreFocus"),
|
|
@@ -3047,8 +3160,8 @@ var machine = createMachine({
|
|
|
3047
3160
|
},
|
|
3048
3161
|
hideContentBelow({ scope, prop }) {
|
|
3049
3162
|
if (!prop("modal")) return;
|
|
3050
|
-
const
|
|
3051
|
-
return ariaHidden(
|
|
3163
|
+
const getElements2 = () => [getContentEl$1(scope)];
|
|
3164
|
+
return ariaHidden(getElements2, { defer: true });
|
|
3052
3165
|
}
|
|
3053
3166
|
},
|
|
3054
3167
|
actions: {
|
|
@@ -3062,7 +3175,7 @@ var machine = createMachine({
|
|
|
3062
3175
|
},
|
|
3063
3176
|
syncZIndex({ scope }) {
|
|
3064
3177
|
raf$2(() => {
|
|
3065
|
-
const contentEl = getContentEl(scope);
|
|
3178
|
+
const contentEl = getContentEl$1(scope);
|
|
3066
3179
|
if (!contentEl) return;
|
|
3067
3180
|
const styles = getComputedStyle(contentEl);
|
|
3068
3181
|
const elems = [getPositionerEl(scope), getBackdropEl(scope)];
|
|
@@ -3124,8 +3237,8 @@ const useDialog = (props) => {
|
|
|
3124
3237
|
dir,
|
|
3125
3238
|
...props
|
|
3126
3239
|
};
|
|
3127
|
-
const service = useMachine(machine, machineProps);
|
|
3128
|
-
return connect(service, normalizeProps);
|
|
3240
|
+
const service = useMachine(machine$1, machineProps);
|
|
3241
|
+
return connect$1(service, normalizeProps);
|
|
3129
3242
|
};
|
|
3130
3243
|
const DialogRoot = (props) => {
|
|
3131
3244
|
const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
|
|
@@ -3181,6 +3294,595 @@ const getPortalNode = (cb) => {
|
|
|
3181
3294
|
};
|
|
3182
3295
|
const subscribe = () => () => {
|
|
3183
3296
|
};
|
|
3297
|
+
const [TabsProvider, useTabsContext] = createContext({
|
|
3298
|
+
name: "TabsContext",
|
|
3299
|
+
hookName: "useTabsContext",
|
|
3300
|
+
providerName: "<TabsProvider />"
|
|
3301
|
+
});
|
|
3302
|
+
const TabList = forwardRef((props, ref) => {
|
|
3303
|
+
const tabs = useTabsContext();
|
|
3304
|
+
const mergedProps = mergeProps(tabs.getListProps(), props);
|
|
3305
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
3306
|
+
});
|
|
3307
|
+
TabList.displayName = "TabList";
|
|
3308
|
+
const TabTrigger = forwardRef((props, ref) => {
|
|
3309
|
+
const [tabProps, localProps] = createSplitProps()(props, ["disabled", "value"]);
|
|
3310
|
+
const tabs = useTabsContext();
|
|
3311
|
+
const mergedProps = mergeProps(tabs.getTriggerProps(tabProps), localProps);
|
|
3312
|
+
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
3313
|
+
});
|
|
3314
|
+
TabTrigger.displayName = "TabTrigger";
|
|
3315
|
+
var anatomy = createAnatomy("tabs").parts("root", "list", "trigger", "content", "indicator");
|
|
3316
|
+
var parts = anatomy.build();
|
|
3317
|
+
var getRootId = (ctx2) => {
|
|
3318
|
+
var _a;
|
|
3319
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.root) ?? `tabs:${ctx2.id}`;
|
|
3320
|
+
};
|
|
3321
|
+
var getListId = (ctx2) => {
|
|
3322
|
+
var _a;
|
|
3323
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.list) ?? `tabs:${ctx2.id}:list`;
|
|
3324
|
+
};
|
|
3325
|
+
var getContentId = (ctx2, id) => {
|
|
3326
|
+
var _a;
|
|
3327
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.content) ?? `tabs:${ctx2.id}:content-${id}`;
|
|
3328
|
+
};
|
|
3329
|
+
var getTriggerId = (ctx2, id) => {
|
|
3330
|
+
var _a;
|
|
3331
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.trigger) ?? `tabs:${ctx2.id}:trigger-${id}`;
|
|
3332
|
+
};
|
|
3333
|
+
var getIndicatorId = (ctx2) => {
|
|
3334
|
+
var _a;
|
|
3335
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.indicator) ?? `tabs:${ctx2.id}:indicator`;
|
|
3336
|
+
};
|
|
3337
|
+
var getListEl = (ctx2) => ctx2.getById(getListId(ctx2));
|
|
3338
|
+
var getContentEl = (ctx2, id) => ctx2.getById(getContentId(ctx2, id));
|
|
3339
|
+
var getTriggerEl = (ctx2, id) => ctx2.getById(getTriggerId(ctx2, id));
|
|
3340
|
+
var getIndicatorEl = (ctx2) => ctx2.getById(getIndicatorId(ctx2));
|
|
3341
|
+
var getElements = (ctx2) => {
|
|
3342
|
+
const ownerId = CSS.escape(getListId(ctx2));
|
|
3343
|
+
const selector = `[role=tab][data-ownedby='${ownerId}']:not([disabled])`;
|
|
3344
|
+
return queryAll(getListEl(ctx2), selector);
|
|
3345
|
+
};
|
|
3346
|
+
var getFirstTriggerEl = (ctx2) => first(getElements(ctx2));
|
|
3347
|
+
var getLastTriggerEl = (ctx2) => last(getElements(ctx2));
|
|
3348
|
+
var getNextTriggerEl = (ctx2, opts) => nextById(getElements(ctx2), getTriggerId(ctx2, opts.value), opts.loopFocus);
|
|
3349
|
+
var getPrevTriggerEl = (ctx2, opts) => prevById(getElements(ctx2), getTriggerId(ctx2, opts.value), opts.loopFocus);
|
|
3350
|
+
var getOffsetRect = (el) => {
|
|
3351
|
+
return {
|
|
3352
|
+
left: (el == null ? void 0 : el.offsetLeft) ?? 0,
|
|
3353
|
+
top: (el == null ? void 0 : el.offsetTop) ?? 0,
|
|
3354
|
+
width: (el == null ? void 0 : el.offsetWidth) ?? 0,
|
|
3355
|
+
height: (el == null ? void 0 : el.offsetHeight) ?? 0
|
|
3356
|
+
};
|
|
3357
|
+
};
|
|
3358
|
+
var getRectById = (ctx2, id) => {
|
|
3359
|
+
const tab = itemById(getElements(ctx2), getTriggerId(ctx2, id));
|
|
3360
|
+
return resolveRect(getOffsetRect(tab));
|
|
3361
|
+
};
|
|
3362
|
+
var resolveRect = (rect) => ({
|
|
3363
|
+
width: `${rect.width}px`,
|
|
3364
|
+
height: `${rect.height}px`,
|
|
3365
|
+
left: `${rect.left}px`,
|
|
3366
|
+
top: `${rect.top}px`
|
|
3367
|
+
});
|
|
3368
|
+
function connect(service, normalize) {
|
|
3369
|
+
const { state, send, context: context2, prop, scope } = service;
|
|
3370
|
+
const translations = prop("translations");
|
|
3371
|
+
const focused = state.matches("focused");
|
|
3372
|
+
const isVertical = prop("orientation") === "vertical";
|
|
3373
|
+
const isHorizontal = prop("orientation") === "horizontal";
|
|
3374
|
+
const composite = prop("composite");
|
|
3375
|
+
function getTriggerState(props2) {
|
|
3376
|
+
return {
|
|
3377
|
+
selected: context2.get("value") === props2.value,
|
|
3378
|
+
focused: context2.get("focusedValue") === props2.value,
|
|
3379
|
+
disabled: !!props2.disabled
|
|
3380
|
+
};
|
|
3381
|
+
}
|
|
3382
|
+
return {
|
|
3383
|
+
value: context2.get("value"),
|
|
3384
|
+
focusedValue: context2.get("focusedValue"),
|
|
3385
|
+
setValue(value) {
|
|
3386
|
+
send({ type: "SET_VALUE", value });
|
|
3387
|
+
},
|
|
3388
|
+
clearValue() {
|
|
3389
|
+
send({ type: "CLEAR_VALUE" });
|
|
3390
|
+
},
|
|
3391
|
+
setIndicatorRect(value) {
|
|
3392
|
+
const id = getTriggerId(scope, value);
|
|
3393
|
+
send({ type: "SET_INDICATOR_RECT", id });
|
|
3394
|
+
},
|
|
3395
|
+
syncTabIndex() {
|
|
3396
|
+
send({ type: "SYNC_TAB_INDEX" });
|
|
3397
|
+
},
|
|
3398
|
+
selectNext(fromValue) {
|
|
3399
|
+
send({ type: "TAB_FOCUS", value: fromValue, src: "selectNext" });
|
|
3400
|
+
send({ type: "ARROW_NEXT", src: "selectNext" });
|
|
3401
|
+
},
|
|
3402
|
+
selectPrev(fromValue) {
|
|
3403
|
+
send({ type: "TAB_FOCUS", value: fromValue, src: "selectPrev" });
|
|
3404
|
+
send({ type: "ARROW_PREV", src: "selectPrev" });
|
|
3405
|
+
},
|
|
3406
|
+
focus() {
|
|
3407
|
+
var _a;
|
|
3408
|
+
const value = context2.get("value");
|
|
3409
|
+
if (!value) return;
|
|
3410
|
+
(_a = getTriggerEl(scope, value)) == null ? void 0 : _a.focus();
|
|
3411
|
+
},
|
|
3412
|
+
getRootProps() {
|
|
3413
|
+
return normalize.element({
|
|
3414
|
+
...parts.root.attrs,
|
|
3415
|
+
id: getRootId(scope),
|
|
3416
|
+
"data-orientation": prop("orientation"),
|
|
3417
|
+
"data-focus": dataAttr(focused),
|
|
3418
|
+
dir: prop("dir")
|
|
3419
|
+
});
|
|
3420
|
+
},
|
|
3421
|
+
getListProps() {
|
|
3422
|
+
return normalize.element({
|
|
3423
|
+
...parts.list.attrs,
|
|
3424
|
+
id: getListId(scope),
|
|
3425
|
+
role: "tablist",
|
|
3426
|
+
dir: prop("dir"),
|
|
3427
|
+
"data-focus": dataAttr(focused),
|
|
3428
|
+
"aria-orientation": prop("orientation"),
|
|
3429
|
+
"data-orientation": prop("orientation"),
|
|
3430
|
+
"aria-label": translations == null ? void 0 : translations.listLabel,
|
|
3431
|
+
onKeyDown(event) {
|
|
3432
|
+
if (event.defaultPrevented) return;
|
|
3433
|
+
if (!isSelfTarget(event)) return;
|
|
3434
|
+
if (isComposingEvent(event)) return;
|
|
3435
|
+
const keyMap2 = {
|
|
3436
|
+
ArrowDown() {
|
|
3437
|
+
if (isHorizontal) return;
|
|
3438
|
+
send({ type: "ARROW_NEXT", key: "ArrowDown" });
|
|
3439
|
+
},
|
|
3440
|
+
ArrowUp() {
|
|
3441
|
+
if (isHorizontal) return;
|
|
3442
|
+
send({ type: "ARROW_PREV", key: "ArrowUp" });
|
|
3443
|
+
},
|
|
3444
|
+
ArrowLeft() {
|
|
3445
|
+
if (isVertical) return;
|
|
3446
|
+
send({ type: "ARROW_PREV", key: "ArrowLeft" });
|
|
3447
|
+
},
|
|
3448
|
+
ArrowRight() {
|
|
3449
|
+
if (isVertical) return;
|
|
3450
|
+
send({ type: "ARROW_NEXT", key: "ArrowRight" });
|
|
3451
|
+
},
|
|
3452
|
+
Home() {
|
|
3453
|
+
send({ type: "HOME" });
|
|
3454
|
+
},
|
|
3455
|
+
End() {
|
|
3456
|
+
send({ type: "END" });
|
|
3457
|
+
},
|
|
3458
|
+
Enter() {
|
|
3459
|
+
send({ type: "ENTER" });
|
|
3460
|
+
}
|
|
3461
|
+
};
|
|
3462
|
+
let key = getEventKey(event, {
|
|
3463
|
+
dir: prop("dir"),
|
|
3464
|
+
orientation: prop("orientation")
|
|
3465
|
+
});
|
|
3466
|
+
const exec = keyMap2[key];
|
|
3467
|
+
if (exec) {
|
|
3468
|
+
event.preventDefault();
|
|
3469
|
+
exec(event);
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
});
|
|
3473
|
+
},
|
|
3474
|
+
getTriggerState,
|
|
3475
|
+
getTriggerProps(props2) {
|
|
3476
|
+
const { value, disabled } = props2;
|
|
3477
|
+
const triggerState = getTriggerState(props2);
|
|
3478
|
+
return normalize.button({
|
|
3479
|
+
...parts.trigger.attrs,
|
|
3480
|
+
role: "tab",
|
|
3481
|
+
type: "button",
|
|
3482
|
+
disabled,
|
|
3483
|
+
dir: prop("dir"),
|
|
3484
|
+
"data-orientation": prop("orientation"),
|
|
3485
|
+
"data-disabled": dataAttr(disabled),
|
|
3486
|
+
"aria-disabled": disabled,
|
|
3487
|
+
"data-value": value,
|
|
3488
|
+
"aria-selected": triggerState.selected,
|
|
3489
|
+
"data-selected": dataAttr(triggerState.selected),
|
|
3490
|
+
"data-focus": dataAttr(triggerState.focused),
|
|
3491
|
+
"aria-controls": triggerState.selected ? getContentId(scope, value) : void 0,
|
|
3492
|
+
"data-ownedby": getListId(scope),
|
|
3493
|
+
"data-ssr": dataAttr(context2.get("ssr")),
|
|
3494
|
+
id: getTriggerId(scope, value),
|
|
3495
|
+
tabIndex: triggerState.selected && composite ? 0 : -1,
|
|
3496
|
+
onFocus() {
|
|
3497
|
+
send({ type: "TAB_FOCUS", value });
|
|
3498
|
+
},
|
|
3499
|
+
onBlur(event) {
|
|
3500
|
+
const target = event.relatedTarget;
|
|
3501
|
+
if ((target == null ? void 0 : target.getAttribute("role")) !== "tab") {
|
|
3502
|
+
send({ type: "TAB_BLUR" });
|
|
3503
|
+
}
|
|
3504
|
+
},
|
|
3505
|
+
onClick(event) {
|
|
3506
|
+
if (event.defaultPrevented) return;
|
|
3507
|
+
if (disabled) return;
|
|
3508
|
+
if (isSafari()) {
|
|
3509
|
+
event.currentTarget.focus();
|
|
3510
|
+
}
|
|
3511
|
+
send({ type: "TAB_CLICK", value });
|
|
3512
|
+
}
|
|
3513
|
+
});
|
|
3514
|
+
},
|
|
3515
|
+
getContentProps(props2) {
|
|
3516
|
+
const { value } = props2;
|
|
3517
|
+
const selected = context2.get("value") === value;
|
|
3518
|
+
return normalize.element({
|
|
3519
|
+
...parts.content.attrs,
|
|
3520
|
+
dir: prop("dir"),
|
|
3521
|
+
id: getContentId(scope, value),
|
|
3522
|
+
tabIndex: composite ? 0 : -1,
|
|
3523
|
+
"aria-labelledby": getTriggerId(scope, value),
|
|
3524
|
+
role: "tabpanel",
|
|
3525
|
+
"data-ownedby": getListId(scope),
|
|
3526
|
+
"data-selected": dataAttr(selected),
|
|
3527
|
+
"data-orientation": prop("orientation"),
|
|
3528
|
+
hidden: !selected
|
|
3529
|
+
});
|
|
3530
|
+
},
|
|
3531
|
+
getIndicatorProps() {
|
|
3532
|
+
const indicatorRect = context2.get("indicatorRect");
|
|
3533
|
+
const indicatorTransition = context2.get("indicatorTransition");
|
|
3534
|
+
return normalize.element({
|
|
3535
|
+
id: getIndicatorId(scope),
|
|
3536
|
+
...parts.indicator.attrs,
|
|
3537
|
+
dir: prop("dir"),
|
|
3538
|
+
"data-orientation": prop("orientation"),
|
|
3539
|
+
style: {
|
|
3540
|
+
"--transition-property": "left, right, top, bottom, width, height",
|
|
3541
|
+
"--left": indicatorRect.left,
|
|
3542
|
+
"--top": indicatorRect.top,
|
|
3543
|
+
"--width": indicatorRect.width,
|
|
3544
|
+
"--height": indicatorRect.height,
|
|
3545
|
+
position: "absolute",
|
|
3546
|
+
willChange: "var(--transition-property)",
|
|
3547
|
+
transitionProperty: "var(--transition-property)",
|
|
3548
|
+
transitionDuration: indicatorTransition ? "var(--transition-duration, 150ms)" : "0ms",
|
|
3549
|
+
transitionTimingFunction: "var(--transition-timing-function)",
|
|
3550
|
+
[isHorizontal ? "left" : "top"]: isHorizontal ? "var(--left)" : "var(--top)"
|
|
3551
|
+
}
|
|
3552
|
+
});
|
|
3553
|
+
}
|
|
3554
|
+
};
|
|
3555
|
+
}
|
|
3556
|
+
var { not } = createGuards();
|
|
3557
|
+
var machine = createMachine({
|
|
3558
|
+
props({ props: props2 }) {
|
|
3559
|
+
return {
|
|
3560
|
+
dir: "ltr",
|
|
3561
|
+
orientation: "horizontal",
|
|
3562
|
+
activationMode: "automatic",
|
|
3563
|
+
loopFocus: true,
|
|
3564
|
+
composite: true,
|
|
3565
|
+
navigate(details) {
|
|
3566
|
+
clickIfLink(details.node);
|
|
3567
|
+
},
|
|
3568
|
+
defaultValue: null,
|
|
3569
|
+
...props2
|
|
3570
|
+
};
|
|
3571
|
+
},
|
|
3572
|
+
initialState() {
|
|
3573
|
+
return "idle";
|
|
3574
|
+
},
|
|
3575
|
+
context({ prop, bindable }) {
|
|
3576
|
+
return {
|
|
3577
|
+
value: bindable(() => ({
|
|
3578
|
+
defaultValue: prop("defaultValue"),
|
|
3579
|
+
value: prop("value"),
|
|
3580
|
+
onChange(value) {
|
|
3581
|
+
var _a;
|
|
3582
|
+
(_a = prop("onValueChange")) == null ? void 0 : _a({ value });
|
|
3583
|
+
}
|
|
3584
|
+
})),
|
|
3585
|
+
focusedValue: bindable(() => ({
|
|
3586
|
+
defaultValue: prop("value") || prop("defaultValue"),
|
|
3587
|
+
sync: true,
|
|
3588
|
+
onChange(value) {
|
|
3589
|
+
var _a;
|
|
3590
|
+
(_a = prop("onFocusChange")) == null ? void 0 : _a({ focusedValue: value });
|
|
3591
|
+
}
|
|
3592
|
+
})),
|
|
3593
|
+
ssr: bindable(() => ({ defaultValue: true })),
|
|
3594
|
+
indicatorTransition: bindable(() => ({ defaultValue: false })),
|
|
3595
|
+
indicatorRect: bindable(() => ({
|
|
3596
|
+
defaultValue: { left: "0px", top: "0px", width: "0px", height: "0px" }
|
|
3597
|
+
}))
|
|
3598
|
+
};
|
|
3599
|
+
},
|
|
3600
|
+
watch({ context: context2, prop, track, action }) {
|
|
3601
|
+
track([() => context2.get("value")], () => {
|
|
3602
|
+
action(["allowIndicatorTransition", "syncIndicatorRect", "syncTabIndex", "navigateIfNeeded"]);
|
|
3603
|
+
});
|
|
3604
|
+
track([() => prop("dir"), () => prop("orientation")], () => {
|
|
3605
|
+
action(["syncIndicatorRect"]);
|
|
3606
|
+
});
|
|
3607
|
+
},
|
|
3608
|
+
on: {
|
|
3609
|
+
SET_VALUE: {
|
|
3610
|
+
actions: ["setValue"]
|
|
3611
|
+
},
|
|
3612
|
+
CLEAR_VALUE: {
|
|
3613
|
+
actions: ["clearValue"]
|
|
3614
|
+
},
|
|
3615
|
+
SET_INDICATOR_RECT: {
|
|
3616
|
+
actions: ["setIndicatorRect"]
|
|
3617
|
+
},
|
|
3618
|
+
SYNC_TAB_INDEX: {
|
|
3619
|
+
actions: ["syncTabIndex"]
|
|
3620
|
+
}
|
|
3621
|
+
},
|
|
3622
|
+
entry: ["syncIndicatorRect", "syncTabIndex", "syncSsr"],
|
|
3623
|
+
exit: ["cleanupObserver"],
|
|
3624
|
+
states: {
|
|
3625
|
+
idle: {
|
|
3626
|
+
on: {
|
|
3627
|
+
TAB_FOCUS: {
|
|
3628
|
+
target: "focused",
|
|
3629
|
+
actions: ["setFocusedValue"]
|
|
3630
|
+
},
|
|
3631
|
+
TAB_CLICK: {
|
|
3632
|
+
target: "focused",
|
|
3633
|
+
actions: ["setFocusedValue", "setValue"]
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
},
|
|
3637
|
+
focused: {
|
|
3638
|
+
on: {
|
|
3639
|
+
TAB_CLICK: {
|
|
3640
|
+
target: "focused",
|
|
3641
|
+
actions: ["setFocusedValue", "setValue"]
|
|
3642
|
+
},
|
|
3643
|
+
ARROW_PREV: [
|
|
3644
|
+
{
|
|
3645
|
+
guard: "selectOnFocus",
|
|
3646
|
+
actions: ["focusPrevTab", "selectFocusedTab"]
|
|
3647
|
+
},
|
|
3648
|
+
{
|
|
3649
|
+
actions: ["focusPrevTab"]
|
|
3650
|
+
}
|
|
3651
|
+
],
|
|
3652
|
+
ARROW_NEXT: [
|
|
3653
|
+
{
|
|
3654
|
+
guard: "selectOnFocus",
|
|
3655
|
+
actions: ["focusNextTab", "selectFocusedTab"]
|
|
3656
|
+
},
|
|
3657
|
+
{
|
|
3658
|
+
actions: ["focusNextTab"]
|
|
3659
|
+
}
|
|
3660
|
+
],
|
|
3661
|
+
HOME: [
|
|
3662
|
+
{
|
|
3663
|
+
guard: "selectOnFocus",
|
|
3664
|
+
actions: ["focusFirstTab", "selectFocusedTab"]
|
|
3665
|
+
},
|
|
3666
|
+
{
|
|
3667
|
+
actions: ["focusFirstTab"]
|
|
3668
|
+
}
|
|
3669
|
+
],
|
|
3670
|
+
END: [
|
|
3671
|
+
{
|
|
3672
|
+
guard: "selectOnFocus",
|
|
3673
|
+
actions: ["focusLastTab", "selectFocusedTab"]
|
|
3674
|
+
},
|
|
3675
|
+
{
|
|
3676
|
+
actions: ["focusLastTab"]
|
|
3677
|
+
}
|
|
3678
|
+
],
|
|
3679
|
+
ENTER: {
|
|
3680
|
+
guard: not("selectOnFocus"),
|
|
3681
|
+
actions: ["selectFocusedTab"]
|
|
3682
|
+
},
|
|
3683
|
+
TAB_FOCUS: {
|
|
3684
|
+
actions: ["setFocusedValue"]
|
|
3685
|
+
},
|
|
3686
|
+
TAB_BLUR: {
|
|
3687
|
+
target: "idle",
|
|
3688
|
+
actions: ["clearFocusedValue"]
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
},
|
|
3693
|
+
implementations: {
|
|
3694
|
+
guards: {
|
|
3695
|
+
selectOnFocus: ({ prop }) => prop("activationMode") === "automatic"
|
|
3696
|
+
},
|
|
3697
|
+
actions: {
|
|
3698
|
+
selectFocusedTab({ context: context2, prop }) {
|
|
3699
|
+
raf$2(() => {
|
|
3700
|
+
const focusedValue = context2.get("focusedValue");
|
|
3701
|
+
if (!focusedValue) return;
|
|
3702
|
+
const nullable = prop("deselectable") && context2.get("value") === focusedValue;
|
|
3703
|
+
const value = nullable ? null : focusedValue;
|
|
3704
|
+
context2.set("value", value);
|
|
3705
|
+
});
|
|
3706
|
+
},
|
|
3707
|
+
setFocusedValue({ context: context2, event, flush: flush2 }) {
|
|
3708
|
+
if (event.value == null) return;
|
|
3709
|
+
flush2(() => {
|
|
3710
|
+
context2.set("focusedValue", event.value);
|
|
3711
|
+
});
|
|
3712
|
+
},
|
|
3713
|
+
clearFocusedValue({ context: context2 }) {
|
|
3714
|
+
context2.set("focusedValue", null);
|
|
3715
|
+
},
|
|
3716
|
+
setValue({ context: context2, event, prop }) {
|
|
3717
|
+
const nullable = prop("deselectable") && context2.get("value") === context2.get("focusedValue");
|
|
3718
|
+
context2.set("value", nullable ? null : event.value);
|
|
3719
|
+
},
|
|
3720
|
+
clearValue({ context: context2 }) {
|
|
3721
|
+
context2.set("value", null);
|
|
3722
|
+
},
|
|
3723
|
+
focusFirstTab({ scope }) {
|
|
3724
|
+
raf$2(() => {
|
|
3725
|
+
var _a;
|
|
3726
|
+
(_a = getFirstTriggerEl(scope)) == null ? void 0 : _a.focus();
|
|
3727
|
+
});
|
|
3728
|
+
},
|
|
3729
|
+
focusLastTab({ scope }) {
|
|
3730
|
+
raf$2(() => {
|
|
3731
|
+
var _a;
|
|
3732
|
+
(_a = getLastTriggerEl(scope)) == null ? void 0 : _a.focus();
|
|
3733
|
+
});
|
|
3734
|
+
},
|
|
3735
|
+
focusNextTab({ context: context2, prop, scope, event }) {
|
|
3736
|
+
const focusedValue = event.value ?? context2.get("focusedValue");
|
|
3737
|
+
if (!focusedValue) return;
|
|
3738
|
+
const triggerEl = getNextTriggerEl(scope, {
|
|
3739
|
+
value: focusedValue,
|
|
3740
|
+
loopFocus: prop("loopFocus")
|
|
3741
|
+
});
|
|
3742
|
+
raf$2(() => {
|
|
3743
|
+
if (prop("composite")) {
|
|
3744
|
+
triggerEl == null ? void 0 : triggerEl.focus();
|
|
3745
|
+
} else if ((triggerEl == null ? void 0 : triggerEl.dataset.value) != null) {
|
|
3746
|
+
context2.set("focusedValue", triggerEl.dataset.value);
|
|
3747
|
+
}
|
|
3748
|
+
});
|
|
3749
|
+
},
|
|
3750
|
+
focusPrevTab({ context: context2, prop, scope, event }) {
|
|
3751
|
+
const focusedValue = event.value ?? context2.get("focusedValue");
|
|
3752
|
+
if (!focusedValue) return;
|
|
3753
|
+
const triggerEl = getPrevTriggerEl(scope, {
|
|
3754
|
+
value: focusedValue,
|
|
3755
|
+
loopFocus: prop("loopFocus")
|
|
3756
|
+
});
|
|
3757
|
+
raf$2(() => {
|
|
3758
|
+
if (prop("composite")) {
|
|
3759
|
+
triggerEl == null ? void 0 : triggerEl.focus();
|
|
3760
|
+
} else if ((triggerEl == null ? void 0 : triggerEl.dataset.value) != null) {
|
|
3761
|
+
context2.set("focusedValue", triggerEl.dataset.value);
|
|
3762
|
+
}
|
|
3763
|
+
});
|
|
3764
|
+
},
|
|
3765
|
+
syncTabIndex({ context: context2, scope }) {
|
|
3766
|
+
raf$2(() => {
|
|
3767
|
+
const value = context2.get("value");
|
|
3768
|
+
if (!value) return;
|
|
3769
|
+
const contentEl = getContentEl(scope, value);
|
|
3770
|
+
if (!contentEl) return;
|
|
3771
|
+
const focusables = getFocusables(contentEl);
|
|
3772
|
+
if (focusables.length > 0) {
|
|
3773
|
+
contentEl.removeAttribute("tabindex");
|
|
3774
|
+
} else {
|
|
3775
|
+
contentEl.setAttribute("tabindex", "0");
|
|
3776
|
+
}
|
|
3777
|
+
});
|
|
3778
|
+
},
|
|
3779
|
+
cleanupObserver({ refs }) {
|
|
3780
|
+
const cleanup = refs.get("indicatorCleanup");
|
|
3781
|
+
if (cleanup) cleanup();
|
|
3782
|
+
},
|
|
3783
|
+
allowIndicatorTransition({ context: context2 }) {
|
|
3784
|
+
context2.set("indicatorTransition", true);
|
|
3785
|
+
},
|
|
3786
|
+
setIndicatorRect({ context: context2, event, scope }) {
|
|
3787
|
+
const value = event.id ?? context2.get("value");
|
|
3788
|
+
const indicatorEl = getIndicatorEl(scope);
|
|
3789
|
+
if (!indicatorEl || !value) return;
|
|
3790
|
+
const triggerEl = getTriggerEl(scope, value);
|
|
3791
|
+
if (!triggerEl) return;
|
|
3792
|
+
context2.set("indicatorRect", getRectById(scope, value));
|
|
3793
|
+
nextTick(() => {
|
|
3794
|
+
context2.set("indicatorTransition", false);
|
|
3795
|
+
});
|
|
3796
|
+
},
|
|
3797
|
+
syncSsr({ context: context2 }) {
|
|
3798
|
+
context2.set("ssr", false);
|
|
3799
|
+
},
|
|
3800
|
+
syncIndicatorRect({ context: context2, refs, scope }) {
|
|
3801
|
+
const cleanup = refs.get("indicatorCleanup");
|
|
3802
|
+
if (cleanup) cleanup();
|
|
3803
|
+
const value = context2.get("value");
|
|
3804
|
+
if (!value) return;
|
|
3805
|
+
const triggerEl = getTriggerEl(scope, value);
|
|
3806
|
+
const indicatorEl = getIndicatorEl(scope);
|
|
3807
|
+
if (!triggerEl || !indicatorEl) return;
|
|
3808
|
+
const exec = () => {
|
|
3809
|
+
const rect = getOffsetRect(triggerEl);
|
|
3810
|
+
context2.set("indicatorRect", resolveRect(rect));
|
|
3811
|
+
nextTick(() => {
|
|
3812
|
+
context2.set("indicatorTransition", false);
|
|
3813
|
+
});
|
|
3814
|
+
};
|
|
3815
|
+
exec();
|
|
3816
|
+
const win = scope.getWin();
|
|
3817
|
+
const obs = new win.ResizeObserver(exec);
|
|
3818
|
+
obs.observe(triggerEl);
|
|
3819
|
+
refs.set("indicatorCleanup", () => obs.disconnect());
|
|
3820
|
+
},
|
|
3821
|
+
navigateIfNeeded({ context: context2, prop, scope }) {
|
|
3822
|
+
var _a;
|
|
3823
|
+
const value = context2.get("value");
|
|
3824
|
+
if (!value) return;
|
|
3825
|
+
const triggerEl = getTriggerEl(scope, value);
|
|
3826
|
+
if (!isAnchorElement(triggerEl)) return;
|
|
3827
|
+
(_a = prop("navigate")) == null ? void 0 : _a({ value, node: triggerEl });
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
});
|
|
3832
|
+
createProps()([
|
|
3833
|
+
"activationMode",
|
|
3834
|
+
"composite",
|
|
3835
|
+
"deselectable",
|
|
3836
|
+
"dir",
|
|
3837
|
+
"getRootNode",
|
|
3838
|
+
"id",
|
|
3839
|
+
"ids",
|
|
3840
|
+
"loopFocus",
|
|
3841
|
+
"navigate",
|
|
3842
|
+
"onFocusChange",
|
|
3843
|
+
"onValueChange",
|
|
3844
|
+
"orientation",
|
|
3845
|
+
"translations",
|
|
3846
|
+
"value",
|
|
3847
|
+
"defaultValue"
|
|
3848
|
+
]);
|
|
3849
|
+
createProps()(["disabled", "value"]);
|
|
3850
|
+
createProps()(["value"]);
|
|
3851
|
+
const useTabs = (props) => {
|
|
3852
|
+
const id = useId();
|
|
3853
|
+
const { getRootNode } = useEnvironmentContext();
|
|
3854
|
+
const { dir } = useLocaleContext();
|
|
3855
|
+
const machineProps = {
|
|
3856
|
+
id,
|
|
3857
|
+
dir,
|
|
3858
|
+
getRootNode,
|
|
3859
|
+
...props
|
|
3860
|
+
};
|
|
3861
|
+
const service = useMachine(machine, machineProps);
|
|
3862
|
+
return connect(service, normalizeProps);
|
|
3863
|
+
};
|
|
3864
|
+
const TabsRoot = forwardRef((props, ref) => {
|
|
3865
|
+
const [renderStrategyProps, tabsProps] = splitRenderStrategyProps(props);
|
|
3866
|
+
const [useTabsProps, localprops] = createSplitProps()(tabsProps, [
|
|
3867
|
+
"activationMode",
|
|
3868
|
+
"composite",
|
|
3869
|
+
"defaultValue",
|
|
3870
|
+
"deselectable",
|
|
3871
|
+
"id",
|
|
3872
|
+
"ids",
|
|
3873
|
+
"loopFocus",
|
|
3874
|
+
"navigate",
|
|
3875
|
+
"onFocusChange",
|
|
3876
|
+
"onValueChange",
|
|
3877
|
+
"orientation",
|
|
3878
|
+
"translations",
|
|
3879
|
+
"value"
|
|
3880
|
+
]);
|
|
3881
|
+
const tabs = useTabs(useTabsProps);
|
|
3882
|
+
const mergedProps = mergeProps(tabs.getRootProps(), localprops);
|
|
3883
|
+
return /* @__PURE__ */ jsx(TabsProvider, { value: tabs, children: /* @__PURE__ */ jsx(RenderStrategyPropsProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) }) });
|
|
3884
|
+
});
|
|
3885
|
+
TabsRoot.displayName = "TabsRoot";
|
|
3184
3886
|
const spinnerRecipe = cva({
|
|
3185
3887
|
base: {
|
|
3186
3888
|
display: "inline-block",
|
|
@@ -3699,6 +4401,14 @@ const textRecipe = cva({
|
|
|
3699
4401
|
variant: "body.md"
|
|
3700
4402
|
},
|
|
3701
4403
|
variants: {
|
|
4404
|
+
font: {
|
|
4405
|
+
inter: {
|
|
4406
|
+
fontFamily: "inter"
|
|
4407
|
+
},
|
|
4408
|
+
notoSans: {
|
|
4409
|
+
fontFamily: "notoSans"
|
|
4410
|
+
}
|
|
4411
|
+
},
|
|
3702
4412
|
variant: {
|
|
3703
4413
|
"display.lg": {
|
|
3704
4414
|
textStyle: "display.lg"
|
|
@@ -3718,6 +4428,9 @@ const textRecipe = cva({
|
|
|
3718
4428
|
"title.md": {
|
|
3719
4429
|
textStyle: "title.md"
|
|
3720
4430
|
},
|
|
4431
|
+
"title.sm": {
|
|
4432
|
+
textStyle: "title.sm"
|
|
4433
|
+
},
|
|
3721
4434
|
"body.lg": {
|
|
3722
4435
|
textStyle: "body.lg"
|
|
3723
4436
|
},
|
|
@@ -3737,7 +4450,7 @@ const textRecipe = cva({
|
|
|
3737
4450
|
}
|
|
3738
4451
|
});
|
|
3739
4452
|
const Text = forwardRef((props, ref) => {
|
|
3740
|
-
const { variant = "body.md", children, ...rest } = props;
|
|
4453
|
+
const { variant = "body.md", font = "notoSans", children, ...rest } = props;
|
|
3741
4454
|
const textType = (variant == null ? void 0 : variant.split(".")[0]) || "body";
|
|
3742
4455
|
const componentMap = {
|
|
3743
4456
|
display: styled("h1", textRecipe),
|
|
@@ -3747,7 +4460,7 @@ const Text = forwardRef((props, ref) => {
|
|
|
3747
4460
|
label: styled("span", textRecipe)
|
|
3748
4461
|
};
|
|
3749
4462
|
const TextComponent = componentMap[textType];
|
|
3750
|
-
return /* @__PURE__ */ jsx(TextComponent, { ref, textStyle: variant, ...rest, children });
|
|
4463
|
+
return /* @__PURE__ */ jsx(TextComponent, { ref, textStyle: variant, font, ...rest, children });
|
|
3751
4464
|
});
|
|
3752
4465
|
Text.displayName = "Text";
|
|
3753
4466
|
const shouldForwardProp = (prop, variantKeys, options = {}) => {
|
|
@@ -3797,7 +4510,7 @@ const createStyleContext = (recipe) => {
|
|
|
3797
4510
|
};
|
|
3798
4511
|
const dialogRecipe = sva({
|
|
3799
4512
|
className: "dialog",
|
|
3800
|
-
slots: anatomy.keys(),
|
|
4513
|
+
slots: [...anatomy$1.keys(), "header", "footer", "body"],
|
|
3801
4514
|
base: {
|
|
3802
4515
|
backdrop: {
|
|
3803
4516
|
backdropFilter: "blur(4px)",
|
|
@@ -3826,17 +4539,22 @@ const dialogRecipe = sva({
|
|
|
3826
4539
|
overflow: "auto",
|
|
3827
4540
|
position: "fixed",
|
|
3828
4541
|
top: "0",
|
|
3829
|
-
width: "
|
|
3830
|
-
height: "
|
|
3831
|
-
zIndex: "modal"
|
|
4542
|
+
width: "100vw",
|
|
4543
|
+
height: "100vh",
|
|
4544
|
+
zIndex: "modal",
|
|
4545
|
+
p: "4"
|
|
3832
4546
|
},
|
|
3833
4547
|
content: {
|
|
3834
|
-
background: "white",
|
|
3835
|
-
borderRadius: "sm",
|
|
3836
|
-
boxShadow: "overlay",
|
|
3837
|
-
minW: "sm",
|
|
3838
4548
|
position: "relative",
|
|
3839
|
-
|
|
4549
|
+
backgroundColor: "surface.layer_1",
|
|
4550
|
+
borderRadius: "lg",
|
|
4551
|
+
width: "full",
|
|
4552
|
+
minW: "xs",
|
|
4553
|
+
maxW: "md",
|
|
4554
|
+
display: "flex",
|
|
4555
|
+
flexDirection: "column",
|
|
4556
|
+
gap: "6",
|
|
4557
|
+
py: "4",
|
|
3840
4558
|
_open: {
|
|
3841
4559
|
animation: "dialog-in"
|
|
3842
4560
|
},
|
|
@@ -3844,31 +4562,80 @@ const dialogRecipe = sva({
|
|
|
3844
4562
|
animation: "dialog-out"
|
|
3845
4563
|
}
|
|
3846
4564
|
},
|
|
4565
|
+
closeTrigger: {
|
|
4566
|
+
position: "absolute",
|
|
4567
|
+
top: "4",
|
|
4568
|
+
right: "4"
|
|
4569
|
+
},
|
|
3847
4570
|
title: {
|
|
3848
|
-
|
|
4571
|
+
display: "flex",
|
|
4572
|
+
alignItems: "center",
|
|
4573
|
+
gap: "1",
|
|
4574
|
+
color: "content.neutral.default",
|
|
4575
|
+
textStyle: "headline.sm"
|
|
3849
4576
|
},
|
|
3850
4577
|
description: {
|
|
3851
|
-
color: "content.neutral.
|
|
4578
|
+
color: "content.neutral.default",
|
|
3852
4579
|
textStyle: "body.md"
|
|
4580
|
+
},
|
|
4581
|
+
header: {
|
|
4582
|
+
display: "flex",
|
|
4583
|
+
flexDirection: "column",
|
|
4584
|
+
gap: "2",
|
|
4585
|
+
px: "6"
|
|
4586
|
+
},
|
|
4587
|
+
footer: {
|
|
4588
|
+
display: "flex",
|
|
4589
|
+
gap: "2",
|
|
4590
|
+
px: "4",
|
|
4591
|
+
justifyContent: "flex-end"
|
|
4592
|
+
},
|
|
4593
|
+
body: {
|
|
4594
|
+
px: "4"
|
|
3853
4595
|
}
|
|
3854
4596
|
}
|
|
3855
4597
|
});
|
|
3856
|
-
const { withRootProvider, withContext } = createStyleContext(dialogRecipe);
|
|
3857
|
-
const Root = withRootProvider(DialogRoot);
|
|
3858
|
-
const Backdrop$1 = withContext(DialogBackdrop, "backdrop");
|
|
3859
|
-
const Trigger = withContext(DialogTrigger, "trigger");
|
|
3860
|
-
const Content = withContext(DialogContent, "content");
|
|
3861
|
-
const Title = withContext(DialogTitle, "title");
|
|
3862
|
-
const Description = withContext(DialogDescription, "description");
|
|
3863
|
-
const Positioner = withContext(DialogPositioner, "positioner");
|
|
4598
|
+
const { withRootProvider: withRootProvider$1, withContext: withContext$1 } = createStyleContext(dialogRecipe);
|
|
4599
|
+
const Root$1 = withRootProvider$1(DialogRoot);
|
|
4600
|
+
const Backdrop$1 = withContext$1(DialogBackdrop, "backdrop");
|
|
4601
|
+
const Trigger$1 = withContext$1(DialogTrigger, "trigger");
|
|
4602
|
+
const Content = withContext$1(DialogContent, "content");
|
|
4603
|
+
const Title = withContext$1(DialogTitle, "title");
|
|
4604
|
+
const Description = withContext$1(DialogDescription, "description");
|
|
4605
|
+
const Positioner = withContext$1(DialogPositioner, "positioner");
|
|
4606
|
+
const Header = withContext$1(ark.header, "header");
|
|
4607
|
+
const Footer = withContext$1(
|
|
4608
|
+
({ orientation = "horizontal", className, ...props }) => {
|
|
4609
|
+
return /* @__PURE__ */ jsx(
|
|
4610
|
+
ark.footer,
|
|
4611
|
+
{
|
|
4612
|
+
className: cx(
|
|
4613
|
+
css$1({
|
|
4614
|
+
display: "flex",
|
|
4615
|
+
flexDirection: orientation === "horizontal" ? "row" : "column"
|
|
4616
|
+
}),
|
|
4617
|
+
className
|
|
4618
|
+
),
|
|
4619
|
+
...props
|
|
4620
|
+
}
|
|
4621
|
+
);
|
|
4622
|
+
},
|
|
4623
|
+
"footer"
|
|
4624
|
+
);
|
|
4625
|
+
const Body = withContext$1(ark.main, "body");
|
|
4626
|
+
const CloseTrigger = withContext$1(DialogCloseTrigger, "closeTrigger");
|
|
3864
4627
|
const Dialog = {
|
|
3865
|
-
Root,
|
|
4628
|
+
Root: Root$1,
|
|
3866
4629
|
Backdrop: Backdrop$1,
|
|
3867
|
-
Trigger,
|
|
4630
|
+
Trigger: Trigger$1,
|
|
3868
4631
|
Content,
|
|
3869
4632
|
Title,
|
|
3870
4633
|
Description,
|
|
3871
|
-
Positioner
|
|
4634
|
+
Positioner,
|
|
4635
|
+
Header,
|
|
4636
|
+
Footer,
|
|
4637
|
+
Body,
|
|
4638
|
+
CloseTrigger
|
|
3872
4639
|
};
|
|
3873
4640
|
const iconButtonRecipe = cva({
|
|
3874
4641
|
base: {
|
|
@@ -7661,6 +8428,220 @@ const BottomSheet = (props) => {
|
|
|
7661
8428
|
};
|
|
7662
8429
|
BottomSheetFrame.displayName = "BottomSheetFrame";
|
|
7663
8430
|
Backdrop.displayName = "Backdrop";
|
|
8431
|
+
const navigationRecipe = sva({
|
|
8432
|
+
className: "navigation",
|
|
8433
|
+
slots: anatomy.keys(),
|
|
8434
|
+
base: {
|
|
8435
|
+
root: {
|
|
8436
|
+
bg: "surface.layer_1",
|
|
8437
|
+
zIndex: 10
|
|
8438
|
+
},
|
|
8439
|
+
list: {
|
|
8440
|
+
width: "100%",
|
|
8441
|
+
display: "flex",
|
|
8442
|
+
flexDirection: "row",
|
|
8443
|
+
justifyContent: "space-around",
|
|
8444
|
+
bg: "surface.layer_1",
|
|
8445
|
+
pt: 2,
|
|
8446
|
+
pb: 8
|
|
8447
|
+
},
|
|
8448
|
+
trigger: {
|
|
8449
|
+
display: "flex",
|
|
8450
|
+
flexDirection: "column",
|
|
8451
|
+
alignItems: "center",
|
|
8452
|
+
justifyContent: "center",
|
|
8453
|
+
h: "48px",
|
|
8454
|
+
w: "64px",
|
|
8455
|
+
px: 2,
|
|
8456
|
+
textStyle: "label.sm",
|
|
8457
|
+
color: "content.neutral.subtlest",
|
|
8458
|
+
transitionDuration: "normal",
|
|
8459
|
+
transitionProperty: "background, border-color, color, box-shadow",
|
|
8460
|
+
transitionTimingFunction: "default",
|
|
8461
|
+
userSelect: "none",
|
|
8462
|
+
rounded: "lg",
|
|
8463
|
+
cursor: "pointer",
|
|
8464
|
+
_hover: {
|
|
8465
|
+
bg: "background.neutral.selected"
|
|
8466
|
+
},
|
|
8467
|
+
_selected: {
|
|
8468
|
+
color: "content.neutral.default",
|
|
8469
|
+
bg: "background.neutral.default"
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
}
|
|
8473
|
+
});
|
|
8474
|
+
const { withRootProvider, withContext } = createStyleContext(navigationRecipe);
|
|
8475
|
+
const Root = withRootProvider(TabsRoot);
|
|
8476
|
+
const Trigger = withContext(
|
|
8477
|
+
({ icon, label, ...props }) => /* @__PURE__ */ jsxs(TabTrigger, { ...props, children: [
|
|
8478
|
+
icon,
|
|
8479
|
+
label
|
|
8480
|
+
] }),
|
|
8481
|
+
"trigger"
|
|
8482
|
+
);
|
|
8483
|
+
const List = withContext(TabList, "list");
|
|
8484
|
+
const Navigation = {
|
|
8485
|
+
Root,
|
|
8486
|
+
Item: Trigger,
|
|
8487
|
+
List
|
|
8488
|
+
};
|
|
8489
|
+
const tagRecipe = cva({
|
|
8490
|
+
base: {
|
|
8491
|
+
display: "inline-flex",
|
|
8492
|
+
alignItems: "center",
|
|
8493
|
+
justifyContent: "center",
|
|
8494
|
+
gap: 1,
|
|
8495
|
+
px: 2,
|
|
8496
|
+
py: 1,
|
|
8497
|
+
textStyle: "label.md",
|
|
8498
|
+
height: "fit-content",
|
|
8499
|
+
width: "fit-content",
|
|
8500
|
+
cursor: "default"
|
|
8501
|
+
},
|
|
8502
|
+
variants: {
|
|
8503
|
+
color: {
|
|
8504
|
+
neutral: {},
|
|
8505
|
+
black: {},
|
|
8506
|
+
white: {}
|
|
8507
|
+
},
|
|
8508
|
+
background: {
|
|
8509
|
+
on: {},
|
|
8510
|
+
off: {}
|
|
8511
|
+
},
|
|
8512
|
+
radius: {
|
|
8513
|
+
sm: { borderRadius: "sm" },
|
|
8514
|
+
full: { borderRadius: "full" }
|
|
8515
|
+
},
|
|
8516
|
+
avatar: {
|
|
8517
|
+
true: {
|
|
8518
|
+
borderRadius: "full",
|
|
8519
|
+
pl: 1
|
|
8520
|
+
},
|
|
8521
|
+
false: {}
|
|
8522
|
+
}
|
|
8523
|
+
},
|
|
8524
|
+
compoundVariants: [
|
|
8525
|
+
{
|
|
8526
|
+
avatar: true,
|
|
8527
|
+
color: "white",
|
|
8528
|
+
css: {
|
|
8529
|
+
background: "background.static.whiteAlpha.bold",
|
|
8530
|
+
color: "content.static.black.default"
|
|
8531
|
+
}
|
|
8532
|
+
},
|
|
8533
|
+
{
|
|
8534
|
+
avatar: true,
|
|
8535
|
+
color: "neutral",
|
|
8536
|
+
css: {
|
|
8537
|
+
background: "background.neutral.selected",
|
|
8538
|
+
color: "content.neutral.default"
|
|
8539
|
+
}
|
|
8540
|
+
},
|
|
8541
|
+
{
|
|
8542
|
+
avatar: true,
|
|
8543
|
+
color: "black",
|
|
8544
|
+
css: {
|
|
8545
|
+
background: "background.static.blackAlpha.default",
|
|
8546
|
+
color: "content.static.white.default"
|
|
8547
|
+
}
|
|
8548
|
+
},
|
|
8549
|
+
{
|
|
8550
|
+
avatar: false,
|
|
8551
|
+
background: "on",
|
|
8552
|
+
color: "neutral",
|
|
8553
|
+
css: {
|
|
8554
|
+
background: "background.neutral.selected",
|
|
8555
|
+
color: "content.neutral.default"
|
|
8556
|
+
}
|
|
8557
|
+
},
|
|
8558
|
+
{
|
|
8559
|
+
avatar: false,
|
|
8560
|
+
background: "on",
|
|
8561
|
+
color: "black",
|
|
8562
|
+
css: {
|
|
8563
|
+
background: "background.static.blackAlpha.default",
|
|
8564
|
+
color: "content.static.white.default"
|
|
8565
|
+
}
|
|
8566
|
+
},
|
|
8567
|
+
{
|
|
8568
|
+
avatar: false,
|
|
8569
|
+
background: "on",
|
|
8570
|
+
color: "white",
|
|
8571
|
+
css: {
|
|
8572
|
+
background: "background.static.whiteAlpha.selected",
|
|
8573
|
+
color: "content.static.black.default"
|
|
8574
|
+
}
|
|
8575
|
+
},
|
|
8576
|
+
{
|
|
8577
|
+
avatar: false,
|
|
8578
|
+
background: "off",
|
|
8579
|
+
color: "neutral",
|
|
8580
|
+
css: {
|
|
8581
|
+
background: "transparent",
|
|
8582
|
+
color: "content.neutral.default"
|
|
8583
|
+
}
|
|
8584
|
+
},
|
|
8585
|
+
{
|
|
8586
|
+
avatar: false,
|
|
8587
|
+
background: "off",
|
|
8588
|
+
color: "black",
|
|
8589
|
+
css: {
|
|
8590
|
+
background: "transparent",
|
|
8591
|
+
color: "content.static.black.default"
|
|
8592
|
+
}
|
|
8593
|
+
},
|
|
8594
|
+
{
|
|
8595
|
+
avatar: false,
|
|
8596
|
+
background: "off",
|
|
8597
|
+
color: "white",
|
|
8598
|
+
css: {
|
|
8599
|
+
background: "transparent",
|
|
8600
|
+
color: "content.static.white.default"
|
|
8601
|
+
}
|
|
8602
|
+
}
|
|
8603
|
+
],
|
|
8604
|
+
defaultVariants: {
|
|
8605
|
+
background: "on",
|
|
8606
|
+
radius: "sm",
|
|
8607
|
+
color: "neutral",
|
|
8608
|
+
avatar: false
|
|
8609
|
+
}
|
|
8610
|
+
});
|
|
8611
|
+
function CloseOutlineIcon({ size = 24, color = "currentColor", ...props }) {
|
|
8612
|
+
return /* @__PURE__ */ jsx(
|
|
8613
|
+
"svg",
|
|
8614
|
+
{
|
|
8615
|
+
width: size,
|
|
8616
|
+
height: size,
|
|
8617
|
+
viewBox: "0 0 24 24",
|
|
8618
|
+
fill: "none",
|
|
8619
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8620
|
+
strokeWidth: "0",
|
|
8621
|
+
color,
|
|
8622
|
+
...props,
|
|
8623
|
+
children: /* @__PURE__ */ jsx(
|
|
8624
|
+
"path",
|
|
8625
|
+
{
|
|
8626
|
+
id: "Union",
|
|
8627
|
+
fillRule: "evenodd",
|
|
8628
|
+
clipRule: "evenodd",
|
|
8629
|
+
d: "M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",
|
|
8630
|
+
fill: "currentColor"
|
|
8631
|
+
}
|
|
8632
|
+
)
|
|
8633
|
+
}
|
|
8634
|
+
);
|
|
8635
|
+
}
|
|
8636
|
+
const Tag = forwardRef(({ color, background, radius, imageSrc, text, onDeleteClick, ...rest }, ref) => {
|
|
8637
|
+
const StyledTag = styled(ark.div, tagRecipe);
|
|
8638
|
+
return /* @__PURE__ */ jsxs(StyledTag, { color, background, radius, avatar: !!imageSrc, ref, ...rest, children: [
|
|
8639
|
+
imageSrc ? /* @__PURE__ */ jsx(styled.img, { src: imageSrc, width: 8, height: 8, borderRadius: "full", overflow: "hidden", alt: "avatar thumbnail" }) : null,
|
|
8640
|
+
text,
|
|
8641
|
+
onDeleteClick ? /* @__PURE__ */ jsx(CloseOutlineIcon, { size: 12, onClick: onDeleteClick, cursor: "pointer" }) : null
|
|
8642
|
+
] });
|
|
8643
|
+
});
|
|
8644
|
+
Tag.displayName = "Tag";
|
|
7664
8645
|
function definePreset(preset2) {
|
|
7665
8646
|
return preset2;
|
|
7666
8647
|
}
|
|
@@ -7966,8 +8947,10 @@ export {
|
|
|
7966
8947
|
Button,
|
|
7967
8948
|
Dialog,
|
|
7968
8949
|
IconButton,
|
|
8950
|
+
Navigation,
|
|
7969
8951
|
Portal,
|
|
7970
8952
|
Spinner,
|
|
8953
|
+
Tag,
|
|
7971
8954
|
Text,
|
|
7972
8955
|
preset
|
|
7973
8956
|
};
|