@cocso-ui/react 1.11.0 → 1.12.1

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 (93) hide show
  1. package/dist/cjs/components/breadcrumb/breadcrumb.d.ts +24 -3
  2. package/dist/cjs/components/breadcrumb/breadcrumb.js +44 -2
  3. package/dist/cjs/components/breadcrumb/breadcrumb.module.css.js +2 -2
  4. package/dist/cjs/components/card/card.d.ts +49 -2
  5. package/dist/cjs/components/card/card.js +76 -10
  6. package/dist/cjs/components/card/card.module.css.js +2 -2
  7. package/dist/cjs/components/copy-button/copy-button.d.ts +29 -0
  8. package/dist/cjs/components/copy-button/copy-button.js +67 -0
  9. package/dist/cjs/components/empty-state/empty-state.d.ts +30 -0
  10. package/dist/cjs/components/empty-state/empty-state.js +50 -0
  11. package/dist/cjs/components/empty-state/empty-state.module.css.js +9 -0
  12. package/dist/cjs/components/file-uploader/file-uploader.d.ts +80 -0
  13. package/dist/cjs/components/file-uploader/file-uploader.js +258 -0
  14. package/dist/cjs/components/file-uploader/file-uploader.module.css.js +9 -0
  15. package/dist/cjs/components/form-field/form-field-context.d.ts +31 -0
  16. package/dist/cjs/components/form-field/form-field-context.js +53 -0
  17. package/dist/cjs/components/form-field/form-field-parts.d.ts +52 -0
  18. package/dist/cjs/components/form-field/form-field-parts.js +109 -0
  19. package/dist/cjs/components/form-field/form-field.d.ts +44 -0
  20. package/dist/cjs/components/form-field/form-field.js +61 -0
  21. package/dist/cjs/components/form-field/form-field.module.css.js +9 -0
  22. package/dist/cjs/components/info-popover/info-popover.d.ts +43 -0
  23. package/dist/cjs/components/info-popover/info-popover.js +57 -0
  24. package/dist/cjs/components/info-popover/info-popover.module.css.js +9 -0
  25. package/dist/cjs/components/loading-overlay/loading-overlay.d.ts +33 -0
  26. package/dist/cjs/components/loading-overlay/loading-overlay.js +68 -0
  27. package/dist/cjs/components/loading-overlay/loading-overlay.module.css.js +9 -0
  28. package/dist/cjs/components/number-input/number-input.d.ts +39 -0
  29. package/dist/cjs/components/number-input/number-input.js +167 -0
  30. package/dist/cjs/components/section-header/section-header.d.ts +48 -0
  31. package/dist/cjs/components/section-header/section-header.js +210 -0
  32. package/dist/cjs/components/section-header/section-header.module.css.js +9 -0
  33. package/dist/cjs/components/segmented-control/segmented-control.d.ts +55 -0
  34. package/dist/cjs/components/segmented-control/segmented-control.js +119 -0
  35. package/dist/cjs/components/segmented-control/segmented-control.module.css.js +9 -0
  36. package/dist/cjs/components/selection-chip/selection-chip.d.ts +22 -0
  37. package/dist/cjs/components/selection-chip/selection-chip.js +32 -0
  38. package/dist/cjs/components/selection-chip/selection-chip.module.css.js +9 -0
  39. package/dist/cjs/components/skeleton/skeleton.d.ts +7 -1
  40. package/dist/cjs/components/skeleton/skeleton.js +20 -2
  41. package/dist/cjs/components/skeleton/skeleton.module.css.js +1 -1
  42. package/dist/cjs/components/summary-card/summary-card.d.ts +47 -0
  43. package/dist/cjs/components/summary-card/summary-card.js +89 -0
  44. package/dist/cjs/components/summary-card/summary-card.module.css.js +9 -0
  45. package/dist/cjs/index.d.ts +15 -2
  46. package/dist/cjs/index.js +24 -0
  47. package/dist/esm/components/breadcrumb/breadcrumb.d.mts +24 -3
  48. package/dist/esm/components/breadcrumb/breadcrumb.mjs +44 -2
  49. package/dist/esm/components/breadcrumb/breadcrumb.module.css.mjs +1 -1
  50. package/dist/esm/components/card/card.d.mts +49 -2
  51. package/dist/esm/components/card/card.mjs +76 -10
  52. package/dist/esm/components/card/card.module.css.mjs +1 -1
  53. package/dist/esm/components/copy-button/copy-button.d.mts +29 -0
  54. package/dist/esm/components/copy-button/copy-button.mjs +65 -0
  55. package/dist/esm/components/empty-state/empty-state.d.mts +30 -0
  56. package/dist/esm/components/empty-state/empty-state.mjs +48 -0
  57. package/dist/esm/components/empty-state/empty-state.module.css.mjs +3 -0
  58. package/dist/esm/components/file-uploader/file-uploader.d.mts +80 -0
  59. package/dist/esm/components/file-uploader/file-uploader.mjs +256 -0
  60. package/dist/esm/components/file-uploader/file-uploader.module.css.mjs +3 -0
  61. package/dist/esm/components/form-field/form-field-context.d.mts +31 -0
  62. package/dist/esm/components/form-field/form-field-context.mjs +49 -0
  63. package/dist/esm/components/form-field/form-field-parts.d.mts +52 -0
  64. package/dist/esm/components/form-field/form-field-parts.mjs +105 -0
  65. package/dist/esm/components/form-field/form-field.d.mts +44 -0
  66. package/dist/esm/components/form-field/form-field.mjs +59 -0
  67. package/dist/esm/components/form-field/form-field.module.css.mjs +3 -0
  68. package/dist/esm/components/info-popover/info-popover.d.mts +43 -0
  69. package/dist/esm/components/info-popover/info-popover.mjs +55 -0
  70. package/dist/esm/components/info-popover/info-popover.module.css.mjs +3 -0
  71. package/dist/esm/components/loading-overlay/loading-overlay.d.mts +33 -0
  72. package/dist/esm/components/loading-overlay/loading-overlay.mjs +66 -0
  73. package/dist/esm/components/loading-overlay/loading-overlay.module.css.mjs +3 -0
  74. package/dist/esm/components/number-input/number-input.d.mts +39 -0
  75. package/dist/esm/components/number-input/number-input.mjs +165 -0
  76. package/dist/esm/components/section-header/section-header.d.mts +48 -0
  77. package/dist/esm/components/section-header/section-header.mjs +208 -0
  78. package/dist/esm/components/section-header/section-header.module.css.mjs +3 -0
  79. package/dist/esm/components/segmented-control/segmented-control.d.mts +55 -0
  80. package/dist/esm/components/segmented-control/segmented-control.mjs +117 -0
  81. package/dist/esm/components/segmented-control/segmented-control.module.css.mjs +3 -0
  82. package/dist/esm/components/selection-chip/selection-chip.d.mts +22 -0
  83. package/dist/esm/components/selection-chip/selection-chip.mjs +30 -0
  84. package/dist/esm/components/selection-chip/selection-chip.module.css.mjs +3 -0
  85. package/dist/esm/components/skeleton/skeleton.d.mts +7 -1
  86. package/dist/esm/components/skeleton/skeleton.mjs +20 -2
  87. package/dist/esm/components/summary-card/summary-card.d.mts +47 -0
  88. package/dist/esm/components/summary-card/summary-card.mjs +87 -0
  89. package/dist/esm/components/summary-card/summary-card.module.css.mjs +3 -0
  90. package/dist/esm/index.css +2 -2
  91. package/dist/esm/index.d.mts +15 -2
  92. package/dist/esm/index.mjs +12 -0
  93. package/package.json +1 -1
