@synnaxlabs/pluto 0.21.3 → 0.21.5

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.
Files changed (110) hide show
  1. package/dist/{Keyboard-C8cyKsao.js → Keyboard-BqO4SYSr.js} +2 -2
  2. package/dist/{Keyboard-C8cyKsao.js.map → Keyboard-BqO4SYSr.js.map} +1 -1
  3. package/dist/{Keyboard-CQoUT-k_.cjs → Keyboard-CsgjS96C.cjs} +2 -2
  4. package/dist/{Keyboard-CQoUT-k_.cjs.map → Keyboard-CsgjS96C.cjs.map} +1 -1
  5. package/dist/{Link-pE5mGv-R.cjs → Link-B6B7MB7O.cjs} +2 -2
  6. package/dist/{Link-pE5mGv-R.cjs.map → Link-B6B7MB7O.cjs.map} +1 -1
  7. package/dist/{Link-3r9yGooG.js → Link-BaPpY2rf.js} +2 -2
  8. package/dist/{Link-3r9yGooG.js.map → Link-BaPpY2rf.js.map} +1 -1
  9. package/dist/{List-DufMhjqX.cjs → List-J5T88ynF.cjs} +2 -2
  10. package/dist/{List-DufMhjqX.cjs.map → List-J5T88ynF.cjs.map} +1 -1
  11. package/dist/{List-A5VsgE6N.js → List-aJEsDHql.js} +2 -2
  12. package/dist/{List-A5VsgE6N.js.map → List-aJEsDHql.js.map} +1 -1
  13. package/dist/{Toggle-D1EoehhH.cjs → Toggle-CAW20E9V.cjs} +56 -20
  14. package/dist/Toggle-CAW20E9V.cjs.map +1 -0
  15. package/dist/{Toggle-Blzh0A0b.js → Toggle-DcOiWiHG.js} +56 -20
  16. package/dist/Toggle-DcOiWiHG.js.map +1 -0
  17. package/dist/button.cjs +1 -1
  18. package/dist/button.js +1 -1
  19. package/dist/color.cjs +1 -1
  20. package/dist/color.js +1 -1
  21. package/dist/dropdown.cjs +1 -1
  22. package/dist/dropdown.js +1 -1
  23. package/dist/{external-C0ssJO_w.js → external-B695Iunb.js} +2 -2
  24. package/dist/{external-C0ssJO_w.js.map → external-B695Iunb.js.map} +1 -1
  25. package/dist/{external-BMK0UUaW.js → external-B6yW9yjs.js} +2 -2
  26. package/dist/external-B6yW9yjs.js.map +1 -0
  27. package/dist/{external-Bh2-N-ic.cjs → external-BGl-cQCe.cjs} +4 -4
  28. package/dist/{external-Bh2-N-ic.cjs.map → external-BGl-cQCe.cjs.map} +1 -1
  29. package/dist/{external-D9_xWvtb.js → external-Bn7V_LTL.js} +3 -3
  30. package/dist/{external-D9_xWvtb.js.map → external-Bn7V_LTL.js.map} +1 -1
  31. package/dist/{external-ueyo2Jw7.cjs → external-BoNCimxR.cjs} +2 -2
  32. package/dist/external-BoNCimxR.cjs.map +1 -0
  33. package/dist/{external-DJYiyF-g.js → external-Brr6przd.js} +2 -2
  34. package/dist/{external-DJYiyF-g.js.map → external-Brr6przd.js.map} +1 -1
  35. package/dist/{external-ClBFWQBO.js → external-CPB95nWX.js} +2 -2
  36. package/dist/{external-ClBFWQBO.js.map → external-CPB95nWX.js.map} +1 -1
  37. package/dist/{external-B8ILMNP2.cjs → external-CYRIymJR.cjs} +2 -2
  38. package/dist/{external-B8ILMNP2.cjs.map → external-CYRIymJR.cjs.map} +1 -1
  39. package/dist/{external-BL3iWJdz.cjs → external-CZli69bF.cjs} +2 -2
  40. package/dist/{external-BL3iWJdz.cjs.map → external-CZli69bF.cjs.map} +1 -1
  41. package/dist/{external-Cco96ysu.js → external-CflFsngP.js} +3 -3
  42. package/dist/external-CflFsngP.js.map +1 -0
  43. package/dist/{external-Dsqoldyc.js → external-CtH30naU.js} +2 -2
  44. package/dist/{external-Dsqoldyc.js.map → external-CtH30naU.js.map} +1 -1
  45. package/dist/{external-D5cOWqK9.js → external-D8uwkCSk.js} +3 -3
  46. package/dist/{external-D5cOWqK9.js.map → external-D8uwkCSk.js.map} +1 -1
  47. package/dist/{external-S9aNR1qN.cjs → external-DL9-TJzC.cjs} +4 -4
  48. package/dist/{external-S9aNR1qN.cjs.map → external-DL9-TJzC.cjs.map} +1 -1
  49. package/dist/{external-BVW64h82.cjs → external-DnojrP1p.cjs} +7 -7
  50. package/dist/{external-BVW64h82.cjs.map → external-DnojrP1p.cjs.map} +1 -1
  51. package/dist/{external-zennQBXe.js → external-Doprw1Uu.js} +4 -4
  52. package/dist/{external-zennQBXe.js.map → external-Doprw1Uu.js.map} +1 -1
  53. package/dist/{external-XnNSUnBv.cjs → external-Dpr-yBfa.cjs} +3 -3
  54. package/dist/external-Dpr-yBfa.cjs.map +1 -0
  55. package/dist/{external-CygFOviM.cjs → external-Drem1ngI.cjs} +2 -2
  56. package/dist/{external-CygFOviM.cjs.map → external-Drem1ngI.cjs.map} +1 -1
  57. package/dist/{external-QoTq138N.cjs → external-axSECIuu.cjs} +3 -3
  58. package/dist/{external-QoTq138N.cjs.map → external-axSECIuu.cjs.map} +1 -1
  59. package/dist/{external-BC7QdjAs.cjs → external-kZAfJn1X.cjs} +3 -3
  60. package/dist/{external-BC7QdjAs.cjs.map → external-kZAfJn1X.cjs.map} +1 -1
  61. package/dist/{external-B8MvInOj.cjs → external-p8bRcctL.cjs} +2 -2
  62. package/dist/{external-B8MvInOj.cjs.map → external-p8bRcctL.cjs.map} +1 -1
  63. package/dist/{external-1LeSvPMo.js → external-wfv-EKsR.js} +4 -4
  64. package/dist/{external-1LeSvPMo.js.map → external-wfv-EKsR.js.map} +1 -1
  65. package/dist/{external-BlDgPWoN.js → external-yv4F8ndX.js} +7 -7
  66. package/dist/{external-BlDgPWoN.js.map → external-yv4F8ndX.js.map} +1 -1
  67. package/dist/header.cjs +1 -1
  68. package/dist/header.js +1 -1
  69. package/dist/index.cjs +43 -15
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.js +51 -23
  72. package/dist/index.js.map +1 -1
  73. package/dist/input.cjs +1 -1
  74. package/dist/input.js +1 -1
  75. package/dist/list.cjs +1 -1
  76. package/dist/list.js +1 -1
  77. package/dist/menu.cjs +1 -1
  78. package/dist/menu.js +1 -1
  79. package/dist/src/form/Form.d.ts +2 -1
  80. package/dist/src/form/Form.d.ts.map +1 -1
  81. package/dist/src/hooks/useTransforms.d.ts.map +1 -1
  82. package/dist/src/list/Column.d.ts +1 -1
  83. package/dist/src/list/Column.d.ts.map +1 -1
  84. package/dist/src/list/Core.d.ts.map +1 -1
  85. package/dist/src/list/Data.d.ts +2 -0
  86. package/dist/src/list/Data.d.ts.map +1 -1
  87. package/dist/src/list/types.d.ts +1 -0
  88. package/dist/src/list/types.d.ts.map +1 -1
  89. package/dist/src/note/Note.d.ts +3 -3
  90. package/dist/src/note/Note.d.ts.map +1 -1
  91. package/dist/src/text/Text.d.ts +2 -2
  92. package/dist/src/text/Text.d.ts.map +1 -1
  93. package/dist/style.css +5 -1
  94. package/dist/tabs.cjs +1 -1
  95. package/dist/tabs.js +1 -1
  96. package/dist/text.cjs +2 -2
  97. package/dist/text.js +2 -2
  98. package/dist/theming.cjs +2 -2
  99. package/dist/theming.js +2 -2
  100. package/dist/tree.cjs +1 -1
  101. package/dist/tree.js +1 -1
  102. package/dist/triggers.cjs +1 -1
  103. package/dist/triggers.js +1 -1
  104. package/package.json +5 -5
  105. package/dist/Toggle-Blzh0A0b.js.map +0 -1
  106. package/dist/Toggle-D1EoehhH.cjs.map +0 -1
  107. package/dist/external-BMK0UUaW.js.map +0 -1
  108. package/dist/external-Cco96ysu.js.map +0 -1
  109. package/dist/external-XnNSUnBv.cjs.map +0 -1
  110. package/dist/external-ueyo2Jw7.cjs.map +0 -1
package/dist/button.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const external = require("./external-XnNSUnBv.cjs");
3
+ const external = require("./external-Dpr-yBfa.cjs");
4
4
  exports.Button = external.external;
5
5
  //# sourceMappingURL=button.cjs.map
package/dist/button.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e } from "./external-Cco96ysu.js";
1
+ import { e } from "./external-CflFsngP.js";
2
2
  export {
3
3
  e as Button
4
4
  };
package/dist/color.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const external = require("./external-B8MvInOj.cjs");
3
+ const external = require("./external-p8bRcctL.cjs");
4
4
  exports.Color = external.external;
5
5
  //# sourceMappingURL=color.cjs.map
package/dist/color.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e } from "./external-ClBFWQBO.js";
1
+ import { e } from "./external-CPB95nWX.js";
2
2
  export {
3
3
  e as Color
4
4
  };
package/dist/dropdown.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Toggle = require("./Toggle-D1EoehhH.cjs");
3
+ const Toggle = require("./Toggle-CAW20E9V.cjs");
4
4
  exports.Dropdown = Toggle.Dropdown;
5
5
  //# sourceMappingURL=dropdown.cjs.map
package/dist/dropdown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D } from "./Toggle-Blzh0A0b.js";
1
+ import { D } from "./Toggle-DcOiWiHG.js";
2
2
  export {
3
3
  D as Dropdown
4
4
  };
@@ -2,7 +2,7 @@ import { j as jsxRuntimeExports } from "./jsx-runtime-mMz73N64.js";
2
2
  import { createContext, useContext as useContext$1, isValidElement, Fragment } from "react";
3
3
  import { A, j as LevelComponentSizes } from "./aggregator-Dl2jHye5.js";
4
4
  import { S as Space } from "./Center-hbwH7rg9.js";
5
- import { I as Icon, ar as Divider, B as Button, W as WithIcon } from "./Toggle-Blzh0A0b.js";
5
+ import { I as Icon, ar as Divider, B as Button, W as WithIcon } from "./Toggle-DcOiWiHG.js";
6
6
  import { C as CSS } from "./css-DoalWJF6.js";
