@stack-spot/citric-react 0.11.1 → 0.13.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.
- package/dist/citric.css +0 -4
- package/dist/components/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion.js +3 -2
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Alert.d.ts.map +1 -1
- package/dist/components/Alert.js +2 -1
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/AsyncContent.d.ts.map +1 -1
- package/dist/components/AsyncContent.js +3 -2
- package/dist/components/AsyncContent.js.map +1 -1
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +3 -2
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/AvatarGroup.d.ts.map +1 -1
- package/dist/components/AvatarGroup.js +3 -2
- package/dist/components/AvatarGroup.js.map +1 -1
- package/dist/components/Badge.d.ts +2 -1
- package/dist/components/Badge.d.ts.map +1 -1
- package/dist/components/Badge.js +3 -1
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Blockquote.d.ts.map +1 -1
- package/dist/components/Blockquote.js +2 -1
- package/dist/components/Blockquote.js.map +1 -1
- package/dist/components/Breadcrumb.d.ts.map +1 -1
- package/dist/components/Breadcrumb.js +3 -2
- package/dist/components/Breadcrumb.js.map +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +3 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +2 -1
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +3 -2
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/CheckboxGroup.d.ts +3 -1
- package/dist/components/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/CheckboxGroup.js +3 -1
- package/dist/components/CheckboxGroup.js.map +1 -1
- package/dist/components/Circle.d.ts.map +1 -1
- package/dist/components/Circle.js +2 -1
- package/dist/components/Circle.js.map +1 -1
- package/dist/components/CitricComponent.d.ts +1 -0
- package/dist/components/CitricComponent.d.ts.map +1 -1
- package/dist/components/CitricComponent.js.map +1 -1
- package/dist/components/Divider.d.ts.map +1 -1
- package/dist/components/Divider.js +2 -1
- package/dist/components/Divider.js.map +1 -1
- package/dist/components/Favorite.d.ts +1 -1
- package/dist/components/Favorite.d.ts.map +1 -1
- package/dist/components/Favorite.js +2 -1
- package/dist/components/Favorite.js.map +1 -1
- package/dist/components/FieldGroup.d.ts.map +1 -1
- package/dist/components/FieldGroup.js +2 -1
- package/dist/components/FieldGroup.js.map +1 -1
- package/dist/components/Form.d.ts.map +1 -1
- package/dist/components/Form.js +2 -1
- package/dist/components/Form.js.map +1 -1
- package/dist/components/FormGroup.d.ts.map +1 -1
- package/dist/components/FormGroup.js +2 -1
- package/dist/components/FormGroup.js.map +1 -1
- package/dist/components/IconBox.d.ts +6 -3
- package/dist/components/IconBox.d.ts.map +1 -1
- package/dist/components/IconBox.js +10 -6
- package/dist/components/IconBox.js.map +1 -1
- package/dist/components/ImageBox.d.ts +52 -0
- package/dist/components/ImageBox.d.ts.map +1 -0
- package/dist/components/ImageBox.js +33 -0
- package/dist/components/ImageBox.js.map +1 -0
- package/dist/components/Input.d.ts +3 -1
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +3 -1
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +3 -2
- package/dist/components/Link.js.map +1 -1
- package/dist/components/MenuOverlay/Menu.d.ts.map +1 -1
- package/dist/components/MenuOverlay/Menu.js.map +1 -1
- package/dist/components/Pagination.d.ts +1 -1
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +3 -2
- package/dist/components/Pagination.js.map +1 -1
- package/dist/components/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar.js +2 -1
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/components/ProgressCircular.d.ts.map +1 -1
- package/dist/components/ProgressCircular.js +2 -1
- package/dist/components/ProgressCircular.js.map +1 -1
- package/dist/components/RadioGroup.d.ts +3 -1
- package/dist/components/RadioGroup.d.ts.map +1 -1
- package/dist/components/RadioGroup.js +3 -1
- package/dist/components/RadioGroup.js.map +1 -1
- package/dist/components/Rating.d.ts.map +1 -1
- package/dist/components/Rating.js +2 -1
- package/dist/components/Rating.js.map +1 -1
- package/dist/components/Select/RichSelect.d.ts +3 -1
- package/dist/components/Select/RichSelect.d.ts.map +1 -1
- package/dist/components/Select/RichSelect.js +5 -2
- package/dist/components/Select/RichSelect.js.map +1 -1
- package/dist/components/Select/SimpleSelect.d.ts +2 -1
- package/dist/components/Select/SimpleSelect.d.ts.map +1 -1
- package/dist/components/Select/SimpleSelect.js +4 -2
- package/dist/components/Select/SimpleSelect.js.map +1 -1
- package/dist/components/Select/index.d.ts +2 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +3 -1
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/types.d.ts +3 -1
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/SelectBox.d.ts +2 -1
- package/dist/components/SelectBox.d.ts.map +1 -1
- package/dist/components/SelectBox.js +3 -1
- package/dist/components/SelectBox.js.map +1 -1
- package/dist/components/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton.js +2 -1
- package/dist/components/Skeleton.js.map +1 -1
- package/dist/components/Slider.d.ts.map +1 -1
- package/dist/components/Slider.js +3 -2
- package/dist/components/Slider.js.map +1 -1
- package/dist/components/SmartTable.d.ts +2 -1
- package/dist/components/SmartTable.d.ts.map +1 -1
- package/dist/components/SmartTable.js +3 -1
- package/dist/components/SmartTable.js.map +1 -1
- package/dist/components/Stepper.d.ts +3 -1
- package/dist/components/Stepper.d.ts.map +1 -1
- package/dist/components/Stepper.js +3 -1
- package/dist/components/Stepper.js.map +1 -1
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +3 -2
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Table.d.ts +1 -1
- package/dist/components/Table.d.ts.map +1 -1
- package/dist/components/Table.js +9 -7
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +3 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +3 -1
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Text.d.ts +2 -1
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +3 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/Textarea.d.ts +3 -0
- package/dist/components/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea.js +3 -1
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/layout.d.ts +7 -3
- package/dist/components/layout.d.ts.map +1 -1
- package/dist/components/layout.js +7 -3
- package/dist/components/layout.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/react.d.ts +2 -0
- package/dist/utils/react.d.ts.map +1 -0
- package/dist/utils/react.js +6 -0
- package/dist/utils/react.js.map +1 -0
- package/package.json +1 -1
- package/src/components/Accordion.tsx +3 -2
- package/src/components/Alert.tsx +3 -2
- package/src/components/AsyncContent.tsx +3 -2
- package/src/components/Avatar.tsx +3 -2
- package/src/components/AvatarGroup.tsx +3 -2
- package/src/components/Badge.tsx +4 -1
- package/src/components/Blockquote.tsx +3 -2
- package/src/components/Breadcrumb.tsx +3 -2
- package/src/components/Button.tsx +3 -2
- package/src/components/Card.tsx +3 -2
- package/src/components/Checkbox.tsx +3 -2
- package/src/components/CheckboxGroup.tsx +4 -1
- package/src/components/Circle.tsx +3 -2
- package/src/components/CitricComponent.ts +1 -0
- package/src/components/Divider.tsx +3 -2
- package/src/components/Favorite.tsx +5 -3
- package/src/components/FieldGroup.tsx +3 -2
- package/src/components/Form.tsx +3 -2
- package/src/components/FormGroup.tsx +3 -2
- package/src/components/IconBox.tsx +11 -8
- package/src/components/ImageBox.tsx +85 -0
- package/src/components/Input.tsx +4 -1
- package/src/components/Link.tsx +3 -2
- package/src/components/MenuOverlay/Menu.tsx +3 -3
- package/src/components/Pagination.tsx +4 -3
- package/src/components/ProgressBar.tsx +4 -2
- package/src/components/ProgressCircular.tsx +4 -2
- package/src/components/RadioGroup.tsx +4 -1
- package/src/components/Rating.tsx +3 -2
- package/src/components/Select/RichSelect.tsx +9 -3
- package/src/components/Select/SimpleSelect.tsx +11 -5
- package/src/components/Select/index.tsx +4 -1
- package/src/components/Select/types.ts +3 -1
- package/src/components/SelectBox.tsx +4 -1
- package/src/components/Skeleton.tsx +4 -2
- package/src/components/Slider.tsx +3 -3
- package/src/components/SmartTable.tsx +4 -1
- package/src/components/Stepper.tsx +4 -1
- package/src/components/Switch.tsx +3 -2
- package/src/components/Table.tsx +46 -42
- package/src/components/Tabs/index.tsx +4 -1
- package/src/components/Text.ts +4 -1
- package/src/components/Textarea.tsx +6 -1
- package/src/components/layout.tsx +8 -3
- package/src/index.ts +1 -0
- package/src/utils/react.ts +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI9D,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,GAAG,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CAC1D;AAED,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,iBAAiB,CAAA;AAElE,eAAO,MAAM,SAAS,GAAI,+BAA+B,aAAa,4CACuD,CAAA;AAE7H,eAAO,MAAM,QAAQ,kCAHoC,aAAa,4CAG5B,CAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { withRef } from '../utils/react.js';
|
|
2
3
|
import { CitricComponent } from './CitricComponent.js';
|
|
3
|
-
export const
|
|
4
|
+
export const _Textarea = ({ value, onChange, ...props }) => _jsx(CitricComponent, { tag: "textarea", component: "textarea", value: value, onChange: e => onChange?.(e.target.value), ...props });
|
|
5
|
+
export const Textarea = withRef(_Textarea);
|
|
4
6
|
//# sourceMappingURL=Textarea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAUnD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE,CACxE,KAAC,eAAe,IAAC,GAAG,EAAC,UAAU,EAAC,SAAS,EAAC,UAAU,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAM,KAAK,GAAI,CAAA;AAE7H,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA"}
|
|
@@ -31,16 +31,20 @@ export interface BaseColumnProps<T extends keyof HTMLTag> extends BaseLayoutProp
|
|
|
31
31
|
export type CenterProps<T extends keyof HTMLTag> = HTMLTag[T] & BaseLayoutProps<T>;
|
|
32
32
|
export type RowProps<T extends keyof HTMLTag> = HTMLTag[T] & BaseRowProps<T>;
|
|
33
33
|
export type ColumnProps<T extends keyof HTMLTag> = HTMLTag[T] & BaseColumnProps<T>;
|
|
34
|
-
|
|
34
|
+
declare function _Center<T extends keyof HTMLTag = 'div'>({ tag, className, ...props }: CenterProps<T>): import("react").ReactElement<{
|
|
35
35
|
style: Partial<import("react").CSSProperties>;
|
|
36
36
|
className: string;
|
|
37
37
|
}, string | import("react").JSXElementConstructor<any>>;
|
|
38
|
-
|
|
38
|
+
declare function _Row<T extends keyof HTMLTag = 'div'>({ tag, className, center, ...props }: RowProps<T>): import("react").ReactElement<{
|
|
39
39
|
style: Partial<import("react").CSSProperties>;
|
|
40
40
|
className: string;
|
|
41
41
|
}, string | import("react").JSXElementConstructor<any>>;
|
|
42
|
-
|
|
42
|
+
declare function _Column<T extends keyof HTMLTag = 'div'>({ tag, className, center, ...props }: ColumnProps<T>): import("react").ReactElement<{
|
|
43
43
|
style: Partial<import("react").CSSProperties>;
|
|
44
44
|
className: string;
|
|
45
45
|
}, string | import("react").JSXElementConstructor<any>>;
|
|
46
|
+
export declare const Center: typeof _Center;
|
|
47
|
+
export declare const Row: typeof _Row;
|
|
48
|
+
export declare const Column: typeof _Column;
|
|
49
|
+
export {};
|
|
46
50
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/components/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/components/layout.tsx"],"names":[],"mappings":"AA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AAC,CAAC,SAAS,MAAM,OAAO,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;;;wDAErG;AAED,eAAO,MAAM,MAAM,gBAAmB,CAAA;AACtC,eAAO,MAAM,GAAG,aAAgB,CAAA;AAChC,eAAO,MAAM,MAAM,gBAAmB,CAAA"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme';
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { applyStyles } from '../utils/css.js';
|
|
4
|
+
import { withRef } from '../utils/react.js';
|
|
4
5
|
export const layout = {
|
|
5
6
|
center: 'center',
|
|
6
7
|
row: 'row',
|
|
7
8
|
column: 'column',
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
function _Center({ tag, className, ...props }) {
|
|
10
11
|
return createElement(tag || 'div', { className: listToClass(['center', className]), ...applyStyles(props) });
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
function _Row({ tag, className, center, ...props }) {
|
|
13
14
|
return createElement(tag || 'div', { className: listToClass(['row', center === false && 'no-center', className]), ...applyStyles(props) });
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
function _Column({ tag, className, center, ...props }) {
|
|
16
17
|
return createElement(tag || 'div', { className: listToClass(['column', center && 'center', className]), ...applyStyles(props) });
|
|
17
18
|
}
|
|
19
|
+
export const Center = withRef(_Center);
|
|
20
|
+
export const Row = withRef(_Row);
|
|
21
|
+
export const Column = withRef(_Column);
|
|
18
22
|
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/components/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EAAE,W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,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAClI,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AACtC,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAChC,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from './components/FieldGroup.js';
|
|
|
20
20
|
export * from './components/Form.js';
|
|
21
21
|
export * from './components/FormGroup.js';
|
|
22
22
|
export * from './components/IconBox.js';
|
|
23
|
+
export * from './components/ImageBox.js';
|
|
23
24
|
export * from './components/Input.js';
|
|
24
25
|
export * from './components/layout.js';
|
|
25
26
|
export * from './components/Link.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBA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5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC/C,cAAc,yBAAyB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from './components/FieldGroup.js';
|
|
|
20
20
|
export * from './components/Form.js';
|
|
21
21
|
export * from './components/FormGroup.js';
|
|
22
22
|
export * from './components/IconBox.js';
|
|
23
|
+
export * from './components/ImageBox.js';
|
|
23
24
|
export * from './components/Input.js';
|
|
24
25
|
export * from './components/layout.js';
|
|
25
26
|
export * from './components/Link.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBA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7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AAExC,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/utils/react.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/utils/react.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,MAAM,UAAU,OAAO,CAAoC,EAAK;IAC9D,OAAO,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC,CAAQ,CAAA;AACjE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react'
|
|
3
3
|
import { applyCSSVariable } from '../utils/css'
|
|
4
|
+
import { withRef } from '../utils/react'
|
|
4
5
|
import { CitricComponent } from './CitricComponent'
|
|
5
6
|
|
|
6
7
|
export interface BaseAccordionProps {
|
|
@@ -35,7 +36,7 @@ export interface BaseAccordionProps {
|
|
|
35
36
|
|
|
36
37
|
export type AccordionProps = Omit<React.JSX.IntrinsicElements['div'], 'onChange'> & BaseAccordionProps
|
|
37
38
|
|
|
38
|
-
export const Accordion = (
|
|
39
|
+
export const Accordion = withRef((
|
|
39
40
|
{ id, appearance, expanded, onChange, header, maxHeight = 300, className, style, children, ...props }: AccordionProps,
|
|
40
41
|
) => {
|
|
41
42
|
const [ariaHidden, setAriaHidden] = useState(!expanded)
|
|
@@ -70,4 +71,4 @@ export const Accordion = (
|
|
|
70
71
|
</section>
|
|
71
72
|
</CitricComponent>
|
|
72
73
|
)
|
|
73
|
-
}
|
|
74
|
+
})
|
package/src/components/Alert.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
|
+
import { withRef } from '../utils/react'
|
|
2
3
|
import { CitricComponent } from './CitricComponent'
|
|
3
4
|
|
|
4
5
|
export interface BaseAlertProps {
|
|
@@ -11,5 +12,5 @@ export interface BaseAlertProps {
|
|
|
11
12
|
|
|
12
13
|
export type AlertProps = React.JSX.IntrinsicElements['div'] & BaseAlertProps
|
|
13
14
|
|
|
14
|
-
export const Alert = ({ type, className, children, ...props }: AlertProps) =>
|
|
15
|
-
<CitricComponent tag="div" component="alert" className={listToClass([type, className])} {...props}>{children}</CitricComponent>
|
|
15
|
+
export const Alert = withRef(({ type, className, children, ...props }: AlertProps) =>
|
|
16
|
+
<CitricComponent tag="div" component="alert" className={listToClass([type, className])} {...props}>{children}</CitricComponent>)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject, useEffect, useLayoutEffect } from 'react'
|
|
2
2
|
import { useCitricController } from '../context/hooks'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { ErrorMessage } from './ErrorMessage'
|
|
4
5
|
import { LoadingPanel } from './LoadingPanel'
|
|
5
6
|
|
|
@@ -31,7 +32,7 @@ interface Props {
|
|
|
31
32
|
* @param options the props for rendering the component: {@link Props}.
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
|
-
export const AsyncContent = ({ loading, error, autofocus, children }: Props) => {
|
|
35
|
+
export const AsyncContent = withRef(({ loading, error, autofocus, children }: Props) => {
|
|
35
36
|
const citric = useCitricController()
|
|
36
37
|
|
|
37
38
|
useEffect(() => {
|
|
@@ -51,4 +52,4 @@ export const AsyncContent = ({ loading, error, autofocus, children }: Props) =>
|
|
|
51
52
|
if (loading) return <LoadingPanel />
|
|
52
53
|
if (error) return citric?.renderError ? citric.renderError(error) : <ErrorMessage error={error} />
|
|
53
54
|
return children
|
|
54
|
-
}
|
|
55
|
+
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { WithColorPalette } from '../types'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { CitricComponent } from './CitricComponent'
|
|
4
5
|
|
|
5
6
|
export interface BaseAvatarProps extends WithColorPalette {
|
|
@@ -23,7 +24,7 @@ export interface BaseAvatarProps extends WithColorPalette {
|
|
|
23
24
|
|
|
24
25
|
export type AvatarProps = React.JSX.IntrinsicElements['div'] & BaseAvatarProps
|
|
25
26
|
|
|
26
|
-
export const Avatar = ({ size, name, appearance, className, image, ...props }: AvatarProps) => {
|
|
27
|
+
export const Avatar = withRef(({ size, name, appearance, className, image, ...props }: AvatarProps) => {
|
|
27
28
|
const parts = name?.split(' ') ?? ['']
|
|
28
29
|
const acronym = parts.length >= 2 ? `${parts[0][0]}${parts[1][0]}` : parts[0][0]
|
|
29
30
|
return (
|
|
@@ -31,4 +32,4 @@ export const Avatar = ({ size, name, appearance, className, image, ...props }: A
|
|
|
31
32
|
{image ? <img src={image} /> : acronym}
|
|
32
33
|
</CitricComponent>
|
|
33
34
|
)
|
|
34
|
-
}
|
|
35
|
+
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { WithColorPalette } from '../types'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { Avatar } from './Avatar'
|
|
4
5
|
import { CitricComponent } from './CitricComponent'
|
|
5
6
|
|
|
@@ -24,7 +25,7 @@ export interface BaseAvatarGroupProps extends WithColorPalette {
|
|
|
24
25
|
|
|
25
26
|
export type AvatarGroupProps = React.JSX.IntrinsicElements['div'] & BaseAvatarGroupProps
|
|
26
27
|
|
|
27
|
-
export const AvatarGroup = ({ size, items, appearance, maxItems, className, ...props }: AvatarGroupProps) => {
|
|
28
|
+
export const AvatarGroup = withRef(({ size, items, appearance, maxItems, className, ...props }: AvatarGroupProps) => {
|
|
28
29
|
const avatars = items.map(({ name, image }) => <Avatar key={name} name={name} image={image} />, [items])
|
|
29
30
|
return (
|
|
30
31
|
<CitricComponent
|
|
@@ -37,4 +38,4 @@ export const AvatarGroup = ({ size, items, appearance, maxItems, className, ...p
|
|
|
37
38
|
{avatars}
|
|
38
39
|
</CitricComponent>
|
|
39
40
|
)
|
|
40
|
-
}
|
|
41
|
+
})
|
package/src/components/Badge.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { HTMLTag, WithColorPalette } from '../types'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { CitricComponent } from './CitricComponent'
|
|
4
5
|
|
|
5
6
|
type ValidTags = 'a' | 'button' | 'li' | 'div' | 'span'
|
|
@@ -19,10 +20,12 @@ export interface BaseBadgeProps<T extends ValidTags = ValidTags> extends WithCol
|
|
|
19
20
|
|
|
20
21
|
export type BadgeProps<T extends ValidTags> = HTMLTag[T] & BaseBadgeProps<T>
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
function _Badge<T extends ValidTags>({ tag, appearance, className, children, ...props }: BadgeProps<T>) {
|
|
23
24
|
return (
|
|
24
25
|
<CitricComponent tag={tag || 'div'} component="badge" className={listToClass([appearance, className])} {...props as any}>
|
|
25
26
|
{children}
|
|
26
27
|
</CitricComponent>
|
|
27
28
|
)
|
|
28
29
|
}
|
|
30
|
+
|
|
31
|
+
export const Badge = withRef(_Badge)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { WithColorPalette, WithColorScheme } from '../types'
|
|
2
|
+
import { withRef } from '../utils/react'
|
|
2
3
|
import { CitricComponent } from './CitricComponent'
|
|
3
4
|
|
|
4
5
|
export type BaseBlockquoteProps = WithColorScheme & WithColorPalette
|
|
5
6
|
|
|
6
7
|
export type BlockquoteProps = React.JSX.IntrinsicElements['blockquote'] & BaseBlockquoteProps
|
|
7
8
|
|
|
8
|
-
export const Blockquote = ({ children, ...props }: BlockquoteProps) =>
|
|
9
|
-
<CitricComponent tag="blockquote" component="blockquote" {...props}>{children}</CitricComponent>
|
|
9
|
+
export const Blockquote = withRef(({ children, ...props }: BlockquoteProps) =>
|
|
10
|
+
<CitricComponent tag="blockquote" component="blockquote" {...props}>{children}</CitricComponent>)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
|
+
import { withRef } from '../utils/react'
|
|
2
3
|
import { CitricComponent } from './CitricComponent'
|
|
3
4
|
|
|
4
5
|
interface BreadCrumbItem {
|
|
@@ -12,7 +13,7 @@ export interface BaseBreadcrumbProps {
|
|
|
12
13
|
|
|
13
14
|
export type BreadcrumbProps = React.JSX.IntrinsicElements['nav'] & BaseBreadcrumbProps
|
|
14
15
|
|
|
15
|
-
export const Breadcrumb = ({ items, ...props }: BreadcrumbProps) => {
|
|
16
|
+
export const Breadcrumb = withRef(({ items, ...props }: BreadcrumbProps) => {
|
|
16
17
|
const children = useMemo(
|
|
17
18
|
() => items.map(
|
|
18
19
|
(item, index) => item.href ? <li key={index}><a href={item.href}>{item.label}</a></li> : <li key={index}>{item.label}</li>,
|
|
@@ -20,4 +21,4 @@ export const Breadcrumb = ({ items, ...props }: BreadcrumbProps) => {
|
|
|
20
21
|
[items],
|
|
21
22
|
)
|
|
22
23
|
return <CitricComponent tag="nav" component="breadcrumb" {...props}><ul>{children}</ul></CitricComponent>
|
|
23
|
-
}
|
|
24
|
+
})
|
|
@@ -2,6 +2,7 @@ import { listToClass } from '@stack-spot/portal-theme'
|
|
|
2
2
|
import { useState } from 'react'
|
|
3
3
|
import { useCitricController } from '../context/hooks'
|
|
4
4
|
import { WithColorScheme } from '../types'
|
|
5
|
+
import { withRef } from '../utils/react'
|
|
5
6
|
import { CitricComponent } from './CitricComponent'
|
|
6
7
|
import { ProgressCircular } from './ProgressCircular'
|
|
7
8
|
|
|
@@ -46,7 +47,7 @@ export interface BaseButtonProps extends WithColorScheme {
|
|
|
46
47
|
|
|
47
48
|
export type ButtonProps = Omit<React.JSX.IntrinsicElements['button'], 'onClick'> & BaseButtonProps
|
|
48
49
|
|
|
49
|
-
export const Button = (
|
|
50
|
+
export const Button = withRef((
|
|
50
51
|
{ appearance, size, feedback, loading, disabled, onClick, className, children, type = 'button', analytics, ...props }: ButtonProps,
|
|
51
52
|
) => {
|
|
52
53
|
const citric = useCitricController()
|
|
@@ -85,4 +86,4 @@ export const Button = (
|
|
|
85
86
|
)}
|
|
86
87
|
</CitricComponent>
|
|
87
88
|
)
|
|
88
|
-
}
|
|
89
|
+
})
|
package/src/components/Card.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { WithColorScheme } from '../types'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { CitricComponent } from './CitricComponent'
|
|
4
5
|
|
|
5
6
|
export interface BaseCardProps extends WithColorScheme {
|
|
@@ -26,7 +27,7 @@ export interface BaseCardProps extends WithColorScheme {
|
|
|
26
27
|
|
|
27
28
|
export type CardProps = React.JSX.IntrinsicElements['div'] & BaseCardProps
|
|
28
29
|
|
|
29
|
-
export const Card = ({ tag = 'div', onClick, size, bgLevel, className, children, ...props }: CardProps) => (
|
|
30
|
+
export const Card = withRef(({ tag = 'div', onClick, size, bgLevel, className, children, ...props }: CardProps) => (
|
|
30
31
|
<CitricComponent
|
|
31
32
|
tag={tag}
|
|
32
33
|
component="card"
|
|
@@ -35,4 +36,4 @@ export const Card = ({ tag = 'div', onClick, size, bgLevel, className, children,
|
|
|
35
36
|
>
|
|
36
37
|
{children}
|
|
37
38
|
</CitricComponent>
|
|
38
|
-
)
|
|
39
|
+
))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ControlledInput, WithColorScheme } from '../types'
|
|
2
|
+
import { withRef } from '../utils/react'
|
|
2
3
|
import { CitricComponent } from './CitricComponent'
|
|
3
4
|
|
|
4
5
|
export interface BaseCheckboxProps extends WithColorScheme {
|
|
@@ -14,7 +15,7 @@ export interface BaseCheckboxProps extends WithColorScheme {
|
|
|
14
15
|
|
|
15
16
|
export type CheckboxProps = ControlledInput & BaseCheckboxProps
|
|
16
17
|
|
|
17
|
-
export const Checkbox = (
|
|
18
|
+
export const Checkbox = withRef((
|
|
18
19
|
{ appearance = 'checkbox', value, onChange, colorScheme, children, className, style, ...props }: CheckboxProps,
|
|
19
20
|
) => {
|
|
20
21
|
const handleChange = onChange ? () => onChange(!value) : undefined
|
|
@@ -33,4 +34,4 @@ export const Checkbox = (
|
|
|
33
34
|
style={style}
|
|
34
35
|
{...props}
|
|
35
36
|
/>
|
|
36
|
-
}
|
|
37
|
+
})
|
|
@@ -2,6 +2,7 @@ import { isNil } from 'lodash'
|
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
import { WithColorScheme } from '../types'
|
|
4
4
|
import { defaultRenderKey, defaultRenderLabel } from '../utils/options'
|
|
5
|
+
import { withRef } from '../utils/react'
|
|
5
6
|
import { CitricComponent } from './CitricComponent'
|
|
6
7
|
import { Column } from './layout'
|
|
7
8
|
|
|
@@ -57,7 +58,7 @@ export interface BaseCheckboxGroupProps<T = any> extends WithColorScheme {
|
|
|
57
58
|
|
|
58
59
|
export type CheckboxGroupProps<T> = Omit<React.JSX.IntrinsicElements['div'], 'onChange' | 'children'> & BaseCheckboxGroupProps<T>
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
function _CheckboxGroup<T>({
|
|
61
62
|
appearance = 'checkbox',
|
|
62
63
|
name,
|
|
63
64
|
value = [],
|
|
@@ -91,3 +92,5 @@ export function CheckboxGroup<T>({
|
|
|
91
92
|
}, [options, value, name, colorScheme, appearance])
|
|
92
93
|
return <Column {...props} style={{ gap: '8px', ...style }}>{items}</Column>
|
|
93
94
|
}
|
|
95
|
+
|
|
96
|
+
export const CheckboxGroup = withRef(_CheckboxGroup)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { WithColorPalette, WithColorScheme } from '../types'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { CitricComponent } from './CitricComponent'
|
|
4
5
|
|
|
5
6
|
export interface BaseCircleProps extends WithColorPalette, WithColorScheme {
|
|
@@ -19,8 +20,8 @@ export interface BaseCircleProps extends WithColorPalette, WithColorScheme {
|
|
|
19
20
|
|
|
20
21
|
export type CircleProps = React.JSX.IntrinsicElements['div'] & BaseCircleProps
|
|
21
22
|
|
|
22
|
-
export const Circle = ({ showBorders, className, size, children, ...props }: CircleProps) => (
|
|
23
|
+
export const Circle = withRef(({ showBorders, className, size, children, ...props }: CircleProps) => (
|
|
23
24
|
<CitricComponent tag="div" component="circle" className={listToClass([className, showBorders && 'bordered', size])} {...props}>
|
|
24
25
|
{children}
|
|
25
26
|
</CitricComponent>
|
|
26
|
-
)
|
|
27
|
+
))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { WithColorScheme } from '../types'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { CitricComponent } from './CitricComponent'
|
|
4
5
|
|
|
5
6
|
export interface BaseDividerProps extends WithColorScheme {
|
|
@@ -15,8 +16,8 @@ export interface BaseDividerProps extends WithColorScheme {
|
|
|
15
16
|
|
|
16
17
|
export type DividerProps = React.JSX.IntrinsicElements['hr'] & BaseDividerProps
|
|
17
18
|
|
|
18
|
-
export const Divider = ({ size, direction, className, children, ...props }: DividerProps) => (
|
|
19
|
+
export const Divider = withRef(({ size, direction, className, children, ...props }: DividerProps) => (
|
|
19
20
|
<CitricComponent tag="hr" component="divider" className={listToClass([className, size, direction])} {...props}>
|
|
20
21
|
{children}
|
|
21
22
|
</CitricComponent>
|
|
22
|
-
)
|
|
23
|
+
))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { ControlledInput } from '../types'
|
|
3
|
+
import { withRef } from '../utils/react'
|
|
3
4
|
import { CitricComponent } from './CitricComponent'
|
|
4
5
|
|
|
5
6
|
type FavoriteAppearance = 'square' | 'circle' | 'text'
|
|
@@ -27,9 +28,9 @@ export interface BaseFavoriteProps {
|
|
|
27
28
|
loading?: boolean,
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export type FavoriteProps = ControlledInput & BaseFavoriteProps
|
|
31
|
+
export type FavoriteProps = Omit<ControlledInput, 'size'> & BaseFavoriteProps
|
|
31
32
|
|
|
32
|
-
export const Favorite = ({ value, size, appearance, onChange, loading, disabled, className, ...props }: FavoriteProps) =>
|
|
33
|
+
export const Favorite = withRef(({ value, size, appearance, onChange, loading, disabled, className, ...props }: FavoriteProps) =>
|
|
33
34
|
<CitricComponent
|
|
34
35
|
tag="input"
|
|
35
36
|
type="checkbox"
|
|
@@ -40,4 +41,5 @@ export const Favorite = ({ value, size, appearance, onChange, loading, disabled,
|
|
|
40
41
|
aria-busy={loading}
|
|
41
42
|
disabled={loading || disabled}
|
|
42
43
|
{...props}
|
|
43
|
-
|
|
44
|
+
/>,
|
|
45
|
+
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
|
+
import { withRef } from '../utils/react'
|
|
2
3
|
import { CitricComponent } from './CitricComponent'
|
|
3
4
|
|
|
4
5
|
export interface BaseFieldGroupProps {
|
|
@@ -14,8 +15,8 @@ export interface BaseFieldGroupProps {
|
|
|
14
15
|
|
|
15
16
|
export type FieldGroupProps = React.JSX.IntrinsicElements['div'] & BaseFieldGroupProps
|
|
16
17
|
|
|
17
|
-
export const FieldGroup = ({ auto = true, className, children, ...props }: FieldGroupProps) => (
|
|
18
|
+
export const FieldGroup = withRef(({ auto = true, className, children, ...props }: FieldGroupProps) => (
|
|
18
19
|
<CitricComponent tag="div" component="field-group" className={listToClass([className, auto && 'auto'])} {...props}>
|
|
19
20
|
{children}
|
|
20
21
|
</CitricComponent>
|
|
21
|
-
)
|
|
22
|
+
))
|
package/src/components/Form.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
|
+
import { withRef } from '../utils/react'
|
|
2
3
|
import { CitricComponent } from './CitricComponent'
|
|
3
4
|
|
|
4
5
|
export type FormProps = JSX.IntrinsicElements['form']
|
|
@@ -10,8 +11,8 @@ export const Form = ({ children, ...props }: FormProps) => (
|
|
|
10
11
|
</CitricComponent>
|
|
11
12
|
)
|
|
12
13
|
|
|
13
|
-
export const ButtonGroup = ({ className, children, ...props }: ButtonGroupProps) => (
|
|
14
|
+
export const ButtonGroup = withRef(({ className, children, ...props }: ButtonGroupProps) => (
|
|
14
15
|
<div className={listToClass([className, 'button-group'])} {...props}>
|
|
15
16
|
{children}
|
|
16
17
|
</div>
|
|
17
|
-
)
|
|
18
|
+
))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
|
+
import { withRef } from '../utils/react'
|
|
2
3
|
import { CitricComponent } from './CitricComponent'
|
|
3
4
|
import { IconButton } from './IconBox'
|
|
4
5
|
import { Text } from './Text'
|
|
@@ -25,7 +26,7 @@ export interface BaseFormGroupProps {
|
|
|
25
26
|
|
|
26
27
|
export type FormGroupProps = React.JSX.IntrinsicElements['div'] & BaseFormGroupProps
|
|
27
28
|
|
|
28
|
-
export const FormGroup = ({ error, help, label, warning, className, children, ...props }: FormGroupProps) => (
|
|
29
|
+
export const FormGroup = withRef(({ error, help, label, warning, className, children, ...props }: FormGroupProps) => (
|
|
29
30
|
<CitricComponent tag="div" component="form-group" className={listToClass([className, error && 'error'])} {...props}>
|
|
30
31
|
<label>
|
|
31
32
|
{help ? (
|
|
@@ -41,4 +42,4 @@ export const FormGroup = ({ error, help, label, warning, className, children, ..
|
|
|
41
42
|
{warning && <div className="warning">{warning}</div>}
|
|
42
43
|
</label>
|
|
43
44
|
</CitricComponent>
|
|
44
|
-
)
|
|
45
|
+
))
|
|
@@ -3,6 +3,7 @@ import { listToClass } from '@stack-spot/portal-theme'
|
|
|
3
3
|
import { useCallback } from 'react'
|
|
4
4
|
import { useCitricController } from '../context/hooks'
|
|
5
5
|
import { HTMLTag, WithColorPalette, WithColorScheme } from '../types'
|
|
6
|
+
import { withRef } from '../utils/react'
|
|
6
7
|
import { CitricComponent } from './CitricComponent'
|
|
7
8
|
|
|
8
9
|
type IconBoxTag = 'a' | 'button' | 'i' | 'span' | 'div'
|
|
@@ -45,8 +46,8 @@ export interface BaseIconBoxProps<T extends IconBoxTag, G extends IconGroup> ext
|
|
|
45
46
|
|
|
46
47
|
export type IconBoxProps<T extends IconBoxTag, G extends IconGroup> = Omit<HTMLTag[T], 'children'> & BaseIconBoxProps<T, G>
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
{ group, icon, tag,
|
|
49
|
+
function _IconBox<T extends IconBoxTag = 'i', G extends IconGroup = 'outline'>(
|
|
50
|
+
{ group, icon, tag, appearance, size, className, analytics, onClick, feedback, ...props }: IconBoxProps<T, G>,
|
|
50
51
|
) {
|
|
51
52
|
const citric = useCitricController()
|
|
52
53
|
|
|
@@ -60,8 +61,6 @@ export function IconBox<T extends IconBoxTag = 'i', G extends IconGroup = 'outli
|
|
|
60
61
|
tag={(tag || 'i') as any}
|
|
61
62
|
component="icon-box"
|
|
62
63
|
className={listToClass(['citric-icon', group || 'outline', icon, appearance, size, className])}
|
|
63
|
-
colorScheme={colorScheme}
|
|
64
|
-
colorPalette={colorPalette}
|
|
65
64
|
data-feedback={feedback || undefined}
|
|
66
65
|
onClick={['button', 'a'].includes(tag ?? '') ? handleClick : onClick}
|
|
67
66
|
{...props}
|
|
@@ -71,13 +70,17 @@ export function IconBox<T extends IconBoxTag = 'i', G extends IconGroup = 'outli
|
|
|
71
70
|
/**
|
|
72
71
|
* Shortcut to `<IconBox tag="button" />`
|
|
73
72
|
*/
|
|
74
|
-
|
|
75
|
-
return IconBox
|
|
73
|
+
function _IconButton<G extends IconGroup = 'outline'>({ type, ...props }: Omit<IconBoxProps<'button', G>, 'tag'>) {
|
|
74
|
+
return <IconBox {...props} tag="button" type={type || 'button' } />
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
/**
|
|
79
78
|
* Shortcut to `<IconBox tag="a" />`
|
|
80
79
|
*/
|
|
81
|
-
|
|
82
|
-
return IconBox
|
|
80
|
+
function _IconLink<G extends IconGroup = 'outline'>(props: Omit<IconBoxProps<'a', G>, 'tag'>) {
|
|
81
|
+
return <IconBox {...props} tag="a" />
|
|
83
82
|
}
|
|
83
|
+
|
|
84
|
+
export const IconBox = withRef(_IconBox)
|
|
85
|
+
export const IconButton = withRef(_IconButton)
|
|
86
|
+
export const IconLink = withRef(_IconLink)
|