@@ -0,0 +1,55 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type SegmentedControlSize = "medium" | "small";
5
+ interface SegmentedControlOption<T extends string> {
6
+ /**
7
+ * One line under the label. When any option has one, every segment grows to
8
+ * two lines so the control keeps a single height.
9
+ */
10
+ description?: string;
11
+ label: string;
12
+ value: T;
13
+ }
14
+ interface SegmentedControlProps<T extends string> {
15
+ /** Names the group. One of this or `aria-labelledby` is required for a screen reader to say what is being chosen. */
16
+ "aria-label"?: string;
17
+ "aria-labelledby"?: string;
18
+ /**
19
+ * Applied to the outermost element: the wrapper when `description` is set,
20
+ * the track otherwise.
21
+ */
22
+ className?: string;
23
+ /** A line under the control that applies to every option. Linked with `aria-describedby`. */
24
+ description?: ReactNode;
25
+ disabled?: boolean;
26
+ /**
27
+ * Sizes each segment to its label instead of splitting the track evenly. The
28
+ * selection indicator is measured and follows the selected segment.
29
+ */
30
+ fitContent?: boolean;
31
+ onChange: (value: T) => void;
32
+ options: readonly SegmentedControlOption<T>[];
33
+ /**
34
+ * `medium` is 32px, the height of a `small` `Input`; `small` is 28px, the
35
+ * height of an `x-small` one.
36
+ */
37
+ size?: SegmentedControlSize;
38
+ /**
39
+ * The selected value. Typed `string` rather than `T` so a caller holding a
40
+ * wider value (`String(field.value)`) does not need a cast; a value matching
41
+ * no option selects nothing.
42
+ */
43
+ value: string;
44
+ }
45
+ /**
46
+ * A single choice among two or three options, drawn as one pill-shaped track.
47
+ *
48
+ * Built on Base UI's radio group, so it is a `radiogroup` of `radio`s: Tab
49
+ * reaches the selected segment and the arrow keys move the selection, the way
50
+ * a set of radio buttons behaves.
51
+ */
52
+ declare function SegmentedControl<T extends string>({ value, options, onChange, description, className, disabled, fitContent, size, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }: SegmentedControlProps<T>): react_jsx_runtime.JSX.Element;
53
+
54
+ export { SegmentedControl };
55
+ export type { SegmentedControlOption, SegmentedControlProps, SegmentedControlSize };
@@ -0,0 +1,119 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+ var cn = require('../../cn.js');
6
+ var segmentedControl_module = require('./segmented-control.module.css.js');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var radioGroup = require('@base-ui/react/radio-group');
9
+ var radio = require('@base-ui/react/radio');
10
+
11
+ /**
12
+ * A single choice among two or three options, drawn as one pill-shaped track.
13
+ *
14
+ * Built on Base UI's radio group, so it is a `radiogroup` of `radio`s: Tab
15
+ * reaches the selected segment and the arrow keys move the selection, the way
16
+ * a set of radio buttons behaves.
17
+ */
18
+ function SegmentedControl({
19
+ value,
20
+ options,
21
+ onChange,
22
+ description,
23
+ className,
24
+ disabled = false,
25
+ fitContent = false,
26
+ size = "medium",
27
+ "aria-label": ariaLabel,
28
+ "aria-labelledby": ariaLabelledBy
29
+ }) {
30
+ const descriptionId = react.useId();
31
+ const trackRef = react.useRef(null);
32
+ const [measured, setMeasured] = react.useState(null);
33
+ const selectedIndex = options.findIndex(option => option.value === value);
34
+ const hasDescription = options.some(option => option.description);
35
+
36
+ // Only the content-width mode measures: an even split is pure CSS.
37
+ react.useLayoutEffect(() => {
38
+ if (!fitContent) {
39
+ return;
40
+ }
41
+ const track = trackRef.current;
42
+ if (!track) {
43
+ return;
44
+ }
45
+ const measure = () => {
46
+ const segment = track.querySelectorAll('[role="radio"]')[Math.max(selectedIndex, 0)];
47
+ if (!segment) {
48
+ return;
49
+ }
50
+ // `offsetLeft` is physical; the indicator is placed on the inline axis
51
+ // so it lands on the right segment when the direction flips.
52
+ const rtl = getComputedStyle(track).direction === "rtl";
53
+ const start = rtl ? track.clientWidth - segment.offsetLeft - segment.offsetWidth : segment.offsetLeft;
54
+ setMeasured({
55
+ start,
56
+ size: segment.offsetWidth
57
+ });
58
+ };
59
+ measure();
60
+ // Label widths change when a web font loads or the container resizes.
61
+ const observer = new ResizeObserver(measure);
62
+ observer.observe(track);
63
+ return () => observer.disconnect();
64
+ }, [fitContent, selectedIndex]);
65
+
66
+ // In content-width mode the indicator is not rendered until it has been
67
+ // measured: a first style has nothing to transition from, so it appears in
68
+ // place instead of growing in from the track's edge on every mount.
69
+ const showIndicator = !fitContent || measured !== null;
70
+ const indicatorStyle = fitContent ? measured && {
71
+ "--segmented-control-indicator-start": `${measured.start}px`,
72
+ "--segmented-control-indicator-size": `${measured.size}px`
73
+ } : {
74
+ "--segmented-control-count": options.length,
75
+ "--segmented-control-index": Math.max(selectedIndex, 0)
76
+ };
77
+ const control = /*#__PURE__*/jsxRuntime.jsxs(radioGroup.RadioGroup, {
78
+ "aria-describedby": description ? descriptionId : undefined,
79
+ "aria-label": ariaLabel,
80
+ "aria-labelledby": ariaLabelledBy,
81
+ className: cn.cn(segmentedControl_module.track, segmentedControl_module[size], fitContent ? segmentedControl_module.fit : segmentedControl_module.even, hasDescription && segmentedControl_module.twoLine, !description && className),
82
+ "data-cocso-component": "segmented-control",
83
+ disabled: disabled,
84
+ onValueChange: next => onChange(next),
85
+ ref: trackRef,
86
+ value: value,
87
+ children: [showIndicator && /*#__PURE__*/jsxRuntime.jsx("span", {
88
+ "aria-hidden": true,
89
+ className: cn.cn(segmentedControl_module.indicator, selectedIndex < 0 && segmentedControl_module.indicatorHidden),
90
+ "data-cocso-component": "segmented-control-indicator",
91
+ style: indicatorStyle
92
+ }), options.map(option => /*#__PURE__*/jsxRuntime.jsxs(radio.Radio.Root, {
93
+ className: segmentedControl_module.segment,
94
+ "data-cocso-component": "segmented-control-item",
95
+ value: option.value,
96
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
97
+ className: segmentedControl_module.label,
98
+ children: option.label
99
+ }), option.description && /*#__PURE__*/jsxRuntime.jsx("span", {
100
+ className: segmentedControl_module.optionDescription,
101
+ children: option.description
102
+ })]
103
+ }, option.value))]
104
+ });
105
+ if (!description) {
106
+ return control;
107
+ }
108
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
109
+ className: cn.cn(segmentedControl_module.root, fitContent && segmentedControl_module.rootFit, className),
110
+ "data-cocso-component": "segmented-control-root",
111
+ children: [control, /*#__PURE__*/jsxRuntime.jsx("span", {
112
+ className: segmentedControl_module.description,
113
+ id: descriptionId,
114
+ children: description
115
+ })]
116
+ });
117
+ }
118
+
119
+ exports.SegmentedControl = SegmentedControl;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var styleInject_es = require('../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js');
4
+
5
+ var css_248z = "@layer components{.segmented-control-module_root__Eg5Cg{display:flex;flex-direction:column;gap:var(--cocso-spacing-3);width:100%}.segmented-control-module_root__Eg5Cg.segmented-control-module_rootFit__HH5g9{width:fit-content}.segmented-control-module_track__tEmZy{--segmented-control-inset:var(--cocso-spacing-2);background-color:var(--cocso-color-surface-secondary);border-radius:var(--cocso-radius-full);display:flex;padding:var(--segmented-control-inset);position:relative;width:100%}.segmented-control-module_track__tEmZy.segmented-control-module_fit__E4VDX{width:fit-content}.segmented-control-module_track__tEmZy.segmented-control-module_medium__ZQMNB{min-height:32px}.segmented-control-module_track__tEmZy.segmented-control-module_small__nqpQ3{min-height:28px}.segmented-control-module_track__tEmZy[data-disabled]{cursor:not-allowed;opacity:.4}.segmented-control-module_indicator__VORjV{background-color:var(--cocso-color-surface-primary);border-radius:var(--cocso-radius-full);box-shadow:var(--cocso-shadow-xs);inset-block:var(--segmented-control-inset);position:absolute;transition:inset-inline-start var(--cocso-duration-normal) var(--cocso-easing-default),width var(--cocso-duration-normal) var(--cocso-easing-default),opacity var(--cocso-duration-fast) var(--cocso-easing-default)}.segmented-control-module_even__aAaDd .segmented-control-module_indicator__VORjV{inset-inline-start:calc(var(--segmented-control-inset) + (100% - var(--segmented-control-inset)*2)/var(--segmented-control-count, 1)*var(--segmented-control-index, 0));width:calc((100% - var(--segmented-control-inset)*2)/var(--segmented-control-count, 1))}.segmented-control-module_fit__E4VDX .segmented-control-module_indicator__VORjV{inset-inline-start:var(--segmented-control-indicator-start,0);width:var(--segmented-control-indicator-size,0)}.segmented-control-module_indicator__VORjV.segmented-control-module_indicatorHidden__uYrjU{opacity:0}.segmented-control-module_segment__3-9eW{align-items:center;border-radius:var(--cocso-radius-full);color:var(--cocso-color-text-secondary);cursor:pointer;display:flex;flex:1 1 0;flex-direction:column;font-size:var(--cocso-text-sm);justify-content:center;line-height:1.4;min-width:0;padding-block:var(--cocso-spacing-2);padding-inline:var(--cocso-spacing-7);position:relative;text-align:center;transition:color var(--cocso-duration-fast) var(--cocso-easing-soft);user-select:none;white-space:nowrap}.segmented-control-module_fit__E4VDX .segmented-control-module_segment__3-9eW{flex:none}.segmented-control-module_twoLine__6RCfj .segmented-control-module_segment__3-9eW{line-height:1.25;padding-block:var(--cocso-spacing-4)}.segmented-control-module_segment__3-9eW[data-checked]{color:var(--cocso-color-text-primary);font-weight:var(--cocso-font-weight-medium)}.segmented-control-module_segment__3-9eW:not([data-checked],[data-disabled]):hover{color:var(--cocso-color-text-primary)}.segmented-control-module_segment__3-9eW:focus-visible{outline:2px solid var(--cocso-color-focus-ring);outline-offset:0}.segmented-control-module_segment__3-9eW[data-disabled]{cursor:not-allowed}.segmented-control-module_label__3RVi9{display:block}.segmented-control-module_optionDescription__iZfff{display:block;font-weight:var(--cocso-font-weight-regular);margin-block-start:var(--cocso-spacing-2)}.segmented-control-module_description__WMQQf,.segmented-control-module_optionDescription__iZfff{color:var(--cocso-color-text-secondary);font-size:var(--cocso-text-xs)}@media (prefers-reduced-motion:reduce){.segmented-control-module_indicator__VORjV,.segmented-control-module_segment__3-9eW{transition:none}}}";
6
+ var styles = {"root":"segmented-control-module_root__Eg5Cg","rootFit":"segmented-control-module_rootFit__HH5g9","track":"segmented-control-module_track__tEmZy","fit":"segmented-control-module_fit__E4VDX","medium":"segmented-control-module_medium__ZQMNB","small":"segmented-control-module_small__nqpQ3","indicator":"segmented-control-module_indicator__VORjV","even":"segmented-control-module_even__aAaDd","indicatorHidden":"segmented-control-module_indicatorHidden__uYrjU","segment":"segmented-control-module_segment__3-9eW","twoLine":"segmented-control-module_twoLine__6RCfj","label":"segmented-control-module_label__3RVi9","optionDescription":"segmented-control-module_optionDescription__iZfff","description":"segmented-control-module_description__WMQQf"};
7
+ styleInject_es(css_248z);
8
+
9
+ module.exports = styles;
@@ -0,0 +1,22 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps } from 'react';
3
+
4
+ interface SelectionChipProps extends Omit<ComponentProps<"button">, "type"> {
5
+ /**
6
+ * Whether everything this chip stands for is currently selected. Drawn in
7
+ * the primary tint and exposed as `aria-pressed`, so the state is not
8
+ * carried by colour alone.
9
+ */
10
+ active?: boolean;
11
+ }
12
+ /**
13
+ * A bulk-selection chip, placed above a multi-select list.
14
+ *
15
+ * "Select all", "select every tagged item", a group name — a button that adds
16
+ * or removes several items at once. `active` shows that every item it targets
17
+ * is already selected, so pressing it again clears them.
18
+ */
19
+ declare function SelectionChip({ ref, className, active, ...props }: SelectionChipProps): react_jsx_runtime.JSX.Element;
20
+
21
+ export { SelectionChip };
22
+ export type { SelectionChipProps };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var cn = require('../../cn.js');
5
+ var selectionChip_module = require('./selection-chip.module.css.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ /**
9
+ * A bulk-selection chip, placed above a multi-select list.
10
+ *
11
+ * "Select all", "select every tagged item", a group name — a button that adds
12
+ * or removes several items at once. `active` shows that every item it targets
13
+ * is already selected, so pressing it again clears them.
14
+ */
15
+ function SelectionChip({
16
+ ref,
17
+ className,
18
+ active = false,
19
+ ...props
20
+ }) {
21
+ return /*#__PURE__*/jsxRuntime.jsx("button", {
22
+ "aria-pressed": active,
23
+ className: cn.cn(selectionChip_module.chip, active && selectionChip_module.active, className),
24
+ "data-active": active || undefined,
25
+ "data-cocso-component": "selection-chip",
26
+ ref: ref,
27
+ type: "button",
28
+ ...props
29
+ });
30
+ }
31
+
32
+ exports.SelectionChip = SelectionChip;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var styleInject_es = require('../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js');
4
+
5
+ var css_248z = "@layer components{.selection-chip-module_chip__QS6TC{align-items:center;background:none;border:1px solid var(--cocso-color-border-strong);border-radius:var(--cocso-radius-full);color:var(--cocso-color-text-secondary);cursor:pointer;display:inline-flex;flex-shrink:0;font-family:inherit;font-size:var(--cocso-text-xs);line-height:1.5;padding-block:var(--cocso-spacing-2);padding-inline:var(--cocso-spacing-5);transition:background-color var(--cocso-duration-fast) var(--cocso-easing-default),border-color var(--cocso-duration-fast) var(--cocso-easing-default)}.selection-chip-module_chip__QS6TC:hover:not(:disabled){background-color:var(--cocso-color-surface-secondary)}.selection-chip-module_chip__QS6TC:focus-visible{outline:2px solid var(--cocso-color-focus-ring);outline-offset:2px}.selection-chip-module_chip__QS6TC.selection-chip-module_active__nuRn2{background-color:var(--cocso-color-interactive-primary-subtle);border-color:var(--cocso-color-interactive-primary);color:var(--cocso-color-interactive-primary-text)}.selection-chip-module_chip__QS6TC.selection-chip-module_active__nuRn2:hover:not(:disabled){background-color:var(--cocso-color-interactive-primary-subtle)}.selection-chip-module_chip__QS6TC:disabled{cursor:not-allowed;opacity:.4}@media (prefers-reduced-motion:reduce){.selection-chip-module_chip__QS6TC{transition:none}}}";
6
+ var styles = {"chip":"selection-chip-module_chip__QS6TC","active":"selection-chip-module_active__nuRn2"};
7
+ styleInject_es(css_248z);
8
+
9
+ module.exports = styles;
@@ -6,10 +6,16 @@ type SkeletonVariant = "text" | "circular" | "rectangular";
6
6
  type SkeletonAnimation = "pulse" | "wave" | "none";
7
7
  interface SkeletonProps extends ComponentProps<"div"> {
8
8
  animation?: SkeletonAnimation;
9
+ /** Shorthand for `variant="circular"` — an avatar or icon placeholder. */
10
+ circle?: boolean;
11
+ /** Block size. A number is read as pixels; a string is used as-is. */
12
+ height?: number | string;
9
13
  variant?: SkeletonVariant;
14
+ /** Inline size. A number is read as pixels; a string is used as-is. */
15
+ width?: number | string;
10
16
  }
11
17
  /** Loading placeholder with configurable shape and animation. */
12
- declare function Skeleton({ ref, className, style, variant, animation, ...props }: SkeletonProps): react_jsx_runtime.JSX.Element;
18
+ declare function Skeleton({ ref, className, style: _style, variant, animation, circle, width, height, ...props }: SkeletonProps): react_jsx_runtime.JSX.Element;
13
19
 
14
20
  export { Skeleton };
15
21
  export type { SkeletonAnimation, SkeletonProps, SkeletonVariant };
@@ -6,19 +6,37 @@ var cn = require('../../cn.js');
6
6
  var skeleton_module = require('./skeleton.module.css.js');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
8
 
9
+ const toLength = value => typeof value === "number" ? `${value}px` : value;
10
+
9
11
  /** Loading placeholder with configurable shape and animation. */
10
12
  function Skeleton({
11
13
  ref,
12
14
  className,
13
- style,
15
+ style: _style,
14
16
  variant = "text",
15
17
  animation = "pulse",
18
+ circle = false,
19
+ width,
20
+ height,
16
21
  ...props
17
22
  }) {
23
+ const resolvedVariant = circle ? "circular" : variant;
24
+
25
+ // The size feeds the custom properties the module already reads, so a
26
+ // consumer's own `style.width` / `style.height` still wins over these.
27
+ const style = {
28
+ ...(width === undefined ? {} : {
29
+ "--cocso-skeleton-width": toLength(width)
30
+ }),
31
+ ...(height === undefined ? {} : {
32
+ "--cocso-skeleton-height": toLength(height)
33
+ }),
34
+ ..._style
35
+ };
18
36
  return /*#__PURE__*/jsxRuntime.jsx("div", {
19
37
  "aria-hidden": "true",
20
38
  className: cn.cn(skeleton.skeleton({
21
- variant,
39
+ variant: resolvedVariant,
22
40
  animation
23
41
  }), skeleton_module.skeleton, animation === "pulse" && skeleton_module.pulse, animation === "wave" && skeleton_module.wave, className),
24
42
  ref: ref,
@@ -2,7 +2,7 @@
2
2
 
3
3
  var styleInject_es = require('../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js');
4
4
 
5
- var css_248z = "@layer components{.skeleton-module_skeleton__fula5{--cocso-skeleton-edge-fade-size:min(var(--cocso-skeleton-edge-fade,12px),25%);background-color:var(--cocso-skeleton-bg-color);border-radius:var(--cocso-skeleton-border-radius);height:var(--cocso-skeleton-height);mask-composite:intersect;mask-image:linear-gradient(to right,transparent,#000 var(--cocso-skeleton-edge-fade-size),#000 calc(100% - var(--cocso-skeleton-edge-fade-size)),transparent),linear-gradient(to bottom,transparent,#000 var(--cocso-skeleton-edge-fade-size),#000 calc(100% - var(--cocso-skeleton-edge-fade-size)),transparent);width:var(--cocso-skeleton-width,100%)}.cocso-skeleton--variant-circular.skeleton-module_skeleton__fula5{mask-composite:add;mask-image:radial-gradient(closest-side,#000 calc(100% - var(--cocso-skeleton-edge-fade, 12px)),transparent)}.skeleton-module_pulse__YLysm{animation:skeleton-module_skeleton-pulse__Yp45W var(--cocso-duration-decorative-slow) var(--cocso-easing-default) infinite}.skeleton-module_wave__GxWJ1{overflow:hidden;position:relative}.skeleton-module_wave__GxWJ1:after{animation:skeleton-module_skeleton-wave__zaVNu var(--cocso-duration-decorative-slow) var(--cocso-easing-default) infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.4),transparent);content:\"\";inset:0;position:absolute}@keyframes skeleton-module_skeleton-pulse__Yp45W{0%,to{opacity:1}50%{opacity:.4}}@keyframes skeleton-module_skeleton-wave__zaVNu{0%{transform:translateX(-100%)}to{transform:translateX(100%)}}@media (prefers-reduced-motion:reduce){.skeleton-module_pulse__YLysm,.skeleton-module_wave__GxWJ1:after{animation:none}}}";
5
+ var css_248z = "@layer components{.skeleton-module_skeleton__fula5{background-color:var(--cocso-skeleton-bg-color);border-radius:var(--cocso-skeleton-border-radius);height:var(--cocso-skeleton-height);width:var(--cocso-skeleton-width,100%)}.skeleton-module_pulse__YLysm{animation:skeleton-module_skeleton-pulse__Yp45W var(--cocso-duration-decorative-slow) var(--cocso-easing-default) infinite}.skeleton-module_wave__GxWJ1{overflow:hidden;position:relative}.skeleton-module_wave__GxWJ1:after{animation:skeleton-module_skeleton-wave__zaVNu var(--cocso-duration-decorative-slow) var(--cocso-easing-default) infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.4),transparent);content:\"\";inset:0;position:absolute}@keyframes skeleton-module_skeleton-pulse__Yp45W{0%,to{opacity:1}50%{opacity:.4}}@keyframes skeleton-module_skeleton-wave__zaVNu{0%{transform:translateX(-100%)}to{transform:translateX(100%)}}@media (prefers-reduced-motion:reduce){.skeleton-module_pulse__YLysm,.skeleton-module_wave__GxWJ1:after{animation:none}}}";
6
6
  var styles = {"skeleton":"skeleton-module_skeleton__fula5","pulse":"skeleton-module_pulse__YLysm","wave":"skeleton-module_wave__GxWJ1"};
7
7
  styleInject_es(css_248z);
8
8
 
@@ -0,0 +1,47 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import { RenderProp } from '../../primitives/use-render.js';
4
+
5
+ interface SummaryCardProps extends ComponentProps<"div"> {
6
+ /** Leading icon. Decorative — the label carries the meaning. */
7
+ icon?: ReactNode;
8
+ /** What the figure counts, in a few words. */
9
+ label: ReactNode;
10
+ }
11
+ declare function SummaryCardRoot({ className, icon, label, children, ...props }: SummaryCardProps): react_jsx_runtime.JSX.Element;
12
+ interface SummaryCardValueProps extends Omit<ComponentProps<"a">, "children"> {
13
+ /** The figure. */
14
+ count: number | string;
15
+ /**
16
+ * Where the figure leads — the list it counts. Without one (and without
17
+ * `render`) the figure is plain text.
18
+ */
19
+ href?: string;
20
+ /**
21
+ * Element the linked figure renders as — the router's link, for example
22
+ * `render={(props) => <NextLink {...props} href={props.href ?? ""} />}`.
23
+ * It receives `href`, `className` and `children`. Defaults to `<a>`.
24
+ */
25
+ render?: RenderProp;
26
+ /** Unit after the figure, e.g. `"건"` or `"%"`. */
27
+ suffix?: ReactNode;
28
+ }
29
+ declare function SummaryCardValue({ className, count, href, render, suffix, ...props }: SummaryCardValueProps): react_jsx_runtime.JSX.Element;
30
+ /**
31
+ * One headline figure on a dashboard: what it counts, the figure, and —
32
+ * usually — a link through to the list behind it.
33
+ *
34
+ * The root paints no surface. Put it in a `Card` where it should read as a
35
+ * card; a grid of four on a plain page does not need one.
36
+ *
37
+ * @example
38
+ * <SummaryCard icon={<PersonIcon />} label="New users">
39
+ * <SummaryCard.Value count={42} href="/users" />
40
+ * </SummaryCard>
41
+ */
42
+ declare const SummaryCard: typeof SummaryCardRoot & {
43
+ Value: typeof SummaryCardValue;
44
+ };
45
+
46
+ export { SummaryCard };
47
+ export type { SummaryCardProps, SummaryCardValueProps };
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+
3
+ var reactIcons = require('@cocso-ui/react-icons');
4
+ var cn = require('../../cn.js');
5
+ var summaryCard_module = require('./summary-card.module.css.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var typography = require('../typography/typography.js');
8
+ var useRender = require('@base-ui/react/use-render');
9
+ var mergeProps = require('@base-ui/react/merge-props');
10
+
11
+ function SummaryCardRoot({
12
+ className,
13
+ icon,
14
+ label,
15
+ children,
16
+ ...props
17
+ }) {
18
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
19
+ className: cn.cn(summaryCard_module.root, className),
20
+ "data-cocso-component": "summary-card",
21
+ ...props,
22
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
23
+ className: summaryCard_module.header,
24
+ children: [icon && /*#__PURE__*/jsxRuntime.jsx("span", {
25
+ "aria-hidden": "true",
26
+ className: summaryCard_module.icon,
27
+ children: icon
28
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
29
+ className: summaryCard_module.label,
30
+ children: label
31
+ })]
32
+ }), children]
33
+ });
34
+ }
35
+ const VALUE_HOOK = {
36
+ "data-cocso-component": "summary-card-value"
37
+ };
38
+ function SummaryCardValue({
39
+ className,
40
+ count,
41
+ href,
42
+ render,
43
+ suffix,
44
+ ...props
45
+ }) {
46
+ const linked = href !== undefined || render !== undefined;
47
+ const element = useRender.useRender({
48
+ render,
49
+ props: mergeProps.mergeProps({
50
+ ...VALUE_HOOK,
51
+ className: cn.cn(summaryCard_module.value, linked && summaryCard_module.link, className),
52
+ href,
53
+ children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
54
+ children: [count, suffix, linked && /*#__PURE__*/jsxRuntime.jsx(reactIcons.ArrowIOSForwardIcon, {
55
+ "aria-hidden": "true",
56
+ className: summaryCard_module.chevron,
57
+ size: 16
58
+ })]
59
+ })
60
+ }, props),
61
+ defaultTagName: linked ? "a" : "span"
62
+ });
63
+ // Typography sets the figure's size and weight, so it follows the type
64
+ // scale (including its responsive steps) rather than a copied number.
65
+ return /*#__PURE__*/jsxRuntime.jsx(typography.Typography, {
66
+ render: element,
67
+ size: "large",
68
+ type: "body",
69
+ weight: "bold"
70
+ });
71
+ }
72
+
73
+ /**
74
+ * One headline figure on a dashboard: what it counts, the figure, and —
75
+ * usually — a link through to the list behind it.
76
+ *
77
+ * The root paints no surface. Put it in a `Card` where it should read as a
78
+ * card; a grid of four on a plain page does not need one.
79
+ *
80
+ * @example
81
+ * <SummaryCard icon={<PersonIcon />} label="New users">
82
+ * <SummaryCard.Value count={42} href="/users" />
83
+ * </SummaryCard>
84
+ */
85
+ const SummaryCard = Object.assign(SummaryCardRoot, {
86
+ Value: SummaryCardValue
87
+ });
88
+
89
+ exports.SummaryCard = SummaryCard;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var styleInject_es = require('../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js');
4
+
5
+ var css_248z = "@layer components{.summary-card-module_root__6-n2Z{flex-direction:column}.summary-card-module_header__eRIMm,.summary-card-module_root__6-n2Z{align-items:center;display:flex;gap:var(--cocso-spacing-3);min-inline-size:0}.summary-card-module_icon__pmw-V{display:inline-flex;flex-shrink:0}.summary-card-module_label__CBgob{color:var(--cocso-color-text-primary);font-size:var(--cocso-text-sm);word-break:keep-all}.summary-card-module_value__uu08J{align-items:center;color:var(--cocso-color-text-primary);display:inline-flex;gap:var(--cocso-spacing-3);text-decoration:none}.summary-card-module_link__jyia5{border-radius:var(--cocso-radius-2)}.summary-card-module_link__jyia5:hover{text-decoration:underline}.summary-card-module_link__jyia5:focus-visible{outline:2px solid var(--cocso-color-focus-ring);outline-offset:2px}.summary-card-module_chevron__uejaT{flex-shrink:0}[dir=rtl] .summary-card-module_chevron__uejaT{transform:scaleX(-1)}}";
6
+ var styles = {"root":"summary-card-module_root__6-n2Z","header":"summary-card-module_header__eRIMm","icon":"summary-card-module_icon__pmw-V","label":"summary-card-module_label__CBgob","value":"summary-card-module_value__uu08J","link":"summary-card-module_link__jyia5","chevron":"summary-card-module_chevron__uejaT"};
7
+ styleInject_es(css_248z);
8
+
9
+ module.exports = styles;
@@ -3,29 +3,40 @@ export { Accordion, AccordionTriggerProps } from './components/accordion/accordi
3
3
  export { Alert, AlertProps, AlertVariant } from './components/alert/alert.js';
