@stack-spot/citric-react 0.21.0 → 0.23.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 +30 -4
- package/dist/components/Accordion.d.ts +34 -0
- package/dist/components/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion.js +34 -0
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Alert.d.ts +8 -0
- package/dist/components/Alert.d.ts.map +1 -1
- package/dist/components/Alert.js +8 -0
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/AsyncContent.d.ts +18 -4
- package/dist/components/AsyncContent.d.ts.map +1 -1
- package/dist/components/AsyncContent.js +18 -4
- package/dist/components/AsyncContent.js.map +1 -1
- package/dist/components/Avatar.d.ts +9 -0
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +11 -1
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/AvatarGroup.d.ts +8 -0
- package/dist/components/AvatarGroup.d.ts.map +1 -1
- package/dist/components/AvatarGroup.js +8 -0
- package/dist/components/AvatarGroup.js.map +1 -1
- package/dist/components/Badge.d.ts +13 -2
- package/dist/components/Badge.d.ts.map +1 -1
- package/dist/components/Badge.js +14 -3
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Blockquote.d.ts +8 -0
- package/dist/components/Blockquote.d.ts.map +1 -1
- package/dist/components/Blockquote.js +8 -0
- package/dist/components/Blockquote.js.map +1 -1
- package/dist/components/Breadcrumb.d.ts +8 -0
- package/dist/components/Breadcrumb.d.ts.map +1 -1
- package/dist/components/Breadcrumb.js +10 -1
- package/dist/components/Breadcrumb.js.map +1 -1
- package/dist/components/Button.d.ts +11 -0
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +14 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts +15 -4
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +13 -1
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Checkbox.d.ts +14 -0
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +14 -0
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/CheckboxGroup.d.ts +22 -3
- package/dist/components/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/CheckboxGroup.js +23 -3
- package/dist/components/CheckboxGroup.js.map +1 -1
- package/dist/components/Circle.d.ts +16 -0
- package/dist/components/Circle.d.ts.map +1 -1
- package/dist/components/Circle.js +8 -0
- package/dist/components/Circle.js.map +1 -1
- package/dist/components/CitricComponent.d.ts +14 -0
- package/dist/components/CitricComponent.d.ts.map +1 -1
- package/dist/components/CitricComponent.js +14 -0
- package/dist/components/CitricComponent.js.map +1 -1
- package/dist/components/Divider.d.ts +4 -1
- package/dist/components/Divider.d.ts.map +1 -1
- package/dist/components/Divider.js +4 -1
- package/dist/components/Divider.js.map +1 -1
- package/dist/components/ErrorBoundary.d.ts +13 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/ErrorBoundary.js +13 -0
- package/dist/components/ErrorBoundary.js.map +1 -1
- package/dist/components/ErrorMessage.js +1 -1
- package/dist/components/ErrorMessage.js.map +1 -1
- package/dist/components/FallbackBoundary.d.ts +12 -1
- package/dist/components/FallbackBoundary.d.ts.map +1 -1
- package/dist/components/FallbackBoundary.js +12 -1
- package/dist/components/FallbackBoundary.js.map +1 -1
- package/dist/components/Favorite.d.ts +12 -0
- package/dist/components/Favorite.d.ts.map +1 -1
- package/dist/components/Favorite.js +12 -0
- package/dist/components/Favorite.js.map +1 -1
- package/dist/components/FieldGroup.d.ts +13 -0
- package/dist/components/FieldGroup.d.ts.map +1 -1
- package/dist/components/FieldGroup.js +13 -0
- package/dist/components/FieldGroup.js.map +1 -1
- package/dist/components/Form.d.ts +18 -0
- package/dist/components/Form.d.ts.map +1 -1
- package/dist/components/Form.js +18 -0
- package/dist/components/Form.js.map +1 -1
- package/dist/components/FormGroup.d.ts +12 -0
- package/dist/components/FormGroup.d.ts.map +1 -1
- package/dist/components/FormGroup.js +12 -0
- package/dist/components/FormGroup.js.map +1 -1
- package/dist/components/IconBox.d.ts +34 -9
- package/dist/components/IconBox.d.ts.map +1 -1
- package/dist/components/IconBox.js +37 -11
- package/dist/components/IconBox.js.map +1 -1
- package/dist/components/ImageBox.d.ts +32 -8
- package/dist/components/ImageBox.d.ts.map +1 -1
- package/dist/components/ImageBox.js +36 -11
- package/dist/components/ImageBox.js.map +1 -1
- package/dist/components/ImageWithFallback.d.ts +18 -0
- package/dist/components/ImageWithFallback.d.ts.map +1 -1
- package/dist/components/ImageWithFallback.js +11 -0
- package/dist/components/ImageWithFallback.js.map +1 -1
- package/dist/components/Input.d.ts +15 -3
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +16 -3
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Link.d.ts +6 -0
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +6 -0
- package/dist/components/Link.js.map +1 -1
- package/dist/components/MenuOverlay/index.d.ts +20 -0
- package/dist/components/MenuOverlay/index.d.ts.map +1 -1
- package/dist/components/MenuOverlay/index.js +20 -0
- package/dist/components/MenuOverlay/index.js.map +1 -1
- package/dist/components/Overlay/index.d.ts +16 -0
- package/dist/components/Overlay/index.d.ts.map +1 -1
- package/dist/components/Overlay/index.js +16 -0
- package/dist/components/Overlay/index.js.map +1 -1
- package/dist/components/Pagination.d.ts +27 -8
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +18 -5
- package/dist/components/Pagination.js.map +1 -1
- package/dist/components/ProgressBar.d.ts +19 -1
- package/dist/components/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar.js +15 -1
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/components/ProgressCircular.d.ts +14 -0
- package/dist/components/ProgressCircular.d.ts.map +1 -1
- package/dist/components/ProgressCircular.js +14 -0
- package/dist/components/ProgressCircular.js.map +1 -1
- package/dist/components/RadioGroup.d.ts +24 -3
- package/dist/components/RadioGroup.d.ts.map +1 -1
- package/dist/components/RadioGroup.js +25 -3
- package/dist/components/RadioGroup.js.map +1 -1
- package/dist/components/Rating.d.ts +10 -0
- package/dist/components/Rating.d.ts.map +1 -1
- package/dist/components/Rating.js +10 -0
- package/dist/components/Rating.js.map +1 -1
- package/dist/components/Select/RichSelect.d.ts +3 -5
- package/dist/components/Select/RichSelect.d.ts.map +1 -1
- package/dist/components/Select/RichSelect.js +4 -4
- package/dist/components/Select/RichSelect.js.map +1 -1
- package/dist/components/Select/SimpleSelect.d.ts +2 -3
- package/dist/components/Select/SimpleSelect.d.ts.map +1 -1
- package/dist/components/Select/SimpleSelect.js +2 -3
- package/dist/components/Select/SimpleSelect.js.map +1 -1
- package/dist/components/Select/index.d.ts +25 -2
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +26 -3
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/types.d.ts +1 -2
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/SelectBox.d.ts +31 -2
- package/dist/components/SelectBox.d.ts.map +1 -1
- package/dist/components/SelectBox.js +32 -3
- package/dist/components/SelectBox.js.map +1 -1
- package/dist/components/Skeleton.d.ts +11 -0
- package/dist/components/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton.js +11 -0
- package/dist/components/Skeleton.js.map +1 -1
- package/dist/components/Slider.d.ts +12 -0
- package/dist/components/Slider.d.ts.map +1 -1
- package/dist/components/Slider.js +12 -0
- package/dist/components/Slider.js.map +1 -1
- package/dist/components/SmartTable.d.ts +36 -2
- package/dist/components/SmartTable.d.ts.map +1 -1
- package/dist/components/SmartTable.js +37 -3
- package/dist/components/SmartTable.js.map +1 -1
- package/dist/components/Stepper.d.ts +20 -3
- package/dist/components/Stepper.d.ts.map +1 -1
- package/dist/components/Stepper.js +21 -3
- package/dist/components/Stepper.js.map +1 -1
- package/dist/components/Table.d.ts +10 -0
- package/dist/components/Table.d.ts.map +1 -1
- package/dist/components/Table.js +10 -0
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Tabs/TabController.d.ts +14 -0
- package/dist/components/Tabs/TabController.d.ts.map +1 -1
- package/dist/components/Tabs/TabController.js +14 -0
- package/dist/components/Tabs/TabController.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +20 -3
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +23 -4
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/types.d.ts +6 -0
- package/dist/components/Tabs/types.d.ts.map +1 -1
- package/dist/components/Text.d.ts +16 -2
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +17 -3
- package/dist/components/Text.js.map +1 -1
- package/dist/components/Textarea.d.ts +11 -1
- package/dist/components/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea.js +12 -2
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/Tooltip.d.ts +14 -1
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip.js +13 -0
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/layout.d.ts +41 -7
- package/dist/components/layout.d.ts.map +1 -1
- package/dist/components/layout.js +44 -9
- package/dist/components/layout.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Accordion.tsx +34 -0
- package/src/components/Alert.tsx +8 -0
- package/src/components/AsyncContent.tsx +18 -4
- package/src/components/Avatar.tsx +11 -1
- package/src/components/AvatarGroup.tsx +8 -0
- package/src/components/Badge.tsx +24 -8
- package/src/components/Blockquote.tsx +8 -0
- package/src/components/Breadcrumb.tsx +10 -1
- package/src/components/Button.tsx +17 -2
- package/src/components/Card.tsx +34 -14
- package/src/components/Checkbox.tsx +14 -0
- package/src/components/CheckboxGroup.tsx +61 -40
- package/src/components/Circle.tsx +16 -0
- package/src/components/CitricComponent.ts +14 -0
- package/src/components/Divider.tsx +6 -5
- package/src/components/ErrorBoundary.tsx +13 -0
- package/src/components/ErrorMessage.tsx +1 -1
- package/src/components/FallbackBoundary.tsx +12 -1
- package/src/components/Favorite.tsx +12 -0
- package/src/components/FieldGroup.tsx +13 -0
- package/src/components/Form.tsx +18 -0
- package/src/components/FormGroup.tsx +12 -0
- package/src/components/IconBox.tsx +62 -31
- package/src/components/ImageBox.tsx +60 -30
- package/src/components/ImageWithFallback.tsx +18 -0
- package/src/components/Input.tsx +28 -14
- package/src/components/Link.tsx +6 -0
- package/src/components/MenuOverlay/index.tsx +20 -0
- package/src/components/Overlay/index.tsx +17 -0
- package/src/components/Pagination.tsx +40 -17
- package/src/components/ProgressBar.tsx +20 -2
- package/src/components/ProgressCircular.tsx +14 -0
- package/src/components/RadioGroup.tsx +62 -39
- package/src/components/Rating.tsx +10 -0
- package/src/components/Select/RichSelect.tsx +183 -182
- package/src/components/Select/SimpleSelect.tsx +57 -57
- package/src/components/Select/index.tsx +29 -5
- package/src/components/Select/types.ts +1 -1
- package/src/components/SelectBox.tsx +92 -62
- package/src/components/Skeleton.tsx +11 -0
- package/src/components/Slider.tsx +12 -0
- package/src/components/SmartTable.tsx +91 -56
- package/src/components/Stepper.tsx +76 -57
- package/src/components/Table.tsx +10 -0
- package/src/components/Tabs/TabController.ts +14 -0
- package/src/components/Tabs/index.tsx +57 -37
- package/src/components/Tabs/types.ts +6 -0
- package/src/components/Text.ts +36 -21
- package/src/components/Textarea.tsx +14 -4
- package/src/components/Tooltip.tsx +14 -1
- package/src/components/layout.tsx +56 -13
- package/src/index.ts +0 -1
- package/dist/components/Switch.d.ts +0 -10
- package/dist/components/Switch.d.ts.map +0 -1
- package/dist/components/Switch.js +0 -8
- package/dist/components/Switch.js.map +0 -1
- package/src/components/Switch.tsx +0 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../src/components/FieldGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAqBnD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE,CAAC,CAChH,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,aAAa,EACvB,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,IAAI,IAAI,MAAM,EAAE,SAAS,IAAI,YAAY,CAAC,CAAC,KAC1E,KAAK,YAER,QAAQ,GACO,CACnB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../src/components/FieldGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAqBnD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE,CAAC,CAChH,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,aAAa,EACvB,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,IAAI,IAAI,MAAM,EAAE,SAAS,IAAI,YAAY,CAAC,CAAC,KAC1E,KAAK,YAER,QAAQ,GACO,CACnB,CAAC,CAAA"}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
export type FormProps = JSX.IntrinsicElements['form'];
|
|
2
2
|
export type ButtonGroupProps = JSX.IntrinsicElements['div'];
|
|
3
|
+
/**
|
|
4
|
+
* A form, styled to receive rows, form groups and button groups.
|
|
5
|
+
*
|
|
6
|
+
* This has the exact same interface as the HTML form.
|
|
7
|
+
*/
|
|
3
8
|
export declare const Form: ({ children, ...props }: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Renders a group of buttons in a form.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* <Form>
|
|
15
|
+
* <ButtonGroup>
|
|
16
|
+
* <Button>Cancel</Button>
|
|
17
|
+
* <Button type="submit">Submit</Button>
|
|
18
|
+
* </ButtonGroup>
|
|
19
|
+
* </Form>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
4
22
|
export declare const ButtonGroup: ({ className, children, ...props }: ButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
23
|
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACrD,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAE3D,eAAO,MAAM,IAAI,GAAI,wBAAwB,SAAS,4CAIrD,CAAA;AAED,eAAO,MAAM,WAAW,sCAA+C,gBAAgB,4CAIrF,CAAA"}
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACrD,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAE3D;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,wBAAwB,SAAS,4CAIrD,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,sCAA+C,gBAAgB,4CAIrF,CAAA"}
|
package/dist/components/Form.js
CHANGED
|
@@ -2,6 +2,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { listToClass } from '@stack-spot/portal-theme';
|
|
3
3
|
import { withRef } from '../utils/react.js';
|
|
4
4
|
import { CitricComponent } from './CitricComponent.js';
|
|
5
|
+
/**
|
|
6
|
+
* A form, styled to receive rows, form groups and button groups.
|
|
7
|
+
*
|
|
8
|
+
* This has the exact same interface as the HTML form.
|
|
9
|
+
*/
|
|
5
10
|
export const Form = ({ children, ...props }) => (_jsx(CitricComponent, { tag: "form", component: "form", ...props, children: children }));
|
|
11
|
+
/**
|
|
12
|
+
* Renders a group of buttons in a form.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```
|
|
16
|
+
* <Form>
|
|
17
|
+
* <ButtonGroup>
|
|
18
|
+
* <Button>Cancel</Button>
|
|
19
|
+
* <Button type="submit">Submit</Button>
|
|
20
|
+
* </ButtonGroup>
|
|
21
|
+
* </Form>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
6
24
|
export const ButtonGroup = withRef(({ className, children, ...props }) => (_jsx("div", { className: listToClass([className, 'button-group']), ...props, children: children })));
|
|
7
25
|
//# sourceMappingURL=Form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAKnD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE,CAAC,CACzD,KAAC,eAAe,IAAC,GAAG,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,KAAK,KAAK,YACnD,QAAQ,GACO,CACnB,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE,CAAC,CAC1F,cAAK,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,KAAM,KAAK,YAChE,QAAQ,GACL,CACP,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAKnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE,CAAC,CACzD,KAAC,eAAe,IAAC,GAAG,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,KAAK,KAAK,YACnD,QAAQ,GACO,CACnB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE,CAAC,CAC1F,cAAK,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,KAAM,KAAK,YAChE,QAAQ,GACL,CACP,CAAC,CAAA"}
|
|
@@ -17,5 +17,17 @@ export interface BaseFormGroupProps {
|
|
|
17
17
|
warning?: string;
|
|
18
18
|
}
|
|
19
19
|
export type FormGroupProps = React.JSX.IntrinsicElements['div'] & BaseFormGroupProps;
|
|
20
|
+
/**
|
|
21
|
+
* A form group renders everything a field in a form needs: the input, its label, a tooltip (help), an error and a remark (warning).
|
|
22
|
+
*
|
|
23
|
+
* Labels, errors, tooltips and warnings are only rendered when they're strings with at least one character.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```
|
|
27
|
+
* <FormGroup label="Birth Date" help="The date when you were born" error="The date you typed is invalid!">
|
|
28
|
+
* <Input type="date" />
|
|
29
|
+
* </FormGroup>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
20
32
|
export declare const FormGroup: ({ error, help, label, warning, className, children, ...props }: FormGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
33
|
//# sourceMappingURL=FormGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormGroup.d.ts","sourceRoot":"","sources":["../../src/components/FormGroup.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,kBAAkB,CAAA;AAEpF,eAAO,MAAM,SAAS,mEAA4E,cAAc,4CAgB9G,CAAA"}
|
|
1
|
+
{"version":3,"file":"FormGroup.d.ts","sourceRoot":"","sources":["../../src/components/FormGroup.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,kBAAkB,CAAA;AAEpF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,mEAA4E,cAAc,4CAgB9G,CAAA"}
|
|
@@ -5,5 +5,17 @@ import { CitricComponent } from './CitricComponent.js';
|
|
|
5
5
|
import { IconButton } from './IconBox.js';
|
|
6
6
|
import { Text } from './Text.js';
|
|
7
7
|
import { Tooltip } from './Tooltip.js';
|
|
8
|
+
/**
|
|
9
|
+
* A form group renders everything a field in a form needs: the input, its label, a tooltip (help), an error and a remark (warning).
|
|
10
|
+
*
|
|
11
|
+
* Labels, errors, tooltips and warnings are only rendered when they're strings with at least one character.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```
|
|
15
|
+
* <FormGroup label="Birth Date" help="The date when you were born" error="The date you typed is invalid!">
|
|
16
|
+
* <Input type="date" />
|
|
17
|
+
* </FormGroup>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
8
20
|
export const FormGroup = withRef(({ error, help, label, warning, className, children, ...props }) => (_jsx(CitricComponent, { tag: "div", component: "form-group", className: listToClass([className, error && 'error']), ...props, children: _jsxs("label", { children: [help ? (_jsxs("div", { className: "row", children: [_jsx(Text, { children: label }), _jsx(Tooltip, { content: help, children: _jsx(IconButton, { icon: "InfoCircle", size: "xs" }) })] })) : label, children, _jsx("div", { className: "feedback", children: error }), warning && _jsx("div", { className: "warning", children: warning })] }) })));
|
|
9
21
|
//# sourceMappingURL=FormGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormGroup.js","sourceRoot":"","sources":["../../src/components/FormGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB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OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAuBnC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAkB,EAAE,EAAE,CAAC,CACnH,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,YAAY,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,KAAK,IAAI,OAAO,CAAC,CAAC,KAAM,KAAK,YAChH,4BACG,IAAI,CAAC,CAAC,CAAC,CACN,eAAK,SAAS,EAAC,KAAK,aAClB,KAAC,IAAI,cAAE,KAAK,GAAQ,EACpB,KAAC,OAAO,IAAC,OAAO,EAAE,IAAI,YACpB,KAAC,UAAU,IAAC,IAAI,EAAC,YAAY,EAAC,IAAI,EAAC,IAAI,GAAG,GAClC,IACN,CACP,CAAA,CAAC,CAAC,KAAK,EACP,QAAQ,EACT,cAAK,SAAS,EAAC,UAAU,YAAE,KAAK,GAAO,EACtC,OAAO,IAAI,cAAK,SAAS,EAAC,SAAS,YAAE,OAAO,GAAO,IAC9C,GACQ,CACnB,CAAC,CAAA"}
|
|
@@ -17,7 +17,7 @@ export interface BaseIconBoxProps<T extends IconBoxTag, G extends IconGroup> ext
|
|
|
17
17
|
* background and foreground colors change on hover or focus.
|
|
18
18
|
* - text: a circle with transparent background. Its size depends on the value of `size`. If this is clickable, the background and
|
|
19
19
|
* foreground colors change on hover or focus (it won't be transparent).
|
|
20
|
-
* - none: no special styling, its size
|
|
20
|
+
* - none: no special styling, its size depends only on the size of the icon (the property `size` is ignored). Even if this is clickable,
|
|
21
21
|
* the style doesn't change on hover or focus.
|
|
22
22
|
*
|
|
23
23
|
* @default 'circle'
|
|
@@ -51,17 +51,42 @@ export interface BaseIconBoxProps<T extends IconBoxTag, G extends IconGroup> ext
|
|
|
51
51
|
analytics?: boolean;
|
|
52
52
|
}
|
|
53
53
|
export type IconBoxProps<T extends IconBoxTag, G extends IconGroup> = Omit<HTMLTag[T], 'children'> & BaseIconBoxProps<T, G>;
|
|
54
|
-
declare function _IconBox<T extends IconBoxTag = 'i', G extends IconGroup = 'outline'>({ group, icon, tag, appearance, size, className, analytics, onClick, feedback, ...props }: IconBoxProps<T, G>): import("react/jsx-runtime").JSX.Element;
|
|
55
54
|
/**
|
|
56
|
-
*
|
|
55
|
+
* Renders a wrapper for an icon. The icon must specified by the properties "icon" and "group", this component accepts no children.
|
|
56
|
+
*
|
|
57
|
+
* If you don't need the icon to be rendered within a box, consider using the component "Icon" directly.
|
|
58
|
+
*
|
|
59
|
+
* Hover and focus effects are applied if the IconBox is focusable.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```
|
|
63
|
+
* <IconBox icon="Search" colorScheme="primary" />
|
|
64
|
+
* ```
|
|
57
65
|
*/
|
|
58
|
-
declare
|
|
66
|
+
export declare const IconBox: <T extends IconBoxTag = "i", G extends IconGroup = "outline">({ group, icon, tag, appearance, size, className, analytics, onClick, feedback, ...props }: IconBoxProps<T, G>) => import("react/jsx-runtime").JSX.Element;
|
|
59
67
|
/**
|
|
60
|
-
*
|
|
68
|
+
* A shortcut for `<IconBox tag="button">`.
|
|
69
|
+
*
|
|
70
|
+
* Whenever a button is clicked, the function `onClickButton` of the nearest CitricController is called with the event and the value of the
|
|
71
|
+
* prop `analytics`.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```
|
|
75
|
+
* <IconButton icon="Search" />
|
|
76
|
+
* ```
|
|
61
77
|
*/
|
|
62
|
-
declare
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
export declare const IconButton: <G extends IconGroup = "outline">({ type, ...props }: Omit<IconBoxProps<"button", G>, "tag">) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
/**
|
|
80
|
+
* A shortcut for `<IconBox tag="a">`.
|
|
81
|
+
*
|
|
82
|
+
* Whenever a link is clicked, the function `onClickLink` of the nearest CitricController is called with the event and the value of the
|
|
83
|
+
* prop `analytics`.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```
|
|
87
|
+
* <IconLink icon="Search" href="#" />
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare const IconLink: <G extends IconGroup = "outline">(props: Omit<IconBoxProps<"a", G>, "tag">) => import("react/jsx-runtime").JSX.Element;
|
|
66
91
|
export {};
|
|
67
92
|
//# sourceMappingURL=IconBox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconBox.d.ts","sourceRoot":"","sources":["../../src/components/IconBox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAGnE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAIrE,KAAK,UAAU,GAAG,GAAG,GAAG,QAAQ,GAAG,GAAG,GAAG,MAAM,GAAG,KAAK,CAAA;AAEvD,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,SAAS,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,gBAAgB;IACtI;;;;OAIG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACnD;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE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,OAAO,GACD,CAAC,SAAS,UAAU,QAAQ,CAAC,SAAS,SAAS,yGAC6B,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,4CAoBhH,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GACD,CAAC,SAAS,SAAS,kCAAkC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,4CAGhH,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GACD,CAAC,SAAS,SAAS,qBAAqB,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,4CAG5F,CAAA"}
|
|
@@ -3,7 +3,20 @@ import { listToClass } from '@stack-spot/portal-theme';
|
|
|
3
3
|
import { useCitricController } from '../context/hooks.js';
|
|
4
4
|
import { withRef } from '../utils/react.js';
|
|
5
5
|
import { CitricComponent } from './CitricComponent.js';
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Renders a wrapper for an icon. The icon must specified by the properties "icon" and "group", this component accepts no children.
|
|
8
|
+
*
|
|
9
|
+
* If you don't need the icon to be rendered within a box, consider using the component "Icon" directly.
|
|
10
|
+
*
|
|
11
|
+
* Hover and focus effects are applied if the IconBox is focusable.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```
|
|
15
|
+
* <IconBox icon="Search" colorScheme="primary" />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const IconBox = withRef(function IconBox({ group, icon, tag, appearance, size, className, analytics, onClick, feedback, ...props }) {
|
|
19
|
+
props['aria-label'] ||= props.title; // accessibility
|
|
7
20
|
const citric = useCitricController();
|
|
8
21
|
function handleClick(e) {
|
|
9
22
|
onClick?.(e);
|
|
@@ -13,20 +26,33 @@ function _IconBox({ group, icon, tag, appearance, size, className, analytics, on
|
|
|
13
26
|
citric?.onClickLink?.(e, analytics ?? false);
|
|
14
27
|
}
|
|
15
28
|
return _jsx(CitricComponent, { tag: (tag || 'i'), component: "icon-box", className: listToClass(['citric-icon', group || 'outline', icon, appearance, size, className]), "data-feedback": feedback || undefined, onClick: ['button', 'a'].includes(tag ?? '') ? handleClick : onClick, ...props });
|
|
16
|
-
}
|
|
29
|
+
});
|
|
17
30
|
/**
|
|
18
|
-
*
|
|
31
|
+
* A shortcut for `<IconBox tag="button">`.
|
|
32
|
+
*
|
|
33
|
+
* Whenever a button is clicked, the function `onClickButton` of the nearest CitricController is called with the event and the value of the
|
|
34
|
+
* prop `analytics`.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```
|
|
38
|
+
* <IconButton icon="Search" />
|
|
39
|
+
* ```
|
|
19
40
|
*/
|
|
20
|
-
function
|
|
41
|
+
export const IconButton = withRef(function IconButton({ type, ...props }) {
|
|
21
42
|
return _jsx(IconBox, { ...props, tag: "button", type: type || 'button' });
|
|
22
|
-
}
|
|
43
|
+
});
|
|
23
44
|
/**
|
|
24
|
-
*
|
|
45
|
+
* A shortcut for `<IconBox tag="a">`.
|
|
46
|
+
*
|
|
47
|
+
* Whenever a link is clicked, the function `onClickLink` of the nearest CitricController is called with the event and the value of the
|
|
48
|
+
* prop `analytics`.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```
|
|
52
|
+
* <IconLink icon="Search" href="#" />
|
|
53
|
+
* ```
|
|
25
54
|
*/
|
|
26
|
-
function
|
|
55
|
+
export const IconLink = withRef(function IconLink(props) {
|
|
27
56
|
return _jsx(IconBox, { ...props, tag: "a" });
|
|
28
|
-
}
|
|
29
|
-
export const IconBox = withRef(_IconBox);
|
|
30
|
-
export const IconButton = withRef(_IconButton);
|
|
31
|
-
export const IconLink = withRef(_IconLink);
|
|
57
|
+
});
|
|
32
58
|
//# sourceMappingURL=IconBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconBox.js","sourceRoot":"","sources":["../../src/components/IconBox.tsx"],"names":[],"m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Q,EACxB,SAAS,EAAC,UAAU,EACpB,SAAS,EAAE,WAAW,CAAC,CAAC,aAAa,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,mBAC/E,QAAQ,IAAI,SAAS,EACpC,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,KAChE,KAAK,GACT,CAAA;AACJ,CAAC,CACF,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAC/B,SAAS,UAAU,CAAkC,EAAE,IAAI,EAAE,GAAG,KAAK,EAA0C;IAC7G,OAAO,KAAC,OAAO,OAAK,KAAK,EAAE,GAAG,EAAC,QAAQ,EAAC,IAAI,EAAE,IAAI,IAAI,QAAQ,GAAK,CAAA;AACrE,CAAC,CACF,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAC7B,SAAS,QAAQ,CAAkC,KAAwC;IACzF,OAAO,KAAC,OAAO,OAAK,KAAK,EAAE,GAAG,EAAC,GAAG,GAAG,CAAA;AACvC,CAAC,CACF,CAAA"}
|
|
@@ -41,17 +41,41 @@ export interface BaseImageBoxProps<T extends ImageBoxTag> extends WithColorPalet
|
|
|
41
41
|
analytics?: boolean;
|
|
42
42
|
}
|
|
43
43
|
export type ImageBoxProps<T extends ImageBoxTag> = HTMLTag[T] & BaseImageBoxProps<T>;
|
|
44
|
-
declare function _ImageBox<T extends ImageBoxTag = 'div'>({ tag, appearance, size, className, analytics, onClick, feedback, ...props }: ImageBoxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
45
|
+
* Renders a wrapper for its child (normally an image). The image will be resized and cropped to fit the container. The image is not cropped
|
|
46
|
+
* if the property "feedback" is set.
|
|
47
|
+
*
|
|
48
|
+
* Hover and focus effects are applied if the ImageBox is focusable.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```
|
|
52
|
+
* <ImageBox><img src="https://images.com/myimage.png" /></ImageBox>
|
|
53
|
+
* ```
|
|
47
54
|
*/
|
|
48
|
-
declare
|
|
55
|
+
export declare const ImageBox: <T extends ImageBoxTag = "div">({ tag, appearance, size, className, analytics, onClick, feedback, ...props }: ImageBoxProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
49
56
|
/**
|
|
50
|
-
*
|
|
57
|
+
* A shortcut for `<ImageBox tag="button">`.
|
|
58
|
+
*
|
|
59
|
+
* Whenever a button is clicked, the function `onClickButton` of the nearest CitricController is called with the event and the value of the
|
|
60
|
+
* prop `analytics`.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```
|
|
64
|
+
* <ImageButton><img src="https://images.com/myimage.png" /></ImageButton>
|
|
65
|
+
* ```
|
|
51
66
|
*/
|
|
52
|
-
declare
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
export declare const ImageButton: (props: Omit<ImageBoxProps<"button">, "tag">) => import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
/**
|
|
69
|
+
* A shortcut for `<ImageBox tag="a">`.
|
|
70
|
+
*
|
|
71
|
+
* Whenever a link is clicked, the function `onClickLink` of the nearest CitricController is called with the event and the value of the
|
|
72
|
+
* prop `analytics`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```
|
|
76
|
+
* <ImageLink href="#"><img src="https://images.com/myimage.png" /></ImageButton>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare const ImageLink: (props: Omit<ImageBoxProps<"a">, "tag">) => import("react/jsx-runtime").JSX.Element;
|
|
56
80
|
export {};
|
|
57
81
|
//# sourceMappingURL=ImageBox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageBox.d.ts","sourceRoot":"","sources":["../../src/components/ImageBox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAIrE,KAAK,WAAW,GAAG,GAAG,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAA;AAElD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,gBAAgB,EAAE,eAAe;IACjG;;;;OAIG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAEpF,
|
|
1
|
+
{"version":3,"file":"ImageBox.d.ts","sourceRoot":"","sources":["../../src/components/ImageBox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAIrE,KAAK,WAAW,GAAG,GAAG,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAA;AAElD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,gBAAgB,EAAE,eAAe;IACjG;;;;OAIG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAEpF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GACD,CAAC,SAAS,WAAW,wFACyC,aAAa,CAAC,CAAC,CAAC,4CAoBjG,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,UACM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,4CAGjE,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,UACM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,4CAG1D,CAAA"}
|
|
@@ -3,7 +3,19 @@ import { listToClass } from '@stack-spot/portal-theme';
|
|
|
3
3
|
import { useCitricController } from '../context/hooks.js';
|
|
4
4
|
import { withRef } from '../utils/react.js';
|
|
5
5
|
import { CitricComponent } from './CitricComponent.js';
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Renders a wrapper for its child (normally an image). The image will be resized and cropped to fit the container. The image is not cropped
|
|
8
|
+
* if the property "feedback" is set.
|
|
9
|
+
*
|
|
10
|
+
* Hover and focus effects are applied if the ImageBox is focusable.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* <ImageBox><img src="https://images.com/myimage.png" /></ImageBox>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export const ImageBox = withRef(function ImageBox({ tag, appearance, size, className, analytics, onClick, feedback, ...props }) {
|
|
18
|
+
props['aria-label'] ||= props.title; // accessibility
|
|
7
19
|
const citric = useCitricController();
|
|
8
20
|
function handleClick(e) {
|
|
9
21
|
onClick?.(e);
|
|
@@ -13,20 +25,33 @@ function _ImageBox({ tag, appearance, size, className, analytics, onClick, feedb
|
|
|
13
25
|
citric?.onClickLink?.(e, analytics ?? false);
|
|
14
26
|
}
|
|
15
27
|
return _jsx(CitricComponent, { tag: (tag || 'i'), component: "icon-box", className: listToClass([appearance, size, className]), "data-feedback": feedback || undefined, onClick: ['button', 'a'].includes(tag ?? '') ? handleClick : onClick, ...props });
|
|
16
|
-
}
|
|
28
|
+
});
|
|
17
29
|
/**
|
|
18
|
-
*
|
|
30
|
+
* A shortcut for `<ImageBox tag="button">`.
|
|
31
|
+
*
|
|
32
|
+
* Whenever a button is clicked, the function `onClickButton` of the nearest CitricController is called with the event and the value of the
|
|
33
|
+
* prop `analytics`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* <ImageButton><img src="https://images.com/myimage.png" /></ImageButton>
|
|
38
|
+
* ```
|
|
19
39
|
*/
|
|
20
|
-
function
|
|
40
|
+
export const ImageButton = withRef(function ImageButton(props) {
|
|
21
41
|
return _jsx(ImageBox, { ...props, tag: "button", type: props.type || 'button' });
|
|
22
|
-
}
|
|
42
|
+
});
|
|
23
43
|
/**
|
|
24
|
-
*
|
|
44
|
+
* A shortcut for `<ImageBox tag="a">`.
|
|
45
|
+
*
|
|
46
|
+
* Whenever a link is clicked, the function `onClickLink` of the nearest CitricController is called with the event and the value of the
|
|
47
|
+
* prop `analytics`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```
|
|
51
|
+
* <ImageLink href="#"><img src="https://images.com/myimage.png" /></ImageButton>
|
|
52
|
+
* ```
|
|
25
53
|
*/
|
|
26
|
-
function
|
|
54
|
+
export const ImageLink = withRef(function ImageLink(props) {
|
|
27
55
|
return _jsx(ImageBox, { ...props, tag: "a" });
|
|
28
|
-
}
|
|
29
|
-
export const ImageBox = withRef(_ImageBox);
|
|
30
|
-
export const ImageButton = withRef(_ImageButton);
|
|
31
|
-
export const ImageLink = withRef(_ImageLink);
|
|
56
|
+
});
|
|
32
57
|
//# sourceMappingURL=ImageBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageBox.js","sourceRoot":"","sources":["../../src/components/ImageBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AA+CnD,
|
|
1
|
+
{"version":3,"file":"ImageBox.js","sourceRoot":"","sources":["../../src/components/ImageBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AA+CnD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAC7B,SAAS,QAAQ,CACf,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB;IAE9F,KAAK,CAAC,YAAY,CAAC,KAAK,KAAK,CAAC,KAAK,CAAA,CAAC,gBAAgB;IACpD,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IAEpC,SAAS,WAAW,CAAC,CAAwB;QAC3C,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;QACZ,IAAI,GAAG,KAAK,QAAQ;YAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,SAAS,IAAI,KAAK,CAAC,CAAA;aAC/D,IAAI,GAAG,KAAK,GAAG;YAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,SAAS,IAAI,KAAK,CAAC,CAAA;IACpE,CAAC;IAED,OAAO,KAAC,eAAe,IACrB,GAAG,EAAE,CAAC,GAAG,IAAI,GAAG,CAAQ,EACxB,SAAS,EAAC,UAAU,EACpB,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,mBACtC,QAAQ,IAAI,SAAS,EACpC,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,KAChE,KAAK,GACT,CAAA;AACJ,CAAC,CACF,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAChC,SAAS,WAAW,CAAC,KAA2C;IAC9D,OAAO,KAAC,QAAQ,OAAK,KAAK,EAAE,GAAG,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,QAAQ,GAAI,CAAA;AAC3E,CAAC,CACF,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAC9B,SAAS,SAAS,CAAC,KAAsC;IACvD,OAAO,KAAC,QAAQ,OAAK,KAAK,EAAE,GAAG,EAAC,GAAG,GAAG,CAAA;AACxC,CAAC,CACF,CAAA"}
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import { WithStyleShortcuts } from '../types.js';
|
|
2
2
|
export interface BaseImageWithFallbackProps extends Pick<WithStyleShortcuts, 'w' | 'h' | 'radius' | 'bg'> {
|
|
3
|
+
/**
|
|
4
|
+
* The react element to fallback to if the image can't be rendered.
|
|
5
|
+
*/
|
|
3
6
|
fallback: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Whether or not to show a skeleton when the image is still loading.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
4
11
|
showLoading?: boolean;
|
|
5
12
|
}
|
|
6
13
|
export type ImageWithFallbackProps = JSX.IntrinsicElements['img'] & BaseImageWithFallbackProps;
|
|
14
|
+
/**
|
|
15
|
+
* Attempts to render an image. If it succeeds, the image is displayed, otherwise, a fallback is rendered.
|
|
16
|
+
*
|
|
17
|
+
* This is very useful if the value of "src" may be empty or if it may be broken. Instead of rendering nothing or the default browser error,
|
|
18
|
+
* it renders the fallback passed as parameter.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* <ImageWithFallback src={item.image} fallback={<Icon icon="Agent" />} />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
7
25
|
export declare const ImageWithFallback: ({ onLoad, onError, className, style: ogStyle, fallback, showLoading, w, h, radius, bg, ...props }: ImageWithFallbackProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
26
|
//# sourceMappingURL=ImageWithFallback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageWithFallback.d.ts","sourceRoot":"","sources":["../../src/components/ImageWithFallback.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAI7C,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,kBAAkB,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,IAAI,CAAC;IACvG,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,0BAA0B,CAAA;AAE9F,eAAO,MAAM,iBAAiB,GAC5B,mGAAmG,sBAAsB,4CAgC1H,CAAA"}
|
|
1
|
+
{"version":3,"file":"ImageWithFallback.d.ts","sourceRoot":"","sources":["../../src/components/ImageWithFallback.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAI7C,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,kBAAkB,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,IAAI,CAAC;IACvG;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,0BAA0B,CAAA;AAE9F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC5B,mGAAmG,sBAAsB,4CAgC1H,CAAA"}
|
|
@@ -3,6 +3,17 @@ import { listToClass } from '@stack-spot/portal-theme';
|
|
|
3
3
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { getStyleFromProps } from '../utils/css.js';
|
|
5
5
|
import { Skeleton } from './Skeleton.js';
|
|
6
|
+
/**
|
|
7
|
+
* Attempts to render an image. If it succeeds, the image is displayed, otherwise, a fallback is rendered.
|
|
8
|
+
*
|
|
9
|
+
* This is very useful if the value of "src" may be empty or if it may be broken. Instead of rendering nothing or the default browser error,
|
|
10
|
+
* it renders the fallback passed as parameter.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* <ImageWithFallback src={item.image} fallback={<Icon icon="Agent" />} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
export const ImageWithFallback = ({ onLoad, onError, className, style: ogStyle, fallback, showLoading, w, h, radius, bg, ...props }) => {
|
|
7
18
|
const [state, setState] = useState(props.src ? 'loading' : 'error');
|
|
8
19
|
const isLoading = state === 'loading' && showLoading;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageWithFallback.js","sourceRoot":"","sources":["../../src/components/ImageWithFallback.tsx"],"names":[],"mappings":";AAAA,OAAO,EA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EtH,SAAS,UAAU,CAAC,CAAgD;QAClE,IAAI,KAAK,KAAK,SAAS;YAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC1C,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;IACb,CAAC;IAED,SAAS,WAAW,CAAC,CAAgD;QACnE,QAAQ,CAAC,OAAO,CAAC,CAAA;QACjB,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;IACd,CAAC;IAED,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,SAAS;YAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACpE,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAEf,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,cAAK,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAO,CAAA;IAChH,OAAO,8BACJ,SAAS,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAI,EAC9D,cACE,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,iBACzF,SAAS,EACtB,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,IACD,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -11,7 +11,19 @@ export interface BaseInputProps<T extends SupportedInputType> extends WithColorS
|
|
|
11
11
|
export type InputProps<T extends SupportedInputType = 'text'> = ControlledInput & BaseInputProps<T> & {
|
|
12
12
|
type?: T;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Renders a input.
|
|
16
|
+
*
|
|
17
|
+
* Attention: "onChange" doesn't receive an event, instead, it receives the new value of the input: a string, unless "type" is "number",
|
|
18
|
+
* in this case, it receives a number.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
* const [value, setValue] = useState('')
|
|
24
|
+
*
|
|
25
|
+
* return <Input value={value} onChange={setValue} />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const Input: <T extends SupportedInputType = "text">({ type, value, onChange, ...props }: InputProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
17
29
|
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI3D,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GACjI,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAElC,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,kBAAkB,CAAE,SAAQ,eAAe;IACnF;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,CAAC,SAAS,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,SAAS,QAAQ,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,KAAK,IAAI,CAAC;CAChF;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,kBAAkB,GAAG,MAAM,IAC1D,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAEpD,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI3D,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GACjI,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAElC,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,kBAAkB,CAAE,SAAQ,eAAe;IACnF;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,CAAC,SAAS,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,SAAS,QAAQ,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,KAAK,IAAI,CAAC;CAChF;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,kBAAkB,GAAG,MAAM,IAC1D,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAEpD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GACD,CAAC,SAAS,kBAAkB,gDAAgD,UAAU,CAAC,CAAC,CAAC,4CAczG,CAAA"}
|
package/dist/components/Input.js
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { withRef } from '../utils/react.js';
|
|
3
3
|
import { CitricComponent } from './CitricComponent.js';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Renders a input.
|
|
6
|
+
*
|
|
7
|
+
* Attention: "onChange" doesn't receive an event, instead, it receives the new value of the input: a string, unless "type" is "number",
|
|
8
|
+
* in this case, it receives a number.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* const [value, setValue] = useState('')
|
|
14
|
+
*
|
|
15
|
+
* return <Input value={value} onChange={setValue} />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const Input = withRef(function Input({ type, value, onChange, ...props }) {
|
|
5
19
|
function handleChange(e) {
|
|
6
20
|
if (!onChange)
|
|
7
21
|
return;
|
|
@@ -15,6 +29,5 @@ function _Input({ type, value, onChange, ...props }) {
|
|
|
15
29
|
}
|
|
16
30
|
}
|
|
17
31
|
return _jsx(CitricComponent, { tag: "input", component: "input", type: type, value: value, onChange: handleChange, ...props });
|
|
18
|
-
}
|
|
19
|
-
export const Input = withRef(_Input);
|
|
32
|
+
});
|
|
20
33
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAiBnD,
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAiBnD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAC1B,SAAS,KAAK,CAAwC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IACtG,SAAS,YAAY,CAAC,CAAsC;QAC1D,IAAI,CAAC,QAAQ;YAAE,OAAM;QACrB,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAA;QAC/B,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YAC1D,QAAQ,CAAC,MAAa,CAAC,CAAA;QACzB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,QAAe,CAAC,CAAA;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,KAAC,eAAe,IAAC,GAAG,EAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,KAAM,KAAK,GAAI,CAAA;AACvH,CAAC,CACF,CAAA"}
|
|
@@ -16,5 +16,11 @@ export interface BaseLinkProps extends WithColor {
|
|
|
16
16
|
analytics?: boolean;
|
|
17
17
|
}
|
|
18
18
|
export type LinkProps = React.JSX.IntrinsicElements['a'] & BaseLinkProps;
|
|
19
|
+
/**
|
|
20
|
+
* Renders an html anchor by default, the actual component to render may be set on a CitricController, through the function `renderLink`.
|
|
21
|
+
*
|
|
22
|
+
* Whenever a link is clicked, the function `onClickLink` of the nearest CitricController is called with the event and the value of the
|
|
23
|
+
* prop `analytics`.
|
|
24
|
+
*/
|
|
19
25
|
export declare const Link: ({ appearance, color, style, className, children, onClick, analytics, ...props }: LinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
26
|
//# sourceMappingURL=Link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAKpD,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,aAAa,CAAA;AAExE,eAAO,MAAM,IAAI,oFAA6F,SAAS,4CAerH,CAAA"}
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAKpD,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,aAAa,CAAA;AAExE;;;;;GAKG;AACH,eAAO,MAAM,IAAI,oFAA6F,SAAS,4CAerH,CAAA"}
|
package/dist/components/Link.js
CHANGED
|
@@ -3,6 +3,12 @@ import { useCitricController } from '../context/hooks.js';
|
|
|
3
3
|
import { applyColor, applyTextAppearance } from '../utils/css.js';
|
|
4
4
|
import { withRef } from '../utils/react.js';
|
|
5
5
|
import { asCitricProps, CitricComponent } from './CitricComponent.js';
|
|
6
|
+
/**
|
|
7
|
+
* Renders an html anchor by default, the actual component to render may be set on a CitricController, through the function `renderLink`.
|
|
8
|
+
*
|
|
9
|
+
* Whenever a link is clicked, the function `onClickLink` of the nearest CitricController is called with the event and the value of the
|
|
10
|
+
* prop `analytics`.
|
|
11
|
+
*/
|
|
6
12
|
export const Link = withRef(({ appearance, color, style, className, children, onClick, analytics, ...props }) => {
|
|
7
13
|
const citric = useCitricController();
|
|
8
14
|
const linkProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAqBlE,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE;IACzH,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IACpC,MAAM,SAAS,GAAG;QAChB,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;QAC/B,SAAS,EAAE,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAC;QACrD,OAAO,EAAE,CAAC,CAAsC,EAAE,EAAE;YAClD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;YACZ,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,SAAS,IAAI,KAAK,CAAC,CAAA;QAC9C,CAAC;QACD,GAAG,KAAK;KACA,CAAA;IACV,OAAO,MAAM,EAAE,UAAU;QACvB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,CAAC,CAAC,KAAC,eAAe,IAAC,GAAG,EAAC,GAAG,KAAK,SAAS,YAAG,QAAQ,GAAmB,CAAA;AAC1E,CAAC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAqBlE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE;IACzH,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IACpC,MAAM,SAAS,GAAG;QAChB,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;QAC/B,SAAS,EAAE,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAC;QACrD,OAAO,EAAE,CAAC,CAAsC,EAAE,EAAE;YAClD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;YACZ,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,SAAS,IAAI,KAAK,CAAC,CAAA;QAC9C,CAAC;QACD,GAAG,KAAK;KACA,CAAA;IACV,OAAO,MAAM,EAAE,UAAU;QACvB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,CAAC,CAAC,KAAC,eAAe,IAAC,GAAG,EAAC,GAAG,KAAK,SAAS,YAAG,QAAQ,GAAmB,CAAA;AAC1E,CAAC,CAAC,CAAA"}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
import { MenuOverlayProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a menu overlay for its child element. Whenever the child element is clicked, the menu appears. Closing the menu is also handled
|
|
4
|
+
* by this component.
|
|
5
|
+
*
|
|
6
|
+
* The menu is defined by the property "items" and can contain sections and sub menus.
|
|
7
|
+
*
|
|
8
|
+
* If no child is provided, a button with the vertical ellipsis icon is rendered.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* const items: MenuItem[] = useMemo([
|
|
14
|
+
* { label: 'View', href: `/resource/${id}` },
|
|
15
|
+
* { label: 'Edit', onClick: () => editResource(id) },
|
|
16
|
+
* { label: 'Remove', onClick: () => removeResource(id), style: { color: theme.color.danger[500] } },
|
|
17
|
+
* ], [id])
|
|
18
|
+
*
|
|
19
|
+
* return <MenuOverlay items={items}><IconButton icon="Plus" /></MenuOverlay>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
2
22
|
export declare const MenuOverlay: ({ id, items, appearance, bgLevel, header, roundedItems, showBorders, showShadows, spaced, menuClass, menuStyle, children, ...props }: MenuOverlayProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MenuOverlay/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE1C,eAAO,MAAM,WAAW,GAAI,sIAEzB,gBAAgB,4CAgBlB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MenuOverlay/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,GAAI,sIAEzB,gBAAgB,4CAgBlB,CAAA"}
|