@ews-admin/global-design-system 1.1.6 → 1.1.8

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 (48) hide show
  1. package/dist/components/Input/Input.d.ts +4 -0
  2. package/dist/components/Input/Input.d.ts.map +1 -1
  3. package/dist/components/Logo/Logo.d.ts +1 -1
  4. package/dist/components/Logo/Logo.d.ts.map +1 -1
  5. package/dist/components/MultiSearchAutocomplete/MultiSearchAutocomplete.d.ts +1 -1
  6. package/dist/components/MultiSearchAutocomplete/MultiSearchAutocomplete.d.ts.map +1 -1
  7. package/dist/components/Select/Select.d.ts +91 -0
  8. package/dist/components/Select/Select.d.ts.map +1 -0
  9. package/dist/components/Select/index.d.ts +3 -0
  10. package/dist/components/Select/index.d.ts.map +1 -0
  11. package/dist/components/ThemeDebugger/ThemeDebugger.d.ts +6 -0
  12. package/dist/components/ThemeDebugger/ThemeDebugger.d.ts.map +1 -0
  13. package/dist/components/ThemeDebugger/index.d.ts +3 -0
  14. package/dist/components/ThemeDebugger/index.d.ts.map +1 -0
  15. package/dist/hooks/index.d.ts +2 -0
  16. package/dist/hooks/index.d.ts.map +1 -1
  17. package/dist/hooks/useSelectField.d.ts +16 -0
  18. package/dist/hooks/useSelectField.d.ts.map +1 -0
  19. package/dist/icons/ArrowRightIcon.d.ts +4 -0
  20. package/dist/icons/ArrowRightIcon.d.ts.map +1 -0
  21. package/dist/icons/CheckIcon.d.ts +4 -0
  22. package/dist/icons/CheckIcon.d.ts.map +1 -0
  23. package/dist/icons/EyeIcon.d.ts +4 -0
  24. package/dist/icons/EyeIcon.d.ts.map +1 -0
  25. package/dist/icons/EyeOffIcon.d.ts +4 -0
  26. package/dist/icons/EyeOffIcon.d.ts.map +1 -0
  27. package/dist/icons/SearchIcon.d.ts +4 -0
  28. package/dist/icons/SearchIcon.d.ts.map +1 -0
  29. package/dist/index.css +2 -2
  30. package/dist/index.d.ts +118 -4
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.esm.css +2 -2
  33. package/dist/index.esm.js +763 -10
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/index.js +764 -8
  36. package/dist/index.js.map +1 -1
  37. package/package.json +7 -6
  38. package/src/components/Input/Input.tsx +10 -4
  39. package/src/components/Logo/Logo.tsx +1 -1
  40. package/src/components/MultiSearchAutocomplete/MultiSearchAutocomplete.tsx +1 -1
  41. package/src/components/Select/Select.tsx +553 -0
  42. package/src/components/Select/index.ts +2 -0
  43. package/src/components/ThemeDebugger/ThemeDebugger.tsx +101 -0
  44. package/src/components/ThemeDebugger/index.ts +2 -0
  45. package/src/hooks/index.ts +2 -0
  46. package/src/hooks/useSelectField.ts +53 -0
  47. package/src/index.ts +8 -1
  48. package/src/styles/index.css +49 -0
