@j2-health/design-system 0.6.1 → 0.6.3
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/index.cjs +7 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -1
- package/dist/index2.js +4 -1
- package/dist/src/components/bareButton/BareButton.cjs +31 -0
- package/dist/src/components/bareButton/BareButton.cjs.map +1 -0
- package/dist/src/components/bareButton/BareButton.d.ts +16 -0
- package/dist/src/components/bareButton/BareButton.js +29 -0
- package/dist/src/components/bareButton/BareButton.js.map +1 -0
- package/dist/src/components/bareButton/index.d.ts +1 -0
- package/dist/src/components/changeChip/ChangeChip.cjs +36 -30
- package/dist/src/components/changeChip/ChangeChip.cjs.map +1 -1
- package/dist/src/components/changeChip/ChangeChip.d.ts +22 -5
- package/dist/src/components/changeChip/ChangeChip.js +37 -31
- package/dist/src/components/changeChip/ChangeChip.js.map +1 -1
- package/dist/src/components/input/AntdInput.d.ts +10 -10
- package/dist/src/components/input/AntdSearchInput.d.ts +10 -10
- package/dist/src/components/stepDrawer/StepDrawer.cjs +89 -0
- package/dist/src/components/stepDrawer/StepDrawer.cjs.map +1 -0
- package/dist/src/components/stepDrawer/StepDrawer.d.ts +65 -0
- package/dist/src/components/stepDrawer/StepDrawer.js +88 -0
- package/dist/src/components/stepDrawer/StepDrawer.js.map +1 -0
- package/dist/src/components/stepDrawer/index.d.ts +1 -0
- package/dist/src/components/steps/Steps.cjs +4 -3
- package/dist/src/components/steps/Steps.cjs.map +1 -1
- package/dist/src/components/steps/Steps.d.ts +1 -1
- package/dist/src/components/steps/Steps.js +4 -3
- package/dist/src/components/steps/Steps.js.map +1 -1
- package/dist/src/components/steps/useSteps.cjs +2 -2
- package/dist/src/components/steps/useSteps.cjs.map +1 -1
- package/dist/src/components/steps/useSteps.js +2 -2
- package/dist/src/components/steps/useSteps.js.map +1 -1
- package/dist/src/components/swatch/Swatch.cjs +12 -6
- package/dist/src/components/swatch/Swatch.cjs.map +1 -1
- package/dist/src/components/swatch/Swatch.d.ts +10 -3
- package/dist/src/components/swatch/Swatch.js +12 -6
- package/dist/src/components/swatch/Swatch.js.map +1 -1
- package/dist/src/components/swatch/index.d.ts +1 -1
- package/dist/src/components/swatchStrip/SwatchStrip.cjs +67 -28
- package/dist/src/components/swatchStrip/SwatchStrip.cjs.map +1 -1
- package/dist/src/components/swatchStrip/SwatchStrip.d.ts +56 -5
- package/dist/src/components/swatchStrip/SwatchStrip.js +67 -28
- package/dist/src/components/swatchStrip/SwatchStrip.js.map +1 -1
- package/dist/src/components/swatchStrip/index.d.ts +1 -1
- package/dist/src/utils/useRender.cjs +76 -0
- package/dist/src/utils/useRender.cjs.map +1 -0
- package/dist/src/utils/useRender.d.ts +29 -0
- package/dist/src/utils/useRender.js +73 -0
- package/dist/src/utils/useRender.js.map +1 -0
- package/package.json +18 -19
package/dist/index.cjs
CHANGED
|
@@ -4,12 +4,14 @@ const require_tailwind = require("./tailwind.cjs");
|
|
|
4
4
|
const require_appTheme = require("./src/appTheme.cjs");
|
|
5
5
|
const require_AppConfigProvider = require("./src/AppConfigProvider.cjs");
|
|
6
6
|
const require_Alert = require("./src/components/alert/Alert.cjs");
|
|
7
|
+
const require_BareButton = require("./src/components/bareButton/BareButton.cjs");
|
|
7
8
|
const require_BarChart = require("./src/components/barchart/BarChart.cjs");
|
|
8
9
|
const require_Breadcrumb = require("./src/components/breadcrumb/Breadcrumb.cjs");
|
|
9
10
|
const require_Button = require("./src/components/button/Button.cjs");
|
|
10
11
|
const require_BulkActionBar = require("./src/components/bulkActionBar/BulkActionBar.cjs");
|
|
11
12
|
const require_Card = require("./src/components/card/Card.cjs");
|
|
12
13
|
const require_Swatch = require("./src/components/swatch/Swatch.cjs");
|
|
14
|
+
const require_useRender = require("./src/utils/useRender.cjs");
|
|
13
15
|
const require_ChangeChip = require("./src/components/changeChip/ChangeChip.cjs");
|
|
14
16
|
const require_Checkbox = require("./src/components/checkbox/Checkbox.cjs");
|
|
15
17
|
const require_CheckboxTree = require("./src/components/checkboxTree/CheckboxTree.cjs");
|
|
@@ -50,6 +52,7 @@ const require_Spinner = require("./src/components/spinner/Spinner.cjs");
|
|
|
50
52
|
const require_StatusPill = require("./src/components/statusPill/StatusPill.cjs");
|
|
51
53
|
const require_useSteps = require("./src/components/steps/useSteps.cjs");
|
|
52
54
|
const require_Steps = require("./src/components/steps/Steps.cjs");
|
|
55
|
+
const require_StepDrawer = require("./src/components/stepDrawer/StepDrawer.cjs");
|
|
53
56
|
const require_SwatchStrip = require("./src/components/swatchStrip/SwatchStrip.cjs");
|
|
54
57
|
const require_Switch = require("./src/components/switch/Switch.cjs");
|
|
55
58
|
const require_Table = require("./src/components/table/Table.cjs");
|
|
@@ -67,6 +70,7 @@ exports.AntdSearchInput = require_AntdSearchInput.AntdSearchInput;
|
|
|
67
70
|
exports.AntdSelect = require_AntdSelect.AntdSelect;
|
|
68
71
|
exports.AppConfigProvider = require_AppConfigProvider.AppConfigProvider;
|
|
69
72
|
exports.BarChart = require_BarChart.BarChart;
|
|
73
|
+
exports.BareButton = require_BareButton.BareButton;
|
|
70
74
|
exports.Breadcrumb = require_Breadcrumb.Breadcrumb;
|
|
71
75
|
exports.BulkActionBar = require_BulkActionBar.BulkActionBar;
|
|
72
76
|
exports.Button = require_Button.Button;
|
|
@@ -108,6 +112,7 @@ exports.SelectAll = require_SelectAll.SelectAll;
|
|
|
108
112
|
exports.Skeleton = require_Skeleton.Skeleton;
|
|
109
113
|
exports.Spinner = require_Spinner.Spinner;
|
|
110
114
|
exports.StatusPill = require_StatusPill.StatusPill;
|
|
115
|
+
exports.StepDrawer = require_StepDrawer.StepDrawer;
|
|
111
116
|
exports.Steps = require_Steps.Steps;
|
|
112
117
|
exports.SummarizedSelect = require_SummarizedSelect.SummarizedSelect;
|
|
113
118
|
exports.Swatch = require_Swatch.Swatch;
|
|
@@ -128,10 +133,12 @@ Object.defineProperty(exports, "icons", {
|
|
|
128
133
|
}
|
|
129
134
|
});
|
|
130
135
|
exports.isMultiValueTextOperator = require_filterHelpers.isMultiValueTextOperator;
|
|
136
|
+
exports.mergeProps = require_useRender.mergeProps;
|
|
131
137
|
exports.normalizeMultiValues = require_filterHelpers.normalizeMultiValues;
|
|
132
138
|
exports.operatorOptionsFor = require_useFilterField.operatorOptionsFor;
|
|
133
139
|
exports.tailwindPreset = require_tailwind.tailwindPreset;
|
|
134
140
|
exports.useMessage = require_useMessage.useMessage;
|
|
135
141
|
exports.useNotification = require_useNotification.useNotification;
|
|
142
|
+
exports.useStepDrawerSlots = require_StepDrawer.useStepDrawerSlots;
|
|
136
143
|
exports.useSteps = require_useSteps.useSteps;
|
|
137
144
|
exports.withDesignSystemPaginationOverrides = require_Pagination.withDesignSystemPaginationOverrides;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './tailwind.config.js';
|
|
|
2
2
|
export * from './src/AppConfigProvider.js';
|
|
3
3
|
export * from './src/appTheme.js';
|
|
4
4
|
export * from './src/components/alert/index.js';
|
|
5
|
+
export * from './src/components/bareButton/index.js';
|
|
5
6
|
export * from './src/components/barchart/index.js';
|
|
6
7
|
export * from './src/components/breadcrumb/index.js';
|
|
7
8
|
export * from './src/components/bulkActionBar/index.js';
|
|
@@ -36,6 +37,7 @@ export * from './src/components/select/index.js';
|
|
|
36
37
|
export * from './src/components/skeleton/index.js';
|
|
37
38
|
export * from './src/components/spinner/index.js';
|
|
38
39
|
export * from './src/components/statusPill/index.js';
|
|
40
|
+
export * from './src/components/stepDrawer/index.js';
|
|
39
41
|
export * from './src/components/steps/index.js';
|
|
40
42
|
export * from './src/components/swatch/index.js';
|
|
41
43
|
export * from './src/components/swatchStrip/index.js';
|
|
@@ -47,5 +49,6 @@ export * from './src/components/thresholdBar/index.js';
|
|
|
47
49
|
export * from './src/components/tooltip/index.js';
|
|
48
50
|
export * from './src/components/vennDiagram/index.js';
|
|
49
51
|
export * from './src/components/legacyNavMenu/index.js';
|
|
52
|
+
export { mergeProps, type RenderProp, type RenderProps, } from './src/utils/useRender.js';
|
|
50
53
|
import * as icons from '@phosphor-icons/react';
|
|
51
54
|
export { icons };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { tailwindPreset } from "./tailwind.js";
|
|
|
2
2
|
import { appTheme } from "./src/appTheme.js";
|
|
3
3
|
import { AppConfigProvider } from "./src/AppConfigProvider.js";
|
|
4
4
|
import { Alert } from "./src/components/alert/Alert.js";
|
|
5
|
+
import { BareButton } from "./src/components/bareButton/BareButton.js";
|
|
5
6
|
import { BarChart } from "./src/components/barchart/BarChart.js";
|
|
6
7
|
import { HighchartsReact } from "./src/components/barchart/index.js";
|
|
7
8
|
import { Breadcrumb } from "./src/components/breadcrumb/Breadcrumb.js";
|
|
@@ -9,6 +10,7 @@ import { Button } from "./src/components/button/Button.js";
|
|
|
9
10
|
import { BulkActionBar } from "./src/components/bulkActionBar/BulkActionBar.js";
|
|
10
11
|
import { Card } from "./src/components/card/Card.js";
|
|
11
12
|
import { Swatch } from "./src/components/swatch/Swatch.js";
|
|
13
|
+
import { mergeProps } from "./src/utils/useRender.js";
|
|
12
14
|
import { ChangeChip } from "./src/components/changeChip/ChangeChip.js";
|
|
13
15
|
import { Checkbox } from "./src/components/checkbox/Checkbox.js";
|
|
14
16
|
import { CheckboxTree } from "./src/components/checkboxTree/CheckboxTree.js";
|
|
@@ -49,6 +51,7 @@ import { Spinner } from "./src/components/spinner/Spinner.js";
|
|
|
49
51
|
import { StatusPill } from "./src/components/statusPill/StatusPill.js";
|
|
50
52
|
import { useSteps } from "./src/components/steps/useSteps.js";
|
|
51
53
|
import { Steps } from "./src/components/steps/Steps.js";
|
|
54
|
+
import { StepDrawer, useStepDrawerSlots } from "./src/components/stepDrawer/StepDrawer.js";
|
|
52
55
|
import { SwatchStrip } from "./src/components/swatchStrip/SwatchStrip.js";
|
|
53
56
|
import { Switch } from "./src/components/switch/Switch.js";
|
|
54
57
|
import { Table } from "./src/components/table/Table.js";
|
|
@@ -58,4 +61,4 @@ import { VennDiagram } from "./src/components/vennDiagram/VennDiagram.js";
|
|
|
58
61
|
import { UserProfile } from "./src/components/legacyNavMenu/UserProfile.js";
|
|
59
62
|
import { LegacyNavMenu } from "./src/components/legacyNavMenu/LegacyNavMenu.js";
|
|
60
63
|
import { icons } from "./index2.js";
|
|
61
|
-
export { Alert, AntdInput, AntdSearchInput, AntdSelect, AppConfigProvider, BarChart, Breadcrumb, BulkActionBar, Button, Card, ChangeChip, Checkbox, CheckboxTree, Collapse, Drawer, Dropdown, EmptyState, FiltersForm, Form, HighchartsReact, Input, InputNumber, LegacyNavMenu, ListPopover, ListRow, ManageColumnsPanel, Menu, Modal, MultiValueTextOperatorOptions, NavMenu, NotificationModal, Pagination, Popover, Progress, Radio, RadioGroup, Rate, Select, SelectAll, Skeleton, Spinner, StatusPill, Steps, SummarizedSelect, Swatch, SwatchStrip, Switch, Table, Tabs, Tag, ThresholdBar, Tooltip, UserProfile, VennDiagram, appTheme, icons, isMultiValueTextOperator, normalizeMultiValues, operatorOptionsFor, tailwindPreset, useMessage, useNotification, useSteps, withDesignSystemPaginationOverrides };
|
|
64
|
+
export { Alert, AntdInput, AntdSearchInput, AntdSelect, AppConfigProvider, BarChart, BareButton, Breadcrumb, BulkActionBar, Button, Card, ChangeChip, Checkbox, CheckboxTree, Collapse, Drawer, Dropdown, EmptyState, FiltersForm, Form, HighchartsReact, Input, InputNumber, LegacyNavMenu, ListPopover, ListRow, ManageColumnsPanel, Menu, Modal, MultiValueTextOperatorOptions, NavMenu, NotificationModal, Pagination, Popover, Progress, Radio, RadioGroup, Rate, Select, SelectAll, Skeleton, Spinner, StatusPill, StepDrawer, Steps, SummarizedSelect, Swatch, SwatchStrip, Switch, Table, Tabs, Tag, ThresholdBar, Tooltip, UserProfile, VennDiagram, appTheme, icons, isMultiValueTextOperator, mergeProps, normalizeMultiValues, operatorOptionsFor, tailwindPreset, useMessage, useNotification, useStepDrawerSlots, useSteps, withDesignSystemPaginationOverrides };
|
package/dist/index2.js
CHANGED
|
@@ -2,6 +2,7 @@ import { tailwindPreset } from "./tailwind.js";
|
|
|
2
2
|
import { appTheme } from "./src/appTheme.js";
|
|
3
3
|
import { AppConfigProvider } from "./src/AppConfigProvider.js";
|
|
4
4
|
import { Alert } from "./src/components/alert/Alert.js";
|
|
5
|
+
import { BareButton } from "./src/components/bareButton/BareButton.js";
|
|
5
6
|
import { BarChart } from "./src/components/barchart/BarChart.js";
|
|
6
7
|
import { HighchartsReact } from "./src/components/barchart/index.js";
|
|
7
8
|
import { Breadcrumb } from "./src/components/breadcrumb/Breadcrumb.js";
|
|
@@ -9,6 +10,7 @@ import { Button } from "./src/components/button/Button.js";
|
|
|
9
10
|
import { BulkActionBar } from "./src/components/bulkActionBar/BulkActionBar.js";
|
|
10
11
|
import { Card } from "./src/components/card/Card.js";
|
|
11
12
|
import { Swatch } from "./src/components/swatch/Swatch.js";
|
|
13
|
+
import { mergeProps } from "./src/utils/useRender.js";
|
|
12
14
|
import { ChangeChip } from "./src/components/changeChip/ChangeChip.js";
|
|
13
15
|
import { Checkbox } from "./src/components/checkbox/Checkbox.js";
|
|
14
16
|
import { CheckboxTree } from "./src/components/checkboxTree/CheckboxTree.js";
|
|
@@ -49,6 +51,7 @@ import { Spinner } from "./src/components/spinner/Spinner.js";
|
|
|
49
51
|
import { StatusPill } from "./src/components/statusPill/StatusPill.js";
|
|
50
52
|
import { useSteps } from "./src/components/steps/useSteps.js";
|
|
51
53
|
import { Steps } from "./src/components/steps/Steps.js";
|
|
54
|
+
import { StepDrawer, useStepDrawerSlots } from "./src/components/stepDrawer/StepDrawer.js";
|
|
52
55
|
import { SwatchStrip } from "./src/components/swatchStrip/SwatchStrip.js";
|
|
53
56
|
import { Switch } from "./src/components/switch/Switch.js";
|
|
54
57
|
import { Table } from "./src/components/table/Table.js";
|
|
@@ -58,4 +61,4 @@ import { VennDiagram } from "./src/components/vennDiagram/VennDiagram.js";
|
|
|
58
61
|
import { UserProfile } from "./src/components/legacyNavMenu/UserProfile.js";
|
|
59
62
|
import { LegacyNavMenu } from "./src/components/legacyNavMenu/LegacyNavMenu.js";
|
|
60
63
|
import * as icons from "@phosphor-icons/react";
|
|
61
|
-
export { Alert, AntdInput, AntdSearchInput, AntdSelect, AppConfigProvider, BarChart, Breadcrumb, BulkActionBar, Button, Card, ChangeChip, Checkbox, CheckboxTree, Collapse, Drawer, Dropdown, EmptyState, FiltersForm, Form, HighchartsReact, Input, InputNumber, LegacyNavMenu, ListPopover, ListRow, ManageColumnsPanel, Menu, Modal, MultiValueTextOperatorOptions, NavMenu, NotificationModal, Pagination, Popover, Progress, Radio, RadioGroup, Rate, Select, SelectAll, Skeleton, Spinner, StatusPill, Steps, SummarizedSelect, Swatch, SwatchStrip, Switch, Table, Tabs, Tag, ThresholdBar, Tooltip, UserProfile, VennDiagram, appTheme, icons, isMultiValueTextOperator, normalizeMultiValues, operatorOptionsFor, tailwindPreset, useMessage, useNotification, useSteps, withDesignSystemPaginationOverrides };
|
|
64
|
+
export { Alert, AntdInput, AntdSearchInput, AntdSelect, AppConfigProvider, BarChart, BareButton, Breadcrumb, BulkActionBar, Button, Card, ChangeChip, Checkbox, CheckboxTree, Collapse, Drawer, Dropdown, EmptyState, FiltersForm, Form, HighchartsReact, Input, InputNumber, LegacyNavMenu, ListPopover, ListRow, ManageColumnsPanel, Menu, Modal, MultiValueTextOperatorOptions, NavMenu, NotificationModal, Pagination, Popover, Progress, Radio, RadioGroup, Rate, Select, SelectAll, Skeleton, Spinner, StatusPill, StepDrawer, Steps, SummarizedSelect, Swatch, SwatchStrip, Switch, Table, Tabs, Tag, ThresholdBar, Tooltip, UserProfile, VennDiagram, appTheme, icons, isMultiValueTextOperator, mergeProps, normalizeMultiValues, operatorOptionsFor, tailwindPreset, useMessage, useNotification, useStepDrawerSlots, useSteps, withDesignSystemPaginationOverrides };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
let classnames = require("classnames");
|
|
5
|
+
classnames = require_runtime.__toESM(classnames, 1);
|
|
6
|
+
//#region src/components/bareButton/BareButton.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A button with no look of its own: its children supply every pixel. For
|
|
9
|
+
* making a purely visual component clickable, e.g. as a `render` element:
|
|
10
|
+
* `<SwatchStrip renderItem={(props) => <BareButton {...props} onClick={…} />} />`.
|
|
11
|
+
* Adds only a pointer cursor and a focus ring; Tailwind's preflight already
|
|
12
|
+
* resets the browser's button styles.
|
|
13
|
+
*
|
|
14
|
+
* The ring reads `--j2-focus-ring-width` (2px), `--j2-focus-ring-color` (the
|
|
15
|
+
* primary color) and `--j2-focus-ring-offset` (0px, so a ring isn't covered by
|
|
16
|
+
* a neighbour placed close by). Change it by setting them on the button or
|
|
17
|
+
* any ancestor, with a class such as `[--j2-focus-ring-offset:2px]` or through
|
|
18
|
+
* `style`. A competing `focus-visible:` class isn't reliable: the order of
|
|
19
|
+
* rules in the generated CSS decides which one wins.
|
|
20
|
+
*/
|
|
21
|
+
var BareButton = (0, react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
22
|
+
...props,
|
|
23
|
+
ref,
|
|
24
|
+
type: "button",
|
|
25
|
+
className: (0, classnames.default)("cursor-pointer disabled:cursor-not-allowed focus-visible:[outline:var(--j2-focus-ring-width,2px)_solid_var(--j2-focus-ring-color,var(--j2-color-primary))] focus-visible:[outline-offset:var(--j2-focus-ring-offset,0px)]", className)
|
|
26
|
+
}));
|
|
27
|
+
BareButton.displayName = "BareButton";
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.BareButton = BareButton;
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=BareButton.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BareButton.cjs","names":["forwardRef","cx"],"sources":["../../../../src/components/bareButton/BareButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport cx from 'classnames'\n\nexport type BareButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'type'\n>\n\n/**\n * A button with no look of its own: its children supply every pixel. For\n * making a purely visual component clickable, e.g. as a `render` element:\n * `<SwatchStrip renderItem={(props) => <BareButton {...props} onClick={…} />} />`.\n * Adds only a pointer cursor and a focus ring; Tailwind's preflight already\n * resets the browser's button styles.\n *\n * The ring reads `--j2-focus-ring-width` (2px), `--j2-focus-ring-color` (the\n * primary color) and `--j2-focus-ring-offset` (0px, so a ring isn't covered by\n * a neighbour placed close by). Change it by setting them on the button or\n * any ancestor, with a class such as `[--j2-focus-ring-offset:2px]` or through\n * `style`. A competing `focus-visible:` class isn't reliable: the order of\n * rules in the generated CSS decides which one wins.\n */\nexport const BareButton = forwardRef<HTMLButtonElement, BareButtonProps>(\n ({ className, ...props }, ref) => (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n className={cx(\n 'cursor-pointer disabled:cursor-not-allowed focus-visible:[outline:var(--j2-focus-ring-width,2px)_solid_var(--j2-focus-ring-color,var(--j2-color-primary))] focus-visible:[outline-offset:var(--j2-focus-ring-offset,0px)]',\n className\n )}\n />\n )\n)\nBareButton.displayName = 'BareButton'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,cAAA,GAAaA,MAAAA,WAAAA,EACvB,EAAE,WAAW,GAAG,SAAS,QACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;CACE,GAAI;CACC;CACL,MAAK;CACL,YAAA,GAAWC,WAAAA,QAAAA,CACT,6NACA,SACF;AACD,CAAA,CAEL;AACA,WAAW,cAAc"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type BareButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>;
|
|
2
|
+
/**
|
|
3
|
+
* A button with no look of its own: its children supply every pixel. For
|
|
4
|
+
* making a purely visual component clickable, e.g. as a `render` element:
|
|
5
|
+
* `<SwatchStrip renderItem={(props) => <BareButton {...props} onClick={…} />} />`.
|
|
6
|
+
* Adds only a pointer cursor and a focus ring; Tailwind's preflight already
|
|
7
|
+
* resets the browser's button styles.
|
|
8
|
+
*
|
|
9
|
+
* The ring reads `--j2-focus-ring-width` (2px), `--j2-focus-ring-color` (the
|
|
10
|
+
* primary color) and `--j2-focus-ring-offset` (0px, so a ring isn't covered by
|
|
11
|
+
* a neighbour placed close by). Change it by setting them on the button or
|
|
12
|
+
* any ancestor, with a class such as `[--j2-focus-ring-offset:2px]` or through
|
|
13
|
+
* `style`. A competing `focus-visible:` class isn't reliable: the order of
|
|
14
|
+
* rules in the generated CSS decides which one wins.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BareButton: import('react').ForwardRefExoticComponent<BareButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
//#region src/components/bareButton/BareButton.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A button with no look of its own: its children supply every pixel. For
|
|
7
|
+
* making a purely visual component clickable, e.g. as a `render` element:
|
|
8
|
+
* `<SwatchStrip renderItem={(props) => <BareButton {...props} onClick={…} />} />`.
|
|
9
|
+
* Adds only a pointer cursor and a focus ring; Tailwind's preflight already
|
|
10
|
+
* resets the browser's button styles.
|
|
11
|
+
*
|
|
12
|
+
* The ring reads `--j2-focus-ring-width` (2px), `--j2-focus-ring-color` (the
|
|
13
|
+
* primary color) and `--j2-focus-ring-offset` (0px, so a ring isn't covered by
|
|
14
|
+
* a neighbour placed close by). Change it by setting them on the button or
|
|
15
|
+
* any ancestor, with a class such as `[--j2-focus-ring-offset:2px]` or through
|
|
16
|
+
* `style`. A competing `focus-visible:` class isn't reliable: the order of
|
|
17
|
+
* rules in the generated CSS decides which one wins.
|
|
18
|
+
*/
|
|
19
|
+
var BareButton = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("button", {
|
|
20
|
+
...props,
|
|
21
|
+
ref,
|
|
22
|
+
type: "button",
|
|
23
|
+
className: cx("cursor-pointer disabled:cursor-not-allowed focus-visible:[outline:var(--j2-focus-ring-width,2px)_solid_var(--j2-focus-ring-color,var(--j2-color-primary))] focus-visible:[outline-offset:var(--j2-focus-ring-offset,0px)]", className)
|
|
24
|
+
}));
|
|
25
|
+
BareButton.displayName = "BareButton";
|
|
26
|
+
//#endregion
|
|
27
|
+
export { BareButton };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=BareButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BareButton.js","names":[],"sources":["../../../../src/components/bareButton/BareButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport cx from 'classnames'\n\nexport type BareButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'type'\n>\n\n/**\n * A button with no look of its own: its children supply every pixel. For\n * making a purely visual component clickable, e.g. as a `render` element:\n * `<SwatchStrip renderItem={(props) => <BareButton {...props} onClick={…} />} />`.\n * Adds only a pointer cursor and a focus ring; Tailwind's preflight already\n * resets the browser's button styles.\n *\n * The ring reads `--j2-focus-ring-width` (2px), `--j2-focus-ring-color` (the\n * primary color) and `--j2-focus-ring-offset` (0px, so a ring isn't covered by\n * a neighbour placed close by). Change it by setting them on the button or\n * any ancestor, with a class such as `[--j2-focus-ring-offset:2px]` or through\n * `style`. A competing `focus-visible:` class isn't reliable: the order of\n * rules in the generated CSS decides which one wins.\n */\nexport const BareButton = forwardRef<HTMLButtonElement, BareButtonProps>(\n ({ className, ...props }, ref) => (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n className={cx(\n 'cursor-pointer disabled:cursor-not-allowed focus-visible:[outline:var(--j2-focus-ring-width,2px)_solid_var(--j2-focus-ring-color,var(--j2-color-primary))] focus-visible:[outline-offset:var(--j2-focus-ring-offset,0px)]',\n className\n )}\n />\n )\n)\nBareButton.displayName = 'BareButton'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,IAAa,aAAa,YACvB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,UAAD;CACE,GAAI;CACC;CACL,MAAK;CACL,WAAW,GACT,6NACA,SACF;AACD,CAAA,CAEL;AACA,WAAW,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BareButton, type BareButtonProps } from './BareButton.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_Swatch = require("../swatch/Swatch.cjs");
|
|
3
|
+
const require_useRender = require("../../utils/useRender.cjs");
|
|
3
4
|
let react = require("react");
|
|
4
5
|
let _phosphor_icons_react = require("@phosphor-icons/react");
|
|
5
6
|
_phosphor_icons_react = require_runtime.__toESM(_phosphor_icons_react, 1);
|
|
@@ -10,39 +11,44 @@ classnames = require_runtime.__toESM(classnames, 1);
|
|
|
10
11
|
/**
|
|
11
12
|
* A compact chip for one change: an optional swatch, a label and a delta.
|
|
12
13
|
* It is a button, so it can open a popover with the details; wrap it in a
|
|
13
|
-
* `Popover` (it forwards its ref and handlers).
|
|
14
|
+
* `Popover` (it forwards its ref and handlers). Pass `render={<span />}` for
|
|
15
|
+
* a chip that only displays. The ref is an `HTMLElement`, since `render` can
|
|
16
|
+
* swap the button for another element.
|
|
14
17
|
*/
|
|
15
|
-
var ChangeChip = (0, react.forwardRef)(({ swatch, label, delta, placeholder, srLabel, className, ...props }, ref) => {
|
|
18
|
+
var ChangeChip = (0, react.forwardRef)(({ swatch, label, delta, placeholder, srLabel, className, render, ...props }, ref) => {
|
|
16
19
|
const Arrow = delta?.direction === "down" ? _phosphor_icons_react.ArrowDownIcon : _phosphor_icons_react.ArrowUpIcon;
|
|
17
|
-
return
|
|
18
|
-
|
|
20
|
+
return require_useRender.useRender({
|
|
21
|
+
render,
|
|
19
22
|
ref,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
state: {},
|
|
24
|
+
defaultTagName: "button",
|
|
25
|
+
props: require_useRender.mergeProps(props, {
|
|
26
|
+
className: (0, classnames.default)("inline-flex items-center gap-1 whitespace-nowrap rounded-j2-sm border border-j2-border bg-[var(--j2-color-fill-quaternary)] px-2 py-px text-xs text-j2-text transition-colors enabled:cursor-pointer enabled:hover:bg-j2-gray-2", className),
|
|
27
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
28
|
+
swatch && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Swatch.Swatch, {
|
|
29
|
+
...swatch,
|
|
30
|
+
size: 12
|
|
31
|
+
}),
|
|
32
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label }),
|
|
33
|
+
delta && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
34
|
+
className: "inline-flex items-center gap-0.5 font-medium",
|
|
35
|
+
style: { color: delta.color ?? "var(--j2-color-primary)" },
|
|
36
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Arrow, {
|
|
37
|
+
size: 11,
|
|
38
|
+
weight: "bold",
|
|
39
|
+
"aria-hidden": true
|
|
40
|
+
}), delta.value]
|
|
41
|
+
}),
|
|
42
|
+
!delta && placeholder && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
43
|
+
className: "text-j2-text-secondary",
|
|
44
|
+
children: placeholder
|
|
45
|
+
}),
|
|
46
|
+
srLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47
|
+
className: "sr-only",
|
|
48
|
+
children: srLabel
|
|
49
|
+
})
|
|
50
|
+
] })
|
|
51
|
+
})
|
|
46
52
|
});
|
|
47
53
|
});
|
|
48
54
|
ChangeChip.displayName = "ChangeChip";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeChip.cjs","names":["forwardRef","ArrowDownIcon","ArrowUpIcon","cx","Swatch"],"sources":["../../../../src/components/changeChip/ChangeChip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport cx from 'classnames'\nimport { ArrowDownIcon, ArrowUpIcon } from '@phosphor-icons/react'\n\nimport { Swatch, type
|
|
1
|
+
{"version":3,"file":"ChangeChip.cjs","names":["forwardRef","ArrowDownIcon","ArrowUpIcon","useRender","mergeProps","cx","_Fragment","Swatch"],"sources":["../../../../src/components/changeChip/ChangeChip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport cx from 'classnames'\nimport { ArrowDownIcon, ArrowUpIcon } from '@phosphor-icons/react'\n\nimport { Swatch, type SwatchVisualProps } from '../swatch'\nimport { mergeProps, useRender, type RenderProp } from '../../utils/useRender'\n\nexport type ChangeChipProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'type'\n> & {\n /** A leading swatch, e.g. the kind of change. */\n swatch?: Omit<SwatchVisualProps, 'size'>\n /** What changed, e.g. an area's name. */\n label?: React.ReactNode\n /** How much it changed. */\n delta?: {\n direction: 'up' | 'down'\n value: React.ReactNode\n /** Text color for the arrow and value. Defaults to the primary color. */\n color?: string\n }\n /** Trailing text when there is no delta to show, e.g. an em dash. */\n placeholder?: React.ReactNode\n /** A full description for assistive tech, when the visible text is terse. */\n srLabel?: string\n /**\n * Replaces the button, e.g. `<span />` for a chip that opens nothing. The\n * hover and pointer apply only while the element is an enabled button. A\n * render function should spread its props: a wrapping `Popover` passes its\n * handlers through them.\n */\n render?: RenderProp<Record<string, never>>\n}\n\n/**\n * A compact chip for one change: an optional swatch, a label and a delta.\n * It is a button, so it can open a popover with the details; wrap it in a\n * `Popover` (it forwards its ref and handlers). Pass `render={<span />}` for\n * a chip that only displays. The ref is an `HTMLElement`, since `render` can\n * swap the button for another element.\n */\nexport const ChangeChip = forwardRef<HTMLElement, ChangeChipProps>(\n (\n { swatch, label, delta, placeholder, srLabel, className, render, ...props },\n ref\n ) => {\n const Arrow = delta?.direction === 'down' ? ArrowDownIcon : ArrowUpIcon\n return useRender({\n render,\n ref,\n state: {},\n defaultTagName: 'button',\n props: mergeProps(props, {\n className: cx(\n 'inline-flex items-center gap-1 whitespace-nowrap rounded-j2-sm border border-j2-border bg-[var(--j2-color-fill-quaternary)] px-2 py-px text-xs text-j2-text transition-colors enabled:cursor-pointer enabled:hover:bg-j2-gray-2',\n className\n ),\n children: (\n <>\n {swatch && <Swatch {...swatch} size={12} />}\n {label && <span>{label}</span>}\n {delta && (\n <span\n className=\"inline-flex items-center gap-0.5 font-medium\"\n style={{ color: delta.color ?? 'var(--j2-color-primary)' }}\n >\n <Arrow size={11} weight=\"bold\" aria-hidden />\n {delta.value}\n </span>\n )}\n {!delta && placeholder && (\n <span className=\"text-j2-text-secondary\">{placeholder}</span>\n )}\n {srLabel && <span className=\"sr-only\">{srLabel}</span>}\n </>\n ),\n }),\n })\n }\n)\nChangeChip.displayName = 'ChangeChip'\n"],"mappings":";;;;;;;;;;;;;;;;;AA0CA,IAAa,cAAA,GAAaA,MAAAA,WAAAA,EAEtB,EAAE,QAAQ,OAAO,OAAO,aAAa,SAAS,WAAW,QAAQ,GAAG,SACpE,QACG;CACH,MAAM,QAAQ,OAAO,cAAc,SAASC,sBAAAA,gBAAgBC,sBAAAA;CAC5D,OAAOC,kBAAAA,UAAU;EACf;EACA;EACA,OAAO,CAAC;EACR,gBAAgB;EAChB,OAAOC,kBAAAA,WAAW,OAAO;GACvB,YAAA,GAAWC,WAAAA,QAAAA,CACT,mOACA,SACF;GACA,UACE,iBAAA,GAAA,kBAAA,KAAA,CAAAC,kBAAAA,UAAA,EAAA,UAAA;IACG,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAACC,eAAAA,QAAD;KAAQ,GAAI;KAAQ,MAAM;IAAK,CAAA;IACzC,SAAS,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAA,UAAO,MAAY,CAAA;IAC5B,SACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;KACE,WAAU;KACV,OAAO,EAAE,OAAO,MAAM,SAAS,0BAA0B;KAF3D,UAAA,CAIE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;MAAO,MAAM;MAAI,QAAO;MAAO,eAAA;KAAa,CAAA,GAC3C,MAAM,KACH;;IAEP,CAAC,SAAS,eACT,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAU;KAA0B,UAAA;IAAkB,CAAA;IAE7D,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAU;KAAW,UAAA;IAAc,CAAA;GACrD,EAAA,CAAA;EAEN,CAAC;CACH,CAAC;AACH,CACF;AACA,WAAW,cAAc"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SwatchVisualProps } from '../swatch/index.js';
|
|
2
|
+
import { RenderProp } from '../../utils/useRender.js';
|
|
2
3
|
export type ChangeChipProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> & {
|
|
3
4
|
/** A leading swatch, e.g. the kind of change. */
|
|
4
|
-
swatch?: Omit<
|
|
5
|
+
swatch?: Omit<SwatchVisualProps, 'size'>;
|
|
5
6
|
/** What changed, e.g. an area's name. */
|
|
6
7
|
label?: React.ReactNode;
|
|
7
8
|
/** How much it changed. */
|
|
@@ -15,15 +16,24 @@ export type ChangeChipProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
15
16
|
placeholder?: React.ReactNode;
|
|
16
17
|
/** A full description for assistive tech, when the visible text is terse. */
|
|
17
18
|
srLabel?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Replaces the button, e.g. `<span />` for a chip that opens nothing. The
|
|
21
|
+
* hover and pointer apply only while the element is an enabled button. A
|
|
22
|
+
* render function should spread its props: a wrapping `Popover` passes its
|
|
23
|
+
* handlers through them.
|
|
24
|
+
*/
|
|
25
|
+
render?: RenderProp<Record<string, never>>;
|
|
18
26
|
};
|
|
19
27
|
/**
|
|
20
28
|
* A compact chip for one change: an optional swatch, a label and a delta.
|
|
21
29
|
* It is a button, so it can open a popover with the details; wrap it in a
|
|
22
|
-
* `Popover` (it forwards its ref and handlers).
|
|
30
|
+
* `Popover` (it forwards its ref and handlers). Pass `render={<span />}` for
|
|
31
|
+
* a chip that only displays. The ref is an `HTMLElement`, since `render` can
|
|
32
|
+
* swap the button for another element.
|
|
23
33
|
*/
|
|
24
34
|
export declare const ChangeChip: import('react').ForwardRefExoticComponent<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "type"> & {
|
|
25
35
|
/** A leading swatch, e.g. the kind of change. */
|
|
26
|
-
swatch?: Omit<
|
|
36
|
+
swatch?: Omit<SwatchVisualProps, "size">;
|
|
27
37
|
/** What changed, e.g. an area's name. */
|
|
28
38
|
label?: React.ReactNode;
|
|
29
39
|
/** How much it changed. */
|
|
@@ -37,4 +47,11 @@ export declare const ChangeChip: import('react').ForwardRefExoticComponent<Omit<
|
|
|
37
47
|
placeholder?: React.ReactNode;
|
|
38
48
|
/** A full description for assistive tech, when the visible text is terse. */
|
|
39
49
|
srLabel?: string;
|
|
40
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Replaces the button, e.g. `<span />` for a chip that opens nothing. The
|
|
52
|
+
* hover and pointer apply only while the element is an enabled button. A
|
|
53
|
+
* render function should spread its props: a wrapping `Popover` passes its
|
|
54
|
+
* handlers through them.
|
|
55
|
+
*/
|
|
56
|
+
render?: RenderProp<Record<string, never>>;
|
|
57
|
+
} & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -1,45 +1,51 @@
|
|
|
1
1
|
import { Swatch } from "../swatch/Swatch.js";
|
|
2
|
+
import { mergeProps, useRender } from "../../utils/useRender.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { ArrowDownIcon, ArrowUpIcon } from "@phosphor-icons/react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import cx from "classnames";
|
|
6
7
|
//#region src/components/changeChip/ChangeChip.tsx
|
|
7
8
|
/**
|
|
8
9
|
* A compact chip for one change: an optional swatch, a label and a delta.
|
|
9
10
|
* It is a button, so it can open a popover with the details; wrap it in a
|
|
10
|
-
* `Popover` (it forwards its ref and handlers).
|
|
11
|
+
* `Popover` (it forwards its ref and handlers). Pass `render={<span />}` for
|
|
12
|
+
* a chip that only displays. The ref is an `HTMLElement`, since `render` can
|
|
13
|
+
* swap the button for another element.
|
|
11
14
|
*/
|
|
12
|
-
var ChangeChip = forwardRef(({ swatch, label, delta, placeholder, srLabel, className, ...props }, ref) => {
|
|
15
|
+
var ChangeChip = forwardRef(({ swatch, label, delta, placeholder, srLabel, className, render, ...props }, ref) => {
|
|
13
16
|
const Arrow = delta?.direction === "down" ? ArrowDownIcon : ArrowUpIcon;
|
|
14
|
-
return
|
|
15
|
-
|
|
17
|
+
return useRender({
|
|
18
|
+
render,
|
|
16
19
|
ref,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
state: {},
|
|
21
|
+
defaultTagName: "button",
|
|
22
|
+
props: mergeProps(props, {
|
|
23
|
+
className: cx("inline-flex items-center gap-1 whitespace-nowrap rounded-j2-sm border border-j2-border bg-[var(--j2-color-fill-quaternary)] px-2 py-px text-xs text-j2-text transition-colors enabled:cursor-pointer enabled:hover:bg-j2-gray-2", className),
|
|
24
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
25
|
+
swatch && /* @__PURE__ */ jsx(Swatch, {
|
|
26
|
+
...swatch,
|
|
27
|
+
size: 12
|
|
28
|
+
}),
|
|
29
|
+
label && /* @__PURE__ */ jsx("span", { children: label }),
|
|
30
|
+
delta && /* @__PURE__ */ jsxs("span", {
|
|
31
|
+
className: "inline-flex items-center gap-0.5 font-medium",
|
|
32
|
+
style: { color: delta.color ?? "var(--j2-color-primary)" },
|
|
33
|
+
children: [/* @__PURE__ */ jsx(Arrow, {
|
|
34
|
+
size: 11,
|
|
35
|
+
weight: "bold",
|
|
36
|
+
"aria-hidden": true
|
|
37
|
+
}), delta.value]
|
|
38
|
+
}),
|
|
39
|
+
!delta && placeholder && /* @__PURE__ */ jsx("span", {
|
|
40
|
+
className: "text-j2-text-secondary",
|
|
41
|
+
children: placeholder
|
|
42
|
+
}),
|
|
43
|
+
srLabel && /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "sr-only",
|
|
45
|
+
children: srLabel
|
|
46
|
+
})
|
|
47
|
+
] })
|
|
48
|
+
})
|
|
43
49
|
});
|
|
44
50
|
});
|
|
45
51
|
ChangeChip.displayName = "ChangeChip";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeChip.js","names":[],"sources":["../../../../src/components/changeChip/ChangeChip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport cx from 'classnames'\nimport { ArrowDownIcon, ArrowUpIcon } from '@phosphor-icons/react'\n\nimport { Swatch, type
|
|
1
|
+
{"version":3,"file":"ChangeChip.js","names":["_Fragment"],"sources":["../../../../src/components/changeChip/ChangeChip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport cx from 'classnames'\nimport { ArrowDownIcon, ArrowUpIcon } from '@phosphor-icons/react'\n\nimport { Swatch, type SwatchVisualProps } from '../swatch'\nimport { mergeProps, useRender, type RenderProp } from '../../utils/useRender'\n\nexport type ChangeChipProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'type'\n> & {\n /** A leading swatch, e.g. the kind of change. */\n swatch?: Omit<SwatchVisualProps, 'size'>\n /** What changed, e.g. an area's name. */\n label?: React.ReactNode\n /** How much it changed. */\n delta?: {\n direction: 'up' | 'down'\n value: React.ReactNode\n /** Text color for the arrow and value. Defaults to the primary color. */\n color?: string\n }\n /** Trailing text when there is no delta to show, e.g. an em dash. */\n placeholder?: React.ReactNode\n /** A full description for assistive tech, when the visible text is terse. */\n srLabel?: string\n /**\n * Replaces the button, e.g. `<span />` for a chip that opens nothing. The\n * hover and pointer apply only while the element is an enabled button. A\n * render function should spread its props: a wrapping `Popover` passes its\n * handlers through them.\n */\n render?: RenderProp<Record<string, never>>\n}\n\n/**\n * A compact chip for one change: an optional swatch, a label and a delta.\n * It is a button, so it can open a popover with the details; wrap it in a\n * `Popover` (it forwards its ref and handlers). Pass `render={<span />}` for\n * a chip that only displays. The ref is an `HTMLElement`, since `render` can\n * swap the button for another element.\n */\nexport const ChangeChip = forwardRef<HTMLElement, ChangeChipProps>(\n (\n { swatch, label, delta, placeholder, srLabel, className, render, ...props },\n ref\n ) => {\n const Arrow = delta?.direction === 'down' ? ArrowDownIcon : ArrowUpIcon\n return useRender({\n render,\n ref,\n state: {},\n defaultTagName: 'button',\n props: mergeProps(props, {\n className: cx(\n 'inline-flex items-center gap-1 whitespace-nowrap rounded-j2-sm border border-j2-border bg-[var(--j2-color-fill-quaternary)] px-2 py-px text-xs text-j2-text transition-colors enabled:cursor-pointer enabled:hover:bg-j2-gray-2',\n className\n ),\n children: (\n <>\n {swatch && <Swatch {...swatch} size={12} />}\n {label && <span>{label}</span>}\n {delta && (\n <span\n className=\"inline-flex items-center gap-0.5 font-medium\"\n style={{ color: delta.color ?? 'var(--j2-color-primary)' }}\n >\n <Arrow size={11} weight=\"bold\" aria-hidden />\n {delta.value}\n </span>\n )}\n {!delta && placeholder && (\n <span className=\"text-j2-text-secondary\">{placeholder}</span>\n )}\n {srLabel && <span className=\"sr-only\">{srLabel}</span>}\n </>\n ),\n }),\n })\n }\n)\nChangeChip.displayName = 'ChangeChip'\n"],"mappings":";;;;;;;;;;;;;;AA0CA,IAAa,aAAa,YAEtB,EAAE,QAAQ,OAAO,OAAO,aAAa,SAAS,WAAW,QAAQ,GAAG,SACpE,QACG;CACH,MAAM,QAAQ,OAAO,cAAc,SAAS,gBAAgB;CAC5D,OAAO,UAAU;EACf;EACA;EACA,OAAO,CAAC;EACR,gBAAgB;EAChB,OAAO,WAAW,OAAO;GACvB,WAAW,GACT,mOACA,SACF;GACA,UACE,qBAAAA,YAAA,EAAA,UAAA;IACG,UAAU,oBAAC,QAAD;KAAQ,GAAI;KAAQ,MAAM;IAAK,CAAA;IACzC,SAAS,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;IAC5B,SACC,qBAAC,QAAD;KACE,WAAU;KACV,OAAO,EAAE,OAAO,MAAM,SAAS,0BAA0B;KAF3D,UAAA,CAIE,oBAAC,OAAD;MAAO,MAAM;MAAI,QAAO;MAAO,eAAA;KAAa,CAAA,GAC3C,MAAM,KACH;;IAEP,CAAC,SAAS,eACT,oBAAC,QAAD;KAAM,WAAU;KAA0B,UAAA;IAAkB,CAAA;IAE7D,WAAW,oBAAC,QAAD;KAAM,WAAU;KAAW,UAAA;IAAc,CAAA;GACrD,EAAA,CAAA;EAEN,CAAC;CACH,CAAC;AACH,CACF;AACA,WAAW,cAAc"}
|
|
@@ -293,11 +293,11 @@ export declare const AntdInput: import('react').ForwardRefExoticComponent<{
|
|
|
293
293
|
prefixCls?: string | undefined;
|
|
294
294
|
list?: string | undefined | undefined;
|
|
295
295
|
step?: number | string | undefined | undefined;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
296
|
+
formAction?: string | ((formData: FormData) => void | Promise<void>) | undefined;
|
|
297
|
+
formEncType?: string | undefined | undefined;
|
|
298
|
+
formMethod?: string | undefined | undefined;
|
|
299
|
+
formNoValidate?: boolean | undefined | undefined;
|
|
300
|
+
formTarget?: string | undefined | undefined;
|
|
301
301
|
defaultChecked?: boolean | undefined | undefined;
|
|
302
302
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
303
303
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -307,10 +307,14 @@ export declare const AntdInput: import('react').ForwardRefExoticComponent<{
|
|
|
307
307
|
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
308
308
|
contextMenu?: string | undefined | undefined;
|
|
309
309
|
dir?: string | undefined | undefined;
|
|
310
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
310
311
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
312
|
+
hidden?: boolean | undefined | undefined;
|
|
311
313
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
314
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
312
315
|
radioGroup?: string | undefined | undefined;
|
|
313
316
|
about?: string | undefined | undefined;
|
|
317
|
+
content?: string | undefined | undefined;
|
|
314
318
|
datatype?: string | undefined | undefined;
|
|
315
319
|
inlist?: any;
|
|
316
320
|
prefix?: import('react').ReactNode;
|
|
@@ -337,11 +341,7 @@ export declare const AntdInput: import('react').ForwardRefExoticComponent<{
|
|
|
337
341
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
338
342
|
is?: string | undefined | undefined;
|
|
339
343
|
exportparts?: string | undefined | undefined;
|
|
340
|
-
|
|
341
|
-
formEncType?: string | undefined | undefined;
|
|
342
|
-
formMethod?: string | undefined | undefined;
|
|
343
|
-
formNoValidate?: boolean | undefined | undefined;
|
|
344
|
-
formTarget?: string | undefined | undefined;
|
|
344
|
+
multiple?: boolean | undefined | undefined;
|
|
345
345
|
count?: import('@rc-component/input/lib/interface').CountConfig | undefined;
|
|
346
346
|
placeholder?: string | undefined | undefined;
|
|
347
347
|
checked?: boolean | undefined | undefined;
|
|
@@ -305,11 +305,11 @@ export declare const AntdSearchInput: import('react').ForwardRefExoticComponent<
|
|
|
305
305
|
prefixCls?: string | undefined;
|
|
306
306
|
list?: string | undefined | undefined;
|
|
307
307
|
step?: number | string | undefined | undefined;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
308
|
+
formAction?: string | ((formData: FormData) => void | Promise<void>) | undefined;
|
|
309
|
+
formEncType?: string | undefined | undefined;
|
|
310
|
+
formMethod?: string | undefined | undefined;
|
|
311
|
+
formNoValidate?: boolean | undefined | undefined;
|
|
312
|
+
formTarget?: string | undefined | undefined;
|
|
313
313
|
defaultChecked?: boolean | undefined | undefined;
|
|
314
314
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
315
315
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -319,10 +319,14 @@ export declare const AntdSearchInput: import('react').ForwardRefExoticComponent<
|
|
|
319
319
|
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
320
320
|
contextMenu?: string | undefined | undefined;
|
|
321
321
|
dir?: string | undefined | undefined;
|
|
322
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
322
323
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
324
|
+
hidden?: boolean | undefined | undefined;
|
|
323
325
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
326
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
324
327
|
radioGroup?: string | undefined | undefined;
|
|
325
328
|
about?: string | undefined | undefined;
|
|
329
|
+
content?: string | undefined | undefined;
|
|
326
330
|
datatype?: string | undefined | undefined;
|
|
327
331
|
inlist?: any;
|
|
328
332
|
prefix?: import('react').ReactNode;
|
|
@@ -349,11 +353,7 @@ export declare const AntdSearchInput: import('react').ForwardRefExoticComponent<
|
|
|
349
353
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
350
354
|
is?: string | undefined | undefined;
|
|
351
355
|
exportparts?: string | undefined | undefined;
|
|
352
|
-
|
|
353
|
-
formEncType?: string | undefined | undefined;
|
|
354
|
-
formMethod?: string | undefined | undefined;
|
|
355
|
-
formNoValidate?: boolean | undefined | undefined;
|
|
356
|
-
formTarget?: string | undefined | undefined;
|
|
356
|
+
multiple?: boolean | undefined | undefined;
|
|
357
357
|
count?: import('@rc-component/input/lib/interface').CountConfig | undefined;
|
|
358
358
|
placeholder?: string | undefined | undefined;
|
|
359
359
|
checked?: boolean | undefined | undefined;
|