7
7
  const Context = createContext({
8
8
  divided: false,
@@ -119,4 +119,4 @@ export {
119
119
  Header as H,
120
120
  external as e
121
121
  };
122
- //# sourceMappingURL=external-C0ssJO_w.js.map
122
+ //# sourceMappingURL=external-B695Iunb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-C0ssJO_w.js","sources":["../src/header/Header.tsx","../src/header/Actions.tsx","../src/header/ButtonTitle.tsx","../src/header/Title.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n createContext,\n type ReactElement,\n type ReactNode,\n useContext as reactUseContext,\n} from \"react\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { type Text } from \"@/text\";\n\nimport \"@/header/Header.css\";\n\nexport interface HeaderProps extends Omit<Align.SpaceProps, \"children\" | \"el\"> {\n level?: Text.Level;\n divided?: boolean;\n children: ReactNode | [ReactNode, ReactNode];\n}\n\nexport interface ContextValue {\n divided: boolean;\n level: Text.Level;\n}\n\nconst Context = createContext<ContextValue>({\n divided: false,\n level: \"h1\",\n});\n\nexport const useContext = (): ContextValue => reactUseContext(Context);\n\n/**\n * The container for a module header.\n *\n * @param props - The component props. All unused props will be passed down to the\n * {@link Space} containing the header.\n * @param props.level - The font level for the header. See the {@link Typography.Text}\n * component for all possible levels. Default is \"h1.\"\n * @param props.icon - An optional icon to add add before the start of the header text.\n * @param props.actions - A list of actions to be rendered on the right side ofthe header.\n * If the action is a JSX element, it will be rendered directly, and if its of type\n * ButtonIconProps, a ButtonIconOnly will be rendered using the given props.\n * @param props.divided - If true, creates a divider between the start icon, header text,\n * and each action. Default is false.\n */\nexport const Header = ({\n children,\n className,\n level = \"h1\",\n divided = false,\n ...props\n}: HeaderProps): ReactElement => (\n <Context.Provider value={{ level, divided }}>\n <Align.Space\n el=\"header\"\n direction=\"x\"\n justify=\"spaceBetween\"\n className={CSS(\n CSS.B(\"header\"),\n CSS.bordered(\"bottom\"),\n divided && CSS.BM(\"header\", \"divided\"),\n className,\n )}\n {...props}\n >\n {children}\n </Align.Space>\n </Context.Provider>\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { Fragment, isValidElement, type ReactElement } from \"react\";\n\nimport { toArray } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { Divider } from \"@/divider\";\nimport { useContext } from \"@/header/Header\";\nimport { Text } from \"@/text\";\n\nexport type ActionSpec = Button.IconProps | ReactElement;\n\nexport interface ActionsProps {\n children?: ActionSpec | ActionSpec[];\n}\n\n/**\n * Custom actions to render on the right side of the header.\n *\n * @param children - The actions to render. If the action is of type\n * {@link ButtonIconProps}, a correectly sized {@link ButtonIconOnly} is rendered\n * using the given props. If the action is a JSX element, it is renderered directly.\n * It's a good idea to prefer the latter in almost all cases for simplicity.\n */\nexport const Actions = ({ children = [] }: ActionsProps): ReactElement => {\n const { level, divided } = useContext();\n return (\n <Align.Space\n direction=\"x\"\n size=\"small\"\n align=\"center\"\n className={CSS.BE(\"header\", \"actions\")}\n >\n {toArray(children).map((action, i) => (\n <Action key={i} index={i} level={level} divided={divided}>\n {action}\n </Action>\n ))}\n </Align.Space>\n );\n};\n\ninterface ActionProps {\n index: number;\n level: Text.Level;\n children: ReactElement | Button.IconProps;\n divided: boolean;\n}\n\nconst Action = ({ index, level, children, divided }: ActionProps): ReactElement => {\n let content: ReactElement = children as ReactElement;\n if (!isValidElement(children)) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const props = children as Button.IconProps;\n content = (\n <Button.Icon\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n props.onClick?.(e);\n }}\n key={index}\n size={Text.LevelComponentSizes[level]}\n {...props}\n />\n );\n }\n return (\n <Fragment key={index}>\n {divided && <Divider.Divider />}\n {content}\n </Fragment>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { useContext } from \"@/header/Header\";\nimport { Text } from \"@/text\";\n\nexport interface ButtonTitleProps\n extends Omit<Button.ButtonProps, \"variant\" | \"size\"> {}\n\n/**\n * Header.Title.Use renders a clickable header title.\n *\n * @param props - The comonent props. The props for this component are identical\n * to {@link Button}, except the variant is always 'outlined' and that the component size\n * is automatically inferred from the 'level' prop passsed to the parent {@link Header}\n * component.\n */\nexport const ButtonTitle = ({\n children = \"\",\n className,\n onClick,\n ...props\n}: ButtonTitleProps): ReactElement => {\n const { level } = useContext();\n return (\n <Button.Button\n variant=\"text\"\n size={Text.LevelComponentSizes[level]}\n onClick={onClick}\n className={CSS(CSS.B(\"header-button-title\"), className)}\n sharp\n {...props}\n >\n {children}\n </Button.Button>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\nimport { useContext } from \"@/header/Header\";\nimport { Text } from \"@/text\";\n\nexport interface TitleProps extends Omit<Text.WithIconProps, \"divided\" | \"level\"> {\n level?: Text.Level;\n}\n\n/**\n * Renders the title for the header component.\n *\n * @param props - The component props. The props for this component are identical\n * to the {@link Typography.TextWithIcon} component, except that the 'level', and\n * 'divider' props are inherited from the parent {@link Header} component.\n */\nexport const Title = ({\n className,\n level: propsLevel,\n ...props\n}: TitleProps): ReactElement => {\n const { level, divided } = useContext();\n return (\n <Text.WithIcon\n className={CSS(CSS.BE(\"header\", \"text\"), className)}\n level={propsLevel ?? level}\n divided={divided}\n size={1.5}\n {...props}\n />\n );\n};\n"],"names":["reactUseContext","jsx","Align.Space","toArray","Button.Icon","Text.LevelComponentSizes","Divider.Divider","Button.Button","Text.WithIcon"],"mappings":";;;;;;AAiCA,MAAM,UAAU,cAA4B;AAAA,EAC1C,SAAS;AAAA,EACT,OAAO;AACT,CAAC;AAEY,MAAA,aAAa,MAAoBA,aAAgB,OAAO;AAgB9D,MAAM,SAAS,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,GAAG;AACL,MACEC,kCAAA,IAAC,QAAQ,UAAR,EAAiB,OAAO,EAAE,OAAO,WAChC,UAAAA,kCAAA;AAAA,EAACC;AAAAA,EAAA;AAAA,IACC,IAAG;AAAA,IACH,WAAU;AAAA,IACV,SAAQ;AAAA,IACR,WAAW;AAAA,MACT,IAAI,EAAE,QAAQ;AAAA,MACd,IAAI,SAAS,QAAQ;AAAA,MACrB,WAAW,IAAI,GAAG,UAAU,SAAS;AAAA,MACrC;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEH;AAAA,EAAA;AACH,EACF,CAAA;AC1CK,MAAM,UAAU,CAAC,EAAE,WAAW,CAAA,QAAqC;AACxE,QAAM,EAAE,OAAO,QAAQ,IAAI,WAAW;AAEpC,SAAAD,kCAAA;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,MAAK;AAAA,MACL,OAAM;AAAA,MACN,WAAW,IAAI,GAAG,UAAU,SAAS;AAAA,MAEpC,UAAQC,EAAA,QAAQ,EAAE,IAAI,CAAC,QAAQ,MAC7BF,sCAAA,QAAA,EAAe,OAAO,GAAG,OAAc,SACrC,UAAA,OAAA,GADU,CAEb,CACD;AAAA,IAAA;AAAA,EAAA;AAGP;AASA,MAAM,SAAS,CAAC,EAAE,OAAO,OAAO,UAAU,cAAyC;AACjF,MAAI,UAAwB;AACxB,MAAA,CAAC,eAAe,QAAQ,GAAG;AAE7B,UAAM,QAAQ;AAEZ,cAAAA,kCAAA;AAAA,MAACG;AAAAA,MAAA;AAAA,QACC,SAAS,CAAC,MAAM;;AACd,YAAE,gBAAgB;AAClB,YAAE,eAAe;AACjB,sBAAM,YAAN,+BAAgB;AAAA,QAClB;AAAA,QAEA,MAAMC,oBAAyB,KAAK;AAAA,QACnC,GAAG;AAAA,MAAA;AAAA,MAFC;AAAA,IAAA;AAAA,EAKX;AACA,gDACG,UACE,EAAA,UAAA;AAAA,IAAW,WAAAJ,kCAAAA,IAACK,SAAA,EAAgB;AAAA,IAC5B;AAAA,EAAA,EAAA,GAFY,KAGf;AAEJ;ACxDO,MAAM,cAAc,CAAC;AAAA,EAC1B,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsC;AAC9B,QAAA,EAAE,UAAU;AAEhB,SAAAL,kCAAA;AAAA,IAACM;AAAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAMF,oBAAyB,KAAK;AAAA,MACpC;AAAA,MACA,WAAW,IAAI,IAAI,EAAE,qBAAqB,GAAG,SAAS;AAAA,MACtD,OAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;ACpBO,MAAM,QAAQ,CAAC;AAAA,EACpB;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,MAAgC;AAC9B,QAAM,EAAE,OAAO,QAAQ,IAAI,WAAW;AAEpC,SAAAJ,kCAAA;AAAA,IAACO;AAAAA,IAAA;AAAA,MACC,WAAW,IAAI,IAAI,GAAG,UAAU,MAAM,GAAG,SAAS;AAAA,MAClD,OAAO,cAAc;AAAA,MACrB;AAAA,MACA,MAAM;AAAA,MACL,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;;;;;;;;"}
1
+ {"version":3,"file":"external-B695Iunb.js","sources":["../src/header/Header.tsx","../src/header/Actions.tsx","../src/header/ButtonTitle.tsx","../src/header/Title.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n createContext,\n type ReactElement,\n type ReactNode,\n useContext as reactUseContext,\n} from \"react\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { type Text } from \"@/text\";\n\nimport \"@/header/Header.css\";\n\nexport interface HeaderProps extends Omit<Align.SpaceProps, \"children\" | \"el\"> {\n level?: Text.Level;\n divided?: boolean;\n children: ReactNode | [ReactNode, ReactNode];\n}\n\nexport interface ContextValue {\n divided: boolean;\n level: Text.Level;\n}\n\nconst Context = createContext<ContextValue>({\n divided: false,\n level: \"h1\",\n});\n\nexport const useContext = (): ContextValue => reactUseContext(Context);\n\n/**\n * The container for a module header.\n *\n * @param props - The component props. All unused props will be passed down to the\n * {@link Space} containing the header.\n * @param props.level - The font level for the header. See the {@link Typography.Text}\n * component for all possible levels. Default is \"h1.\"\n * @param props.icon - An optional icon to add add before the start of the header text.\n * @param props.actions - A list of actions to be rendered on the right side ofthe header.\n * If the action is a JSX element, it will be rendered directly, and if its of type\n * ButtonIconProps, a ButtonIconOnly will be rendered using the given props.\n * @param props.divided - If true, creates a divider between the start icon, header text,\n * and each action. Default is false.\n */\nexport const Header = ({\n children,\n className,\n level = \"h1\",\n divided = false,\n ...props\n}: HeaderProps): ReactElement => (\n <Context.Provider value={{ level, divided }}>\n <Align.Space\n el=\"header\"\n direction=\"x\"\n justify=\"spaceBetween\"\n className={CSS(\n CSS.B(\"header\"),\n CSS.bordered(\"bottom\"),\n divided && CSS.BM(\"header\", \"divided\"),\n className,\n )}\n {...props}\n >\n {children}\n </Align.Space>\n </Context.Provider>\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { Fragment, isValidElement, type ReactElement } from \"react\";\n\nimport { toArray } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { Divider } from \"@/divider\";\nimport { useContext } from \"@/header/Header\";\nimport { Text } from \"@/text\";\n\nexport type ActionSpec = Button.IconProps | ReactElement;\n\nexport interface ActionsProps {\n children?: ActionSpec | ActionSpec[];\n}\n\n/**\n * Custom actions to render on the right side of the header.\n *\n * @param children - The actions to render. If the action is of type\n * {@link ButtonIconProps}, a correectly sized {@link ButtonIconOnly} is rendered\n * using the given props. If the action is a JSX element, it is renderered directly.\n * It's a good idea to prefer the latter in almost all cases for simplicity.\n */\nexport const Actions = ({ children = [] }: ActionsProps): ReactElement => {\n const { level, divided } = useContext();\n return (\n <Align.Space\n direction=\"x\"\n size=\"small\"\n align=\"center\"\n className={CSS.BE(\"header\", \"actions\")}\n >\n {toArray(children).map((action, i) => (\n <Action key={i} index={i} level={level} divided={divided}>\n {action}\n </Action>\n ))}\n </Align.Space>\n );\n};\n\ninterface ActionProps {\n index: number;\n level: Text.Level;\n children: ReactElement | Button.IconProps;\n divided: boolean;\n}\n\nconst Action = ({ index, level, children, divided }: ActionProps): ReactElement => {\n let content: ReactElement = children as ReactElement;\n if (!isValidElement(children)) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const props = children as Button.IconProps;\n content = (\n <Button.Icon\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n props.onClick?.(e);\n }}\n key={index}\n size={Text.LevelComponentSizes[level]}\n {...props}\n />\n );\n }\n return (\n <Fragment key={index}>\n {divided && <Divider.Divider />}\n {content}\n </Fragment>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { useContext } from \"@/header/Header\";\nimport { Text } from \"@/text\";\n\nexport interface ButtonTitleProps\n extends Omit<Button.ButtonProps, \"variant\" | \"size\"> {}\n\n/**\n * Header.Title.Use renders a clickable header title.\n *\n * @param props - The comonent props. The props for this component are identical\n * to {@link Button}, except the variant is always 'outlined' and that the component size\n * is automatically inferred from the 'level' prop passsed to the parent {@link Header}\n * component.\n */\nexport const ButtonTitle = ({\n children = \"\",\n className,\n onClick,\n ...props\n}: ButtonTitleProps): ReactElement => {\n const { level } = useContext();\n return (\n <Button.Button\n variant=\"text\"\n size={Text.LevelComponentSizes[level]}\n onClick={onClick}\n className={CSS(CSS.B(\"header-button-title\"), className)}\n sharp\n {...props}\n >\n {children}\n </Button.Button>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\nimport { useContext } from \"@/header/Header\";\nimport { Text } from \"@/text\";\n\nexport interface TitleProps extends Omit<Text.WithIconProps, \"divided\" | \"level\"> {\n level?: Text.Level;\n}\n\n/**\n * Renders the title for the header component.\n *\n * @param props - The component props. The props for this component are identical\n * to the {@link Typography.TextWithIcon} component, except that the 'level', and\n * 'divider' props are inherited from the parent {@link Header} component.\n */\nexport const Title = ({\n className,\n level: propsLevel,\n ...props\n}: TitleProps): ReactElement => {\n const { level, divided } = useContext();\n return (\n <Text.WithIcon\n className={CSS(CSS.BE(\"header\", \"text\"), className)}\n level={propsLevel ?? level}\n divided={divided}\n size={1.5}\n {...props}\n />\n );\n};\n"],"names":["reactUseContext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AA;AAAA,QACC,SAAS,CAAC,MAAM;;AACd,YAAE,gBAAgB;AAClB,YAAE,eAAe;AACjB,sBAAM,YAAN,+BAAgB;AAAA,QAClB;AAAA,QAEA,MAAMC,oBAAyB,KAAK;AAAA,QACnC,GAAG;AAAA,MAAA;AAAA,MAFC;AAAA,IAAA;AAAA,EAKX;AACA,gDACG,UACE,EAAA,UAAA;AAAA,IAAW,WAAAJ,kCAAAA,IAACK,SAAA,EAAgB;AAAA,IAC5B;AAAA,EAAA,EAAA,GAFY,KAGf;AAEJ;ACxDO,MAAM,cAAc,CAAC;AAAA,EAC1B,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsC;AAC9B,QAAA,EAAE,UAAU;AAEhB,SAAAL,kCAAA;AAAA,IAACM;AAAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAMF,oBAAyB,KAAK;AAAA,MACpC;AAAA,MACA,WAAW,IAAI,IAAI,EAAE,qBAAqB,GAAG,SAAS;AAAA,MACtD,OAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;ACpBO,MAAM,QAAQ,CAAC;AAAA,EACpB;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,MAAgC;AAC9B,QAAM,EAAE,OAAO,QAAQ,IAAI,WAAW;AAEpC,SAAAJ,kCAAA;AAAA,IAACO;AAAAA,IAAA;AAAA,MACC,WAAW,IAAI,IAAI,GAAG,UAAU,MAAM,GAAG,SAAS;AAAA,MAClD,OAAO,cAAc;AAAA,MACrB;AAAA,MACA,MAAM;AAAA,MACL,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { P as Provider, S as Switch, t as toCSSVars, u as use, a as useContext, b as useProvider, c as useTypography } from "./Toggle-Blzh0A0b.js";
1
+ import { P as Provider, S as Switch, t as toCSSVars, u as use, a as useContext, b as useProvider, c as useTypography } from "./Toggle-DcOiWiHG.js";
2
2
  import { S as SYNNAX_DARK, a as SYNNAX_LIGHT, b as SYNNAX_THEMES, t as themeZ } from "./aggregator-Dl2jHye5.js";
3
3
  const external = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4
4
  __proto__: null,
@@ -20,4 +20,4 @@ const external = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
20
20
  export {
21
21
  external as e
22
22
  };
23
- //# sourceMappingURL=external-BMK0UUaW.js.map
23
+ //# sourceMappingURL=external-B6yW9yjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-B6yW9yjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- const Toggle = require("./Toggle-D1EoehhH.cjs");
2
+ const Toggle = require("./Toggle-CAW20E9V.cjs");
3
3
  const aggregator = require("./aggregator-Ca8xiVD2.cjs");
4
- const Keyboard = require("./Keyboard-CQoUT-k_.cjs");
4
+ const Keyboard = require("./Keyboard-CsgjS96C.cjs");
5
5
  const jsxRuntime = require("./jsx-runtime-B3vWrP5x.cjs");
6
6
  const React = require("react");
7
7
  const Center = require("./Center-5NJ61qfA.cjs");
8
8
  const css = require("./css-Pf9qxhQ4.cjs");
9
- const List = require("./List-DufMhjqX.cjs");
9
+ const List = require("./List-J5T88ynF.cjs");
10
10
  const DEFAULT_COLUMNS = [];
11
11
  const Core = ({
12
12
  data,
@@ -216,4 +216,4 @@ exports.DropdownButton = DropdownButton;
216
216
  exports.SelectLevel = SelectLevel;
217
217
  exports.defaultButton = defaultButton;
218
218
  exports.external = external;
219
- //# sourceMappingURL=external-Bh2-N-ic.cjs.map
219
+ //# sourceMappingURL=external-BGl-cQCe.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-Bh2-N-ic.cjs","sources":["../src/select/List.tsx","../src/select/Button.tsx","../src/text/SelectLevel.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type PropsWithChildren, type ReactElement } from \"react\";\n\nimport { type Key, type Keyed } from \"@synnaxlabs/x\";\n\nimport { CSS } from \"@/css\";\nimport { Dropdown } from \"@/dropdown\";\nimport { List as CoreList } from \"@/list\";\nimport { componentRenderProp } from \"@/util/renderProp\";\n\nexport interface SelectListProps<K extends Key = Key, E extends Keyed<K> = Keyed<K>>\n extends CoreList.SelectorProps<K, E>,\n Pick<Partial<CoreList.ColumnHeaderProps<K, E>>, \"columns\">,\n Omit<Dropdown.DialogProps, \"onChange\" | \"children\">,\n PropsWithChildren<{}> {\n data?: E[];\n emptyContent?: ReactElement;\n hideColumnHeader?: boolean;\n omit?: K[];\n}\n\nconst DEFAULT_COLUMNS: CoreList.ColumnSpec[] = [];\n\nexport const Core = <K extends Key, E extends Keyed<K>>({\n data,\n emptyContent,\n value,\n onChange,\n allowMultiple,\n allowNone,\n hideColumnHeader = false,\n children,\n columns = DEFAULT_COLUMNS,\n visible,\n replaceOnSingle,\n omit,\n ...props\n}: SelectListProps<K, E>): ReactElement => (\n <CoreList.List data={data} emptyContent={emptyContent} omit={omit}>\n <CoreList.Selector\n value={value}\n onChange={onChange}\n allowMultiple={allowMultiple}\n allowNone={allowNone}\n replaceOnSingle={replaceOnSingle}\n >\n <Dropdown.Dialog visible={visible} className={CSS.B(\"select\")} {...props}>\n {children}\n <CoreList.Hover disabled={!visible}>\n <CoreList.Column.Header hide={hideColumnHeader} columns={columns}>\n <CoreList.Core.Virtual itemHeight={CoreList.Column.itemHeight}>\n {componentRenderProp(CoreList.Column.Item)}\n </CoreList.Core.Virtual>\n </CoreList.Column.Header>\n </CoreList.Hover>\n </Dropdown.Dialog>\n </CoreList.Selector>\n </CoreList.List>\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n useCallback,\n type ReactElement,\n useState,\n useEffect,\n type ReactNode,\n} from \"react\";\n\nimport { Icon } from \"@synnaxlabs/media\";\nimport { type Keyed, type Key } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { Button as CoreButton } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { Dropdown } from \"@/dropdown\";\nimport { type Input } from \"@/input\";\nimport { type List as CoreList } from \"@/list\";\nimport {\n type UseSelectProps,\n useSelect,\n type UseSelectOnChangeExtra,\n} from \"@/list/useSelect\";\nimport { Core } from \"@/select/List\";\nimport { componentRenderProp, type RenderProp } from \"@/util/renderProp\";\n\nimport \"@/select/Button.css\";\n\nexport interface ButtonOptionProps<K extends Key = Key, E extends Keyed<K> = Keyed<K>>\n extends Pick<CoreButton.ButtonProps, \"onClick\"> {\n key: K;\n selected: boolean;\n entry: E;\n title: E[keyof E];\n}\n\nexport type ButtonProps<K extends Key = Key, E extends Keyed<K> = Keyed<K>> = Omit<\n UseSelectProps<K, E>,\n \"data\"\n> &\n Omit<Align.PackProps, \"children\" | \"onChange\"> & {\n data: E[];\n children?: RenderProp<ButtonOptionProps<K, E>>;\n entryRenderKey?: keyof E;\n };\n\nexport const Button = <K extends Key = Key, E extends Keyed<K> = Keyed<K>>({\n children = defaultSelectButtonOption,\n value,\n onChange,\n entryRenderKey = \"key\",\n allowNone = false,\n allowMultiple = false,\n data,\n replaceOnSingle,\n ...props\n}: ButtonProps<K, E>): JSX.Element => {\n const { onSelect } = useSelect<K, E>({\n allowMultiple,\n allowNone,\n replaceOnSingle,\n data,\n value,\n onChange,\n } as const as UseSelectProps<K, E>);\n\n return (\n <Align.Pack {...props}>\n {data.map((e) => {\n return children({\n key: e.key,\n onClick: () => onSelect(e.key),\n selected: e.key === value,\n entry: e,\n title: e[entryRenderKey],\n });\n })}\n </Align.Pack>\n );\n};\n\nconst defaultSelectButtonOption = <K extends Key = Key, E extends Keyed<K> = Keyed<K>>({\n onClick,\n selected,\n title,\n}: ButtonOptionProps<K, E>): JSX.Element => (\n <CoreButton.Button onClick={onClick} variant={selected ? \"filled\" : \"outlined\"}>\n {title as ReactNode}\n </CoreButton.Button>\n);\n\nexport interface DropdownButtonButtonProps<K extends Key, E extends Keyed<K>>\n extends CoreButton.ButtonProps {\n selected: E | null;\n renderKey: keyof E;\n toggle: () => void;\n visible: boolean;\n}\n\nexport interface DropdownButtonProps<K extends Key, E extends Keyed<K>>\n extends Omit<Dropdown.DialogProps, \"onChange\" | \"visible\" | \"children\" | \"close\">,\n Input.Control<K>,\n Omit<CoreList.ListProps<K, E>, \"children\">,\n Pick<CoreButton.ButtonProps, \"disabled\"> {\n columns?: Array<CoreList.ColumnSpec<K, E>>;\n children?: RenderProp<DropdownButtonButtonProps<K, E>>;\n entryRenderKey?: keyof E;\n allowNone?: boolean;\n hideColumnHeader?: boolean;\n disabled?: boolean;\n omit?: K[];\n}\n\nexport const BaseButton = ({\n selected,\n renderKey,\n toggle,\n visible,\n children,\n ...props\n}: DropdownButtonButtonProps<any, any>): ReactElement => (\n <CoreButton.Button\n className={CSS.B(\"select-button\")}\n onClick={toggle}\n variant=\"outlined\"\n endIcon={<Icon.Caret.Left className={CSS.BE(\"select-button\", \"indicator\")} />}\n {...props}\n >\n {children ?? selected?.[renderKey]}\n </CoreButton.Button>\n);\n\nexport const defaultButton: RenderProp<DropdownButtonButtonProps<any, any>> =\n componentRenderProp(BaseButton);\n\nexport const DropdownButton = <K extends Key = Key, E extends Keyed<K> = Keyed<K>>({\n data,\n value,\n columns = [],\n children = defaultButton,\n entryRenderKey = \"key\",\n allowNone = false,\n onChange,\n disabled,\n hideColumnHeader = true,\n ...props\n}: DropdownButtonProps<K, E>): ReactElement => {\n const { close, visible, toggle } = Dropdown.use();\n const [selected, setSelected] = useState<E | null>(\n data?.find((e) => e.key === value) ?? null,\n );\n\n useEffect(() => {\n setSelected(data?.find((e) => e.key === value) ?? null);\n }, [data, value]);\n\n const handleChange: UseSelectProps<K, E>[\"onChange\"] = useCallback(\n (next: K, e: UseSelectOnChangeExtra<K, E>): void => {\n close();\n if (next == null) {\n setSelected(null);\n return onChange(value);\n }\n setSelected(e.entries[0]);\n onChange(next);\n },\n [onChange, value, close, setSelected],\n );\n\n return (\n <Core<K, E>\n {...props}\n close={close}\n data={data}\n visible={visible}\n value={[value]}\n onChange={handleChange}\n allowMultiple={false}\n allowNone={allowNone}\n columns={columns}\n hideColumnHeader={hideColumnHeader}\n >\n {children({\n selected,\n renderKey: entryRenderKey,\n toggle,\n visible,\n disabled,\n })}\n </Core>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { Button as CoreButton } from \"@/button\";\nimport { Button, type ButtonOptionProps, type ButtonProps } from \"@/select/Button\";\nimport { type text } from \"@/text/core\";\n\ninterface Entry {\n key: text.Level;\n label: string;\n}\n\nexport interface SelectLevelProps\n extends Omit<ButtonProps<text.Level, Entry>, \"data\" | \"entryRenderKey\"> {}\n\nconst DATA: Entry[] = [\n {\n key: \"h2\",\n label: \"XL\",\n },\n {\n key: \"h3\",\n label: \"L\",\n },\n {\n key: \"h4\",\n label: \"M\",\n },\n {\n key: \"p\",\n label: \"S\",\n },\n {\n key: \"small\",\n label: \"XS\",\n },\n];\n\nconst defaultSelectDirectionButton = ({\n key,\n entry,\n onClick,\n selected,\n}: ButtonOptionProps<text.Level, Entry>): ReactElement => {\n return (\n <CoreButton.Button\n key={key}\n variant={selected ? \"filled\" : \"outlined\"}\n onClick={onClick}\n >\n {entry.label}\n </CoreButton.Button>\n );\n};\n\nexport const SelectLevel = ({\n children = defaultSelectDirectionButton,\n ...props\n}: SelectLevelProps): ReactElement => {\n return (\n <Button {...props} data={DATA}>\n {children}\n </Button>\n );\n};\n"],"names":["CoreList.List","jsx","CoreList.Selector","jsxs","Dropdown.Dialog","CSS","CoreList.Hover","CoreList.Column","CoreList.Core","componentRenderProp","useSelect","Align.Pack","CoreButton.Button","Icon","Dropdown.use","useState","useEffect","useCallback"],"mappings":";;;;;;;;;AA6BA,MAAM,kBAAyC,CAAA;AAExC,MAAM,OAAO,CAAoC;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,uDACGA,KAAAA,MAAA,EAAc,MAAY,cAA4B,MACrD,UAAAC,2BAAA,kBAAA;AAAA,EAACC,OAAS;AAAA,EAAT;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,UAAAC,2BAAA,kBAAA,KAACC,eAAA,EAAgB,SAAkB,WAAWC,QAAI,EAAE,QAAQ,GAAI,GAAG,OAChE,UAAA;AAAA,MAAA;AAAA,MACAJ,2BAAAA,kBAAAA,IAAAK,OAAAA,OAAA,EAAe,UAAU,CAAC,SACzB,UAAAL,iDAACM,OAAAA,OAAgB,QAAhB,EAAuB,MAAM,kBAAkB,SAC9C,UAACN,2BAAA,kBAAA,IAAAO,OAAc,KAAA,SAAd,EAAsB,YAAYD,OAAS,OAAO,YAChD,UAAAE,OAAAA,oBAAoBF,OAAAA,OAAgB,IAAI,EAAA,CAC3C,GACF,EACF,CAAA;AAAA,IAAA,GACF;AAAA,EAAA;AACF,EACF,CAAA;ACXK,MAAM,SAAS,CAAqD;AAAA,EACzE,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,YAAY;AAAA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KAAK;AAAA,IACL,OAAO;AAAA,EACT;AACF;AAEA,MAAM,+BAA+B,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0D;AAEtD,SAAAA,2BAAA,kBAAA;AAAA,IAACW,OAAW;AAAA,IAAX;AAAA,MAEC,SAAS,WAAW,WAAW;AAAA,MAC/B;AAAA,MAEC,UAAM,MAAA;AAAA,IAAA;AAAA,IAJF;AAAA,EAAA;AAOX;AAEO,MAAM,cAAc,CAAC;AAAA,EAC1B,WAAW;AAAA,EACX,GAAG;AACL,MAAsC;AACpC,0DACG,QAAQ,EAAA,GAAG,OAAO,MAAM,MACtB,SACH,CAAA;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"external-BGl-cQCe.cjs","sources":["../src/select/List.tsx","../src/select/Button.tsx","../src/text/SelectLevel.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type PropsWithChildren, type ReactElement } from \"react\";\n\nimport { type Key, type Keyed } from \"@synnaxlabs/x\";\n\nimport { CSS } from \"@/css\";\nimport { Dropdown } from \"@/dropdown\";\nimport { List as CoreList } from \"@/list\";\nimport { componentRenderProp } from \"@/util/renderProp\";\n\nexport interface SelectListProps<K extends Key = Key, E extends Keyed<K> = Keyed<K>>\n extends CoreList.SelectorProps<K, E>,\n Pick<Partial<CoreList.ColumnHeaderProps<K, E>>, \"columns\">,\n Omit<Dropdown.DialogProps, \"onChange\" | \"children\">,\n PropsWithChildren<{}> {\n data?: E[];\n emptyContent?: ReactElement;\n hideColumnHeader?: boolean;\n omit?: K[];\n}\n\nconst DEFAULT_COLUMNS: CoreList.ColumnSpec[] = [];\n\nexport const Core = <K extends Key, E extends Keyed<K>>({\n data,\n emptyContent,\n value,\n onChange,\n allowMultiple,\n allowNone,\n hideColumnHeader = false,\n children,\n columns = DEFAULT_COLUMNS,\n visible,\n replaceOnSingle,\n omit,\n ...props\n}: SelectListProps<K, E>): ReactElement => (\n <CoreList.List data={data} emptyContent={emptyContent} omit={omit}>\n <CoreList.Selector\n value={value}\n onChange={onChange}\n allowMultiple={allowMultiple}\n allowNone={allowNone}\n replaceOnSingle={replaceOnSingle}\n >\n <Dropdown.Dialog visible={visible} className={CSS.B(\"select\")} {...props}>\n {children}\n <CoreList.Hover disabled={!visible}>\n <CoreList.Column.Header hide={hideColumnHeader} columns={columns}>\n <CoreList.Core.Virtual itemHeight={CoreList.Column.itemHeight}>\n {componentRenderProp(CoreList.Column.Item)}\n </CoreList.Core.Virtual>\n </CoreList.Column.Header>\n </CoreList.Hover>\n </Dropdown.Dialog>\n </CoreList.Selector>\n </CoreList.List>\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n useCallback,\n type ReactElement,\n useState,\n useEffect,\n type ReactNode,\n} from \"react\";\n\nimport { Icon } from \"@synnaxlabs/media\";\nimport { type Keyed, type Key } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { Button as CoreButton } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { Dropdown } from \"@/dropdown\";\nimport { type Input } from \"@/input\";\nimport { type List as CoreList } from \"@/list\";\nimport {\n type UseSelectProps,\n useSelect,\n type UseSelectOnChangeExtra,\n} from \"@/list/useSelect\";\nimport { Core } from \"@/select/List\";\nimport { componentRenderProp, type RenderProp } from \"@/util/renderProp\";\n\nimport \"@/select/Button.css\";\n\nexport interface ButtonOptionProps<K extends Key = Key, E extends Keyed<K> = Keyed<K>>\n extends Pick<CoreButton.ButtonProps, \"onClick\"> {\n key: K;\n selected: boolean;\n entry: E;\n title: E[keyof E];\n}\n\nexport type ButtonProps<K extends Key = Key, E extends Keyed<K> = Keyed<K>> = Omit<\n UseSelectProps<K, E>,\n \"data\"\n> &\n Omit<Align.PackProps, \"children\" | \"onChange\"> & {\n data: E[];\n children?: RenderProp<ButtonOptionProps<K, E>>;\n entryRenderKey?: keyof E;\n };\n\nexport const Button = <K extends Key = Key, E extends Keyed<K> = Keyed<K>>({\n children = defaultSelectButtonOption,\n value,\n onChange,\n entryRenderKey = \"key\",\n allowNone = false,\n allowMultiple = false,\n data,\n replaceOnSingle,\n ...props\n}: ButtonProps<K, E>): JSX.Element => {\n const { onSelect } = useSelect<K, E>({\n allowMultiple,\n allowNone,\n replaceOnSingle,\n data,\n value,\n onChange,\n } as const as UseSelectProps<K, E>);\n\n return (\n <Align.Pack {...props}>\n {data.map((e) => {\n return children({\n key: e.key,\n onClick: () => onSelect(e.key),\n selected: e.key === value,\n entry: e,\n title: e[entryRenderKey],\n });\n })}\n </Align.Pack>\n );\n};\n\nconst defaultSelectButtonOption = <K extends Key = Key, E extends Keyed<K> = Keyed<K>>({\n onClick,\n selected,\n title,\n}: ButtonOptionProps<K, E>): JSX.Element => (\n <CoreButton.Button onClick={onClick} variant={selected ? \"filled\" : \"outlined\"}>\n {title as ReactNode}\n </CoreButton.Button>\n);\n\nexport interface DropdownButtonButtonProps<K extends Key, E extends Keyed<K>>\n extends CoreButton.ButtonProps {\n selected: E | null;\n renderKey: keyof E;\n toggle: () => void;\n visible: boolean;\n}\n\nexport interface DropdownButtonProps<K extends Key, E extends Keyed<K>>\n extends Omit<Dropdown.DialogProps, \"onChange\" | \"visible\" | \"children\" | \"close\">,\n Input.Control<K>,\n Omit<CoreList.ListProps<K, E>, \"children\">,\n Pick<CoreButton.ButtonProps, \"disabled\"> {\n columns?: Array<CoreList.ColumnSpec<K, E>>;\n children?: RenderProp<DropdownButtonButtonProps<K, E>>;\n entryRenderKey?: keyof E;\n allowNone?: boolean;\n hideColumnHeader?: boolean;\n disabled?: boolean;\n omit?: K[];\n}\n\nexport const BaseButton = ({\n selected,\n renderKey,\n toggle,\n visible,\n children,\n ...props\n}: DropdownButtonButtonProps<any, any>): ReactElement => (\n <CoreButton.Button\n className={CSS.B(\"select-button\")}\n onClick={toggle}\n variant=\"outlined\"\n endIcon={<Icon.Caret.Left className={CSS.BE(\"select-button\", \"indicator\")} />}\n {...props}\n >\n {children ?? selected?.[renderKey]}\n </CoreButton.Button>\n);\n\nexport const defaultButton: RenderProp<DropdownButtonButtonProps<any, any>> =\n componentRenderProp(BaseButton);\n\nexport const DropdownButton = <K extends Key = Key, E extends Keyed<K> = Keyed<K>>({\n data,\n value,\n columns = [],\n children = defaultButton,\n entryRenderKey = \"key\",\n allowNone = false,\n onChange,\n disabled,\n hideColumnHeader = true,\n ...props\n}: DropdownButtonProps<K, E>): ReactElement => {\n const { close, visible, toggle } = Dropdown.use();\n const [selected, setSelected] = useState<E | null>(\n data?.find((e) => e.key === value) ?? null,\n );\n\n useEffect(() => {\n setSelected(data?.find((e) => e.key === value) ?? null);\n }, [data, value]);\n\n const handleChange: UseSelectProps<K, E>[\"onChange\"] = useCallback(\n (next: K, e: UseSelectOnChangeExtra<K, E>): void => {\n close();\n if (next == null) {\n setSelected(null);\n return onChange(value);\n }\n setSelected(e.entries[0]);\n onChange(next);\n },\n [onChange, value, close, setSelected],\n );\n\n return (\n <Core<K, E>\n {...props}\n close={close}\n data={data}\n visible={visible}\n value={[value]}\n onChange={handleChange}\n allowMultiple={false}\n allowNone={allowNone}\n columns={columns}\n hideColumnHeader={hideColumnHeader}\n >\n {children({\n selected,\n renderKey: entryRenderKey,\n toggle,\n visible,\n disabled,\n })}\n </Core>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { Button as CoreButton } from \"@/button\";\nimport { Button, type ButtonOptionProps, type ButtonProps } from \"@/select/Button\";\nimport { type text } from \"@/text/core\";\n\ninterface Entry {\n key: text.Level;\n label: string;\n}\n\nexport interface SelectLevelProps\n extends Omit<ButtonProps<text.Level, Entry>, \"data\" | \"entryRenderKey\"> {}\n\nconst DATA: Entry[] = [\n {\n key: \"h2\",\n label: \"XL\",\n },\n {\n key: \"h3\",\n label: \"L\",\n },\n {\n key: \"h4\",\n label: \"M\",\n },\n {\n key: \"p\",\n label: \"S\",\n },\n {\n key: \"small\",\n label: \"XS\",\n },\n];\n\nconst defaultSelectDirectionButton = ({\n key,\n entry,\n onClick,\n selected,\n}: ButtonOptionProps<text.Level, Entry>): ReactElement => {\n return (\n <CoreButton.Button\n key={key}\n variant={selected ? \"filled\" : \"outlined\"}\n onClick={onClick}\n >\n {entry.label}\n </CoreButton.Button>\n );\n};\n\nexport const SelectLevel = ({\n children = defaultSelectDirectionButton,\n ...props\n}: SelectLevelProps): ReactElement => {\n return (\n <Button {...props} data={DATA}>\n {children}\n </Button>\n );\n};\n"],"names":["CoreList.List","jsx","CoreList.Selector","jsxs","Dropdown.Dialog","CSS","CoreList.Hover","CoreList.Column","CoreList.Core","componentRenderProp","useSelect","Align.Pack","CoreButton.Button","Icon","Dropdown.use","useState","useEffect","useCallback"],"mappings":";;;;;;;;;AA6BA,MAAM,kBAAyC,CAAA;AAExC,MAAM,OAAO,CAAoC;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,uDACGA,KAAAA,MAAA,EAAc,MAAY,cAA4B,MACrD,UAAAC,2BAAA,kBAAA;AAAA,EAACC,OAAS;AAAA,EAAT;AAAA,IACC;AAAA,IACA;AAAA,IACA;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SAAAhB,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,CAAC,KAAK;AAAA,MACb,UAAU;AAAA,MACV,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MAEC,UAAS,SAAA;AAAA,QACR;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,EAAA;AAGP;AChLA,MAAM,OAAgB;AAAA,EACpB;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AACF;AAEA,MAAM,+BAA+B,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0D;AAEtD,SAAAA,2BAAA,kBAAA;AAAA,IAACW,OAAW;AAAA,IAAX;AAAA,MAEC,SAAS,WAAW,WAAW;AAAA,MAC/B;AAAA,MAEC,UAAM,MAAA;AAAA,IAAA;AAAA,IAJF;AAAA,EAAA;AAOX;AAEO,MAAM,cAAc,CAAC;AAAA,EAC1B,WAAW;AAAA,EACX,GAAG;AACL,MAAsC;AACpC,0DACG,QAAQ,EAAA,GAAG,OAAO,MAAM,MACtB,SACH,CAAA;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { j as jsxRuntimeExports } from "./jsx-runtime-mMz73N64.js";
2
- import { B as Button, I as Icon, C as CONTEXT_SELECTED, q as CONTEXT_TARGET, r as ContextMenu, s as useContextMenu } from "./Toggle-Blzh0A0b.js";
3
- import { L as Link } from "./Link-3r9yGooG.js";
2
+ import { B as Button, I as Icon, C as CONTEXT_SELECTED, q as CONTEXT_TARGET, r as ContextMenu, s as useContextMenu } from "./Toggle-DcOiWiHG.js";
3
+ import { L as Link } from "./Link-BaPpY2rf.js";
4
4
  import { C as CSS } from "./css-DoalWJF6.js";
5
5
  import { createContext, useContext } from "react";
6
6
  const MenuContext = createContext({
@@ -75,4 +75,4 @@ const external = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
75
75
  export {
76
76
  external as e
77
77
  };
78
- //# sourceMappingURL=external-D9_xWvtb.js.map
78
+ //# sourceMappingURL=external-Bn7V_LTL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-D9_xWvtb.js","sources":["../src/menu/Menu.tsx","../src/menu/Item.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n createContext,\n type PropsWithChildren,\n type ReactElement,\n useContext,\n} from \"react\";\n\nimport { type Input } from \"@/input\";\nimport { type Text } from \"@/text\";\nimport { type ComponentSize } from \"@/util/component\";\n\ninterface MenuContextValue {\n onClick: (key: string) => void;\n selected: string;\n level?: Text.Level;\n iconSpacing?: ComponentSize;\n}\n\nexport const MenuContext = createContext<MenuContextValue>({\n onClick: () => {},\n selected: \"\",\n});\n\nexport interface MenuProps\n extends Partial<Input.Control<string>>,\n PropsWithChildren,\n Pick<MenuContextValue, \"level\" | \"iconSpacing\"> {}\n\nexport const useMenuContext = (): MenuContextValue => useContext(MenuContext);\n\n/**\n * Menu is a modular component that allows you to create a menu with a list of items.\n * It satisfies the InputControl string interface, so it's selected value can be\n * controlled.\n *\n * @param props - Props for the component. All unlisted props will be spread to the\n * underlying Space component acting as the root element.\n * @param props.onChange - Callback executed when the selected item changes.\n * @param props.value - The selected item.\n */\nexport const Menu = ({\n children,\n onChange,\n level,\n iconSpacing,\n value = \"\",\n}: MenuProps): ReactElement => {\n const handleClick: MenuProps[\"onChange\"] = (key) => onChange?.(key);\n return (\n <MenuContext.Provider\n value={{ onClick: handleClick, selected: value, level, iconSpacing }}\n >\n {children}\n </MenuContext.Provider>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type FunctionComponent, type ReactElement } from \"react\";\n\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { useMenuContext } from \"@/menu/Menu\";\n\nimport \"@/menu/Item.css\";\n\nconst menuItemFactory =\n <E extends Pick<Button.ButtonProps, \"className\" | \"onClick\" | \"size\">>(\n Base: FunctionComponent<E>,\n defaultProps?: Partial<E>,\n ): FunctionComponent<E & { itemKey: string }> =>\n // eslint-disable-next-line react/display-name\n (props): ReactElement => {\n const { itemKey, className, onClick, size, ...rest } = {\n ...defaultProps,\n ...props,\n };\n\n const { onClick: ctxOnClick, selected, level, iconSpacing } = useMenuContext();\n\n const handleClick: Button.ButtonProps[\"onClick\"] = (e) => {\n ctxOnClick(itemKey);\n onClick?.(e);\n };\n const _selected = selected === itemKey;\n return (\n // @ts-expect-error\n <Base\n level={level}\n {...rest}\n onClick={handleClick}\n variant=\"text\"\n className={CSS(CSS.B(\"menu-item\"), CSS.selected(_selected), className)}\n size={size ?? iconSpacing}\n />\n );\n };\n\nexport interface ItemProps extends Button.ButtonProps {\n itemKey: string;\n}\nexport const CoreItem = menuItemFactory(Button.Button, { noWrap: true });\n\nexport interface ItemIconProps extends Button.IconProps {\n itemKey: string;\n}\nconst ItemIcon = menuItemFactory(Button.Icon);\n\nconst ItemLink = menuItemFactory(Button.Link, { noWrap: true });\nexport interface MenuItemLinkProps extends Button.LinkProps {\n itemKey: string;\n}\n\ntype CoreItemType = typeof CoreItem;\n\nexport interface ItemType extends CoreItemType {\n Icon: typeof ItemIcon;\n Link: typeof ItemLink;\n}\n\n/**\n * Menu.Item renders a menu item.\n *\n * @param props - Props for the component. Identical props to those of Use except\n * for the ones listed below.\n * @param props.itemKey - The key of the item. This is used to identify the item and\n * is passed to the onChange callback of the Menu.\n */\nexport const Item = CoreItem as ItemType;\nItem.Icon = ItemIcon;\nItem.Link = ItemLink;\n"],"names":["jsx","Button.Button","Button.Icon","Button.Link"],"mappings":";;;;;AA2BO,MAAM,cAAc,cAAgC;AAAA,EACzD,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,UAAU;AACZ,CAAC;AAOY,MAAA,iBAAiB,MAAwB,WAAW,WAAW;AAYrE,MAAM,OAAO,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,MAA+B;AAC7B,QAAM,cAAqC,CAAC,QAAQ,qCAAW;AAE7D,SAAAA,kCAAA;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACC,OAAO,EAAE,SAAS,aAAa,UAAU,OAAO,OAAO,YAAY;AAAA,MAElE;AAAA,IAAA;AAAA,EAAA;AAGP;AC/CA,MAAM,kBACJ,CACE,MACA;AAAA;AAAA,EAGF,CAAC,UAAwB;AACvB,UAAM,EAAE,SAAS,WAAW,SAAS,MAAM,GAAG,SAAS;AAAA,MACrD,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAGL,UAAM,EAAE,SAAS,YAAY,UAAU,OAAO,YAAA,IAAgB;AAExD,UAAA,cAA6C,CAAC,MAAM;AACxD,iBAAW,OAAO;AAClB,yCAAU;AAAA,IAAC;AAEb,UAAM,YAAY,aAAa;AAC/B;AAAA;AAAA,MAEEA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACC,GAAG;AAAA,UACJ,SAAS;AAAA,UACT,SAAQ;AAAA,UACR,WAAW,IAAI,IAAI,EAAE,WAAW,GAAG,IAAI,SAAS,SAAS,GAAG,SAAS;AAAA,UACrE,MAAM,QAAQ;AAAA,QAAA;AAAA,MAChB;AAAA;AAAA,EAEJ;AAAA;AAKK,MAAM,WAAW,gBAAgBC,QAAe,EAAE,QAAQ,KAAM,CAAA;AAKvE,MAAM,WAAW,gBAAgBC,IAAW;AAE5C,MAAM,WAAW,gBAAgBC,MAAa,EAAE,QAAQ,KAAM,CAAA;AAoBvD,MAAM,OAAO;AACpB,KAAK,OAAO;AACZ,KAAK,OAAO;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"external-Bn7V_LTL.js","sources":["../src/menu/Menu.tsx","../src/menu/Item.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n createContext,\n type PropsWithChildren,\n type ReactElement,\n useContext,\n} from \"react\";\n\nimport { type Input } from \"@/input\";\nimport { type Text } from \"@/text\";\nimport { type ComponentSize } from \"@/util/component\";\n\ninterface MenuContextValue {\n onClick: (key: string) => void;\n selected: string;\n level?: Text.Level;\n iconSpacing?: ComponentSize;\n}\n\nexport const MenuContext = createContext<MenuContextValue>({\n onClick: () => {},\n selected: \"\",\n});\n\nexport interface MenuProps\n extends Partial<Input.Control<string>>,\n PropsWithChildren,\n Pick<MenuContextValue, \"level\" | \"iconSpacing\"> {}\n\nexport const useMenuContext = (): MenuContextValue => useContext(MenuContext);\n\n/**\n * Menu is a modular component that allows you to create a menu with a list of items.\n * It satisfies the InputControl string interface, so it's selected value can be\n * controlled.\n *\n * @param props - Props for the component. All unlisted props will be spread to the\n * underlying Space component acting as the root element.\n * @param props.onChange - Callback executed when the selected item changes.\n * @param props.value - The selected item.\n */\nexport const Menu = ({\n children,\n onChange,\n level,\n iconSpacing,\n value = \"\",\n}: MenuProps): ReactElement => {\n const handleClick: MenuProps[\"onChange\"] = (key) => onChange?.(key);\n return (\n <MenuContext.Provider\n value={{ onClick: handleClick, selected: value, level, iconSpacing }}\n >\n {children}\n </MenuContext.Provider>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type FunctionComponent, type ReactElement } from \"react\";\n\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { useMenuContext } from \"@/menu/Menu\";\n\nimport \"@/menu/Item.css\";\n\nconst menuItemFactory =\n <E extends Pick<Button.ButtonProps, \"className\" | \"onClick\" | \"size\">>(\n Base: FunctionComponent<E>,\n defaultProps?: Partial<E>,\n ): FunctionComponent<E & { itemKey: string }> =>\n // eslint-disable-next-line react/display-name\n (props): ReactElement => {\n const { itemKey, className, onClick, size, ...rest } = {\n ...defaultProps,\n ...props,\n };\n\n const { onClick: ctxOnClick, selected, level, iconSpacing } = useMenuContext();\n\n const handleClick: Button.ButtonProps[\"onClick\"] = (e) => {\n ctxOnClick(itemKey);\n onClick?.(e);\n };\n const _selected = selected === itemKey;\n return (\n // @ts-expect-error\n <Base\n level={level}\n {...rest}\n onClick={handleClick}\n variant=\"text\"\n className={CSS(CSS.B(\"menu-item\"), CSS.selected(_selected), className)}\n size={size ?? iconSpacing}\n />\n );\n };\n\nexport interface ItemProps extends Button.ButtonProps {\n itemKey: string;\n}\nexport const CoreItem = menuItemFactory(Button.Button, { noWrap: true });\n\nexport interface ItemIconProps extends Button.IconProps {\n itemKey: string;\n}\nconst ItemIcon = menuItemFactory(Button.Icon);\n\nconst ItemLink = menuItemFactory(Button.Link, { noWrap: true });\nexport interface MenuItemLinkProps extends Button.LinkProps {\n itemKey: string;\n}\n\ntype CoreItemType = typeof CoreItem;\n\nexport interface ItemType extends CoreItemType {\n Icon: typeof ItemIcon;\n Link: typeof ItemLink;\n}\n\n/**\n * Menu.Item renders a menu item.\n *\n * @param props - Props for the component. Identical props to those of Use except\n * for the ones listed below.\n * @param props.itemKey - The key of the item. This is used to identify the item and\n * is passed to the onChange callback of the Menu.\n */\nexport const Item = CoreItem as ItemType;\nItem.Icon = ItemIcon;\nItem.Link = ItemLink;\n"],"names":["jsx","Button.Button","Button.Icon","Button.Link"],"mappings":";;;;;AA2BO,MAAM,cAAc,cAAgC;AAAA,EACzD,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,UAAU;AACZ,CAAC;AAOY,MAAA,iBAAiB,MAAwB,WAAW,WAAW;AAYrE,MAAM,OAAO,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,MAA+B;AAC7B,QAAM,cAAqC,CAAC,QAAQ,qCAAW;AAE7D,SAAAA,kCAAA;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACC,OAAO,EAAE,SAAS,aAAa,UAAU,OAAO,OAAO,YAAY;AAAA,MAElE;AAAA,IAAA;AAAA,EAAA;AAGP;AC/CA,MAAM,kBACJ,CACE,MACA;AAAA;AAAA,EAGF,CAAC,UAAwB;AACvB,UAAM,EAAE,SAAS,WAAW,SAAS,MAAM,GAAG,SAAS;AAAA,MACrD,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAGL,UAAM,EAAE,SAAS,YAAY,UAAU,OAAO,YAAA,IAAgB;AAExD,UAAA,cAA6C,CAAC,MAAM;AACxD,iBAAW,OAAO;AAClB,yCAAU;AAAA,IAAC;AAEb,UAAM,YAAY,aAAa;AAC/B;AAAA;AAAA,MAEEA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACC,GAAG;AAAA,UACJ,SAAS;AAAA,UACT,SAAQ;AAAA,UACR,WAAW,IAAI,IAAI,EAAE,WAAW,GAAG,IAAI,SAAS,SAAS,GAAG,SAAS;AAAA,UACrE,MAAM,QAAQ;AAAA,QAAA;AAAA,MAChB;AAAA;AAAA,EAEJ;AAAA;AAKK,MAAM,WAAW,gBAAgBC,QAAe,EAAE,QAAQ,KAAM,CAAA;AAKvE,MAAM,WAAW,gBAAgBC,IAAW;AAE5C,MAAM,WAAW,gBAAgBC,MAAa,EAAE,QAAQ,KAAM,CAAA;AAoBvD,MAAM,OAAO;AACpB,KAAK,OAAO;AACZ,KAAK,OAAO;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const Toggle = require("./Toggle-D1EoehhH.cjs");
2
+ const Toggle = require("./Toggle-CAW20E9V.cjs");
3
3
  const aggregator = require("./aggregator-Ca8xiVD2.cjs");
4
4
  const external = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5
5
  __proto__: null,
@@ -19,4 +19,4 @@ const external = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
19
19
  useTypography: Toggle.useTypography
20
20
  }, Symbol.toStringTag, { value: "Module" }));
21
21
  exports.external = external;
22
- //# sourceMappingURL=external-ueyo2Jw7.cjs.map
22
+ //# sourceMappingURL=external-BoNCimxR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-BoNCimxR.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { e as Text, ah as Text$1, ai as Date, aj as DragButton, ak as Numeric, al as Switch, am as TextArea, an as Time, ao as combineDateAndTimeValue, ap as useDate, aq as useTime } from "./Toggle-Blzh0A0b.js";
1
+ import { e as Text, ah as Text$1, ai as Date, aj as DragButton, ak as Numeric, al as Switch, am as TextArea, an as Time, ao as combineDateAndTimeValue, ap as useDate, aq as useTime } from "./Toggle-DcOiWiHG.js";
2
2
  import { j as jsxRuntimeExports } from "./jsx-runtime-mMz73N64.js";
3
3
  import { C as CSS, d as f } from "./css-DoalWJF6.js";
4
4
  import { w, y } from "./aggregator-Dl2jHye5.js";
@@ -154,4 +154,4 @@ export {
154
154
  Item as I,
155
155
  external as e
156
156
  };
157
- //# sourceMappingURL=external-DJYiyF-g.js.map
157
+ //# sourceMappingURL=external-Brr6przd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-DJYiyF-g.js","sources":["../src/input/HelpText.tsx","../src/input/Label.tsx","../src/input/Item.tsx","../src/input/DateTime.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\nimport { type Status } from \"@/status\";\nimport { Text } from \"@/text\";\n\nimport \"@/input/HelpText.css\";\n\n/** Props for the {@link HelpText} component. */\nexport interface HelpTextProps extends Omit<Text.TextProps<\"small\">, \"level\" | \"ref\"> {\n variant?: Status.Variant;\n}\n\n/**\n * Help text for an input component. We generally recommend using Input.Item with a\n * 'helpText' prop instead of this component. This component is useful for low-level\n * control over the help text element.\n *\n * @param props - Props for the help text component. Unlisted props are passed to the\n * underlying text element.\n * @param props.variant - The variant of the help text.\n * \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\" | \"disabled\n * @default \"info\"\n */\nexport const HelpText = ({\n className,\n variant = \"error\",\n ...props\n}: HelpTextProps): ReactElement => (\n <Text.Text<\"small\">\n className={CSS(\n CSS.B(\"input-help-text\"),\n CSS.BM(\"input-help-text\", variant),\n className,\n )}\n level=\"small\"\n {...props}\n />\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type DetailedHTMLProps, type HTMLAttributes, type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\n\nimport \"@/input/Label.css\";\n\n/** Props for the {@link Label} component. */\nexport interface LabelProps\n extends DetailedHTMLProps<HTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {\n required?: boolean;\n}\n\n/**\n * A thin, styled wrapper for an input label. We generally recommend using Input.Item\n * with a 'label' prop instead of this component. This component is useful for\n * low-level control over the label element.\n *\n * @param props - Props for the label component. Unlisted props are passed to the\n * underlying label element.\n * @param props.required - Indicate whether the label is associated with a required\n * input.\n */\nexport const Label = ({\n className,\n required = false,\n children,\n ...props\n}: LabelProps): ReactElement => {\n return (\n <label className={CSS(CSS.B(\"input-label\"), className)} {...props}>\n {children} {required && <span className={CSS.B(\"required-indicator\")}>*</span>}\n </label>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { direction } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { HelpText } from \"@/input/HelpText\";\nimport { Label } from \"@/input/Label\";\n\nimport \"@/input/Item.css\";\nimport { status } from \"@/status/aether\";\n\nexport interface ItemProps extends Align.SpaceProps {\n label?: string;\n required?: boolean;\n showLabel?: boolean;\n helpText?: string;\n padHelpText?: boolean;\n helpTextVariant?: status.Variant;\n showHelpText?: boolean;\n}\n\nconst maybeDefaultAlignment = (\n align?: Align.Alignment,\n dir: direction.Crude = \"x\",\n): Align.Alignment => {\n if (align != null) return align;\n return direction.construct(dir) === \"y\" ? \"stretch\" : \"center\";\n};\n\nexport const Item = ({\n label,\n showLabel = true,\n helpText,\n direction = \"y\",\n className,\n children,\n required,\n align,\n size = \"small\",\n padHelpText = false,\n helpTextVariant,\n showHelpText = true,\n ...props\n}: ItemProps): ReactElement => {\n let inputAndHelp: ReactElement;\n if (showHelpText === false && showLabel === false) return <>{children}</>;\n if (direction === \"x\")\n inputAndHelp = (\n <Align.Space direction=\"y\" size=\"small\">\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n else\n inputAndHelp = (\n <Align.Space direction=\"y\" size={1 / 3}>\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n\n return (\n <Align.Space\n className={CSS(CSS.B(\"input-item\"), className)}\n direction={direction}\n size={size}\n align={maybeDefaultAlignment(align, direction)}\n {...props}\n >\n {showLabel && <Label required={required}>{label}</Label>}\n {inputAndHelp}\n </Align.Space>\n );\n};\n","// Copyright 2024 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement, useState } from \"react\";\n\nimport { TimeSpan, TimeStamp } from \"@synnaxlabs/x\";\n\nimport { Text } from \"@/input/Text\";\nimport { type BaseProps } from \"@/input/types\";\n\nexport interface DateTimeProps extends BaseProps<number> {}\n\nexport const DateTime = ({\n value,\n onChange,\n onBlur,\n ...props\n}: DateTimeProps): ReactElement => {\n const ts = new TimeStamp(value, \"UTC\");\n const [internalValue, setInternalValue] = useState(\n ts.fString(\"ISO\", \"local\").slice(0, -1),\n );\n const [valueIsValid, setValueIsValid] = useState(true);\n\n const handleChange = (next: string | number): void => {\n let nextStr = next.toString();\n setInternalValue(nextStr);\n\n let ts = new TimeStamp(next, \"UTC\");\n if (nextStr.length < 23) nextStr += \".000\";\n\n ts = ts.add(\n BigInt(\n TimeStamp.now().date().getTimezoneOffset() - ts.date().getTimezoneOffset(),\n ) * TimeSpan.MINUTE.valueOf(),\n );\n let ok = false;\n try {\n const str = ts.fString(\"ISO\", \"local\");\n ok = str.slice(0, -1) === nextStr;\n } catch (_) {\n console.error(\"e\");\n }\n if (!ok) {\n setValueIsValid(false);\n return;\n }\n onChange(Number(ts.valueOf()));\n setValueIsValid(true);\n };\n\n const handleBlur: React.FocusEventHandler<HTMLInputElement> = (e) => {\n setValueIsValid(true);\n setInternalValue(new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1));\n onBlur?.(e);\n };\n\n return (\n <Text\n type=\"datetime-local\"\n onBlur={handleBlur}\n required={false}\n value={\n valueIsValid\n ? new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1)\n : internalValue\n }\n onChange={handleChange}\n {...props}\n />\n );\n};\n"],"names":["jsx","Text.Text","jsxs","direction","Align.Space","TimeStamp","ts","TimeSpan","Text"],"mappings":";;;;;;AAiCO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,MACEA,kCAAA;AAAA,EAACC;AAAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT,IAAI,EAAE,iBAAiB;AAAA,MACvB,IAAI,GAAG,mBAAmB,OAAO;AAAA,MACjC;AAAA,IACF;AAAA,IACA,OAAM;AAAA,IACL,GAAG;AAAA,EAAA;AACN;ACfK,MAAM,QAAQ,CAAC;AAAA,EACpB;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,MAAgC;AAE5B,SAAAC,kCAAA,KAAC,SAAM,EAAA,WAAW,IAAI,IAAI,EAAE,aAAa,GAAG,SAAS,GAAI,GAAG,OACzD,UAAA;AAAA,IAAA;AAAA,IAAS;AAAA,IAAE,kDAAa,QAAK,EAAA,WAAW,IAAI,EAAE,oBAAoB,GAAG,UAAC,KAAA;AAAA,EACzE,EAAA,CAAA;AAEJ;ACXA,MAAM,wBAAwB,CAC5B,OACA,MAAuB,QACH;AACpB,MAAI,SAAS;AAAa,WAAA;AAC1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;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"external-Brr6przd.js","sources":["../src/input/HelpText.tsx","../src/input/Label.tsx","../src/input/Item.tsx","../src/input/DateTime.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\nimport { type Status } from \"@/status\";\nimport { Text } from \"@/text\";\n\nimport \"@/input/HelpText.css\";\n\n/** Props for the {@link HelpText} component. */\nexport interface HelpTextProps extends Omit<Text.TextProps<\"small\">, \"level\" | \"ref\"> {\n variant?: Status.Variant;\n}\n\n/**\n * Help text for an input component. We generally recommend using Input.Item with a\n * 'helpText' prop instead of this component. This component is useful for low-level\n * control over the help text element.\n *\n * @param props - Props for the help text component. Unlisted props are passed to the\n * underlying text element.\n * @param props.variant - The variant of the help text.\n * \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\" | \"disabled\n * @default \"info\"\n */\nexport const HelpText = ({\n className,\n variant = \"error\",\n ...props\n}: HelpTextProps): ReactElement => (\n <Text.Text<\"small\">\n className={CSS(\n CSS.B(\"input-help-text\"),\n CSS.BM(\"input-help-text\", variant),\n className,\n )}\n level=\"small\"\n {...props}\n />\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type DetailedHTMLProps, type HTMLAttributes, type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\n\nimport \"@/input/Label.css\";\n\n/** Props for the {@link Label} component. */\nexport interface LabelProps\n extends DetailedHTMLProps<HTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {\n required?: boolean;\n}\n\n/**\n * A thin, styled wrapper for an input label. We generally recommend using Input.Item\n * with a 'label' prop instead of this component. This component is useful for\n * low-level control over the label element.\n *\n * @param props - Props for the label component. Unlisted props are passed to the\n * underlying label element.\n * @param props.required - Indicate whether the label is associated with a required\n * input.\n */\nexport const Label = ({\n className,\n required = false,\n children,\n ...props\n}: LabelProps): ReactElement => {\n return (\n <label className={CSS(CSS.B(\"input-label\"), className)} {...props}>\n {children} {required && <span className={CSS.B(\"required-indicator\")}>*</span>}\n </label>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { direction } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { HelpText } from \"@/input/HelpText\";\nimport { Label } from \"@/input/Label\";\n\nimport \"@/input/Item.css\";\nimport { status } from \"@/status/aether\";\n\nexport interface ItemProps extends Align.SpaceProps {\n label?: string;\n required?: boolean;\n showLabel?: boolean;\n helpText?: string;\n padHelpText?: boolean;\n helpTextVariant?: status.Variant;\n showHelpText?: boolean;\n}\n\nconst maybeDefaultAlignment = (\n align?: Align.Alignment,\n dir: direction.Crude = \"x\",\n): Align.Alignment => {\n if (align != null) return align;\n return direction.construct(dir) === \"y\" ? \"stretch\" : \"center\";\n};\n\nexport const Item = ({\n label,\n showLabel = true,\n helpText,\n direction = \"y\",\n className,\n children,\n required,\n align,\n size = \"small\",\n padHelpText = false,\n helpTextVariant,\n showHelpText = true,\n ...props\n}: ItemProps): ReactElement => {\n let inputAndHelp: ReactElement;\n if (showHelpText === false && showLabel === false) return <>{children}</>;\n if (direction === \"x\")\n inputAndHelp = (\n <Align.Space direction=\"y\" size=\"small\">\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n else\n inputAndHelp = (\n <Align.Space direction=\"y\" size={1 / 3}>\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n\n return (\n <Align.Space\n className={CSS(CSS.B(\"input-item\"), className)}\n direction={direction}\n size={size}\n align={maybeDefaultAlignment(align, direction)}\n {...props}\n >\n {showLabel && <Label required={required}>{label}</Label>}\n {inputAndHelp}\n </Align.Space>\n );\n};\n","// Copyright 2024 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement, useState } from \"react\";\n\nimport { TimeSpan, TimeStamp } from \"@synnaxlabs/x\";\n\nimport { Text } from \"@/input/Text\";\nimport { type BaseProps } from \"@/input/types\";\n\nexport interface DateTimeProps extends BaseProps<number> {}\n\nexport const DateTime = ({\n value,\n onChange,\n onBlur,\n ...props\n}: DateTimeProps): ReactElement => {\n const ts = new TimeStamp(value, \"UTC\");\n const [internalValue, setInternalValue] = useState(\n ts.fString(\"ISO\", \"local\").slice(0, -1),\n );\n const [valueIsValid, setValueIsValid] = useState(true);\n\n const handleChange = (next: string | number): void => {\n let nextStr = next.toString();\n setInternalValue(nextStr);\n\n let ts = new TimeStamp(next, \"UTC\");\n if (nextStr.length < 23) nextStr += \".000\";\n\n ts = ts.add(\n BigInt(\n TimeStamp.now().date().getTimezoneOffset() - ts.date().getTimezoneOffset(),\n ) * TimeSpan.MINUTE.valueOf(),\n );\n let ok = false;\n try {\n const str = ts.fString(\"ISO\", \"local\");\n ok = str.slice(0, -1) === nextStr;\n } catch (_) {\n console.error(\"e\");\n }\n if (!ok) {\n setValueIsValid(false);\n return;\n }\n onChange(Number(ts.valueOf()));\n setValueIsValid(true);\n };\n\n const handleBlur: React.FocusEventHandler<HTMLInputElement> = (e) => {\n setValueIsValid(true);\n setInternalValue(new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1));\n onBlur?.(e);\n };\n\n return (\n <Text\n type=\"datetime-local\"\n onBlur={handleBlur}\n required={false}\n value={\n valueIsValid\n ? new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1)\n : internalValue\n }\n onChange={handleChange}\n {...props}\n />\n );\n};\n"],"names":["jsx","Text.Text","jsxs","direction","Align.Space","TimeStamp","ts","TimeSpan","Text"],"mappings":";;;;;;AAiCO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,MACEA,kCAAA;AAAA,EAACC;AAAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT,IAAI,EAAE,iBAAiB;AAAA,MACvB,IAAI,GAAG,mBAAmB,OAAO;AAAA,MACjC;AAAA,IACF;AAAA,IACA,OAAM;AAAA,IACL,GAAG;AAAA,EAAA;AACN;ACfK,MAAM,QAAQ,CAAC;AAAA,EACpB;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,MAAgC;AAE5B,SAAAC,kCAAA,KAAC,SAAM,EAAA,WAAW,IAAI,IAAI,EAAE,aAAa,GAAG,SAAS,GAAI,GAAG,OACzD,UAAA;AAAA,IAAA;AAAA,IAAS;AAAA,IAAE,kDAAa,QAAK,EAAA,WAAW,IAAI,EAAE,oBAAoB,GAAG,UAAC,KAAA;AAAA,EACzE,EAAA,CAAA;AAEJ;ACXA,MAAM,wBAAwB,CAC5B,OACA,MAAuB,QACH;AACpB,MAAI,SAAS;AAAa,WAAA;AAC1B,SAAOC,EAAU,UAAU,GAAG,MAAM,MAAM,YAAY;AACxD;AAEO,MAAM,OAAO,CAAC;AAAA,EACnB;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,WAAAA,aAAY;AA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"./jsx-runtime-mMz73N64.js";
3
- import { i as SketchPicker, j as use, u as use$1, k as useDraggingState, l as filterByType, m as useDragAndDrop, B as Button, e as Text, n as Dialog } from "./Toggle-Blzh0A0b.js";
3
+ import { i as SketchPicker, j as use, u as use$1, k as useDraggingState, l as filterByType, m as useDragAndDrop, B as Button, e as Text, n as Dialog } from "./Toggle-DcOiWiHG.js";
4
4
  import { useCallback } from "react";
5
5
  import "./aggregator-Dl2jHye5.js";
6
6
  import "./Center-hbwH7rg9.js";
@@ -105,4 +105,4 @@ export {
105
105
  Swatch as S,
106
106
  external as e
107
107
  };
108
- //# sourceMappingURL=external-ClBFWQBO.js.map
108
+ //# sourceMappingURL=external-CPB95nWX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-ClBFWQBO.js","sources":["../src/color/Picker/Picker.tsx","../src/color/Swatch/Swatch.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ComponentPropsWithoutRef, type ReactElement } from \"react\";\n\nimport { SketchPicker, type ColorResult } from \"react-color\";\n\nimport { color } from \"@/color/core\";\nimport { CSS } from \"@/css\";\nimport { type Input } from \"@/input\";\n\nimport \"@/color/Picker/Picker.css\";\n\nexport interface PickerProps\n extends Input.Control<color.Crude, color.Color>,\n Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\"> {}\n\nexport const Picker = ({ value, onChange, ...props }: PickerProps): ReactElement => {\n const handleChange = (res: ColorResult): void => {\n if (res.hex === \"transparent\") onChange(color.ZERO);\n onChange(new color.Color(res.hex, res.rgb.a));\n };\n\n return (\n <SketchPicker\n className={CSS.B(\"color-picker\")}\n color={new color.Color(value).hex}\n onChange={handleChange}\n presetColors={[]}\n {...props}\n />\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement, useCallback } from \"react\";\n\nimport { Button } from \"@/button\";\nimport { color } from \"@/color/core\";\nimport { type Crude, type Color } from \"@/color/core/color\";\nimport { Picker } from \"@/color/Picker\";\nimport { CSS } from \"@/css\";\nimport { Dropdown } from \"@/dropdown\";\nimport { type UseProps } from \"@/dropdown/Dropdown\";\nimport { Haul } from \"@/haul\";\nimport { type Input } from \"@/input\";\nimport { Text } from \"@/text\";\nimport { Theming } from \"@/theming\";\n\nimport \"@/color/Swatch/Swatch.css\";\n\nexport interface SwatchProps\n extends Input.Control<Crude, Color>,\n Omit<Button.ButtonProps, \"onChange\" | \"value\">,\n UseProps {}\n\nconst HAUL_TYPE = \"color\";\n\nexport const Swatch = ({\n value,\n onChange,\n className,\n size = \"medium\",\n onVisibleChange,\n initialVisible,\n draggable = true,\n ...props\n}: SwatchProps): ReactElement => {\n const { visible, open, close } = Dropdown.use({ onVisibleChange, initialVisible });\n\n const bg = Theming.use().colors.gray.l0;\n\n const d = new color.Color(value);\n\n const dragging = Haul.useDraggingState();\n\n const canDrop: Haul.CanDrop = useCallback(\n ({ items }) => {\n const [k] = Haul.filterByType(HAUL_TYPE, items);\n return k != null && k.key !== d.hex;\n },\n [d.hex],\n );\n\n const { startDrag, ...haulProps } = Haul.useDragAndDrop({\n type: \"Color.Swatch\",\n onDrop: ({ items }) => {\n const dropped = Haul.filterByType(HAUL_TYPE, items);\n if (items.length > 0) onChange?.(new color.Color(dropped[0].key as string));\n return dropped;\n },\n canDrop,\n });\n\n const swatch = (\n <Button.Button\n className={CSS(\n CSS.B(\"color-swatch\"),\n CSS.size(size),\n d.contrast(bg) > 1.5 && d.a > 0.5 && CSS.M(\"no-border\"),\n CSS.dropRegion(canDrop(dragging)),\n className,\n )}\n draggable={draggable}\n onDragStart={() => startDrag([{ type: HAUL_TYPE, key: d.hex }])}\n style={{ backgroundColor: color.cssString(value) }}\n variant=\"text\"\n onClick={open}\n size={size}\n tooltip={\n onChange != null ? (\n <Text.Text level=\"small\">Click to change color</Text.Text>\n ) : undefined\n }\n {...haulProps}\n {...props}\n />\n );\n\n if (onChange == null) return swatch;\n\n return (\n <Dropdown.Dialog\n close={close}\n visible={visible}\n className={CSS.BE(\"color-swatch\", \"dropdown\")}\n keepMounted={false}\n variant=\"floating\"\n >\n {swatch}\n <Picker value={value} onChange={onChange} />\n </Dropdown.Dialog>\n );\n};\n"],"names":["color.ZERO","color.Color","jsx","Dropdown.use","Theming.use","Haul.useDraggingState","Haul.filterByType","Haul.useDragAndDrop","Button.Button","color.cssString","Text.Text","jsxs","Dropdown.Dialog"],"mappings":";;;;;;AAuBO,MAAM,SAAS,CAAC,EAAE,OAAO,UAAU,GAAG,YAAuC;AAC5E,QAAA,eAAe,CAAC,QAA2B;AAC/C,QAAI,IAAI,QAAQ;AAAe,eAASA,IAAU;AACzC,aAAA,IAAIC,MAAY,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC;AAAA,EAAA;AAI5C,SAAAC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,IAAI,EAAE,cAAc;AAAA,MAC/B,OAAO,IAAID,MAAY,KAAK,EAAE;AAAA,MAC9B,UAAU;AAAA,MACV,cAAc,CAAC;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;ACRA,MAAM,YAAY;AAEX,MAAM,SAAS,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,MAAiC;AACzB,QAAA,EAAE,SAAS,MAAM,MAAM,IAAIE,IAAa,EAAE,iBAAiB,eAAA,CAAgB;AAEjF,QAAM,KAAKC,MAAY,EAAE,OAAO,KAAK;AAErC,QAAM,IAAI,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A;AAAA,MACA,WAAW,IAAI,GAAG,gBAAgB,UAAU;AAAA,MAC5C,aAAa;AAAA,MACb,SAAQ;AAAA,MAEP,UAAA;AAAA,QAAA;AAAA,QACDV,kCAAAA,IAAC,QAAO,EAAA,OAAc,SAAoB,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhD;;;;;;;;;;;"}
1
+ {"version":3,"file":"external-CPB95nWX.js","sources":["../src/color/Picker/Picker.tsx","../src/color/Swatch/Swatch.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ComponentPropsWithoutRef, type ReactElement } from \"react\";\n\nimport { SketchPicker, type ColorResult } from \"react-color\";\n\nimport { color } from \"@/color/core\";\nimport { CSS } from \"@/css\";\nimport { type Input } from \"@/input\";\n\nimport \"@/color/Picker/Picker.css\";\n\nexport interface PickerProps\n extends Input.Control<color.Crude, color.Color>,\n Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\"> {}\n\nexport const Picker = ({ value, onChange, ...props }: PickerProps): ReactElement => {\n const handleChange = (res: ColorResult): void => {\n if (res.hex === \"transparent\") onChange(color.ZERO);\n onChange(new color.Color(res.hex, res.rgb.a));\n };\n\n return (\n <SketchPicker\n className={CSS.B(\"color-picker\")}\n color={new color.Color(value).hex}\n onChange={handleChange}\n presetColors={[]}\n {...props}\n />\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement, useCallback } from \"react\";\n\nimport { Button } from \"@/button\";\nimport { color } from \"@/color/core\";\nimport { type Crude, type Color } from \"@/color/core/color\";\nimport { Picker } from \"@/color/Picker\";\nimport { CSS } from \"@/css\";\nimport { Dropdown } from \"@/dropdown\";\nimport { type UseProps } from \"@/dropdown/Dropdown\";\nimport { Haul } from \"@/haul\";\nimport { type Input } from \"@/input\";\nimport { Text } from \"@/text\";\nimport { Theming } from \"@/theming\";\n\nimport \"@/color/Swatch/Swatch.css\";\n\nexport interface SwatchProps\n extends Input.Control<Crude, Color>,\n Omit<Button.ButtonProps, \"onChange\" | \"value\">,\n UseProps {}\n\nconst HAUL_TYPE = \"color\";\n\nexport const Swatch = ({\n value,\n onChange,\n className,\n size = \"medium\",\n onVisibleChange,\n initialVisible,\n draggable = true,\n ...props\n}: SwatchProps): ReactElement => {\n const { visible, open, close } = Dropdown.use({ onVisibleChange, initialVisible });\n\n const bg = Theming.use().colors.gray.l0;\n\n const d = new color.Color(value);\n\n const dragging = Haul.useDraggingState();\n\n const canDrop: Haul.CanDrop = useCallback(\n ({ items }) => {\n const [k] = Haul.filterByType(HAUL_TYPE, items);\n return k != null && k.key !== d.hex;\n },\n [d.hex],\n );\n\n const { startDrag, ...haulProps } = Haul.useDragAndDrop({\n type: \"Color.Swatch\",\n onDrop: ({ items }) => {\n const dropped = Haul.filterByType(HAUL_TYPE, items);\n if (items.length > 0) onChange?.(new color.Color(dropped[0].key as string));\n return dropped;\n },\n canDrop,\n });\n\n const swatch = (\n <Button.Button\n className={CSS(\n CSS.B(\"color-swatch\"),\n CSS.size(size),\n d.contrast(bg) > 1.5 && d.a > 0.5 && CSS.M(\"no-border\"),\n CSS.dropRegion(canDrop(dragging)),\n className,\n )}\n draggable={draggable}\n onDragStart={() => startDrag([{ type: HAUL_TYPE, key: d.hex }])}\n style={{ backgroundColor: color.cssString(value) }}\n variant=\"text\"\n onClick={open}\n size={size}\n tooltip={\n onChange != null ? (\n <Text.Text level=\"small\">Click to change color</Text.Text>\n ) : undefined\n }\n {...haulProps}\n {...props}\n />\n );\n\n if (onChange == null) return swatch;\n\n return (\n <Dropdown.Dialog\n close={close}\n visible={visible}\n className={CSS.BE(\"color-swatch\", \"dropdown\")}\n keepMounted={false}\n variant=\"floating\"\n >\n {swatch}\n <Picker value={value} onChange={onChange} />\n </Dropdown.Dialog>\n );\n};\n"],"names":["color.ZERO","color.Color","jsx","Dropdown.use","Theming.use","Haul.useDraggingState","Haul.filterByType","Haul.useDragAndDrop","Button.Button","color.cssString","Text.Text","jsxs","Dropdown.Dialog"],"mappings":";;;;;;AAuBO,MAAM,SAAS,CAAC,EAAE,OAAO,UAAU,GAAG,YAAuC;AAC5E,QAAA,eAAe,CAAC,QAA2B;AAC/C,QAAI,IAAI,QAAQ;AAAe,eAASA,IAAU;AACzC,aAAA,IAAIC,MAAY,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC;AAAA,EAAA;AAI5C,SAAAC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,IAAI,EAAE,cAAc;AAAA,MAC/B,OAAO,IAAID,MAAY,KAAK,EAAE;AAAA,MAC9B,UAAU;AAAA,MACV,cAAc,CAAC;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;ACRA,MAAM,YAAY;AAEX,MAAM,SAAS,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,MAAiC;AACzB,QAAA,EAAE,SAAS,MAAM,MAAM,IAAIE,IAAa,EAAE,iBAAiB,eAAA,CAAgB;AAEjF,QAAM,KAAKC,MAAY,EAAE,OAAO,KAAK;AAErC,QAAM,IAAI,IAAIH,MAAY,KAAK;AAEzB,QAAA,WAAWI;AAEjB,QAAM,UAAwB;AAAA,IAC5B,CAAC,EAAE,MAAA,MAAY;AACb,YAAM,CAAC,CAAC,IAAIC,aAAkB,WAAW,KAAK;AAC9C,aAAO,KAAK,QAAQ,EAAE,QAAQ,EAAE;AAAA,IAClC;AAAA,IACA,CAAC,EAAE,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}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("./jsx-runtime-B3vWrP5x.cjs");
3
3
  const React = require("react");
4
- const Toggle = require("./Toggle-D1EoehhH.cjs");
4
+ const Toggle = require("./Toggle-CAW20E9V.cjs");
5
5
  const Center = require("./Center-5NJ61qfA.cjs");
6
6
  const css = require("./css-Pf9qxhQ4.cjs");
7
7
  const aggregator = require("./aggregator-Ca8xiVD2.cjs");
@@ -283,4 +283,4 @@ exports.external = external;
283
283
  exports.rename = rename;
284
284
  exports.resetSelection = resetSelection;
285
285
  exports.useStatic = useStatic;
286
- //# sourceMappingURL=external-B8ILMNP2.cjs.map
286
+ //# sourceMappingURL=external-CYRIymJR.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-B8ILMNP2.cjs","sources":["../src/tabs/Tabs.tsx","../src/tabs/Selector.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport React, {\n createContext,\n type ReactElement,\n type ReactNode,\n useContext,\n useCallback,\n} from \"react\";\n\nimport { direction } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { useSyncedRef } from \"@/hooks\";\nimport { state } from \"@/state\";\nimport { type TabSpec, Selector } from \"@/tabs/Selector\";\nimport { type ComponentSize } from \"@/util/component\";\nimport { type RenderProp } from \"@/util/renderProp\";\n\nimport \"@/tabs/Tabs.css\";\n\nexport interface Tab extends TabSpec {\n content?: ReactNode;\n}\n\nexport type TabRenderProp = RenderProp<Tab>;\n\nexport interface UseStaticTabsProps {\n tabs: Tab[];\n content?: TabRenderProp;\n onSelect?: (key: string) => void;\n selected?: string;\n}\n\nexport const resetSelection = (selected = \"\", tabs: Tab[] = []): string | undefined => {\n if (tabs.length === 0) return undefined;\n return tabs.find((t) => t.tabKey === selected) != null\n ? selected\n : tabs[tabs.length - 1]?.tabKey;\n};\n\nexport const rename = (key: string, title: string, tabs: Tab[]): Tab[] => {\n title = title.trim();\n if (title.length === 0) return tabs;\n const t = tabs.find((t) => t.tabKey === key);\n if (t == null || t.name === title) return tabs;\n return tabs.map((t) => (t.tabKey === key ? { ...t, name: title } : t));\n};\n\nexport const useStatic = ({\n tabs,\n content,\n selected,\n onSelect,\n}: UseStaticTabsProps): TabsContextValue => {\n const [value, onChange] = state.usePurePassthrough({\n initial: selected ?? tabs[0]?.tabKey ?? \"\",\n value: selected,\n onChange: onSelect,\n });\n const valueRef = useSyncedRef(selected ?? value);\n\n const handleSelect = useCallback(\n (key: string): void => {\n onChange(key);\n if (valueRef.current == null) onSelect?.(key);\n },\n [value, onSelect],\n );\n\n return {\n tabs,\n selected: value,\n content,\n onSelect: handleSelect,\n };\n};\n\nexport interface TabsContextValue {\n tabs: Tab[];\n emptyContent?: ReactElement | null;\n closable?: boolean;\n selected?: string;\n onSelect?: (key: string) => void;\n content?: TabRenderProp | ReactNode;\n onClose?: (key: string) => void;\n onDragStart?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onDragEnd?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onDrop?: (e: React.DragEvent<HTMLDivElement>) => void;\n onRename?: (key: string, title: string) => void;\n onCreate?: () => void;\n}\n\nexport interface TabsProps\n extends Omit<\n Align.SpaceProps,\n \"children\" | \"onSelect\" | \"size\" | \"onDragStart\" | \"onDragEnd\" | \"content\"\n >,\n TabsContextValue {\n children?: TabRenderProp | ReactNode;\n size?: ComponentSize;\n}\n\nexport const TabsContext = createContext<TabsContextValue>({ tabs: [] });\n\nexport const useTabsContext = (): TabsContextValue => useContext(TabsContext);\n\nexport const Tabs = ({\n id,\n content,\n children,\n onSelect,\n selected,\n closable,\n tabs,\n onClose,\n onDragStart,\n onDragEnd,\n onCreate,\n onRename,\n emptyContent,\n className,\n onDragOver,\n onDrop,\n size = \"medium\",\n direction: dir = \"y\",\n ...props\n}: TabsProps): ReactElement => (\n <Align.Space\n id={id}\n empty\n className={CSS(CSS.B(\"tabs\"), className)}\n onDragOver={onDragOver}\n onDrop={onDrop}\n direction={dir}\n {...props}\n >\n <TabsContext.Provider\n value={{\n tabs,\n emptyContent,\n selected,\n closable,\n content: children ?? content,\n onSelect,\n onClose,\n onDragStart,\n onDragEnd,\n onRename,\n onCreate,\n onDrop,\n }}\n >\n <Selector size={size} direction={direction.swap(dir)} />\n <Content />\n </TabsContext.Provider>\n </Align.Space>\n);\n\nexport const Provider = TabsContext.Provider;\n\nexport const Content = (): ReactNode | null => {\n const {\n tabs,\n selected,\n content: renderProp,\n emptyContent,\n onSelect,\n } = useTabsContext();\n let content: ReactNode = null;\n const selectedTab = tabs.find((tab) => tab.tabKey === selected);\n if (selected == null || selectedTab == null) return emptyContent ?? null;\n if (renderProp != null) {\n if (typeof renderProp === \"function\") content = renderProp(selectedTab);\n else content = renderProp;\n } else if (selectedTab.content != null) content = selectedTab.content;\n return (\n <div className={CSS.B(\"tabs-content\")} onClick={() => onSelect?.(selected)}>\n {content}\n </div>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n type DragEventHandler,\n type MouseEventHandler,\n type ReactElement,\n useCallback,\n} from \"react\";\n\nimport { Icon } from \"@synnaxlabs/media\";\n\nimport { Align } from \"@/align\";\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { useTabsContext } from \"@/tabs/Tabs\";\nimport { Text } from \"@/text\";\nimport { type ComponentSize } from \"@/util/component\";\n\nexport interface TabSpec {\n tabKey: string;\n name: string;\n closable?: boolean;\n icon?: ReactElement;\n editable?: boolean;\n}\n\nexport interface SelectorProps extends Omit<Align.SpaceProps, \"children\"> {\n size?: ComponentSize;\n}\n\nconst CLS = \"tabs-selector\";\n\nexport const Selector = ({\n className,\n size = \"medium\",\n direction = \"x\",\n ...props\n}: SelectorProps): ReactElement | null => {\n const {\n tabs,\n selected,\n onSelect,\n onClose,\n closable,\n onDragEnd,\n onDragStart,\n onDrop,\n onRename,\n onCreate,\n } = useTabsContext();\n return (\n <Align.Space\n className={CSS(CSS.B(CLS), CSS.size(size), className)}\n align=\"center\"\n justify=\"spaceBetween\"\n onDrop={onDrop}\n empty\n direction={direction}\n {...props}\n >\n <Align.Space direction={direction} className={CSS.BE(CLS, \"tabs\")} empty>\n {tabs.map((tab) => (\n <SelectorButton\n key={tab.tabKey}\n selected={selected}\n onSelect={onSelect}\n onClose={onClose}\n onDragStart={onDragStart}\n onDragEnd={onDragEnd}\n onRename={onRename}\n closable={tab.closable ?? closable}\n size={size}\n {...tab}\n />\n ))}\n </Align.Space>\n\n {onCreate != null && (\n <Align.Space className={CSS.BE(CLS, \"actions\")}>\n <Button.Icon size={size} sharp onClick={onCreate}>\n <Icon.Add />\n </Button.Icon>\n </Align.Space>\n )}\n </Align.Space>\n );\n};\n\nconst SelectorButton = ({\n selected,\n onSelect,\n onClose,\n tabKey,\n name,\n onDragStart,\n onDragEnd,\n onRename,\n closable = true,\n icon,\n size,\n editable = true,\n}: SelectorButtonProps): ReactElement => {\n const handleDragStart: DragEventHandler<HTMLDivElement> = useCallback(\n (e) => onDragStart?.(e, { tabKey, name }),\n [onDragStart, tabKey, name],\n );\n\n const handleDragEnd: DragEventHandler<HTMLDivElement> = useCallback(\n (e) => onDragEnd?.(e, { tabKey, name }),\n [onDragEnd, tabKey, name],\n );\n\n const handleClose: MouseEventHandler<HTMLButtonElement> = useCallback(\n (e) => {\n e.stopPropagation();\n onClose?.(tabKey);\n },\n [onClose, tabKey],\n );\n\n const _onSelect = useCallback(() => onSelect?.(tabKey), [onSelect, tabKey]);\n\n return (\n <Align.Pack\n size={size}\n className={CSS(\n CSS.BE(CLS, \"btn\"),\n onRename == null && CSS.BEM(CLS, \"btn\", \"uneditable\"),\n CSS.selected(selected === tabKey),\n closable && onClose != null && CSS.BEM(CLS, \"btn\", \"closable\"),\n )}\n draggable\n direction=\"x\"\n justify=\"center\"\n align=\"center\"\n onClick={_onSelect}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n bordered={false}\n rounded={false}\n >\n <Name\n name={name}\n tabKey={tabKey}\n onRename={onRename}\n icon={icon}\n editable={editable}\n level={Text.ComponentSizeLevels[size]}\n />\n {closable && onClose != null && (\n <Button.Icon onClick={handleClose}>\n <Icon.Close aria-label=\"pluto-tabs__close\" />\n </Button.Icon>\n )}\n </Align.Pack>\n );\n};\n\nexport interface SelectorButtonProps extends TabSpec {\n selected?: string;\n onDragStart?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onDragEnd?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onSelect?: (key: string) => void;\n onClose?: (key: string) => void;\n onRename?: (key: string, name: string) => void;\n size: ComponentSize;\n}\n\ninterface NameProps extends Text.CoreProps<Text.Level> {\n onRename?: (key: string, name: string) => void;\n name: string;\n tabKey: string;\n icon?: ReactElement;\n editable?: boolean;\n}\n\nconst Name = ({\n onRename,\n name,\n tabKey,\n icon,\n editable = true,\n ...props\n}: NameProps): ReactElement => {\n if (onRename == null || !editable) {\n if (icon != null)\n return (\n <Text.WithIcon startIcon={icon} noWrap {...props}>\n {name}\n </Text.WithIcon>\n );\n return (\n <Text.Text noWrap {...props}>\n {name}\n </Text.Text>\n );\n }\n return (\n <Text.Editable<Text.Level>\n onChange={(newText: string) => onRename(tabKey, newText)}\n value={name}\n noWrap\n {...props}\n />\n );\n};\n"],"names":["t","state.usePurePassthrough","useSyncedRef","useCallback","createContext","useContext","jsx","Align.Space","CSS","jsxs","direction","Button.Icon","Icon","Align.Pack","Text.ComponentSizeLevels","Text.WithIcon","Text.Text","Text.Editable"],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AAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOQ,WAAK,oBAAoB,IAAI;AAAA,UAAA;AAAA,QACtC;AAAA,QACC,YAAY,WAAW,QACtBR,2BAAA,kBAAA,IAACK,OAAA,MAAA,EAAY,SAAS,aACpB,2DAACC,OAAK,GAAA,OAAL,EAAW,cAAW,oBAAoB,CAAA,GAC7C;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAoBA,MAAM,OAAO,CAAC;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,MAA+B;AACzB,MAAA,YAAY,QAAQ,CAAC,UAAU;AACjC,QAAI,QAAQ;AAER,aAAAN,iDAACS,OAAAA,UAAA,EAAc,WAAW,MAAM,QAAM,MAAE,GAAG,OACxC,UACH,KAAA,CAAA;AAGF,WAAAT,2BAAA,kBAAA,IAACU,aAAA,EAAU,QAAM,MAAE,GAAG,OACnB,UACH,KAAA,CAAA;AAAA,EAEJ;AAEE,SAAAV,2BAAA,kBAAA;AAAA,IAACW,OAAK;AAAA,IAAL;AAAA,MACC,UAAU,CAAC,YAAoB,SAAS,QAAQ,OAAO;AAAA,MACvD,OAAO;AAAA,MACP,QAAM;AAAA,MACL,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"external-CYRIymJR.cjs","sources":["../src/tabs/Tabs.tsx","../src/tabs/Selector.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport React, {\n createContext,\n type ReactElement,\n type ReactNode,\n useContext,\n useCallback,\n} from \"react\";\n\nimport { direction } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { useSyncedRef } from \"@/hooks\";\nimport { state } from \"@/state\";\nimport { type TabSpec, Selector } from \"@/tabs/Selector\";\nimport { type ComponentSize } from \"@/util/component\";\nimport { type RenderProp } from \"@/util/renderProp\";\n\nimport \"@/tabs/Tabs.css\";\n\nexport interface Tab extends TabSpec {\n content?: ReactNode;\n}\n\nexport type TabRenderProp = RenderProp<Tab>;\n\nexport interface UseStaticTabsProps {\n tabs: Tab[];\n content?: TabRenderProp;\n onSelect?: (key: string) => void;\n selected?: string;\n}\n\nexport const resetSelection = (selected = \"\", tabs: Tab[] = []): string | undefined => {\n if (tabs.length === 0) return undefined;\n return tabs.find((t) => t.tabKey === selected) != null\n ? selected\n : tabs[tabs.length - 1]?.tabKey;\n};\n\nexport const rename = (key: string, title: string, tabs: Tab[]): Tab[] => {\n title = title.trim();\n if (title.length === 0) return tabs;\n const t = tabs.find((t) => t.tabKey === key);\n if (t == null || t.name === title) return tabs;\n return tabs.map((t) => (t.tabKey === key ? { ...t, name: title } : t));\n};\n\nexport const useStatic = ({\n tabs,\n content,\n selected,\n onSelect,\n}: UseStaticTabsProps): TabsContextValue => {\n const [value, onChange] = state.usePurePassthrough({\n initial: selected ?? tabs[0]?.tabKey ?? \"\",\n value: selected,\n onChange: onSelect,\n });\n const valueRef = useSyncedRef(selected ?? value);\n\n const handleSelect = useCallback(\n (key: string): void => {\n onChange(key);\n if (valueRef.current == null) onSelect?.(key);\n },\n [value, onSelect],\n );\n\n return {\n tabs,\n selected: value,\n content,\n onSelect: handleSelect,\n };\n};\n\nexport interface TabsContextValue {\n tabs: Tab[];\n emptyContent?: ReactElement | null;\n closable?: boolean;\n selected?: string;\n onSelect?: (key: string) => void;\n content?: TabRenderProp | ReactNode;\n onClose?: (key: string) => void;\n onDragStart?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onDragEnd?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onDrop?: (e: React.DragEvent<HTMLDivElement>) => void;\n onRename?: (key: string, title: string) => void;\n onCreate?: () => void;\n}\n\nexport interface TabsProps\n extends Omit<\n Align.SpaceProps,\n \"children\" | \"onSelect\" | \"size\" | \"onDragStart\" | \"onDragEnd\" | \"content\"\n >,\n TabsContextValue {\n children?: TabRenderProp | ReactNode;\n size?: ComponentSize;\n}\n\nexport const TabsContext = createContext<TabsContextValue>({ tabs: [] });\n\nexport const useTabsContext = (): TabsContextValue => useContext(TabsContext);\n\nexport const Tabs = ({\n id,\n content,\n children,\n onSelect,\n selected,\n closable,\n tabs,\n onClose,\n onDragStart,\n onDragEnd,\n onCreate,\n onRename,\n emptyContent,\n className,\n onDragOver,\n onDrop,\n size = \"medium\",\n direction: dir = \"y\",\n ...props\n}: TabsProps): ReactElement => (\n <Align.Space\n id={id}\n empty\n className={CSS(CSS.B(\"tabs\"), className)}\n onDragOver={onDragOver}\n onDrop={onDrop}\n direction={dir}\n {...props}\n >\n <TabsContext.Provider\n value={{\n tabs,\n emptyContent,\n selected,\n closable,\n content: children ?? content,\n onSelect,\n onClose,\n onDragStart,\n onDragEnd,\n onRename,\n onCreate,\n onDrop,\n }}\n >\n <Selector size={size} direction={direction.swap(dir)} />\n <Content />\n </TabsContext.Provider>\n </Align.Space>\n);\n\nexport const Provider = TabsContext.Provider;\n\nexport const Content = (): ReactNode | null => {\n const {\n tabs,\n selected,\n content: renderProp,\n emptyContent,\n onSelect,\n } = useTabsContext();\n let content: ReactNode = null;\n const selectedTab = tabs.find((tab) => tab.tabKey === selected);\n if (selected == null || selectedTab == null) return emptyContent ?? null;\n if (renderProp != null) {\n if (typeof renderProp === \"function\") content = renderProp(selectedTab);\n else content = renderProp;\n } else if (selectedTab.content != null) content = selectedTab.content;\n return (\n <div className={CSS.B(\"tabs-content\")} onClick={() => onSelect?.(selected)}>\n {content}\n </div>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport {\n type DragEventHandler,\n type MouseEventHandler,\n type ReactElement,\n useCallback,\n} from \"react\";\n\nimport { Icon } from \"@synnaxlabs/media\";\n\nimport { Align } from \"@/align\";\nimport { Button } from \"@/button\";\nimport { CSS } from \"@/css\";\nimport { useTabsContext } from \"@/tabs/Tabs\";\nimport { Text } from \"@/text\";\nimport { type ComponentSize } from \"@/util/component\";\n\nexport interface TabSpec {\n tabKey: string;\n name: string;\n closable?: boolean;\n icon?: ReactElement;\n editable?: boolean;\n}\n\nexport interface SelectorProps extends Omit<Align.SpaceProps, \"children\"> {\n size?: ComponentSize;\n}\n\nconst CLS = \"tabs-selector\";\n\nexport const Selector = ({\n className,\n size = \"medium\",\n direction = \"x\",\n ...props\n}: SelectorProps): ReactElement | null => {\n const {\n tabs,\n selected,\n onSelect,\n onClose,\n closable,\n onDragEnd,\n onDragStart,\n onDrop,\n onRename,\n onCreate,\n } = useTabsContext();\n return (\n <Align.Space\n className={CSS(CSS.B(CLS), CSS.size(size), className)}\n align=\"center\"\n justify=\"spaceBetween\"\n onDrop={onDrop}\n empty\n direction={direction}\n {...props}\n >\n <Align.Space direction={direction} className={CSS.BE(CLS, \"tabs\")} empty>\n {tabs.map((tab) => (\n <SelectorButton\n key={tab.tabKey}\n selected={selected}\n onSelect={onSelect}\n onClose={onClose}\n onDragStart={onDragStart}\n onDragEnd={onDragEnd}\n onRename={onRename}\n closable={tab.closable ?? closable}\n size={size}\n {...tab}\n />\n ))}\n </Align.Space>\n\n {onCreate != null && (\n <Align.Space className={CSS.BE(CLS, \"actions\")}>\n <Button.Icon size={size} sharp onClick={onCreate}>\n <Icon.Add />\n </Button.Icon>\n </Align.Space>\n )}\n </Align.Space>\n );\n};\n\nconst SelectorButton = ({\n selected,\n onSelect,\n onClose,\n tabKey,\n name,\n onDragStart,\n onDragEnd,\n onRename,\n closable = true,\n icon,\n size,\n editable = true,\n}: SelectorButtonProps): ReactElement => {\n const handleDragStart: DragEventHandler<HTMLDivElement> = useCallback(\n (e) => onDragStart?.(e, { tabKey, name }),\n [onDragStart, tabKey, name],\n );\n\n const handleDragEnd: DragEventHandler<HTMLDivElement> = useCallback(\n (e) => onDragEnd?.(e, { tabKey, name }),\n [onDragEnd, tabKey, name],\n );\n\n const handleClose: MouseEventHandler<HTMLButtonElement> = useCallback(\n (e) => {\n e.stopPropagation();\n onClose?.(tabKey);\n },\n [onClose, tabKey],\n );\n\n const _onSelect = useCallback(() => onSelect?.(tabKey), [onSelect, tabKey]);\n\n return (\n <Align.Pack\n size={size}\n className={CSS(\n CSS.BE(CLS, \"btn\"),\n onRename == null && CSS.BEM(CLS, \"btn\", \"uneditable\"),\n CSS.selected(selected === tabKey),\n closable && onClose != null && CSS.BEM(CLS, \"btn\", \"closable\"),\n )}\n draggable\n direction=\"x\"\n justify=\"center\"\n align=\"center\"\n onClick={_onSelect}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n bordered={false}\n rounded={false}\n >\n <Name\n name={name}\n tabKey={tabKey}\n onRename={onRename}\n icon={icon}\n editable={editable}\n level={Text.ComponentSizeLevels[size]}\n />\n {closable && onClose != null && (\n <Button.Icon onClick={handleClose}>\n <Icon.Close aria-label=\"pluto-tabs__close\" />\n </Button.Icon>\n )}\n </Align.Pack>\n );\n};\n\nexport interface SelectorButtonProps extends TabSpec {\n selected?: string;\n onDragStart?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onDragEnd?: (e: React.DragEvent<HTMLDivElement>, tab: TabSpec) => void;\n onSelect?: (key: string) => void;\n onClose?: (key: string) => void;\n onRename?: (key: string, name: string) => void;\n size: ComponentSize;\n}\n\ninterface NameProps extends Text.CoreProps<Text.Level> {\n onRename?: (key: string, name: string) => void;\n name: string;\n tabKey: string;\n icon?: ReactElement;\n editable?: boolean;\n}\n\nconst Name = ({\n onRename,\n name,\n tabKey,\n icon,\n editable = true,\n ...props\n}: NameProps): ReactElement => {\n if (onRename == null || !editable) {\n if (icon != null)\n return (\n <Text.WithIcon startIcon={icon} noWrap {...props}>\n {name}\n </Text.WithIcon>\n );\n return (\n <Text.Text noWrap {...props}>\n {name}\n </Text.Text>\n );\n }\n return (\n <Text.Editable<Text.Level>\n onChange={(newText: string) => onRename(tabKey, newText)}\n value={name}\n noWrap\n {...props}\n />\n );\n};\n"],"names":["t","state.usePurePassthrough","useSyncedRef","useCallback","createContext","useContext","jsx","Align.Space","CSS","jsxs","direction","Button.Icon","Icon","Align.Pack","Text.ComponentSizeLevels","Text.WithIcon","Text.Text","Text.Editable"],"mappings":";;;;;;;AA0CO,MAAM,iBAAiB,CAAC,WAAW,IAAI,OAAc,CAAA,MAA2B;;AACrF,MAAI,KAAK,WAAW;AAAU,WAAA;AAC9B,SAAO,KAAK,KAAK,CAAC,MAAM,EAAE,WAAW,QAAQ,KAAK,OAC9C,YACA,UAAK,KAAK,SAAS,CAAC,MAApB,mBAAuB;AAC7B;AAEO,MAAM,SAAS,CAAC,KAAa,OAAe,SAAuB;AACxE,UAAQ,MAAM;AACd,MAAI,MAAM,WAAW;AAAU,WAAA;AAC/B,QAAM,IAAI,KAAK,KAAK,CAACA,OAAMA,GAAE,WAAW,GAAG;AACvC,MAAA,KAAK,QAAQ,EAAE,SAAS;AAAc,WAAA;AAC1C,SAAO,KAAK,IAAI,CAACA,OAAOA,GAAE,WAAW,MAAM,EAAE,GAAGA,IAAG,MAAM,UAAUA,EAAE;AACvE;AAEO,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA4C;;AAC1C,QAAM,CAAC,OAAO,QAAQ,IAAIC,8BAAyB;AAAA,IACjD,SAAS,cAAY,UAAK,CAAC,MAAN,mBAAS,WAAU;AAAA,IACxC,OAAO;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACK,QAAA,WAAWC,OAAAA,aAAa,Y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AAM;AAAA,MACL,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const Toggle = require("./Toggle-D1EoehhH.cjs");
2
+ const Toggle = require("./Toggle-CAW20E9V.cjs");
3
3
  const jsxRuntime = require("./jsx-runtime-B3vWrP5x.cjs");
4
4
  const css = require("./css-Pf9qxhQ4.cjs");
5
5
  const aggregator = require("./aggregator-Ca8xiVD2.cjs");
@@ -153,4 +153,4 @@ const external = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
153
153
  }, Symbol.toStringTag, { value: "Module" }));
154
154
  exports.Item = Item;
155
155
  exports.external = external;
156
- //# sourceMappingURL=external-BL3iWJdz.cjs.map
156
+ //# sourceMappingURL=external-CZli69bF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-BL3iWJdz.cjs","sources":["../src/input/HelpText.tsx","../src/input/Label.tsx","../src/input/Item.tsx","../src/input/DateTime.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\nimport { type Status } from \"@/status\";\nimport { Text } from \"@/text\";\n\nimport \"@/input/HelpText.css\";\n\n/** Props for the {@link HelpText} component. */\nexport interface HelpTextProps extends Omit<Text.TextProps<\"small\">, \"level\" | \"ref\"> {\n variant?: Status.Variant;\n}\n\n/**\n * Help text for an input component. We generally recommend using Input.Item with a\n * 'helpText' prop instead of this component. This component is useful for low-level\n * control over the help text element.\n *\n * @param props - Props for the help text component. Unlisted props are passed to the\n * underlying text element.\n * @param props.variant - The variant of the help text.\n * \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\" | \"disabled\n * @default \"info\"\n */\nexport const HelpText = ({\n className,\n variant = \"error\",\n ...props\n}: HelpTextProps): ReactElement => (\n <Text.Text<\"small\">\n className={CSS(\n CSS.B(\"input-help-text\"),\n CSS.BM(\"input-help-text\", variant),\n className,\n )}\n level=\"small\"\n {...props}\n />\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type DetailedHTMLProps, type HTMLAttributes, type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\n\nimport \"@/input/Label.css\";\n\n/** Props for the {@link Label} component. */\nexport interface LabelProps\n extends DetailedHTMLProps<HTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {\n required?: boolean;\n}\n\n/**\n * A thin, styled wrapper for an input label. We generally recommend using Input.Item\n * with a 'label' prop instead of this component. This component is useful for\n * low-level control over the label element.\n *\n * @param props - Props for the label component. Unlisted props are passed to the\n * underlying label element.\n * @param props.required - Indicate whether the label is associated with a required\n * input.\n */\nexport const Label = ({\n className,\n required = false,\n children,\n ...props\n}: LabelProps): ReactElement => {\n return (\n <label className={CSS(CSS.B(\"input-label\"), className)} {...props}>\n {children} {required && <span className={CSS.B(\"required-indicator\")}>*</span>}\n </label>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { direction } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { HelpText } from \"@/input/HelpText\";\nimport { Label } from \"@/input/Label\";\n\nimport \"@/input/Item.css\";\nimport { status } from \"@/status/aether\";\n\nexport interface ItemProps extends Align.SpaceProps {\n label?: string;\n required?: boolean;\n showLabel?: boolean;\n helpText?: string;\n padHelpText?: boolean;\n helpTextVariant?: status.Variant;\n showHelpText?: boolean;\n}\n\nconst maybeDefaultAlignment = (\n align?: Align.Alignment,\n dir: direction.Crude = \"x\",\n): Align.Alignment => {\n if (align != null) return align;\n return direction.construct(dir) === \"y\" ? \"stretch\" : \"center\";\n};\n\nexport const Item = ({\n label,\n showLabel = true,\n helpText,\n direction = \"y\",\n className,\n children,\n required,\n align,\n size = \"small\",\n padHelpText = false,\n helpTextVariant,\n showHelpText = true,\n ...props\n}: ItemProps): ReactElement => {\n let inputAndHelp: ReactElement;\n if (showHelpText === false && showLabel === false) return <>{children}</>;\n if (direction === \"x\")\n inputAndHelp = (\n <Align.Space direction=\"y\" size=\"small\">\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n else\n inputAndHelp = (\n <Align.Space direction=\"y\" size={1 / 3}>\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n\n return (\n <Align.Space\n className={CSS(CSS.B(\"input-item\"), className)}\n direction={direction}\n size={size}\n align={maybeDefaultAlignment(align, direction)}\n {...props}\n >\n {showLabel && <Label required={required}>{label}</Label>}\n {inputAndHelp}\n </Align.Space>\n );\n};\n","// Copyright 2024 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement, useState } from \"react\";\n\nimport { TimeSpan, TimeStamp } from \"@synnaxlabs/x\";\n\nimport { Text } from \"@/input/Text\";\nimport { type BaseProps } from \"@/input/types\";\n\nexport interface DateTimeProps extends BaseProps<number> {}\n\nexport const DateTime = ({\n value,\n onChange,\n onBlur,\n ...props\n}: DateTimeProps): ReactElement => {\n const ts = new TimeStamp(value, \"UTC\");\n const [internalValue, setInternalValue] = useState(\n ts.fString(\"ISO\", \"local\").slice(0, -1),\n );\n const [valueIsValid, setValueIsValid] = useState(true);\n\n const handleChange = (next: string | number): void => {\n let nextStr = next.toString();\n setInternalValue(nextStr);\n\n let ts = new TimeStamp(next, \"UTC\");\n if (nextStr.length < 23) nextStr += \".000\";\n\n ts = ts.add(\n BigInt(\n TimeStamp.now().date().getTimezoneOffset() - ts.date().getTimezoneOffset(),\n ) * TimeSpan.MINUTE.valueOf(),\n );\n let ok = false;\n try {\n const str = ts.fString(\"ISO\", \"local\");\n ok = str.slice(0, -1) === nextStr;\n } catch (_) {\n console.error(\"e\");\n }\n if (!ok) {\n setValueIsValid(false);\n return;\n }\n onChange(Number(ts.valueOf()));\n setValueIsValid(true);\n };\n\n const handleBlur: React.FocusEventHandler<HTMLInputElement> = (e) => {\n setValueIsValid(true);\n setInternalValue(new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1));\n onBlur?.(e);\n };\n\n return (\n <Text\n type=\"datetime-local\"\n onBlur={handleBlur}\n required={false}\n value={\n valueIsValid\n ? new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1)\n : internalValue\n }\n onChange={handleChange}\n {...props}\n />\n );\n};\n"],"names":["jsx","Text.Text","CSS","jsxs","direction","Align.Space","TimeStamp","useState","ts","TimeSpan","Text"],"mappings":";;;;;;;AAiCO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,MACEA,2BAAA,kBAAA;AAAA,EAACC,OAAK;AAAA,EAAL;AAAA,IACC,WAAWC,IAAA;AAAA,MACTA,IAAA,IAAI,EAAE,iBAAiB;AAAA,MACvBA,QAAI,GAAG,mBAAmB,OAAO;AAAA,MACjC;AAAA,IACF;AAAA,IACA,OAAM;AAAA,IACL,GAAG;AAAA,EAAA;AACN;ACfK,MA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AA,IACF;AACA,aAAS,OAAOA,IAAG,QAAQ,CAAC,CAAC;AAC7B,oBAAgB,IAAI;AAAA,EAAA;AAGhB,QAAA,aAAwD,CAAC,MAAM;AACnE,oBAAgB,IAAI;AACpB,qBAAiB,IAAIF,WAAA,EAAU,OAAO,KAAK,EAAE,QAAQ,OAAO,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC;AACjF,qCAAS;AAAA,EAAC;AAIV,SAAAN,2BAAA,kBAAA;AAAA,IAACU,OAAA;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,OACE,eACI,IAAIJ,WAAA,EAAU,OAAO,KAAK,EAAE,QAAQ,OAAO,OAAO,EAAE,MAAM,GAAG,EAAE,IAC/D;AAAA,MAEN,UAAU;AAAA,MACT,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"external-CZli69bF.cjs","sources":["../src/input/HelpText.tsx","../src/input/Label.tsx","../src/input/Item.tsx","../src/input/DateTime.tsx"],"sourcesContent":["// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\nimport { type Status } from \"@/status\";\nimport { Text } from \"@/text\";\n\nimport \"@/input/HelpText.css\";\n\n/** Props for the {@link HelpText} component. */\nexport interface HelpTextProps extends Omit<Text.TextProps<\"small\">, \"level\" | \"ref\"> {\n variant?: Status.Variant;\n}\n\n/**\n * Help text for an input component. We generally recommend using Input.Item with a\n * 'helpText' prop instead of this component. This component is useful for low-level\n * control over the help text element.\n *\n * @param props - Props for the help text component. Unlisted props are passed to the\n * underlying text element.\n * @param props.variant - The variant of the help text.\n * \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\" | \"disabled\n * @default \"info\"\n */\nexport const HelpText = ({\n className,\n variant = \"error\",\n ...props\n}: HelpTextProps): ReactElement => (\n <Text.Text<\"small\">\n className={CSS(\n CSS.B(\"input-help-text\"),\n CSS.BM(\"input-help-text\", variant),\n className,\n )}\n level=\"small\"\n {...props}\n />\n);\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type DetailedHTMLProps, type HTMLAttributes, type ReactElement } from \"react\";\n\nimport { CSS } from \"@/css\";\n\nimport \"@/input/Label.css\";\n\n/** Props for the {@link Label} component. */\nexport interface LabelProps\n extends DetailedHTMLProps<HTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {\n required?: boolean;\n}\n\n/**\n * A thin, styled wrapper for an input label. We generally recommend using Input.Item\n * with a 'label' prop instead of this component. This component is useful for\n * low-level control over the label element.\n *\n * @param props - Props for the label component. Unlisted props are passed to the\n * underlying label element.\n * @param props.required - Indicate whether the label is associated with a required\n * input.\n */\nexport const Label = ({\n className,\n required = false,\n children,\n ...props\n}: LabelProps): ReactElement => {\n return (\n <label className={CSS(CSS.B(\"input-label\"), className)} {...props}>\n {children} {required && <span className={CSS.B(\"required-indicator\")}>*</span>}\n </label>\n );\n};\n","// Copyright 2023 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement } from \"react\";\n\nimport { direction } from \"@synnaxlabs/x\";\n\nimport { Align } from \"@/align\";\nimport { CSS } from \"@/css\";\nimport { HelpText } from \"@/input/HelpText\";\nimport { Label } from \"@/input/Label\";\n\nimport \"@/input/Item.css\";\nimport { status } from \"@/status/aether\";\n\nexport interface ItemProps extends Align.SpaceProps {\n label?: string;\n required?: boolean;\n showLabel?: boolean;\n helpText?: string;\n padHelpText?: boolean;\n helpTextVariant?: status.Variant;\n showHelpText?: boolean;\n}\n\nconst maybeDefaultAlignment = (\n align?: Align.Alignment,\n dir: direction.Crude = \"x\",\n): Align.Alignment => {\n if (align != null) return align;\n return direction.construct(dir) === \"y\" ? \"stretch\" : \"center\";\n};\n\nexport const Item = ({\n label,\n showLabel = true,\n helpText,\n direction = \"y\",\n className,\n children,\n required,\n align,\n size = \"small\",\n padHelpText = false,\n helpTextVariant,\n showHelpText = true,\n ...props\n}: ItemProps): ReactElement => {\n let inputAndHelp: ReactElement;\n if (showHelpText === false && showLabel === false) return <>{children}</>;\n if (direction === \"x\")\n inputAndHelp = (\n <Align.Space direction=\"y\" size=\"small\">\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n else\n inputAndHelp = (\n <Align.Space direction=\"y\" size={1 / 3}>\n {children}\n {(padHelpText || (helpText != null && helpText.length > 0)) && (\n <HelpText variant={helpTextVariant}>{helpText}</HelpText>\n )}\n </Align.Space>\n );\n\n return (\n <Align.Space\n className={CSS(CSS.B(\"input-item\"), className)}\n direction={direction}\n size={size}\n align={maybeDefaultAlignment(align, direction)}\n {...props}\n >\n {showLabel && <Label required={required}>{label}</Label>}\n {inputAndHelp}\n </Align.Space>\n );\n};\n","// Copyright 2024 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { type ReactElement, useState } from \"react\";\n\nimport { TimeSpan, TimeStamp } from \"@synnaxlabs/x\";\n\nimport { Text } from \"@/input/Text\";\nimport { type BaseProps } from \"@/input/types\";\n\nexport interface DateTimeProps extends BaseProps<number> {}\n\nexport const DateTime = ({\n value,\n onChange,\n onBlur,\n ...props\n}: DateTimeProps): ReactElement => {\n const ts = new TimeStamp(value, \"UTC\");\n const [internalValue, setInternalValue] = useState(\n ts.fString(\"ISO\", \"local\").slice(0, -1),\n );\n const [valueIsValid, setValueIsValid] = useState(true);\n\n const handleChange = (next: string | number): void => {\n let nextStr = next.toString();\n setInternalValue(nextStr);\n\n let ts = new TimeStamp(next, \"UTC\");\n if (nextStr.length < 23) nextStr += \".000\";\n\n ts = ts.add(\n BigInt(\n TimeStamp.now().date().getTimezoneOffset() - ts.date().getTimezoneOffset(),\n ) * TimeSpan.MINUTE.valueOf(),\n );\n let ok = false;\n try {\n const str = ts.fString(\"ISO\", \"local\");\n ok = str.slice(0, -1) === nextStr;\n } catch (_) {\n console.error(\"e\");\n }\n if (!ok) {\n setValueIsValid(false);\n return;\n }\n onChange(Number(ts.valueOf()));\n setValueIsValid(true);\n };\n\n const handleBlur: React.FocusEventHandler<HTMLInputElement> = (e) => {\n setValueIsValid(true);\n setInternalValue(new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1));\n onBlur?.(e);\n };\n\n return (\n <Text\n type=\"datetime-local\"\n onBlur={handleBlur}\n required={false}\n value={\n valueIsValid\n ? new TimeStamp(value, \"UTC\").fString(\"ISO\", \"local\").slice(0, -1)\n : internalValue\n }\n onChange={handleChange}\n {...props}\n />\n );\n};\n"],"names":["jsx","Text.Text","CSS","jsxs","direction","Align.Space","TimeStamp","useState","ts","TimeSpan","Text"],"mappings":";;;;;;;AAiCO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,MACEA,2BAAA,kBAAA;AAAA,EAACC,OAAK;AAAA,EAAL;AAAA,IACC,WAAWC,IAAA;AAAA,MACTA,IAAA,IAAI,EAAE,iBAAiB;AAAA,MACvBA,QAAI,GAAG,mBAAmB,OAAO;AAAA,MACjC;AAAA,IACF;AAAA,IACA,O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