4
4
  export { Avatar, AvatarProps, AvatarShape, AvatarSize } from './components/avatar/avatar.js';
5
5
  export { Badge, BadgeProps, BadgeSize } from './components/badge/badge.js';
6
- export { Breadcrumb, BreadcrumbProps, BreadcrumbSize } from './components/breadcrumb/breadcrumb.js';
6
+ export { Breadcrumb, BreadcrumbItem, BreadcrumbProps, BreadcrumbSize } from './components/breadcrumb/breadcrumb.js';
7
7
  export { Button, ButtonAlign, ButtonProps, ButtonShape, ButtonSize, ButtonVariant } from './components/button/button.js';
8
- export { Card, CardPadding, CardProps, CardVariant } from './components/card/card.js';
8
+ export { Card, CardHeaderProps, CardPadding, CardProps, CardTitleProps, CardVariant } from './components/card/card.js';
9
9
  export { Checkbox, CheckboxProps, CheckboxSize, CheckboxStatus } from './components/checkbox/checkbox.js';
10
+ export { CopyButton, CopyButtonProps } from './components/copy-button/copy-button.js';
10
11
  export { DateTimePicker, DateTimePickerProps } from './components/date-time-picker/date-time-picker.js';
11
12
  export { DayPicker, DayPickerProps } from './components/day-picker/day-picker.js';
