@ews-admin/global-design-system 1.7.0 → 1.9.0

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.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
+ var reactHookForm = require('react-hook-form');
5
6
 
6
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
7
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
7
8
 
8
9
  const LOCAL_PORTS = {
9
10
  bff: 8082,
@@ -64,7 +65,7 @@ function createEnvConfig(env, overrides) {
64
65
  * Available country codes supported by the platform
65
66
  */
66
67
  const COUNTRY_CODES = [
67
- { code: "+221", country: "SN" },
68
+ { code: "+221", country: "SN" }, // Senegal
68
69
  { code: "+235", country: "TD" }, // Chad
69
70
  ];
70
71
  /**
@@ -32608,11 +32609,11 @@ const Input = React.forwardRef(({ className, variant = "default", size = "md", l
32608
32609
  if (label) {
32609
32610
  // Render checkbox with built-in label
32610
32611
  return (jsxRuntime.jsx("div", { className: cn("space-y-1", fullWidth ? "w-full" : "w-auto"), children: jsxRuntime.jsxs("div", { className: "flex items-start space-x-3", children: [jsxRuntime.jsx("input", { id: inputId, type: actualType, className: cn("mt-0.5", // Slight top margin to align with first line of text
32611
- className), ref: ref, ...props }), jsxRuntime.jsxs("div", { className: "flex-1", children: [jsxRuntime.jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium cursor-pointer text-ews-gray-700", children: [label, required && jsxRuntime.jsx("span", { className: "ml-1 text-ews-error", children: "*" })] }), (error || helperText) && (jsxRuntime.jsx("p", { className: cn("mt-1 text-sm", error ? "text-ews-error" : "text-ews-gray-500"), children: error || helperText }))] })] }) }));
32612
+ className), ref: ref, onChange: onChange, onBlur: onBlur, ...props }), jsxRuntime.jsxs("div", { className: "flex-1", children: [jsxRuntime.jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium cursor-pointer text-ews-gray-700", children: [label, required && jsxRuntime.jsx("span", { className: "ml-1 text-ews-error", children: "*" })] }), (error || helperText) && (jsxRuntime.jsx("p", { className: cn("mt-1 text-sm", error ? "text-ews-error" : "text-ews-gray-500"), children: error || helperText }))] })] }) }));
32612
32613
  }
32613
32614
  else {
32614
32615
  // Render just the checkbox for external label usage
32615
- return (jsxRuntime.jsx("input", { id: inputId, type: actualType, className: cn(className), ref: ref, ...props }));
32616
+ return (jsxRuntime.jsx("input", { id: inputId, type: actualType, className: cn(className), ref: ref, onChange: onChange, onBlur: onBlur, ...props }));
32616
32617
  }
32617
32618
  }
32618
32619
  // Default rendering for non-checkbox inputs
@@ -32907,545 +32908,8 @@ function useDebouncedCallback(callback, delay) {
32907
32908
  return debouncedCallback;
32908
32909
  }
32909
32910
 
32910
- var isCheckBoxInput = (element) => element.type === 'checkbox';
32911
-
32912
- var isDateObject = (value) => value instanceof Date;
32913
-
32914
- var isNullOrUndefined = (value) => value == null;
32915
-
32916
- const isObjectType = (value) => typeof value === 'object';
32917
- var isObject = (value) => !isNullOrUndefined(value) &&
32918
- !Array.isArray(value) &&
32919
- isObjectType(value) &&
32920
- !isDateObject(value);
32921
-
32922
- var getEventValue = (event) => isObject(event) && event.target
32923
- ? isCheckBoxInput(event.target)
32924
- ? event.target.checked
32925
- : event.target.value
32926
- : event;
32927
-
32928
- var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
32929
-
32930
- var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
32931
-
32932
- var isPlainObject = (tempObject) => {
32933
- const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
32934
- return (isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf'));
32935
- };
32936
-
32937
- var isWeb = typeof window !== 'undefined' &&
32938
- typeof window.HTMLElement !== 'undefined' &&
32939
- typeof document !== 'undefined';
32940
-
32941
- function cloneObject(data) {
32942
- let copy;
32943
- const isArray = Array.isArray(data);
32944
- const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
32945
- if (data instanceof Date) {
32946
- copy = new Date(data);
32947
- }
32948
- else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
32949
- (isArray || isObject(data))) {
32950
- copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
32951
- if (!isArray && !isPlainObject(data)) {
32952
- copy = data;
32953
- }
32954
- else {
32955
- for (const key in data) {
32956
- if (data.hasOwnProperty(key)) {
32957
- copy[key] = cloneObject(data[key]);
32958
- }
32959
- }
32960
- }
32961
- }
32962
- else {
32963
- return data;
32964
- }
32965
- return copy;
32966
- }
32967
-
32968
- var isKey = (value) => /^\w*$/.test(value);
32969
-
32970
- var isUndefined = (val) => val === undefined;
32971
-
32972
- var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
32973
-
32974
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
32975
-
32976
- var get = (object, path, defaultValue) => {
32977
- if (!path || !isObject(object)) {
32978
- return defaultValue;
32979
- }
32980
- const result = (isKey(path) ? [path] : stringToPath(path)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
32981
- return isUndefined(result) || result === object
32982
- ? isUndefined(object[path])
32983
- ? defaultValue
32984
- : object[path]
32985
- : result;
32986
- };
32987
-
32988
- var isBoolean = (value) => typeof value === 'boolean';
32989
-
32990
- var set = (object, path, value) => {
32991
- let index = -1;
32992
- const tempPath = isKey(path) ? [path] : stringToPath(path);
32993
- const length = tempPath.length;
32994
- const lastIndex = length - 1;
32995
- while (++index < length) {
32996
- const key = tempPath[index];
32997
- let newValue = value;
32998
- if (index !== lastIndex) {
32999
- const objValue = object[key];
33000
- newValue =
33001
- isObject(objValue) || Array.isArray(objValue)
33002
- ? objValue
33003
- : !isNaN(+tempPath[index + 1])
33004
- ? []
33005
- : {};
33006
- }
33007
- if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
33008
- return;
33009
- }
33010
- object[key] = newValue;
33011
- object = object[key];
33012
- }
33013
- };
33014
-
33015
- const EVENTS = {
33016
- BLUR: 'blur',
33017
- FOCUS_OUT: 'focusout',
33018
- CHANGE: 'change',
33019
- };
33020
- const VALIDATION_MODE = {
33021
- onBlur: 'onBlur',
33022
- onChange: 'onChange',
33023
- onSubmit: 'onSubmit',
33024
- onTouched: 'onTouched',
33025
- all: 'all',
33026
- };
33027
-
33028
- const HookFormContext = React.createContext(null);
33029
- HookFormContext.displayName = 'HookFormContext';
33030
- /**
33031
- * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.
33032
- *
33033
- * @remarks
33034
- * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
33035
- *
33036
- * @returns return all useForm methods
33037
- *
33038
- * @example
33039
- * ```tsx
33040
- * function App() {
33041
- * const methods = useForm();
33042
- * const onSubmit = data => console.log(data);
33043
- *
33044
- * return (
33045
- * <FormProvider {...methods} >
33046
- * <form onSubmit={methods.handleSubmit(onSubmit)}>
33047
- * <NestedInput />
33048
- * <input type="submit" />
33049
- * </form>
33050
- * </FormProvider>
33051
- * );
33052
- * }
33053
- *
33054
- * function NestedInput() {
33055
- * const { register } = useFormContext(); // retrieve all hook methods
33056
- * return <input {...register("test")} />;
33057
- * }
33058
- * ```
33059
- */
33060
- const useFormContext = () => React.useContext(HookFormContext);
33061
-
33062
- var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
33063
- const result = {
33064
- defaultValues: control._defaultValues,
33065
- };
33066
- for (const key in formState) {
33067
- Object.defineProperty(result, key, {
33068
- get: () => {
33069
- const _key = key;
33070
- if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
33071
- control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
33072
- }
33073
- localProxyFormState && (localProxyFormState[_key] = true);
33074
- return formState[_key];
33075
- },
33076
- });
33077
- }
33078
- return result;
33079
- };
33080
-
33081
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
33082
-
33083
- /**
33084
- * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
33085
- *
33086
- * @remarks
33087
- * [API](https://react-hook-form.com/docs/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)
33088
- *
33089
- * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}
33090
- *
33091
- * @example
33092
- * ```tsx
33093
- * function App() {
33094
- * const { register, handleSubmit, control } = useForm({
33095
- * defaultValues: {
33096
- * firstName: "firstName"
33097
- * }});
33098
- * const { dirtyFields } = useFormState({
33099
- * control
33100
- * });
33101
- * const onSubmit = (data) => console.log(data);
33102
- *
33103
- * return (
33104
- * <form onSubmit={handleSubmit(onSubmit)}>
33105
- * <input {...register("firstName")} placeholder="First Name" />
33106
- * {dirtyFields.firstName && <p>Field is dirty.</p>}
33107
- * <input type="submit" />
33108
- * </form>
33109
- * );
33110
- * }
33111
- * ```
33112
- */
33113
- function useFormState(props) {
33114
- const methods = useFormContext();
33115
- const { control = methods.control, disabled, name, exact } = props || {};
33116
- const [formState, updateFormState] = React.useState(control._formState);
33117
- const _localProxyFormState = React.useRef({
33118
- isDirty: false,
33119
- isLoading: false,
33120
- dirtyFields: false,
33121
- touchedFields: false,
33122
- validatingFields: false,
33123
- isValidating: false,
33124
- isValid: false,
33125
- errors: false,
33126
- });
33127
- useIsomorphicLayoutEffect(() => control._subscribe({
33128
- name,
33129
- formState: _localProxyFormState.current,
33130
- exact,
33131
- callback: (formState) => {
33132
- !disabled &&
33133
- updateFormState({
33134
- ...control._formState,
33135
- ...formState,
33136
- });
33137
- },
33138
- }), [name, disabled, exact]);
33139
- React.useEffect(() => {
33140
- _localProxyFormState.current.isValid && control._setValid(true);
33141
- }, [control]);
33142
- return React.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
33143
- }
33144
-
33145
- var isString = (value) => typeof value === 'string';
33146
-
33147
- var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
33148
- if (isString(names)) {
33149
- isGlobal && _names.watch.add(names);
33150
- return get(formValues, names, defaultValue);
33151
- }
33152
- if (Array.isArray(names)) {
33153
- return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName),
33154
- get(formValues, fieldName)));
33155
- }
33156
- isGlobal && (_names.watchAll = true);
33157
- return formValues;
33158
- };
33159
-
33160
- var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
33161
-
33162
- function deepEqual(object1, object2, _internal_visited = new WeakSet()) {
33163
- if (isPrimitive(object1) || isPrimitive(object2)) {
33164
- return object1 === object2;
33165
- }
33166
- if (isDateObject(object1) && isDateObject(object2)) {
33167
- return object1.getTime() === object2.getTime();
33168
- }
33169
- const keys1 = Object.keys(object1);
33170
- const keys2 = Object.keys(object2);
33171
- if (keys1.length !== keys2.length) {
33172
- return false;
33173
- }
33174
- if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
33175
- return true;
33176
- }
33177
- _internal_visited.add(object1);
33178
- _internal_visited.add(object2);
33179
- for (const key of keys1) {
33180
- const val1 = object1[key];
33181
- if (!keys2.includes(key)) {
33182
- return false;
33183
- }
33184
- if (key !== 'ref') {
33185
- const val2 = object2[key];
33186
- if ((isDateObject(val1) && isDateObject(val2)) ||
33187
- (isObject(val1) && isObject(val2)) ||
33188
- (Array.isArray(val1) && Array.isArray(val2))
33189
- ? !deepEqual(val1, val2, _internal_visited)
33190
- : val1 !== val2) {
33191
- return false;
33192
- }
33193
- }
33194
- }
33195
- return true;
33196
- }
33197
-
33198
- /**
33199
- * Custom hook to subscribe to field change and isolate re-rendering at the component level.
33200
- *
33201
- * @remarks
33202
- *
33203
- * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
33204
- *
33205
- * @example
33206
- * ```tsx
33207
- * const { control } = useForm();
33208
- * const values = useWatch({
33209
- * name: "fieldName"
33210
- * control,
33211
- * })
33212
- * ```
33213
- */
33214
- function useWatch(props) {
33215
- const methods = useFormContext();
33216
- const { control = methods.control, name, defaultValue, disabled, exact, compute, } = props || {};
33217
- const _defaultValue = React.useRef(defaultValue);
33218
- const _compute = React.useRef(compute);
33219
- const _computeFormValues = React.useRef(undefined);
33220
- _compute.current = compute;
33221
- const defaultValueMemo = React.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
33222
- const [value, updateValue] = React.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
33223
- useIsomorphicLayoutEffect(() => control._subscribe({
33224
- name,
33225
- formState: {
33226
- values: true,
33227
- },
33228
- exact,
33229
- callback: (formState) => {
33230
- if (!disabled) {
33231
- const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
33232
- if (_compute.current) {
33233
- const computedFormValues = _compute.current(formValues);
33234
- if (!deepEqual(computedFormValues, _computeFormValues.current)) {
33235
- updateValue(computedFormValues);
33236
- _computeFormValues.current = computedFormValues;
33237
- }
33238
- }
33239
- else {
33240
- updateValue(formValues);
33241
- }
33242
- }
33243
- },
33244
- }), [control, disabled, name, exact]);
33245
- React.useEffect(() => control._removeUnmounted());
33246
- return value;
33247
- }
33248
-
33249
- /**
33250
- * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.
33251
- *
33252
- * @remarks
33253
- * [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)
33254
- *
33255
- * @param props - the path name to the form field value, and validation rules.
33256
- *
33257
- * @returns field properties, field and form state. {@link UseControllerReturn}
33258
- *
33259
- * @example
33260
- * ```tsx
33261
- * function Input(props) {
33262
- * const { field, fieldState, formState } = useController(props);
33263
- * return (
33264
- * <div>
33265
- * <input {...field} placeholder={props.name} />
33266
- * <p>{fieldState.isTouched && "Touched"}</p>
33267
- * <p>{formState.isSubmitted ? "submitted" : ""}</p>
33268
- * </div>
33269
- * );
33270
- * }
33271
- * ```
33272
- */
33273
- function useController(props) {
33274
- const methods = useFormContext();
33275
- const { name, disabled, control = methods.control, shouldUnregister, defaultValue, } = props;
33276
- const isArrayField = isNameInFieldArray(control._names.array, name);
33277
- const defaultValueMemo = React.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
33278
- const value = useWatch({
33279
- control,
33280
- name,
33281
- defaultValue: defaultValueMemo,
33282
- exact: true,
33283
- });
33284
- const formState = useFormState({
33285
- control,
33286
- name,
33287
- exact: true,
33288
- });
33289
- const _props = React.useRef(props);
33290
- const _previousNameRef = React.useRef(undefined);
33291
- const _registerProps = React.useRef(control.register(name, {
33292
- ...props.rules,
33293
- value,
33294
- ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
33295
- }));
33296
- _props.current = props;
33297
- const fieldState = React.useMemo(() => Object.defineProperties({}, {
33298
- invalid: {
33299
- enumerable: true,
33300
- get: () => !!get(formState.errors, name),
33301
- },
33302
- isDirty: {
33303
- enumerable: true,
33304
- get: () => !!get(formState.dirtyFields, name),
33305
- },
33306
- isTouched: {
33307
- enumerable: true,
33308
- get: () => !!get(formState.touchedFields, name),
33309
- },
33310
- isValidating: {
33311
- enumerable: true,
33312
- get: () => !!get(formState.validatingFields, name),
33313
- },
33314
- error: {
33315
- enumerable: true,
33316
- get: () => get(formState.errors, name),
33317
- },
33318
- }), [formState, name]);
33319
- const onChange = React.useCallback((event) => _registerProps.current.onChange({
33320
- target: {
33321
- value: getEventValue(event),
33322
- name: name,
33323
- },
33324
- type: EVENTS.CHANGE,
33325
- }), [name]);
33326
- const onBlur = React.useCallback(() => _registerProps.current.onBlur({
33327
- target: {
33328
- value: get(control._formValues, name),
33329
- name: name,
33330
- },
33331
- type: EVENTS.BLUR,
33332
- }), [name, control._formValues]);
33333
- const ref = React.useCallback((elm) => {
33334
- const field = get(control._fields, name);
33335
- if (field && elm) {
33336
- field._f.ref = {
33337
- focus: () => elm.focus && elm.focus(),
33338
- select: () => elm.select && elm.select(),
33339
- setCustomValidity: (message) => elm.setCustomValidity(message),
33340
- reportValidity: () => elm.reportValidity(),
33341
- };
33342
- }
33343
- }, [control._fields, name]);
33344
- const field = React.useMemo(() => ({
33345
- name,
33346
- value,
33347
- ...(isBoolean(disabled) || formState.disabled
33348
- ? { disabled: formState.disabled || disabled }
33349
- : {}),
33350
- onChange,
33351
- onBlur,
33352
- ref,
33353
- }), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
33354
- React.useEffect(() => {
33355
- const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
33356
- const previousName = _previousNameRef.current;
33357
- if (previousName && previousName !== name && !isArrayField) {
33358
- control.unregister(previousName);
33359
- }
33360
- control.register(name, {
33361
- ..._props.current.rules,
33362
- ...(isBoolean(_props.current.disabled)
33363
- ? { disabled: _props.current.disabled }
33364
- : {}),
33365
- });
33366
- const updateMounted = (name, value) => {
33367
- const field = get(control._fields, name);
33368
- if (field && field._f) {
33369
- field._f.mount = value;
33370
- }
33371
- };
33372
- updateMounted(name, true);
33373
- if (_shouldUnregisterField) {
33374
- const value = cloneObject(get(control._options.defaultValues, name));
33375
- set(control._defaultValues, name, value);
33376
- if (isUndefined(get(control._formValues, name))) {
33377
- set(control._formValues, name, value);
33378
- }
33379
- }
33380
- !isArrayField && control.register(name);
33381
- _previousNameRef.current = name;
33382
- return () => {
33383
- (isArrayField
33384
- ? _shouldUnregisterField && !control._state.action
33385
- : _shouldUnregisterField)
33386
- ? control.unregister(name)
33387
- : updateMounted(name, false);
33388
- };
33389
- }, [name, control, isArrayField, shouldUnregister]);
33390
- React.useEffect(() => {
33391
- control._setDisabledField({
33392
- disabled,
33393
- name,
33394
- });
33395
- }, [disabled, name, control]);
33396
- return React.useMemo(() => ({
33397
- field,
33398
- formState,
33399
- fieldState,
33400
- }), [field, formState, fieldState]);
33401
- }
33402
-
33403
- /**
33404
- * Component based on `useController` hook to work with controlled component.
33405
- *
33406
- * @remarks
33407
- * [API](https://react-hook-form.com/docs/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA)
33408
- *
33409
- * @param props - the path name to the form field value, and validation rules.
33410
- *
33411
- * @returns provide field handler functions, field and form state.
33412
- *
33413
- * @example
33414
- * ```tsx
33415
- * function App() {
33416
- * const { control } = useForm<FormValues>({
33417
- * defaultValues: {
33418
- * test: ""
33419
- * }
33420
- * });
33421
- *
33422
- * return (
33423
- * <form>
33424
- * <Controller
33425
- * control={control}
33426
- * name="test"
33427
- * render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (
33428
- * <>
33429
- * <input
33430
- * onChange={onChange} // send value to hook form
33431
- * onBlur={onBlur} // notify when input is touched
33432
- * value={value} // return updated value
33433
- * ref={ref} // set ref for focus management
33434
- * />
33435
- * <p>{formState.isSubmitted ? "submitted" : ""}</p>
33436
- * <p>{fieldState.isTouched ? "touched" : ""}</p>
33437
- * </>
33438
- * )}
33439
- * />
33440
- * </form>
33441
- * );
33442
- * }
33443
- * ```
33444
- */
33445
- const Controller = (props) => props.render(useController(props));
33446
-
33447
32911
  function useSelectField({ name, control, options: _options, rules, defaultValue, }) {
33448
- const { field, fieldState: { error, invalid }, } = useController({
32912
+ const { field, fieldState: { error, invalid }, } = reactHookForm.useController({
33449
32913
  name,
33450
32914
  control,
33451
32915
  rules,
@@ -33919,7 +33383,7 @@ const DropdownMultiSelect = ({ options, name, control, placeholder = "Select opt
33919
33383
  }, onClick: (e) => e.stopPropagation(), className: "mr-3 w-4 h-4 rounded border-ews-gray-300 text-ews-primary focus:ring-ews-primary" }), jsxRuntime.jsx("label", { className: "text-sm cursor-pointer text-ews-gray-700", children: option.label })] }, getDisplayValue(option.value))))) : (jsxRuntime.jsx("div", { className: "p-2 text-sm text-ews-gray-500", children: "No options found" })) })] }))] }));