@@ -0,0 +1,101 @@
1
+ import React from "react";
2
+ import { useTheme } from "../../theme/ThemeProvider";
3
+
4
+ export interface ThemeDebuggerProps {
5
+ className?: string;
6
+ }
7
+
8
+ export const ThemeDebugger: React.FC<ThemeDebuggerProps> = ({
9
+ className = "",
10
+ }) => {
11
+ const { theme, themeConfig, setTheme } = useTheme();
12
+
13
+ const getComputedStyleValue = (property: string) => {
14
+ if (typeof window !== "undefined") {
15
+ return getComputedStyle(document.documentElement).getPropertyValue(
16
+ property
17
+ );
18
+ }
19
+ return "N/A";
20
+ };
21
+
22
+ return (
23
+ <div className={`p-4 border rounded-lg bg-gray-50 ${className}`}>
24
+ <h3 className="text-lg font-semibold mb-4">Theme Debugger</h3>
25
+
26
+ <div className="space-y-3">
27
+ <div>
28
+ <strong>Current Theme:</strong> {theme}
29
+ </div>
30
+
31
+ <div>
32
+ <strong>Theme Config:</strong>
33
+ <pre className="text-xs bg-gray-100 p-2 rounded mt-1">
34
+ {JSON.stringify(themeConfig, null, 2)}
35
+ </pre>
36
+ </div>
37
+
38
+ <div>
39
+ <strong>CSS Variables:</strong>
40
+ <div className="text-xs space-y-1 mt-1">
41
+ <div>--ews-primary: {getComputedStyleValue("--ews-primary")}</div>
42
+ <div>
43
+ --ews-secondary: {getComputedStyleValue("--ews-secondary")}
44
+ </div>
45
+ <div>
46
+ --ews-primary-hover:{" "}
47
+ {getComputedStyleValue("--ews-primary-hover")}
48
+ </div>
49
+ <div>
50
+ --ews-secondary-hover:{" "}
51
+ {getComputedStyleValue("--ews-secondary-hover")}
52
+ </div>
53
+ </div>
54
+ </div>
55
+
56
+ <div>
57
+ <strong>Data Theme Attribute:</strong>{" "}
58
+ {document.documentElement.getAttribute("data-theme")}
59
+ </div>
60
+
61
+ <div className="flex space-x-2">
62
+ <button
63
+ onClick={() => setTheme("PROMED")}
64
+ className={`px-3 py-1 text-xs rounded ${
65
+ theme === "PROMED"
66
+ ? "bg-ews-primary text-white"
67
+ : "bg-gray-200 text-gray-700"
68
+ }`}
69
+ >
70
+ PROMED
71
+ </button>
72
+ <button
73
+ onClick={() => setTheme("MED")}
74
+ className={`px-3 py-1 text-xs rounded ${
75
+ theme === "MED"
76
+ ? "bg-ews-primary text-white"
77
+ : "bg-gray-200 text-gray-700"
78
+ }`}
79
+ >
80
+ MED
81
+ </button>
82
+ </div>
83
+
84
+ <div className="grid grid-cols-2 gap-2 mt-4">
85
+ <div className="bg-ews-primary text-white p-2 rounded text-center">
86
+ Primary
87
+ </div>
88
+ <div className="bg-ews-secondary text-white p-2 rounded text-center">
89
+ Secondary
90
+ </div>
91
+ <div className="bg-ews-success text-white p-2 rounded text-center">
92
+ Success
93
+ </div>
94
+ <div className="bg-ews-warning text-white p-2 rounded text-center">
95
+ Warning
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ );
101
+ };
@@ -0,0 +1,2 @@
1
+ export { ThemeDebugger } from "./ThemeDebugger";
2
+ export type { ThemeDebuggerProps } from "./ThemeDebugger";
@@ -1 +1,3 @@
1
1
  export { useDebounce, useDebouncedCallback } from "./useDebounce";
2
+ export { useSelectField } from "./useSelectField";
3
+ export type { UseSelectFieldProps } from "./useSelectField";
@@ -0,0 +1,53 @@
1
+ import {
2
+ Control,
3
+ FieldPath,
4
+ FieldValues,
5
+ useController,
6
+ } from "react-hook-form";
7
+ import { SelectOption, SelectProps } from "../components/Select";
8
+
9
+ export interface UseSelectFieldProps<
10
+ TFieldValues extends FieldValues = FieldValues,
11
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
12
+ > {
13
+ name: TName;
14
+ control: Control<TFieldValues>;
15
+ options: SelectOption[];
16
+ rules?: any;
17
+ defaultValue?: any;
18
+ }
19
+
20
+ export function useSelectField<
21
+ TFieldValues extends FieldValues = FieldValues,
22
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
23
+ >({
24
+ name,
25
+ control,
26
+ options: _options,
27
+ rules,
28
+ defaultValue,
29
+ }: UseSelectFieldProps<TFieldValues, TName>) {
30
+ const {
31
+ field,
32
+ fieldState: { error, invalid },
33
+ } = useController({
34
+ name,
35
+ control,
36
+ rules,
37
+ defaultValue,
38
+ });
39
+
40
+ const selectProps: Omit<SelectProps, "options"> = {
41
+ value: field.value,
42
+ onChange: (value) => field.onChange(value),
43
+ isError: invalid,
44
+ error: error?.message,
45
+ };
46
+
47
+ return {
48
+ selectProps,
49
+ field,
50
+ error,
51
+ invalid,
52
+ };
53
+ }
package/src/index.ts CHANGED
@@ -5,6 +5,9 @@ export type { ButtonProps } from "./components/Button";
5
5
  export { Input } from "./components/Input";
