@j2-health/design-system 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +10 -9
  2. package/dist/index.cjs +4 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +3 -1
  5. package/dist/index2.js +3 -1
  6. package/dist/src/components/bareButton/BareButton.cjs +31 -0
  7. package/dist/src/components/bareButton/BareButton.cjs.map +1 -0
  8. package/dist/src/components/bareButton/BareButton.d.ts +16 -0
  9. package/dist/src/components/bareButton/BareButton.js +29 -0
  10. package/dist/src/components/bareButton/BareButton.js.map +1 -0
  11. package/dist/src/components/bareButton/index.d.ts +1 -0
  12. package/dist/src/components/changeChip/ChangeChip.cjs +36 -30
  13. package/dist/src/components/changeChip/ChangeChip.cjs.map +1 -1
  14. package/dist/src/components/changeChip/ChangeChip.d.ts +22 -5
  15. package/dist/src/components/changeChip/ChangeChip.js +37 -31
  16. package/dist/src/components/changeChip/ChangeChip.js.map +1 -1
  17. package/dist/src/components/input/AntdInput.d.ts +10 -10
  18. package/dist/src/components/input/AntdSearchInput.d.ts +10 -10
  19. package/dist/src/components/select/SummarizedSelect.cjs +11 -2
  20. package/dist/src/components/select/SummarizedSelect.cjs.map +1 -1
  21. package/dist/src/components/select/SummarizedSelect.d.ts +10 -3
  22. package/dist/src/components/select/SummarizedSelect.js +11 -2
  23. package/dist/src/components/select/SummarizedSelect.js.map +1 -1
  24. package/dist/src/components/select/SummarizedSelect.module.css.cjs +10 -10
  25. package/dist/src/components/select/SummarizedSelect.module.css.cjs.map +1 -1
  26. package/dist/src/components/select/SummarizedSelect.module.css.js +10 -10
  27. package/dist/src/components/select/SummarizedSelect.module.css.js.map +1 -1
  28. package/dist/src/components/swatch/Swatch.cjs +12 -6
  29. package/dist/src/components/swatch/Swatch.cjs.map +1 -1
  30. package/dist/src/components/swatch/Swatch.d.ts +10 -3
  31. package/dist/src/components/swatch/Swatch.js +12 -6
  32. package/dist/src/components/swatch/Swatch.js.map +1 -1
  33. package/dist/src/components/swatch/index.d.ts +1 -1
  34. package/dist/src/components/swatchStrip/SwatchStrip.cjs +67 -28
  35. package/dist/src/components/swatchStrip/SwatchStrip.cjs.map +1 -1
  36. package/dist/src/components/swatchStrip/SwatchStrip.d.ts +56 -5
  37. package/dist/src/components/swatchStrip/SwatchStrip.js +67 -28
  38. package/dist/src/components/swatchStrip/SwatchStrip.js.map +1 -1
  39. package/dist/src/components/swatchStrip/index.d.ts +1 -1
  40. package/dist/src/utils/useRender.cjs +76 -0
  41. package/dist/src/utils/useRender.cjs.map +1 -0
  42. package/dist/src/utils/useRender.d.ts +29 -0
  43. package/dist/src/utils/useRender.js +73 -0
  44. package/dist/src/utils/useRender.js.map +1 -0
  45. package/dist/style.css +33 -37
  46. package/package.json +15 -16
package/README.md CHANGED
@@ -201,12 +201,15 @@ consequences worth knowing before you change anything here:
201
201
  11.5.1, which is exactly what Node 24.5.0 ships. The workflow asserts this
202
202
  rather than letting it surface later as an unexplained 401.
203
203
 
204
- To release a new version — maintainers only, since step 2 needs write access to
205
- this repository:
204
+ To release a new version, bump `version` in `package.json` in a pull request —
205
+ on its own, or in the PR carrying the change you want to release — and merge it.
206
+ That is the whole procedure: the merge to `main` triggers the publish workflow,
207
+ which checks that `version` changed and is not already on npm, then publishes it
208
+ and creates the matching `vX.Y.Z` tag. A merge that touches `package.json`
209
+ without changing `version` (a dependency bump, say) publishes nothing.
206
210
 
207
- 1. Bump `version` in `package.json` in a pull request — on its own, or in the PR
208
- carrying the change you want to release — and merge it.
209
- 2. Dispatch the publish workflow against `main`:
211
+ If an automatic release needs re-running, dispatch the workflow against `main` —
212
+ maintainers only, since it needs write access to this repository:
210
213
 
