azeriand-library 1.8.2 → 1.9.1

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.
@@ -0,0 +1,7 @@
1
+ type DropdownButtonProps = {
2
+ children: React.ReactNode;
3
+ open: boolean;
4
+ toggle: () => void;
5
+ };
6
+ export declare function DropdownButton({ children, open, toggle }: DropdownButtonProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ type DropdownProps = {
2
+ buttonText?: string;
3
+ options?: string[];
4
+ onSelected?: (option: string) => void;
5
+ };
6
+ export declare function Dropdown({ buttonText, options, onSelected }: DropdownProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
package/dist/index.d.ts CHANGED
@@ -7,3 +7,5 @@ export { SectionName } from './components/section-name/section-name';
7
7
  export { Input } from './components/input/input';
8
8
  export { Calendar } from './components/calendar/calendar';
9
9
  export { ThemeContext, ThemeContextComponent } from './components/theme-context';
10
+ export { Dropdown } from './components/dropdown/dropdown';
11
+ export { DropdownButton } from './components/dropdown/dropdown-button';
package/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@
3
3
  try {
4
4
  if (typeof document != "undefined") {
5
5
  var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode(".card{\n /* border-radius: 20px; */\n color: var(--card-text-color, white);\n}\n\n.card.glass{\n background-color: color-mix(in oklch, var(--glass-color), transparent 80%);\n border: 1px solid color-mix(in oklch, var(--glass-color), transparent 40%);\n -webkit-backface-visibility: hidden;\n -webkit-perspective: 1000;\n -webkit-transform: translate3d(0,0,0);\n -webkit-transform: translateZ(0);\n backface-visibility: hidden;\n perspective: 1000;\n transform: translate3d(0,0,0);\n transform: translateZ(0);\n}\n\n.card.mate{\n background-color: var(--glass-color);\n}\n\n.card.outlined{\n border: solid white 2px;\n}\n\nbutton .card.ghost:hover, button .card.outlined:hover{\n background: color-mix(in oklch, var(--glass-color), transparent 80%);\n}\n\nbutton .card.glass:hover{\n box-shadow: 0 4px 10px color-mix(in oklch, var(--glass-color), transparent 85%);\n}\n\nbutton .card.mate:hover{\n background-color: color-mix(in oklch, var(--glass-color), white 10%) \n}\nbutton{\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n cursor: pointer;\n outline: inherit;\n font-weight: bold;\n}\n\nbutton:focus {\n outline: revert;\n}\n.section-name{\n color: hsla(0, 0%, 100%, 0.7);\n}input:disabled{\n color: hsla(0, 0%, 100%, 0.5);\n font-weight: bold;\n}\n\ninput::-moz-placeholder{\n color: hsla(0, 0%, 100%, 0.5);\n \n}\n\ninput::placeholder{\n color: hsla(0, 0%, 100%, 0.5);\n \n}\n\ninput::-webkit-outer-spin-button,\ninput::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput:focus{\n outline: none;\n}.MuiDateCalendar-root{\n color: white;\n}"));
6
+ elementStyle.appendChild(document.createTextNode(".card{\n /* border-radius: 20px; */\n color: var(--card-text-color, white);\n}\n\n.card.glass{\n background-color: color-mix(in oklch, var(--glass-color), transparent 80%);\n border: 1px solid color-mix(in oklch, var(--glass-color), transparent 40%);\n -webkit-backface-visibility: hidden;\n -webkit-perspective: 1000;\n -webkit-transform: translate3d(0,0,0);\n -webkit-transform: translateZ(0);\n backface-visibility: hidden;\n perspective: 1000;\n transform: translate3d(0,0,0);\n transform: translateZ(0);\n}\n\n.card.mate{\n background-color: var(--glass-color);\n}\n\n.card.outlined{\n border: solid white 2px;\n}\n\nbutton .card.ghost:hover, button .card.outlined:hover{\n background: color-mix(in oklch, var(--glass-color), transparent 80%);\n}\n\nbutton .card.glass:hover{\n box-shadow: 0 4px 10px color-mix(in oklch, var(--glass-color), transparent 85%);\n}\n\nbutton .card.mate:hover{\n background-color: color-mix(in oklch, var(--glass-color), white 10%) \n}\nbutton{\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n cursor: pointer;\n outline: inherit;\n font-weight: bold;\n}\n\nbutton:focus {\n outline: revert;\n}\n.section-name{\n color: hsla(0, 0%, 100%, 0.7);\n}input:disabled{\n color: hsla(0, 0%, 100%, 0.5);\n font-weight: bold;\n}\n\ninput::-moz-placeholder{\n color: hsla(0, 0%, 100%, 0.5);\n \n}\n\ninput::placeholder{\n color: hsla(0, 0%, 100%, 0.5);\n \n}\n\ninput::-webkit-outer-spin-button,\ninput::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput:focus{\n outline: none;\n}.MuiDateCalendar-root{\n color: white;\n}.dropdown-content{\n box-shadow: rgba(149, 157, 165, 0.2)\n 0px 8px 24px;\n max-height: 40%vh;\n scrollbar-width: none;\n -ms-overflow-style: none;\n z-index: 10;\n}\n\n.dropdown-content::-webkit-scrollbar{\n width: 0;\n height: 0;\n}\n\n.dropdown-item:hover{\n background-color: rgb(240, 249, 255);\n}.button-open{\n border: rgb(147, 197, 253) 2px solid;\n}"));
7
7
  document.head.appendChild(elementStyle);
8
8
  }
9
9
  } catch (e) {
@@ -15892,6 +15892,12 @@ function IconBase(props) {
15892
15892
  function FaCheck(props) {
15893
15893
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" }, "child": [] }] })(props);
15894
15894
  }
15895
+ function FaChevronDown(props) {
15896
+ return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }, "child": [] }] })(props);
15897
+ }
15898
+ function FaChevronUp(props) {
15899
+ return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z" }, "child": [] }] })(props);
15900
+ }
15895
15901
  function Checkbox({ label, checkedDefault = false, onChange }) {
15896
15902
  const [checked, setChecked] = useState(checkedDefault);
15897
15903
  function checkboxClicked() {
@@ -15956,6 +15962,28 @@ function Calendar({ selectedDates, ...cardProps }) {
15956
15962
  }
15957
15963
  ) }) });
