@fibery/ui-kit 9.0.0 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/lib/actions-menu/actions-menu-item.js +1 -1
  2. package/lib/actions-menu/actions-menu-separator.d.ts +2 -2
  3. package/lib/actions-menu/index.d.ts +3 -3
  4. package/lib/antd/input-number.js +2 -2
  5. package/lib/antd/input.js +2 -2
  6. package/lib/board-table-loader.js +1 -1
  7. package/lib/card-container.js +1 -1
  8. package/lib/copy-to-clipboard.js +2 -1
  9. package/lib/date-picker/date-range-input.js +1 -1
  10. package/lib/date-picker/relative-date-picker.js +5 -3
  11. package/lib/date-picker/single-date-input.js +1 -1
  12. package/lib/date-picker/single-date-picker.d.ts +1 -2
  13. package/lib/date-picker/single-date-picker.js +2 -1
  14. package/lib/date-picker/types.d.ts +1 -2
  15. package/lib/design-system/alpha.d.ts +6 -0
  16. package/lib/design-system/alpha.js +6 -0
  17. package/lib/embed.js +20 -35
  18. package/lib/embed.wyw-in-js.css +1 -2
  19. package/lib/emoji-picker/app-icon-picker.d.ts +2 -2
  20. package/lib/emoji-picker/emoji-picker-content-with-color.d.ts +2 -2
  21. package/lib/emoji-picker/emoji-picker.d.ts +2 -2
  22. package/lib/emoji-picker/icon-emoji-picker.d.ts +1 -2
  23. package/lib/errors.d.ts +2 -3
  24. package/lib/guide-link.js +1 -1
  25. package/lib/icons/ast/build.d.ts +5 -0
  26. package/lib/icons/ast/build.js +25 -0
  27. package/lib/icons/ast/index.d.ts +2 -1
  28. package/lib/icons/ast/index.js +5 -4
  29. package/lib/icons/ast/spinner.js +7 -1
  30. package/lib/icons/react/build.d.ts +15 -0
  31. package/lib/icons/react/build.js +21 -0
  32. package/lib/icons/react/index.d.ts +2 -1
  33. package/lib/icons/react/index.js +5 -4
  34. package/lib/integration-compact-info-button.js +1 -2
  35. package/lib/is-in-popup.d.ts +1 -2
  36. package/lib/is-in-popup.js +6 -0
  37. package/lib/loaders.d.ts +1 -9
  38. package/lib/loaders.js +2 -39
  39. package/lib/loaders.wyw-in-js.css +2 -4
  40. package/lib/mobile-drawer.wyw-in-js.css +2 -2
  41. package/lib/popover/index.d.ts +5 -10
  42. package/lib/popover/index.js +11 -22
  43. package/lib/popover/mobile-popover.d.ts +2 -2
  44. package/lib/popover/popup-modifiers-context.d.ts +3 -5
  45. package/lib/root-theme-provider.d.ts +11 -0
  46. package/lib/root-theme-provider.js +107 -0
  47. package/lib/root-theme-provider.wyw-in-js.css +1 -0
  48. package/lib/select/components/drop-down-indicator.js +1 -1
  49. package/lib/select/components/menu-list-virtualized.js +1 -1
  50. package/lib/select/select-in-popover.js +1 -1
  51. package/lib/select/select.js +3 -3
  52. package/lib/select/styles.js +2 -2
  53. package/lib/spinner.d.ts +9 -0
  54. package/lib/spinner.js +13 -0
  55. package/lib/thematic-state.js +1 -1
  56. package/lib/thematic.js +1 -1
  57. package/lib/theme-provider.d.ts +4 -8
  58. package/lib/theme-provider.js +5 -96
  59. package/lib/theme-provider.wyw-in-js.css +1 -2
  60. package/lib/theme-settings-core.d.ts +13 -1
  61. package/lib/theme-settings-core.js +37 -1
  62. package/lib/theme-settings.d.ts +3 -2
  63. package/lib/theme-settings.js +7 -2
  64. package/lib/unit/primitive.js +56 -51
  65. package/lib/unit/primitive.wyw-in-js.css +2 -2
  66. package/lib/use-long-press.d.ts +6 -6
  67. package/lib/with-data.d.ts +35 -37
  68. package/lib/with-data.js +23 -22
  69. package/package.json +6 -3
  70. package/lib/beta-badge.d.ts +0 -8
  71. package/lib/beta-badge.js +0 -13
  72. package/lib/beta-badge.wyw-in-js.css +0 -1
  73. package/lib/checkbox-multi-select.d.ts +0 -21
  74. package/lib/checkbox-multi-select.js +0 -41
  75. package/lib/checkbox-multi-select.wyw-in-js.css +0 -3
  76. package/lib/country-selector.d.ts +0 -9
  77. package/lib/country-selector.js +0 -21
  78. package/lib/layout.d.ts +0 -28
  79. package/lib/layout.js +0 -66
  80. package/lib/layout.wyw-in-js.css +0 -2
  81. package/lib/new-card-placeholder.d.ts +0 -26
  82. package/lib/new-card-placeholder.js +0 -141
  83. package/lib/new-card-placeholder.wyw-in-js.css +0 -5