12
13
  export { Dialog, DialogCloseProps, DialogSize } from './components/dialog/dialog.js';
13
14
  export { Dropdown } from './components/dropdown/dropdown.js';
15
+ export { EmptyState, EmptyStateProps } from './components/empty-state/empty-state.js';
14
16
  export { Field, FieldProps, useField } from './components/field/field.js';
15
17
  export { FileRow, FileRowProps } from './components/file-row/file-row.js';
18
+ export { FileItem, FileUploader, FileUploaderMessages, FileUploaderProps, FileUploaderRejection, FileUploaderRejectionReason } from './components/file-uploader/file-uploader.js';
19
+ export { FormField } from './components/form-field/form-field.js';
20
+ export { InfoPopover, InfoPopoverProps } from './components/info-popover/info-popover.js';
16
21
  export { Input, InputProps, InputSize } from './components/input/input.js';
17
22
  export { InputTrigger, InputTriggerProps } from './components/input-trigger/input-trigger.js';
18
23
  export { Link, LinkProps, LinkSize, LinkVariant } from './components/link/link.js';
24
+ export { LoadingOverlay, LoadingOverlayProps } from './components/loading-overlay/loading-overlay.js';
19
25
  export { MonthPicker, MonthPickerProps } from './components/month-picker/month-picker.js';