6
6
  export type { InputProps } from "./components/Input";
7
7
 
8
+ export { Select } from "./components/Select";
9
+ export type { SelectOption, SelectProps } from "./components/Select";
10
+
8
11
  export { SearchAutocomplete } from "./components/SearchAutocomplete";
9
12
  export type { SearchableEntity } from "./components/SearchAutocomplete";
10
13
 
@@ -19,6 +22,9 @@ export type { LogoProps } from "./components/Logo";
19
22
  export { ThemeToggle } from "./components/ThemeToggle";
20
23
  export type { ThemeToggleProps } from "./components/ThemeToggle";
21
24
 
25
+ export { ThemeDebugger } from "./components/ThemeDebugger";
26
+ export type { ThemeDebuggerProps } from "./components/ThemeDebugger";
27
+
22
28
  // Molecules
23
29
  export { SpecialtySearchAutocomplete } from "./molecules";
24
30
  export type { Specialty, SpecialtySearchAutocompleteProps } from "./molecules";
@@ -39,7 +45,8 @@ export type { IconProps, SimpleIconProps } from "./icons";
39
45
  export { cn, debounce, formatCurrency, formatDate, generateId } from "./utils";
40
46
 
41
47
  // Hooks
42
- export { useDebounce, useDebouncedCallback } from "./hooks";
48
+ export { useDebounce, useDebouncedCallback, useSelectField } from "./hooks";
49
+ export type { UseSelectFieldProps } from "./hooks";
43
50
 
44
51
  // Theme
45
52
  export { ThemeProvider, useTheme } from "./theme/ThemeProvider";
@@ -4,6 +4,55 @@
4
4
  @tailwind components;
5
5
  @tailwind utilities;
6
6
 
7
+ /* Override browser default focus styles */
8
+ *:focus {
9
+ outline: none !important;
10
+ }
11
+
12
+ /* Ensure custom focus styles for all interactive elements */
13
+ button:focus,
14
+ input:focus,
15
+ select:focus,
16
+ textarea:focus,
17
+ [tabindex]:focus {
18
+ outline: none !important;
19
+ }
20
+
21
+ /* Custom Select component focus override */
22
+ .ews-select-trigger:focus {
23
+ outline: none !important;
24
+ box-shadow: 0 0 0 2px var(--ews-primary) !important;
25
+ border-color: var(--ews-primary) !important;
26
+ }
27
+
28
+ .ews-select-trigger:focus-visible {
29
+ outline: none !important;
30
+ box-shadow: 0 0 0 2px var(--ews-primary) !important;
31
+ border-color: var(--ews-primary) !important;
32
+ }
33
+
34
+ /* Force override any blue focus styles */
35
+ .ews-select-trigger:focus,
36
+ .ews-select-trigger:focus-visible,
37
+ .ews-select-trigger:focus-within {
38
+ outline: none !important;
39
+ border: 1px solid var(--ews-primary) !important;
40
+ box-shadow: 0 0 0 2px var(--ews-primary) !important;
41
+ }
42
+
43
+ /* Override any browser default blue focus */
44
+ *:focus {
45
+ outline: none !important;
46
+ box-shadow: none !important;
47
+ }
48
+
49
+ /* Specific override for div elements with tabindex */
50
+ div[tabindex]:focus {
51
+ outline: none !important;
52
+ box-shadow: 0 0 0 2px var(--ews-primary) !important;
53
+ border-color: var(--ews-primary) !important;
54
+ }
55
+
7
56
  :root {
8
57
  /* Colors */
9
58
  --ews-primary: #21596c;