@lobehub/ui 6.0.0-beta.8 → 6.0.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.
Files changed (113) hide show
  1. package/README.md +3 -3
  2. package/es/Accordion/style.d.mts +1 -1
  3. package/es/CodeDiff/DiffPanel.mjs +2 -2
  4. package/es/CodeDiff/DiffPanel.mjs.map +1 -1
  5. package/es/DatePicker/DatePicker.d.mts +5 -3
  6. package/es/DatePicker/DatePicker.mjs +7 -5
  7. package/es/DatePicker/DatePicker.mjs.map +1 -1
  8. package/es/DatePicker/DateRangePicker.d.mts +1 -1
  9. package/es/DatePicker/DayjsDatePicker.d.mts +12 -0
  10. package/es/DatePicker/DayjsDatePicker.mjs +19 -0
  11. package/es/DatePicker/DayjsDatePicker.mjs.map +1 -0
  12. package/es/DatePicker/DayjsDateRangePicker.d.mts +7 -0
  13. package/es/DatePicker/DayjsDateRangePicker.mjs +8 -0
  14. package/es/DatePicker/DayjsDateRangePicker.mjs.map +1 -0
  15. package/es/DatePicker/RangePicker.mjs +7 -1
  16. package/es/DatePicker/RangePicker.mjs.map +1 -1
  17. package/es/DatePicker/SinglePicker.mjs +3 -1
  18. package/es/DatePicker/SinglePicker.mjs.map +1 -1
  19. package/es/DatePicker/dateGenerateConfig.mjs +52 -0
  20. package/es/DatePicker/dateGenerateConfig.mjs.map +1 -0
  21. package/es/DatePicker/index.d.mts +4 -2
  22. package/es/DatePicker/index.mjs +3 -1
  23. package/es/DatePicker/legacyDate.mjs +58 -0
  24. package/es/DatePicker/legacyDate.mjs.map +1 -0
  25. package/es/DatePicker/type.d.mts +60 -34
  26. package/es/DatePicker/usePresetActive.mjs +1 -0
  27. package/es/DatePicker/usePresetActive.mjs.map +1 -1
  28. package/es/Drawer/style.mjs.map +1 -1
  29. package/es/FloatingPanel/style.mjs +3 -2
  30. package/es/FloatingPanel/style.mjs.map +1 -1
  31. package/es/Form/Form.mjs +6 -2
  32. package/es/Form/Form.mjs.map +1 -1
  33. package/es/Form/style.mjs +3 -3
  34. package/es/Form/style.mjs.map +1 -1
  35. package/es/Form/type.d.mts +7 -0
  36. package/es/Popover/style.mjs +1 -1
  37. package/es/Popover/style.mjs.map +1 -1
  38. package/es/ProTable/hooks/useFetchData.mjs +1 -1
  39. package/es/ProTable/hooks/useFetchData.mjs.map +1 -1
  40. package/es/ProTable/parts/FieldControl.mjs +32 -15
  41. package/es/ProTable/parts/FieldControl.mjs.map +1 -1
  42. package/es/ProTable/style.mjs +9 -0
  43. package/es/ProTable/style.mjs.map +1 -1
  44. package/es/ProTable/type.d.mts +5 -2
  45. package/es/Switch/Switch.mjs +8 -1
  46. package/es/Switch/Switch.mjs.map +1 -1
  47. package/es/Switch/atoms.d.mts +7 -1
  48. package/es/Switch/atoms.mjs +20 -4
  49. package/es/Switch/atoms.mjs.map +1 -1
  50. package/es/Switch/style.mjs +33 -2
  51. package/es/Switch/style.mjs.map +1 -1
  52. package/es/Table/Table.mjs +14 -5
  53. package/es/Table/Table.mjs.map +1 -1
  54. package/es/Table/render/FixedFrost.mjs +11 -2
  55. package/es/Table/render/FixedFrost.mjs.map +1 -1
  56. package/es/Table/style.mjs +4 -0
  57. package/es/Table/style.mjs.map +1 -1
  58. package/es/Tabs/style.d.mts +1 -1
  59. package/es/Text/style.d.mts +3 -3
  60. package/es/Toast/dodge.mjs +0 -1
  61. package/es/Toast/dodge.mjs.map +1 -1
  62. package/es/Toast/dodge.stylex.mjs +1 -4
  63. package/es/Toast/dodge.stylex.mjs.map +1 -1
  64. package/es/Toast/style.mjs +1 -1
  65. package/es/Toast/style.mjs.map +1 -1
  66. package/es/Tooltip/style.mjs +2 -2
  67. package/es/Tooltip/style.mjs.map +1 -1
  68. package/es/color/index.d.mts +2 -1
  69. package/es/color/index.mjs +2 -1
  70. package/es/color/status/error.mjs +67 -0
  71. package/es/color/status/error.mjs.map +1 -0
  72. package/es/color/status/index.d.mts +11 -0
  73. package/es/color/status/index.mjs +15 -0
  74. package/es/color/status/index.mjs.map +1 -0
  75. package/es/color/status/info.mjs +67 -0
  76. package/es/color/status/info.mjs.map +1 -0
  77. package/es/color/status/success.mjs +67 -0
  78. package/es/color/status/success.mjs.map +1 -0
  79. package/es/color/status/warning.mjs +67 -0
  80. package/es/color/status/warning.mjs.map +1 -0
  81. package/es/index.d.mts +6 -3
  82. package/es/index.mjs +5 -2
  83. package/es/style.css +114 -23
  84. package/es/styles/index.d.mts +3 -2
  85. package/es/styles/index.mjs +3 -2
  86. package/es/styles/stylex/cssVar.stylex.mjs +3 -0
  87. package/es/styles/stylex/cssVar.stylex.mjs.map +1 -1
  88. package/es/styles/theme/createLobeToken.d.mts +9 -5
  89. package/es/styles/theme/createLobeToken.mjs +3 -2
  90. package/es/styles/theme/createLobeToken.mjs.map +1 -1
  91. package/es/styles/theme/customPalette.d.mts +6 -0
  92. package/es/styles/theme/customPalette.mjs +28 -0
  93. package/es/styles/theme/customPalette.mjs.map +1 -0
  94. package/es/styles/theme/customPrimary.mjs +52 -17
  95. package/es/styles/theme/customPrimary.mjs.map +1 -1
  96. package/es/styles/theme/scope.d.mts +4 -2
  97. package/es/styles/theme/scope.mjs +53 -20
  98. package/es/styles/theme/scope.mjs.map +1 -1
  99. package/es/styles/theme/themeCss.d.mts +1 -0
  100. package/es/styles/theme/themeCss.mjs +16 -1
  101. package/es/styles/theme/themeCss.mjs.map +1 -1
  102. package/es/styles/theme/token/legacy.mjs +12 -12
  103. package/es/styles/theme/token/legacy.mjs.map +1 -1
  104. package/es/styles/theme/token/neutral.mjs +12 -4
  105. package/es/styles/theme/token/neutral.mjs.map +1 -1
  106. package/es/styles/theme/token/neutralText.mjs +91 -0
  107. package/es/styles/theme/token/neutralText.mjs.map +1 -0
  108. package/es/styles/theme/token/palette.mjs +16 -41
  109. package/es/styles/theme/token/palette.mjs.map +1 -1
  110. package/es/styles/theme/token/static.mjs +3 -0
  111. package/es/styles/theme/token/static.mjs.map +1 -1
  112. package/es/theme.css +293 -290
  113. package/package.json +1 -1
@@ -47,11 +47,11 @@ export type PickerLocaleInput = Omit<Partial<PickerLocale>, 'lang' | 'timePicker
47
47
  timePickerLocale?: TimePickerLocale;
48
48
  };
49
49
  /** A `presets` entry: `value` may be a function, evaluated when the preset is hovered or picked. */
50
- export type PresetDate<T = Dayjs> = ValueDate<T>;
50
+ export type PresetDate<T = Date> = ValueDate<T>;
51
51
  /** `components`: replace a panel (`date` / `week` / … / `time`), the `input` or the OK `button`. */
52
- export type PickerComponents = Components<Dayjs>;
52
+ export type PickerComponents = Components<Date>;
53
53
  /** Props a custom panel in `components` receives (`value`, `onSelect`, `onHover`, …). */
54
- export type PickerPanelProps = SharedPanelProps<Dayjs>;
54
+ export type PickerPanelProps<DateType extends object = Date> = SharedPanelProps<DateType>;
55
55
  export type PickerSize = 'large' | 'medium' | 'small';
56
56
  export type PickerVariant = 'outlined' | 'borderless' | 'filled' | 'underlined';
57
57
  export type PickerStatus = 'error' | 'warning';
@@ -107,7 +107,7 @@ interface LobePickerProps {
107
107
  variant?: PickerVariant;
108
108
  }
109
109
  /** Props `tagRender` receives for each picked date in `multiple` mode. */