26
+ export { NumberInput, NumberInputProps } from './components/number-input/number-input.js';
20
27
  export { OneTimePasswordField, OneTimePasswordFieldProps } from './components/one-time-password-field/one-time-password-field.js';
21
28
  export { Pagination, PaginationLabels, PaginationLocale, PaginationProps } from './components/pagination/pagination.js';
22
29
  export { Popover } from './components/popover/popover.js';
23
30
  export { Progress, ProgressProps, ProgressSize, ProgressVariant } from './components/progress/progress.js';
24
31
  export { RadioGroup, RadioSize } from './components/radio-group/radio-group.js';
32
+ export { SectionHeader, SectionHeaderLevel, SectionHeaderProps } from './components/section-header/section-header.js';
33
+ export { SegmentedControl, SegmentedControlOption, SegmentedControlProps, SegmentedControlSize } from './components/segmented-control/segmented-control.js';
25
34
  export { Select, SelectProps, SelectSize } from './components/select/select.js';
35
+ export { SelectionChip, SelectionChipProps } from './components/selection-chip/selection-chip.js';
26
36
  export { Skeleton, SkeletonAnimation, SkeletonProps, SkeletonVariant } from './components/skeleton/skeleton.js';
27
37
  export { Spinner, SpinnerProps, SpinnerSize, SpinnerVariant } from './components/spinner/spinner.js';
