sy-ui-lib 1.0.27 → 1.0.29

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,21 +1,28 @@
1
1
  import { TimePickerProps } from './TimePicker.types';
2
2
  /**
3
- * A reusable and customizable time picker component that allows
4
- * selecting a time range (From–To) using `react-time-picker`.
3
+ * A reusable and customizable controlled time picker component
4
+ * that allows selecting a time range (From–To) using `react-time-picker`.
5
5
  *
6
6
  * @param {string} [title] - Optional button text placeholder. Default is "Select Time".
7
+ * @param {TimeRange} [value] - Controlled selected time range value.
7
8
  * @param {(value: TimeRange) => void} selectedTime - Callback function
8
- * triggered when the user applies a selected time range.
9
+ * triggered when the selected time range changes.
9
10
  * @param {boolean} [fullWidth] - If true, the component stretches to full width of its container.
10
11
  * @param {string} [errorMessage] - Custom validation error message shown for invalid ranges.
11
12
  *
12
13
  * @returns {JSX.Element} The rendered TimePicker component.
13
14
  *
14
15
  * @example
16
+ * const [timeRange, setTimeRange] = useState<TimeRange>({
17
+ * from: null,
18
+ * to: null,
19
+ * });
20
+ *
15
21
  * <TimePicker
16
22
  * title="Pick Time"
23
+ * value={timeRange}
17
24
  * fullWidth
18
- * selectedTime={(value) => console.log("Selected:", value)}
25
+ * selectedTime={setTimeRange}
19
26
  * />
20
27
  */
21
28
  declare const TimePicker: React.FC<TimePickerProps>;
@@ -6,3 +6,4 @@ type Story = StoryObj<TimePickerProps>;
6
6
  export declare const Default: Story;
7
7
  export declare const FullWidth: Story;
8
8
  export declare const FixedWidthContainer: Story;
9
+ export declare const ControlledContainer: Story;
@@ -15,6 +15,8 @@ export interface TimePickerProps {
15
15
  title?: string;
16
16
  /** Callback function that receives the selected time range */
17
17
  selectedTime: (value: TimeRange) => void;
18
+ /** Controlled value from parent */
19
+ value?: TimeRange;
18
20
  /** If true, the time picker stretches to full width of its container */
19
21
  fullWidth?: boolean;
20
22
  /** Custom validation error message shown when the selected time range is invalid */