@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.cjs
CHANGED
|
@@ -593,6 +593,8 @@ function toArray$1(v2) {
|
|
|
593
593
|
if (!v2) return [];
|
|
594
594
|
return Array.isArray(v2) ? v2 : [v2];
|
|
595
595
|
}
|
|
596
|
+
var first = (v2) => v2[0];
|
|
597
|
+
var last = (v2) => v2[v2.length - 1];
|
|
596
598
|
var isString = (v2) => typeof v2 === "string";
|
|
597
599
|
var isFunction = (v2) => typeof v2 === "function";
|
|
598
600
|
var fnToString = Function.prototype.toString;
|
|
@@ -629,6 +631,7 @@ function ensure(c, m2) {
|
|
|
629
631
|
if (c == null) throw new Error(m2);
|
|
630
632
|
}
|
|
631
633
|
var isObject = (v2) => typeof v2 === "object" && v2 !== null;
|
|
634
|
+
var dataAttr = (guard) => guard ? "" : void 0;
|
|
632
635
|
var ELEMENT_NODE = 1;
|
|
633
636
|
var DOCUMENT_NODE = 9;
|
|
634
637
|
var DOCUMENT_FRAGMENT_NODE = 11;
|
|
@@ -645,6 +648,7 @@ function isRootElement(node) {
|
|
|
645
648
|
var isNode = (el) => isObject(el) && el.nodeType !== void 0;
|
|
646
649
|
var isShadowRoot = (el) => isNode(el) && el.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in el;
|
|
647
650
|
var isInputElement = (el) => isHTMLElement(el) && el.localName === "input";
|
|
651
|
+
var isAnchorElement = (el) => !!(el == null ? void 0 : el.matches("a[href]"));
|
|
648
652
|
var isElementVisible = (el) => {
|
|
649
653
|
if (!isHTMLElement(el)) return false;
|
|
650
654
|
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
@@ -715,8 +719,20 @@ function getPlatform() {
|
|
|
715
719
|
const agent = navigator.userAgentData;
|
|
716
720
|
return (agent == null ? void 0 : agent.platform) ?? navigator.platform;
|
|
717
721
|
}
|
|
722
|
+
function getUserAgent() {
|
|
723
|
+
const ua2 = navigator.userAgentData;
|
|
724
|
+
if (ua2 && Array.isArray(ua2.brands)) {
|
|
725
|
+
return ua2.brands.map(({ brand, version }) => `${brand}/${version}`).join(" ");
|
|
726
|
+
}
|
|
727
|
+
return navigator.userAgent;
|
|
728
|
+
}
|
|
718
729
|
var pt = (v2) => isDom() && v2.test(getPlatform());
|
|
730
|
+
var ua = (v2) => isDom() && v2.test(getUserAgent());
|
|
731
|
+
var vn = (v2) => isDom() && v2.test(navigator.vendor);
|
|
719
732
|
var isMac = () => pt(/^Mac/);
|
|
733
|
+
var isSafari = () => isApple() && vn(/apple/i);
|
|
734
|
+
var isFirefox = () => ua(/firefox\//i);
|
|
735
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
720
736
|
var isIos = () => pt(/iP(hone|ad|od)|iOS/);
|
|
721
737
|
function getComposedPath(event) {
|
|
722
738
|
var _a, _b, _c;
|
|
@@ -726,9 +742,39 @@ function getEventTarget(event) {
|
|
|
726
742
|
const composedPath = getComposedPath(event);
|
|
727
743
|
return (composedPath == null ? void 0 : composedPath[0]) ?? event.target;
|
|
728
744
|
}
|
|
745
|
+
var isSelfTarget = (event) => {
|
|
746
|
+
return contains(event.currentTarget, getEventTarget(event));
|
|
747
|
+
};
|
|
748
|
+
function isComposingEvent(event) {
|
|
749
|
+
return getNativeEvent(event).isComposing;
|
|
750
|
+
}
|
|
729
751
|
var isContextMenuEvent = (e) => {
|
|
730
752
|
return e.button === 2 || isMac() && e.ctrlKey && e.button === 0;
|
|
731
753
|
};
|
|
754
|
+
var keyMap = {
|
|
755
|
+
Up: "ArrowUp",
|
|
756
|
+
Down: "ArrowDown",
|
|
757
|
+
Esc: "Escape",
|
|
758
|
+
" ": "Space",
|
|
759
|
+
",": "Comma",
|
|
760
|
+
Left: "ArrowLeft",
|
|
761
|
+
Right: "ArrowRight"
|
|
762
|
+
};
|
|
763
|
+
var rtlKeyMap = {
|
|
764
|
+
ArrowLeft: "ArrowRight",
|
|
765
|
+
ArrowRight: "ArrowLeft"
|
|
766
|
+
};
|
|
767
|
+
function getEventKey(event, options = {}) {
|
|
768
|
+
const { dir = "ltr", orientation = "horizontal" } = options;
|
|
769
|
+
let key = event.key;
|
|
770
|
+
key = keyMap[key] ?? key;
|
|
771
|
+
const isRtl = dir === "rtl" && orientation === "horizontal";
|
|
772
|
+
if (isRtl && key in rtlKeyMap) key = rtlKeyMap[key];
|
|
773
|
+
return key;
|
|
774
|
+
}
|
|
775
|
+
function getNativeEvent(event) {
|
|
776
|
+
return event.nativeEvent ?? event;
|
|
777
|
+
}
|
|
732
778
|
var addDomEvent = (target, eventName, handler, options) => {
|
|
733
779
|
const node = typeof target === "function" ? target() : target;
|
|
734
780
|
node == null ? void 0 : node.addEventListener(eventName, handler, options);
|
|
@@ -807,6 +853,26 @@ function raf$2(fn) {
|
|
|
807
853
|
cleanup == null ? void 0 : cleanup();
|
|
808
854
|
};
|
|
809
855
|
}
|
|
856
|
+
function queueBeforeEvent(el, type, cb) {
|
|
857
|
+
const cancelTimer = raf$2(() => {
|
|
858
|
+
el.removeEventListener(type, exec, true);
|
|
859
|
+
cb();
|
|
860
|
+
});
|
|
861
|
+
const exec = () => {
|
|
862
|
+
cancelTimer();
|
|
863
|
+
cb();
|
|
864
|
+
};
|
|
865
|
+
el.addEventListener(type, exec, { once: true, capture: true });
|
|
866
|
+
return cancelTimer;
|
|
867
|
+
}
|
|
868
|
+
function clickIfLink(el) {
|
|
869
|
+
const click = () => el.click();
|
|
870
|
+
if (isFirefox()) {
|
|
871
|
+
queueBeforeEvent(el, "keyup", click);
|
|
872
|
+
} else {
|
|
873
|
+
queueMicrotask(click);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
810
876
|
function getNearestOverflowAncestor(el) {
|
|
811
877
|
const parentNode = getParentNode$1(el);
|
|
812
878
|
if (isRootElement(parentNode)) return getDocument(parentNode).body;
|
|
@@ -819,6 +885,28 @@ function isOverflowElement(el) {
|
|
|
819
885
|
const { overflow, overflowX, overflowY, display } = win.getComputedStyle(el);
|
|
820
886
|
return OVERFLOW_RE.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
821
887
|
}
|
|
888
|
+
function queryAll(root, selector) {
|
|
889
|
+
return Array.from((root == null ? void 0 : root.querySelectorAll(selector)) ?? []);
|
|
890
|
+
}
|
|
891
|
+
var defaultItemToId = (v2) => v2.id;
|
|
892
|
+
function itemById(v2, id, itemToId = defaultItemToId) {
|
|
893
|
+
return v2.find((item) => itemToId(item) === id);
|
|
894
|
+
}
|
|
895
|
+
function indexOfId(v2, id, itemToId = defaultItemToId) {
|
|
896
|
+
const item = itemById(v2, id, itemToId);
|
|
897
|
+
return item ? v2.indexOf(item) : -1;
|
|
898
|
+
}
|
|
899
|
+
function nextById(v2, id, loop2 = true) {
|
|
900
|
+
let idx = indexOfId(v2, id);
|
|
901
|
+
idx = loop2 ? (idx + 1) % v2.length : Math.min(idx + 1, v2.length - 1);
|
|
902
|
+
return v2[idx];
|
|
903
|
+
}
|
|
904
|
+
function prevById(v2, id, loop2 = true) {
|
|
905
|
+
let idx = indexOfId(v2, id);
|
|
906
|
+
if (idx === -1) return loop2 ? v2[v2.length - 1] : null;
|
|
907
|
+
idx = loop2 ? (idx - 1 + v2.length) % v2.length : Math.max(0, idx - 1);
|
|
908
|
+
return v2[idx];
|
|
909
|
+
}
|
|
822
910
|
var cleanups = /* @__PURE__ */ new WeakMap();
|
|
823
911
|
function set(element, key, setup) {
|
|
824
912
|
if (!cleanups.has(element)) {
|
|
@@ -935,6 +1023,25 @@ function mergeProps(...args) {
|
|
|
935
1023
|
}
|
|
936
1024
|
return result;
|
|
937
1025
|
}
|
|
1026
|
+
function createGuards() {
|
|
1027
|
+
return {
|
|
1028
|
+
and: (...guards) => {
|
|
1029
|
+
return function andGuard(params) {
|
|
1030
|
+
return guards.every((str) => params.guard(str));
|
|
1031
|
+
};
|
|
1032
|
+
},
|
|
1033
|
+
or: (...guards) => {
|
|
1034
|
+
return function orGuard(params) {
|
|
1035
|
+
return guards.some((str) => params.guard(str));
|
|
1036
|
+
};
|
|
1037
|
+
},
|
|
1038
|
+
not: (guard) => {
|
|
1039
|
+
return function notGuard(params) {
|
|
1040
|
+
return !params.guard(guard);
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
938
1045
|
function createMachine(config2) {
|
|
939
1046
|
return config2;
|
|
940
1047
|
}
|
|
@@ -1831,7 +1938,7 @@ const [PresenceProvider, usePresenceContext] = createContext({
|
|
|
1831
1938
|
providerName: "<PresenceProvider />"
|
|
1832
1939
|
});
|
|
1833
1940
|
const splitPresenceProps = (props) => createSplitProps()(props, ["immediate", "lazyMount", "onExitComplete", "present", "unmountOnExit"]);
|
|
1834
|
-
function connect$
|
|
1941
|
+
function connect$2(service, _normalize) {
|
|
1835
1942
|
const { state, send, context: context2 } = service;
|
|
1836
1943
|
const present = state.matches("mounted", "unmountSuspended");
|
|
1837
1944
|
return {
|
|
@@ -1846,7 +1953,7 @@ function connect$1(service, _normalize) {
|
|
|
1846
1953
|
}
|
|
1847
1954
|
};
|
|
1848
1955
|
}
|
|
1849
|
-
var machine$
|
|
1956
|
+
var machine$2 = createMachine({
|
|
1850
1957
|
props({ props: props2 }) {
|
|
1851
1958
|
return { ...props2, present: !!props2.present };
|
|
1852
1959
|
},
|
|
@@ -2013,8 +2120,8 @@ const usePresence = (props = {}) => {
|
|
|
2013
2120
|
present,
|
|
2014
2121
|
onExitComplete: useEvent(props.onExitComplete)
|
|
2015
2122
|
};
|
|
2016
|
-
const service = useMachine(machine$
|
|
2017
|
-
const api = connect$
|
|
2123
|
+
const service = useMachine(machine$2, machineProps);
|
|
2124
|
+
const api = connect$2(service);
|
|
2018
2125
|
if (api.present) {
|
|
2019
2126
|
wasEverPresent.current = true;
|
|
2020
2127
|
}
|
|
@@ -2172,6 +2279,12 @@ const DialogBackdrop = React.forwardRef((props, ref) => {
|
|
|
2172
2279
|
return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) });
|
|
2173
2280
|
});
|
|
2174
2281
|
DialogBackdrop.displayName = "DialogBackdrop";
|
|
2282
|
+
const DialogCloseTrigger = React.forwardRef((props, ref) => {
|
|
2283
|
+
const dialog = useDialogContext();
|
|
2284
|
+
const mergedProps = mergeProps(dialog.getCloseTriggerProps(), props);
|
|
2285
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
|
|
2286
|
+
});
|
|
2287
|
+
DialogCloseTrigger.displayName = "DialogCloseTrigger";
|
|
2175
2288
|
const DialogContent = React.forwardRef((props, ref) => {
|
|
2176
2289
|
const dialog = useDialogContext();
|
|
2177
2290
|
const presence = usePresenceContext();
|
|
@@ -2787,7 +2900,7 @@ function preventBodyScroll(_document) {
|
|
|
2787
2900
|
body.removeAttribute(LOCK_CLASSNAME);
|
|
2788
2901
|
};
|
|
2789
2902
|
}
|
|
2790
|
-
var anatomy = createAnatomy("dialog").parts(
|
|
2903
|
+
var anatomy$1 = createAnatomy("dialog").parts(
|
|
2791
2904
|
"trigger",
|
|
2792
2905
|
"backdrop",
|
|
2793
2906
|
"positioner",
|
|
@@ -2796,7 +2909,7 @@ var anatomy = createAnatomy("dialog").parts(
|
|
|
2796
2909
|
"description",
|
|
2797
2910
|
"closeTrigger"
|
|
2798
2911
|
);
|
|
2799
|
-
var parts = anatomy.build();
|
|
2912
|
+
var parts$1 = anatomy$1.build();
|
|
2800
2913
|
var getPositionerId = (ctx2) => {
|
|
2801
2914
|
var _a;
|
|
2802
2915
|
return ((_a = ctx2.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx2.id}:positioner`;
|
|
@@ -2805,11 +2918,11 @@ var getBackdropId = (ctx2) => {
|
|
|
2805
2918
|
var _a;
|
|
2806
2919
|
return ((_a = ctx2.ids) == null ? void 0 : _a.backdrop) ?? `dialog:${ctx2.id}:backdrop`;
|
|
2807
2920
|
};
|
|
2808
|
-
var getContentId = (ctx2) => {
|
|
2921
|
+
var getContentId$1 = (ctx2) => {
|
|
2809
2922
|
var _a;
|
|
2810
2923
|
return ((_a = ctx2.ids) == null ? void 0 : _a.content) ?? `dialog:${ctx2.id}:content`;
|
|
2811
2924
|
};
|
|
2812
|
-
var getTriggerId = (ctx2) => {
|
|
2925
|
+
var getTriggerId$1 = (ctx2) => {
|
|
2813
2926
|
var _a;
|
|
2814
2927
|
return ((_a = ctx2.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx2.id}:trigger`;
|
|
2815
2928
|
};
|
|
@@ -2825,14 +2938,14 @@ var getCloseTriggerId = (ctx2) => {
|
|
|
2825
2938
|
var _a;
|
|
2826
2939
|
return ((_a = ctx2.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx2.id}:close`;
|
|
2827
2940
|
};
|
|
2828
|
-
var getContentEl = (ctx2) => ctx2.getById(getContentId(ctx2));
|
|
2941
|
+
var getContentEl$1 = (ctx2) => ctx2.getById(getContentId$1(ctx2));
|
|
2829
2942
|
var getPositionerEl = (ctx2) => ctx2.getById(getPositionerId(ctx2));
|
|
2830
2943
|
var getBackdropEl = (ctx2) => ctx2.getById(getBackdropId(ctx2));
|
|
2831
|
-
var getTriggerEl = (ctx2) => ctx2.getById(getTriggerId(ctx2));
|
|
2944
|
+
var getTriggerEl$1 = (ctx2) => ctx2.getById(getTriggerId$1(ctx2));
|
|
2832
2945
|
var getTitleEl = (ctx2) => ctx2.getById(getTitleId(ctx2));
|
|
2833
2946
|
var getDescriptionEl = (ctx2) => ctx2.getById(getDescriptionId(ctx2));
|
|
2834
2947
|
var getCloseTriggerEl = (ctx2) => ctx2.getById(getCloseTriggerId(ctx2));
|
|
2835
|
-
function connect(service, normalize) {
|
|
2948
|
+
function connect$1(service, normalize) {
|
|
2836
2949
|
const { state, send, context: context2, prop, scope } = service;
|
|
2837
2950
|
const ariaLabel = prop("aria-label");
|
|
2838
2951
|
const open = state.matches("open");
|
|
@@ -2845,14 +2958,14 @@ function connect(service, normalize) {
|
|
|
2845
2958
|
},
|
|
2846
2959
|
getTriggerProps() {
|
|
2847
2960
|
return normalize.button({
|
|
2848
|
-
...parts.trigger.attrs,
|
|
2961
|
+
...parts$1.trigger.attrs,
|
|
2849
2962
|
dir: prop("dir"),
|
|
2850
|
-
id: getTriggerId(scope),
|
|
2963
|
+
id: getTriggerId$1(scope),
|
|
2851
2964
|
"aria-haspopup": "dialog",
|
|
2852
2965
|
type: "button",
|
|
2853
2966
|
"aria-expanded": open,
|
|
2854
2967
|
"data-state": open ? "open" : "closed",
|
|
2855
|
-
"aria-controls": getContentId(scope),
|
|
2968
|
+
"aria-controls": getContentId$1(scope),
|
|
2856
2969
|
onClick(event) {
|
|
2857
2970
|
if (event.defaultPrevented) return;
|
|
2858
2971
|
send({ type: "TOGGLE" });
|
|
@@ -2861,7 +2974,7 @@ function connect(service, normalize) {
|
|
|
2861
2974
|
},
|
|
2862
2975
|
getBackdropProps() {
|
|
2863
2976
|
return normalize.element({
|
|
2864
|
-
...parts.backdrop.attrs,
|
|
2977
|
+
...parts$1.backdrop.attrs,
|
|
2865
2978
|
dir: prop("dir"),
|
|
2866
2979
|
hidden: !open,
|
|
2867
2980
|
id: getBackdropId(scope),
|
|
@@ -2870,7 +2983,7 @@ function connect(service, normalize) {
|
|
|
2870
2983
|
},
|
|
2871
2984
|
getPositionerProps() {
|
|
2872
2985
|
return normalize.element({
|
|
2873
|
-
...parts.positioner.attrs,
|
|
2986
|
+
...parts$1.positioner.attrs,
|
|
2874
2987
|
dir: prop("dir"),
|
|
2875
2988
|
id: getPositionerId(scope),
|
|
2876
2989
|
style: {
|
|
@@ -2881,11 +2994,11 @@ function connect(service, normalize) {
|
|
|
2881
2994
|
getContentProps() {
|
|
2882
2995
|
const rendered = context2.get("rendered");
|
|
2883
2996
|
return normalize.element({
|
|
2884
|
-
...parts.content.attrs,
|
|
2997
|
+
...parts$1.content.attrs,
|
|
2885
2998
|
dir: prop("dir"),
|
|
2886
2999
|
role: prop("role"),
|
|
2887
3000
|
hidden: !open,
|
|
2888
|
-
id: getContentId(scope),
|
|
3001
|
+
id: getContentId$1(scope),
|
|
2889
3002
|
tabIndex: -1,
|
|
2890
3003
|
"data-state": open ? "open" : "closed",
|
|
2891
3004
|
"aria-modal": true,
|
|
@@ -2896,21 +3009,21 @@ function connect(service, normalize) {
|
|
|
2896
3009
|
},
|
|
2897
3010
|
getTitleProps() {
|
|
2898
3011
|
return normalize.element({
|
|
2899
|
-
...parts.title.attrs,
|
|
3012
|
+
...parts$1.title.attrs,
|
|
2900
3013
|
dir: prop("dir"),
|
|
2901
3014
|
id: getTitleId(scope)
|
|
2902
3015
|
});
|
|
2903
3016
|
},
|
|
2904
3017
|
getDescriptionProps() {
|
|
2905
3018
|
return normalize.element({
|
|
2906
|
-
...parts.description.attrs,
|
|
3019
|
+
...parts$1.description.attrs,
|
|
2907
3020
|
dir: prop("dir"),
|
|
2908
3021
|
id: getDescriptionId(scope)
|
|
2909
3022
|
});
|
|
2910
3023
|
},
|
|
2911
3024
|
getCloseTriggerProps() {
|
|
2912
3025
|
return normalize.button({
|
|
2913
|
-
...parts.closeTrigger.attrs,
|
|
3026
|
+
...parts$1.closeTrigger.attrs,
|
|
2914
3027
|
dir: prop("dir"),
|
|
2915
3028
|
id: getCloseTriggerId(scope),
|
|
2916
3029
|
type: "button",
|
|
@@ -2923,7 +3036,7 @@ function connect(service, normalize) {
|
|
|
2923
3036
|
}
|
|
2924
3037
|
};
|
|
2925
3038
|
}
|
|
2926
|
-
var machine = createMachine({
|
|
3039
|
+
var machine$1 = createMachine({
|
|
2927
3040
|
props({ props: props2, scope }) {
|
|
2928
3041
|
const alertDialog = props2.role === "alertdialog";
|
|
2929
3042
|
const initialFocusEl = alertDialog ? () => getCloseTriggerEl(scope) : void 0;
|
|
@@ -3019,11 +3132,11 @@ var machine = createMachine({
|
|
|
3019
3132
|
},
|
|
3020
3133
|
effects: {
|
|
3021
3134
|
trackDismissableElement({ scope, send, prop }) {
|
|
3022
|
-
const getContentEl2 = () => getContentEl(scope);
|
|
3135
|
+
const getContentEl2 = () => getContentEl$1(scope);
|
|
3023
3136
|
return trackDismissableElement(getContentEl2, {
|
|
3024
3137
|
defer: true,
|
|
3025
3138
|
pointerBlocking: prop("modal"),
|
|
3026
|
-
exclude: [getTriggerEl(scope)],
|
|
3139
|
+
exclude: [getTriggerEl$1(scope)],
|
|
3027
3140
|
onInteractOutside(event) {
|
|
3028
3141
|
var _a;
|
|
3029
3142
|
(_a = prop("onInteractOutside")) == null ? void 0 : _a(event);
|
|
@@ -3052,7 +3165,7 @@ var machine = createMachine({
|
|
|
3052
3165
|
},
|
|
3053
3166
|
trapFocus({ scope, prop }) {
|
|
3054
3167
|
if (!prop("trapFocus") || !prop("modal")) return;
|
|
3055
|
-
const contentEl = () => getContentEl(scope);
|
|
3168
|
+
const contentEl = () => getContentEl$1(scope);
|
|
3056
3169
|
return trapFocus(contentEl, {
|
|
3057
3170
|
preventScroll: true,
|
|
3058
3171
|
returnFocusOnDeactivate: !!prop("restoreFocus"),
|
|
@@ -3065,8 +3178,8 @@ var machine = createMachine({
|
|
|
3065
3178
|
},
|
|
3066
3179
|
hideContentBelow({ scope, prop }) {
|
|
3067
3180
|
if (!prop("modal")) return;
|
|
3068
|
-
const
|
|
3069
|
-
return ariaHidden(
|
|
3181
|
+
const getElements2 = () => [getContentEl$1(scope)];
|
|
3182
|
+
return ariaHidden(getElements2, { defer: true });
|
|
3070
3183
|
}
|
|
3071
3184
|
},
|
|
3072
3185
|
actions: {
|
|
@@ -3080,7 +3193,7 @@ var machine = createMachine({
|
|
|
3080
3193
|
},
|
|
3081
3194
|
syncZIndex({ scope }) {
|
|
3082
3195
|
raf$2(() => {
|
|
3083
|
-
const contentEl = getContentEl(scope);
|
|
3196
|
+
const contentEl = getContentEl$1(scope);
|
|
3084
3197
|
if (!contentEl) return;
|
|
3085
3198
|
const styles = getComputedStyle(contentEl);
|
|
3086
3199
|
const elems = [getPositionerEl(scope), getBackdropEl(scope)];
|
|
@@ -3142,8 +3255,8 @@ const useDialog = (props) => {
|
|
|
3142
3255
|
dir,
|
|
3143
3256
|
...props
|
|
3144
3257
|
};
|
|
3145
|
-
const service = useMachine(machine, machineProps);
|
|
3146
|
-
return connect(service, normalizeProps);
|
|
3258
|
+
const service = useMachine(machine$1, machineProps);
|
|
3259
|
+
return connect$1(service, normalizeProps);
|
|
3147
3260
|
};
|
|
3148
3261
|
const DialogRoot = (props) => {
|
|
3149
3262
|
const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
|
|
@@ -3199,6 +3312,595 @@ const getPortalNode = (cb) => {
|
|
|
3199
3312
|
};
|
|
3200
3313
|
const subscribe = () => () => {
|
|
3201
3314
|
};
|
|
3315
|
+
const [TabsProvider, useTabsContext] = createContext({
|
|
3316
|
+
name: "TabsContext",
|
|
3317
|
+
hookName: "useTabsContext",
|
|
3318
|
+
providerName: "<TabsProvider />"
|
|
3319
|
+
});
|
|
3320
|
+
const TabList = React.forwardRef((props, ref) => {
|
|
3321
|
+
const tabs = useTabsContext();
|
|
3322
|
+
const mergedProps = mergeProps(tabs.getListProps(), props);
|
|
3323
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
|
|
3324
|
+
});
|
|
3325
|
+
TabList.displayName = "TabList";
|
|
3326
|
+
const TabTrigger = React.forwardRef((props, ref) => {
|
|
3327
|
+
const [tabProps, localProps] = createSplitProps()(props, ["disabled", "value"]);
|
|
3328
|
+
const tabs = useTabsContext();
|
|
3329
|
+
const mergedProps = mergeProps(tabs.getTriggerProps(tabProps), localProps);
|
|
3330
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
|
|
3331
|
+
});
|
|
3332
|
+
TabTrigger.displayName = "TabTrigger";
|
|
3333
|
+
var anatomy = createAnatomy("tabs").parts("root", "list", "trigger", "content", "indicator");
|
|
3334
|
+
var parts = anatomy.build();
|
|
3335
|
+
var getRootId = (ctx2) => {
|
|
3336
|
+
var _a;
|
|
3337
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.root) ?? `tabs:${ctx2.id}`;
|
|
3338
|
+
};
|
|
3339
|
+
var getListId = (ctx2) => {
|
|
3340
|
+
var _a;
|
|
3341
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.list) ?? `tabs:${ctx2.id}:list`;
|
|
3342
|
+
};
|
|
3343
|
+
var getContentId = (ctx2, id) => {
|
|
3344
|
+
var _a;
|
|
3345
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.content) ?? `tabs:${ctx2.id}:content-${id}`;
|
|
3346
|
+
};
|
|
3347
|
+
var getTriggerId = (ctx2, id) => {
|
|
3348
|
+
var _a;
|
|
3349
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.trigger) ?? `tabs:${ctx2.id}:trigger-${id}`;
|
|
3350
|
+
};
|
|
3351
|
+
var getIndicatorId = (ctx2) => {
|
|
3352
|
+
var _a;
|
|
3353
|
+
return ((_a = ctx2.ids) == null ? void 0 : _a.indicator) ?? `tabs:${ctx2.id}:indicator`;
|
|
3354
|
+
};
|
|
3355
|
+
var getListEl = (ctx2) => ctx2.getById(getListId(ctx2));
|
|
3356
|
+
var getContentEl = (ctx2, id) => ctx2.getById(getContentId(ctx2, id));
|
|
3357
|
+
var getTriggerEl = (ctx2, id) => ctx2.getById(getTriggerId(ctx2, id));
|
|
3358
|
+
var getIndicatorEl = (ctx2) => ctx2.getById(getIndicatorId(ctx2));
|
|
3359
|
+
var getElements = (ctx2) => {
|
|
3360
|
+
const ownerId = CSS.escape(getListId(ctx2));
|
|
3361
|
+
const selector = `[role=tab][data-ownedby='${ownerId}']:not([disabled])`;
|
|
3362
|
+
return queryAll(getListEl(ctx2), selector);
|
|
3363
|
+
};
|
|
3364
|
+
var getFirstTriggerEl = (ctx2) => first(getElements(ctx2));
|
|
3365
|
+
var getLastTriggerEl = (ctx2) => last(getElements(ctx2));
|
|
3366
|
+
var getNextTriggerEl = (ctx2, opts) => nextById(getElements(ctx2), getTriggerId(ctx2, opts.value), opts.loopFocus);
|
|
3367
|
+
var getPrevTriggerEl = (ctx2, opts) => prevById(getElements(ctx2), getTriggerId(ctx2, opts.value), opts.loopFocus);
|
|
3368
|
+
var getOffsetRect = (el) => {
|
|
3369
|
+
return {
|
|
3370
|
+
left: (el == null ? void 0 : el.offsetLeft) ?? 0,
|
|
3371
|
+
top: (el == null ? void 0 : el.offsetTop) ?? 0,
|
|
3372
|
+
width: (el == null ? void 0 : el.offsetWidth) ?? 0,
|
|
3373
|
+
height: (el == null ? void 0 : el.offsetHeight) ?? 0
|
|
3374
|
+
};
|
|
3375
|
+
};
|
|
3376
|
+
var getRectById = (ctx2, id) => {
|
|
3377
|
+
const tab = itemById(getElements(ctx2), getTriggerId(ctx2, id));
|
|
3378
|
+
return resolveRect(getOffsetRect(tab));
|
|
3379
|
+
};
|
|
3380
|
+
var resolveRect = (rect) => ({
|
|
3381
|
+
width: `${rect.width}px`,
|
|
3382
|
+
height: `${rect.height}px`,
|
|
3383
|
+
left: `${rect.left}px`,
|
|
3384
|
+
top: `${rect.top}px`
|
|
3385
|
+
});
|
|
3386
|
+
function connect(service, normalize) {
|
|
3387
|
+
const { state, send, context: context2, prop, scope } = service;
|
|
3388
|
+
const translations = prop("translations");
|
|
3389
|
+
const focused = state.matches("focused");
|
|
3390
|
+
const isVertical = prop("orientation") === "vertical";
|
|
3391
|
+
const isHorizontal = prop("orientation") === "horizontal";
|
|
3392
|
+
const composite = prop("composite");
|
|
3393
|
+
function getTriggerState(props2) {
|
|
3394
|
+
return {
|
|
3395
|
+
selected: context2.get("value") === props2.value,
|
|
3396
|
+
focused: context2.get("focusedValue") === props2.value,
|
|
3397
|
+
disabled: !!props2.disabled
|
|
3398
|
+
};
|
|
3399
|
+
}
|
|
3400
|
+
return {
|
|
3401
|
+
value: context2.get("value"),
|
|
3402
|
+
focusedValue: context2.get("focusedValue"),
|
|
3403
|
+
setValue(value) {
|
|
3404
|
+
send({ type: "SET_VALUE", value });
|
|
3405
|
+
},
|
|
3406
|
+
clearValue() {
|
|
3407
|
+
send({ type: "CLEAR_VALUE" });
|
|
3408
|
+
},
|
|
3409
|
+
setIndicatorRect(value) {
|
|
3410
|
+
const id = getTriggerId(scope, value);
|
|
3411
|
+
send({ type: "SET_INDICATOR_RECT", id });
|
|
3412
|
+
},
|
|
3413
|
+
syncTabIndex() {
|
|
3414
|
+
send({ type: "SYNC_TAB_INDEX" });
|
|
3415
|
+
},
|
|
3416
|
+
selectNext(fromValue) {
|
|
3417
|
+
send({ type: "TAB_FOCUS", value: fromValue, src: "selectNext" });
|
|
3418
|
+
send({ type: "ARROW_NEXT", src: "selectNext" });
|
|
3419
|
+
},
|
|
3420
|
+
selectPrev(fromValue) {
|
|
3421
|
+
send({ type: "TAB_FOCUS", value: fromValue, src: "selectPrev" });
|
|
3422
|
+
send({ type: "ARROW_PREV", src: "selectPrev" });
|
|
3423
|
+
},
|
|
3424
|
+
focus() {
|
|
3425
|
+
var _a;
|
|
3426
|
+
const value = context2.get("value");
|
|
3427
|
+
if (!value) return;
|
|
3428
|
+
(_a = getTriggerEl(scope, value)) == null ? void 0 : _a.focus();
|
|
3429
|
+
},
|
|
3430
|
+
getRootProps() {
|
|
3431
|
+
return normalize.element({
|
|
3432
|
+
...parts.root.attrs,
|
|
3433
|
+
id: getRootId(scope),
|
|
3434
|
+
"data-orientation": prop("orientation"),
|
|
3435
|
+
"data-focus": dataAttr(focused),
|
|
3436
|
+
dir: prop("dir")
|
|
3437
|
+
});
|
|
3438
|
+
},
|
|
3439
|
+
getListProps() {
|
|
3440
|
+
return normalize.element({
|
|
3441
|
+
...parts.list.attrs,
|
|
3442
|
+
id: getListId(scope),
|
|
3443
|
+
role: "tablist",
|
|
3444
|
+
dir: prop("dir"),
|
|
3445
|
+
"data-focus": dataAttr(focused),
|
|
3446
|
+
"aria-orientation": prop("orientation"),
|
|
3447
|
+
"data-orientation": prop("orientation"),
|
|
3448
|
+
"aria-label": translations == null ? void 0 : translations.listLabel,
|
|
3449
|
+
onKeyDown(event) {
|
|
3450
|
+
if (event.defaultPrevented) return;
|
|
3451
|
+
if (!isSelfTarget(event)) return;
|
|
3452
|
+
if (isComposingEvent(event)) return;
|
|
3453
|
+
const keyMap2 = {
|
|
3454
|
+
ArrowDown() {
|
|
3455
|
+
if (isHorizontal) return;
|
|
3456
|
+
send({ type: "ARROW_NEXT", key: "ArrowDown" });
|
|
3457
|
+
},
|
|
3458
|
+
ArrowUp() {
|
|
3459
|
+
if (isHorizontal) return;
|
|
3460
|
+
send({ type: "ARROW_PREV", key: "ArrowUp" });
|
|
3461
|
+
},
|
|
3462
|
+
ArrowLeft() {
|
|
3463
|
+
if (isVertical) return;
|
|
3464
|
+
send({ type: "ARROW_PREV", key: "ArrowLeft" });
|
|
3465
|
+
},
|
|
3466
|
+
ArrowRight() {
|
|
3467
|
+
if (isVertical) return;
|
|
3468
|
+
send({ type: "ARROW_NEXT", key: "ArrowRight" });
|
|
3469
|
+
},
|
|
3470
|
+
Home() {
|
|
3471
|
+
send({ type: "HOME" });
|
|
3472
|
+
},
|
|
3473
|
+
End() {
|
|
3474
|
+
send({ type: "END" });
|
|
3475
|
+
},
|
|
3476
|
+
Enter() {
|
|
3477
|
+
send({ type: "ENTER" });
|
|
3478
|
+
}
|
|
3479
|
+
};
|
|
3480
|
+
let key = getEventKey(event, {
|
|
3481
|
+
dir: prop("dir"),
|
|
3482
|
+
orientation: prop("orientation")
|
|
3483
|
+
});
|
|
3484
|
+
const exec = keyMap2[key];
|
|
3485
|
+
if (exec) {
|
|
3486
|
+
event.preventDefault();
|
|
3487
|
+
exec(event);
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
});
|
|
3491
|
+
},
|
|
3492
|
+
getTriggerState,
|
|
3493
|
+
getTriggerProps(props2) {
|
|
3494
|
+
const { value, disabled } = props2;
|
|
3495
|
+
const triggerState = getTriggerState(props2);
|
|
3496
|
+
return normalize.button({
|
|
3497
|
+
...parts.trigger.attrs,
|
|
3498
|
+
role: "tab",
|
|
3499
|
+
type: "button",
|
|
3500
|
+
disabled,
|
|
3501
|
+
dir: prop("dir"),
|
|
3502
|
+
"data-orientation": prop("orientation"),
|
|
3503
|
+
"data-disabled": dataAttr(disabled),
|
|
3504
|
+
"aria-disabled": disabled,
|
|
3505
|
+
"data-value": value,
|
|
3506
|
+
"aria-selected": triggerState.selected,
|
|
3507
|
+
"data-selected": dataAttr(triggerState.selected),
|
|
3508
|
+
"data-focus": dataAttr(triggerState.focused),
|
|
3509
|
+
"aria-controls": triggerState.selected ? getContentId(scope, value) : void 0,
|
|
3510
|
+
"data-ownedby": getListId(scope),
|
|
3511
|
+
"data-ssr": dataAttr(context2.get("ssr")),
|
|
3512
|
+
id: getTriggerId(scope, value),
|
|
3513
|
+
tabIndex: triggerState.selected && composite ? 0 : -1,
|
|
3514
|
+
onFocus() {
|
|
3515
|
+
send({ type: "TAB_FOCUS", value });
|
|
3516
|
+
},
|
|
3517
|
+
onBlur(event) {
|
|
3518
|
+
const target = event.relatedTarget;
|
|
3519
|
+
if ((target == null ? void 0 : target.getAttribute("role")) !== "tab") {
|
|
3520
|
+
send({ type: "TAB_BLUR" });
|
|
3521
|
+
}
|
|
3522
|
+
},
|
|
3523
|
+
onClick(event) {
|
|
3524
|
+
if (event.defaultPrevented) return;
|
|
3525
|
+
if (disabled) return;
|
|
3526
|
+
if (isSafari()) {
|
|
3527
|
+
event.currentTarget.focus();
|
|
3528
|
+
}
|
|
3529
|
+
send({ type: "TAB_CLICK", value });
|
|
3530
|
+
}
|
|
3531
|
+
});
|
|
3532
|
+
},
|
|
3533
|
+
getContentProps(props2) {
|
|
3534
|
+
const { value } = props2;
|
|
3535
|
+
const selected = context2.get("value") === value;
|
|
3536
|
+
return normalize.element({
|
|
3537
|
+
...parts.content.attrs,
|
|
3538
|
+
dir: prop("dir"),
|
|
3539
|
+
id: getContentId(scope, value),
|
|
3540
|
+
tabIndex: composite ? 0 : -1,
|
|
3541
|
+
"aria-labelledby": getTriggerId(scope, value),
|
|
3542
|
+
role: "tabpanel",
|
|
3543
|
+
"data-ownedby": getListId(scope),
|
|
3544
|
+
"data-selected": dataAttr(selected),
|
|
3545
|
+
"data-orientation": prop("orientation"),
|
|
3546
|
+
hidden: !selected
|
|
3547
|
+
});
|
|
3548
|
+
},
|
|
3549
|
+
getIndicatorProps() {
|
|
3550
|
+
const indicatorRect = context2.get("indicatorRect");
|
|
3551
|
+
const indicatorTransition = context2.get("indicatorTransition");
|
|
3552
|
+
return normalize.element({
|
|
3553
|
+
id: getIndicatorId(scope),
|
|
3554
|
+
...parts.indicator.attrs,
|
|
3555
|
+
dir: prop("dir"),
|
|
3556
|
+
"data-orientation": prop("orientation"),
|
|
3557
|
+
style: {
|
|
3558
|
+
"--transition-property": "left, right, top, bottom, width, height",
|
|
3559
|
+
"--left": indicatorRect.left,
|
|
3560
|
+
"--top": indicatorRect.top,
|
|
3561
|
+
"--width": indicatorRect.width,
|
|
3562
|
+
"--height": indicatorRect.height,
|
|
3563
|
+
position: "absolute",
|
|
3564
|
+
willChange: "var(--transition-property)",
|
|
3565
|
+
transitionProperty: "var(--transition-property)",
|
|
3566
|
+
transitionDuration: indicatorTransition ? "var(--transition-duration, 150ms)" : "0ms",
|
|
3567
|
+
transitionTimingFunction: "var(--transition-timing-function)",
|
|
3568
|
+
[isHorizontal ? "left" : "top"]: isHorizontal ? "var(--left)" : "var(--top)"
|
|
3569
|
+
}
|
|
3570
|
+
});
|
|
3571
|
+
}
|
|
3572
|
+
};
|
|
3573
|
+
}
|
|
3574
|
+
var { not } = createGuards();
|
|
3575
|
+
var machine = createMachine({
|
|
3576
|
+
props({ props: props2 }) {
|
|
3577
|
+
return {
|
|
3578
|
+
dir: "ltr",
|
|
3579
|
+
orientation: "horizontal",
|
|
3580
|
+
activationMode: "automatic",
|
|
3581
|
+
loopFocus: true,
|
|
3582
|
+
composite: true,
|
|
3583
|
+
navigate(details) {
|
|
3584
|
+
clickIfLink(details.node);
|
|
3585
|
+
},
|
|
3586
|
+
defaultValue: null,
|
|
3587
|
+
...props2
|
|
3588
|
+
};
|
|
3589
|
+
},
|
|
3590
|
+
initialState() {
|
|
3591
|
+
return "idle";
|
|
3592
|
+
},
|
|
3593
|
+
context({ prop, bindable }) {
|
|
3594
|
+
return {
|
|
3595
|
+
value: bindable(() => ({
|
|
3596
|
+
defaultValue: prop("defaultValue"),
|
|
3597
|
+
value: prop("value"),
|
|
3598
|
+
onChange(value) {
|
|
3599
|
+
var _a;
|
|
3600
|
+
(_a = prop("onValueChange")) == null ? void 0 : _a({ value });
|
|
3601
|
+
}
|
|
3602
|
+
})),
|
|
3603
|
+
focusedValue: bindable(() => ({
|
|
3604
|
+
defaultValue: prop("value") || prop("defaultValue"),
|
|
3605
|
+
sync: true,
|
|
3606
|
+
onChange(value) {
|
|
3607
|
+
var _a;
|
|
3608
|
+
(_a = prop("onFocusChange")) == null ? void 0 : _a({ focusedValue: value });
|
|
3609
|
+
}
|
|
3610
|
+
})),
|
|
3611
|
+
ssr: bindable(() => ({ defaultValue: true })),
|
|
3612
|
+
indicatorTransition: bindable(() => ({ defaultValue: false })),
|
|
3613
|
+
indicatorRect: bindable(() => ({
|
|
3614
|
+
defaultValue: { left: "0px", top: "0px", width: "0px", height: "0px" }
|
|
3615
|
+
}))
|
|
3616
|
+
};
|
|
3617
|
+
},
|
|
3618
|
+
watch({ context: context2, prop, track, action }) {
|
|
3619
|
+
track([() => context2.get("value")], () => {
|
|
3620
|
+
action(["allowIndicatorTransition", "syncIndicatorRect", "syncTabIndex", "navigateIfNeeded"]);
|
|
3621
|
+
});
|
|
3622
|
+
track([() => prop("dir"), () => prop("orientation")], () => {
|
|
3623
|
+
action(["syncIndicatorRect"]);
|
|
3624
|
+
});
|
|
3625
|
+
},
|
|
3626
|
+
on: {
|
|
3627
|
+
SET_VALUE: {
|
|
3628
|
+
actions: ["setValue"]
|
|
3629
|
+
},
|
|
3630
|
+
CLEAR_VALUE: {
|
|
3631
|
+
actions: ["clearValue"]
|
|
3632
|
+
},
|
|
3633
|
+
SET_INDICATOR_RECT: {
|
|
3634
|
+
actions: ["setIndicatorRect"]
|
|
3635
|
+
},
|
|
3636
|
+
SYNC_TAB_INDEX: {
|
|
3637
|
+
actions: ["syncTabIndex"]
|
|
3638
|
+
}
|
|
3639
|
+
},
|
|
3640
|
+
entry: ["syncIndicatorRect", "syncTabIndex", "syncSsr"],
|
|
3641
|
+
exit: ["cleanupObserver"],
|
|
3642
|
+
states: {
|
|
3643
|
+
idle: {
|
|
3644
|
+
on: {
|
|
3645
|
+
TAB_FOCUS: {
|
|
3646
|
+
target: "focused",
|
|
3647
|
+
actions: ["setFocusedValue"]
|
|
3648
|
+
},
|
|
3649
|
+
TAB_CLICK: {
|
|
3650
|
+
target: "focused",
|
|
3651
|
+
actions: ["setFocusedValue", "setValue"]
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
},
|
|
3655
|
+
focused: {
|
|
3656
|
+
on: {
|
|
3657
|
+
TAB_CLICK: {
|
|
3658
|
+
target: "focused",
|
|
3659
|
+
actions: ["setFocusedValue", "setValue"]
|
|
3660
|
+
},
|
|
3661
|
+
ARROW_PREV: [
|
|
3662
|
+
{
|
|
3663
|
+
guard: "selectOnFocus",
|
|
3664
|
+
actions: ["focusPrevTab", "selectFocusedTab"]
|
|
3665
|
+
},
|
|
3666
|
+
{
|
|
3667
|
+
actions: ["focusPrevTab"]
|
|
3668
|
+
}
|
|
3669
|
+
],
|
|
3670
|
+
ARROW_NEXT: [
|
|
3671
|
+
{
|
|
3672
|
+
guard: "selectOnFocus",
|
|
3673
|
+
actions: ["focusNextTab", "selectFocusedTab"]
|
|
3674
|
+
},
|
|
3675
|
+
{
|
|
3676
|
+
actions: ["focusNextTab"]
|
|
3677
|
+
}
|
|
3678
|
+
],
|
|
3679
|
+
HOME: [
|
|
3680
|
+
{
|
|
3681
|
+
guard: "selectOnFocus",
|
|
3682
|
+
actions: ["focusFirstTab", "selectFocusedTab"]
|
|
3683
|
+
},
|
|
3684
|
+
{
|
|
3685
|
+
actions: ["focusFirstTab"]
|
|
3686
|
+
}
|
|
3687
|
+
],
|
|
3688
|
+
END: [
|
|
3689
|
+
{
|
|
3690
|
+
guard: "selectOnFocus",
|
|
3691
|
+
actions: ["focusLastTab", "selectFocusedTab"]
|
|
3692
|
+
},
|
|
3693
|
+
{
|
|
3694
|
+
actions: ["focusLastTab"]
|
|
3695
|
+
}
|
|
3696
|
+
],
|
|
3697
|
+
ENTER: {
|
|
3698
|
+
guard: not("selectOnFocus"),
|
|
3699
|
+
actions: ["selectFocusedTab"]
|
|
3700
|
+
},
|
|
3701
|
+
TAB_FOCUS: {
|
|
3702
|
+
actions: ["setFocusedValue"]
|
|
3703
|
+
},
|
|
3704
|
+
TAB_BLUR: {
|
|
3705
|
+
target: "idle",
|
|
3706
|
+
actions: ["clearFocusedValue"]
|
|
3707
|
+
}
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3710
|
+
},
|
|
3711
|
+
implementations: {
|
|
3712
|
+
guards: {
|
|
3713
|
+
selectOnFocus: ({ prop }) => prop("activationMode") === "automatic"
|
|
3714
|
+
},
|
|
3715
|
+
actions: {
|
|
3716
|
+
selectFocusedTab({ context: context2, prop }) {
|
|
3717
|
+
raf$2(() => {
|
|
3718
|
+
const focusedValue = context2.get("focusedValue");
|
|
3719
|
+
if (!focusedValue) return;
|
|
3720
|
+
const nullable = prop("deselectable") && context2.get("value") === focusedValue;
|
|
3721
|
+
const value = nullable ? null : focusedValue;
|
|
3722
|
+
context2.set("value", value);
|
|
3723
|
+
});
|
|
3724
|
+
},
|
|
3725
|
+
setFocusedValue({ context: context2, event, flush: flush2 }) {
|
|
3726
|
+
if (event.value == null) return;
|
|
3727
|
+
flush2(() => {
|
|
3728
|
+
context2.set("focusedValue", event.value);
|
|
3729
|
+
});
|
|
3730
|
+
},
|
|
3731
|
+
clearFocusedValue({ context: context2 }) {
|
|
3732
|
+
context2.set("focusedValue", null);
|
|
3733
|
+
},
|
|
3734
|
+
setValue({ context: context2, event, prop }) {
|
|
3735
|
+
const nullable = prop("deselectable") && context2.get("value") === context2.get("focusedValue");
|
|
3736
|
+
context2.set("value", nullable ? null : event.value);
|
|
3737
|
+
},
|
|
3738
|
+
clearValue({ context: context2 }) {
|
|
3739
|
+
context2.set("value", null);
|
|
3740
|
+
},
|
|
3741
|
+
focusFirstTab({ scope }) {
|
|
3742
|
+
raf$2(() => {
|
|
3743
|
+
var _a;
|
|
3744
|
+
(_a = getFirstTriggerEl(scope)) == null ? void 0 : _a.focus();
|
|
3745
|
+
});
|
|
3746
|
+
},
|
|
3747
|
+
focusLastTab({ scope }) {
|
|
3748
|
+
raf$2(() => {
|
|
3749
|
+
var _a;
|
|
3750
|
+
(_a = getLastTriggerEl(scope)) == null ? void 0 : _a.focus();
|
|
3751
|
+
});
|
|
3752
|
+
},
|
|
3753
|
+
focusNextTab({ context: context2, prop, scope, event }) {
|
|
3754
|
+
const focusedValue = event.value ?? context2.get("focusedValue");
|
|
3755
|
+
if (!focusedValue) return;
|
|
3756
|
+
const triggerEl = getNextTriggerEl(scope, {
|
|
3757
|
+
value: focusedValue,
|
|
3758
|
+
loopFocus: prop("loopFocus")
|
|
3759
|
+
});
|
|
3760
|
+
raf$2(() => {
|
|
3761
|
+
if (prop("composite")) {
|
|
3762
|
+
triggerEl == null ? void 0 : triggerEl.focus();
|
|
3763
|
+
} else if ((triggerEl == null ? void 0 : triggerEl.dataset.value) != null) {
|
|
3764
|
+
context2.set("focusedValue", triggerEl.dataset.value);
|
|
3765
|
+
}
|
|
3766
|
+
});
|
|
3767
|
+
},
|
|
3768
|
+
focusPrevTab({ context: context2, prop, scope, event }) {
|
|
3769
|
+
const focusedValue = event.value ?? context2.get("focusedValue");
|
|
3770
|
+
if (!focusedValue) return;
|
|
3771
|
+
const triggerEl = getPrevTriggerEl(scope, {
|
|
3772
|
+
value: focusedValue,
|
|
3773
|
+
loopFocus: prop("loopFocus")
|
|
3774
|
+
});
|
|
3775
|
+
raf$2(() => {
|
|
3776
|
+
if (prop("composite")) {
|
|
3777
|
+
triggerEl == null ? void 0 : triggerEl.focus();
|
|
3778
|
+
} else if ((triggerEl == null ? void 0 : triggerEl.dataset.value) != null) {
|
|
3779
|
+
context2.set("focusedValue", triggerEl.dataset.value);
|
|
3780
|
+
}
|
|
3781
|
+
});
|
|
3782
|
+
},
|
|
3783
|
+
syncTabIndex({ context: context2, scope }) {
|
|
3784
|
+
raf$2(() => {
|
|
3785
|
+
const value = context2.get("value");
|
|
3786
|
+
if (!value) return;
|
|
3787
|
+
const contentEl = getContentEl(scope, value);
|
|
3788
|
+
if (!contentEl) return;
|
|
3789
|
+
const focusables = getFocusables(contentEl);
|
|
3790
|
+
if (focusables.length > 0) {
|
|
3791
|
+
contentEl.removeAttribute("tabindex");
|
|
3792
|
+
} else {
|
|
3793
|
+
contentEl.setAttribute("tabindex", "0");
|
|
3794
|
+
}
|
|
3795
|
+
});
|
|
3796
|
+
},
|
|
3797
|
+
cleanupObserver({ refs }) {
|
|
3798
|
+
const cleanup = refs.get("indicatorCleanup");
|
|
3799
|
+
if (cleanup) cleanup();
|
|
3800
|
+
},
|
|
3801
|
+
allowIndicatorTransition({ context: context2 }) {
|
|
3802
|
+
context2.set("indicatorTransition", true);
|
|
3803
|
+
},
|
|
3804
|
+
setIndicatorRect({ context: context2, event, scope }) {
|
|
3805
|
+
const value = event.id ?? context2.get("value");
|
|
3806
|
+
const indicatorEl = getIndicatorEl(scope);
|
|
3807
|
+
if (!indicatorEl || !value) return;
|
|
3808
|
+
const triggerEl = getTriggerEl(scope, value);
|
|
3809
|
+
if (!triggerEl) return;
|
|
3810
|
+
context2.set("indicatorRect", getRectById(scope, value));
|
|
3811
|
+
nextTick(() => {
|
|
3812
|
+
context2.set("indicatorTransition", false);
|
|
3813
|
+
});
|
|
3814
|
+
},
|
|
3815
|
+
syncSsr({ context: context2 }) {
|
|
3816
|
+
context2.set("ssr", false);
|
|
3817
|
+
},
|
|
3818
|
+
syncIndicatorRect({ context: context2, refs, scope }) {
|
|
3819
|
+
const cleanup = refs.get("indicatorCleanup");
|
|
3820
|
+
if (cleanup) cleanup();
|
|
3821
|
+
const value = context2.get("value");
|
|
3822
|
+
if (!value) return;
|
|
3823
|
+
const triggerEl = getTriggerEl(scope, value);
|
|
3824
|
+
const indicatorEl = getIndicatorEl(scope);
|
|
3825
|
+
if (!triggerEl || !indicatorEl) return;
|
|
3826
|
+
const exec = () => {
|
|
3827
|
+
const rect = getOffsetRect(triggerEl);
|
|
3828
|
+
context2.set("indicatorRect", resolveRect(rect));
|
|
3829
|
+
nextTick(() => {
|
|
3830
|
+
context2.set("indicatorTransition", false);
|
|
3831
|
+
});
|
|
3832
|
+
};
|
|
3833
|
+
exec();
|
|
3834
|
+
const win = scope.getWin();
|
|
3835
|
+
const obs = new win.ResizeObserver(exec);
|
|
3836
|
+
obs.observe(triggerEl);
|
|
3837
|
+
refs.set("indicatorCleanup", () => obs.disconnect());
|
|
3838
|
+
},
|
|
3839
|
+
navigateIfNeeded({ context: context2, prop, scope }) {
|
|
3840
|
+
var _a;
|
|
3841
|
+
const value = context2.get("value");
|
|
3842
|
+
if (!value) return;
|
|
3843
|
+
const triggerEl = getTriggerEl(scope, value);
|
|
3844
|
+
if (!isAnchorElement(triggerEl)) return;
|
|
3845
|
+
(_a = prop("navigate")) == null ? void 0 : _a({ value, node: triggerEl });
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
});
|
|
3850
|
+
createProps()([
|
|
3851
|
+
"activationMode",
|
|
3852
|
+
"composite",
|
|
3853
|
+
"deselectable",
|
|
3854
|
+
"dir",
|
|
3855
|
+
"getRootNode",
|
|
3856
|
+
"id",
|
|
3857
|
+
"ids",
|
|
3858
|
+
"loopFocus",
|
|
3859
|
+
"navigate",
|
|
3860
|
+
"onFocusChange",
|
|
3861
|
+
"onValueChange",
|
|
3862
|
+
"orientation",
|
|
3863
|
+
"translations",
|
|
3864
|
+
"value",
|
|
3865
|
+
"defaultValue"
|
|
3866
|
+
]);
|
|
3867
|
+
createProps()(["disabled", "value"]);
|
|
3868
|
+
createProps()(["value"]);
|
|
3869
|
+
const useTabs = (props) => {
|
|
3870
|
+
const id = React.useId();
|
|
3871
|
+
const { getRootNode } = useEnvironmentContext();
|
|
3872
|
+
const { dir } = useLocaleContext();
|
|
3873
|
+
const machineProps = {
|
|
3874
|
+
id,
|
|
3875
|
+
dir,
|
|
3876
|
+
getRootNode,
|
|
3877
|
+
...props
|
|
3878
|
+
};
|
|
3879
|
+
const service = useMachine(machine, machineProps);
|
|
3880
|
+
return connect(service, normalizeProps);
|
|
3881
|
+
};
|
|
3882
|
+
const TabsRoot = React.forwardRef((props, ref) => {
|
|
3883
|
+
const [renderStrategyProps, tabsProps] = splitRenderStrategyProps(props);
|
|
3884
|
+
const [useTabsProps, localprops] = createSplitProps()(tabsProps, [
|
|
3885
|
+
"activationMode",
|
|
3886
|
+
"composite",
|
|
3887
|
+
"defaultValue",
|
|
3888
|
+
"deselectable",
|
|
3889
|
+
"id",
|
|
3890
|
+
"ids",
|
|
3891
|
+
"loopFocus",
|
|
3892
|
+
"navigate",
|
|
3893
|
+
"onFocusChange",
|
|
3894
|
+
"onValueChange",
|
|
3895
|
+
"orientation",
|
|
3896
|
+
"translations",
|
|
3897
|
+
"value"
|
|
3898
|
+
]);
|
|
3899
|
+
const tabs = useTabs(useTabsProps);
|
|
3900
|
+
const mergedProps = mergeProps(tabs.getRootProps(), localprops);
|
|
3901
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TabsProvider, { value: tabs, children: /* @__PURE__ */ jsxRuntime.jsx(RenderStrategyPropsProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref }) }) });
|
|
3902
|
+
});
|
|
3903
|
+
TabsRoot.displayName = "TabsRoot";
|
|
3202
3904
|
const spinnerRecipe = cva({
|
|
3203
3905
|
base: {
|
|
3204
3906
|
display: "inline-block",
|
|
@@ -3717,6 +4419,14 @@ const textRecipe = cva({
|
|
|
3717
4419
|
variant: "body.md"
|
|
3718
4420
|
},
|
|
3719
4421
|
variants: {
|
|
4422
|
+
font: {
|
|
4423
|
+
inter: {
|
|
4424
|
+
fontFamily: "inter"
|
|
4425
|
+
},
|
|
4426
|
+
notoSans: {
|
|
4427
|
+
fontFamily: "notoSans"
|
|
4428
|
+
}
|
|
4429
|
+
},
|
|
3720
4430
|
variant: {
|
|
3721
4431
|
"display.lg": {
|
|
3722
4432
|
textStyle: "display.lg"
|
|
@@ -3736,6 +4446,9 @@ const textRecipe = cva({
|
|
|
3736
4446
|
"title.md": {
|
|
3737
4447
|
textStyle: "title.md"
|
|
3738
4448
|
},
|
|
4449
|
+
"title.sm": {
|
|
4450
|
+
textStyle: "title.sm"
|
|
4451
|
+
},
|
|
3739
4452
|
"body.lg": {
|
|
3740
4453
|
textStyle: "body.lg"
|
|
3741
4454
|
},
|
|
@@ -3755,7 +4468,7 @@ const textRecipe = cva({
|
|
|
3755
4468
|
}
|
|
3756
4469
|
});
|
|
3757
4470
|
const Text = React.forwardRef((props, ref) => {
|
|
3758
|
-
const { variant = "body.md", children, ...rest } = props;
|
|
4471
|
+
const { variant = "body.md", font = "notoSans", children, ...rest } = props;
|
|
3759
4472
|
const textType = (variant == null ? void 0 : variant.split(".")[0]) || "body";
|
|
3760
4473
|
const componentMap = {
|
|
3761
4474
|
display: styled("h1", textRecipe),
|
|
@@ -3765,7 +4478,7 @@ const Text = React.forwardRef((props, ref) => {
|
|
|
3765
4478
|
label: styled("span", textRecipe)
|
|
3766
4479
|
};
|
|
3767
4480
|
const TextComponent = componentMap[textType];
|
|
3768
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ref, textStyle: variant, ...rest, children });
|
|
4481
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ref, textStyle: variant, font, ...rest, children });
|
|
3769
4482
|
});
|
|
3770
4483
|
Text.displayName = "Text";
|
|
3771
4484
|
const shouldForwardProp = (prop, variantKeys, options = {}) => {
|
|
@@ -3815,7 +4528,7 @@ const createStyleContext = (recipe) => {
|
|
|
3815
4528
|
};
|
|
3816
4529
|
const dialogRecipe = sva({
|
|
3817
4530
|
className: "dialog",
|
|
3818
|
-
slots: anatomy.keys(),
|
|
4531
|
+
slots: [...anatomy$1.keys(), "header", "footer", "body"],
|
|
3819
4532
|
base: {
|
|
3820
4533
|
backdrop: {
|
|
3821
4534
|
backdropFilter: "blur(4px)",
|
|
@@ -3844,17 +4557,22 @@ const dialogRecipe = sva({
|
|
|
3844
4557
|
overflow: "auto",
|
|
3845
4558
|
position: "fixed",
|
|
3846
4559
|
top: "0",
|
|
3847
|
-
width: "
|
|
3848
|
-
height: "
|
|
3849
|
-
zIndex: "modal"
|
|
4560
|
+
width: "100vw",
|
|
4561
|
+
height: "100vh",
|
|
4562
|
+
zIndex: "modal",
|
|
4563
|
+
p: "4"
|
|
3850
4564
|
},
|
|
3851
4565
|
content: {
|
|
3852
|
-
background: "white",
|
|
3853
|
-
borderRadius: "sm",
|
|
3854
|
-
boxShadow: "overlay",
|
|
3855
|
-
minW: "sm",
|
|
3856
4566
|
position: "relative",
|
|
3857
|
-
|
|
4567
|
+
backgroundColor: "surface.layer_1",
|
|
4568
|
+
borderRadius: "lg",
|
|
4569
|
+
width: "full",
|
|
4570
|
+
minW: "xs",
|
|
4571
|
+
maxW: "md",
|
|
4572
|
+
display: "flex",
|
|
4573
|
+
flexDirection: "column",
|
|
4574
|
+
gap: "6",
|
|
4575
|
+
py: "4",
|
|
3858
4576
|
_open: {
|
|
3859
4577
|
animation: "dialog-in"
|
|
3860
4578
|
},
|
|
@@ -3862,31 +4580,80 @@ const dialogRecipe = sva({
|
|
|
3862
4580
|
animation: "dialog-out"
|
|
3863
4581
|
}
|
|
3864
4582
|
},
|
|
4583
|
+
closeTrigger: {
|
|
4584
|
+
position: "absolute",
|
|
4585
|
+
top: "4",
|
|
4586
|
+
right: "4"
|
|
4587
|
+
},
|
|
3865
4588
|
title: {
|
|
3866
|
-
|
|
4589
|
+
display: "flex",
|
|
4590
|
+
alignItems: "center",
|
|
4591
|
+
gap: "1",
|
|
4592
|
+
color: "content.neutral.default",
|
|
4593
|
+
textStyle: "headline.sm"
|
|
3867
4594
|
},
|
|
3868
4595
|
description: {
|
|
3869
|
-
color: "content.neutral.
|
|
4596
|
+
color: "content.neutral.default",
|
|
3870
4597
|
textStyle: "body.md"
|
|
4598
|
+
},
|
|
4599
|
+
header: {
|
|
4600
|
+
display: "flex",
|
|
4601
|
+
flexDirection: "column",
|
|
4602
|
+
gap: "2",
|
|
4603
|
+
px: "6"
|
|
4604
|
+
},
|
|
4605
|
+
footer: {
|
|
4606
|
+
display: "flex",
|
|
4607
|
+
gap: "2",
|
|
4608
|
+
px: "4",
|
|
4609
|
+
justifyContent: "flex-end"
|
|
4610
|
+
},
|
|
4611
|
+
body: {
|
|
4612
|
+
px: "4"
|
|
3871
4613
|
}
|
|
3872
4614
|
}
|
|
3873
4615
|
});
|
|
3874
|
-
const { withRootProvider, withContext } = createStyleContext(dialogRecipe);
|
|
3875
|
-
const Root = withRootProvider(DialogRoot);
|
|
3876
|
-
const Backdrop$1 = withContext(DialogBackdrop, "backdrop");
|
|
3877
|
-
const Trigger = withContext(DialogTrigger, "trigger");
|
|
3878
|
-
const Content = withContext(DialogContent, "content");
|
|
3879
|
-
const Title = withContext(DialogTitle, "title");
|
|
3880
|
-
const Description = withContext(DialogDescription, "description");
|
|
3881
|
-
const Positioner = withContext(DialogPositioner, "positioner");
|
|
4616
|
+
const { withRootProvider: withRootProvider$1, withContext: withContext$1 } = createStyleContext(dialogRecipe);
|
|
4617
|
+
const Root$1 = withRootProvider$1(DialogRoot);
|
|
4618
|
+
const Backdrop$1 = withContext$1(DialogBackdrop, "backdrop");
|
|
4619
|
+
const Trigger$1 = withContext$1(DialogTrigger, "trigger");
|
|
4620
|
+
const Content = withContext$1(DialogContent, "content");
|
|
4621
|
+
const Title = withContext$1(DialogTitle, "title");
|
|
4622
|
+
const Description = withContext$1(DialogDescription, "description");
|
|
4623
|
+
const Positioner = withContext$1(DialogPositioner, "positioner");
|
|
4624
|
+
const Header = withContext$1(ark.header, "header");
|
|
4625
|
+
const Footer = withContext$1(
|
|
4626
|
+
({ orientation = "horizontal", className, ...props }) => {
|
|
4627
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4628
|
+
ark.footer,
|
|
4629
|
+
{
|
|
4630
|
+
className: cx(
|
|
4631
|
+
css$1({
|
|
4632
|
+
display: "flex",
|
|
4633
|
+
flexDirection: orientation === "horizontal" ? "row" : "column"
|
|
4634
|
+
}),
|
|
4635
|
+
className
|
|
4636
|
+
),
|
|
4637
|
+
...props
|
|
4638
|
+
}
|
|
4639
|
+
);
|
|
4640
|
+
},
|
|
4641
|
+
"footer"
|
|
4642
|
+
);
|
|
4643
|
+
const Body = withContext$1(ark.main, "body");
|
|
4644
|
+
const CloseTrigger = withContext$1(DialogCloseTrigger, "closeTrigger");
|
|
3882
4645
|
const Dialog = {
|
|
3883
|
-
Root,
|
|
4646
|
+
Root: Root$1,
|
|
3884
4647
|
Backdrop: Backdrop$1,
|
|
3885
|
-
Trigger,
|
|
4648
|
+
Trigger: Trigger$1,
|
|
3886
4649
|
Content,
|
|
3887
4650
|
Title,
|
|
3888
4651
|
Description,
|
|
3889
|
-
Positioner
|
|
4652
|
+
Positioner,
|
|
4653
|
+
Header,
|
|
4654
|
+
Footer,
|
|
4655
|
+
Body,
|
|
4656
|
+
CloseTrigger
|
|
3890
4657
|
};
|
|
3891
4658
|
const iconButtonRecipe = cva({
|
|
3892
4659
|
base: {
|
|
@@ -7679,6 +8446,220 @@ const BottomSheet = (props) => {
|
|
|
7679
8446
|
};
|
|
7680
8447
|
BottomSheetFrame.displayName = "BottomSheetFrame";
|
|
7681
8448
|
Backdrop.displayName = "Backdrop";
|
|
8449
|
+
const navigationRecipe = sva({
|
|
8450
|
+
className: "navigation",
|
|
8451
|
+
slots: anatomy.keys(),
|
|
8452
|
+
base: {
|
|
8453
|
+
root: {
|
|
8454
|
+
bg: "surface.layer_1",
|
|
8455
|
+
zIndex: 10
|
|
8456
|
+
},
|
|
8457
|
+
list: {
|
|
8458
|
+
width: "100%",
|
|
8459
|
+
display: "flex",
|
|
8460
|
+
flexDirection: "row",
|
|
8461
|
+
justifyContent: "space-around",
|
|
8462
|
+
bg: "surface.layer_1",
|
|
8463
|
+
pt: 2,
|
|
8464
|
+
pb: 8
|
|
8465
|
+
},
|
|
8466
|
+
trigger: {
|
|
8467
|
+
display: "flex",
|
|
8468
|
+
flexDirection: "column",
|
|
8469
|
+
alignItems: "center",
|
|
8470
|
+
justifyContent: "center",
|
|
8471
|
+
h: "48px",
|
|
8472
|
+
w: "64px",
|
|
8473
|
+
px: 2,
|
|
8474
|
+
textStyle: "label.sm",
|
|
8475
|
+
color: "content.neutral.subtlest",
|
|
8476
|
+
transitionDuration: "normal",
|
|
8477
|
+
transitionProperty: "background, border-color, color, box-shadow",
|
|
8478
|
+
transitionTimingFunction: "default",
|
|
8479
|
+
userSelect: "none",
|
|
8480
|
+
rounded: "lg",
|
|
8481
|
+
cursor: "pointer",
|
|
8482
|
+
_hover: {
|
|
8483
|
+
bg: "background.neutral.selected"
|
|
8484
|
+
},
|
|
8485
|
+
_selected: {
|
|
8486
|
+
color: "content.neutral.default",
|
|
8487
|
+
bg: "background.neutral.default"
|
|
8488
|
+
}
|
|
8489
|
+
}
|
|
8490
|
+
}
|
|
8491
|
+
});
|
|
8492
|
+
const { withRootProvider, withContext } = createStyleContext(navigationRecipe);
|
|
8493
|
+
const Root = withRootProvider(TabsRoot);
|
|
8494
|
+
const Trigger = withContext(
|
|
8495
|
+
({ icon, label, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(TabTrigger, { ...props, children: [
|
|
8496
|
+
icon,
|
|
8497
|
+
label
|
|
8498
|
+
] }),
|
|
8499
|
+
"trigger"
|
|
8500
|
+
);
|
|
8501
|
+
const List = withContext(TabList, "list");
|
|
8502
|
+
const Navigation = {
|
|
8503
|
+
Root,
|
|
8504
|
+
Item: Trigger,
|
|
8505
|
+
List
|
|
8506
|
+
};
|
|
8507
|
+
const tagRecipe = cva({
|
|
8508
|
+
base: {
|
|
8509
|
+
display: "inline-flex",
|
|
8510
|
+
alignItems: "center",
|
|
8511
|
+
justifyContent: "center",
|
|
8512
|
+
gap: 1,
|
|
8513
|
+
px: 2,
|
|
8514
|
+
py: 1,
|
|
8515
|
+
textStyle: "label.md",
|
|
8516
|
+
height: "fit-content",
|
|
8517
|
+
width: "fit-content",
|
|
8518
|
+
cursor: "default"
|
|
8519
|
+
},
|
|
8520
|
+
variants: {
|
|
8521
|
+
color: {
|
|
8522
|
+
neutral: {},
|
|
8523
|
+
black: {},
|
|
8524
|
+
white: {}
|
|
8525
|
+
},
|
|
8526
|
+
background: {
|
|
8527
|
+
on: {},
|
|
8528
|
+
off: {}
|
|
8529
|
+
},
|
|
8530
|
+
radius: {
|
|
8531
|
+
sm: { borderRadius: "sm" },
|
|
8532
|
+
full: { borderRadius: "full" }
|
|
8533
|
+
},
|
|
8534
|
+
avatar: {
|
|
8535
|
+
true: {
|
|
8536
|
+
borderRadius: "full",
|
|
8537
|
+
pl: 1
|
|
8538
|
+
},
|
|
8539
|
+
false: {}
|
|
8540
|
+
}
|
|
8541
|
+
},
|
|
8542
|
+
compoundVariants: [
|
|
8543
|
+
{
|
|
8544
|
+
avatar: true,
|
|
8545
|
+
color: "white",
|
|
8546
|
+
css: {
|
|
8547
|
+
background: "background.static.whiteAlpha.bold",
|
|
8548
|
+
color: "content.static.black.default"
|
|
8549
|
+
}
|
|
8550
|
+
},
|
|
8551
|
+
{
|
|
8552
|
+
avatar: true,
|
|
8553
|
+
color: "neutral",
|
|
8554
|
+
css: {
|
|
8555
|
+
background: "background.neutral.selected",
|
|
8556
|
+
color: "content.neutral.default"
|
|
8557
|
+
}
|
|
8558
|
+
},
|
|
8559
|
+
{
|
|
8560
|
+
avatar: true,
|
|
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: "neutral",
|
|
8571
|
+
css: {
|
|
8572
|
+
background: "background.neutral.selected",
|
|
8573
|
+
color: "content.neutral.default"
|
|
8574
|
+
}
|
|
8575
|
+
},
|
|
8576
|
+
{
|
|
8577
|
+
avatar: false,
|
|
8578
|
+
background: "on",
|
|
8579
|
+
color: "black",
|
|
8580
|
+
css: {
|
|
8581
|
+
background: "background.static.blackAlpha.default",
|
|
8582
|
+
color: "content.static.white.default"
|
|
8583
|
+
}
|
|
8584
|
+
},
|
|
8585
|
+
{
|
|
8586
|
+
avatar: false,
|
|
8587
|
+
background: "on",
|
|
8588
|
+
color: "white",
|
|
8589
|
+
css: {
|
|
8590
|
+
background: "background.static.whiteAlpha.selected",
|
|
8591
|
+
color: "content.static.black.default"
|
|
8592
|
+
}
|
|
8593
|
+
},
|
|
8594
|
+
{
|
|
8595
|
+
avatar: false,
|
|
8596
|
+
background: "off",
|
|
8597
|
+
color: "neutral",
|
|
8598
|
+
css: {
|
|
8599
|
+
background: "transparent",
|
|
8600
|
+
color: "content.neutral.default"
|
|
8601
|
+
}
|
|
8602
|
+
},
|
|
8603
|
+
{
|
|
8604
|
+
avatar: false,
|
|
8605
|
+
background: "off",
|
|
8606
|
+
color: "black",
|
|
8607
|
+
css: {
|
|
8608
|
+
background: "transparent",
|
|
8609
|
+
color: "content.static.black.default"
|
|
8610
|
+
}
|
|
8611
|
+
},
|
|
8612
|
+
{
|
|
8613
|
+
avatar: false,
|
|
8614
|
+
background: "off",
|
|
8615
|
+
color: "white",
|
|
8616
|
+
css: {
|
|
8617
|
+
background: "transparent",
|
|
8618
|
+
color: "content.static.white.default"
|
|
8619
|
+
}
|
|
8620
|
+
}
|
|
8621
|
+
],
|
|
8622
|
+
defaultVariants: {
|
|
8623
|
+
background: "on",
|
|
8624
|
+
radius: "sm",
|
|
8625
|
+
color: "neutral",
|
|
8626
|
+
avatar: false
|
|
8627
|
+
}
|
|
8628
|
+
});
|
|
8629
|
+
function CloseOutlineIcon({ size = 24, color = "currentColor", ...props }) {
|
|
8630
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8631
|
+
"svg",
|
|
8632
|
+
{
|
|
8633
|
+
width: size,
|
|
8634
|
+
height: size,
|
|
8635
|
+
viewBox: "0 0 24 24",
|
|
8636
|
+
fill: "none",
|
|
8637
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8638
|
+
strokeWidth: "0",
|
|
8639
|
+
color,
|
|
8640
|
+
...props,
|
|
8641
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8642
|
+
"path",
|
|
8643
|
+
{
|
|
8644
|
+
id: "Union",
|
|
8645
|
+
fillRule: "evenodd",
|
|
8646
|
+
clipRule: "evenodd",
|
|
8647
|
+
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",
|
|
8648
|
+
fill: "currentColor"
|
|
8649
|
+
}
|
|
8650
|
+
)
|
|
8651
|
+
}
|
|
8652
|
+
);
|
|
8653
|
+
}
|
|
8654
|
+
const Tag = React.forwardRef(({ color, background, radius, imageSrc, text, onDeleteClick, ...rest }, ref) => {
|
|
8655
|
+
const StyledTag = styled(ark.div, tagRecipe);
|
|
8656
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StyledTag, { color, background, radius, avatar: !!imageSrc, ref, ...rest, children: [
|
|
8657
|
+
imageSrc ? /* @__PURE__ */ jsxRuntime.jsx(styled.img, { src: imageSrc, width: 8, height: 8, borderRadius: "full", overflow: "hidden", alt: "avatar thumbnail" }) : null,
|
|
8658
|
+
text,
|
|
8659
|
+
onDeleteClick ? /* @__PURE__ */ jsxRuntime.jsx(CloseOutlineIcon, { size: 12, onClick: onDeleteClick, cursor: "pointer" }) : null
|
|
8660
|
+
] });
|
|
8661
|
+
});
|
|
8662
|
+
Tag.displayName = "Tag";
|
|
7682
8663
|
function definePreset(preset2) {
|
|
7683
8664
|
return preset2;
|
|
7684
8665
|
}
|
|
@@ -7983,8 +8964,10 @@ exports.BottomSheet = BottomSheet;
|
|
|
7983
8964
|
exports.Button = Button;
|
|
7984
8965
|
exports.Dialog = Dialog;
|
|
7985
8966
|
exports.IconButton = IconButton;
|
|
8967
|
+
exports.Navigation = Navigation;
|
|
7986
8968
|
exports.Portal = Portal;
|
|
7987
8969
|
exports.Spinner = Spinner;
|
|
8970
|
+
exports.Tag = Tag;
|
|
7988
8971
|
exports.Text = Text;
|
|
7989
8972
|
exports.preset = preset;
|
|
7990
8973
|
//# sourceMappingURL=index.cjs.map
|