@@ -1,76 +1,74 @@
1
- import { $TSFixMe } from "./tsfixme.js";
2
1
  import { ComponentType } from "react";
3
2
  //#region src/with-data.d.ts
4
- type FetchState = {
3
+ type FetchState<Value = unknown> = {
5
4
  fetchState: ":fetch-state/start";
6
5
  fetchError: null;
7
6
  fetchValue: null;
8
7
  } | {
9
8
  fetchState: ":fetch-state/success";
10
- fetchValue: $TSFixMe;
9
+ fetchValue: Value;
11
10
  fetchError: null;
12
11
  } | {
13
12
  fetchState: ":fetch-state/error";
14
13
  fetchError: Error;
15
14
  fetchValue: null;
16
15
  };
17
- type ProvidedState = Record<string, FetchState>;
18
- declare function provideData<T>({ sources }: {
19
- sources: Record<string, () => Promise<$TSFixMe>>;
20
- }): (Component: ComponentType<T & ProvidedState>) => {
21
- new (props: T): {
22
- state: {
23
- [x: string]: FetchState;
24
- };
25
- _prefetch: (key: string, fetch: () => Promise<$TSFixMe>) => Promise<void>;
16
+ type DataSources = Record<string, () => Promise<unknown>>;
17
+ type ProvidedState<Sources extends DataSources> = { [Key in keyof Sources]: FetchState<Awaited<ReturnType<Sources[Key]>>>; };
18
+ declare function provideData<Sources extends DataSources>({ sources }: {
19
+ sources: Sources;
20
+ }): <OwnProps extends object>(Component: ComponentType<OwnProps & ProvidedState<Sources>>) => {
21
+ new (props: OwnProps): {
22
+ state: ProvidedState<Sources>;
23
+ _prefetch: <Key extends keyof Sources>(key: Key, fetch: Sources[Key]) => Promise<void>;
24
+ setSourceState<Key extends keyof Sources>(key: Key, value: ProvidedState<Sources>[Key]): void;
26
25
  componentDidMount(): void;
27
- setStateIfMounted(updater: (prevState: ProvidedState) => ProvidedState): void;
26
+ setStateIfMounted(updater: (prevState: ProvidedState<Sources>) => ProvidedState<Sources>): void;
28
27
  componentWillUnmount(): void;
29
28
  render(): import("react/jsx-runtime").JSX.Element;
30
29
  context: unknown;
31
- setState<K extends string>(state: Pick<ProvidedState, K> | ProvidedState | ((prevState: Readonly<ProvidedState>, props: Readonly<T>) => Pick<ProvidedState, K> | ProvidedState | null) | null, callback?: (() => void) | undefined): void;
30
+ setState<K extends keyof Sources>(state: Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | ((prevState: Readonly<ProvidedState<Sources>>, props: Readonly<OwnProps>) => Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | null) | null, callback?: (() => void) | undefined): void;
32
31
  forceUpdate(callback?: (() => void) | undefined): void;
33
- readonly props: Readonly<T>;
32
+ readonly props: Readonly<OwnProps>;
34
33
  refs: {
35
34
  [key: string]: import("react").ReactInstance;
36
35
  };
37
- shouldComponentUpdate?(nextProps: Readonly<T>, nextState: Readonly<ProvidedState>, nextContext: any): boolean;
36
+ shouldComponentUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): boolean;
38
37
  componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
39
- getSnapshotBeforeUpdate?(prevProps: Readonly<T>, prevState: Readonly<ProvidedState>): any;
40
- componentDidUpdate?(prevProps: Readonly<T>, prevState: Readonly<ProvidedState>, snapshot?: any): void;
38
+ getSnapshotBeforeUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>): any;
39
+ componentDidUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>, snapshot?: any): void;
41
40
  componentWillMount?(): void;
42
41
  UNSAFE_componentWillMount?(): void;
43
- componentWillReceiveProps?(nextProps: Readonly<T>, nextContext: any): void;
44
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<T>, nextContext: any): void;
45
- componentWillUpdate?(nextProps: Readonly<T>, nextState: Readonly<ProvidedState>, nextContext: any): void;
46
- UNSAFE_componentWillUpdate?(nextProps: Readonly<T>, nextState: Readonly<ProvidedState>, nextContext: any): void;
42
+ componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
43
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
44
+ componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
45
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
47
46
  };