28
38
  export { QuantityStatus, StockQuantityStatus, StockQuantityStatusProps } from './components/stock-quantity-status/stock-quantity-status.js';
39
+ export { SummaryCard, SummaryCardProps, SummaryCardValueProps } from './components/summary-card/summary-card.js';
29
40
  export { Switch, SwitchProps, SwitchSize, SwitchVariant } from './components/switch/switch.js';
30
41
  export { Tab, TabContentProps, TabListProps, TabProps, TabTriggerProps } from './components/tab/tab.js';
31
42
  export { Toaster, toast } from 'sonner';
@@ -36,3 +47,5 @@ export { colors } from './token/color.js';
36
47
  export { radius } from './token/radius.js';
37
48
  export { spacing } from './token/spacing.js';
38
49
  export { FontSize, FontWeight, LineHeight, ResponsiveFontSize, fontSize, fontWeight, lineHeight } from './token/typography.js';
50
+ export { FormFieldContextValue, FormFieldProps, useFormField } from './components/form-field/form-field-context.js';
51
+ export { FormFieldInputProps, FormFieldInputTriggerProps, FormFieldLabelProps } from './components/form-field/form-field-parts.js';
package/dist/cjs/index.js CHANGED
@@ -9,25 +9,36 @@ var breadcrumb = require('./components/breadcrumb/breadcrumb.js');
9
9
  var button = require('./components/button/button.js');