110
- export interface PickerTagProps<DateType extends object = Dayjs> {
110
+ export interface PickerTagProps<DateType extends object = Date> {
111
111
  closable: boolean;
112
112
  disabled: boolean;
113
113
  /** The date formatted with `format`. */
@@ -118,25 +118,39 @@ export interface PickerTagProps<DateType extends object = Dayjs> {
118
118
  }
119
119
  /** `dateString` of a value: a string per date in `multiple` mode. */
120
120
  export type PickerDateStrings<ValueType> = ValueType extends readonly unknown[] ? string[] : string | null;
121
+ /**
122
+ * Date inputs the previous lobe DatePicker took (native `Date`), plus date strings and
123
+ * timestamps. On the dayjs pickers they are converted to `Dayjs`; callbacks always get `Dayjs`.
124
+ */
125
+ export type LegacyDateInput = Date | string | number;
126
+ /** A date prop value: `Dayjs` or a `LegacyDateInput` on the dayjs pickers, else `DateType`. */
127
+ export type PickerDateInput<DateType> = DateType extends Dayjs ? Dayjs | LegacyDateInput : DateType extends Date ? Dayjs | LegacyDateInput : DateType;
128
+ /** Range `onChange` dates: never `null` on the default (native `Date`) picker, as before. */
129
+ export type RangeChangeDates<DateType extends object> = DateType extends Date ? DateRangeValue<DateType> : DateRangeValue<DateType> | null;
130
+ export type RangeChangeStrings<DateType extends object> = DateType extends Date ? [string, string] : [string, string] | null;
131
+ /** `PickerDateInput` for a single value or each date of a `multiple` array. */
132
+ export type PickerValueInput<ValueType> = ValueType extends readonly (infer D)[] ? PickerDateInput<D>[] : PickerDateInput<ValueType>;
121
133
  /**
122
134
  * antd's `PickerPropsWithMultiple`: `InnerPickerProps` with the value props typed by
123
135
  * `ValueType` — `DateType` for one date, `DateType[]` with `multiple`.
124
136
  */
125
137
  export type PickerPropsWithMultiple<DateType, InnerPickerProps, ValueType = DateType> = Omit<InnerPickerProps, 'defaultValue' | 'onCalendarChange' | 'onChange' | 'onOk' | 'value'> & {
126
- defaultValue?: ValueType | null;
127
- onCalendarChange?: (date: ValueType | null, dateString: PickerDateStrings<ValueType>, info: BaseInfo) => void;
138
+ /** Also takes a native `Date`, date string or timestamp (converted to `Dayjs`). */
139
+ defaultValue?: PickerValueInput<ValueType> | null;
140
+ onCalendarChange?(date: ValueType | null, dateString: PickerDateStrings<ValueType>, info: BaseInfo): void;
128
141
  /** Cleared: `null` for one date, `[]` with `multiple`. */
129
- onChange?: (date: ValueType | null, dateString: PickerDateStrings<ValueType>) => void;
130
- onOk?: (date?: ValueType | null) => void;
131
- value?: ValueType | null;
142
+ onChange?(date: ValueType | null, dateString: PickerDateStrings<ValueType>): void;
143
+ onOk?(date?: ValueType | null): void;
144
+ /** Also takes a native `Date`, date string or timestamp (converted to `Dayjs`). */
145
+ value?: PickerValueInput<ValueType> | null;
132
146
  };
133
147
  /**
134
148
  * DatePicker props other than the value ones, which `PickerPropsWithMultiple` adds.
135
149
  * `DateType` is the date library's type (`Dayjs`, or another one with `generatePicker`).
136
150
  */
137
- export interface DatePickerBaseProps<DateType extends object = Dayjs> extends Omit<PickerProps$1<DateType>, InternalRcProps | MultipleRcProps | ValueRcProps>, LobePickerProps {
151
+ export interface DatePickerBaseProps<DateType extends object = Date> extends Omit<PickerProps$1<DateType>, InternalRcProps | MultipleRcProps | ValueRcProps>, LobePickerProps {
138
152
  /** Semantic DOM class names: `root` / `prefix` / `input` / `suffix` and `popup.*`. */
139
- classNames?: PickerClassNames<DatePickerProps<any>>;
153
+ classNames?: PickerClassNames<DatePickerBaseProps<DateType>>;
140
154
  /**
141
155
  * antd `PickerLocale`: `lang` texts and formats (`fieldDateFormat`, `yearFormat`,
142
156
  * `shortWeekDays`, …) and `timePickerLocale`. Defaults to the locale generated from the
@@ -165,7 +179,7 @@ export interface DatePickerBaseProps<DateType extends object = Dayjs> extends Om
165
179
  /** `multiple`: the remove icon of each tag. */
166
180
  removeIcon?: ReactNode;
167
181
  /** Semantic DOM styles: `root` / `prefix` / `input` / `suffix` and `popup.*`. */
168
- styles?: PickerStyles<DatePickerProps<any>>;
182
+ styles?: PickerStyles<DatePickerBaseProps<DateType>>;
169
183
  /** `multiple`: render each picked date's tag, e.g. with base-ui `Tag`. */
170
184
  tagRender?: (props: PickerTagProps<DateType>) => ReactNode;
171
185
  }
@@ -173,19 +187,19 @@ export interface DatePickerBaseProps<DateType extends object = Dayjs> extends Om
173
187
  * `ValueType` is `Dayjs` (default) or `Dayjs[]` with `multiple`; `<DatePicker multiple>`
174
188
  * infers `Dayjs[]` by itself.
175
189
  */
176
- export type DatePickerProps<ValueType = Dayjs> = PickerPropsWithMultiple<Dayjs, DatePickerBaseProps, ValueType>;
177
- export type DateRangeValue<DateType extends object = Dayjs> = [DateType | null, DateType | null];
190
+ export type DatePickerProps<ValueType = Date> = PickerPropsWithMultiple<Date, DatePickerBaseProps, ValueType>;
191
+ export type DateRangeValue<DateType extends object = Date> = [DateType | null, DateType | null];
178
192
  /** Which end of a range an event belongs to. */
179
193
  export interface RangeInfo {
180
194
  range: 'start' | 'end';
181
195
  }
182
196
  /** `info.from` is the end picked first in the current range selection. */
183
- export type RangeDisabledDate<DateType extends object = Dayjs> = (current: DateType, info: {
197
+ export type RangeDisabledDate<DateType extends object = Date> = (current: DateType, info: {
184
198
  from?: DateType;
185
199
  type: PanelMode;
186
200
  }) => boolean;
187
201
  type RangeRcProps = 'allowEmpty' | 'disabled' | 'disabledDate' | 'id' | 'onBlur' | 'onFocus' | 'order';
188
- export interface DateRangePickerProps<DateType extends object = Dayjs> extends Omit<RangePickerProps$1<DateType>, InternalRcProps | RangeRcProps | ValueRcProps>, LobePickerProps {
202
+ export interface DateRangePickerProps<DateType extends object = Date> extends Omit<RangePickerProps$1<DateType>, InternalRcProps | RangeRcProps | ValueRcProps>, LobePickerProps {
189
203
  /**
190
204
  * Allow leaving the start / end empty; `true` applies to both ends.
191
205
  * @default [false, false]
@@ -193,7 +207,8 @@ export interface DateRangePickerProps<DateType extends object = Dayjs> extends O
193
207
  allowEmpty?: boolean | [boolean, boolean];
194
208
  /** Semantic DOM class names, see `DatePickerProps['classNames']`. */
195
209
  classNames?: PickerClassNames<DateRangePickerProps<DateType>>;
196
- defaultValue?: [DateType | null | undefined, DateType | null | undefined];
210
+ /** Each end also takes a native `Date`, date string or timestamp (converted to `Dayjs`). */
211
+ defaultValue?: [PickerDateInput<DateType> | null | undefined, PickerDateInput<DateType> | null | undefined];
197
212
  /** Disable the whole picker, or each end separately with `[start, end]`. */
198
213
  disabled?: boolean | [boolean, boolean];
199
214
  /** Receives `info.from` once one end is picked, e.g. to limit the range length. */
@@ -206,10 +221,12 @@ export interface DateRangePickerProps<DateType extends object = Dayjs> extends O
206
221
  /** antd `PickerLocale`, see `DatePickerProps['locale']`. */
207
222
  locale?: PickerLocaleInput;
208
223
  onBlur?: (event: FocusEvent<HTMLElement>, info: RangeInfo) => void;
209
- onCalendarChange?: (dates: DateRangeValue<DateType>, dateStrings: [string, string], info: RangeInfo) => void;
210
- onChange?: (dates: DateRangeValue<DateType> | null, dateStrings: [string, string] | null) => void;
224
+ onCalendarChange?(dates: DateRangeValue<DateType>, dateStrings: [string, string], info: RangeInfo): void;
225
+ /** Cleared: `null` (antd). */
226
+ /** Cleared: `[null, null]` on the default (native `Date`) picker, `null` on the dayjs one (antd). */
227
+ onChange?(dates: RangeChangeDates<DateType>, dateStrings: RangeChangeStrings<DateType>): void;
211
228
  onFocus?: (event: FocusEvent<HTMLElement>, info: RangeInfo) => void;
212
- onOk?: (dates: DateRangeValue<DateType>) => void;
229
+ onOk?(dates: DateRangeValue<DateType>): void;
213
230
  /**
214
231
  * Swap the ends when the end is earlier than the start; `false` keeps them as entered.
215
232
  * @default true
@@ -220,21 +237,22 @@ export interface DateRangePickerProps<DateType extends object = Dayjs> extends O
220
237
  ref?: Ref<RangePickerRef>;
221
238
  /** Semantic DOM styles, see `DatePickerProps['styles']`. */
222
239
  styles?: PickerStyles<DateRangePickerProps<DateType>>;
223
- value?: [DateType | null | undefined, DateType | null | undefined] | null;
240
+ /** Each end also takes a native `Date`, date string or timestamp (converted to `Dayjs`). */
241
+ value?: [PickerDateInput<DateType> | null | undefined, PickerDateInput<DateType> | null | undefined] | null;
224
242
  }
225
243
  /** antd `PickerProps<DateType>`: DatePicker props over any date library's type. */
226
- export type PickerProps<DateType extends object = Dayjs, ValueType = DateType> = PickerPropsWithMultiple<DateType, DatePickerBaseProps<DateType>, ValueType>;
244
+ export type PickerProps<DateType extends object = Date, ValueType = DateType> = PickerPropsWithMultiple<DateType, DatePickerBaseProps<DateType>, ValueType>;
227
245
  /** Props of `DatePicker.WeekPicker` / `MonthPicker` / … : `picker` is fixed. */
228
- export type PresetPickerProps<DateType extends object = Dayjs, ValueType = DateType> = Omit<PickerProps<DateType, ValueType>, 'picker'>;
229
- export type WeekPickerProps<ValueType = Dayjs> = PresetPickerProps<Dayjs, ValueType>;
230
- export type MonthPickerProps<ValueType = Dayjs> = PresetPickerProps<Dayjs, ValueType>;
231
- export type YearPickerProps<ValueType = Dayjs> = PresetPickerProps<Dayjs, ValueType>;
232
- export type QuarterPickerProps<ValueType = Dayjs> = PresetPickerProps<Dayjs, ValueType>;
246
+ export type PresetPickerProps<DateType extends object = Date, ValueType = DateType> = Omit<PickerProps<DateType, ValueType>, 'picker'>;
247
+ export type WeekPickerProps<ValueType = Date> = PresetPickerProps<Date, ValueType>;
248
+ export type MonthPickerProps<ValueType = Date> = PresetPickerProps<Date, ValueType>;
249
+ export type YearPickerProps<ValueType = Date> = PresetPickerProps<Date, ValueType>;
250
+ export type QuarterPickerProps<ValueType = Date> = PresetPickerProps<Date, ValueType>;
233
251
  /** antd `GenericTimePickerProps`: `DatePicker.TimePicker` has no `picker` / `showTime`. */
234
- export type GenericTimePickerProps<DateType extends object = Dayjs, ValueType = DateType> = Omit<PickerProps<DateType, ValueType>, 'picker' | 'showTime'>;
235
- export type TimePickerProps<ValueType = Dayjs> = GenericTimePickerProps<Dayjs, ValueType>;
252
+ export type GenericTimePickerProps<DateType extends object = Date, ValueType = DateType> = Omit<PickerProps<DateType, ValueType>, 'picker' | 'showTime'>;
253
+ export type TimePickerProps<ValueType = Date> = GenericTimePickerProps<Date, ValueType>;
236
254
  /** antd-style alias of `DateRangePickerProps`. */
237
- export type RangePickerProps<DateType extends object = Dayjs> = DateRangePickerProps<DateType>;
255
+ export type RangePickerProps<DateType extends object = Date> = DateRangePickerProps<DateType>;
238
256
  /** antd `DatePickerSemanticType`: the Semantic DOM `classNames` / `styles` shapes. */
239
257
  export interface DatePickerSemanticType {
240
258
  classNames?: PickerSemanticClassNames;
@@ -263,14 +281,22 @@ export interface GeneratedDatePicker<DateType extends object> extends SinglePick
263
281
  WeekPicker: SinglePickerComponent<DateType, Omit<DatePickerBaseProps<DateType>, 'picker'>>;
264
282
  YearPicker: SinglePickerComponent<DateType, Omit<DatePickerBaseProps<DateType>, 'picker'>>;
265
283
  }
266
- /** The default `DatePicker` (Dayjs), with antd's pure panels and `generatePicker`. */
267
- export interface DatePickerType extends GeneratedDatePicker<Dayjs> {
284
+ /** The default `DatePicker` (native `Date`) or `DayjsDatePicker`, with antd's pure panels and `generatePicker`. */
285
+ export interface DatePickerType<D extends object = Date> extends GeneratedDatePicker<D> {
268
286
  /** Debug only: the popup panel rendered inline, always open (antd `render-panel`). */
269
- _InternalPanelDoNotUseOrYouWillBeFired: ComponentType<DatePickerProps<any>>;
287
+ _InternalPanelDoNotUseOrYouWillBeFired: ComponentType<PickerPropsWithMultiple<D, DatePickerBaseProps<D>, any>>;
270
288
  /** Debug only: the RangePicker popup panel rendered inline, always open. */
271
- _InternalRangePanelDoNotUseOrYouWillBeFired: ComponentType<DateRangePickerProps>;
289
+ _InternalRangePanelDoNotUseOrYouWillBeFired: ComponentType<DateRangePickerProps<D>>;
272
290
  generatePicker: <DateType extends object>(generateConfig: GenerateConfig<DateType>) => GeneratedDatePicker<DateType>;
273
291
  }
292
+ /** `DayjsDatePicker`: the antd-aligned DatePicker over `Dayjs`. */
293
+ export type DayjsDatePickerType = DatePickerType<Dayjs>;
294
+ /** `DayjsDatePicker` props: values and callbacks use `Dayjs` (`Dayjs[]` with `multiple`). */
295
+ export type DayjsDatePickerProps<ValueType = Dayjs> = PickerPropsWithMultiple<Dayjs, DatePickerBaseProps<Dayjs>, ValueType>;
296
+ /** `DayjsDateRangePicker` props. */
297
+ export type DayjsDateRangePickerProps = DateRangePickerProps<Dayjs>;
298
+ /** `DayjsDateRangePicker` value: `[Dayjs | null, Dayjs | null]`. */
299
+ export type DayjsDateRangeValue = DateRangeValue<Dayjs>;
274
300
  //#endregion
275
301
  export type { CellRender, CellRenderInfo, GenerateConfig, PanelMode, PickerMode, PickerRef, RangePickerRef };
276
302
  //# sourceMappingURL=type.d.mts.map
@@ -5,6 +5,7 @@ import { jsx } from "react/jsx-runtime";
5
5
  const sameDay = (a, b) => {
6
6
  if (!a || !b) return !a && !b;
7
7
  if (typeof a.isSame === "function") return a.isSame(b, "day");
8
+ if (a instanceof Date && b instanceof Date) return a.toDateString() === b.toDateString();
8
9
  return a === b;
9
10
  };
10
11
  const sameValue = (a, b) => {
@@ -1 +1 @@
1
- {"version":3,"file":"usePresetActive.mjs","names":[],"sources":["../../src/DatePicker/usePresetActive.tsx"],"sourcesContent":["import { type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport { PREFIX_CLS } from './style';\n\ninterface Preset {\n label: ReactNode;\n value: unknown;\n}\n\nconst sameDay = (a: any, b: any): boolean => {\n if (!a || !b) return !a && !b;\n if (typeof a.isSame === 'function') return a.isSame(b, 'day');\n return a === b;\n};\n\nconst sameValue = (a: any, b: any): boolean => {\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n return a.every((item, i) => sameDay(item, b[i]));\n }\n return sameDay(a, b);\n};\n\nexport const PRESET_ACTIVE_CLS = `${PREFIX_CLS}-preset-active`;\n\n/**\n * rc-picker renders `presets` as the popup sidebar but has no \"current preset\" state.\n * Mirror the picked value (controlled or not) and wrap the matching preset's label so the\n * sidebar can show it as selected (`li:has(> .lobe-picker-preset-active)`).\n */\nexport const usePresetActive = <P extends Preset>(\n presets: P[] | undefined,\n value: unknown,\n defaultValue: unknown,\n) => {\n const [inner, setInner] = useState<unknown>(defaultValue);\n const current = value !== undefined ? value : inner;\n\n const track = useCallback((next: unknown) => setInner(next), []);\n\n const mapped = useMemo(() => {\n if (!presets?.length || !current) return presets;\n return presets.map((preset) => {\n const v =\n typeof preset.value === 'function' ? (preset.value as () => unknown)() : preset.value;\n if (!sameValue(v, current)) return preset;\n return { ...preset, label: <span className={PRESET_ACTIVE_CLS}>{preset.label}</span> };\n });\n }, [presets, current]);\n\n return { presets: mapped, track };\n};\n"],"mappings":";;;;AASA,MAAM,WAAW,GAAQ,MAAoB;CAC3C,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;CAC5B,IAAI,OAAO,EAAE,WAAW,YAAY,OAAO,EAAE,OAAO,GAAG,KAAK;CAC5D,OAAO,MAAM;AACf;AAEA,MAAM,aAAa,GAAQ,MAAoB;CAC7C,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,GAAG;EACxC,IAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,OAAO;EAC5E,OAAO,EAAE,OAAO,MAAM,MAAM,QAAQ,MAAM,EAAE,EAAE,CAAC;CACjD;CACA,OAAO,QAAQ,GAAG,CAAC;AACrB;AAEA,MAAa,oBAAoB,GAAG,WAAW;;;;;;AAO/C,MAAa,mBACX,SACA,OACA,iBACG;CACH,MAAM,CAAC,OAAO,YAAY,SAAkB,YAAY;CACxD,MAAM,UAAU,UAAU,KAAA,IAAY,QAAQ;CAE9C,MAAM,QAAQ,aAAa,SAAkB,SAAS,IAAI,GAAG,CAAC,CAAC;CAY/D,OAAO;EAAE,SAVM,cAAc;GAC3B,IAAI,CAAC,SAAS,UAAU,CAAC,SAAS,OAAO;GACzC,OAAO,QAAQ,KAAK,WAAW;IAC7B,MAAM,IACJ,OAAO,OAAO,UAAU,aAAc,OAAO,MAAwB,IAAI,OAAO;IAClF,IAAI,CAAC,UAAU,GAAG,OAAO,GAAG,OAAO;IACnC,OAAO;KAAE,GAAG;KAAQ,OAAO,oBAAC,QAAD;MAAM,WAAW;MAAoB,UAAA,OAAO;KAAY,CAAA;IAAE;GACvF,CAAC;EACH,GAAG,CAAC,SAAS,OAAO,CAEG;EAAG;CAAM;AAClC"}
1
+ {"version":3,"file":"usePresetActive.mjs","names":[],"sources":["../../src/DatePicker/usePresetActive.tsx"],"sourcesContent":["import { type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport { PREFIX_CLS } from './style';\n\ninterface Preset {\n label: ReactNode;\n value: unknown;\n}\n\nconst sameDay = (a: any, b: any): boolean => {\n if (!a || !b) return !a && !b;\n if (typeof a.isSame === 'function') return a.isSame(b, 'day');\n if (a instanceof Date && b instanceof Date) return a.toDateString() === b.toDateString();\n return a === b;\n};\n\nconst sameValue = (a: any, b: any): boolean => {\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n return a.every((item, i) => sameDay(item, b[i]));\n }\n return sameDay(a, b);\n};\n\nexport const PRESET_ACTIVE_CLS = `${PREFIX_CLS}-preset-active`;\n\n/**\n * rc-picker renders `presets` as the popup sidebar but has no \"current preset\" state.\n * Mirror the picked value (controlled or not) and wrap the matching preset's label so the\n * sidebar can show it as selected (`li:has(> .lobe-picker-preset-active)`).\n */\nexport const usePresetActive = <P extends Preset>(\n presets: P[] | undefined,\n value: unknown,\n defaultValue: unknown,\n) => {\n const [inner, setInner] = useState<unknown>(defaultValue);\n const current = value !== undefined ? value : inner;\n\n const track = useCallback((next: unknown) => setInner(next), []);\n\n const mapped = useMemo(() => {\n if (!presets?.length || !current) return presets;\n return presets.map((preset) => {\n const v =\n typeof preset.value === 'function' ? (preset.value as () => unknown)() : preset.value;\n if (!sameValue(v, current)) return preset;\n return { ...preset, label: <span className={PRESET_ACTIVE_CLS}>{preset.label}</span> };\n });\n }, [presets, current]);\n\n return { presets: mapped, track };\n};\n"],"mappings":";;;;AASA,MAAM,WAAW,GAAQ,MAAoB;CAC3C,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;CAC5B,IAAI,OAAO,EAAE,WAAW,YAAY,OAAO,EAAE,OAAO,GAAG,KAAK;CAC5D,IAAI,aAAa,QAAQ,aAAa,MAAM,OAAO,EAAE,aAAa,MAAM,EAAE,aAAa;CACvF,OAAO,MAAM;AACf;AAEA,MAAM,aAAa,GAAQ,MAAoB;CAC7C,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,GAAG;EACxC,IAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,OAAO;EAC5E,OAAO,EAAE,OAAO,MAAM,MAAM,QAAQ,MAAM,EAAE,EAAE,CAAC;CACjD;CACA,OAAO,QAAQ,GAAG,CAAC;AACrB;AAEA,MAAa,oBAAoB,GAAG,WAAW;;;;;;AAO/C,MAAa,mBACX,SACA,OACA,iBACG;CACH,MAAM,CAAC,OAAO,YAAY,SAAkB,YAAY;CACxD,MAAM,UAAU,UAAU,KAAA,IAAY,QAAQ;CAE9C,MAAM,QAAQ,aAAa,SAAkB,SAAS,IAAI,GAAG,CAAC,CAAC;CAY/D,OAAO;EAAE,SAVM,cAAc;GAC3B,IAAI,CAAC,SAAS,UAAU,CAAC,SAAS,OAAO;GACzC,OAAO,QAAQ,KAAK,WAAW;IAC7B,MAAM,IACJ,OAAO,OAAO,UAAU,aAAc,OAAO,MAAwB,IAAI,OAAO;IAClF,IAAI,CAAC,UAAU,GAAG,OAAO,GAAG,OAAO;IACnC,OAAO;KAAE,GAAG;KAAQ,OAAO,oBAAC,QAAD;MAAM,WAAW;MAAoB,UAAA,OAAO;KAAY,CAAA;IAAE;GACvF,CAAC;EACH,GAAG,CAAC,SAAS,OAAO,CAEG;EAAG;CAAM;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":[],"sources":["../../src/Drawer/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nconst softEase = 'cubic-bezier(0.32, 0.72, 0, 1)';\nconst startingOrEnding = ':is([data-starting-style], [data-ending-style])';\nconst pushTransform = 'translate(var(--drawer-push-x, 0), var(--drawer-push-y, 0))';\nconst edge = `var(--drawer-edge-width, 1px)`;\n\n/* antd's boxShadowDrawer{Left,Right,Up,Down} geometry and alphas, scaled against colorShadow's own\n alpha (opaque black in light, rgba(255,255,255,0.2) in dark). Direction styles set the cast sign\n and weight styles scale the alpha, so the two compose without a style per combination. */\nconst castShadow = (x: number, y: number, blur: number, spread: number, alpha: number) =>\n `calc(var(--drawer-cast-x, 0) * ${x}px) calc(var(--drawer-cast-y, 0) * ${y}px) ${blur}px ${spread}px color-mix(in srgb, var(--lobe-color-shadow, #000) calc(${alpha}% * var(--drawer-cast-alpha, 1)), transparent)`;\n\nconst panelShadow = `${castShadow(6, 6, 16, 0, 8)}, ${castShadow(3, 3, 6, -4, 12)}, ${castShadow(9, 9, 28, 8, 5)}`;\n\nexport const styles = stylex.create({\n backdrop: {\n inset: 0,\n transition: `opacity 180ms ${softEase}`,\n backgroundColor: cssVar.colorBgMask,\n opacity: { default: null, [startingOrEnding]: 0 },\n position: 'fixed',\n zIndex: 1200,\n },\n\n popup: {\n display: 'flex',\n pointerEvents: 'none',\n position: 'fixed',\n zIndex: 1201,\n /* Clamped here rather than on the panel, so an oversized size prop shrinks the box instead of\n detaching the panel from its anchored edge. */\n maxHeight: '100dvh',\n maxWidth: '100dvw',\n },\n\n popupLeft: {\n insetBlock: 0,\n insetInlineStart: 0,\n },\n\n popupRight: {\n insetBlock: 0,\n insetInlineEnd: 0,\n },\n\n popupTop: {\n insetInline: 0,\n insetBlockStart: 0,\n },\n\n popupBottom: {\n insetInline: 0,\n insetBlockEnd: 0,\n },\n\n panel: {\n flex: '1',\n overflow: 'hidden',\n transition: `transform 300ms ${softEase}`,\n backgroundColor: cssVar.colorBgContainer,\n boxShadow: panelShadow,\n boxSizing: 'border-box',\n display: 'flex',\n flexDirection: 'column',\n pointerEvents: 'auto',\n position: 'relative',\n transform: pushTransform,\n minHeight: 0,\n minWidth: 0,\n },\n\n panelLeft: {\n '--drawer-cast-x': '1',\n 'borderInlineEndColor': cssVar.colorBorder,\n 'borderInlineEndStyle': 'solid',\n 'borderInlineEndWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateX(-100%)' },\n },\n\n panelRight: {\n '--drawer-cast-x': '-1',\n 'borderInlineStartColor': cssVar.colorBorder,\n 'borderInlineStartStyle': 'solid',\n 'borderInlineStartWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateX(100%)' },\n },\n\n panelTop: {\n '--drawer-cast-y': '1',\n 'borderBlockEndColor': cssVar.colorBorder,\n 'borderBlockEndStyle': 'solid',\n 'borderBlockEndWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateY(-100%)' },\n },\n\n panelBottom: {\n '--drawer-cast-y': '-1',\n 'borderBlockStartColor': cssVar.colorBorder,\n 'borderBlockStartStyle': 'solid',\n 'borderBlockStartWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateY(100%)' },\n },\n\n panelRoundedLeft: {\n borderEndEndRadius: 12,\n borderStartEndRadius: 12,\n },\n\n panelRoundedRight: {\n borderEndStartRadius: 12,\n borderStartStartRadius: 12,\n },\n\n panelRoundedTop: {\n borderEndEndRadius: 12,\n borderEndStartRadius: 12,\n },\n\n panelRoundedBottom: {\n borderStartEndRadius: 12,\n borderStartStartRadius: 12,\n },\n\n panelFlush: {\n '--drawer-cast-alpha': '0',\n '--drawer-edge-width': '0',\n },\n\n panelBoosted: {\n '--drawer-cast-alpha': '1.75',\n },\n\n panelRecessed: {\n '--drawer-cast-alpha': '0.5',\n },\n\n header: {\n flex: 'none',\n gap: 8,\n paddingBlock: 12,\n paddingInline: 16,\n alignItems: 'center',\n borderBlockEndColor: cssVar.colorSplit,\n borderBlockEndStyle: 'solid',\n borderBlockEndWidth: 1,\n display: 'flex',\n justifyContent: 'space-between',\n minHeight: 56,\n },\n\n containerInner: {\n flex: '1',\n gap: 8,\n marginInline: 'auto',\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n },\n\n containerInnerFooter: {\n justifyContent: 'flex-end',\n },\n\n title: {\n margin: 0,\n color: cssVar.colorText,\n fontSize: 17,\n fontWeight: 600,\n letterSpacing: '-0.005em',\n lineHeight: 1.4,\n },\n\n extra: {\n flex: 'none',\n gap: 4,\n alignItems: 'center',\n display: 'flex',\n marginInlineEnd: -4,\n },\n\n extraFloating: {\n insetBlockStart: 12,\n insetInlineEnd: 12,\n marginInlineEnd: 0,\n position: 'absolute',\n zIndex: 1,\n },\n\n close: {\n 'padding': 0,\n 'borderColor': 'currentcolor',\n 'borderRadius': 8,\n 'borderStyle': 'none',\n 'borderWidth': 'medium',\n 'transition': `color 160ms ${softEase}, background 160ms ${softEase}, transform 160ms ${softEase}`,\n 'alignItems': 'center',\n 'backgroundColor': { default: 'transparent', ':hover': cssVar.colorFillSecondary },\n 'color': { default: cssVar.colorTextTertiary, ':hover': cssVar.colorText },\n 'cursor': 'pointer',\n 'display': 'flex',\n 'justifyContent': 'center',\n 'position': 'relative',\n 'transform': {\n default: null,\n ':hover:not(:active)': 'scale(1.04)',\n ':active': 'scale(0.96)',\n },\n 'height': 32,\n 'width': 32,\n '::after': {\n inset: -4,\n content: '\"\"',\n position: 'absolute',\n },\n },\n\n content: {\n flex: '1',\n display: 'flex',\n minHeight: 0,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n\n bodyContent: {\n marginInline: 'auto',\n paddingBlock: 12,\n paddingInline: 16,\n display: 'flex',\n flexDirection: 'column',\n minHeight: '100%',\n width: '100%',\n },\n\n contentSidebar: {\n overflowX: 'hidden',\n overflowY: 'hidden',\n },\n\n bodyContentSidebar: {\n paddingBlock: 0,\n paddingInline: 0,\n flexDirection: 'row',\n height: '100%',\n minHeight: 0,\n },\n\n sidebar: {\n flex: 'none',\n paddingBlock: 12,\n paddingInline: 16,\n backgroundColor: cssVar.colorBgLayout,\n borderInlineEndColor: cssVar.colorBorderSecondary,\n borderInlineEndStyle: 'solid',\n borderInlineEndWidth: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n\n sidebarContent: {\n flex: '1',\n paddingBlock: 12,\n paddingInline: 16,\n minWidth: 0,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n\n footer: {\n flex: 'none',\n gap: 8,\n paddingBlock: 12,\n paddingInline: 16,\n alignItems: 'center',\n borderBlockStartColor: cssVar.colorSplit,\n borderBlockStartStyle: 'solid',\n borderBlockStartWidth: 1,\n display: 'flex',\n justifyContent: 'flex-end',\n },\n});\n"],"mappings":";AAWA,M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AQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,oBAAoB;EAClB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../src/Drawer/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nconst softEase = 'cubic-bezier(0.32, 0.72, 0, 1)';\nconst startingOrEnding = ':is([data-starting-style], [data-ending-style])';\nconst pushTransform = 'translate(var(--drawer-push-x, 0), var(--drawer-push-y, 0))';\nconst edge = `var(--drawer-edge-width, 1px)`;\n\n/* antd's boxShadowDrawer{Left,Right,Up,Down} geometry and alphas, mixed against colorShadow.\n Direction styles set the cast sign and weight styles scale the alpha, so the two compose without\n a style per combination. */\nconst castShadow = (x: number, y: number, blur: number, spread: number, alpha: number) =>\n `calc(var(--drawer-cast-x, 0) * ${x}px) calc(var(--drawer-cast-y, 0) * ${y}px) ${blur}px ${spread}px color-mix(in srgb, var(--lobe-color-shadow, #000) calc(${alpha}% * var(--drawer-cast-alpha, 1)), transparent)`;\n\nconst panelShadow = `${castShadow(6, 6, 16, 0, 8)}, ${castShadow(3, 3, 6, -4, 12)}, ${castShadow(9, 9, 28, 8, 5)}`;\n\nexport const styles = stylex.create({\n backdrop: {\n inset: 0,\n transition: `opacity 180ms ${softEase}`,\n backgroundColor: cssVar.colorBgMask,\n opacity: { default: null, [startingOrEnding]: 0 },\n position: 'fixed',\n zIndex: 1200,\n },\n\n popup: {\n display: 'flex',\n pointerEvents: 'none',\n position: 'fixed',\n zIndex: 1201,\n /* Clamped here rather than on the panel, so an oversized size prop shrinks the box instead of\n detaching the panel from its anchored edge. */\n maxHeight: '100dvh',\n maxWidth: '100dvw',\n },\n\n popupLeft: {\n insetBlock: 0,\n insetInlineStart: 0,\n },\n\n popupRight: {\n insetBlock: 0,\n insetInlineEnd: 0,\n },\n\n popupTop: {\n insetInline: 0,\n insetBlockStart: 0,\n },\n\n popupBottom: {\n insetInline: 0,\n insetBlockEnd: 0,\n },\n\n panel: {\n flex: '1',\n overflow: 'hidden',\n transition: `transform 300ms ${softEase}`,\n backgroundColor: cssVar.colorBgContainer,\n boxShadow: panelShadow,\n boxSizing: 'border-box',\n display: 'flex',\n flexDirection: 'column',\n pointerEvents: 'auto',\n position: 'relative',\n transform: pushTransform,\n minHeight: 0,\n minWidth: 0,\n },\n\n panelLeft: {\n '--drawer-cast-x': '1',\n 'borderInlineEndColor': cssVar.colorBorder,\n 'borderInlineEndStyle': 'solid',\n 'borderInlineEndWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateX(-100%)' },\n },\n\n panelRight: {\n '--drawer-cast-x': '-1',\n 'borderInlineStartColor': cssVar.colorBorder,\n 'borderInlineStartStyle': 'solid',\n 'borderInlineStartWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateX(100%)' },\n },\n\n panelTop: {\n '--drawer-cast-y': '1',\n 'borderBlockEndColor': cssVar.colorBorder,\n 'borderBlockEndStyle': 'solid',\n 'borderBlockEndWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateY(-100%)' },\n },\n\n panelBottom: {\n '--drawer-cast-y': '-1',\n 'borderBlockStartColor': cssVar.colorBorder,\n 'borderBlockStartStyle': 'solid',\n 'borderBlockStartWidth': edge,\n 'transform': { default: pushTransform, [startingOrEnding]: 'translateY(100%)' },\n },\n\n panelRoundedLeft: {\n borderEndEndRadius: 12,\n borderStartEndRadius: 12,\n },\n\n panelRoundedRight: {\n borderEndStartRadius: 12,\n borderStartStartRadius: 12,\n },\n\n panelRoundedTop: {\n borderEndEndRadius: 12,\n borderEndStartRadius: 12,\n },\n\n panelRoundedBottom: {\n borderStartEndRadius: 12,\n borderStartStartRadius: 12,\n },\n\n panelFlush: {\n '--drawer-cast-alpha': '0',\n '--drawer-edge-width': '0',\n },\n\n panelBoosted: {\n '--drawer-cast-alpha': '1.75',\n },\n\n panelRecessed: {\n '--drawer-cast-alpha': '0.5',\n },\n\n header: {\n flex: 'none',\n gap: 8,\n paddingBlock: 12,\n paddingInline: 16,\n alignItems: 'center',\n borderBlockEndColor: cssVar.colorSplit,\n borderBlockEndStyle: 'solid',\n borderBlockEndWidth: 1,\n display: 'flex',\n justifyContent: 'space-between',\n minHeight: 56,\n },\n\n containerInner: {\n flex: '1',\n gap: 8,\n marginInline: 'auto',\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n },\n\n containerInnerFooter: {\n justifyContent: 'flex-end',\n },\n\n title: {\n margin: 0,\n color: cssVar.colorText,\n fontSize: 17,\n fontWeight: 600,\n letterSpacing: '-0.005em',\n lineHeight: 1.4,\n },\n\n extra: {\n flex: 'none',\n gap: 4,\n alignItems: 'center',\n display: 'flex',\n marginInlineEnd: -4,\n },\n\n extraFloating: {\n insetBlockStart: 12,\n insetInlineEnd: 12,\n marginInlineEnd: 0,\n position: 'absolute',\n zIndex: 1,\n },\n\n close: {\n 'padding': 0,\n 'borderColor': 'currentcolor',\n 'borderRadius': 8,\n 'borderStyle': 'none',\n 'borderWidth': 'medium',\n 'transition': `color 160ms ${softEase}, background 160ms ${softEase}, transform 160ms ${softEase}`,\n 'alignItems': 'center',\n 'backgroundColor': { 'default': 'transparent', ':hover': cssVar.colorFillSecondary },\n 'color': { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },\n 'cursor': 'pointer',\n 'display': 'flex',\n 'justifyContent': 'center',\n 'position': 'relative',\n 'transform': {\n 'default': null,\n ':hover:not(:active)': 'scale(1.04)',\n ':active': 'scale(0.96)',\n },\n 'height': 32,\n 'width': 32,\n '::after': {\n inset: -4,\n content: '\"\"',\n position: 'absolute',\n },\n },\n\n content: {\n flex: '1',\n display: 'flex',\n minHeight: 0,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n\n bodyContent: {\n marginInline: 'auto',\n paddingBlock: 12,\n paddingInline: 16,\n display: 'flex',\n flexDirection: 'column',\n minHeight: '100%',\n width: '100%',\n },\n\n contentSidebar: {\n overflowX: 'hidden',\n overflowY: 'hidden',\n },\n\n bodyContentSidebar: {\n paddingBlock: 0,\n paddingInline: 0,\n flexDirection: 'row',\n height: '100%',\n minHeight: 0,\n },\n\n sidebar: {\n flex: 'none',\n paddingBlock: 12,\n paddingInline: 16,\n backgroundColor: cssVar.colorBgLayout,\n borderInlineEndColor: cssVar.colorBorderSecondary,\n borderInlineEndStyle: 'solid',\n borderInlineEndWidth: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n\n sidebarContent: {\n flex: '1',\n paddingBlock: 12,\n paddingInline: 16,\n minWidth: 0,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n\n footer: {\n flex: 'none',\n gap: 8,\n paddingBlock: 12,\n paddingInline: 16,\n alignItems: 'center',\n borderBlockStartColor: cssVar.colorSplit,\n borderBlockStartStyle: 'solid',\n borderBlockStartWidth: 1,\n display: 'flex',\n justifyContent: 'flex-end',\n },\n});\n"],"mappings":";AAWA,MAAM,cAAc,GAAW,GAAW,MAAc,QAAgB,UA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AQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,oBAAoB;EAClB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
@@ -1,5 +1,6 @@
1
+ import { cssVar } from "../styles/stylex/cssVar.stylex.mjs";
1
2
  //#region src/FloatingPanel/style.ts
2
- const dodge = `608ms linear(0, 0.08, 0.249, 0.437, 0.607, 0.745, 0.847, 0.917, 0.963, 0.99, 1.004, 1.011, 1.012, 1.011, 1.009, 1.007, 1.005, 1.003, 1.002, 1)`;
3
+ const dodge = `608ms ${cssVar.motionSpringSnappy}`;
3
4
  `${dodge}${dodge}${dodge}${dodge}`;
4
5
  const styles = {
5
6
  actions: {
@@ -156,7 +157,7 @@ const styles = {
156
157
  },
157
158
  wrapper: {
158
159
  kVQacm: "lbb3r6kr",
159
- kmkexE: "lbon1zjq",
160
+ kmkexE: "lbchz62r",
160
161
  kIyJzY: "lb12w9bfk",
161
162
  k1ekBW: "lb4wkmsb",
162
163
  kAMwcw: "lb7v8fk2",
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":[],"sources":["../../src/FloatingPanel/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nconst dodgeDuration = '608ms';\nconst dodgeEase =\n 'linear(0, 0.08, 0.249, 0.437, 0.607, 0.745, 0.847, 0.917, 0.963, 0.99, 1.004, 1.011, 1.012, 1.011, 1.009, 1.007, 1.005, 1.003, 1.002, 1)';\nconst reducedMotion = '@media (prefers-reduced-motion: reduce)';\nconst dodge = `${dodgeDuration} ${dodgeEase}`;\nconst wrapperTransition = `padding-block-end ${dodge}, padding-block-start ${dodge}, padding-inline-end ${dodge}, padding-inline-start ${dodge}`;\nconst handleActive = ':is(:hover, :focus-visible)';\n\nexport const styles = stylex.create({\n actions: {\n flex: 'none',\n gap: 4,\n alignItems: 'center',\n display: 'flex',\n },\n body: {\n flex: '1',\n paddingInline: 0,\n paddingBlockEnd: 0,\n paddingBlockStart: 0,\n minHeight: 0,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n close: {\n borderRadius: 8,\n marginInlineEnd: -4,\n position: 'static',\n height: 32,\n width: 32,\n },\n footer: {\n flex: 'none',\n borderBlockStartColor: cssVar.colorBorderSecondary,\n borderBlockStartStyle: 'solid',\n borderBlockStartWidth: 1,\n },\n header: {\n flex: 'none',\n borderBlockEndColor: cssVar.colorBorderSecondary,\n borderBlockEndStyle: 'solid',\n borderBlockEndWidth: 1,\n minHeight: 48,\n },\n headerActions: {\n flex: 'none',\n gap: 4,\n alignItems: 'center',\n display: 'flex',\n },\n panel: {\n borderRadius: 12,\n boxShadow: `${cssVar.boxShadowSecondary}, var(--lobe-ring)`,\n transformOrigin: '100% 100%',\n maxHeight: 'calc(100dvh - 32px - var(--floating-panel-reserve-block-end, 0px))',\n width: 'calc(100dvw - 32px)',\n },\n panelTop: {\n transformOrigin: '100% 0',\n },\n resizeHandle: {\n 'backgroundColor': 'transparent',\n 'position': 'absolute',\n 'touchAction': 'none',\n 'zIndex': 1,\n '::after': {\n borderRadius: 999,\n transition: 'opacity 120ms ease',\n backgroundColor: cssVar.colorPrimary,\n content: '\"\"',\n opacity: { default: 0, [handleActive]: 0.55 },\n position: 'absolute',\n },\n },\n resizeHandleBottom: {\n 'insetInline': 16,\n 'cursor': 'ns-resize',\n 'insetBlockEnd': -4,\n 'height': 8,\n '::after': {\n insetInline: 0,\n insetBlockEnd: 3,\n height: 2,\n },\n },\n resizeHandleBottomLeft: {\n cursor: 'nesw-resize',\n insetBlockEnd: -5,\n insetInlineStart: -5,\n height: 16,\n width: 16,\n },\n resizeHandleBottomRight: {\n cursor: 'nwse-resize',\n insetBlockEnd: -5,\n insetInlineEnd: -5,\n height: 16,\n width: 16,\n },\n resizeHandleLeft: {\n 'insetBlock': 16,\n 'cursor': 'ew-resize',\n 'insetInlineStart': -4,\n 'width': 8,\n '::after': {\n insetBlock: 0,\n insetInlineStart: 3,\n width: 2,\n },\n },\n resizeHandleRight: {\n 'insetBlock': 16,\n 'cursor': 'ew-resize',\n 'insetInlineEnd': -4,\n 'width': 8,\n '::after': {\n insetBlock: 0,\n insetInlineEnd: 3,\n width: 2,\n },\n },\n resizeHandleTop: {\n 'insetInline': 16,\n 'cursor': 'ns-resize',\n 'insetBlockStart': -4,\n 'height': 8,\n '::after': {\n insetInline: 0,\n insetBlockStart: 3,\n height: 2,\n },\n },\n resizeHandleTopLeft: {\n cursor: 'nwse-resize',\n insetBlockStart: -5,\n insetInlineStart: -5,\n height: 16,\n width: 16,\n },\n resizeHandleTopRight: {\n cursor: 'nesw-resize',\n insetBlockStart: -5,\n insetInlineEnd: -5,\n height: 16,\n width: 16,\n },\n title: {\n flex: '1',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n minWidth: 0,\n },\n wrapper: {\n overflow: 'hidden',\n transition: wrapperTransition,\n transitionDuration: { default: null, [reducedMotion]: '0s' },\n transitionProperty: { default: null, [reducedMotion]: 'none' },\n transitionTimingFunction: { default: null, [reducedMotion]: 'ease' },\n },\n});\n"],"mappings":";AAMA,MAAM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QAAQ;EACR,OAAO;CACT;CACA,mBAAmB;EACjB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,iBAAiB;EACf,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,qBAAqB;EACnB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,sBAAsB;EACpB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../src/FloatingPanel/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nconst dodgeDuration = '608ms';\nconst dodgeEase = cssVar.motionSpringSnappy;\nconst reducedMotion = '@media (prefers-reduced-motion: reduce)';\nconst dodge = `${dodgeDuration} ${dodgeEase}`;\nconst wrapperTransition = `padding-block-end ${dodge}, padding-block-start ${dodge}, padding-inline-end ${dodge}, padding-inline-start ${dodge}`;\nconst handleActive = ':is(:hover, :focus-visible)';\n\nexport const styles = stylex.create({\n actions: {\n flex: 'none',\n gap: 4,\n alignItems: 'center',\n display: 'flex',\n },\n body: {\n flex: '1',\n paddingInline: 0,\n paddingBlockEnd: 0,\n paddingBlockStart: 0,\n minHeight: 0,\n overflowX: 'hidden',\n overflowY: 'auto',\n },\n close: {\n borderRadius: 8,\n marginInlineEnd: -4,\n position: 'static',\n height: 32,\n width: 32,\n },\n footer: {\n flex: 'none',\n borderBlockStartColor: cssVar.colorBorderSecondary,\n borderBlockStartStyle: 'solid',\n borderBlockStartWidth: 1,\n },\n header: {\n flex: 'none',\n borderBlockEndColor: cssVar.colorBorderSecondary,\n borderBlockEndStyle: 'solid',\n borderBlockEndWidth: 1,\n minHeight: 48,\n },\n headerActions: {\n flex: 'none',\n gap: 4,\n alignItems: 'center',\n display: 'flex',\n },\n panel: {\n borderRadius: 12,\n boxShadow: `${cssVar.boxShadowSecondary}, var(--lobe-ring)`,\n transformOrigin: '100% 100%',\n maxHeight: 'calc(100dvh - 32px - var(--floating-panel-reserve-block-end, 0px))',\n width: 'calc(100dvw - 32px)',\n },\n panelTop: {\n transformOrigin: '100% 0',\n },\n resizeHandle: {\n 'backgroundColor': 'transparent',\n 'position': 'absolute',\n 'touchAction': 'none',\n 'zIndex': 1,\n '::after': {\n borderRadius: 999,\n transition: 'opacity 120ms ease',\n backgroundColor: cssVar.colorPrimary,\n content: '\"\"',\n opacity: { default: 0, [handleActive]: 0.55 },\n position: 'absolute',\n },\n },\n resizeHandleBottom: {\n 'insetInline': 16,\n 'cursor': 'ns-resize',\n 'insetBlockEnd': -4,\n 'height': 8,\n '::after': {\n insetInline: 0,\n insetBlockEnd: 3,\n height: 2,\n },\n },\n resizeHandleBottomLeft: {\n cursor: 'nesw-resize',\n insetBlockEnd: -5,\n insetInlineStart: -5,\n height: 16,\n width: 16,\n },\n resizeHandleBottomRight: {\n cursor: 'nwse-resize',\n insetBlockEnd: -5,\n insetInlineEnd: -5,\n height: 16,\n width: 16,\n },\n resizeHandleLeft: {\n 'insetBlock': 16,\n 'cursor': 'ew-resize',\n 'insetInlineStart': -4,\n 'width': 8,\n '::after': {\n insetBlock: 0,\n insetInlineStart: 3,\n width: 2,\n },\n },\n resizeHandleRight: {\n 'insetBlock': 16,\n 'cursor': 'ew-resize',\n 'insetInlineEnd': -4,\n 'width': 8,\n '::after': {\n insetBlock: 0,\n insetInlineEnd: 3,\n width: 2,\n },\n },\n resizeHandleTop: {\n 'insetInline': 16,\n 'cursor': 'ns-resize',\n 'insetBlockStart': -4,\n 'height': 8,\n '::after': {\n insetInline: 0,\n insetBlockStart: 3,\n height: 2,\n },\n },\n resizeHandleTopLeft: {\n cursor: 'nwse-resize',\n insetBlockStart: -5,\n insetInlineStart: -5,\n height: 16,\n width: 16,\n },\n resizeHandleTopRight: {\n cursor: 'nesw-resize',\n insetBlockStart: -5,\n insetInlineEnd: -5,\n height: 16,\n width: 16,\n },\n title: {\n flex: '1',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n minWidth: 0,\n },\n wrapper: {\n overflow: 'hidden',\n transition: wrapperTransition,\n transitionDuration: { default: null, [reducedMotion]: '0s' },\n transitionProperty: { default: null, [reducedMotion]: 'none' },\n transitionTimingFunction: { default: null, [reducedMotion]: 'ease' },\n },\n});\n"],"mappings":";;AAMA,MAAM,QAAQ,SAFI,OAAO;AAGC,GAAqB,QAA8B,QAA6B,QAA+B;AAEzI,MAAa,SAAS;CACpB,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,eAAe;EACb,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,O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@@ const serializeForm = (form) => {
17
17
  const entries = [...new FormData(form).entries()].filter(([, value]) => typeof value === "string");
18
18
  return JSON.stringify(entries.sort((a, b) => a[0].localeCompare(b[0])));
19
19
  };
20
- const Form$1 = memo(({ className, itemMinWidth, footer, items = [], children, itemsType = "group", variant = "borderless", classNames, styles: customStyles, gap, style, collapsible, defaultActiveKey, initialValues, activeKey, onCollapse, onFinish, onFormSubmit, layout, ref, ...rest }) => {
20
+ const Form$1 = memo(({ className, itemMinWidth, footer, items = [], children, itemsType = "group", variant = "borderless", classNames, styles: customStyles, gap, style, collapsible, defaultActiveKey, initialValues, activeKey, onCollapse, onFinish, onFormSubmit, layout, ref, compact, itemPadding, ...rest }) => {
21
+ const resolvedGap = gap ?? (compact ? 12 : void 0);
22
+ const resolvedItemPadding = itemPadding ?? (compact ? 10 : void 0);
21
23
  const { mobile } = useResponsive();
22
24
  const formRef = useRef(null);
23
25
  const [submitLoading, setSubmitLoading] = useState(false);
@@ -124,7 +126,9 @@ const Form$1 = memo(({ className, itemMinWidth, footer, items = [], children, it
124
126
  rootStyles.root,
125
127
  variant === "borderless" && rootStyles.borderless
126
128
  ], className, {
127
- gap,
129
+ gap: resolvedGap,
130
+ ...resolvedGap === void 0 ? void 0 : { "--lobe-form-gap": typeof resolvedGap === "number" ? `${resolvedGap}px` : resolvedGap },
131
+ ...resolvedItemPadding === void 0 ? void 0 : { "--lobe-form-item-padding-block": typeof resolvedItemPadding === "number" ? `${resolvedItemPadding}px` : resolvedItemPadding },
128
132
  ...style
129
133
  }),
130
134
  onFormSubmit: async (values, eventDetails) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Form.mjs","names":["Form","BaseForm"],"sources":["../../src/Form/Form.tsx"],"sourcesContent":["'use client';\n\nimport { Form as BaseForm } from '@base-ui/react/form';\nimport { isUndefined } from 'es-toolkit/compat';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { styleProps } from '@/styles/stylex/props';\nimport { useResponsive } from '@/styles/theme/scope';\n\nimport FormField from './components/FormField';\nimport FormFlatGroup from './components/FormFlatGroup';\nimport FormGroup from './components/FormGroup';\nimport { FormContext } from './context';\nimport { formMarker } from './marker.stylex';\nimport { rootStyles } from './style';\nimport type { FormFieldProps, FormGroupItemType, FormProps } from './type';\n\nconst serializeForm = (form: HTMLFormElement | null) => {\n if (!form) return '';\n const entries = [...new FormData(form).entries()].filter(\n ([, value]) => typeof value === 'string',\n ) as [string, string][];\n return JSON.stringify(entries.sort((a, b) => a[0].localeCompare(b[0])));\n};\n\nconst Form = memo<FormProps>(\n ({\n className,\n itemMinWidth,\n footer,\n items = [],\n children,\n itemsType = 'group',\n variant = 'borderless',\n classNames,\n styles: customStyles,\n gap,\n style,\n collapsible,\n defaultActiveKey,\n initialValues,\n activeKey,\n onCollapse,\n onFinish,\n onFormSubmit,\n layout,\n ref,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const formRef = useRef<HTMLFormElement>(null);\n const [submitLoading, setSubmitLoading] = useState(false);\n const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);\n const snapshotRef = useRef('');\n\n const syncUnsaved = useCallback(() => {\n setHasUnsavedChanges(serializeForm(formRef.current) !== snapshotRef.current);\n }, []);\n\n useEffect(() => {\n const form = formRef.current;\n if (!form) return;\n snapshotRef.current = serializeForm(form);\n let resetTimer: ReturnType<typeof setTimeout>;\n const handleMutation = () => syncUnsaved();\n const handleReset = () => {\n resetTimer = setTimeout(() => {\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n }, 0);\n };\n form.addEventListener('input', handleMutation);\n form.addEventListener('change', handleMutation);\n form.addEventListener('reset', handleReset);\n return () => {\n clearTimeout(resetTimer);\n form.removeEventListener('input', handleMutation);\n form.removeEventListener('change', handleMutation);\n form.removeEventListener('reset', handleReset);\n };\n }, [syncUnsaved]);\n\n const requestReset = useCallback(() => {\n formRef.current?.reset();\n }, []);\n\n const mergedRef = useCallback(\n (node: HTMLFormElement | null) => {\n formRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n const context = useMemo(\n () => ({\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout: layout || (mobile ? ('vertical' as const) : ('horizontal' as const)),\n requestReset,\n submitLoading,\n variant,\n }),\n [\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout,\n mobile,\n requestReset,\n submitLoading,\n variant,\n ],\n );\n\n const mapFlat = useCallback(\n (item: FormFieldProps, itemIndex: number) => (\n <FormField\n className={classNames?.item}\n divider={itemIndex !== 0}\n key={itemIndex}\n style={customStyles?.item}\n variant={variant}\n {...item}\n />\n ),\n [variant, classNames, customStyles],\n );\n\n const mapTree = useCallback(\n (group: FormGroupItemType, groupIndex: number) => {\n const key = group?.key || groupIndex;\n return (\n <FormGroup\n active={activeKey && group?.key ? activeKey.includes(key) : undefined}\n className={classNames?.group}\n collapsible={isUndefined(group.collapsible) ? collapsible : group.collapsible}\n desc={group?.desc}\n extra={group?.extra}\n icon={group?.icon}\n key={key}\n style={customStyles?.group}\n title={group.title}\n variant={group?.variant || variant}\n defaultActive={\n defaultActiveKey && group?.key ? defaultActiveKey.includes(key) : group?.defaultActive\n }\n onCollapse={(active) => {\n let keys: (string | number)[] = activeKey || defaultActiveKey || [];\n keys = keys.filter((k) => k !== key);\n onCollapse?.(active ? [...keys, key] : keys);\n }}\n >\n {Array.isArray(group.children)\n ? group.children.filter((item) => !item.hidden).map((item, i) => mapFlat(item, i))\n : group.children}\n </FormGroup>\n );\n },\n [\n activeKey,\n collapsible,\n defaultActiveKey,\n onCollapse,\n variant,\n classNames,\n customStyles,\n mapFlat,\n ],\n );\n\n return (\n <FormContext value={context}>\n <BaseForm\n ref={mergedRef}\n {...styleProps(\n [formMarker, rootStyles.root, variant === 'borderless' && rootStyles.borderless],\n className,\n { gap, ...style },\n )}\n onFormSubmit={async (values, eventDetails) => {\n onFormSubmit?.(values, eventDetails);\n if (!onFinish) return;\n setSubmitLoading(true);\n try {\n await onFinish(values, eventDetails);\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n } finally {\n setSubmitLoading(false);\n }\n }}\n {...rest}\n >\n {items && items.length > 0 ? (\n itemsType === 'group' ? (\n (items as FormGroupItemType[]).map((item, i) => mapTree(item, i))\n ) : (\n <FormFlatGroup\n className={classNames?.group}\n style={customStyles?.group}\n variant={variant}\n >\n {(items as FormFieldProps[])\n .filter((item) => !item.hidden)\n .map((item, i) => mapFlat(item, i))}\n </FormFlatGroup>\n )\n ) : undefined}\n {children}\n {footer}\n </BaseForm>\n </FormContext>\n );\n },\n);\n\nForm.displayName = 'Form';\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,iBAAiB,SAAiC;CACtD,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,UAAU,CAAC,GAAG,IAAI,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAC/C,GAAG,WAAW,OAAO,UAAU,QAClC;CACA,OAAO,KAAK,UAAU,QAAQ,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AACxE;AAEA,MAAMA,SAAO,MACV,EACC,WACA,cACA,QACA,QAAQ,CAAC,GACT,UACA,YAAY,SACZ,UAAU,cACV,YACA,QAAQ,cACR,KACA,OACA,aACA,kBACA,eACA,WACA,YACA,UACA,cACA,QACA,KACA,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,UAAU,OAAwB,IAAI;CAC5C,MAAM,CAAC,eAAe,oBAAoB,SAAS,KAAK;CACxD,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,KAAK;CAChE,MAAM,cAAc,OAAO,EAAE;CAE7B,MAAM,cAAc,kBAAkB;EACpC,qBAAqB,cAAc,QAAQ,OAAO,MAAM,YAAY,OAAO;CAC7E,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,MAAM,OAAO,QAAQ;EACrB,IAAI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AM,QAAQ,MAAM,CAAC,CAAC;IACvB,CAAA,IAEf,KAAA;IACH;IACA;GACO;;CACC,CAAA;AAEjB,CACF;AAEA,OAAK,cAAc"}
1
+ {"version":3,"file":"Form.mjs","names":["Form","BaseForm"],"sources":["../../src/Form/Form.tsx"],"sourcesContent":["'use client';\n\nimport { Form as BaseForm } from '@base-ui/react/form';\nimport { isUndefined } from 'es-toolkit/compat';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { styleProps } from '@/styles/stylex/props';\nimport { useResponsive } from '@/styles/theme/scope';\n\nimport FormField from './components/FormField';\nimport FormFlatGroup from './components/FormFlatGroup';\nimport FormGroup from './components/FormGroup';\nimport { FormContext } from './context';\nimport { formMarker } from './marker.stylex';\nimport { rootStyles } from './style';\nimport type { FormFieldProps, FormGroupItemType, FormProps } from './type';\n\nconst serializeForm = (form: HTMLFormElement | null) => {\n if (!form) return '';\n const entries = [...new FormData(form).entries()].filter(\n ([, value]) => typeof value === 'string',\n ) as [string, string][];\n return JSON.stringify(entries.sort((a, b) => a[0].localeCompare(b[0])));\n};\n\nconst Form = memo<FormProps>(\n ({\n className,\n itemMinWidth,\n footer,\n items = [],\n children,\n itemsType = 'group',\n variant = 'borderless',\n classNames,\n styles: customStyles,\n gap,\n style,\n collapsible,\n defaultActiveKey,\n initialValues,\n activeKey,\n onCollapse,\n onFinish,\n onFormSubmit,\n layout,\n ref,\n compact,\n itemPadding,\n ...rest\n }) => {\n const resolvedGap = gap ?? (compact ? 12 : undefined);\n const resolvedItemPadding = itemPadding ?? (compact ? 10 : undefined);\n const { mobile } = useResponsive();\n const formRef = useRef<HTMLFormElement>(null);\n const [submitLoading, setSubmitLoading] = useState(false);\n const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);\n const snapshotRef = useRef('');\n\n const syncUnsaved = useCallback(() => {\n setHasUnsavedChanges(serializeForm(formRef.current) !== snapshotRef.current);\n }, []);\n\n useEffect(() => {\n const form = formRef.current;\n if (!form) return;\n snapshotRef.current = serializeForm(form);\n let resetTimer: ReturnType<typeof setTimeout>;\n const handleMutation = () => syncUnsaved();\n const handleReset = () => {\n resetTimer = setTimeout(() => {\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n }, 0);\n };\n form.addEventListener('input', handleMutation);\n form.addEventListener('change', handleMutation);\n form.addEventListener('reset', handleReset);\n return () => {\n clearTimeout(resetTimer);\n form.removeEventListener('input', handleMutation);\n form.removeEventListener('change', handleMutation);\n form.removeEventListener('reset', handleReset);\n };\n }, [syncUnsaved]);\n\n const requestReset = useCallback(() => {\n formRef.current?.reset();\n }, []);\n\n const mergedRef = useCallback(\n (node: HTMLFormElement | null) => {\n formRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n const context = useMemo(\n () => ({\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout: layout || (mobile ? ('vertical' as const) : ('horizontal' as const)),\n requestReset,\n submitLoading,\n variant,\n }),\n [\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout,\n mobile,\n requestReset,\n submitLoading,\n variant,\n ],\n );\n\n const mapFlat = useCallback(\n (item: FormFieldProps, itemIndex: number) => (\n <FormField\n className={classNames?.item}\n divider={itemIndex !== 0}\n key={itemIndex}\n style={customStyles?.item}\n variant={variant}\n {...item}\n />\n ),\n [variant, classNames, customStyles],\n );\n\n const mapTree = useCallback(\n (group: FormGroupItemType, groupIndex: number) => {\n const key = group?.key || groupIndex;\n return (\n <FormGroup\n active={activeKey && group?.key ? activeKey.includes(key) : undefined}\n className={classNames?.group}\n collapsible={isUndefined(group.collapsible) ? collapsible : group.collapsible}\n desc={group?.desc}\n extra={group?.extra}\n icon={group?.icon}\n key={key}\n style={customStyles?.group}\n title={group.title}\n variant={group?.variant || variant}\n defaultActive={\n defaultActiveKey && group?.key ? defaultActiveKey.includes(key) : group?.defaultActive\n }\n onCollapse={(active) => {\n let keys: (string | number)[] = activeKey || defaultActiveKey || [];\n keys = keys.filter((k) => k !== key);\n onCollapse?.(active ? [...keys, key] : keys);\n }}\n >\n {Array.isArray(group.children)\n ? group.children.filter((item) => !item.hidden).map((item, i) => mapFlat(item, i))\n : group.children}\n </FormGroup>\n );\n },\n [\n activeKey,\n collapsible,\n defaultActiveKey,\n onCollapse,\n variant,\n classNames,\n customStyles,\n mapFlat,\n ],\n );\n\n return (\n <FormContext value={context}>\n <BaseForm\n ref={mergedRef}\n {...styleProps(\n [formMarker, rootStyles.root, variant === 'borderless' && rootStyles.borderless],\n className,\n {\n gap: resolvedGap,\n ...(resolvedGap === undefined\n ? undefined\n : {\n '--lobe-form-gap':\n typeof resolvedGap === 'number' ? `${resolvedGap}px` : resolvedGap,\n }),\n ...(resolvedItemPadding === undefined\n ? undefined\n : {\n '--lobe-form-item-padding-block':\n typeof resolvedItemPadding === 'number'\n ? `${resolvedItemPadding}px`\n : resolvedItemPadding,\n }),\n ...style,\n },\n )}\n onFormSubmit={async (values, eventDetails) => {\n onFormSubmit?.(values, eventDetails);\n if (!onFinish) return;\n setSubmitLoading(true);\n try {\n await onFinish(values, eventDetails);\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n } finally {\n setSubmitLoading(false);\n }\n }}\n {...rest}\n >\n {items && items.length > 0 ? (\n itemsType === 'group' ? (\n (items as FormGroupItemType[]).map((item, i) => mapTree(item, i))\n ) : (\n <FormFlatGroup\n className={classNames?.group}\n style={customStyles?.group}\n variant={variant}\n >\n {(items as FormFieldProps[])\n .filter((item) => !item.hidden)\n .map((item, i) => mapFlat(item, i))}\n </FormFlatGroup>\n )\n ) : undefined}\n {children}\n {footer}\n </BaseForm>\n </FormContext>\n );\n },\n);\n\nForm.displayName = 'Form';\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,iBAAiB,SAAiC;CACtD,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,UAAU,CAAC,GAAG,IAAI,SAAS,IAAI,CAAC,CAAC,QAA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AAC,CAAC,IAC/E,MAAM;EACD,GAhBJ,GAgBI;CAEf,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,OACE,oBAAC,aAAD;EAAa,OAAO;EAClB,UAAA,qBAACC,MAAD;GACE,KAAK;GACL,GAAI,WACF;IAAC;IAAY,WAAW;IAAM,YAAY,gBAAgB,WAAW;GAAU,GAC/E,WACA;IACE,KAAK;IACL,GAAI,gBAAgB,KAAA,IAChB,KAAA,IACA,EACE,mBACE,OAAO,gBAAgB,WAAW,GAAG,YAAY,MAAM,YAC3D;IACJ,GAAI,wBAAwB,KAAA,IACxB,KAAA,IACA,EACE,kCACE,OAAO,wBAAwB,WAC3B,GAAG,oBAAoB,MACvB,oBACR;IACJ,GAAG;GACL,CACF;GACA,cAAc,OAAO,QAAQ,iBAAiB;IAC5C,eAAe,QAAQ,YAAY;IACnC,IAAI,CAAC,UAAU;IACf,iBAAiB,IAAI;IACrB,IAAI;KACF,MAAM,SAAS,QAAQ,YAAY;KACnC,YAAY,UAAU,cAAc,QAAQ,OAAO;KACnD,YAAY;IACd,UAAU;KACR,iBAAiB,KAAK;IACxB;GACF;GACA,GAAI;GApCN,UAAA;IAsCG,SAAS,MAAM,SAAS,IACvB,cAAc,UACX,MAA8B,KAAK,MAAM,MAAM,QAAQ,MAAM,CAAC,CAAC,IAEhE,oBAAC,eAAD;KACE,WAAW,YAAY;KACvB,OAAO,cAAc;KACZ;KAEP,UAAA,MACC,QAAQ,SAAS,CAAC,KAAK,MAAM,CAAC,CAC9B,KAAK,MAAM,MAAM,QAAQ,MAAM,CAAC,CAAC;IACvB,CAAA,IAEf,KAAA;IACH;IACA;GACO;;CACC,CAAA;AAEjB,CACF;AAEA,OAAK,cAAc"}
package/es/Form/style.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  //#region src/Form/style.ts
2
2
  const rootStyles = {
3
3
  borderless: {
4
- kOIVth: "lb1y9zxd1 lb1q0xmy4",
4
+ kOIVth: "lb1y9zxd1 lbcptdvr",
5
5
  $$css: true
6
6
  },
7
7
  root: {
8
- kOIVth: "lbou54vl lb1q0xmy4",
8
+ kOIVth: "lbou54vl lbcptdvr",
9
9
  k1xSpc: "lb78zum5",
10
10
  kXwgrk: "lbdt5ytf",
11
11
  kVAEAm: "lb1n2onr6",
@@ -47,7 +47,7 @@ const fieldStyles = {
47
47
  },
48
48
  root: {
49
49
  kOIVth: "lb1v2ro7d",
50
- k8WAf4: "lb1xn8qrt",
50
+ k8WAf4: "lby0ca47",
51
51
  kB7OPa: "lb9f619",
52
52
  k1xSpc: "lb78zum5",
53
53
  kzqmXN: "lbh8yej3",
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":[],"sources":["../../src/Form/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\nimport { media } from '@/styles/stylex/media.stylex';\n\nimport { formGroupTriggerMarker, formMarker } from './marker.stylex';\n\nconst reducedMotion = '@media (prefers-reduced-motion: reduce)';\n\nexport const rootStyles = stylex.create({\n borderless: {\n gap: { default: 48, [media.sm]: '0 !important' },\n },\n root: {\n gap: { default: 16, [media.sm]: '0 !important' },\n display: 'flex',\n flexDirection: 'column',\n position: 'relative',\n width: '100%',\n },\n});\n\nexport const fieldStyles = stylex.create({\n control: {\n gap: 4,\n alignItems: 'flex-end',\n display: 'flex',\n flexDirection: 'column',\n minWidth: 'var(--form-field-min-width, unset)',\n },\n controlVertical: {\n alignItems: 'stretch',\n width: '100%',\n },\n error: {\n color: cssVar.colorError,\n fontSize: 12,\n },\n horizontal: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n label: {\n flex: '1',\n display: 'block',\n textAlign: 'start',\n maxWidth: '100%',\n },\n root: {\n gap: 12,\n paddingBlock: 16,\n boxSizing: 'border-box',\n display: 'flex',\n width: '100%',\n },\n vertical: {\n gap: 8,\n alignItems: 'stretch',\n flexDirection: 'column',\n },\n});\n\nexport const fieldLayoutStyles = {\n horizontal: fieldStyles.horizontal,\n vertical: fieldStyles.vertical,\n};\n\nexport const dividerStyles = stylex.create({\n root: {\n margin: 0,\n borderColor: 'currentcolor',\n borderStyle: 'none',\n borderWidth: 'medium',\n backgroundColor: cssVar.colorBorderSecondary,\n height: 1,\n width: '100%',\n },\n});\n\nexport const groupStyles = stylex.create({\n body: {\n display: 'flex',\n flexDirection: 'column',\n },\n bodyBoxed: {\n paddingBlock: { default: 16, [stylex.when.ancestor(':is(*)', formMarker)]: 0 },\n paddingInline: 16,\n },\n bodyFilled: {\n borderRadius: cssVar.borderRadius,\n marginInline: 3,\n marginBlockEnd: 3,\n },\n bodyFilledLight: {\n boxShadow: `0 1px 0 -1px ${cssVar.colorBorder}, 0 1px 2px -0.5px ${cssVar.colorBorder}, 0 2px 2px -1px ${cssVar.colorBorderSecondary}, 0 3px 6px -4px ${cssVar.colorBorderSecondary}`,\n },\n chevron: {\n flex: 'none',\n transition: `transform 200ms ${cssVar.motionEaseOut}`,\n color: cssVar.colorTextDescription,\n transform: {\n default: null,\n [stylex.when.ancestor('[data-panel-open]', formGroupTriggerMarker)]: 'rotate(180deg)',\n },\n },\n desc: {\n color: cssVar.colorTextDescription,\n fontSize: 12,\n fontWeight: 400,\n },\n header: {\n gap: 12,\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n },\n headerBorderless: {\n borderBlockEndColor: cssVar.colorBorderSecondary,\n borderBlockEndStyle: 'solid',\n borderBlockEndWidth: 1,\n paddingBlockEnd: 16,\n },\n headerBoxed: {\n padding: 16,\n },\n mobileBody: {\n paddingBlock: 0,\n paddingInline: 16,\n backgroundColor: cssVar.colorBgContainer,\n },\n mobileHeader: {\n padding: 16,\n backgroundColor: cssVar.colorBgLayout,\n },\n mobileTitle: {\n fontSize: 14,\n fontWeight: 400,\n opacity: 0.5,\n },\n panel: {\n overflow: 'hidden',\n transition: `height 200ms ${cssVar.motionEaseOut}`,\n transitionDuration: { default: null, [reducedMotion]: '0s' },\n height: {\n 'default': 'var(--collapsible-panel-height)',\n ':is([data-starting-style], [data-ending-style])': 0,\n },\n },\n rootFilled: {\n borderRadius: cssVar.borderRadiusLG,\n backgroundColor: cssVar.colorFillQuaternary,\n },\n rootFilledDark: {\n backgroundColor: cssVar.colorBgLayout,\n },\n rootOutlined: {\n borderRadius: cssVar.borderRadiusLG,\n },\n title: {\n gap: 8,\n alignItems: 'center',\n color: cssVar.colorText,\n display: 'flex',\n flexShrink: 0,\n fontSize: 16,\n fontWeight: 'bold',\n },\n titleBorderless: {\n fontSize: 18,\n },\n trigger: {\n margin: 0,\n padding: 0,\n borderColor: 'currentcolor',\n borderRadius: cssVar.borderRadius,\n borderStyle: 'none',\n borderWidth: 'medium',\n flex: '1',\n gap: 12,\n outline: 'none',\n alignItems: 'center',\n backgroundColor: 'transparent',\n backgroundImage: 'none',\n cursor: 'pointer',\n display: 'flex',\n textAlign: 'start',\n },\n});\n\nexport const flatGroupStyles = stylex.create({\n borderless: {\n paddingInline: 0,\n },\n filled: {\n backgroundColor: cssVar.colorFillQuaternary,\n },\n mobile: {\n borderRadius: 0,\n paddingBlock: 0,\n paddingInline: 16,\n backgroundColor: cssVar.colorBgContainer,\n },\n root: {\n borderRadius: cssVar.borderRadiusLG,\n paddingInline: 16,\n },\n});\n\nexport const footerStyles = stylex.create({\n root: {\n padding: { default: null, [media.sm]: 16 },\n backgroundColor: { default: null, [media.sm]: cssVar.colorBgContainer },\n borderBlockStartColor: { default: null, [media.sm]: cssVar.colorBorderSecondary },\n borderBlockStartStyle: { default: null, [media.sm]: 'solid' },\n borderBlockStartWidth: { default: null, [media.sm]: 1 },\n },\n});\n\nexport const submitFooterStyles = stylex.create({\n floatFooter: {\n padding: 8,\n borderColor: cssVar.colorBorderSecondary,\n borderRadius: 48,\n borderStyle: 'solid',\n borderWidth: 1,\n backgroundColor: cssVar.colorBgContainer,\n boxShadow: cssVar.boxShadowSecondary,\n insetBlockEnd: 24,\n insetInlineStart: '50%',\n position: 'fixed',\n transform: 'translateX(-50%)',\n zIndex: 1000,\n width: 'max-content',\n },\n footer: {\n padding: { default: null, [media.sm]: 16 },\n backgroundColor: { default: null, [media.sm]: cssVar.colorBgContainer },\n borderBlockStartColor: { default: null, [media.sm]: cssVar.colorBorderSecondary },\n borderBlockStartStyle: { default: null, [media.sm]: 'solid' },\n borderBlockStartWidth: { default: null, [media.sm]: 1 },\n marginBlockStart: { default: null, [media.sm]: `calc(-1 * ${cssVar.borderRadius})` },\n },\n});\n\nexport const titleStyles = stylex.create({\n content: {\n position: 'relative',\n textAlign: 'start',\n },\n desc: {\n color: cssVar.colorTextDescription,\n display: 'block',\n fontSize: 12,\n fontWeight: 400,\n lineHeight: 1.44,\n overflowWrap: 'break-word',\n whiteSpace: 'pre-wrap',\n },\n title: {\n color: cssVar.colorText,\n fontWeight: 500,\n lineHeight: 1,\n },\n});\n"],"mappings":";AAQA,MAAa,aAAa;CACxB,YAAY;EACV,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAa,cAAc;CACzB,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,iBAAiB;EACf,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,M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esContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\nimport { media } from '@/styles/stylex/media.stylex';\n\nimport { formGroupTriggerMarker, formMarker } from './marker.stylex';\n\nconst reducedMotion = '@media (prefers-reduced-motion: reduce)';\n\nexport const rootStyles = stylex.create({\n borderless: {\n gap: { default: 48, [media.sm]: 'var(--lobe-form-gap, 0) !important' },\n },\n root: {\n gap: { default: 16, [media.sm]: 'var(--lobe-form-gap, 0) !important' },\n display: 'flex',\n flexDirection: 'column',\n position: 'relative',\n width: '100%',\n },\n});\n\nexport const fieldStyles = stylex.create({\n control: {\n gap: 4,\n alignItems: 'flex-end',\n display: 'flex',\n flexDirection: 'column',\n minWidth: 'var(--form-field-min-width, unset)',\n },\n controlVertical: {\n alignItems: 'stretch',\n width: '100%',\n },\n error: {\n color: cssVar.colorError,\n fontSize: 12,\n },\n horizontal: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n label: {\n flex: '1',\n display: 'block',\n textAlign: 'start',\n maxWidth: '100%',\n },\n root: {\n gap: 12,\n paddingBlock: 'var(--lobe-form-item-padding-block,16px)',\n boxSizing: 'border-box',\n display: 'flex',\n width: '100%',\n },\n vertical: {\n gap: 8,\n alignItems: 'stretch',\n flexDirection: 'column',\n },\n});\n\nexport const fieldLayoutStyles = {\n horizontal: fieldStyles.horizontal,\n vertical: fieldStyles.vertical,\n};\n\nexport const dividerStyles = stylex.create({\n root: {\n margin: 0,\n borderColor: 'currentcolor',\n borderStyle: 'none',\n borderWidth: 'medium',\n backgroundColor: cssVar.colorBorderSecondary,\n height: 1,\n width: '100%',\n },\n});\n\nexport const groupStyles = stylex.create({\n body: {\n display: 'flex',\n flexDirection: 'column',\n },\n bodyBoxed: {\n paddingBlock: { default: 16, [stylex.when.ancestor(':is(*)', formMarker)]: 0 },\n paddingInline: 16,\n },\n bodyFilled: {\n borderRadius: cssVar.borderRadius,\n marginInline: 3,\n marginBlockEnd: 3,\n },\n bodyFilledLight: {\n boxShadow: `0 1px 0 -1px ${cssVar.colorBorder}, 0 1px 2px -0.5px ${cssVar.colorBorder}, 0 2px 2px -1px ${cssVar.colorBorderSecondary}, 0 3px 6px -4px ${cssVar.colorBorderSecondary}`,\n },\n chevron: {\n flex: 'none',\n transition: `transform 200ms ${cssVar.motionEaseOut}`,\n color: cssVar.colorTextDescription,\n transform: {\n default: null,\n [stylex.when.ancestor('[data-panel-open]', formGroupTriggerMarker)]: 'rotate(180deg)',\n },\n },\n desc: {\n color: cssVar.colorTextDescription,\n fontSize: 12,\n fontWeight: 400,\n },\n header: {\n gap: 12,\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n },\n headerBorderless: {\n borderBlockEndColor: cssVar.colorBorderSecondary,\n borderBlockEndStyle: 'solid',\n borderBlockEndWidth: 1,\n paddingBlockEnd: 16,\n },\n headerBoxed: {\n padding: 16,\n },\n mobileBody: {\n paddingBlock: 0,\n paddingInline: 16,\n backgroundColor: cssVar.colorBgContainer,\n },\n mobileHeader: {\n padding: 16,\n backgroundColor: cssVar.colorBgLayout,\n },\n mobileTitle: {\n fontSize: 14,\n fontWeight: 400,\n opacity: 0.5,\n },\n panel: {\n overflow: 'hidden',\n transition: `height 200ms ${cssVar.motionEaseOut}`,\n transitionDuration: { default: null, [reducedMotion]: '0s' },\n height: {\n 'default': 'var(--collapsible-panel-height)',\n ':is([data-starting-style], [data-ending-style])': 0,\n },\n },\n rootFilled: {\n borderRadius: cssVar.borderRadiusLG,\n backgroundColor: cssVar.colorFillQuaternary,\n },\n rootFilledDark: {\n backgroundColor: cssVar.colorBgLayout,\n },\n rootOutlined: {\n borderRadius: cssVar.borderRadiusLG,\n },\n title: {\n gap: 8,\n alignItems: 'center',\n color: cssVar.colorText,\n display: 'flex',\n flexShrink: 0,\n fontSize: 16,\n fontWeight: 'bold',\n },\n titleBorderless: {\n fontSize: 18,\n },\n trigger: {\n margin: 0,\n padding: 0,\n borderColor: 'currentcolor',\n borderRadius: cssVar.borderRadius,\n borderStyle: 'none',\n borderWidth: 'medium',\n flex: '1',\n gap: 12,\n outline: 'none',\n alignItems: 'center',\n backgroundColor: 'transparent',\n backgroundImage: 'none',\n cursor: 'pointer',\n display: 'flex',\n textAlign: 'start',\n },\n});\n\nexport const flatGroupStyles = stylex.create({\n borderless: {\n paddingInline: 0,\n },\n filled: {\n backgroundColor: cssVar.colorFillQuaternary,\n },\n mobile: {\n borderRadius: 0,\n paddingBlock: 0,\n paddingInline: 16,\n backgroundColor: cssVar.colorBgContainer,\n },\n root: {\n borderRadius: cssVar.borderRadiusLG,\n paddingInline: 16,\n },\n});\n\nexport const footerStyles = stylex.create({\n root: {\n padding: { default: null, [media.sm]: 16 },\n backgroundColor: { default: null, [media.sm]: cssVar.colorBgContainer },\n borderBlockStartColor: { default: null, [media.sm]: cssVar.colorBorderSecondary },\n borderBlockStartStyle: { default: null, [media.sm]: 'solid' },\n borderBlockStartWidth: { default: null, [media.sm]: 1 },\n },\n});\n\nexport const submitFooterStyles = stylex.create({\n floatFooter: {\n padding: 8,\n borderColor: cssVar.colorBorderSecondary,\n borderRadius: 48,\n borderStyle: 'solid',\n borderWidth: 1,\n backgroundColor: cssVar.colorBgContainer,\n boxShadow: cssVar.boxShadowSecondary,\n insetBlockEnd: 24,\n insetInlineStart: '50%',\n position: 'fixed',\n transform: 'translateX(-50%)',\n zIndex: 1000,\n width: 'max-content',\n },\n footer: {\n padding: { default: null, [media.sm]: 16 },\n backgroundColor: { default: null, [media.sm]: cssVar.colorBgContainer },\n borderBlockStartColor: { default: null, [media.sm]: cssVar.colorBorderSecondary },\n borderBlockStartStyle: { default: null, [media.sm]: 'solid' },\n borderBlockStartWidth: { default: null, [media.sm]: 1 },\n marginBlockStart: { default: null, [media.sm]: `calc(-1 * ${cssVar.borderRadius})` },\n },\n});\n\nexport const titleStyles = stylex.create({\n content: {\n position: 'relative',\n textAlign: 'start',\n },\n desc: {\n color: cssVar.colorTextDescription,\n display: 'block',\n fontSize: 12,\n fontWeight: 400,\n lineHeight: 1.44,\n overflowWrap: 'break-word',\n whiteSpace: 'pre-wrap',\n },\n title: {\n color: cssVar.colorText,\n fontWeight: 500,\n lineHeight: 1,\n },\n});\n"],"mappings":";AAQA,MAAa,aAAa;CACxB,YAAY;EACV,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAa,cAAc;CACzB,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,iBAAiB;EACf,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAa,oBAAoB;CAC/B,YAAY,YAAY;CACxB,UAAU,YAAY;AACxB;AACA,MAAa,gBAAgB,EAC3B,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;AACT,EACF;AACA,MAAa,cAAc;CACzB,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,iBAAiB;EACf,QAAQ;EACR,OAAO;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,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAa,eAAe,EAC1B,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;AACT,EACF;AACA,MAAa,qBAAqB;CAChC,aAAa;EACX,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAa,cAAc;CACzB,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
@@ -24,6 +24,11 @@ export interface FormProps extends BaseFormProps {
24
24
  item?: string;
25
25
  };
26
26
  collapsible?: boolean;
27
+ /**
28
+ * Compact spacing for narrow containers (Drawer / Modal): `gap` 12px and `itemPadding` 10px
29
+ * unless set explicitly. Default `false` (unchanged spacing).
30
+ */
31
+ compact?: boolean;
27
32
  defaultActiveKey?: (string | number)[];
28
33
  footer?: ReactNode;
29
34
  gap?: number | string;
@@ -33,6 +38,8 @@ export interface FormProps extends BaseFormProps {
33
38
  */
34
39
  initialValues?: FormValues;
35
40
  itemMinWidth?: FormFieldProps['minWidth'];
41
+ /** Block (top / bottom) padding of every Form.Field. Default `16px`. */
42
+ itemPadding?: number | string;
36
43
  items?: FormGroupItemType[] | FormFieldProps[];
37
44
  itemsType?: ItemsType;
38
45
  layout?: FormLayout;
@@ -61,7 +61,7 @@ const styles = {
61
61
  "--lobe-popover-animation-scale": "lb191ky9q",
62
62
  "--lobe-popover-animation-translate": "lb10lwwj9",
63
63
  "--lobe-popover-layout-duration": "lbpmwb57 lbvabi",
64
- "--lobe-popover-layout-ease": "lb18d1rk7",
64
+ "--lobe-popover-layout-ease": "lb1yl6ih0",
65
65
  "--lobe-popover-translate-x": "lbdtzx1f lb1u18tlr lb8cr33m",
66
66
  "--lobe-popover-translate-y": "lb70ox3w lb132x4ng lb19ms9b6 lb1jpw2w9",
67
67
  kfzvcC: "lb1tblq73",
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":[],"sources":["../../src/Popover/style.ts"],"sourcesContent":["import './style.css';\n\nimport * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nconst reducedMotion = '@media (prefers-reduced-motion: reduce)';\nconst layoutAnimation = ':is([data-layout-animation])';\nconst instantOrRepop = ':is([data-instant], [data-repop])';\nconst instant = ':is([data-instant])';\nconst popupLayoutTiming =\n ':is([data-layout-animation]):not([data-repop], [data-ending-style], [data-instant])';\nconst popupLayoutProperty = ':is([data-layout-animation]):not([data-repop], [data-instant])';\nconst popupRepopTiming = ':is([data-repop]):not([data-ending-style], [data-instant])';\nconst popupEndingTiming = ':is([data-ending-style]):not([data-instant])';\nconst positionerLayout = ':is([data-layout-animation]):not([data-instant], [data-repop])';\nconst startingOrEnding = ':is([data-starting-style], [data-ending-style])';\nconst anchorHidden = \":is([data-anchor-hidden], [data-zero-origin='true'])\";\nconst placementTop =\n \":is([data-placement='top'], [data-placement='topLeft'], [data-placement='topRight'])\";\nconst placementLeft =\n \":is([data-placement='left'], [data-placement='leftTop'], [data-placement='leftBottom'])\";\nconst placementRight =\n \":is([data-placement='right'], [data-placement='rightTop'], [data-placement='rightBottom'])\";\n\nconst springGlide =\n 'linear(0, 0.041, 0.14, 0.268, 0.407, 0.541, 0.661, 0.765, 0.849, 0.915, 0.964, 0.998, 1.02, 1.032, 1.038, 1.039, 1.036, 1.032, 1.027, 1.022, 1.016, 1.012, 1.008, 1.005, 1.003)';\n\nexport const styles = stylex.create({\n arrow: {\n '--lobe-popover-arrow-offset-block': '5px',\n '--lobe-popover-arrow-offset-inline': '8px',\n 'transition':\n 'inset-inline-start var(--lobe-popover-layout-duration) var(--lobe-popover-layout-ease), inset-block-start var(--lobe-popover-layout-duration) var(--lobe-popover-layout-ease)',\n 'display': 'flex',\n 'insetBlockEnd': {\n 'default': null,\n \":is([data-side='top'])\": 'calc(var(--lobe-popover-arrow-offset-block) * -1)',\n },\n 'insetBlockStart': {\n 'default': null,\n \":is([data-side='bottom'])\": 'calc(var(--lobe-popover-arrow-offset-block) * -1)',\n },\n 'insetInlineEnd': {\n 'default': null,\n \":is([data-side='left'])\": 'calc(var(--lobe-popover-arrow-offset-inline) * -1)',\n },\n 'insetInlineStart': {\n 'default': null,\n \":is([data-side='right'])\": 'calc(var(--lobe-popover-arrow-offset-inline) * -1)',\n },\n 'pointerEvents': 'none',\n 'position': 'absolute',\n 'transform': {\n 'default': null,\n \":is([data-side='left'])\": 'rotate(90deg)',\n \":is([data-side='right'])\": 'rotate(-90deg)',\n \":is([data-side='top'])\": 'rotate(180deg)',\n },\n 'transformOrigin': 'center',\n 'height': 6,\n 'width': 12,\n },\n arrowFill: {\n fill: cssVar.colorBgElevated,\n },\n arrowStroke: {\n fill: 'none',\n stroke: cssVar.colorBorder,\n strokeWidth: '1px',\n },\n arrowSvg: {\n display: 'block',\n height: '100%',\n width: '100%',\n },\n\n popup: {\n borderRadius: cssVar.borderRadius,\n outline: 'none',\n backgroundColor: cssVar.colorBgElevated,\n boxShadow: `${cssVar.boxShadowSecondary}, var(--lobe-ring)`,\n boxSizing: 'border-box',\n color: cssVar.colorText,\n opacity: { default: null, [startingOrEnding]: 0 },\n position: 'relative',\n transform: {\n default: null,\n [startingOrEnding]:\n 'translate3d(var(--lobe-popover-translate-x), var(--lobe-popover-translate-y), 0) scale(var(--lobe-popover-animation-scale))',\n },\n transformOrigin: 'var(--transform-origin)',\n transitionDuration: {\n default: 'var(--lobe-popover-animation-duration)',\n [instant]: '0s',\n [popupEndingTiming]: 'var(--lobe-popover-animation-duration-exit)',\n [popupLayoutTiming]:\n 'var(--lobe-popover-animation-duration), var(--lobe-popover-animation-duration), var(--lobe-popover-layout-duration), var(--lobe-popover-layout-duration)',\n [popupRepopTiming]: '0s',\n },\n transitionProperty: {\n default: 'opacity, transform',\n [instantOrRepop]: 'none',\n [popupLayoutProperty]: 'opacity, transform, width, height',\n },\n transitionTimingFunction: {\n default: 'var(--lobe-popover-animation-ease-out)',\n [instant]: 'ease',\n [popupEndingTiming]: 'var(--lobe-popover-animation-ease-in)',\n [popupLayoutTiming]:\n 'var(--lobe-popover-animation-ease-out), var(--lobe-popover-animation-ease-out), var(--lobe-popover-layout-ease), var(--lobe-popover-layout-ease)',\n [popupRepopTiming]: 'ease',\n },\n height: { default: null, [layoutAnimation]: 'var(--popup-height, auto)' },\n maxWidth: 'var(--available-width)',\n minWidth: 120,\n width: { default: null, [layoutAnimation]: 'var(--popup-width, auto)' },\n },\n\n positioner: {\n '--lobe-popover-animation-duration': '150ms',\n '--lobe-popover-animation-duration-exit': '75ms',\n '--lobe-popover-animation-ease-in': 'ease-in',\n '--lobe-popover-animation-ease-out': cssVar.motionEaseOut,\n '--lobe-popover-animation-scale': '0.96',\n '--lobe-popover-animation-translate': '6px',\n '--lobe-popover-layout-duration': { default: '380ms', [reducedMotion]: '0s' },\n '--lobe-popover-layout-ease': springGlide,\n '--lobe-popover-translate-x': {\n default: '0',\n [placementLeft]: 'var(--lobe-popover-animation-translate)',\n [placementRight]: 'calc(var(--lobe-popover-animation-translate) * -1)',\n },\n '--lobe-popover-translate-y': {\n default: 'calc(var(--lobe-popover-animation-translate) * -1)',\n [placementLeft]: '0',\n [placementRight]: '0',\n [placementTop]: 'var(--lobe-popover-animation-translate)',\n },\n 'pointerEvents': { [anchorHidden]: 'none', default: null },\n 'transitionDuration': {\n default: 'var(--lobe-popover-animation-duration)',\n [instantOrRepop]: '0s',\n [positionerLayout]: 'var(--lobe-popover-layout-duration)',\n },\n 'transitionProperty': {\n default: 'none',\n [positionerLayout]:\n 'inset-block-start, inset-inline-start, inset-inline-end, inset-block-end, transform',\n },\n 'transitionTimingFunction': {\n default: 'var(--lobe-popover-animation-ease-out)',\n [instantOrRepop]: 'ease',\n [positionerLayout]: 'var(--lobe-popover-layout-ease)',\n },\n 'visibility': { [anchorHidden]: 'hidden', default: null },\n 'zIndex': 1100,\n 'height': 'var(--positioner-height)',\n 'width': 'min(var(--positioner-width), var(--available-width))',\n },\n\n viewport: {\n '--lobe-popover-content-blur': '4px',\n '--lobe-popover-content-shift': '8px',\n '--lobe-popover-viewport-inline-padding': '12px',\n 'overflow': 'clip',\n 'paddingBlock': 12,\n 'paddingInline': 'var(--lobe-popover-viewport-inline-padding)',\n 'position': 'relative',\n },\n});\n"],"mappings":";AAmBA,MAAa,SAAS;CACpB,OAAO;EACL,qCAAqC;EACrC,sCAAsC;EACtC,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,qCAAqC;EACrC,0CAA0C;EAC1C,oCAAoC;EACpC,qCAAqC;EACrC,kCAAkC;EAClC,sCAAsC;EACtC,kCAAkC;EAClC,8BAA8B;EAC9B,8BAA8B;EAC9B,8BAA8B;EAC9B,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,+BAA+B;EAC/B,gCAAgC;EAChC,0CAA0C;EAC1C,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../src/Popover/style.ts"],"sourcesContent":["import './style.css';\n\nimport * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nconst reducedMotion = '@media (prefers-reduced-motion: reduce)';\nconst layoutAnimation = ':is([data-layout-animation])';\nconst instantOrRepop = ':is([data-instant], [data-repop])';\nconst instant = ':is([data-instant])';\nconst popupLayoutTiming =\n ':is([data-layout-animation]):not([data-repop], [data-ending-style], [data-instant])';\nconst popupLayoutProperty = ':is([data-layout-animation]):not([data-repop], [data-instant])';\nconst popupRepopTiming = ':is([data-repop]):not([data-ending-style], [data-instant])';\nconst popupEndingTiming = ':is([data-ending-style]):not([data-instant])';\nconst positionerLayout = ':is([data-layout-animation]):not([data-instant], [data-repop])';\nconst startingOrEnding = ':is([data-starting-style], [data-ending-style])';\nconst anchorHidden = \":is([data-anchor-hidden], [data-zero-origin='true'])\";\nconst placementTop =\n \":is([data-placement='top'], [data-placement='topLeft'], [data-placement='topRight'])\";\nconst placementLeft =\n \":is([data-placement='left'], [data-placement='leftTop'], [data-placement='leftBottom'])\";\nconst placementRight =\n \":is([data-placement='right'], [data-placement='rightTop'], [data-placement='rightBottom'])\";\n\nexport const styles = stylex.create({\n arrow: {\n '--lobe-popover-arrow-offset-block': '5px',\n '--lobe-popover-arrow-offset-inline': '8px',\n 'transition':\n 'inset-inline-start var(--lobe-popover-layout-duration) var(--lobe-popover-layout-ease), inset-block-start var(--lobe-popover-layout-duration) var(--lobe-popover-layout-ease)',\n 'display': 'flex',\n 'insetBlockEnd': {\n 'default': null,\n \":is([data-side='top'])\": 'calc(var(--lobe-popover-arrow-offset-block) * -1)',\n },\n 'insetBlockStart': {\n 'default': null,\n \":is([data-side='bottom'])\": 'calc(var(--lobe-popover-arrow-offset-block) * -1)',\n },\n 'insetInlineEnd': {\n 'default': null,\n \":is([data-side='left'])\": 'calc(var(--lobe-popover-arrow-offset-inline) * -1)',\n },\n 'insetInlineStart': {\n 'default': null,\n \":is([data-side='right'])\": 'calc(var(--lobe-popover-arrow-offset-inline) * -1)',\n },\n 'pointerEvents': 'none',\n 'position': 'absolute',\n 'transform': {\n 'default': null,\n \":is([data-side='left'])\": 'rotate(90deg)',\n \":is([data-side='right'])\": 'rotate(-90deg)',\n \":is([data-side='top'])\": 'rotate(180deg)',\n },\n 'transformOrigin': 'center',\n 'height': 6,\n 'width': 12,\n },\n arrowFill: {\n fill: cssVar.colorBgElevated,\n },\n arrowStroke: {\n fill: 'none',\n stroke: cssVar.colorBorder,\n strokeWidth: '1px',\n },\n arrowSvg: {\n display: 'block',\n height: '100%',\n width: '100%',\n },\n\n popup: {\n borderRadius: cssVar.borderRadius,\n outline: 'none',\n backgroundColor: cssVar.colorBgElevated,\n boxShadow: `${cssVar.boxShadowSecondary}, var(--lobe-ring)`,\n boxSizing: 'border-box',\n color: cssVar.colorText,\n opacity: { default: null, [startingOrEnding]: 0 },\n position: 'relative',\n transform: {\n default: null,\n [startingOrEnding]:\n 'translate3d(var(--lobe-popover-translate-x), var(--lobe-popover-translate-y), 0) scale(var(--lobe-popover-animation-scale))',\n },\n transformOrigin: 'var(--transform-origin)',\n transitionDuration: {\n default: 'var(--lobe-popover-animation-duration)',\n [instant]: '0s',\n [popupEndingTiming]: 'var(--lobe-popover-animation-duration-exit)',\n [popupLayoutTiming]:\n 'var(--lobe-popover-animation-duration), var(--lobe-popover-animation-duration), var(--lobe-popover-layout-duration), var(--lobe-popover-layout-duration)',\n [popupRepopTiming]: '0s',\n },\n transitionProperty: {\n default: 'opacity, transform',\n [instantOrRepop]: 'none',\n [popupLayoutProperty]: 'opacity, transform, width, height',\n },\n transitionTimingFunction: {\n default: 'var(--lobe-popover-animation-ease-out)',\n [instant]: 'ease',\n [popupEndingTiming]: 'var(--lobe-popover-animation-ease-in)',\n [popupLayoutTiming]:\n 'var(--lobe-popover-animation-ease-out), var(--lobe-popover-animation-ease-out), var(--lobe-popover-layout-ease), var(--lobe-popover-layout-ease)',\n [popupRepopTiming]: 'ease',\n },\n height: { default: null, [layoutAnimation]: 'var(--popup-height, auto)' },\n maxWidth: 'var(--available-width)',\n minWidth: 120,\n width: { default: null, [layoutAnimation]: 'var(--popup-width, auto)' },\n },\n\n positioner: {\n '--lobe-popover-animation-duration': '150ms',\n '--lobe-popover-animation-duration-exit': '75ms',\n '--lobe-popover-animation-ease-in': 'ease-in',\n '--lobe-popover-animation-ease-out': cssVar.motionEaseOut,\n '--lobe-popover-animation-scale': '0.96',\n '--lobe-popover-animation-translate': '6px',\n '--lobe-popover-layout-duration': { default: '380ms', [reducedMotion]: '0s' },\n '--lobe-popover-layout-ease': cssVar.motionSpringBouncy,\n '--lobe-popover-translate-x': {\n default: '0',\n [placementLeft]: 'var(--lobe-popover-animation-translate)',\n [placementRight]: 'calc(var(--lobe-popover-animation-translate) * -1)',\n },\n '--lobe-popover-translate-y': {\n default: 'calc(var(--lobe-popover-animation-translate) * -1)',\n [placementLeft]: '0',\n [placementRight]: '0',\n [placementTop]: 'var(--lobe-popover-animation-translate)',\n },\n 'pointerEvents': { [anchorHidden]: 'none', default: null },\n 'transitionDuration': {\n default: 'var(--lobe-popover-animation-duration)',\n [instantOrRepop]: '0s',\n [positionerLayout]: 'var(--lobe-popover-layout-duration)',\n },\n 'transitionProperty': {\n default: 'none',\n [positionerLayout]:\n 'inset-block-start, inset-inline-start, inset-inline-end, inset-block-end, transform',\n },\n 'transitionTimingFunction': {\n default: 'var(--lobe-popover-animation-ease-out)',\n [instantOrRepop]: 'ease',\n [positionerLayout]: 'var(--lobe-popover-layout-ease)',\n },\n 'visibility': { [anchorHidden]: 'hidden', default: null },\n 'zIndex': 1100,\n 'height': 'var(--positioner-height)',\n 'width': 'min(var(--positioner-width), var(--available-width))',\n },\n\n viewport: {\n '--lobe-popover-content-blur': '4px',\n '--lobe-popover-content-shift': '8px',\n '--lobe-popover-viewport-inline-padding': '12px',\n 'overflow': 'clip',\n 'paddingBlock': 12,\n 'paddingInline': 'var(--lobe-popover-viewport-inline-padding)',\n 'position': 'relative',\n },\n});\n"],"mappings":";AAkBA,MAAa,SAAS;CACpB,OAAO;EACL,qCAAqC;EACrC,sCAAsC;EACtC,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,qCAAqC;EACrC,0CAA0C;EAC1C,oCAAoC;EACpC,qCAAqC;EACrC,kCAAkC;EAClC,sCAAsC;EACtC,kCAAkC;EAClC,8BAA8B;EAC9B,8BAA8B;EAC9B,8BAA8B;EAC9B,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,+BAA+B;EAC/B,gCAAgC;EAChC,0CAA0C;EAC1C,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
@@ -24,7 +24,7 @@ const useFetchData = (options) => {
24
24
  params.current = opts.pageInfo.current;
25
25
  params.pageSize = opts.pageInfo.pageSize;
26
26
  }
27
- const response = await opts.request(params, opts.sort, opts.filter);
27
+ const response = await opts.request(params, opts.sort, opts.filter) ?? { data: [] };
28
28
  if (id !== requestId.current) return;
29
29
  if (response.success === false) return;
30
30
  const raw = response.data ?? [];
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchData.mjs","names":[],"sources":["../../../src/ProTable/hooks/useFetchData.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { SortOrder } from '@/Table/type';\n\nimport type { ProTablePageInfo, ProTableRequest, ProTableRequestFilter } from '../type';\n\ntype Filter = Record<string, (string | number | boolean)[] | null>;\n\nexport interface UseFetchDataOptions<T> {\n debounceTime: number;\n defaultData?: T[];\n depsKey: string;\n filter: Filter;\n getParams: () => Record<string, any>;\n manual: boolean;\n onDataSourceChange?: (data: T[]) => void;\n onLoad?: (data: T[]) => void;\n onLoadingChange?: (loading: boolean) => void;\n onRequestError?: (error: Error) => void;\n pageInfo: ProTablePageInfo;\n paginated: boolean;\n polling?: number | ((data: T[]) => number);\n postData?: (data: T[]) => T[];\n request?: ProTableRequest<T, any>;\n setTotal: (total: number) => void;\n sort: Record<string, SortOrder>;\n}\n\nexport const useFetchData = <T>(options: UseFetchDataOptions<T>) => {\n const [data, setData] = useState<T[]>(options.defaultData ?? []);\n const [loading, setLoading] = useState(false);\n const latest = useRef(options);\n latest.current = options;\n const requestId = useRef(0);\n const [enabled, setEnabled] = useState(!options.manual);\n const [token, setToken] = useState(0);\n const pending = useRef<(() => void)[]>([]);\n\n const updateLoading = (next: boolean) => {\n setLoading(next);\n latest.current.onLoadingChange?.(next);\n };\n\n const run = useCallback(async () => {\n const opts = latest.current;\n if (!opts.request) return;\n const id = ++requestId.current;\n updateLoading(true);\n try {\n const params: Record<string, any> = { ...opts.getParams() };\n if (opts.paginated) {\n params.current = opts.pageInfo.current;\n params.pageSize = opts.pageInfo.pageSize;\n }\n const response = await opts.request(\n params as any,\n opts.sort,\n opts.filter as ProTableRequestFilter,\n );\n if (id !== requestId.current) return;\n if (response.success === false) {\n // Pro keeps the previous data when the request reports failure.\n return;\n }\n const raw = response.data ?? [];\n const next = opts.postData ? opts.postData(raw) : raw;\n setData(next);\n opts.setTotal(response.total ?? next.length);\n opts.onLoad?.(next);\n opts.onDataSourceChange?.(next);\n } catch (error) {\n if (id !== requestId.current) return;\n if (opts.onRequestError) opts.onRequestError(error as Error);\n else console.error(error);\n } finally {\n if (id === requestId.current) updateLoading(false);\n const resolvers = pending.current;\n pending.current = [];\n resolvers.forEach((resolve) => resolve());\n }\n }, []);\n\n const { current, pageSize } = options.pageInfo;\n useEffect(() => {\n if (!enabled || !latest.current.request) return;\n const delay = latest.current.debounceTime;\n if (delay <= 0) {\n void run();\n return;\n }\n const timer = setTimeout(() => void run(), delay);\n return () => clearTimeout(timer);\n }, [enabled, token, options.depsKey, current, pageSize, run]);\n\n useEffect(() => {\n const { polling } = latest.current;\n if (!polling || loading || !enabled) return;\n const interval = typeof polling === 'function' ? polling(data) : polling;\n if (!interval) return;\n const timer = setTimeout(() => void run(), Math.max(interval, 2000));\n return () => clearTimeout(timer);\n }, [data, loading, enabled, options.polling, run]);\n\n const reload = useCallback(\n () =>\n new Promise<void>((resolve) => {\n if (!latest.current.request) {\n resolve();\n return;\n }\n pending.current.push(resolve);\n setEnabled(true);\n setToken((value) => value + 1);\n }),\n [],\n );\n\n return { data, loading, reload, setData };\n};\n"],"mappings":";;AA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YAAY,QAAQ;GAC1B,QAAQ,UAAU,CAAC;GACnB,UAAU,SAAS,YAAY,QAAQ,CAAC;EAC1C;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,EAAE,SAAS,aAAa,QAAQ;CACtC,gBAAgB;EACd,IAAI,CAAC,WAAW,CAAC,OAAO,QAAQ,SAAS;EACzC,MAAM,QAAQ,OAAO,QAAQ;EAC7B,IAAI,SAAS,GAAG;GACd,IAAS;GACT;EACF;EACA,MAAM,QAAQ,iBAAiB,KAAK,IAAI,GAAG,KAAK;EAChD,aAAa,aAAa,KAAK;CACjC,GAAG;EAAC;EAAS;EAAO,QAAQ;EAAS;EAAS;EAAU;CAAG,CAAC;CAE5D,gBAAgB;EACd,MAAM,EAAE,YAAY,OAAO;EAC3B,IAAI,CAAC,WAAW,WAAW,CAAC,SAAS;EACrC,MAAM,WAAW,OAAO,YAAY,aAAa,QAAQ,IAAI,IAAI;EACjE,IAAI,CAAC,UAAU;EACf,MAAM,QAAQ,iBAAiB,KAAK,IAAI,GAAG,KAAK,IAAI,UAAU,GAAI,CAAC;EACnE,aAAa,aAAa,KAAK;CACjC,GAAG;EAAC;EAAM;EAAS;EAAS,QAAQ;EAAS;CAAG,CAAC;CAgBjD,OAAO;EAAE;EAAM;EAAS,QAdT,kBAEX,IAAI,SAAe,YAAY;GAC7B,IAAI,CAAC,OAAO,QAAQ,SAAS;IAC3B,QAAQ;IACR;GACF;GACA,QAAQ,QAAQ,KAAK,OAAO;GAC5B,WAAW,IAAI;GACf,UAAU,UAAU,QAAQ,CAAC;EAC/B,CAAC,GACH,CAAC,CAG0B;EAAG;CAAQ;AAC1C"}
1
+ {"version":3,"file":"useFetchData.mjs","names":[],"sources":["../../../src/ProTable/hooks/useFetchData.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { SortOrder } from '@/Table/type';\n\nimport type {\n ProTablePageInfo,\n ProTableRequest,\n ProTableRequestData,\n ProTableRequestFilter,\n} from '../type';\n\ntype Filter = Record<string, (string | number | boolean)[] | null>;\n\nexport interface UseFetchDataOptions<T> {\n debounceTime: number;\n defaultData?: T[];\n depsKey: string;\n filter: Filter;\n getParams: () => Record<string, any>;\n manual: boolean;\n onDataSourceChange?: (data: T[]) => void;\n onLoad?: (data: T[]) => void;\n onLoadingChange?: (loading: boolean) => void;\n onRequestError?: (error: Error) => void;\n pageInfo: ProTablePageInfo;\n paginated: boolean;\n polling?: number | ((data: T[]) => number);\n postData?: (data: T[]) => T[];\n request?: ProTableRequest<T, any>;\n setTotal: (total: number) => void;\n sort: Record<string, SortOrder>;\n}\n\nexport const useFetchData = <T>(options: UseFetchDataOptions<T>) => {\n const [data, setData] = useState<T[]>(options.defaultData ?? []);\n const [loading, setLoading] = useState(false);\n const latest = useRef(options);\n latest.current = options;\n const requestId = useRef(0);\n const [enabled, setEnabled] = useState(!options.manual);\n const [token, setToken] = useState(0);\n const pending = useRef<(() => void)[]>([]);\n\n const updateLoading = (next: boolean) => {\n setLoading(next);\n latest.current.onLoadingChange?.(next);\n };\n\n const run = useCallback(async () => {\n const opts = latest.current;\n if (!opts.request) return;\n const id = ++requestId.current;\n updateLoading(true);\n try {\n const params: Record<string, any> = { ...opts.getParams() };\n if (opts.paginated) {\n params.current = opts.pageInfo.current;\n params.pageSize = opts.pageInfo.pageSize;\n }\n // A `request` resolving `null` / `undefined` (e.g. an empty API body) is treated as empty data.\n const response: Partial<ProTableRequestData<T>> = (await opts.request(\n params as any,\n opts.sort,\n opts.filter as ProTableRequestFilter,\n )) ?? { data: [] };\n if (id !== requestId.current) return;\n if (response.success === false) {\n // Pro keeps the previous data when the request reports failure.\n return;\n }\n const raw = response.data ?? [];\n const next = opts.postData ? opts.postData(raw) : raw;\n setData(next);\n opts.setTotal(response.total ?? next.length);\n opts.onLoad?.(next);\n opts.onDataSourceChange?.(next);\n } catch (error) {\n if (id !== requestId.current) return;\n if (opts.onRequestError) opts.onRequestError(error as Error);\n else console.error(error);\n } finally {\n if (id === requestId.current) updateLoading(false);\n const resolvers = pending.current;\n pending.current = [];\n resolvers.forEach((resolve) => resolve());\n }\n }, []);\n\n const { current, pageSize } = options.pageInfo;\n useEffect(() => {\n if (!enabled || !latest.current.request) return;\n const delay = latest.current.debounceTime;\n if (delay <= 0) {\n void run();\n return;\n }\n const timer = setTimeout(() => void run(), delay);\n return () => clearTimeout(timer);\n }, [enabled, token, options.depsKey, current, pageSize, run]);\n\n useEffect(() => {\n const { polling } = latest.current;\n if (!polling || loading || !enabled) return;\n const interval = typeof polling === 'function' ? polling(data) : polling;\n if (!interval) return;\n const timer = setTimeout(() => void run(), Math.max(interval, 2000));\n return () => clearTimeout(timer);\n }, [data, loading, enabled, options.polling, run]);\n\n const reload = useCallback(\n () =>\n new Promise<void>((resolve) => {\n if (!latest.current.request) {\n resolve();\n return;\n }\n pending.current.push(resolve);\n setEnabled(true);\n setToken((value) => value + 1);\n }),\n [],\n );\n\n return { data, loading, reload, setData };\n};\n"],"mappings":";;AAiCA,MAAa,gBAAmB,YAAoC;CAClE,MAAM,CAAC,MAAM,WAAW,SAAc,QAAQ,eAAe,CAAC,CAAC;CAC/D,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,SAAS,OAAO,OAAO;CAC7B,OAAO,UAAU;CACjB,MAAM,YAAY,OAAO,CAAC;CAC1B,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC,QAAQ,MAAM;CACtD,MAAM,CAAC,OAAO,YAAY,SAAS,CAAC;CACpC,MAAM,UAAU,OAAuB,CAAC,CAAC;CAEzC,MAAM,iBAAiB,SAAkB;EACvC,WAAW,IAAI;EACf,OAAO,QAAQ,kBAAkB,IAAI;CACvC;CAEA,MAAM,MAAM,YAAY,YAAY;EAClC,MAAM,OAAO,OAAO;EACpB,IAAI,CAAC,KAAK,SAAS;EACnB,MAAM,KAAK,EAAE,UAAU;EACvB,cAAc,IAAI;EAClB,IAAI;GACF,MAAM,SAA8B,EAAE,GAAG,KAAK,UAAU,EAAE;G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