15958
15964
  }
15965
+ function DropdownButton({ children, open, toggle }) {
15966
+ return /* @__PURE__ */ jsxs(Button, { onClick: toggle, className: `cursor-pointer ${open ? "button-open" : null}`, children: [
15967
+ children,
15968
+ /* @__PURE__ */ jsx$1("span", { className: "flex items-center content-center ml-[1rem]", children: open ? /* @__PURE__ */ jsx$1(FaChevronUp, {}) : /* @__PURE__ */ jsx$1(FaChevronDown, {}) })
15969
+ ] });
15970
+ }
15971
+ function Dropdown({ buttonText, options = [], onSelected }) {
15972
+ const [open, setOpen] = useState(false);
15973
+ const [optionSelected, setOptionSelected] = useState(buttonText);
15974
+ const toggleDropdown = () => {
15975
+ setOpen((open2) => !open2);
15976
+ };
15977
+ const itemClicked = (option) => {
15978
+ setOptionSelected(option);
15979
+ onSelected == null ? void 0 : onSelected(option);
15980
+ setOpen(false);
15981
+ };
15982
+ return /* @__PURE__ */ jsxs("div", { tabIndex: 0, className: "relative w-fit", onBlur: () => setOpen(false), children: [
15983
+ /* @__PURE__ */ jsx$1(DropdownButton, { toggle: toggleDropdown, open, children: optionSelected }),
15984
+ open && /* @__PURE__ */ jsx$1(Card, { noBlur: true, appearance: "mate", className: "absolute flex flex-col items-center p-[1rem] mt-[0.5rem] bg-white rounded-lg overflow-y-scroll dropdown-content", children: options.map((option) => /* @__PURE__ */ jsx$1("div", { className: "p-[0.5rem] m-[0.1rem] w-full rounded-lg cursor-pointer", onMouseDown: () => itemClicked(option), children: option }, option)) })
15985
+ ] });
15986
+ }
15959
15987
  export {
15960
15988
  Avatar,
15961
15989
  Badge,
@@ -15963,6 +15991,8 @@ export {
15963
15991
  Calendar,
15964
15992
  Card,
15965
15993
  Checkbox,
15994
+ Dropdown,
15995
+ DropdownButton,
15966
15996
  Input,
15967
15997
  SectionName,
15968
15998
  ThemeContext,