10
10
  var card = require('./components/card/card.js');
11
11
  var checkbox = require('./components/checkbox/checkbox.js');
12
+ var copyButton = require('./components/copy-button/copy-button.js');
12
13
  var dateTimePicker = require('./components/date-time-picker/date-time-picker.js');
13
14
  var dayPicker = require('./components/day-picker/day-picker.js');
14
15
  var dialog = require('./components/dialog/dialog.js');
15
16
  var dropdown = require('./components/dropdown/dropdown.js');
17
+ var emptyState = require('./components/empty-state/empty-state.js');
16
18
  var field = require('./components/field/field.js');
17
19
  var fileRow = require('./components/file-row/file-row.js');
20
+ var fileUploader = require('./components/file-uploader/file-uploader.js');
21
+ var formField = require('./components/form-field/form-field.js');
22
+ var infoPopover = require('./components/info-popover/info-popover.js');
18
23
  var input = require('./components/input/input.js');
19
24
  var inputTrigger = require('./components/input-trigger/input-trigger.js');
20
25
  var link = require('./components/link/link.js');
26
+ var loadingOverlay = require('./components/loading-overlay/loading-overlay.js');
21
27
  var monthPicker = require('./components/month-picker/month-picker.js');
28
+ var numberInput = require('./components/number-input/number-input.js');
22
29
  var oneTimePasswordField = require('./components/one-time-password-field/one-time-password-field.js');