33920
33384
  // Render controlled version with react-hook-form
33921
33385
  if (control) {
33922
- return (jsxRuntime.jsx(Controller, { name: name, control: control, render: ({ field: { value, onChange } }) => (jsxRuntime.jsxs("div", { children: [label && (jsxRuntime.jsx("label", { className: "block mb-1 text-sm font-medium text-ews-gray-700", children: label })), renderDropdown({ value, onChange }), error && jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ews-error", children: error })] })) }));
33386
+ return (jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, render: ({ field: { value, onChange } }) => (jsxRuntime.jsxs("div", { children: [label && (jsxRuntime.jsx("label", { className: "block mb-1 text-sm font-medium text-ews-gray-700", children: label })), renderDropdown({ value, onChange }), error && jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ews-error", children: error })] })) }));
33923
33387
  }
33924
33388
  // Render uncontrolled version
33925
33389
  return (jsxRuntime.jsxs("div", { children: [label && (jsxRuntime.jsx("label", { className: "block mb-1 text-sm font-medium text-ews-gray-700", children: label })), renderDropdown({
@@ -34107,8 +33571,8 @@ const PROMED_THEME = {
34107
33571
  const MED_THEME = {
34108
33572
  name: "MED",
34109
33573
  colors: {
34110
- primary: "#3BA1A1",
34111
- secondary: "#6B73FF",
33574
+ primary: "#3BA1A1", // Teal for patients (calming, trustworthy)
33575
+ secondary: "#6B73FF", // Soft purple-blue (suggested secondary for MED)
34112
33576
  primaryHover: "#308181",
34113
33577
  secondaryHover: "#5a61e6",
34114
33578
  primaryLight: "#a8d5d5",