48
- new (props: T, context: any): {
49
- state: {
50
- [x: string]: FetchState;
51
- };
52
- _prefetch: (key: string, fetch: () => Promise<$TSFixMe>) => Promise<void>;
47
+ new (props: OwnProps, context: any): {
48
+ state: ProvidedState<Sources>;
49
+ _prefetch: <Key extends keyof Sources>(key: Key, fetch: Sources[Key]) => Promise<void>;
50
+ setSourceState<Key extends keyof Sources>(key: Key, value: ProvidedState<Sources>[Key]): void;
53
51
  componentDidMount(): void;
54
- setStateIfMounted(updater: (prevState: ProvidedState) => ProvidedState): void;
52
+ setStateIfMounted(updater: (prevState: ProvidedState<Sources>) => ProvidedState<Sources>): void;
55
53
  componentWillUnmount(): void;
56
54
  render(): import("react/jsx-runtime").JSX.Element;
57
55
  context: unknown;
58
- setState<K extends string>(state: Pick<ProvidedState, K> | ProvidedState | ((prevState: Readonly<ProvidedState>, props: Readonly<T>) => Pick<ProvidedState, K> | ProvidedState | null) | null, callback?: (() => void) | undefined): void;
56
+ setState<K extends keyof Sources>(state: Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | ((prevState: Readonly<ProvidedState<Sources>>, props: Readonly<OwnProps>) => Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | null) | null, callback?: (() => void) | undefined): void;
59
57
  forceUpdate(callback?: (() => void) | undefined): void;
60
- readonly props: Readonly<T>;
58
+ readonly props: Readonly<OwnProps>;
61
59
  refs: {
62
60
  [key: string]: import("react").ReactInstance;
63
61
  };
64
- shouldComponentUpdate?(nextProps: Readonly<T>, nextState: Readonly<ProvidedState>, nextContext: any): boolean;
62
+ shouldComponentUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): boolean;
65
63
  componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
66
- getSnapshotBeforeUpdate?(prevProps: Readonly<T>, prevState: Readonly<ProvidedState>): any;
67
- componentDidUpdate?(prevProps: Readonly<T>, prevState: Readonly<ProvidedState>, snapshot?: any): void;
64
+ getSnapshotBeforeUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>): any;
65
+ componentDidUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>, snapshot?: any): void;
68
66
  componentWillMount?(): void;
69
67
  UNSAFE_componentWillMount?(): void;
70
- componentWillReceiveProps?(nextProps: Readonly<T>, nextContext: any): void;
71
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<T>, nextContext: any): void;
72
- componentWillUpdate?(nextProps: Readonly<T>, nextState: Readonly<ProvidedState>, nextContext: any): void;
73
- UNSAFE_componentWillUpdate?(nextProps: Readonly<T>, nextState: Readonly<ProvidedState>, nextContext: any): void;
68
+ componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
69
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
70
+ componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
71
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
74
72
  };
75
73
  contextType?: import("react").Context<any> | undefined;
76
74
  };
package/lib/with-data.js CHANGED
@@ -3,37 +3,38 @@ import { mapValues, noop } from "@fibery/helpers/src/_";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { PureComponent } from "react";
5
5
  //#region src/with-data.tsx
