@fairmint/ui 0.4.2 → 0.4.4
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/components/layout/MobileNav/MobileNavHeader.cjs +17 -5
- package/dist/components/layout/MobileNav/MobileNavHeader.cjs.map +1 -1
- package/dist/components/layout/MobileNav/MobileNavHeader.d.ts.map +1 -1
- package/dist/components/layout/MobileNav/MobileNavHeader.js +17 -5
- package/dist/components/layout/MobileNav/MobileNavHeader.js.map +1 -1
- package/dist/components/primitives/MultiSelect/MultiSelect.cjs +6 -1
- package/dist/components/primitives/MultiSelect/MultiSelect.cjs.map +1 -1
- package/dist/components/primitives/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/primitives/MultiSelect/MultiSelect.js +6 -1
- package/dist/components/primitives/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/primitives/Select/Select.cjs +8 -2
- package/dist/components/primitives/Select/Select.cjs.map +1 -1
- package/dist/components/primitives/Select/Select.d.ts.map +1 -1
- package/dist/components/primitives/Select/Select.js +8 -2
- package/dist/components/primitives/Select/Select.js.map +1 -1
- package/dist/components/primitives/muiCompat.cjs +6 -0
- package/dist/components/primitives/muiCompat.cjs.map +1 -1
- package/dist/components/primitives/muiCompat.d.ts.map +1 -1
- package/dist/components/primitives/muiCompat.js +6 -0
- package/dist/components/primitives/muiCompat.js.map +1 -1
- package/dist/theme/index.cjs +13 -0
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/zIndex.cjs +2 -0
- package/dist/theme/zIndex.cjs.map +1 -1
- package/dist/theme/zIndex.d.ts +5 -0
- package/dist/theme/zIndex.d.ts.map +1 -1
- package/dist/theme/zIndex.js +2 -0
- package/dist/theme/zIndex.js.map +1 -1
- package/package.json +1 -1
|
@@ -57,16 +57,28 @@ function MobileNavHeader({
|
|
|
57
57
|
children: menuIcon ?? defaultMenuIcon
|
|
58
58
|
}
|
|
59
59
|
) : null;
|
|
60
|
-
const trailing = rightSection != null || menu != null ?
|
|
61
|
-
|
|
62
|
-
menu
|
|
63
|
-
|
|
60
|
+
const trailing = rightSection != null || menu != null ? (
|
|
61
|
+
// Auto margin rather than `justify="space-between"` on the row: desktop
|
|
62
|
+
// shells pass no logo and no menu, leaving this as the only child.
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
64
|
+
Group.Group,
|
|
65
|
+
{
|
|
66
|
+
style: { marginInlineStart: "auto" },
|
|
67
|
+
wrap: "nowrap",
|
|
68
|
+
gap: MOBILE_NAV_BRAND_GAP,
|
|
69
|
+
align: "center",
|
|
70
|
+
children: [
|
|
71
|
+
rightSection,
|
|
72
|
+
menu
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
) : null;
|
|
64
77
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
65
78
|
Group.Group,
|
|
66
79
|
{
|
|
67
80
|
h: MOBILE_NAV_HEADER_HEIGHT,
|
|
68
81
|
px: MOBILE_NAV_HEADER_PADDING_X,
|
|
69
|
-
justify: "space-between",
|
|
70
82
|
wrap: "nowrap",
|
|
71
83
|
align: "center",
|
|
72
84
|
gap: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNavHeader.cjs","sources":["../../../../src/components/layout/MobileNav/MobileNavHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { colors } from \"../../../theme\";\nimport { FairmintLogo } from \"../../FairmintLogo/FairmintLogo\";\nimport { ActionIcon } from \"../../primitives/ActionIcon/ActionIcon\";\nimport { Group } from \"../../primitives/layout\";\n\n/** Product-shell mobile header height (Studio + Investor). */\nexport const MOBILE_NAV_HEADER_HEIGHT = 60;\n/** Fairmint wordmark width in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_WIDTH = 120;\n/** Fairmint wordmark height in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_HEIGHT = 28;\n/** Space between trailing actions and the menu control. */\nexport const MOBILE_NAV_BRAND_GAP = 16;\n/** Header horizontal padding. */\nexport const MOBILE_NAV_HEADER_PADDING_X = 16;\n/** Menu control hit target (Mantine `lg`). */\nexport const MOBILE_NAV_MENU_SIZE = 36;\n\nconst defaultMenuIcon = (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M4 6h16\" />\n <path d=\"M4 12h16\" />\n <path d=\"M4 18h16\" />\n </svg>\n);\n\nexport interface MobileNavHeaderProps {\n /**\n * Override the default Fairmint wordmark (white-label portals).\n * When omitted and `onMenuClick` is set, the canonical 120×28 Fairmint logo is used.\n */\n logo?: ReactNode;\n /** Opens the MobileNav sheet. Omit on desktop where SideNav owns destinations. */\n onMenuClick?: () => void;\n /** Trailing header actions before the hamburger (notifications, Ask AI). */\n rightSection?: ReactNode;\n /** Menu glyph. Defaults to an outlined hamburger so the component never imports an icon library. */\n menuIcon?: ReactNode;\n}\n\n/**\n * Canonical mobile page header for Fairmint product shells.\n *\n * Logo on the left; optional `rightSection` then hamburger on the far right.\n * Pixel metrics are fixed so Studio and Investor cannot drift via theme tokens\n * or extra wrappers. Sign out belongs in AccountSheet / the user menu — not here.\n */\nexport function MobileNavHeader({\n logo,\n onMenuClick,\n rightSection,\n menuIcon,\n}: MobileNavHeaderProps) {\n const mark =\n logo ??\n (onMenuClick ? (\n <FairmintLogo\n width={MOBILE_NAV_LOGO_WIDTH}\n height={MOBILE_NAV_LOGO_HEIGHT}\n style={{ display: \"block\" }}\n />\n ) : null);\n\n const menu =\n onMenuClick != null ? (\n <ActionIcon\n type=\"button\"\n aria-label=\"Open navigation\"\n color={colors.neutral}\n variant=\"subtle\"\n w={MOBILE_NAV_MENU_SIZE}\n h={MOBILE_NAV_MENU_SIZE}\n onClick={onMenuClick}\n >\n {menuIcon ?? defaultMenuIcon}\n </ActionIcon>\n ) : null;\n\n const trailing =\n rightSection != null || menu != null ? (\n <Group wrap=\"nowrap\"
|
|
1
|
+
{"version":3,"file":"MobileNavHeader.cjs","sources":["../../../../src/components/layout/MobileNav/MobileNavHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { colors } from \"../../../theme\";\nimport { FairmintLogo } from \"../../FairmintLogo/FairmintLogo\";\nimport { ActionIcon } from \"../../primitives/ActionIcon/ActionIcon\";\nimport { Group } from \"../../primitives/layout\";\n\n/** Product-shell mobile header height (Studio + Investor). */\nexport const MOBILE_NAV_HEADER_HEIGHT = 60;\n/** Fairmint wordmark width in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_WIDTH = 120;\n/** Fairmint wordmark height in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_HEIGHT = 28;\n/** Space between trailing actions and the menu control. */\nexport const MOBILE_NAV_BRAND_GAP = 16;\n/** Header horizontal padding. */\nexport const MOBILE_NAV_HEADER_PADDING_X = 16;\n/** Menu control hit target (Mantine `lg`). */\nexport const MOBILE_NAV_MENU_SIZE = 36;\n\nconst defaultMenuIcon = (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M4 6h16\" />\n <path d=\"M4 12h16\" />\n <path d=\"M4 18h16\" />\n </svg>\n);\n\nexport interface MobileNavHeaderProps {\n /**\n * Override the default Fairmint wordmark (white-label portals).\n * When omitted and `onMenuClick` is set, the canonical 120×28 Fairmint logo is used.\n */\n logo?: ReactNode;\n /** Opens the MobileNav sheet. Omit on desktop where SideNav owns destinations. */\n onMenuClick?: () => void;\n /** Trailing header actions before the hamburger (notifications, Ask AI). */\n rightSection?: ReactNode;\n /** Menu glyph. Defaults to an outlined hamburger so the component never imports an icon library. */\n menuIcon?: ReactNode;\n}\n\n/**\n * Canonical mobile page header for Fairmint product shells.\n *\n * Logo on the left; optional `rightSection` then hamburger on the far right.\n * Pixel metrics are fixed so Studio and Investor cannot drift via theme tokens\n * or extra wrappers. Sign out belongs in AccountSheet / the user menu — not here.\n */\nexport function MobileNavHeader({\n logo,\n onMenuClick,\n rightSection,\n menuIcon,\n}: MobileNavHeaderProps) {\n const mark =\n logo ??\n (onMenuClick ? (\n <FairmintLogo\n width={MOBILE_NAV_LOGO_WIDTH}\n height={MOBILE_NAV_LOGO_HEIGHT}\n style={{ display: \"block\" }}\n />\n ) : null);\n\n const menu =\n onMenuClick != null ? (\n <ActionIcon\n type=\"button\"\n aria-label=\"Open navigation\"\n color={colors.neutral}\n variant=\"subtle\"\n w={MOBILE_NAV_MENU_SIZE}\n h={MOBILE_NAV_MENU_SIZE}\n onClick={onMenuClick}\n >\n {menuIcon ?? defaultMenuIcon}\n </ActionIcon>\n ) : null;\n\n const trailing =\n rightSection != null || menu != null ? (\n // Auto margin rather than `justify=\"space-between\"` on the row: desktop\n // shells pass no logo and no menu, leaving this as the only child.\n <Group\n style={{ marginInlineStart: \"auto\" }}\n wrap=\"nowrap\"\n gap={MOBILE_NAV_BRAND_GAP}\n align=\"center\"\n >\n {rightSection}\n {menu}\n </Group>\n ) : null;\n\n return (\n <Group\n h={MOBILE_NAV_HEADER_HEIGHT}\n px={MOBILE_NAV_HEADER_PADDING_X}\n wrap=\"nowrap\"\n align=\"center\"\n gap={0}\n w=\"100%\"\n bg=\"body\"\n >\n {mark}\n {trailing}\n </Group>\n );\n}\n"],"names":["jsxs","jsx","FairmintLogo","ActionIcon","colors","Group"],"mappings":";;;;;;;AAOO,MAAM,2BAA2B;AAEjC,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAE/B,MAAM,uBAAuB;AAE7B,MAAM,8BAA8B;AAEpC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AAA;AAAA,MAED;AAEN,SACEL,2BAAAA;AAAAA,IAACK,MAAAA;AAAAA,IAAA;AAAA,MACC,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,MAAK;AAAA,MACL,OAAM;AAAA,MACN,KAAK;AAAA,MACL,GAAE;AAAA,MACF,IAAG;AAAA,MAEF,UAAA;AAAA,QAAA;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNavHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/MobileNav/MobileNavHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,8DAA8D;AAC9D,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,iCAAiC;AACjC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,8CAA8C;AAC9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAoBvC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"MobileNavHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/MobileNav/MobileNavHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,8DAA8D;AAC9D,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,iCAAiC;AACjC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,8CAA8C;AAC9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAoBvC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE,oBAAoB,+BAuDtB"}
|
|
@@ -55,16 +55,28 @@ function MobileNavHeader({
|
|
|
55
55
|
children: menuIcon ?? defaultMenuIcon
|
|
56
56
|
}
|
|
57
57
|
) : null;
|
|
58
|
-
const trailing = rightSection != null || menu != null ?
|
|
59
|
-
|
|
60
|
-
menu
|
|
61
|
-
|
|
58
|
+
const trailing = rightSection != null || menu != null ? (
|
|
59
|
+
// Auto margin rather than `justify="space-between"` on the row: desktop
|
|
60
|
+
// shells pass no logo and no menu, leaving this as the only child.
|
|
61
|
+
/* @__PURE__ */ jsxs(
|
|
62
|
+
Group,
|
|
63
|
+
{
|
|
64
|
+
style: { marginInlineStart: "auto" },
|
|
65
|
+
wrap: "nowrap",
|
|
66
|
+
gap: MOBILE_NAV_BRAND_GAP,
|
|
67
|
+
align: "center",
|
|
68
|
+
children: [
|
|
69
|
+
rightSection,
|
|
70
|
+
menu
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
) : null;
|
|
62
75
|
return /* @__PURE__ */ jsxs(
|
|
63
76
|
Group,
|
|
64
77
|
{
|
|
65
78
|
h: MOBILE_NAV_HEADER_HEIGHT,
|
|
66
79
|
px: MOBILE_NAV_HEADER_PADDING_X,
|
|
67
|
-
justify: "space-between",
|
|
68
80
|
wrap: "nowrap",
|
|
69
81
|
align: "center",
|
|
70
82
|
gap: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNavHeader.js","sources":["../../../../src/components/layout/MobileNav/MobileNavHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { colors } from \"../../../theme\";\nimport { FairmintLogo } from \"../../FairmintLogo/FairmintLogo\";\nimport { ActionIcon } from \"../../primitives/ActionIcon/ActionIcon\";\nimport { Group } from \"../../primitives/layout\";\n\n/** Product-shell mobile header height (Studio + Investor). */\nexport const MOBILE_NAV_HEADER_HEIGHT = 60;\n/** Fairmint wordmark width in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_WIDTH = 120;\n/** Fairmint wordmark height in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_HEIGHT = 28;\n/** Space between trailing actions and the menu control. */\nexport const MOBILE_NAV_BRAND_GAP = 16;\n/** Header horizontal padding. */\nexport const MOBILE_NAV_HEADER_PADDING_X = 16;\n/** Menu control hit target (Mantine `lg`). */\nexport const MOBILE_NAV_MENU_SIZE = 36;\n\nconst defaultMenuIcon = (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M4 6h16\" />\n <path d=\"M4 12h16\" />\n <path d=\"M4 18h16\" />\n </svg>\n);\n\nexport interface MobileNavHeaderProps {\n /**\n * Override the default Fairmint wordmark (white-label portals).\n * When omitted and `onMenuClick` is set, the canonical 120×28 Fairmint logo is used.\n */\n logo?: ReactNode;\n /** Opens the MobileNav sheet. Omit on desktop where SideNav owns destinations. */\n onMenuClick?: () => void;\n /** Trailing header actions before the hamburger (notifications, Ask AI). */\n rightSection?: ReactNode;\n /** Menu glyph. Defaults to an outlined hamburger so the component never imports an icon library. */\n menuIcon?: ReactNode;\n}\n\n/**\n * Canonical mobile page header for Fairmint product shells.\n *\n * Logo on the left; optional `rightSection` then hamburger on the far right.\n * Pixel metrics are fixed so Studio and Investor cannot drift via theme tokens\n * or extra wrappers. Sign out belongs in AccountSheet / the user menu — not here.\n */\nexport function MobileNavHeader({\n logo,\n onMenuClick,\n rightSection,\n menuIcon,\n}: MobileNavHeaderProps) {\n const mark =\n logo ??\n (onMenuClick ? (\n <FairmintLogo\n width={MOBILE_NAV_LOGO_WIDTH}\n height={MOBILE_NAV_LOGO_HEIGHT}\n style={{ display: \"block\" }}\n />\n ) : null);\n\n const menu =\n onMenuClick != null ? (\n <ActionIcon\n type=\"button\"\n aria-label=\"Open navigation\"\n color={colors.neutral}\n variant=\"subtle\"\n w={MOBILE_NAV_MENU_SIZE}\n h={MOBILE_NAV_MENU_SIZE}\n onClick={onMenuClick}\n >\n {menuIcon ?? defaultMenuIcon}\n </ActionIcon>\n ) : null;\n\n const trailing =\n rightSection != null || menu != null ? (\n <Group wrap=\"nowrap\"
|
|
1
|
+
{"version":3,"file":"MobileNavHeader.js","sources":["../../../../src/components/layout/MobileNav/MobileNavHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { colors } from \"../../../theme\";\nimport { FairmintLogo } from \"../../FairmintLogo/FairmintLogo\";\nimport { ActionIcon } from \"../../primitives/ActionIcon/ActionIcon\";\nimport { Group } from \"../../primitives/layout\";\n\n/** Product-shell mobile header height (Studio + Investor). */\nexport const MOBILE_NAV_HEADER_HEIGHT = 60;\n/** Fairmint wordmark width in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_WIDTH = 120;\n/** Fairmint wordmark height in the mobile header and sheet. */\nexport const MOBILE_NAV_LOGO_HEIGHT = 28;\n/** Space between trailing actions and the menu control. */\nexport const MOBILE_NAV_BRAND_GAP = 16;\n/** Header horizontal padding. */\nexport const MOBILE_NAV_HEADER_PADDING_X = 16;\n/** Menu control hit target (Mantine `lg`). */\nexport const MOBILE_NAV_MENU_SIZE = 36;\n\nconst defaultMenuIcon = (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M4 6h16\" />\n <path d=\"M4 12h16\" />\n <path d=\"M4 18h16\" />\n </svg>\n);\n\nexport interface MobileNavHeaderProps {\n /**\n * Override the default Fairmint wordmark (white-label portals).\n * When omitted and `onMenuClick` is set, the canonical 120×28 Fairmint logo is used.\n */\n logo?: ReactNode;\n /** Opens the MobileNav sheet. Omit on desktop where SideNav owns destinations. */\n onMenuClick?: () => void;\n /** Trailing header actions before the hamburger (notifications, Ask AI). */\n rightSection?: ReactNode;\n /** Menu glyph. Defaults to an outlined hamburger so the component never imports an icon library. */\n menuIcon?: ReactNode;\n}\n\n/**\n * Canonical mobile page header for Fairmint product shells.\n *\n * Logo on the left; optional `rightSection` then hamburger on the far right.\n * Pixel metrics are fixed so Studio and Investor cannot drift via theme tokens\n * or extra wrappers. Sign out belongs in AccountSheet / the user menu — not here.\n */\nexport function MobileNavHeader({\n logo,\n onMenuClick,\n rightSection,\n menuIcon,\n}: MobileNavHeaderProps) {\n const mark =\n logo ??\n (onMenuClick ? (\n <FairmintLogo\n width={MOBILE_NAV_LOGO_WIDTH}\n height={MOBILE_NAV_LOGO_HEIGHT}\n style={{ display: \"block\" }}\n />\n ) : null);\n\n const menu =\n onMenuClick != null ? (\n <ActionIcon\n type=\"button\"\n aria-label=\"Open navigation\"\n color={colors.neutral}\n variant=\"subtle\"\n w={MOBILE_NAV_MENU_SIZE}\n h={MOBILE_NAV_MENU_SIZE}\n onClick={onMenuClick}\n >\n {menuIcon ?? defaultMenuIcon}\n </ActionIcon>\n ) : null;\n\n const trailing =\n rightSection != null || menu != null ? (\n // Auto margin rather than `justify=\"space-between\"` on the row: desktop\n // shells pass no logo and no menu, leaving this as the only child.\n <Group\n style={{ marginInlineStart: \"auto\" }}\n wrap=\"nowrap\"\n gap={MOBILE_NAV_BRAND_GAP}\n align=\"center\"\n >\n {rightSection}\n {menu}\n </Group>\n ) : null;\n\n return (\n <Group\n h={MOBILE_NAV_HEADER_HEIGHT}\n px={MOBILE_NAV_HEADER_PADDING_X}\n wrap=\"nowrap\"\n align=\"center\"\n gap={0}\n w=\"100%\"\n bg=\"body\"\n >\n {mark}\n {trailing}\n </Group>\n );\n}\n"],"names":[],"mappings":";;;;;AAOO,MAAM,2BAA2B;AAEjC,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAE/B,MAAM,uBAAuB;AAE7B,MAAM,8BAA8B;AAEpC,MAAM,uBAAuB;AAEpC,MAAM,kBACJ;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,eAAY;AAAA,IAEZ,UAAA;AAAA,MAAA,oBAAC,QAAA,EAAK,GAAE,UAAA,CAAU;AAAA,MAClB,oBAAC,QAAA,EAAK,GAAE,WAAA,CAAW;AAAA,MACnB,oBAAC,QAAA,EAAK,GAAE,WAAA,CAAW;AAAA,IAAA;AAAA,EAAA;AACrB;AAwBK,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,OACJ,SACC,cACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO,EAAE,SAAS,QAAA;AAAA,IAAQ;AAAA,EAAA,IAE1B;AAEN,QAAM,OACJ,eAAe,OACb;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAW;AAAA,MACX,OAAO,OAAO;AAAA,MACd,SAAQ;AAAA,MACR,GAAG;AAAA,MACH,GAAG;AAAA,MACH,SAAS;AAAA,MAER,UAAA,YAAY;AAAA,IAAA;AAAA,EAAA,IAEb;AAEN,QAAM,WACJ,gBAAgB,QAAQ,QAAQ;AAAA;AAAA;AAAA,IAG9B;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO,EAAE,mBAAmB,OAAA;AAAA,QAC5B,MAAK;AAAA,QACL,KAAK;AAAA,QACL,OAAM;AAAA,QAEL,UAAA;AAAA,UAAA;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,MAED;AAEN,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,MAAK;AAAA,MACL,OAAM;AAAA,MACN,KAAK;AAAA,MACL,GAAE;AAAA,MACF,IAAG;AAAA,MAEF,UAAA;AAAA,QAAA;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
+
const zIndex = require("../../../theme/zIndex.cjs");
|
|
5
6
|
const MultiSelect$1 = require("../../../node_modules/@mantine/core/esm/components/MultiSelect/MultiSelect.cjs");
|
|
6
7
|
const horizontalPillsListClassName = "fairmint-multiselect-pills-list";
|
|
7
8
|
function mergeClassName(...classes) {
|
|
@@ -23,11 +24,15 @@ function appendHorizontalPillsListClass(classNames) {
|
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
const MultiSelect = React.forwardRef(
|
|
26
|
-
({ classNames, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
|
+
({ classNames, comboboxProps, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
28
|
MultiSelect$1.MultiSelect,
|
|
28
29
|
{
|
|
29
30
|
size: "md",
|
|
30
31
|
classNames: appendHorizontalPillsListClass(classNames),
|
|
32
|
+
comboboxProps: {
|
|
33
|
+
zIndex: zIndex.overlayZIndexAboveFairmintOverlays,
|
|
34
|
+
...comboboxProps
|
|
35
|
+
},
|
|
31
36
|
...props,
|
|
32
37
|
ref
|
|
33
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.cjs","sources":["../../../../src/components/primitives/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n MultiSelect as MantineMultiSelect,\n type MultiSelectProps as MantineMultiSelectProps,\n} from \"@mantine/core\";\nimport { forwardRef } from \"react\";\n\nexport interface MultiSelectProps extends MantineMultiSelectProps {}\n\nconst horizontalPillsListClassName = \"fairmint-multiselect-pills-list\";\n\nfunction mergeClassName(...classes: Array<string | undefined>): string | undefined {\n return classes.filter(Boolean).join(\" \") || undefined;\n}\n\nfunction appendHorizontalPillsListClass(\n classNames: MantineMultiSelectProps[\"classNames\"],\n): MantineMultiSelectProps[\"classNames\"] {\n if (typeof classNames === \"function\") {\n return (theme, props, ctx) => {\n const resolvedClassNames = classNames(theme, props, ctx);\n return {\n ...resolvedClassNames,\n pillsList: mergeClassName(horizontalPillsListClassName, resolvedClassNames?.pillsList),\n };\n };\n }\n\n return {\n ...classNames,\n pillsList: mergeClassName(horizontalPillsListClassName, classNames?.pillsList),\n };\n}\n\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(\n ({ classNames, ...props }, ref) => (\n <MantineMultiSelect\n size=\"md\"\n classNames={appendHorizontalPillsListClass(classNames)}\n {...props}\n ref={ref}\n />\n ),\n);\nMultiSelect.displayName = \"MultiSelect\";\n"],"names":["forwardRef","jsx","MantineMultiSelect"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiSelect.cjs","sources":["../../../../src/components/primitives/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n MultiSelect as MantineMultiSelect,\n type MultiSelectProps as MantineMultiSelectProps,\n} from \"@mantine/core\";\nimport { forwardRef } from \"react\";\nimport { overlayZIndexAboveFairmintOverlays } from \"../../../theme/zIndex\";\n\nexport interface MultiSelectProps extends MantineMultiSelectProps {}\n\nconst horizontalPillsListClassName = \"fairmint-multiselect-pills-list\";\n\nfunction mergeClassName(...classes: Array<string | undefined>): string | undefined {\n return classes.filter(Boolean).join(\" \") || undefined;\n}\n\nfunction appendHorizontalPillsListClass(\n classNames: MantineMultiSelectProps[\"classNames\"],\n): MantineMultiSelectProps[\"classNames\"] {\n if (typeof classNames === \"function\") {\n return (theme, props, ctx) => {\n const resolvedClassNames = classNames(theme, props, ctx);\n return {\n ...resolvedClassNames,\n pillsList: mergeClassName(horizontalPillsListClassName, resolvedClassNames?.pillsList),\n };\n };\n }\n\n return {\n ...classNames,\n pillsList: mergeClassName(horizontalPillsListClassName, classNames?.pillsList),\n };\n}\n\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(\n ({ classNames, comboboxProps, ...props }, ref) => (\n <MantineMultiSelect\n size=\"md\"\n classNames={appendHorizontalPillsListClass(classNames)}\n comboboxProps={{\n zIndex: overlayZIndexAboveFairmintOverlays,\n ...comboboxProps,\n }}\n {...props}\n ref={ref}\n />\n ),\n);\nMultiSelect.displayName = \"MultiSelect\";\n"],"names":["forwardRef","jsx","MantineMultiSelect","overlayZIndexAboveFairmintOverlays"],"mappings":";;;;;;AASA,MAAM,+BAA+B;AAErC,SAAS,kBAAkB,SAAwD;AACjF,SAAO,QAAQ,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAC9C;AAEA,SAAS,+BACP,YACuC;AACvC,MAAI,OAAO,eAAe,YAAY;AACpC,WAAO,CAAC,OAAO,OAAO,QAAQ;AAC5B,YAAM,qBAAqB,WAAW,OAAO,OAAO,GAAG;AACvD,aAAO;AAAA,QACL,GAAG;AAAA,QACH,WAAW,eAAe,8BAA8B,oBAAoB,SAAS;AAAA,MAAA;AAAA,IAEzF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,WAAW,eAAe,8BAA8B,YAAY,SAAS;AAAA,EAAA;AAEjF;AAEO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CAAC,EAAE,YAAY,eAAe,GAAG,MAAA,GAAS,QACxCC,2BAAAA;AAAAA,IAACC,cAAAA;AAAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,YAAY,+BAA+B,UAAU;AAAA,MACrD,eAAe;AAAA,QACb,QAAQC,OAAAA;AAAAA,QACR,GAAG;AAAA,MAAA;AAAA,MAEJ,GAAG;AAAA,MACJ;AAAA,IAAA;AAAA,EAAA;AAGN;AACA,YAAY,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,IAAI,uBAAuB,EACjD,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,IAAI,uBAAuB,EACjD,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,gBAAiB,SAAQ,uBAAuB;CAAG;AA2BpE,eAAO,MAAM,WAAW,+GAavB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { overlayZIndexAboveFairmintOverlays } from "../../../theme/zIndex.js";
|
|
3
4
|
import { MultiSelect as MultiSelect$1 } from "../../../node_modules/@mantine/core/esm/components/MultiSelect/MultiSelect.js";
|
|
4
5
|
const horizontalPillsListClassName = "fairmint-multiselect-pills-list";
|
|
5
6
|
function mergeClassName(...classes) {
|
|
@@ -21,11 +22,15 @@ function appendHorizontalPillsListClass(classNames) {
|
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
const MultiSelect = forwardRef(
|
|
24
|
-
({ classNames, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
25
|
+
({ classNames, comboboxProps, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
25
26
|
MultiSelect$1,
|
|
26
27
|
{
|
|
27
28
|
size: "md",
|
|
28
29
|
classNames: appendHorizontalPillsListClass(classNames),
|
|
30
|
+
comboboxProps: {
|
|
31
|
+
zIndex: overlayZIndexAboveFairmintOverlays,
|
|
32
|
+
...comboboxProps
|
|
33
|
+
},
|
|
29
34
|
...props,
|
|
30
35
|
ref
|
|
31
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.js","sources":["../../../../src/components/primitives/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n MultiSelect as MantineMultiSelect,\n type MultiSelectProps as MantineMultiSelectProps,\n} from \"@mantine/core\";\nimport { forwardRef } from \"react\";\n\nexport interface MultiSelectProps extends MantineMultiSelectProps {}\n\nconst horizontalPillsListClassName = \"fairmint-multiselect-pills-list\";\n\nfunction mergeClassName(...classes: Array<string | undefined>): string | undefined {\n return classes.filter(Boolean).join(\" \") || undefined;\n}\n\nfunction appendHorizontalPillsListClass(\n classNames: MantineMultiSelectProps[\"classNames\"],\n): MantineMultiSelectProps[\"classNames\"] {\n if (typeof classNames === \"function\") {\n return (theme, props, ctx) => {\n const resolvedClassNames = classNames(theme, props, ctx);\n return {\n ...resolvedClassNames,\n pillsList: mergeClassName(horizontalPillsListClassName, resolvedClassNames?.pillsList),\n };\n };\n }\n\n return {\n ...classNames,\n pillsList: mergeClassName(horizontalPillsListClassName, classNames?.pillsList),\n };\n}\n\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(\n ({ classNames, ...props }, ref) => (\n <MantineMultiSelect\n size=\"md\"\n classNames={appendHorizontalPillsListClass(classNames)}\n {...props}\n ref={ref}\n />\n ),\n);\nMultiSelect.displayName = \"MultiSelect\";\n"],"names":["MantineMultiSelect"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sources":["../../../../src/components/primitives/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n MultiSelect as MantineMultiSelect,\n type MultiSelectProps as MantineMultiSelectProps,\n} from \"@mantine/core\";\nimport { forwardRef } from \"react\";\nimport { overlayZIndexAboveFairmintOverlays } from \"../../../theme/zIndex\";\n\nexport interface MultiSelectProps extends MantineMultiSelectProps {}\n\nconst horizontalPillsListClassName = \"fairmint-multiselect-pills-list\";\n\nfunction mergeClassName(...classes: Array<string | undefined>): string | undefined {\n return classes.filter(Boolean).join(\" \") || undefined;\n}\n\nfunction appendHorizontalPillsListClass(\n classNames: MantineMultiSelectProps[\"classNames\"],\n): MantineMultiSelectProps[\"classNames\"] {\n if (typeof classNames === \"function\") {\n return (theme, props, ctx) => {\n const resolvedClassNames = classNames(theme, props, ctx);\n return {\n ...resolvedClassNames,\n pillsList: mergeClassName(horizontalPillsListClassName, resolvedClassNames?.pillsList),\n };\n };\n }\n\n return {\n ...classNames,\n pillsList: mergeClassName(horizontalPillsListClassName, classNames?.pillsList),\n };\n}\n\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(\n ({ classNames, comboboxProps, ...props }, ref) => (\n <MantineMultiSelect\n size=\"md\"\n classNames={appendHorizontalPillsListClass(classNames)}\n comboboxProps={{\n zIndex: overlayZIndexAboveFairmintOverlays,\n ...comboboxProps,\n }}\n {...props}\n ref={ref}\n />\n ),\n);\nMultiSelect.displayName = \"MultiSelect\";\n"],"names":["MantineMultiSelect"],"mappings":";;;;AASA,MAAM,+BAA+B;AAErC,SAAS,kBAAkB,SAAwD;AACjF,SAAO,QAAQ,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAC9C;AAEA,SAAS,+BACP,YACuC;AACvC,MAAI,OAAO,eAAe,YAAY;AACpC,WAAO,CAAC,OAAO,OAAO,QAAQ;AAC5B,YAAM,qBAAqB,WAAW,OAAO,OAAO,GAAG;AACvD,aAAO;AAAA,QACL,GAAG;AAAA,QACH,WAAW,eAAe,8BAA8B,oBAAoB,SAAS;AAAA,MAAA;AAAA,IAEzF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,WAAW,eAAe,8BAA8B,YAAY,SAAS;AAAA,EAAA;AAEjF;AAEO,MAAM,cAAc;AAAA,EACzB,CAAC,EAAE,YAAY,eAAe,GAAG,MAAA,GAAS,QACxC;AAAA,IAACA;AAAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,YAAY,+BAA+B,UAAU;AAAA,MACrD,eAAe;AAAA,QACb,QAAQ;AAAA,QACR,GAAG;AAAA,MAAA;AAAA,MAEJ,GAAG;AAAA,MACJ;AAAA,IAAA;AAAA,EAAA;AAGN;AACA,YAAY,cAAc;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
+
const zIndex = require("../../../theme/zIndex.cjs");
|
|
5
6
|
const Select$1 = require("../../../node_modules/@mantine/core/esm/components/Select/Select.cjs");
|
|
6
7
|
const nodeToLabel = (node) => {
|
|
7
8
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
@@ -66,13 +67,18 @@ const Select = React.forwardRef(
|
|
|
66
67
|
const rendersOwnHiddenInput = Boolean(children && name);
|
|
67
68
|
const selectedOriginalValue = value === void 0 ? uncontrolledOriginalValue : resolveOriginalValue(resolveInternalValue(value));
|
|
68
69
|
const hiddenValue = selectedOriginalValue == null ? "" : String(selectedOriginalValue);
|
|
70
|
+
const mergedComboboxProps = {
|
|
71
|
+
zIndex: zIndex.overlayZIndexAboveFairmintOverlays,
|
|
72
|
+
...comboboxProps
|
|
73
|
+
};
|
|
69
74
|
if (!children && !endAdornment) {
|
|
70
|
-
const { onChange: mantineOnChange, ...mantineProps } = props;
|
|
75
|
+
const { comboboxProps: _comboboxProps, onChange: mantineOnChange, ...mantineProps } = props;
|
|
71
76
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
72
77
|
Select$1.Select,
|
|
73
78
|
{
|
|
74
79
|
size: "md",
|
|
75
80
|
...mantineProps,
|
|
81
|
+
comboboxProps: mergedComboboxProps,
|
|
76
82
|
onChange: mantineOnChange,
|
|
77
83
|
ref
|
|
78
84
|
}
|
|
@@ -93,7 +99,7 @@ const Select = React.forwardRef(
|
|
|
93
99
|
hiddenInputProps: rendersOwnHiddenInput ? void 0 : hiddenInputProps,
|
|
94
100
|
name: rendersOwnHiddenInput ? void 0 : name,
|
|
95
101
|
value: value === void 0 ? void 0 : value == null ? null : String(resolveInternalValue(value)),
|
|
96
|
-
comboboxProps,
|
|
102
|
+
comboboxProps: mergedComboboxProps,
|
|
97
103
|
rightSection: rightSection || endAdornment,
|
|
98
104
|
styles,
|
|
99
105
|
onChange: (next, option) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","sources":["../../../../src/components/primitives/Select/Select.tsx"],"sourcesContent":["import { Select as MantineSelect, type SelectProps as MantineSelectProps } from \"@mantine/core\";\nimport {\n Children,\n forwardRef,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useState,\n} from \"react\";\n\ntype SelectChangeEvent = {\n currentTarget: { name?: string; value: unknown };\n target: { name?: string; value: unknown };\n};\n\ntype LegacySelectChange = (event: SelectChangeEvent, option: unknown) => void;\n\nexport interface SelectProps extends Omit<MantineSelectProps, \"onChange\"> {\n children?: ReactNode;\n endAdornment?: ReactNode;\n onChange?: MantineSelectProps[\"onChange\"] | LegacySelectChange;\n}\n\ntype SelectChildProps = {\n children?: ReactNode;\n value?: unknown;\n};\n\nconst nodeToLabel = (node: ReactNode): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(nodeToLabel).join(\"\");\n if (isValidElement<SelectChildProps>(node)) return nodeToLabel(node.props.children);\n return \"\";\n};\n\nexport const Select = forwardRef<HTMLInputElement, SelectProps>(\n ({ children, endAdornment, ...props }, ref) => {\n const {\n classNames,\n comboboxProps,\n data,\n defaultValue,\n hiddenInputProps,\n name,\n onChange,\n rightSection,\n styles,\n value,\n ...compatProps\n } = props;\n const classNameMap = typeof classNames === \"function\" ? undefined : classNames;\n const rawChildOptions = children\n ? Children.toArray(children)\n .filter(isValidElement)\n .map((child, index) => {\n const option = child as ReactElement<SelectChildProps>;\n const stringValue = String(option.props.value);\n return {\n index,\n label: nodeToLabel(option.props.children),\n originalValue: option.props.value,\n stringValue,\n };\n })\n : undefined;\n const stringValueCounts = new Map<string, number>();\n rawChildOptions?.forEach((option) => {\n stringValueCounts.set(\n option.stringValue,\n (stringValueCounts.get(option.stringValue) ?? 0) + 1,\n );\n });\n const childOptions = rawChildOptions?.map((option) => ({\n ...option,\n value:\n (stringValueCounts.get(option.stringValue) ?? 0) > 1\n ? `${option.stringValue}::${option.index}`\n : option.stringValue,\n }));\n const childValuesByInternalValue = new Map(\n childOptions?.map((option) => [option.value, option.originalValue]),\n );\n const resolveInternalValue = (nextValue: unknown) => {\n if (nextValue == null) return nextValue;\n const matchingOption = childOptions?.find((option) =>\n Object.is(option.originalValue, nextValue),\n );\n return matchingOption?.value ?? String(nextValue);\n };\n const resolveOriginalValue = (nextValue: unknown) => {\n if (nextValue == null) return null;\n return childValuesByInternalValue.has(String(nextValue))\n ? childValuesByInternalValue.get(String(nextValue))\n : nextValue;\n };\n const [uncontrolledOriginalValue, setUncontrolledOriginalValue] = useState(\n defaultValue == null ? null : resolveOriginalValue(resolveInternalValue(defaultValue)),\n );\n const rendersOwnHiddenInput = Boolean(children && name);\n const selectedOriginalValue =\n value === undefined\n ? uncontrolledOriginalValue\n : resolveOriginalValue(resolveInternalValue(value));\n const hiddenValue = selectedOriginalValue == null ? \"\" : String(selectedOriginalValue);\n\n if (!children && !endAdornment) {\n const { onChange: mantineOnChange, ...mantineProps } = props;\n return (\n <MantineSelect\n size=\"md\"\n {...mantineProps}\n onChange={mantineOnChange as MantineSelectProps[\"onChange\"]}\n ref={ref}\n />\n );\n }\n\n return (\n <>\n <MantineSelect\n size=\"md\"\n classNames={{\n ...classNameMap,\n input: [\"MuiSelect-select\", \"fairmint-select-input\", classNameMap?.input]\n .filter(Boolean)\n .join(\" \"),\n option: [\"fairmint-select-option\", classNameMap?.option].filter(Boolean).join(\" \"),\n }}\n data={children ? childOptions?.map(({ label, value }) => ({ label, value })) : data}\n defaultValue={\n defaultValue == null ? undefined : String(resolveInternalValue(defaultValue))\n }\n hiddenInputProps={rendersOwnHiddenInput ? undefined : hiddenInputProps}\n name={rendersOwnHiddenInput ? undefined : name}\n value={\n value === undefined\n ? undefined\n : value == null\n ? null\n : String(resolveInternalValue(value))\n }\n comboboxProps={
|
|
1
|
+
{"version":3,"file":"Select.cjs","sources":["../../../../src/components/primitives/Select/Select.tsx"],"sourcesContent":["import { Select as MantineSelect, type SelectProps as MantineSelectProps } from \"@mantine/core\";\nimport {\n Children,\n forwardRef,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useState,\n} from \"react\";\nimport { overlayZIndexAboveFairmintOverlays } from \"../../../theme/zIndex\";\n\ntype SelectChangeEvent = {\n currentTarget: { name?: string; value: unknown };\n target: { name?: string; value: unknown };\n};\n\ntype LegacySelectChange = (event: SelectChangeEvent, option: unknown) => void;\n\nexport interface SelectProps extends Omit<MantineSelectProps, \"onChange\"> {\n children?: ReactNode;\n endAdornment?: ReactNode;\n onChange?: MantineSelectProps[\"onChange\"] | LegacySelectChange;\n}\n\ntype SelectChildProps = {\n children?: ReactNode;\n value?: unknown;\n};\n\nconst nodeToLabel = (node: ReactNode): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(nodeToLabel).join(\"\");\n if (isValidElement<SelectChildProps>(node)) return nodeToLabel(node.props.children);\n return \"\";\n};\n\nexport const Select = forwardRef<HTMLInputElement, SelectProps>(\n ({ children, endAdornment, ...props }, ref) => {\n const {\n classNames,\n comboboxProps,\n data,\n defaultValue,\n hiddenInputProps,\n name,\n onChange,\n rightSection,\n styles,\n value,\n ...compatProps\n } = props;\n const classNameMap = typeof classNames === \"function\" ? undefined : classNames;\n const rawChildOptions = children\n ? Children.toArray(children)\n .filter(isValidElement)\n .map((child, index) => {\n const option = child as ReactElement<SelectChildProps>;\n const stringValue = String(option.props.value);\n return {\n index,\n label: nodeToLabel(option.props.children),\n originalValue: option.props.value,\n stringValue,\n };\n })\n : undefined;\n const stringValueCounts = new Map<string, number>();\n rawChildOptions?.forEach((option) => {\n stringValueCounts.set(\n option.stringValue,\n (stringValueCounts.get(option.stringValue) ?? 0) + 1,\n );\n });\n const childOptions = rawChildOptions?.map((option) => ({\n ...option,\n value:\n (stringValueCounts.get(option.stringValue) ?? 0) > 1\n ? `${option.stringValue}::${option.index}`\n : option.stringValue,\n }));\n const childValuesByInternalValue = new Map(\n childOptions?.map((option) => [option.value, option.originalValue]),\n );\n const resolveInternalValue = (nextValue: unknown) => {\n if (nextValue == null) return nextValue;\n const matchingOption = childOptions?.find((option) =>\n Object.is(option.originalValue, nextValue),\n );\n return matchingOption?.value ?? String(nextValue);\n };\n const resolveOriginalValue = (nextValue: unknown) => {\n if (nextValue == null) return null;\n return childValuesByInternalValue.has(String(nextValue))\n ? childValuesByInternalValue.get(String(nextValue))\n : nextValue;\n };\n const [uncontrolledOriginalValue, setUncontrolledOriginalValue] = useState(\n defaultValue == null ? null : resolveOriginalValue(resolveInternalValue(defaultValue)),\n );\n const rendersOwnHiddenInput = Boolean(children && name);\n const selectedOriginalValue =\n value === undefined\n ? uncontrolledOriginalValue\n : resolveOriginalValue(resolveInternalValue(value));\n const hiddenValue = selectedOriginalValue == null ? \"\" : String(selectedOriginalValue);\n const mergedComboboxProps = {\n zIndex: overlayZIndexAboveFairmintOverlays,\n ...comboboxProps,\n };\n\n if (!children && !endAdornment) {\n const { comboboxProps: _comboboxProps, onChange: mantineOnChange, ...mantineProps } = props;\n return (\n <MantineSelect\n size=\"md\"\n {...mantineProps}\n comboboxProps={mergedComboboxProps}\n onChange={mantineOnChange as MantineSelectProps[\"onChange\"]}\n ref={ref}\n />\n );\n }\n\n return (\n <>\n <MantineSelect\n size=\"md\"\n classNames={{\n ...classNameMap,\n input: [\"MuiSelect-select\", \"fairmint-select-input\", classNameMap?.input]\n .filter(Boolean)\n .join(\" \"),\n option: [\"fairmint-select-option\", classNameMap?.option].filter(Boolean).join(\" \"),\n }}\n data={children ? childOptions?.map(({ label, value }) => ({ label, value })) : data}\n defaultValue={\n defaultValue == null ? undefined : String(resolveInternalValue(defaultValue))\n }\n hiddenInputProps={rendersOwnHiddenInput ? undefined : hiddenInputProps}\n name={rendersOwnHiddenInput ? undefined : name}\n value={\n value === undefined\n ? undefined\n : value == null\n ? null\n : String(resolveInternalValue(value))\n }\n comboboxProps={mergedComboboxProps}\n rightSection={rightSection || endAdornment}\n styles={styles}\n onChange={(next, option) => {\n if (children) {\n const originalValue = resolveOriginalValue(next);\n if (value === undefined) setUncontrolledOriginalValue(originalValue);\n const event = {\n currentTarget: { name, value: originalValue },\n target: { name, value: originalValue },\n };\n (onChange as LegacySelectChange | undefined)?.(event, option);\n return;\n }\n (onChange as MantineSelectProps[\"onChange\"] | undefined)?.(next, option);\n }}\n {...compatProps}\n ref={ref}\n />\n {rendersOwnHiddenInput ? (\n <input {...hiddenInputProps} name={name} type=\"hidden\" value={hiddenValue} />\n ) : null}\n </>\n );\n },\n);\nSelect.displayName = \"Select\";\n"],"names":["isValidElement","forwardRef","Children","useState","overlayZIndexAboveFairmintOverlays","jsx","MantineSelect","jsxs","Fragment","value"],"mappings":";;;;;;AA6BA,MAAM,cAAc,CAAC,SAA4B;AAC/C,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,SAAU,QAAO,OAAO,IAAI;AAC5E,MAAI,MAAM,QAAQ,IAAI,EAAG,QAAO,KAAK,IAAI,WAAW,EAAE,KAAK,EAAE;AAC7D,MAAIA,MAAAA,eAAiC,IAAI,UAAU,YAAY,KAAK,MAAM,QAAQ;AAClF,SAAO;AACT;AAEO,MAAM,SAASC,MAAAA;AAAAA,EACpB,CAAC,EAAE,UAAU,cAAc,GAAG,MAAA,GAAS,QAAQ;AAC7C,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD;AACJ,UAAM,eAAe,OAAO,eAAe,aAAa,SAAY;AACpE,UAAM,kBAAkB,WACpBC,MAAAA,SAAS,QAAQ,QAAQ,EACtB,OAAOF,MAAAA,cAAc,EACrB,IAAI,CAAC,OAAO,UAAU;AACrB,YAAM,SAAS;AACf,YAAM,cAAc,OAAO,OAAO,MAAM,KAAK;AAC7C,aAAO;AAAA,QACL;AAAA,QACA,OAAO,YAAY,OAAO,MAAM,QAAQ;AAAA,QACxC,eAAe,OAAO,MAAM;AAAA,QAC5B;AAAA,MAAA;AAAA,IAEJ,CAAC,IACH;AACJ,UAAM,wCAAwB,IAAA;AAC9B,qBAAiB,QAAQ,CAAC,WAAW;AACnC,wBAAkB;AAAA,QAChB,OAAO;AAAA,SACN,kBAAkB,IAAI,OAAO,WAAW,KAAK,KAAK;AAAA,MAAA;AAAA,IAEvD,CAAC;AACD,UAAM,eAAe,iBAAiB,IAAI,CAAC,YAAY;AAAA,MACrD,GAAG;AAAA,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EJ;AACF;AACA,OAAO,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,WAAW,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EAKL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,WAAW,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EAKL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAGf,KAAK,iBAAiB,GAAG;IACvB,aAAa,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACjD,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;CAC3C,CAAC;AAEF,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAE9E,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC;IACvE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC;CAChE;AAcD,eAAO,MAAM,MAAM,0GAwIlB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, Children, isValidElement, useState } from "react";
|
|
3
|
+
import { overlayZIndexAboveFairmintOverlays } from "../../../theme/zIndex.js";
|
|
3
4
|
import { Select as Select$1 } from "../../../node_modules/@mantine/core/esm/components/Select/Select.js";
|
|
4
5
|
const nodeToLabel = (node) => {
|
|
5
6
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
@@ -64,13 +65,18 @@ const Select = forwardRef(
|
|
|
64
65
|
const rendersOwnHiddenInput = Boolean(children && name);
|
|
65
66
|
const selectedOriginalValue = value === void 0 ? uncontrolledOriginalValue : resolveOriginalValue(resolveInternalValue(value));
|
|
66
67
|
const hiddenValue = selectedOriginalValue == null ? "" : String(selectedOriginalValue);
|
|
68
|
+
const mergedComboboxProps = {
|
|
69
|
+
zIndex: overlayZIndexAboveFairmintOverlays,
|
|
70
|
+
...comboboxProps
|
|
71
|
+
};
|
|
67
72
|
if (!children && !endAdornment) {
|
|
68
|
-
const { onChange: mantineOnChange, ...mantineProps } = props;
|
|
73
|
+
const { comboboxProps: _comboboxProps, onChange: mantineOnChange, ...mantineProps } = props;
|
|
69
74
|
return /* @__PURE__ */ jsx(
|
|
70
75
|
Select$1,
|
|
71
76
|
{
|
|
72
77
|
size: "md",
|
|
73
78
|
...mantineProps,
|
|
79
|
+
comboboxProps: mergedComboboxProps,
|
|
74
80
|
onChange: mantineOnChange,
|
|
75
81
|
ref
|
|
76
82
|
}
|
|
@@ -91,7 +97,7 @@ const Select = forwardRef(
|
|
|
91
97
|
hiddenInputProps: rendersOwnHiddenInput ? void 0 : hiddenInputProps,
|
|
92
98
|
name: rendersOwnHiddenInput ? void 0 : name,
|
|
93
99
|
value: value === void 0 ? void 0 : value == null ? null : String(resolveInternalValue(value)),
|
|
94
|
-
comboboxProps,
|
|
100
|
+
comboboxProps: mergedComboboxProps,
|
|
95
101
|
rightSection: rightSection || endAdornment,
|
|
96
102
|
styles,
|
|
97
103
|
onChange: (next, option) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../src/components/primitives/Select/Select.tsx"],"sourcesContent":["import { Select as MantineSelect, type SelectProps as MantineSelectProps } from \"@mantine/core\";\nimport {\n Children,\n forwardRef,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useState,\n} from \"react\";\n\ntype SelectChangeEvent = {\n currentTarget: { name?: string; value: unknown };\n target: { name?: string; value: unknown };\n};\n\ntype LegacySelectChange = (event: SelectChangeEvent, option: unknown) => void;\n\nexport interface SelectProps extends Omit<MantineSelectProps, \"onChange\"> {\n children?: ReactNode;\n endAdornment?: ReactNode;\n onChange?: MantineSelectProps[\"onChange\"] | LegacySelectChange;\n}\n\ntype SelectChildProps = {\n children?: ReactNode;\n value?: unknown;\n};\n\nconst nodeToLabel = (node: ReactNode): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(nodeToLabel).join(\"\");\n if (isValidElement<SelectChildProps>(node)) return nodeToLabel(node.props.children);\n return \"\";\n};\n\nexport const Select = forwardRef<HTMLInputElement, SelectProps>(\n ({ children, endAdornment, ...props }, ref) => {\n const {\n classNames,\n comboboxProps,\n data,\n defaultValue,\n hiddenInputProps,\n name,\n onChange,\n rightSection,\n styles,\n value,\n ...compatProps\n } = props;\n const classNameMap = typeof classNames === \"function\" ? undefined : classNames;\n const rawChildOptions = children\n ? Children.toArray(children)\n .filter(isValidElement)\n .map((child, index) => {\n const option = child as ReactElement<SelectChildProps>;\n const stringValue = String(option.props.value);\n return {\n index,\n label: nodeToLabel(option.props.children),\n originalValue: option.props.value,\n stringValue,\n };\n })\n : undefined;\n const stringValueCounts = new Map<string, number>();\n rawChildOptions?.forEach((option) => {\n stringValueCounts.set(\n option.stringValue,\n (stringValueCounts.get(option.stringValue) ?? 0) + 1,\n );\n });\n const childOptions = rawChildOptions?.map((option) => ({\n ...option,\n value:\n (stringValueCounts.get(option.stringValue) ?? 0) > 1\n ? `${option.stringValue}::${option.index}`\n : option.stringValue,\n }));\n const childValuesByInternalValue = new Map(\n childOptions?.map((option) => [option.value, option.originalValue]),\n );\n const resolveInternalValue = (nextValue: unknown) => {\n if (nextValue == null) return nextValue;\n const matchingOption = childOptions?.find((option) =>\n Object.is(option.originalValue, nextValue),\n );\n return matchingOption?.value ?? String(nextValue);\n };\n const resolveOriginalValue = (nextValue: unknown) => {\n if (nextValue == null) return null;\n return childValuesByInternalValue.has(String(nextValue))\n ? childValuesByInternalValue.get(String(nextValue))\n : nextValue;\n };\n const [uncontrolledOriginalValue, setUncontrolledOriginalValue] = useState(\n defaultValue == null ? null : resolveOriginalValue(resolveInternalValue(defaultValue)),\n );\n const rendersOwnHiddenInput = Boolean(children && name);\n const selectedOriginalValue =\n value === undefined\n ? uncontrolledOriginalValue\n : resolveOriginalValue(resolveInternalValue(value));\n const hiddenValue = selectedOriginalValue == null ? \"\" : String(selectedOriginalValue);\n\n if (!children && !endAdornment) {\n const { onChange: mantineOnChange, ...mantineProps } = props;\n return (\n <MantineSelect\n size=\"md\"\n {...mantineProps}\n onChange={mantineOnChange as MantineSelectProps[\"onChange\"]}\n ref={ref}\n />\n );\n }\n\n return (\n <>\n <MantineSelect\n size=\"md\"\n classNames={{\n ...classNameMap,\n input: [\"MuiSelect-select\", \"fairmint-select-input\", classNameMap?.input]\n .filter(Boolean)\n .join(\" \"),\n option: [\"fairmint-select-option\", classNameMap?.option].filter(Boolean).join(\" \"),\n }}\n data={children ? childOptions?.map(({ label, value }) => ({ label, value })) : data}\n defaultValue={\n defaultValue == null ? undefined : String(resolveInternalValue(defaultValue))\n }\n hiddenInputProps={rendersOwnHiddenInput ? undefined : hiddenInputProps}\n name={rendersOwnHiddenInput ? undefined : name}\n value={\n value === undefined\n ? undefined\n : value == null\n ? null\n : String(resolveInternalValue(value))\n }\n comboboxProps={
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../src/components/primitives/Select/Select.tsx"],"sourcesContent":["import { Select as MantineSelect, type SelectProps as MantineSelectProps } from \"@mantine/core\";\nimport {\n Children,\n forwardRef,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useState,\n} from \"react\";\nimport { overlayZIndexAboveFairmintOverlays } from \"../../../theme/zIndex\";\n\ntype SelectChangeEvent = {\n currentTarget: { name?: string; value: unknown };\n target: { name?: string; value: unknown };\n};\n\ntype LegacySelectChange = (event: SelectChangeEvent, option: unknown) => void;\n\nexport interface SelectProps extends Omit<MantineSelectProps, \"onChange\"> {\n children?: ReactNode;\n endAdornment?: ReactNode;\n onChange?: MantineSelectProps[\"onChange\"] | LegacySelectChange;\n}\n\ntype SelectChildProps = {\n children?: ReactNode;\n value?: unknown;\n};\n\nconst nodeToLabel = (node: ReactNode): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(nodeToLabel).join(\"\");\n if (isValidElement<SelectChildProps>(node)) return nodeToLabel(node.props.children);\n return \"\";\n};\n\nexport const Select = forwardRef<HTMLInputElement, SelectProps>(\n ({ children, endAdornment, ...props }, ref) => {\n const {\n classNames,\n comboboxProps,\n data,\n defaultValue,\n hiddenInputProps,\n name,\n onChange,\n rightSection,\n styles,\n value,\n ...compatProps\n } = props;\n const classNameMap = typeof classNames === \"function\" ? undefined : classNames;\n const rawChildOptions = children\n ? Children.toArray(children)\n .filter(isValidElement)\n .map((child, index) => {\n const option = child as ReactElement<SelectChildProps>;\n const stringValue = String(option.props.value);\n return {\n index,\n label: nodeToLabel(option.props.children),\n originalValue: option.props.value,\n stringValue,\n };\n })\n : undefined;\n const stringValueCounts = new Map<string, number>();\n rawChildOptions?.forEach((option) => {\n stringValueCounts.set(\n option.stringValue,\n (stringValueCounts.get(option.stringValue) ?? 0) + 1,\n );\n });\n const childOptions = rawChildOptions?.map((option) => ({\n ...option,\n value:\n (stringValueCounts.get(option.stringValue) ?? 0) > 1\n ? `${option.stringValue}::${option.index}`\n : option.stringValue,\n }));\n const childValuesByInternalValue = new Map(\n childOptions?.map((option) => [option.value, option.originalValue]),\n );\n const resolveInternalValue = (nextValue: unknown) => {\n if (nextValue == null) return nextValue;\n const matchingOption = childOptions?.find((option) =>\n Object.is(option.originalValue, nextValue),\n );\n return matchingOption?.value ?? String(nextValue);\n };\n const resolveOriginalValue = (nextValue: unknown) => {\n if (nextValue == null) return null;\n return childValuesByInternalValue.has(String(nextValue))\n ? childValuesByInternalValue.get(String(nextValue))\n : nextValue;\n };\n const [uncontrolledOriginalValue, setUncontrolledOriginalValue] = useState(\n defaultValue == null ? null : resolveOriginalValue(resolveInternalValue(defaultValue)),\n );\n const rendersOwnHiddenInput = Boolean(children && name);\n const selectedOriginalValue =\n value === undefined\n ? uncontrolledOriginalValue\n : resolveOriginalValue(resolveInternalValue(value));\n const hiddenValue = selectedOriginalValue == null ? \"\" : String(selectedOriginalValue);\n const mergedComboboxProps = {\n zIndex: overlayZIndexAboveFairmintOverlays,\n ...comboboxProps,\n };\n\n if (!children && !endAdornment) {\n const { comboboxProps: _comboboxProps, onChange: mantineOnChange, ...mantineProps } = props;\n return (\n <MantineSelect\n size=\"md\"\n {...mantineProps}\n comboboxProps={mergedComboboxProps}\n onChange={mantineOnChange as MantineSelectProps[\"onChange\"]}\n ref={ref}\n />\n );\n }\n\n return (\n <>\n <MantineSelect\n size=\"md\"\n classNames={{\n ...classNameMap,\n input: [\"MuiSelect-select\", \"fairmint-select-input\", classNameMap?.input]\n .filter(Boolean)\n .join(\" \"),\n option: [\"fairmint-select-option\", classNameMap?.option].filter(Boolean).join(\" \"),\n }}\n data={children ? childOptions?.map(({ label, value }) => ({ label, value })) : data}\n defaultValue={\n defaultValue == null ? undefined : String(resolveInternalValue(defaultValue))\n }\n hiddenInputProps={rendersOwnHiddenInput ? undefined : hiddenInputProps}\n name={rendersOwnHiddenInput ? undefined : name}\n value={\n value === undefined\n ? undefined\n : value == null\n ? null\n : String(resolveInternalValue(value))\n }\n comboboxProps={mergedComboboxProps}\n rightSection={rightSection || endAdornment}\n styles={styles}\n onChange={(next, option) => {\n if (children) {\n const originalValue = resolveOriginalValue(next);\n if (value === undefined) setUncontrolledOriginalValue(originalValue);\n const event = {\n currentTarget: { name, value: originalValue },\n target: { name, value: originalValue },\n };\n (onChange as LegacySelectChange | undefined)?.(event, option);\n return;\n }\n (onChange as MantineSelectProps[\"onChange\"] | undefined)?.(next, option);\n }}\n {...compatProps}\n ref={ref}\n />\n {rendersOwnHiddenInput ? (\n <input {...hiddenInputProps} name={name} type=\"hidden\" value={hiddenValue} />\n ) : null}\n </>\n );\n },\n);\nSelect.displayName = \"Select\";\n"],"names":["MantineSelect","value"],"mappings":";;;;AA6BA,MAAM,cAAc,CAAC,SAA4B;AAC/C,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,SAAU,QAAO,OAAO,IAAI;AAC5E,MAAI,MAAM,QAAQ,IAAI,EAAG,QAAO,KAAK,IAAI,WAAW,EAAE,KAAK,EAAE;AAC7D,MAAI,eAAiC,IAAI,UAAU,YAAY,KAAK,MAAM,QAAQ;AAClF,SAAO;AACT;AAEO,MAAM,SAAS;AAAA,EACpB,CAAC,EAAE,UAAU,cAAc,GAAG,MAAA,GAAS,QAAQ;AAC7C,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD;AACJ,UAAM,eAAe,OAAO,eAAe,aAAa,SAAY;AACpE,UAAM,kBAAkB,WACpB,SAAS,QAAQ,QAAQ,EACtB,OAAO,cAAc,EACrB,IAAI,CAAC,OAAO,UAAU;AACrB,YAAM,SAAS;AACf,YAAM,cAAc,OAAO,OAAO,MAAM,KAAK;AAC7C,aAAO;AAAA,QACL;AAAA,QACA,OAAO,YAAY,OAAO,MAAM,QAAQ;AAAA,QACxC,eAAe,OAAO,MAAM;AAAA,QAC5B;AAAA,MAAA;AAAA,IAEJ,CAAC,IACH;AACJ,UAAM,wCAAwB,IAAA;AAC9B,qBAAiB,QAAQ,CAAC,WAAW;AACnC,wBAAkB;AAAA,QAChB,OAAO;AAAA,SACN,kBAAkB,IAAI,O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AO,YAAA,CAAa,IACzE;AAAA,IAAA,GACN;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;"}
|
|
@@ -16,6 +16,7 @@ const Table = require("../../node_modules/@mantine/core/esm/components/Table/Tab
|
|
|
16
16
|
const Accordion$1 = require("../../node_modules/@mantine/core/esm/components/Accordion/Accordion.cjs");
|
|
17
17
|
const Text = require("../../node_modules/@mantine/core/esm/components/Text/Text.cjs");
|
|
18
18
|
const MultiSelect = require("../../node_modules/@mantine/core/esm/components/MultiSelect/MultiSelect.cjs");
|
|
19
|
+
const zIndex = require("../../theme/zIndex.cjs");
|
|
19
20
|
const Select = require("../../node_modules/@mantine/core/esm/components/Select/Select.cjs");
|
|
20
21
|
const Box = require("../../node_modules/@mantine/core/esm/core/Box/Box.cjs");
|
|
21
22
|
const Title = require("../../node_modules/@mantine/core/esm/components/Title/Title.cjs");
|
|
@@ -1231,6 +1232,7 @@ function Autocomplete(componentProps) {
|
|
|
1231
1232
|
filterOptions,
|
|
1232
1233
|
freeSolo,
|
|
1233
1234
|
fullWidth,
|
|
1235
|
+
comboboxProps,
|
|
1234
1236
|
getOptionLabel,
|
|
1235
1237
|
defaultValue,
|
|
1236
1238
|
inputValue,
|
|
@@ -1363,6 +1365,10 @@ function Autocomplete(componentProps) {
|
|
|
1363
1365
|
const commonSelectProps = {
|
|
1364
1366
|
...autocompleteInputProps,
|
|
1365
1367
|
clearable: !disableClearable,
|
|
1368
|
+
comboboxProps: {
|
|
1369
|
+
zIndex: zIndex.overlayZIndexAboveFairmintOverlays,
|
|
1370
|
+
...comboboxProps
|
|
1371
|
+
},
|
|
1366
1372
|
disabled: disabled ?? autocompleteInputProps.disabled,
|
|
1367
1373
|
label: inputProps.label || label,
|
|
1368
1374
|
nothingFoundMessage: _noOptionsText,
|