@teja-app/ui 0.0.7 → 0.0.9

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.
@@ -1,6 +1,7 @@
1
+ import 'react-day-picker/style.css';
1
2
  import type { DateInputProps } from './DateInput.types';
2
3
  /**
3
- * DateInput component for date selection.
4
+ * DateInput component with a calendar popup for date selection.
4
5
  *
5
6
  * @example
6
7
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/DateInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,6GAmFrB,CAAC"}
1
+ {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/DateInput.tsx"],"names":[],"mappings":"AAWA,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA+JxD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,6GAgcrB,CAAC"}
@@ -1,5 +1,4 @@
1
- import type { InputHTMLAttributes } from 'react';
2
- export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'value'> {
1
+ export interface DateInputProps {
3
2
  /** Current date value in YYYY-MM-DD format */
4
3
  value: string | null;
5
4
  /** Called when the date changes */
@@ -12,5 +11,29 @@ export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElemen
12
11
  helperText?: string;
13
12
  /** Whether the input should take full width */
14
13
  fullWidth?: boolean;
14
+ /** Whether the input is disabled */
15
+ disabled?: boolean;
16
+ /** Whether the field is required */
17
+ required?: boolean;
18
+ /** Minimum date in YYYY-MM-DD format */
19
+ min?: string;
20
+ /** Maximum date in YYYY-MM-DD format */
21
+ max?: string;
22
+ /** Additional CSS class for the input element */
23
+ className?: string;
24
+ /** HTML id attribute */
25
+ id?: string;
26
+ /** Test ID following teja-ui suffix pattern */
27
+ testId?: string;
28
+ /** Placeholder text (default: "Select date") */
29
+ placeholder?: string;
30
+ /** Custom function to disable specific dates */
31
+ disabledDate?: (date: Date) => boolean;
32
+ /** Show clear button when value is set (default: true) */
33
+ allowClear?: boolean;
34
+ /** Locale for the calendar (import from "react-day-picker/locale") */
35
+ locale?: Partial<import('react-day-picker').Locale>;
36
+ /** Format function to display the date in the input. Receives the Date and locale. Default: YYYY-MM-DD */
37
+ formatDisplayValue?: (date: Date, locale?: Partial<import('react-day-picker').Locale>) => string;
15
38
  }
16
39
  //# sourceMappingURL=DateInput.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/DateInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAClF,8CAA8C;IAC9C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,mCAAmC;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
1
+ {"version":3,"file":"DateInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/DateInput.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,m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;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAAyB,EACzB,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAgB,EAChB,QAAgB,EAChB,SAAiB,EACjB,SAAS,EACT,SAAiB,EACjB,WAA0B,EAC1B,SAAoB,EACpB,MAAM,GACP,EAAE,WAAW,2CAgJb;yBAhKe,MAAM"}
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAAyB,EACzB,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAgB,EAChB,QAAgB,EAChB,SAAiB,EACjB,SAAS,EACT,SAAiB,EACjB,WAA0B,EAC1B,SAAoB,EACpB,MAAM,GACP,EAAE,WAAW,2CA6Ib;yBA7Je,MAAM"}
@@ -0,0 +1,69 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Feature Flag Hook for React applications
4
+ *
5
+ * Provides feature flag support for trunk-based development.
6
+ * Flags can be loaded from:
7
+ * 1. Backend API endpoint (recommended for user-specific rollouts)
8
+ * 2. Fallback flags passed as props
9
+ *
10
+ * Usage:
11
+ * // In App.tsx
12
+ * <FeatureFlagProvider apiUrl="/api/feature-flags" userId={user?.id}>
13
+ * <App />
14
+ * </FeatureFlagProvider>
15
+ *
16
+ * // In components
17
+ * const { isEnabled, isLoading } = useFeatureFlags();
18
+ * if (isEnabled('new-calendar-ui')) {
19
+ * return <NewCalendar />;
20
+ * }
21
+ */
22
+ export interface FeatureFlag {
23
+ enabled: boolean;
24
+ rolloutPercentage?: number;
25
+ }
26
+ export interface FeatureFlags {
27
+ [key: string]: FeatureFlag;
28
+ }
29
+ interface FeatureFlagContextValue {
30
+ flags: FeatureFlags;
31
+ isLoading: boolean;
32
+ error: Error | null;
33
+ isEnabled: (flagName: string) => boolean;
34
+ reload: () => Promise<void>;
35
+ }
36
+ interface FeatureFlagProviderProps {
37
+ children: ReactNode;
38
+ /** API endpoint to fetch flags (e.g., '/api/feature-flags') */
39
+ apiUrl?: string;
40
+ /** User ID for percentage-based rollouts */
41
+ userId?: string;
42
+ /** Fallback flags when API is unavailable */
43
+ fallbackFlags?: FeatureFlags;
44
+ /** Skip API fetch entirely, use only fallback flags */
45
+ skipApi?: boolean;
46
+ }
47
+ export declare function FeatureFlagProvider({ children, apiUrl, userId, fallbackFlags, skipApi, }: FeatureFlagProviderProps): import("react/jsx-runtime").JSX.Element;
48
+ /**
49
+ * Hook to access feature flags
50
+ *
51
+ * @example
52
+ * const { isEnabled } = useFeatureFlags();
53
+ * if (isEnabled('new-feature')) {
54
+ * return <NewFeature />;
55
+ * }
56
+ */
57
+ export declare function useFeatureFlags(): FeatureFlagContextValue;
58
+ /**
59
+ * Convenience hook to check a single feature flag
60
+ *
61
+ * @example
62
+ * const isNewUIEnabled = useFeatureFlag('new-ui');
63
+ * if (isNewUIEnabled) {
64
+ * return <NewUI />;
65
+ * }
66
+ */
67
+ export declare function useFeatureFlag(flagName: string): boolean;
68
+ export {};
69
+ //# sourceMappingURL=useFeatureFlags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/hooks/useFeatureFlags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B;AAED,UAAU,uBAAuB;IAC/B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAID,UAAU,wBAAwB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAeD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAAa,EACb,OAAe,GAChB,EAAE,wBAAwB,2CAgF1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,uBAAuB,CAgBzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGxD"}