6
+ var makeInitialState = (sources) => mapValues(sources, () => ({
7
+ fetchState: ":fetch-state/start",
8
+ fetchValue: null,
9
+ fetchError: null
10
+ }));
6
11
  function provideData({ sources }) {
7
12
  return (Component) => class DataProvider extends PureComponent {
8
- state = mapValues(sources, () => ({
9
- fetchState: ":fetch-state/start",
10
- fetchValue: null,
11
- fetchError: null
12
- }));
13
+ state = makeInitialState(sources);
13
14
  _prefetch = async (key, fetch) => {
14
15
  try {
15
16
  const fetchValue = await fetch();
16
- this.setStateIfMounted((state) => ({
17
- ...state,
18
- [key]: {
19
- fetchState: ":fetch-state/success",
20
- fetchValue,
21
- fetchError: null
22
- }
23
- }));
17
+ this.setSourceState(key, {
18
+ fetchState: ":fetch-state/success",
19
+ fetchValue,
20
+ fetchError: null
21
+ });
24
22
  } catch (fetchError) {
25
- this.setStateIfMounted((state) => ({
26
- ...state,
27
- [key]: {
28
- fetchState: ":fetch-state/error",
29
- fetchValue: null,
30
- fetchError: asError(fetchError)
31
- }
32
- }));
23
+ this.setSourceState(key, {
24
+ fetchState: ":fetch-state/error",
25
+ fetchValue: null,
26
+ fetchError: asError(fetchError)
27
+ });
33
28
  }
34
29
  };
30
+ setSourceState(key, value) {
31
+ this.setStateIfMounted((state) => ({
32
+ ...state,
33
+ [key]: value
34
+ }));
35
+ }
35
36
  componentDidMount() {
36
- Object.entries(sources).forEach(([key, fetch]) => this._prefetch(key, fetch));
37
+ Object.keys(sources).forEach((key) => this._prefetch(key, sources[key]));
37
38
  }
38
39
  setStateIfMounted(updater) {
39
40
  return this.setState(updater);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/ui-kit",
3
- "version": "9.0.0",
3
+ "version": "9.0.2",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "lib"
@@ -83,6 +83,9 @@
83
83
  "./src/theme-provider": {
84
84
  "default": null
85
85
  },
86
+ "./src/root-theme-provider": {
87
+ "default": null
88
+ },
86
89
  "./src/layout-variables": {
87
90
  "default": null
88
91
  },
@@ -144,8 +147,8 @@
144
147
  "vaul": "1.1.2",
145
148
  "virtua": "0.48.8",
146
149
  "@fibery/emoji-data": "3.0.0",
147
- "@fibery/helpers": "3.2.1",
148
- "@fibery/react": "2.0.0"
150
+ "@fibery/react": "2.0.0",
151
+ "@fibery/helpers": "3.2.1"
149
152
  },
150
153
  "peerDependencies": {
151
154
  "react": "18.3.1",
@@ -1,8 +0,0 @@
1
- //#region src/beta-badge.d.ts
2
- type Props = {
3
- children: React.ReactNode;
4
- className?: string;
5
- };
6
- declare const BetaBadge: React.FC<Props>;
7
- //#endregion
8
- export { BetaBadge };
package/lib/beta-badge.js DELETED
@@ -1,13 +0,0 @@
1
- import "./beta-badge.wyw-in-js.css";
2
- import { textClasses } from "./design-system/typography.js";
3
- /* empty css */
4
- import { jsx } from "react/jsx-runtime";
5
- import { cx } from "@linaria/core";
6
- //#region src/beta-badge.tsx
7
- var betaBadgeStyle = "b15i7tcu-betaBadge";
8
- var BetaBadge = ({ children, className }) => /* @__PURE__ */ jsx("span", {
9
- className: cx(textClasses.heading8, betaBadgeStyle, className),
10
- children
11
- });
12
- //#endregion
13
- export { BetaBadge };
@@ -1 +0,0 @@
1
- .b15i7tcu-betaBadge{display:inline-block;padding:2px 5px;color:var(--colorAI);background-color:var(--colorBgAI);vertical-align:text-top;border-radius:4px;}
@@ -1,21 +0,0 @@
1
- import { Theme } from "./design-system/theme.js";
2
- import "./design-system.js";
3
- import { FC } from "react";
4
- //#region src/checkbox-multi-select.d.ts
5
- type Option = {
6
- color?: string;
7
- label?: string;
8
- title?: string;
9
- checked?: boolean;
10
- disabled?: boolean;
11
- onToggle: () => void;
12
- };
13
- interface CheckboxMultiSelectProps {
14
- theme: Theme;
15
- color?: string;
16
- options: Option[];
17
- }
18
- declare const CheckboxMultiSelect: FC<CheckboxMultiSelectProps>;
19
- declare const ThemedCheckboxMultiSelect: FC<Omit<CheckboxMultiSelectProps, "theme">>;
20
- //#endregion
21
- export { CheckboxMultiSelect, ThemedCheckboxMultiSelect };
@@ -1,41 +0,0 @@
1
- import "./checkbox-multi-select.wyw-in-js.css";
2
- import { textClasses } from "./design-system/typography.js";
3
- import { useTheme } from "./theme-provider.js";
4
- import { Checkbox } from "./checkbox.js";
5
- /* empty css */
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { cx } from "@linaria/core";
8
- //#region src/checkbox-multi-select.tsx
9
- var labelStyle = "l1h8scft-label";
10
- var labelWrapperStyle = "l1lwjtjf-labelWrapper";
11
- var optionsWrapperStyle = "oa8vb22-optionsWrapper";
12
- var CheckboxMultiSelect = ({ options, color, theme }) => {
13
- return /* @__PURE__ */ jsx("div", {
14
- className: optionsWrapperStyle,
15
- children: options.map(({ checked, onToggle, label, disabled, title, color: optionColor }, index) => {
16
- return /* @__PURE__ */ jsxs("label", {
17
- style: { cursor: disabled ? "not-allowed" : "pointer" },
18
- className: labelWrapperStyle,
19
- title,
20
- children: [/* @__PURE__ */ jsx(Checkbox, {
21
- checked,
22
- onChange: onToggle,
23
- disabled,
24
- color: optionColor || color || theme.colors.colorAccent
25
- }), /* @__PURE__ */ jsx("div", {
26
- className: cx(textClasses.regular, labelStyle),
27
- children: label
28
- })]
29
- }, index);
30
- })
31
- });
32
- };
33
- var ThemedCheckboxMultiSelect = (props) => {
34
- const theme = useTheme();
35
- return /* @__PURE__ */ jsx(CheckboxMultiSelect, {
36
- ...props,
37
- theme
38
- });
39
- };
40
- //#endregion
41
- export { CheckboxMultiSelect, ThemedCheckboxMultiSelect };
@@ -1,3 +0,0 @@
1
- .l1h8scft-label{margin-left:8px;line-height:15px;}
2
- .l1lwjtjf-labelWrapper{min-width:0;margin-bottom:12px;display:flex;flex-direction:row;align-items:flex-start;}
3
- .oa8vb22-optionsWrapper{display:flex;flex-direction:column;max-height:400px;overflow-y:auto;}
@@ -1,9 +0,0 @@
1
- import { FC } from "react";
2
- //#region src/country-selector.d.ts
3
- interface CountrySelectorProps {
4
- value?: string;
5
- onChange?: (value: string) => void;
6
- }
7
- declare const CountrySelector: FC<CountrySelectorProps>;
8
- //#endregion
9
- export { CountrySelector };
@@ -1,21 +0,0 @@
1
- import { Select } from "./select/index.js";
2
- import { jsx } from "react/jsx-runtime";
3
- import countryList from "react-select-country-list";
4
- //#region src/country-selector.tsx
5
- var restrictedCountries = "RU,BY,KP,SY,IR,SD,CU".split(",");
6
- var options = countryList().getData().filter((x) => !restrictedCountries.includes(x.value));
7
- var countryMap = /* @__PURE__ */ new Map();
8
- options.forEach((option) => {
9
- countryMap.set(option.value, option);
10
- });
11
- var CountrySelector = ({ onChange = () => null, value }) => {
12
- return /* @__PURE__ */ jsx(Select, {
13
- isSearchable: true,
14
- options,
15
- value: countryMap.get(value) ?? null,
16
- placeholder: "Select your country",
17
- onChange: ({ value }) => onChange(value)
18
- });
19
- };
20
- //#endregion
21
- export { CountrySelector };
package/lib/layout.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import { ComponentProps } from "react";
2
- //#region src/layout.d.ts
3
- declare const verticalAlignmentsToAlignItems: {
4
- top: string;
5
- center: string;
6
- bottom: string;
7
- };
8
- declare const verticalAlignments: Array<keyof typeof verticalAlignmentsToAlignItems>;
9
- interface HStackProps extends ComponentProps<"div"> {
10
- alignment: keyof typeof verticalAlignmentsToAlignItems;
11
- spacing?: number;
12
- padding?: number;
13
- }
14
- declare const HStack: import("react").ForwardRefExoticComponent<Omit<HStackProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
15
- declare const horizontalAlignmentsToAlignItems: {
16
- leading: string;
17
- center: string;
18
- trailing: string;
19
- };
20
- declare const horizontalAlignments: Array<keyof typeof horizontalAlignmentsToAlignItems>;
21
- interface VStackProps extends ComponentProps<"div"> {
22
- alignment: keyof typeof horizontalAlignmentsToAlignItems;
23
- spacing?: number;
24
- padding?: number;
25
- }
26
- declare const VStack: import("react").ForwardRefExoticComponent<Omit<VStackProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
27
- //#endregion
28
- export { HStack, VStack, horizontalAlignments, verticalAlignments };
package/lib/layout.js DELETED
@@ -1,66 +0,0 @@
1
- import "./layout.wyw-in-js.css";
2
- /* empty css */
3
- import { jsx } from "react/jsx-runtime";
4
- import { forwardRef } from "react";
5
- import { styled } from "@linaria/react";
6
- //#region src/layout.tsx
7
- var verticalAlignmentsToAlignItems = {
8
- top: "flex-start",
9
- center: "center",
10
- bottom: "flex-end"
11
- };
12
- var verticalAlignments = Object.keys(verticalAlignmentsToAlignItems);
13
- var _exp = () => (({ alignItemsType }) => alignItemsType);
14
- var _exp2 = () => (({ paddingStyle = 0 }) => paddingStyle);
15
- var _exp3 = () => (({ spacingStyle = 0 }) => spacingStyle);
16
- var HStackStyle = /*#__PURE__*/ styled("div")({
17
- name: "HStackStyle",
18
- class: "highyvt-HStack",
19
- propsAsIs: false,
20
- vars: {
21
- "highyvt-0": [_exp()],
22
- "highyvt-1": [_exp2(), "px"],
23
- "highyvt-2": [_exp3(), "px"]
24
- }
25
- });
26
- var HStack = forwardRef(({ alignment, spacing, padding, children, ...rest }, ref) => {
27
- return /* @__PURE__ */ jsx(HStackStyle, {
28
- ref,
29
- alignItemsType: verticalAlignmentsToAlignItems[alignment],
30
- paddingStyle: padding,
31
- spacingStyle: spacing,
32
- ...rest,
33
- children
34
- });
35
- });
36
- var horizontalAlignmentsToAlignItems = {
37
- leading: "flex-start",
38
- center: "center",
39
- trailing: "flex-end"
40
- };
41
- var horizontalAlignments = Object.keys(horizontalAlignmentsToAlignItems);
42
- var _exp4 = () => (({ alignItemsType }) => alignItemsType);
43
- var _exp5 = () => (({ paddingStyle = 0 }) => paddingStyle);
44
- var _exp6 = () => (({ spacingStyle = 0 }) => spacingStyle);
45
- var VStackStyle = /*#__PURE__*/ styled("div")({
46
- name: "VStackStyle",
47
- class: "vsoocrd-VStack",
48
- propsAsIs: false,
49
- vars: {
50
- "vsoocrd-0": [_exp4()],
51
- "vsoocrd-1": [_exp5(), "px"],
52
- "vsoocrd-2": [_exp6(), "px"]
53
- }
54
- });
55
- var VStack = forwardRef(({ alignment, spacing, children, padding, ...rest }, ref) => {
56
- return /* @__PURE__ */ jsx(VStackStyle, {
57
- ref,
58
- alignItemsType: horizontalAlignmentsToAlignItems[alignment],
59
- paddingStyle: padding,
60
- spacingStyle: spacing,
61
- ...rest,
62
- children
63
- });
64
- });
65
- //#endregion
66
- export { HStack, VStack, horizontalAlignments, verticalAlignments };
@@ -1,2 +0,0 @@
1
- .highyvt-HStack{display:flex;flex-direction:row;align-items:var(--highyvt-0);padding:var(--highyvt-1);}.highyvt-HStack>*+*{margin-left:var(--highyvt-2);}
2
- .vsoocrd-VStack{display:flex;flex-direction:column;align-items:var(--vsoocrd-0);padding:var(--vsoocrd-1);}.vsoocrd-VStack>*+*{margin-top:var(--vsoocrd-2);}
@@ -1,26 +0,0 @@
1
- import { $TSFixMe } from "./tsfixme.js";
2
- import { CardSize } from "./card-container.js";
3
- import { CSSProperties, FC, ReactNode, RefObject } from "react";
4
- //#region src/new-card-placeholder.d.ts
5
- declare const outlineNoneClassName: import("@linaria/core").LinariaClassName;
6
- interface NewCardPlaceholderProps {
7
- typeTitle?: string;
8
- size: CardSize;
9
- containerClassName?: string;
10
- inputStyle?: CSSProperties;
11
- leftContainer?: ReactNode;
12
- scrollToInput?: boolean;
13
- bypassedRef: RefObject<HTMLDivElement>;
14
- referenceSelector?: ReactNode;
15
- selectorOpen?: boolean;
16
- readOnly?: boolean;
17
- onSubmit: (v: {
18
- event: $TSFixMe;
19
- title: string;
20
- }) => Promise<void>;
21
- onHide: () => void;
22
- onHideByEsc?: () => void;
23
- }
24
- declare const NewCardPlaceholder: FC<NewCardPlaceholderProps>;
25
- //#endregion
26
- export { NewCardPlaceholder, outlineNoneClassName };
@@ -1,141 +0,0 @@
1
- import "./new-card-placeholder.wyw-in-js.css";
2
- import { textStyles } from "./design-system/typography.js";
3
- import { AntTransparentInput, AntTransparentTextArea } from "./antd/input.js";
4
- import { Box } from "./box.js";
5
- import { Button } from "./button/button.js";
6
- import { CardContainer, titleUnitsContainerClassName } from "./card-container.js";
7
- import { ignoreEnter } from "./form-utils.js";
8
- /* empty css */
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- import { useCallback, useEffect, useState } from "react";
11
- import cx from "classnames";
12
- import { styled } from "@linaria/react";
13
- import { useFocusOutside } from "@fibery/react/src/use-focus-outside";
14
- //#region src/new-card-placeholder.tsx
15
- var disabledTextClassName = "d147c4dk-disabledText";
16
- var titleAreaContainerClassName = "t11jol8j-titleAreaContainer";
17
- var _exp4 = () => (({ backgroundColor }) => backgroundColor || "");
18
- var AuxWrapper = /*#__PURE__*/ styled("div")({
19
- name: "AuxWrapper",
20
- class: "asb1482-AuxWrapper",
21
- propsAsIs: false,
22
- vars: { "asb1482-0": [_exp4()] }
23
- });
24
- var singleLineClassName = "sxvk75e-singleLine";
25
- var autosize = {
26
- minRows: 1,
27
- maxRows: 10
28
- };
29
- var outlineNoneClassName = "o1l7moht-outlineNone";
30
- var NewCardPlaceholder = (props) => {
31
- const { leftContainer, typeTitle, containerClassName, inputStyle, bypassedRef, onSubmit, onHide, onHideByEsc = onHide, referenceSelector, selectorOpen, readOnly, scrollToInput = true, size } = props;
32
- const [title, setTitle] = useState("");
33
- const multiline = size !== ":card-size/timeline" && size !== ":card-size/list" && size !== ":card-size/cell";
34
- useEffect(() => {
35
- if (readOnly) bypassedRef.current?.focus();
36
- }, [bypassedRef, readOnly]);
37
- const onChange = useCallback((e) => {
38
- setTitle(e.target.value);
39
- e.stopPropagation();
40
- }, []);
41
- const submit = useCallback(async (event) => {
42
- setTitle("");
43
- try {
44
- await onSubmit({
45
- event,
46
- title
47
- });
48
- } catch (e) {}
49
- }, [onSubmit, title]);
50
- const onPressEnter = useCallback(async (e) => {
51
- e.stopPropagation();
52
- submit(e);
53
- }, [submit]);
54
- const onBlur = useCallback(async (e) => {
55
- if (!selectorOpen) {
56
- if (title) submit(e);
57
- onHide();
58
- }
59
- }, [
60
- onHide,
61
- selectorOpen,
62
- submit,
63
- title
64
- ]);
65
- const hasTitle = title.length > 0;
66
- const onKeyDown = useCallback((e) => {
67
- ignoreEnter(e);
68
- if (e.key === "Escape") {
69
- e.stopPropagation();
70
- if (hasTitle) setTitle("");
71
- else onHideByEsc();
72
- }
73
- }, [hasTitle, onHideByEsc]);
74
- const onAddCardButtonClick = useCallback((e) => {
75
- submit(e);
76
- }, [submit]);
77
- const [containerElement, setContainerElement] = useState(null);
78
- useEffect(() => {
79
- if (containerElement && scrollToInput) containerElement.scrollIntoView({
80
- behavior: "smooth",
81
- block: "center",
82
- inline: "nearest"
83
- });
84
- }, [
85
- containerElement,
86
- title === "",
87
- scrollToInput
88
- ]);
89
- const { onBlurCapture, onFocusCapture } = useFocusOutside(onBlur);
90
- return /* @__PURE__ */ jsx(Box, {
91
- focused: true,
92
- hovered: false,
93
- ref: setContainerElement,
94
- className: containerClassName,
95
- onBlurCapture,
96
- onFocusCapture,
97
- children: jsx(CardContainer, {
98
- before: leftContainer && /* @__PURE__ */ jsx("div", { children: leftContainer }),
99
- title: readOnly ? /* @__PURE__ */ jsx("div", {
100
- ref: bypassedRef,
101
- tabIndex: 0,
102
- className: titleUnitsContainerClassName,
103
- children: /* @__PURE__ */ jsx("div", {
104
- className: cx(disabledTextClassName, outlineNoneClassName, { [singleLineClassName]: !multiline }),
105
- children: "Name will be generated by a formula"
106
- })
107
- }) : /* @__PURE__ */ jsx("div", {
108
- className: titleAreaContainerClassName,
109
- children: /* @__PURE__ */ jsx(multiline ? AntTransparentTextArea : AntTransparentInput, {
110
- bypassedRef,
111
- value: title,
112
- readOnly: false,
113
- onChange,
114
- onPressEnter,
115
- autoFocus: true,
116
- onKeyDown,
117
- placeholder: readOnly ? "" : `New ${typeTitle}`,
118
- style: {
119
- ...textStyles.regular,
120
- ...inputStyle
121
- },
122
- ...multiline ? { autoSize: autosize } : {}
123
- })
124
- }),
125
- size,
126
- after: (referenceSelector || readOnly) && /* @__PURE__ */ jsxs(AuxWrapper, { children: [
127
- referenceSelector && /* @__PURE__ */ jsx("div", { children: referenceSelector }),
128
- readOnly && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
129
- style: { width: 40 },
130
- size: "small",
131
- onClick: onAddCardButtonClick,
132
- children: "Add"
133
- }) }),
134
- multiline && /* @__PURE__ */ jsx("div", {})
135
- ] }),
136
- input: !readOnly
137
- })
138
- });
139
- };
140
- //#endregion
141
- export { NewCardPlaceholder, outlineNoneClassName };
@@ -1,5 +0,0 @@
1
- .d147c4dk-disabledText{color:var(--disabledTextColor);}
2
- .t11jol8j-titleAreaContainer{width:100%;}
3
- .asb1482-AuxWrapper{display:flex;gap:4px;background-color:var(--asb1482-0);}
4
- .sxvk75e-singleLine{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
5
- .o1l7moht-outlineNone{outline:none;}