211
214
  ```bash
212
215
  $ gh workflow run publish-workflow.yml --ref main
@@ -217,10 +220,8 @@ Pick the ref carefully: the publish job is _skipped_ rather than failed on any
217
220
  other ref, so a dispatch from a feature branch reports success without
218
221
  publishing.
219
222
 
220
- That is the whole procedure. The workflow publishes the version `package.json`
221
- declares and then creates the matching `vX.Y.Z` tag itself, so you do not
222
- normally tag by hand — the `tag` job's own comments cover the one case that
223
- needs it, where publishing succeeds and tagging fails.
223
+ You do not normally tag by hand — the `tag` job's own comments cover the one
224
+ case that needs it, where publishing succeeds and tagging fails.
224
225
 
225
226
  `npm version` is not the tool here, despite being the obvious one: it writes the
226
227
  bump as a local commit, and `main` requires a pull request, so that commit has
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");
@@ -67,6 +69,7 @@ exports.AntdSearchInput = require_AntdSearchInput.AntdSearchInput;
67
69
  exports.AntdSelect = require_AntdSelect.AntdSelect;
68
70
  exports.AppConfigProvider = require_AppConfigProvider.AppConfigProvider;
69
71
  exports.BarChart = require_BarChart.BarChart;
72
+ exports.BareButton = require_BareButton.BareButton;
70
73
  exports.Breadcrumb = require_Breadcrumb.Breadcrumb;
71
74
  exports.BulkActionBar = require_BulkActionBar.BulkActionBar;
72
75
  exports.Button = require_Button.Button;
@@ -128,6 +131,7 @@ Object.defineProperty(exports, "icons", {
128
131
  }
129
132
  });
130
133
  exports.isMultiValueTextOperator = require_filterHelpers.isMultiValueTextOperator;
134
+ exports.mergeProps = require_useRender.mergeProps;
131
135
  exports.normalizeMultiValues = require_filterHelpers.normalizeMultiValues;
132
136
  exports.operatorOptionsFor = require_useFilterField.operatorOptionsFor;
133
137
  exports.tailwindPreset = require_tailwind.tailwindPreset;
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';
@@ -47,5 +48,6 @@ export * from './src/components/thresholdBar/index.js';
47
48
  export * from './src/components/tooltip/index.js';
48
49
  export * from './src/components/vennDiagram/index.js';
49
50
  export * from './src/components/legacyNavMenu/index.js';
51
+ export { mergeProps, type RenderProp, type RenderProps, } from './src/utils/useRender.js';
50
52
  import * as icons from '@phosphor-icons/react';
51
53
  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";
@@ -58,4 +60,4 @@ import { VennDiagram } from "./src/components/vennDiagram/VennDiagram.js";
58
60
  import { UserProfile } from "./src/components/legacyNavMenu/UserProfile.js";
59
61
  import { LegacyNavMenu } from "./src/components/legacyNavMenu/LegacyNavMenu.js";
60
62
  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 };
63
+ 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, Steps, SummarizedSelect, Swatch, SwatchStrip, Switch, Table, Tabs, Tag, ThresholdBar, Tooltip, UserProfile, VennDiagram, appTheme, icons, isMultiValueTextOperator, mergeProps, normalizeMultiValues, operatorOptionsFor, tailwindPreset, useMessage, useNotification, 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";
@@ -58,4 +60,4 @@ import { VennDiagram } from "./src/components/vennDiagram/VennDiagram.js";
58
60
  import { UserProfile } from "./src/components/legacyNavMenu/UserProfile.js";
59
61
  import { LegacyNavMenu } from "./src/components/legacyNavMenu/LegacyNavMenu.js";
60
62
  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 };
63
+ 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, Steps, SummarizedSelect, Swatch, SwatchStrip, Switch, Table, Tabs, Tag, ThresholdBar, Tooltip, UserProfile, VennDiagram, appTheme, icons, isMultiValueTextOperator, mergeProps, normalizeMultiValues, operatorOptionsFor, tailwindPreset, useMessage, useNotification, 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 /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
18
- ...props,
20
+ return require_useRender.useRender({
21
+ render,
19
22
  ref,
20
- type: "button",
21
- className: (0, classnames.default)("inline-flex cursor-pointer 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 hover:bg-j2-gray-2", className),
22
- children: [
23
- swatch && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Swatch.Swatch, {
24
- ...swatch,
25
- size: 12
26
- }),
27
- label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label }),
28
- delta && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
29
- className: "inline-flex items-center gap-0.5 font-medium",
30
- style: { color: delta.color ?? "var(--j2-color-primary)" },
31
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Arrow, {
32
- size: 11,
33
- weight: "bold",
34
- "aria-hidden": true
35
- }), delta.value]
36
- }),
37
- !delta && placeholder && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
38
- className: "text-j2-text-secondary",
39
- children: placeholder
40
- }),
41
- srLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
42
- className: "sr-only",
43
- children: srLabel
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 SwatchProps } from '../swatch'\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<SwatchProps, '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\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).\n */\nexport const ChangeChip = forwardRef<HTMLButtonElement, ChangeChipProps>(\n (\n { swatch, label, delta, placeholder, srLabel, className, ...props },\n ref\n ) => {\n const Arrow = delta?.direction === 'down' ? ArrowDownIcon : ArrowUpIcon\n return (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n className={cx(\n 'inline-flex cursor-pointer 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 hover:bg-j2-gray-2',\n className\n )}\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 </button>\n )\n }\n)\nChangeChip.displayName = 'ChangeChip'\n"],"mappings":";;;;;;;;;;;;;;AAgCA,IAAa,cAAA,GAAaA,MAAAA,WAAAA,EAEtB,EAAE,QAAQ,OAAO,OAAO,aAAa,SAAS,WAAW,GAAG,SAC5D,QACG;CACH,MAAM,QAAQ,OAAO,cAAc,SAASC,sBAAAA,gBAAgBC,sBAAAA;CAC5D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;EACE,GAAI;EACC;EACL,MAAK;EACL,YAAA,GAAWC,WAAAA,QAAAA,CACT,mNACA,SACF;EAPF,UAAA;GASG,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAACC,eAAAA,QAAD;IAAQ,GAAI;IAAQ,MAAM;GAAK,CAAA;GACzC,SAAS,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAA,UAAO,MAAY,CAAA;GAC5B,SACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,OAAO,MAAM,SAAS,0BAA0B;IAF3D,UAAA,CAIE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAO,MAAM;KAAI,QAAO;KAAO,eAAA;IAAa,CAAA,GAC3C,MAAM,KACH;;GAEP,CAAC,SAAS,eACT,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAA0B,UAAA;GAAkB,CAAA;GAE7D,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAAW,UAAA;GAAc,CAAA;EAC/C;;AAEZ,CACF;AACA,WAAW,cAAc"}
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 { SwatchProps } from '../swatch/index.js';
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<SwatchProps, 'size'>;
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<SwatchProps, "size">;
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
- } & import('react').RefAttributes<HTMLButtonElement>>;
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 /* @__PURE__ */ jsxs("button", {
15
- ...props,
17
+ return useRender({
18
+ render,
16
19
  ref,
17
- type: "button",
18
- className: cx("inline-flex cursor-pointer 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 hover:bg-j2-gray-2", className),
19
- children: [
20
- swatch && /* @__PURE__ */ jsx(Swatch, {
21
- ...swatch,
22
- size: 12
23
- }),
24
- label && /* @__PURE__ */ jsx("span", { children: label }),
25
- delta && /* @__PURE__ */ jsxs("span", {
26
- className: "inline-flex items-center gap-0.5 font-medium",
27
- style: { color: delta.color ?? "var(--j2-color-primary)" },
28
- children: [/* @__PURE__ */ jsx(Arrow, {
29
- size: 11,
30
- weight: "bold",
31
- "aria-hidden": true
32
- }), delta.value]
33
- }),
34
- !delta && placeholder && /* @__PURE__ */ jsx("span", {
35
- className: "text-j2-text-secondary",
36
- children: placeholder
37
- }),
38
- srLabel && /* @__PURE__ */ jsx("span", {
39
- className: "sr-only",
40
- children: srLabel
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 SwatchProps } from '../swatch'\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<SwatchProps, '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\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).\n */\nexport const ChangeChip = forwardRef<HTMLButtonElement, ChangeChipProps>(\n (\n { swatch, label, delta, placeholder, srLabel, className, ...props },\n ref\n ) => {\n const Arrow = delta?.direction === 'down' ? ArrowDownIcon : ArrowUpIcon\n return (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n className={cx(\n 'inline-flex cursor-pointer 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 hover:bg-j2-gray-2',\n className\n )}\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 </button>\n )\n }\n)\nChangeChip.displayName = 'ChangeChip'\n"],"mappings":";;;;;;;;;;;AAgCA,IAAa,aAAa,YAEtB,EAAE,QAAQ,OAAO,OAAO,aAAa,SAAS,WAAW,GAAG,SAC5D,QACG;CACH,MAAM,QAAQ,OAAO,cAAc,SAAS,gBAAgB;CAC5D,OACE,qBAAC,UAAD;EACE,GAAI;EACC;EACL,MAAK;EACL,WAAW,GACT,mNACA,SACF;EAPF,UAAA;GASG,UAAU,oBAAC,QAAD;IAAQ,GAAI;IAAQ,MAAM;GAAK,CAAA;GACzC,SAAS,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;GAC5B,SACC,qBAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,OAAO,MAAM,SAAS,0BAA0B;IAF3D,UAAA,CAIE,oBAAC,OAAD;KAAO,MAAM;KAAI,QAAO;KAAO,eAAA;IAAa,CAAA,GAC3C,MAAM,KACH;;GAEP,CAAC,SAAS,eACT,oBAAC,QAAD;IAAM,WAAU;IAA0B,UAAA;GAAkB,CAAA;GAE7D,WAAW,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA;GAAc,CAAA;EAC/C;;AAEZ,CACF;AACA,WAAW,cAAc"}
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
- draggable?: (boolean | "true" | "false") | undefined;
297
- hidden?: boolean | undefined | undefined;
298
- content?: string | undefined | undefined;
299
- multiple?: boolean | undefined | undefined;
300
- translate?: "yes" | "no" | undefined | undefined;
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
- formAction?: string | ((formData: FormData) => void | Promise<void>) | undefined;
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
- draggable?: (boolean | "true" | "false") | undefined;
309
- hidden?: boolean | undefined | undefined;
310
- content?: string | undefined | undefined;
311
- multiple?: boolean | undefined | undefined;
312
- translate?: "yes" | "no" | undefined | undefined;
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
- formAction?: string | ((formData: FormData) => void | Promise<void>) | undefined;
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;