@ostack.tech/ui 0.11.0 → 0.11.2

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,4 +1,4 @@
1
- import { ComponentPropsWithRef } from 'react';
1
+ import { ComponentPropsWithRef, RefObject } from 'react';
2
2
  import { DayPickerProps } from 'react-day-picker';
3
3
  import { IconButton } from '../IconButton';
4
4
  import { Select } from '../Select';
@@ -18,10 +18,22 @@ export interface DateRange {
18
18
  /** End of the date-range. */
19
19
  end: Date | null;
20
20
  }
21
+ /** API to manipulate the calendar imperatively. */
22
+ export interface CalendarApi<TValue extends Date | Date[] | DateRange | null = Date | Date[] | DateRange | null> {
23
+ getValue: () => TValue;
24
+ /** Sets the selected value of the calendar. */
25
+ setValue: (value: string | Date | (string | Date)[] | AcceptedDateRange | null) => void;
26
+ /** Gets the currently visible month of the calendar. */
27
+ getMonth: () => Date;
28
+ /** Sets the visible month of the calendar. */
29
+ setMonth: (month: Date) => void;
30
+ /** Whether the provided date is visible in the calendar. */
31
+ isVisible: (date: Date | string) => boolean;
32
+ }
21
33
  /** Properties of the calendar component. */
22
34
  export type CalendarProps = CalendarNoneSelectionProps | CalendarSingleSelectionProps | CalendarMultipleSelectionProps | CalendarRangeSelectionProps;
23
35
  /** Base properties of the calendar component. */
