@inzumer/ui-library 1.0.1 → 1.1.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/{chunk-HCLY7B4H.js → chunk-2YBZCUME.js} +39 -6
- package/dist/chunk-2YBZCUME.js.map +1 -0
- package/dist/{chunk-LK2EJ4H6.js → chunk-CJ4LRU6X.js} +3 -3
- package/dist/{chunk-LK2EJ4H6.js.map → chunk-CJ4LRU6X.js.map} +1 -1
- package/dist/{chunk-KWSZ2S34.js → chunk-DXJQNQ5K.js} +44 -13
- package/dist/chunk-DXJQNQ5K.js.map +1 -0
- package/dist/{chunk-K35XIA25.js → chunk-ZEGQFAYE.js} +3 -3
- package/dist/{chunk-K35XIA25.js.map → chunk-ZEGQFAYE.js.map} +1 -1
- package/dist/components/atoms/Button/index.d.ts +9 -1
- package/dist/components/atoms/Button/index.js +2 -1
- package/dist/components/atoms/Image/index.d.ts +2 -2
- package/dist/components/atoms/Input/index.d.ts +2 -2
- package/dist/components/atoms/RichText/index.d.ts +2 -2
- package/dist/components/atoms/Switch/index.d.ts +1 -1
- package/dist/components/molecules/BottomSheet/index.js +2 -2
- package/dist/components/molecules/Language/index.d.ts +5 -0
- package/dist/components/molecules/Language/index.js +1 -1
- package/dist/components/molecules/Modal/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/package.json +2 -2
- package/dist/chunk-HCLY7B4H.js.map +0 -1
- package/dist/chunk-KWSZ2S34.js.map +0 -1
|
@@ -19,10 +19,14 @@ var languageOptionStyles = cva(
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
);
|
|
22
|
+
var NEXT_KEYS = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]);
|
|
23
|
+
var PREVIOUS_KEYS = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]);
|
|
22
24
|
var Language = forwardRef(
|
|
23
25
|
({ options, value, onChange, className, ...props }, ref) => {
|
|
24
26
|
const buttonRefs = useRef(/* @__PURE__ */ new Map());
|
|
25
27
|
const [indicator, setIndicator] = useState(null);
|
|
28
|
+
const selectedIndex = options.findIndex((option) => option.value === value);
|
|
29
|
+
const focusableIndex = selectedIndex === -1 ? 0 : selectedIndex;
|
|
26
30
|
useLayoutEffect(() => {
|
|
27
31
|
const activeButton = buttonRefs.current.get(value);
|
|
28
32
|
if (!activeButton) {
|
|
@@ -35,11 +39,38 @@ var Language = forwardRef(
|
|
|
35
39
|
height: activeButton.offsetHeight
|
|
36
40
|
});
|
|
37
41
|
}, [value, options]);
|
|
42
|
+
const select = (index) => {
|
|
43
|
+
const option = options[index];
|
|
44
|
+
if (!option) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
buttonRefs.current.get(option.value)?.focus();
|
|
48
|
+
if (option.value !== value) {
|
|
49
|
+
onChange(option.value);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const handleKeyDown = (event) => {
|
|
53
|
+
const last = options.length - 1;
|
|
54
|
+
let target = null;
|
|
55
|
+
if (NEXT_KEYS.has(event.key)) {
|
|
56
|
+
target = focusableIndex === last ? 0 : focusableIndex + 1;
|
|
57
|
+
} else if (PREVIOUS_KEYS.has(event.key)) {
|
|
58
|
+
target = focusableIndex === 0 ? last : focusableIndex - 1;
|
|
59
|
+
} else if (event.key === "Home") {
|
|
60
|
+
target = 0;
|
|
61
|
+
} else if (event.key === "End") {
|
|
62
|
+
target = last;
|
|
63
|
+
}
|
|
64
|
+
if (target !== null) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
select(target);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
38
69
|
return /* @__PURE__ */ jsxs(
|
|
39
70
|
"div",
|
|
40
71
|
{
|
|
41
72
|
ref,
|
|
42
|
-
role: "
|
|
73
|
+
role: "radiogroup",
|
|
43
74
|
"aria-label": "Language selector",
|
|
44
75
|
className: cn(languageStyles, className),
|
|
45
76
|
...props,
|
|
@@ -56,7 +87,7 @@ var Language = forwardRef(
|
|
|
56
87
|
}
|
|
57
88
|
}
|
|
58
89
|
),
|
|
59
|
-
options.map((option) => {
|
|
90
|
+
options.map((option, index) => {
|
|
60
91
|
const selected = option.value === value;
|
|
61
92
|
return /* @__PURE__ */ jsx(
|
|
62
93
|
"button",
|
|
@@ -69,9 +100,11 @@ var Language = forwardRef(
|
|
|
69
100
|
}
|
|
70
101
|
},
|
|
71
102
|
type: "button",
|
|
72
|
-
role: "
|
|
73
|
-
"aria-
|
|
103
|
+
role: "radio",
|
|
104
|
+
"aria-checked": selected,
|
|
105
|
+
tabIndex: index === focusableIndex ? 0 : -1,
|
|
74
106
|
onClick: () => onChange(option.value),
|
|
107
|
+
onKeyDown: handleKeyDown,
|
|
75
108
|
className: languageOptionStyles({ selected }),
|
|
76
109
|
children: option.label
|
|
77
110
|
},
|
|
@@ -86,5 +119,5 @@ var Language = forwardRef(
|
|
|
86
119
|
Language.displayName = "Language";
|
|
87
120
|
|
|
88
121
|
export { Language };
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-2YBZCUME.js.map
|
|
123
|
+
//# sourceMappingURL=chunk-2YBZCUME.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/molecules/Language/Language.styles.ts","../src/components/molecules/Language/Language.tsx"],"names":[],"mappings":";;;;;AAEO,IAAM,cAAA,GACX,4HAAA;AAEK,IAAM,uBAAA,GACX,oHAAA;AAEK,IAAM,oBAAA,GAAuB,GAAA;AAAA,EAClC,2GAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,QAAA,EAAU;AAAA,QACR,IAAA,EAAM,gCAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,QAAA,EAAU;AAAA;AACZ;AAEJ,CAAA;ACGA,IAAM,4BAAY,IAAI,GAAA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c,UAAA","file":"chunk-2YBZCUME.js","sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const languageStyles =\n 'relative inline-flex items-center gap-1 rounded-md border border-[var(--border-default)] bg-[var(--surface-secondary)] p-1';\n\nexport const languageIndicatorStyles =\n 'absolute left-0 top-0 rounded bg-[var(--btn-primary-bg)] transition-[transform,width,height] duration-200 ease-out';\n\nexport const languageOptionStyles = cva(\n 'relative z-10 rounded px-2.5 py-1 text-xs font-semibold uppercase transition-colors duration-200 ease-out',\n {\n variants: {\n selected: {\n true: 'text-[var(--btn-primary-text)]',\n false: 'text-[var(--text-secondary)] hover:text-[var(--text-primary)]',\n },\n },\n defaultVariants: {\n selected: false,\n },\n },\n);\n","import { cn } from '@utils';\nimport {\n forwardRef,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n} from 'react';\nimport { languageIndicatorStyles, languageOptionStyles, languageStyles } from './Language.styles';\n\nexport interface LanguageOption {\n value: string;\n label: string;\n}\n\nexport type LanguageProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> & {\n options: LanguageOption[];\n value: string;\n onChange: (value: string) => void;\n};\n\ntype IndicatorRect = { left: number; top: number; width: number; height: number };\n\nconst NEXT_KEYS = new Set(['ArrowRight', 'ArrowDown']);\nconst PREVIOUS_KEYS = new Set(['ArrowLeft', 'ArrowUp']);\n\n/**\n * Single-choice segmented switch, following the WAI-ARIA radio group pattern: one Tab stop,\n * arrow keys (and Home/End) move the selection. Name it with `aria-label` (defaults to\n * \"Language selector\") or `aria-labelledby`.\n */\nexport const Language = forwardRef<HTMLDivElement, LanguageProps>(\n ({ options, value, onChange, className, ...props }, ref) => {\n const buttonRefs = useRef(new Map<string, HTMLButtonElement>());\n const [indicator, setIndicator] = useState<IndicatorRect | null>(null);\n const selectedIndex = options.findIndex((option) => option.value === value);\n const focusableIndex = selectedIndex === -1 ? 0 : selectedIndex;\n\n useLayoutEffect(() => {\n const activeButton = buttonRefs.current.get(value);\n if (!activeButton) {\n return;\n }\n\n setIndicator({\n left: activeButton.offsetLeft,\n top: activeButton.offsetTop,\n width: activeButton.offsetWidth,\n height: activeButton.offsetHeight,\n });\n }, [value, options]);\n\n const select = (index: number) => {\n const option = options[index];\n if (!option) {\n return;\n }\n buttonRefs.current.get(option.value)?.focus();\n if (option.value !== value) {\n onChange(option.value);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n const last = options.length - 1;\n let target: number | null = null;\n if (NEXT_KEYS.has(event.key)) {\n target = focusableIndex === last ? 0 : focusableIndex + 1;\n } else if (PREVIOUS_KEYS.has(event.key)) {\n target = focusableIndex === 0 ? last : focusableIndex - 1;\n } else if (event.key === 'Home') {\n target = 0;\n } else if (event.key === 'End') {\n target = last;\n }\n if (target !== null) {\n event.preventDefault();\n select(target);\n }\n };\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label=\"Language selector\"\n className={cn(languageStyles, className)}\n {...props}\n >\n {indicator && (\n <span\n aria-hidden\n className={languageIndicatorStyles}\n style={{\n width: indicator.width,\n height: indicator.height,\n transform: `translate(${indicator.left}px, ${indicator.top}px)`,\n }}\n />\n )}\n {options.map((option, index) => {\n const selected = option.value === value;\n\n return (\n <button\n key={option.value}\n ref={(node) => {\n if (node) {\n buttonRefs.current.set(option.value, node);\n } else {\n buttonRefs.current.delete(option.value);\n }\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n tabIndex={index === focusableIndex ? 0 : -1}\n onClick={() => onChange(option.value)}\n onKeyDown={handleKeyDown}\n className={languageOptionStyles({ selected })}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n },\n);\n\nLanguage.displayName = 'Language';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useDismissableLayer } from './chunk-JCJP427C.js';
|
|
2
|
-
import { useMergedRef } from './chunk-P4Z7HH66.js';
|
|
3
2
|
import { useDelayedUnmount } from './chunk-BNEEI7S5.js';
|
|
3
|
+
import { useMergedRef } from './chunk-P4Z7HH66.js';
|
|
4
4
|
import { RichText } from './chunk-P4CV2EPR.js';
|
|
5
5
|
import { cn } from './chunk-6LLGTBM6.js';
|
|
6
6
|
import { forwardRef, useRef } from 'react';
|
|
@@ -74,5 +74,5 @@ var Modal = forwardRef(
|
|
|
74
74
|
Modal.displayName = "Modal";
|
|
75
75
|
|
|
76
76
|
export { Modal };
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-CJ4LRU6X.js.map
|
|
78
|
+
//# sourceMappingURL=chunk-CJ4LRU6X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/molecules/Modal/Modal.styles.ts","../src/components/molecules/Modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,GAAA;AAAA,EAChC;AAAA,IACE,qFAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,aAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,gBAAA,GAAmB,GAAA;AAAA,EAC9B;AAAA,IACE,8GAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,uBAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,gBAAA,GAAmB,uDAAA;AAEzB,IAAM,iBAAA,GAAoB,0CAAA;AC7BjC,IAAM,gBAAA,GAAmB,GAAA;AAUlB,IAAM,KAAA,GAAQ,UAAA;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CAAA;AAAA,EAEJ;AACF;AAEA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/components/molecules/Modal/Modal.styles.ts","../src/components/molecules/Modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,GAAA;AAAA,EAChC;AAAA,IACE,qFAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,aAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,gBAAA,GAAmB,GAAA;AAAA,EAC9B;AAAA,IACE,8GAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,uBAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,gBAAA,GAAmB,uDAAA;AAEzB,IAAM,iBAAA,GAAoB,0CAAA;AC7BjC,IAAM,gBAAA,GAAmB,GAAA;AAUlB,IAAM,KAAA,GAAQ,UAAA;AAAA,EACnB,CACE,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,MAAA,EAAQ,oBAAA,GAAuB,IAAA,EAAM,SAAA,EAAW,QAAA,EAAU,GAAG,KAAA,IACrF,GAAA,KACG;AACH,IAAA,MAAM,QAAA,GAAW,OAA8B,IAAI,CAAA;AACnD,IAAA,MAAM,WAAA,GAAc,YAAA,CAAa,GAAA,EAAK,QAAQ,CAAA;AAC9C,IAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAQ,GAAI,iBAAA,CAAkB,MAAM,gBAAgB,CAAA;AAErE,IAAA,mBAAA,CAAoB,IAAA,EAAM,OAAA,EAAS,QAAA,EAAU,oBAAoB,CAAA;AAEjE,IAAA,IAAI,CAAC,OAAA,EAAS;AACZ,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAW,mBAAmB,EAAE,OAAA,EAAS,CAAA,EAC5C,QAAA,kBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,WAAA;AAAA,QACL,IAAA,EAAK,QAAA;AAAA,QACL,YAAA,EAAW,MAAA;AAAA,QACX,iBAAA,EAAiB,QAAQ,aAAA,GAAgB,MAAA;AAAA,QACzC,WAAW,EAAA,CAAG,gBAAA,CAAiB,EAAE,OAAA,EAAS,GAAG,SAAS,CAAA;AAAA,QACrD,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,KAAA,oBACC,GAAA,CAAC,QAAA,EAAA,EAAS,EAAA,EAAG,IAAA,EAAK,EAAA,EAAG,eAAc,OAAA,EAAQ,IAAA,EAAK,SAAA,EAAW,gBAAA,EACxD,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,UAED,QAAA;AAAA,UACA,MAAA,oBAAU,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,mBAAoB,QAAA,EAAA,MAAA,EAAO;AAAA;AAAA;AAAA,KACxD,EACF,CAAA;AAAA,EAEJ;AACF;AAEA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"chunk-CJ4LRU6X.js","sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const modalOverlayStyles = cva(\n [\n 'fixed inset-0 z-50 flex items-center justify-center bg-[var(--surface-overlay)] p-4',\n 'transition-opacity duration-200 ease-out',\n ],\n {\n variants: {\n visible: {\n true: 'opacity-100',\n false: 'opacity-0',\n },\n },\n defaultVariants: {\n visible: false,\n },\n },\n);\n\nexport const modalPanelStyles = cva(\n [\n 'w-full max-w-md rounded-xl border border-[var(--border-default)] bg-[var(--surface-secondary)] p-6 shadow-lg',\n 'transition-all duration-200 ease-out',\n ],\n {\n variants: {\n visible: {\n true: 'scale-100 opacity-100',\n false: 'scale-95 opacity-0',\n },\n },\n defaultVariants: {\n visible: false,\n },\n },\n);\n\nexport const modalTitleStyles = 'mb-4 text-lg font-semibold text-[var(--text-primary)]';\n\nexport const modalFooterStyles = 'mt-6 flex items-center justify-end gap-2';\n","import { forwardRef, useRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { RichText } from '@components';\nimport { useDelayedUnmount, useDismissableLayer, useMergedRef } from '@hooks';\nimport { cn } from '@utils';\nimport {\n modalFooterStyles,\n modalOverlayStyles,\n modalPanelStyles,\n modalTitleStyles,\n} from './Modal.styles';\n\nconst EXIT_DURATION_MS = 200;\n\nexport type ModalProps = Omit<HTMLAttributes<HTMLDivElement>, 'title'> & {\n open: boolean;\n onClose: () => void;\n title?: ReactNode;\n footer?: ReactNode;\n closeOnBackdropClick?: boolean;\n};\n\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(\n (\n { open, onClose, title, footer, closeOnBackdropClick = true, className, children, ...props },\n ref,\n ) => {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const setPanelRef = useMergedRef(ref, panelRef);\n const { mounted, visible } = useDelayedUnmount(open, EXIT_DURATION_MS);\n\n useDismissableLayer(open, onClose, panelRef, closeOnBackdropClick);\n\n if (!mounted) {\n return null;\n }\n\n return (\n <div className={modalOverlayStyles({ visible })}>\n <div\n ref={setPanelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title ? 'modal-title' : undefined}\n className={cn(modalPanelStyles({ visible }), className)}\n {...props}\n >\n {title && (\n <RichText as=\"h2\" id=\"modal-title\" variant=\"s1\" className={modalTitleStyles}>\n {title}\n </RichText>\n )}\n {children}\n {footer && <div className={modalFooterStyles}>{footer}</div>}\n </div>\n </div>\n );\n },\n);\n\nModal.displayName = 'Modal';\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { useMergedRef } from './chunk-P4Z7HH66.js';
|
|
1
2
|
import { cn } from './chunk-6LLGTBM6.js';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { forwardRef, Children, isValidElement, cloneElement } from 'react';
|
|
3
4
|
import { cva } from 'class-variance-authority';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
@@ -57,20 +58,50 @@ var buttonStyles = cva(
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
);
|
|
61
|
+
var isHandler = (key, value) => /^on[A-Z]/.test(key) && typeof value === "function";
|
|
62
|
+
var mergeProps = (slotProps, childProps) => {
|
|
63
|
+
const merged = { ...slotProps, ...childProps };
|
|
64
|
+
for (const [key, slotValue] of Object.entries(slotProps)) {
|
|
65
|
+
const childValue = childProps[key];
|
|
66
|
+
if (isHandler(key, slotValue) && isHandler(key, childValue)) {
|
|
67
|
+
merged[key] = (...args) => {
|
|
68
|
+
childValue(...args);
|
|
69
|
+
slotValue(...args);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
merged["className"] = cn(slotProps["className"], childProps["className"]);
|
|
74
|
+
merged["style"] = {
|
|
75
|
+
...slotProps["style"],
|
|
76
|
+
...childProps["style"]
|
|
77
|
+
};
|
|
78
|
+
return merged;
|
|
79
|
+
};
|
|
80
|
+
var Slot = forwardRef(
|
|
81
|
+
({ children, ...slotProps }, forwardedRef) => {
|
|
82
|
+
const child = Children.count(children) === 1 ? Children.toArray(children)[0] : null;
|
|
83
|
+
const childProps = isValidElement(child) ? child.props : {};
|
|
84
|
+
const childRef = childProps["ref"] ?? child?.ref;
|
|
85
|
+
const ref = useMergedRef(forwardedRef, childRef);
|
|
86
|
+
if (!isValidElement(child)) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return cloneElement(child, { ...mergeProps(slotProps, childProps), ref });
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
Slot.displayName = "Slot";
|
|
60
93
|
var Button = forwardRef(
|
|
61
|
-
({ className, variant, size, fullWidth, ...props }, ref) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
);
|
|
94
|
+
({ className, variant, size, fullWidth, asChild = false, ...props }, ref) => {
|
|
95
|
+
const classes = cn(buttonStyles({ variant, size, fullWidth }), className);
|
|
96
|
+
if (asChild) {
|
|
97
|
+
const slotRef = ref;
|
|
98
|
+
return /* @__PURE__ */ jsx(Slot, { ref: slotRef, className: classes, ...props });
|
|
99
|
+
}
|
|
100
|
+
return /* @__PURE__ */ jsx("button", { ref, className: classes, ...props });
|
|
70
101
|
}
|
|
71
102
|
);
|
|
72
103
|
Button.displayName = "Button";
|
|
73
104
|
|
|
74
|
-
export { Button };
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
export { Button, buttonStyles };
|
|
106
|
+
//# sourceMappingURL=chunk-DXJQNQ5K.js.map
|
|
107
|
+
//# sourceMappingURL=chunk-DXJQNQ5K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/atoms/Button/Button.styles.ts","../src/components/atoms/Button/Slot.tsx","../src/components/atoms/Button/Button.tsx"],"names":["forwardRef"],"mappings":";;;;;;AAEO,IAAM,YAAA,GAAe,GAAA;AAAA,EAC1B;AAAA,IACE,+CAAA;AAAA,IACA,kCAAA;AAAA,IACA,YAAA;AAAA,IACA,4CAAA;AAAA,IACA,sHAAA;AAAA,IACA,kDAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS;AAAA,UACP,2DAAA;AAAA,UACA,2CAAA;AAAA,UACA,wCAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,SAAA,EAAW;AAAA,UACT,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AAa,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAA,EAAG,SAAS,CAAA;AAExE,IAAA,IAAI,OAAA,EAAS;AAEX,MAAA,MAAM,OAAA,GAAU,GAAA;AAChB,MAAA,2BAAQ,IAAA,EAAA,EAAK,GAAA,EAAK,SAAS,SAAA,EAAW,OAAA,EAAU,GAAG,KAAA,EAAO,CAAA;AAAA,IAC5D;AAEA,IAAA,2BAAQ,QAAA,EAAA,EAAO,GAAA,EAAU,SAAA,EAAW,OAAA,EAAU,GAAG,KAAA,EAAO,CAAA;AAAA,EAC1D;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"chunk-DXJQNQ5K.js","sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const buttonStyles = cva(\n [\n 'inline-flex items-center justify-center gap-2',\n 'font-medium text-sm leading-none',\n 'rounded-md',\n 'transition-colors duration-150 ease-in-out',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--border-focus)] focus-visible:ring-offset-2',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'select-none',\n ],\n {\n variants: {\n variant: {\n primary: [\n 'bg-[var(--btn-primary-bg)] text-[var(--btn-primary-text)]',\n 'border border-[var(--btn-primary-border)]',\n 'hover:bg-[var(--btn-primary-bg-hover)]',\n 'active:bg-[var(--btn-primary-bg-active)]',\n ],\n secondary: [\n 'bg-[var(--btn-secondary-bg)] text-[var(--btn-secondary-text)]',\n 'border border-[var(--btn-secondary-border)]',\n 'hover:bg-[var(--btn-secondary-bg-hover)]',\n 'active:bg-[var(--btn-secondary-bg-active)]',\n ],\n ghost: [\n 'bg-[var(--btn-ghost-bg)] text-[var(--btn-ghost-text)]',\n 'border border-[var(--btn-ghost-border)]',\n 'hover:bg-[var(--btn-ghost-bg-hover)]',\n 'active:bg-[var(--btn-ghost-bg-active)]',\n ],\n destructive: [\n 'bg-[var(--btn-destructive-bg)] text-[var(--btn-destructive-text)]',\n 'border border-[var(--btn-destructive-border)]',\n 'hover:bg-[var(--btn-destructive-bg-hover)]',\n 'active:bg-[var(--btn-destructive-bg-active)]',\n ],\n },\n size: {\n sm: 'h-8 px-3 text-xs',\n md: 'h-10 px-4 text-sm',\n lg: 'h-12 px-6 text-base',\n icon: 'h-10 w-10',\n },\n fullWidth: {\n true: 'w-full',\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n);\n","import { useMergedRef } from '@hooks';\nimport { cn } from '@utils';\nimport {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from 'react';\n\ntype AnyProps = Record<string, unknown>;\n\nexport type SlotProps = HTMLAttributes<HTMLElement> & { children?: ReactNode };\n\nconst isHandler = (key: string, value: unknown): value is (...args: unknown[]) => void =>\n /^on[A-Z]/.test(key) && typeof value === 'function';\n\n/** Slot props first, child props override — except handlers (both run) and className/style (merged). */\nconst mergeProps = (slotProps: AnyProps, childProps: AnyProps): AnyProps => {\n const merged: AnyProps = { ...slotProps, ...childProps };\n for (const [key, slotValue] of Object.entries(slotProps)) {\n const childValue = childProps[key];\n if (isHandler(key, slotValue) && isHandler(key, childValue)) {\n merged[key] = (...args: unknown[]) => {\n childValue(...args);\n slotValue(...args);\n };\n }\n }\n merged['className'] = cn(slotProps['className'] as string, childProps['className'] as string);\n merged['style'] = {\n ...(slotProps['style'] as CSSProperties),\n ...(childProps['style'] as CSSProperties),\n };\n return merged;\n};\n\n/**\n * Renders its single child element instead of its own DOM node, merging its props into it\n * (Radix-style `asChild`). Used by `Button` so a link can look like a button and stay an `<a>`.\n */\nexport const Slot = forwardRef<HTMLElement, SlotProps>(\n ({ children, ...slotProps }, forwardedRef) => {\n // Text or several children can't receive props: render nothing rather than throwing.\n const child = Children.count(children) === 1 ? Children.toArray(children)[0] : null;\n const childProps = isValidElement<AnyProps>(child) ? child.props : {};\n // React 19 exposes `ref` as a prop; React 18 keeps it on the element.\n const childRef = (childProps['ref'] ??\n (child as unknown as { ref?: Ref<HTMLElement> } | null)?.ref) as Ref<HTMLElement> | undefined;\n const ref = useMergedRef(forwardedRef, childRef);\n\n if (!isValidElement<AnyProps>(child)) {\n return null;\n }\n return cloneElement(child, { ...mergeProps(slotProps as AnyProps, childProps), ref });\n },\n);\n\nSlot.displayName = 'Slot';\n","import { cn } from '@utils';\nimport type { VariantProps } from 'class-variance-authority';\nimport { forwardRef, type ButtonHTMLAttributes, type Ref } from 'react';\nimport { buttonStyles } from './Button.styles';\nimport { Slot } from './Slot';\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n VariantProps<typeof buttonStyles> & {\n /**\n * Render the single child element (e.g. an `<a>`) with the button styles and props instead of\n * a `<button>`. Use it for navigation that must look like a button.\n */\n asChild?: boolean;\n };\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, fullWidth, asChild = false, ...props }, ref) => {\n const classes = cn(buttonStyles({ variant, size, fullWidth }), className);\n\n if (asChild) {\n // The ref points at whatever element the child renders (usually an <a>), not a <button>.\n const slotRef = ref as unknown as Ref<HTMLElement>;\n return <Slot ref={slotRef} className={classes} {...props} />;\n }\n\n return <button ref={ref} className={classes} {...props} />;\n },\n);\n\nButton.displayName = 'Button';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useDismissableLayer } from './chunk-JCJP427C.js';
|
|
2
|
-
import { useMergedRef } from './chunk-P4Z7HH66.js';
|
|
3
2
|
import { useDelayedUnmount } from './chunk-BNEEI7S5.js';
|
|
3
|
+
import { useMergedRef } from './chunk-P4Z7HH66.js';
|
|
4
4
|
import { RichText } from './chunk-P4CV2EPR.js';
|
|
5
5
|
import { cn } from './chunk-6LLGTBM6.js';
|
|
6
6
|
import { forwardRef, useRef } from 'react';
|
|
@@ -77,5 +77,5 @@ var BottomSheet = forwardRef(
|
|
|
77
77
|
BottomSheet.displayName = "BottomSheet";
|
|
78
78
|
|
|
79
79
|
export { BottomSheet };
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-ZEGQFAYE.js.map
|
|
81
|
+
//# sourceMappingURL=chunk-ZEGQFAYE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/molecules/BottomSheet/BottomSheet.styles.ts","../src/components/molecules/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;;;;AAEO,IAAM,wBAAA,GAA2B,GAAA;AAAA,EACtC;AAAA,IACE,8EAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,aAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,sBAAA,GAAyB,GAAA;AAAA,EACpC;AAAA,IACE,+EAAA;AAAA,IACA,6CAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,eAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,uBAAA,GACX,gEAAA;AAEK,IAAM,sBAAA,GAAyB,uDAAA;AAE/B,IAAM,uBAAA,GAA0B,0CAAA;AChCvC,IAAM,gBAAA,GAAmB,GAAA;AAUlB,IAAM,WAAA,GAAc,UAAA;AAAA,EACzB,CACE,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,MAAA,EAAQ,oBAAA,GAAuB,IAAA,EAAM,SAAA,EAAW,QAAA,EAAU,GAAG,KAAA,IACrF,GAAA,KACG;AACH,IAAA,MAAM,QAAA,GAAW,OAA8B,IAAI,CAAA;A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,"sources":["../src/components/molecules/BottomSheet/BottomSheet.styles.ts","../src/components/molecules/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;;;;AAEO,IAAM,wBAAA,GAA2B,GAAA;AAAA,EACtC;AAAA,IACE,8EAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,aAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,sBAAA,GAAyB,GAAA;AAAA,EACpC;AAAA,IACE,+EAAA;AAAA,IACA,6CAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,eAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAEO,IAAM,uBAAA,GACX,gEAAA;AAEK,IAAM,sBAAA,GAAyB,uDAAA;AAE/B,IAAM,uBAAA,GAA0B,0CAAA;AChCvC,IAAM,gBAAA,GAAmB,GAAA;AAUlB,IAAM,WAAA,GAAc,UAAA;AAAA,EACzB,CACE,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,MAAA,EAAQ,oBAAA,GAAuB,IAAA,EAAM,SAAA,EAAW,QAAA,EAAU,GAAG,KAAA,IACrF,GAAA,KACG;AACH,IAAA,MAAM,QAAA,GAAW,OAA8B,IAAI,CAAA;AACnD,IAAA,MAAM,WAAA,GAAc,YAAA,CAAa,GAAA,EAAK,QAAQ,CAAA;AAC9C,IAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAQ,GAAI,iBAAA,CAAkB,MAAM,gBAAgB,CAAA;AAErE,IAAA,mBAAA,CAAoB,IAAA,EAAM,OAAA,EAAS,QAAA,EAAU,oBAAoB,CAAA;AAEjE,IAAA,IAAI,CAAC,OAAA,EAAS;AACZ,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAW,yBAAyB,EAAE,OAAA,EAAS,CAAA,EAClD,QAAA,kBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,WAAA;AAAA,QACL,IAAA,EAAK,QAAA;AAAA,QACL,YAAA,EAAW,MAAA;AAAA,QACX,iBAAA,EAAiB,QAAQ,oBAAA,GAAuB,MAAA;AAAA,QAChD,WAAW,EAAA,CAAG,sBAAA,CAAuB,EAAE,OAAA,EAAS,GAAG,SAAS,CAAA;AAAA,QAC3D,GAAG,KAAA;AAAA,QAEJ,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,KAAA,EAAA,EAAI,aAAA,EAAW,IAAA,EAAC,SAAA,EAAW,uBAAA,EAAyB,CAAA;AAAA,UACpD,KAAA,oBACC,GAAA,CAAC,QAAA,EAAA,EAAS,EAAA,EAAG,IAAA,EAAK,EAAA,EAAG,oBAAA,EAAqB,OAAA,EAAQ,IAAA,EAAK,SAAA,EAAW,sBAAA,EAC/D,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,UAED,QAAA;AAAA,UACA,MAAA,oBAAU,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,yBAA0B,QAAA,EAAA,MAAA,EAAO;AAAA;AAAA;AAAA,KAC9D,EACF,CAAA;AAAA,EAEJ;AACF;AAEA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"chunk-ZEGQFAYE.js","sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const bottomSheetOverlayStyles = cva(\n [\n 'fixed inset-0 z-50 flex items-end justify-center bg-[var(--surface-overlay)]',\n 'transition-opacity duration-200 ease-out',\n ],\n {\n variants: {\n visible: {\n true: 'opacity-100',\n false: 'opacity-0',\n },\n },\n defaultVariants: {\n visible: false,\n },\n },\n);\n\nexport const bottomSheetPanelStyles = cva(\n [\n 'w-full max-w-md rounded-t-xl border border-b-0 border-[var(--border-default)]',\n 'bg-[var(--surface-secondary)] p-6 shadow-lg',\n 'transition-transform duration-200 ease-out',\n ],\n {\n variants: {\n visible: {\n true: 'translate-y-0',\n false: 'translate-y-full',\n },\n },\n defaultVariants: {\n visible: false,\n },\n },\n);\n\nexport const bottomSheetHandleStyles =\n 'mx-auto mb-4 h-1.5 w-10 rounded-full bg-[var(--border-strong)]';\n\nexport const bottomSheetTitleStyles = 'mb-4 text-lg font-semibold text-[var(--text-primary)]';\n\nexport const bottomSheetFooterStyles = 'mt-6 flex items-center justify-end gap-2';\n","import { forwardRef, useRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { RichText } from '@components';\nimport { useDelayedUnmount, useDismissableLayer, useMergedRef } from '@hooks';\nimport { cn } from '@utils';\nimport {\n bottomSheetFooterStyles,\n bottomSheetHandleStyles,\n bottomSheetOverlayStyles,\n bottomSheetPanelStyles,\n bottomSheetTitleStyles,\n} from './BottomSheet.styles';\n\nconst EXIT_DURATION_MS = 200;\n\nexport type BottomSheetProps = Omit<HTMLAttributes<HTMLDivElement>, 'title'> & {\n open: boolean;\n onClose: () => void;\n title?: ReactNode;\n footer?: ReactNode;\n closeOnBackdropClick?: boolean;\n};\n\nexport const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(\n (\n { open, onClose, title, footer, closeOnBackdropClick = true, className, children, ...props },\n ref,\n ) => {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const setPanelRef = useMergedRef(ref, panelRef);\n const { mounted, visible } = useDelayedUnmount(open, EXIT_DURATION_MS);\n\n useDismissableLayer(open, onClose, panelRef, closeOnBackdropClick);\n\n if (!mounted) {\n return null;\n }\n\n return (\n <div className={bottomSheetOverlayStyles({ visible })}>\n <div\n ref={setPanelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title ? 'bottom-sheet-title' : undefined}\n className={cn(bottomSheetPanelStyles({ visible }), className)}\n {...props}\n >\n <div aria-hidden className={bottomSheetHandleStyles} />\n {title && (\n <RichText as=\"h2\" id=\"bottom-sheet-title\" variant=\"s1\" className={bottomSheetTitleStyles}>\n {title}\n </RichText>\n )}\n {children}\n {footer && <div className={bottomSheetFooterStyles}>{footer}</div>}\n </div>\n </div>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
|
|
@@ -10,6 +10,10 @@ declare const buttonStyles: (props?: ({
|
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
11
|
|
|
12
12
|
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonStyles> & {
|
|
13
|
+
/**
|
|
14
|
+
* Render the single child element (e.g. an `<a>`) with the button styles and props instead of
|
|
15
|
+
* a `<button>`. Use it for navigation that must look like a button.
|
|
16
|
+
*/
|
|
13
17
|
asChild?: boolean;
|
|
14
18
|
};
|
|
15
19
|
declare const Button: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<(props?: ({
|
|
@@ -17,7 +21,11 @@ declare const Button: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLB
|
|
|
17
21
|
size?: "sm" | "md" | "lg" | "icon" | null | undefined;
|
|
18
22
|
fullWidth?: boolean | null | undefined;
|
|
19
23
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
24
|
+
/**
|
|
25
|
+
* Render the single child element (e.g. an `<a>`) with the button styles and props instead of
|
|
26
|
+
* a `<button>`. Use it for navigation that must look like a button.
|
|
27
|
+
*/
|
|
20
28
|
asChild?: boolean;
|
|
21
29
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
22
30
|
|
|
23
|
-
export { Button, type ButtonProps };
|
|
31
|
+
export { Button, type ButtonProps, buttonStyles };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { Button } from '../../../chunk-
|
|
1
|
+
export { Button, buttonStyles } from '../../../chunk-DXJQNQ5K.js';
|
|
2
|
+
import '../../../chunk-P4Z7HH66.js';
|
|
2
3
|
import '../../../chunk-6LLGTBM6.js';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,7 +4,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const imageStyles: (props?: ({
|
|
7
|
-
fit?: "
|
|
7
|
+
fit?: "contain" | "cover" | "fill" | null | undefined;
|
|
8
8
|
rounded?: "md" | "none" | "full" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ type ImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, 'alt'> & VariantProp
|
|
|
13
13
|
lazy?: boolean;
|
|
14
14
|
};
|
|
15
15
|
declare const Image: react.ForwardRefExoticComponent<Omit<ImgHTMLAttributes<HTMLImageElement>, "alt"> & VariantProps<(props?: ({
|
|
16
|
-
fit?: "
|
|
16
|
+
fit?: "contain" | "cover" | "fill" | null | undefined;
|
|
17
17
|
rounded?: "md" | "none" | "full" | null | undefined;
|
|
18
18
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
19
19
|
alt: string;
|
|
@@ -4,7 +4,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const inputStyles: (props?: ({
|
|
7
|
-
state?: "
|
|
7
|
+
state?: "error" | "default" | null | undefined;
|
|
8
8
|
inputSize?: "sm" | "md" | "lg" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ type InputProps = InputHTMLAttributes<HTMLInputElement> & VariantProps<typeof in
|
|
|
14
14
|
error?: string;
|
|
15
15
|
};
|
|
16
16
|
declare const Input: react.ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & VariantProps<(props?: ({
|
|
17
|
-
state?: "
|
|
17
|
+
state?: "error" | "default" | null | undefined;
|
|
18
18
|
inputSize?: "sm" | "md" | "lg" | null | undefined;
|
|
19
19
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
20
20
|
label?: string;
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
5
5
|
|
|
6
6
|
declare const richTextStyles: (props?: ({
|
|
7
7
|
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "s1" | "s2" | "s3" | "s4" | "p1" | "p2" | "p3" | "p4" | null | undefined;
|
|
8
|
-
weight?: "
|
|
8
|
+
weight?: "normal" | "light" | "bold" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
|
|
11
11
|
type RichTextVariant = NonNullable<VariantProps<typeof richTextStyles>['variant']>;
|
|
@@ -16,7 +16,7 @@ type RichTextProps = HTMLAttributes<HTMLElement> & VariantProps<typeof richTextS
|
|
|
16
16
|
};
|
|
17
17
|
declare const RichText: react.ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & VariantProps<(props?: ({
|
|
18
18
|
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "s1" | "s2" | "s3" | "s4" | "p1" | "p2" | "p3" | "p4" | null | undefined;
|
|
19
|
-
weight?: "
|
|
19
|
+
weight?: "normal" | "light" | "bold" | null | undefined;
|
|
20
20
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
21
21
|
as?: ElementType;
|
|
22
22
|
bold?: boolean;
|
|
@@ -6,7 +6,7 @@ type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' |
|
|
|
6
6
|
onCheckedChange: (checked: boolean) => void;
|
|
7
7
|
label?: string;
|
|
8
8
|
};
|
|
9
|
-
declare const Switch: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "
|
|
9
|
+
declare const Switch: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "type" | "checked"> & {
|
|
10
10
|
checked: boolean;
|
|
11
11
|
onCheckedChange: (checked: boolean) => void;
|
|
12
12
|
label?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { BottomSheet } from '../../../chunk-
|
|
1
|
+
export { BottomSheet } from '../../../chunk-ZEGQFAYE.js';
|
|
2
2
|
import '../../../chunk-JCJP427C.js';
|
|
3
|
-
import '../../../chunk-P4Z7HH66.js';
|
|
4
3
|
import '../../../chunk-BNEEI7S5.js';
|
|
4
|
+
import '../../../chunk-P4Z7HH66.js';
|
|
5
5
|
import '../../../chunk-P4CV2EPR.js';
|
|
6
6
|
import '../../../chunk-6LLGTBM6.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -10,6 +10,11 @@ type LanguageProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> & {
|
|
|
10
10
|
value: string;
|
|
11
11
|
onChange: (value: string) => void;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Single-choice segmented switch, following the WAI-ARIA radio group pattern: one Tab stop,
|
|
15
|
+
* arrow keys (and Home/End) move the selection. Name it with `aria-label` (defaults to
|
|
16
|
+
* "Language selector") or `aria-labelledby`.
|
|
17
|
+
*/
|
|
13
18
|
declare const Language: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "onChange"> & {
|
|
14
19
|
options: LanguageOption[];
|
|
15
20
|
value: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { Modal } from '../../../chunk-
|
|
1
|
+
export { Modal } from '../../../chunk-CJ4LRU6X.js';
|
|
2
2
|
import '../../../chunk-JCJP427C.js';
|
|
3
|
-
import '../../../chunk-P4Z7HH66.js';
|
|
4
3
|
import '../../../chunk-BNEEI7S5.js';
|
|
4
|
+
import '../../../chunk-P4Z7HH66.js';
|
|
5
5
|
import '../../../chunk-P4CV2EPR.js';
|
|
6
6
|
import '../../../chunk-6LLGTBM6.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Button, ButtonProps } from './components/atoms/Button/index.js';
|
|
1
|
+
export { Button, ButtonProps, buttonStyles } from './components/atoms/Button/index.js';
|
|
2
2
|
export { Icon, IconProps } from './components/atoms/Icon/index.js';
|
|
3
3
|
export { Image, ImageProps } from './components/atoms/Image/index.js';
|
|
4
4
|
export { Input, InputProps } from './components/atoms/Input/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { useMediaQuery } from './chunk-2HCMNEIQ.js';
|
|
2
|
-
export { BottomSheet } from './chunk-
|
|
2
|
+
export { BottomSheet } from './chunk-ZEGQFAYE.js';
|
|
3
3
|
export { Breadcrumbs } from './chunk-PE6XEC7Y.js';
|
|
4
4
|
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './chunk-N5CLCKR3.js';
|
|
5
|
-
export { Language } from './chunk-
|
|
6
|
-
export { Modal } from './chunk-
|
|
5
|
+
export { Language } from './chunk-2YBZCUME.js';
|
|
6
|
+
export { Modal } from './chunk-CJ4LRU6X.js';
|
|
7
7
|
export { useDismissableLayer } from './chunk-JCJP427C.js';
|
|
8
|
-
export { useMergedRef } from './chunk-P4Z7HH66.js';
|
|
9
8
|
export { Snackbar } from './chunk-BKPP4D3Q.js';
|
|
10
9
|
export { Timeline } from './chunk-UL33H4AD.js';
|
|
11
10
|
export { useDelayedUnmount } from './chunk-BNEEI7S5.js';
|
|
12
|
-
export { Button } from './chunk-
|
|
11
|
+
export { Button, buttonStyles } from './chunk-DXJQNQ5K.js';
|
|
12
|
+
export { useMergedRef } from './chunk-P4Z7HH66.js';
|
|
13
13
|
export { Icon } from './chunk-7HQFLM4A.js';
|
|
14
14
|
export { Image } from './chunk-5IHM2545.js';
|
|
15
15
|
export { Input } from './chunk-PVDRNAYK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inzumer/ui-library",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React UI component library for the Inzumer design system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"dist"
|
|
114
114
|
],
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@inzumer/tokens": "1.
|
|
116
|
+
"@inzumer/tokens": "1.1.0"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"class-variance-authority": ">=0.7.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/molecules/Language/Language.styles.ts","../src/components/molecules/Language/Language.tsx"],"names":[],"mappings":";;;;;AAEO,IAAM,cAAA,GACX,4HAAA;AAEK,IAAM,uBAAA,GACX,oHAAA;AAEK,IAAM,oBAAA,GAAuB,GAAA;AAAA,EAClC,2GAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,QAAA,EAAU;AAAA,QACR,IAAA,EAAM,gCAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,QAAA,EAAU;AAAA;AACZ;AAEJ,CAAA;ACAO,IAAM,QAAA,GAAW,UAAA;AAAA,EACtB,CAAC,EAAE,OAAA,EAAS,KAAA,EAAO,UAAU,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC1D,IAAA,MAAM,UAAA,GAAa,MAAA,iBAAO,IAAI,GAAA,EAAgC,CAAA;AAC9D,IAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAA+B,IAAI,CAAA;AAErE,IAA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AAW,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAO,KAAA,EAAO,IAAI,CAAA;AAAA,kBAC3C,CAAA,MAAO;AACL,oBAAA,UAAA,CAAW,OAAA,CAAQ,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA;AAAA,kBACxC;AAAA,gBACF,CAAA;AAAA,gBACA,IAAA,EAAK,QAAA;AAAA,gBACL,IAAA,EAAK,QAAA;AAAA,gBACL,eAAA,EAAe,QAAA;AAAA,gBACf,OAAA,EAAS,MAAM,QAAA,CAAS,MAAA,CAAO,KAAK,CAAA;AAAA,gBACpC,SAAA,EAAW,oBAAA,CAAqB,EAAE,QAAA,EAAU,CAAA;AAAA,gBAE3C,QAAA,EAAA,MAAA,CAAO;AAAA,eAAA;AAAA,cAdH,MAAA,CAAO;AAAA,aAed;AAAA,UAEJ,CAAC;AAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"chunk-HCLY7B4H.js","sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const languageStyles =\n 'relative inline-flex items-center gap-1 rounded-md border border-[var(--border-default)] bg-[var(--surface-secondary)] p-1';\n\nexport const languageIndicatorStyles =\n 'absolute left-0 top-0 rounded bg-[var(--btn-primary-bg)] transition-[transform,width,height] duration-200 ease-out';\n\nexport const languageOptionStyles = cva(\n 'relative z-10 rounded px-2.5 py-1 text-xs font-semibold uppercase transition-colors duration-200 ease-out',\n {\n variants: {\n selected: {\n true: 'text-[var(--btn-primary-text)]',\n false: 'text-[var(--text-secondary)] hover:text-[var(--text-primary)]',\n },\n },\n defaultVariants: {\n selected: false,\n },\n },\n);\n","import { forwardRef, useLayoutEffect, useRef, useState, type HTMLAttributes } from 'react';\nimport { cn } from '@utils';\nimport {\n languageIndicatorStyles,\n languageOptionStyles,\n languageStyles,\n} from './Language.styles';\n\nexport interface LanguageOption {\n value: string;\n label: string;\n}\n\nexport type LanguageProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> & {\n options: LanguageOption[];\n value: string;\n onChange: (value: string) => void;\n};\n\ntype IndicatorRect = { left: number; top: number; width: number; height: number };\n\nexport const Language = forwardRef<HTMLDivElement, LanguageProps>(\n ({ options, value, onChange, className, ...props }, ref) => {\n const buttonRefs = useRef(new Map<string, HTMLButtonElement>());\n const [indicator, setIndicator] = useState<IndicatorRect | null>(null);\n\n useLayoutEffect(() => {\n const activeButton = buttonRefs.current.get(value);\n if (!activeButton) {\n return;\n }\n\n setIndicator({\n left: activeButton.offsetLeft,\n top: activeButton.offsetTop,\n width: activeButton.offsetWidth,\n height: activeButton.offsetHeight,\n });\n }, [value, options]);\n\n return (\n <div\n ref={ref}\n role=\"listbox\"\n aria-label=\"Language selector\"\n className={cn(languageStyles, className)}\n {...props}\n >\n {indicator && (\n <span\n aria-hidden\n className={languageIndicatorStyles}\n style={{\n width: indicator.width,\n height: indicator.height,\n transform: `translate(${indicator.left}px, ${indicator.top}px)`,\n }}\n />\n )}\n {options.map((option) => {\n const selected = option.value === value;\n\n return (\n <button\n key={option.value}\n ref={(node) => {\n if (node) {\n buttonRefs.current.set(option.value, node);\n } else {\n buttonRefs.current.delete(option.value);\n }\n }}\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n onClick={() => onChange(option.value)}\n className={languageOptionStyles({ selected })}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n },\n);\n\nLanguage.displayName = 'Language';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/atoms/Button/Button.styles.ts","../src/components/atoms/Button/Button.tsx"],"names":[],"mappings":";;;;;AAEO,IAAM,YAAA,GAAe,GAAA;AAAA,EAC1B;AAAA,IACE,+CAAA;AAAA,IACA,kCAAA;AAAA,IACA,YAAA;AAAA,IACA,4CAAA;AAAA,IACA,sHAAA;AAAA,IACA,kDAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS;AAAA,UACP,2DAAA;AAAA,UACA,2CAAA;AAAA,UACA,wCAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,SAAA,EAAW;AAAA,UACT,+DAAA;AAAA,UACA,6CAAA;AAAA,UACA,0CAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,KAAA,EAAO;AAAA,UACL,uDAAA;AAAA,UACA,yCAAA;AAAA,UACA,sCAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,WAAA,EAAa;AAAA,UACX,mEAAA;AAAA,UACA,+CAAA;AAAA,UACA,4CAAA;AAAA,UACA;AAAA;AACF,OACF;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,kBAAA;AAAA,QACJ,EAAA,EAAI,mBAAA;AAAA,QACJ,EAAA,EAAI,qBAAA;AAAA,QACJ,IAAA,EAAM;AAAA,OACR;AAAA,MACA,SAAA,EAAW;AAAA,QACT,IAAA,EAAM;AAAA;AACR,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR;AAEJ,CAAA;AC7CO,IAAM,MAAA,GAAS,UAAA;AAAA,EACpB,CAAC,EAAE,SAAA,EAAW,OAAA,EAAS,MAAM,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC1D,IAAA,uBACE,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAA,EAAW,GAAG,YAAA,CAAa,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAA,EAAG,SAAS,CAAA;AAAA,QAClE,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"chunk-KWSZ2S34.js","sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const buttonStyles = cva(\n [\n 'inline-flex items-center justify-center gap-2',\n 'font-medium text-sm leading-none',\n 'rounded-md',\n 'transition-colors duration-150 ease-in-out',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--border-focus)] focus-visible:ring-offset-2',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'select-none',\n ],\n {\n variants: {\n variant: {\n primary: [\n 'bg-[var(--btn-primary-bg)] text-[var(--btn-primary-text)]',\n 'border border-[var(--btn-primary-border)]',\n 'hover:bg-[var(--btn-primary-bg-hover)]',\n 'active:bg-[var(--btn-primary-bg-active)]',\n ],\n secondary: [\n 'bg-[var(--btn-secondary-bg)] text-[var(--btn-secondary-text)]',\n 'border border-[var(--btn-secondary-border)]',\n 'hover:bg-[var(--btn-secondary-bg-hover)]',\n 'active:bg-[var(--btn-secondary-bg-active)]',\n ],\n ghost: [\n 'bg-[var(--btn-ghost-bg)] text-[var(--btn-ghost-text)]',\n 'border border-[var(--btn-ghost-border)]',\n 'hover:bg-[var(--btn-ghost-bg-hover)]',\n 'active:bg-[var(--btn-ghost-bg-active)]',\n ],\n destructive: [\n 'bg-[var(--btn-destructive-bg)] text-[var(--btn-destructive-text)]',\n 'border border-[var(--btn-destructive-border)]',\n 'hover:bg-[var(--btn-destructive-bg-hover)]',\n 'active:bg-[var(--btn-destructive-bg-active)]',\n ],\n },\n size: {\n sm: 'h-8 px-3 text-xs',\n md: 'h-10 px-4 text-sm',\n lg: 'h-12 px-6 text-base',\n icon: 'h-10 w-10',\n },\n fullWidth: {\n true: 'w-full',\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n);\n","import type { VariantProps } from 'class-variance-authority';\nimport { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cn } from '@utils';\nimport { buttonStyles } from './Button.styles';\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n VariantProps<typeof buttonStyles> & {\n asChild?: boolean;\n };\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, fullWidth, ...props }, ref) => {\n return (\n <button\n ref={ref}\n className={cn(buttonStyles({ variant, size, fullWidth }), className)}\n {...props}\n />\n );\n },\n);\n\nButton.displayName = 'Button';\n"]}
|