23
30
  var pagination = require('./components/pagination/pagination.js');
24
31
  var popover = require('./components/popover/popover.js');
25
32
  var progress = require('./components/progress/progress.js');
26
33
  var radioGroup = require('./components/radio-group/radio-group.js');
34
+ var sectionHeader = require('./components/section-header/section-header.js');
35
+ var segmentedControl = require('./components/segmented-control/segmented-control.js');
27
36
  var select = require('./components/select/select.js');
37
+ var selectionChip = require('./components/selection-chip/selection-chip.js');
28
38
  var skeleton = require('./components/skeleton/skeleton.js');
29
39
  var spinner = require('./components/spinner/spinner.js');
30
40
  var stockQuantityStatus = require('./components/stock-quantity-status/stock-quantity-status.js');
41
+ var summaryCard = require('./components/summary-card/summary-card.js');
31
42
  var _switch = require('./components/switch/switch.js');
32
43
  var tab = require('./components/tab/tab.js');
33
44
  var sonner = require('sonner');
@@ -37,6 +48,7 @@ var color = require('./token/color.js');
37
48
  var typography$1 = require('./token/typography.js');
38
49
  var radius = require('./token/radius.js');
39
50
  var spacing = require('./token/spacing.js');
51
+ var formFieldContext = require('./components/form-field/form-field-context.js');
40
52
 
41
53
 
42
54
 
@@ -49,26 +61,37 @@ exports.Breadcrumb = breadcrumb.Breadcrumb;
49
61
  exports.Button = button.Button;
50
62
  exports.Card = card.Card;
51
63
  exports.Checkbox = checkbox.Checkbox;
64
+ exports.CopyButton = copyButton.CopyButton;
52
65
  exports.DateTimePicker = dateTimePicker.DateTimePicker;
53
66
  exports.DayPicker = dayPicker.DayPicker;
54
67
  exports.Dialog = dialog.Dialog;
55
68
  exports.Dropdown = dropdown.Dropdown;
69
+ exports.EmptyState = emptyState.EmptyState;
56
70
  exports.Field = field.Field;
57
71
  exports.useField = field.useField;
58
72
  exports.FileRow = fileRow.FileRow;
73
+ exports.FileUploader = fileUploader.FileUploader;
74
+ exports.FormField = formField.FormField;
75
+ exports.InfoPopover = infoPopover.InfoPopover;
59
76
  exports.Input = input.Input;
60
77
  exports.InputTrigger = inputTrigger.InputTrigger;
61
78
  exports.Link = link.Link;
79
+ exports.LoadingOverlay = loadingOverlay.LoadingOverlay;
62
80
  exports.MonthPicker = monthPicker.MonthPicker;
81
+ exports.NumberInput = numberInput.NumberInput;
63
82
  exports.OneTimePasswordField = oneTimePasswordField.OneTimePasswordField;
64
83
  exports.Pagination = pagination.Pagination;
65
84
  exports.Popover = popover.Popover;
66
85
  exports.Progress = progress.Progress;
67
86
  exports.RadioGroup = radioGroup.RadioGroup;
87
+ exports.SectionHeader = sectionHeader.SectionHeader;
88
+ exports.SegmentedControl = segmentedControl.SegmentedControl;
68
89
  exports.Select = select.Select;
90
+ exports.SelectionChip = selectionChip.SelectionChip;
69
91
  exports.Skeleton = skeleton.Skeleton;
70
92
  exports.Spinner = spinner.Spinner;
71
93
  exports.StockQuantityStatus = stockQuantityStatus.StockQuantityStatus;
94
+ exports.SummaryCard = summaryCard.SummaryCard;
72
95
  exports.Switch = _switch.Switch;
73
96
  exports.Tab = tab.Tab;
74
97
  Object.defineProperty(exports, "Toaster", {
@@ -87,3 +110,4 @@ exports.fontWeight = typography$1.fontWeight;
87
110
  exports.lineHeight = typography$1.lineHeight;
88
111
  exports.radius = radius.radius;
89
112
  exports.spacing = spacing.spacing;
113
+ exports.useFormField = formFieldContext.useFormField;