24
- export interface CalendarPropsBase<TValue extends Date | Date[] | DateRange | null = Date | Date[] | DateRange | null> extends Pick<DayPickerProps, "required" | "className" | "style" | "id" | "defaultMonth" | "month" | "numberOfMonths" | "pagedNavigation" | "disableNavigation" | "fixedWeeks" | "hideWeekdays" | "showOutsideDays" | "showWeekNumber" | "broadcastCalendar" | "ISOWeek" | "timeZone" | "noonSafe" | "footer" | "autoFocus" | "disabled" | "hidden" | "today" | "modifiers" | "aria-label" | "aria-labelledby" | "numerals" | "weekStartsOn" | "firstWeekContainsDate" | "useAdditionalWeekYearTokens" | "useAdditionalDayOfYearTokens" | "onMonthChange" | "onNextClick" | "onPrevClick" | "onDayClick" | "onDayFocus" | "onDayBlur" | "onDayKeyDown" | "onDayMouseEnter" | "onDayMouseLeave"> {
36
+ export interface CalendarPropsBase<TValue extends Date | Date[] | DateRange | null = Date | Date[] | DateRange | null> extends Pick<DayPickerProps, "required" | "className" | "style" | "id" | "numberOfMonths" | "pagedNavigation" | "disableNavigation" | "fixedWeeks" | "hideWeekdays" | "showOutsideDays" | "showWeekNumber" | "broadcastCalendar" | "ISOWeek" | "timeZone" | "noonSafe" | "footer" | "autoFocus" | "disabled" | "hidden" | "today" | "modifiers" | "aria-label" | "aria-labelledby" | "numerals" | "weekStartsOn" | "firstWeekContainsDate" | "useAdditionalWeekYearTokens" | "useAdditionalDayOfYearTokens" | "onMonthChange" | "onNextClick" | "onPrevClick" | "onDayClick" | "onDayFocus" | "onDayBlur" | "onDayKeyDown" | "onDayMouseEnter" | "onDayMouseLeave"> {
25
37
  /**
26
38
  * Mode for selecting calendar dates.
27
39
  *
@@ -34,6 +46,10 @@ export interface CalendarPropsBase<TValue extends Date | Date[] | DateRange | nu
34
46
  value?: string | Date | (string | Date)[] | AcceptedDateRange | null;
35
47
  /** Function called when the selected value changes. */
36
48
  onValueChange?: (value: TValue) => void;
49
+ /** The initial month to show in the calendar. */
50
+ defaultMonth?: string | Date;
51
+ /** Controlled month displayed in the calendar. */
52
+ month?: string | Date;
37
53
  /** Minimum date allowed. */
38
54
  minDate?: string | Date | null;
39
55
  /** Maximum date allowed. */
@@ -54,6 +70,8 @@ export interface CalendarPropsBase<TValue extends Date | Date[] | DateRange | nu
54
70
  previousMonthLabel?: string;
55
71
  /** Label of the "next month" button. */
56
72
  nextMonthLabel?: string;
73
+ /** Reference to the calendar API. */
74
+ apiRef?: RefObject<CalendarApi<TValue> | null>;
57
75
  /** Properties to pass to the header element. */
58
76
  headerProps?: ComponentPropsWithRef<"header">;
59
77
  /** Properties to pass to the header label element. */
@@ -97,4 +115,4 @@ export interface CalendarRangeSelectionProps extends CalendarPropsBase<DateRange
97
115
  * }
98
116
  * ```
99
117
  */
100
- export declare function Calendar({ selectionMode, defaultValue, value: controlledValue, onValueChange, required, minDate, maxDate, minMonth, maxMonth, minYear, maxYear, monthSelectLabel, yearSelectLabel, previousMonthLabel, nextMonthLabel, defaultMonth, month: controlledMonth, onMonthChange, onDayClick, onDayFocus, onDayMouseEnter, numberOfMonths, fixedWeeks, showOutsideDays, disableNavigation, disabled, modifiers, headerProps, headerLabelProps, previousButtonProps, nextButtonProps, monthSelectProps, yearSelectProps, pagedNavigation, ...otherProps }: CalendarProps): import("react/jsx-runtime").JSX.Element;
118
+ export declare function Calendar({ selectionMode, defaultValue, value: controlledValue, onValueChange, required, minDate, maxDate, minMonth, maxMonth, minYear, maxYear, monthSelectLabel, yearSelectLabel, previousMonthLabel, nextMonthLabel, defaultMonth, month: controlledMonth, onMonthChange, onDayClick, onDayFocus, onDayMouseEnter, numberOfMonths, fixedWeeks, showOutsideDays, disableNavigation, disabled, modifiers, apiRef, headerProps, headerLabelProps, previousButtonProps, nextButtonProps, monthSelectProps, yearSelectProps, pagedNavigation, ...otherProps }: CalendarProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ostack.tech/ui",
3
3
  "description": "ostack/UI component library.",
4
- "version": "0.11.0",
4
+ "version": "0.11.2",
5
5
  "homepage": "https://ui.ostack.tech/",
6
6
  "author": {
7
7
  "name": "Opensoft",
@@ -1,3 +1,4 @@
1
+ @use "../Label/Label-variables" as *;
1
2
  @use "../../scss/base-variables" as *;
2
3
  @use "../../scss/utils/spacing" as *;
3
4
 
@@ -13,15 +14,17 @@ $data-table-filter-max-width: 250px !default;
13
14
 
14
15
  // Rows per page
15
16
  $data-table-rows-per-page-gap-x: spacing(1) !default;
16
- $data-table-rows-per-page-font-size: var(--#{$prefix}font-size-sm) !default;
17
- $data-table-rows-per-page-line-height: var(--#{$prefix}line-height-sm) !default;
17
+ $data-table-rows-per-page-font-size: null !default;
18
+ $data-table-rows-per-page-line-height: null !default;
18
19
  $data-table-rows-per-page-font-weight: $font-weight-normal !default;
20
+ $data-table-rows-per-page-color: null !default;
19
21
 
20
22
  // Pagination
21
23
  $data-table-pagination-gap-x: spacing(2) !default;
22
- $data-table-pagination-font-size: var(--#{$prefix}font-size-sm) !default;
23
- $data-table-pagination-line-height: var(--#{$prefix}line-height-sm) !default;
24
- $data-table-pagination-font-weight: null !default;
24
+ $data-table-pagination-font-size: $label-font-size !default;
25
+ $data-table-pagination-line-height: $label-line-height !default;
26
+ $data-table-pagination-font-weight: $font-weight-normal !default;
27
+ $data-table-pagination-color: $label-color !default;
25
28
 
26
29
  // Pagination arrows
27
30
  $data-table-pagination-arrows-gap-x: spacing(1) !default;
@@ -49,9 +49,10 @@
49
49
 
50
50
  &__rows-per-page-label {
51
51
  margin-right: $data-table-rows-per-page-gap-x;
52
- font-size: $data-table-rows-per-page-font-size;
53
- line-height: $data-table-rows-per-page-line-height;
52
+ font-size: maybe-important($data-table-rows-per-page-font-size);
53
+ line-height: maybe-important($data-table-rows-per-page-line-height);
54
54
  font-weight: maybe-important($data-table-rows-per-page-font-weight);
55
+ color: maybe-important($data-table-rows-per-page-color);
55
56
  }
56
57
 
57
58
  &__rows-per-page-select-root,
@@ -66,6 +67,7 @@
66
67
  font-size: $data-table-pagination-font-size;
67
68
  line-height: $data-table-pagination-line-height;
68
69
  font-weight: $data-table-pagination-font-weight;
70
+ color: $data-table-pagination-color;
69
71
  }
70
72
 
71
73
  &__pagination-arrows {
@@ -49,11 +49,16 @@
49
49
  }
50
50
  }
51
51
 
52
+ &__popover-anchor {
53
+ box-shadow: none;
54
+ }
55
+
52
56
  &__popover-anchor > &__container {
53
57
  margin: calc(var(--#{$prefix}control-border-width) * -1);
54
- background: none;
58
+
55
59
  &:not([data-focused]) {
56
60
  border-color: transparent;
61
+ background: none;
57
62
  }
58
63
 
59
64
  // When necessary, tweak spacing around containers so that the focus ring
@@ -18,6 +18,7 @@
18
18
 
19
19
  & > .#{$prefix}feedback {
20
20
  margin-left: $feedback-list-feedback-margin-x !important;
21
+ text-align: left !important;
21
22
 
22
23
  & ~ .#{$prefix}feedback {
23
24
  margin-top: $feedback-list-feedback-margin-y;
@@ -48,7 +48,7 @@
48
48
  background-color: $stepper-step-line-status-background-color;
49
49
  }
50
50
 
51
- &:is([data-completed], [data-active]) {
51
+ &:is([data-completed], [data-current]) {
52
52
  &::before {
53
53
  background-color: $stepper-step-line-completed-background-color;
54
54
  }
@@ -70,7 +70,7 @@
70
70
  margin-bottom: $stepper-step-label-margin-y;
71
71
  text-align: center;
72
72
 
73
- &:not([data-completed], [data-active]) {
73
+ &:not([data-completed], [data-current]) {
74
74
  color: $stepper-step-label-incomplete-color;
75
75
  }
76
76
  }
@@ -106,13 +106,13 @@
106
106
  }
107
107
 
108
108
  // TODO: Improve animations
109
- &[data-active] {
109
+ &[data-current] {
110
110
  @include accessible-animation(
111
111
  $animation-fade-in $stepper-step-content-animation-duration
112
112
  $stepper-step-content-animation-timing-function
113
113
  );
114
114
  }
115
- //&:not([data-active]) {
115
+ //&:not([data-current]) {
116
116
  // @include accessible-animation-close();
117
117
  //}
118
118
 
@@ -213,6 +213,7 @@ $tabs-tab-content-label-border-bottom: 2px solid var(--#{$prefix}primary-9) !def
213
213
  $tabs-tab-content-label-font-size: var(--#{$prefix}font-size-sm) !default;
214
214
  $tabs-tab-content-label-line-height: var(--#{$prefix}font-size-sm) !default;
215
215
  $tabs-tab-content-label-font-weight: $font-weight-medium !default;
216
+ $tabs-tab-content-label-color: null !default;
216
217
 
217
218
  // Tab content
218
219
  $tabs-tab-content-gap-y: spacing(2) !default;
@@ -447,6 +447,7 @@
447
447
  font-size: $tabs-tab-content-label-font-size;
448
448
  line-height: $tabs-tab-content-label-line-height;
449
449
  font-weight: $tabs-tab-content-label-font-weight;
450
+ color: $tabs-tab-content-label-color;
450
451
  }
451
452
 
452
453
  // Tab content