karsten-design-system 1.2.33 → 1.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from './stories/components/input';
19
19
  export * from './stories/components/inputSwitch';
20
20
  export * from './stories/components/inputTextArea';
21
21
  export * from './stories/components/internalMenu';
22
+ export * from './stories/components/languageDropdown';
22
23
  export * from './stories/components/link';
23
24
  export * from './stories/components/megaMenu';
24
25
  export * from './stories/components/modal';
package/dist/index.js CHANGED
@@ -693,6 +693,49 @@ function InternalMenu({ item, isFiltering }) {
693
693
  }) }));
694
694
  }
695
695
 
696
+ const languageOptions = [
697
+ {
698
+ code: 'pt',
699
+ label: 'PT',
700
+ icon: (jsx("img", { src: "./src/assets/flags/br.svg", alt: "Brasil", className: "inline-block w-5 h-5 mr-1 rounded-full" })),
701
+ },
702
+ {
703
+ code: 'en',
704
+ label: 'EN',
705
+ icon: (jsx("img", { src: "./src/assets/flags/us.svg", alt: "Estados Unidos", className: "inline-block w-5 h-5 mr-1 rounded-full" })),
706
+ },
707
+ {
708
+ code: 'es',
709
+ label: 'ES',
710
+ icon: (jsx("img", { src: "./src/assets/flags/es.svg", alt: "Espanha", className: "inline-block w-5 h-5 mr-1 rounded-full" })),
711
+ },
712
+ ];
713
+
714
+ function LanguageDropdown({ selected, onChange, }) {
715
+ const [open, setOpen] = useState(false);
716
+ const ref = useRef(null);
717
+ useEffect(() => {
718
+ function handleClickOutside(event) {
719
+ if (ref.current && !ref.current.contains(event.target)) {
720
+ setOpen(false);
721
+ }
722
+ }
723
+ document.addEventListener('mousedown', handleClickOutside);
724
+ return () => document.removeEventListener('mousedown', handleClickOutside);
725
+ }, []);
726
+ return (jsxs("div", { ref: ref, className: "relative inline-block", children: [jsxs("button", { type: "button", className: clsx('p-2 rounded-md cursor-pointer hover:bg-light-300 dark:hover:bg-dark-400'), onClick: () => setOpen(!open), "aria-haspopup": "listbox", "aria-expanded": open, "aria-label": "Selecionar idioma", children: [selected.icon ?? jsx("span", { className: "pi pi-globe text-lg" }), jsx("span", { className: "sr-only", children: selected.label })] }), open && (jsx("div", { className: clsx('absolute right-0 mt-2 w-40 rounded-md border border-light-700 bg-light-500 p-2 dark:bg-dark-100 shadow-md z-40'), role: "listbox", children: jsx("ul", { children: languageOptions.map((option) => (jsxs("li", { className: clsx('p-2 cursor-pointer rounded hover:bg-light-300 hover:font-bold dark:bg-dark-100 dark:text-light-500 dark:hover:bg-dark-400 mt-1', option.code === selected.code &&
727
+ 'font-bold bg-light-300 dark:bg-dark-400'), role: "option", "aria-selected": option.code === selected.code, tabIndex: 0, onClick: () => {
728
+ onChange(option);
729
+ setOpen(false);
730
+ }, onKeyDown: (e) => {
731
+ if (e.key === 'Enter' || e.key === ' ') {
732
+ e.preventDefault();
733
+ onChange(option);
734
+ setOpen(false);
735
+ }
736
+ }, children: [option.icon && (jsx("span", { className: "mr-2 inline-block align-middle", children: option.icon })), jsx("span", { children: option.label })] }, option.code))) }) }))] }));
737
+ }
738
+
696
739
  function Link({ href, children, className }) {
697
740
  return (jsx("a", { href: href, className: `text-primary hover:underline font-bold font-roboto dark:text-light-500 ${className}`, children: children }));
698
741
  }
@@ -4662,5 +4705,5 @@ function Toast({ messages }) {
4662
4705
  : ''), "aria-label": "toast", children: [severity === 'success' && jsx(SuccessIcon, {}), severity === 'info' && jsx(InfoIcon, {}), severity === 'error' && jsx(ErrorIcon, {}), jsxs("div", { children: [jsx("strong", { children: summary }), jsx("p", { children: detail })] })] }, id))) }));
4663
4706
  }
4664
4707
 
4665
- export { Accordion, BasicHeader, Breadcrumb, Button, CalendarInput, Card, CardButton, CardIconsButton, Charts, Divider, EmptyContent, ExpandablePanel, FileUpload, Header, IconButton, InfoCard, Input, InputSwitch, InputTextArea, InternalMenu, Link, MegaMenu, Modal, ModalForm, MultiSelect, NotificationsSidebar, Paginator, RadioButton, RightSidebar, Select, Sidebar, Skeleton, Spinner, Table, Tabs, TagStatus, Toast, Tooltip };
4708
+ export { Accordion, BasicHeader, Breadcrumb, Button, CalendarInput, Card, CardButton, CardIconsButton, Charts, Divider, EmptyContent, ExpandablePanel, FileUpload, Header, IconButton, InfoCard, Input, InputSwitch, InputTextArea, InternalMenu, LanguageDropdown, Link, MegaMenu, Modal, ModalForm, MultiSelect, NotificationsSidebar, Paginator, RadioButton, RightSidebar, Select, Sidebar, Skeleton, Spinner, Table, Tabs, TagStatus, Toast, Tooltip };
4666
4709
  //# sourceMappingURL=index.js.map