@kerfjs/ui 5.0.0-beta.124 → 5.0.0-beta.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/ai/component-catalog.json +91 -1
- package/ai/component-composition.json +70 -0
- package/ai/component-props.json +202 -0
- package/ai/components/README.md +1 -0
- package/ai/components/gauge.md +83 -0
- package/ai/components/segmented-control.md +1 -0
- package/ai/public-api-signatures-v1.md +100 -1
- package/ai/skill.md +26 -23
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/dist/browser/gauge.js +3 -0
- package/dist/browser/segmented-control.js +1 -0
- package/dist/catalog.js +3 -3
- package/dist/{chunk-F3PZGFEA.js → chunk-6OT7FOSA.js} +2 -2
- package/dist/{chunk-F3PZGFEA.js.map → chunk-6OT7FOSA.js.map} +1 -1
- package/dist/{chunk-NYNNNEAU.js → chunk-KQZIC5CA.js} +4 -4
- package/dist/{chunk-NYNNNEAU.js.map → chunk-KQZIC5CA.js.map} +1 -1
- package/dist/{chunk-3JOEJT2Z.js → chunk-NHQOX7T4.js} +2 -2
- package/dist/{chunk-3JOEJT2Z.js.map → chunk-NHQOX7T4.js.map} +1 -1
- package/dist/{chunk-7AUZG5EW.js → chunk-SVUJIVMR.js} +2 -2
- package/dist/{chunk-7AUZG5EW.js.map → chunk-SVUJIVMR.js.map} +1 -1
- package/dist/{chunk-4Z4QSTRF.js → chunk-TTFW6E6C.js} +37 -4
- package/dist/chunk-TTFW6E6C.js.map +1 -0
- package/dist/collapsible-panel.js +2 -2
- package/dist/editor.js +7 -7
- package/dist/gauge.d.ts +73 -0
- package/dist/gauge.js +157 -0
- package/dist/gauge.js.map +1 -0
- package/dist/index.js +8 -8
- package/dist/list-detail-dialog.js +2 -2
- package/dist/nav-stack.js +1 -1
- package/dist/segmented-control.d.ts +21 -0
- package/dist/segmented-control.js +3 -1
- package/dist/split-view.js +1 -1
- package/dist/styles/badge.css +39 -0
- package/dist/styles/components/feedback/badge/badge.css +39 -0
- package/dist/styles/components/feedback/gauge/gauge.css +132 -0
- package/dist/styles/components/forms/segmented-control/segmented-control.css +16 -0
- package/dist/styles/gauge.css +132 -0
- package/dist/styles/segmented-control.css +16 -0
- package/dist/styles/styles.css +1 -0
- package/dist/workbench-dialog.js +1 -1
- package/dist/workbench.js +1 -1
- package/docs/component-selection.md +2 -1
- package/docs/design/sketch/Kerf-UI.sketch +0 -0
- package/docs/design/sketch/README.md +1 -1
- package/docs/design/sketch/content/README.md +8 -8
- package/docs/design/sketch/coverage.md +7 -5
- package/docs/design/sketch/unified/README.md +1 -1
- package/docs/design/sketch/unified/pages/content.png +0 -0
- package/docs/design/templates/button/full-width-dark.svg +1 -1
- package/docs/design/templates/button/full-width.svg +1 -1
- package/docs/design/templates/button/icons-dark.svg +1 -1
- package/docs/design/templates/button/icons.svg +1 -1
- package/docs/design/templates/button/pill-dark.svg +1 -1
- package/docs/design/templates/button/pill.svg +1 -1
- package/docs/design/templates/button/toggles-dark.svg +1 -1
- package/docs/design/templates/button/toggles.svg +1 -1
- package/docs/design/templates/button-dark.svg +1 -1
- package/docs/design/templates/button.svg +1 -1
- package/docs/design/templates/checkbox/compact-dark.svg +1 -1
- package/docs/design/templates/checkbox/compact.svg +1 -1
- package/docs/design/templates/checkbox/mixed-dark.svg +1 -1
- package/docs/design/templates/checkbox/mixed.svg +1 -1
- package/docs/design/templates/checkbox/states-dark.svg +1 -1
- package/docs/design/templates/checkbox/states.svg +1 -1
- package/docs/design/templates/checkbox-dark.svg +1 -1
- package/docs/design/templates/checkbox-group/vertical-dark.svg +1 -1
- package/docs/design/templates/checkbox-group/vertical.svg +1 -1
- package/docs/design/templates/checkbox-group-dark.svg +1 -1
- package/docs/design/templates/checkbox-group.svg +1 -1
- package/docs/design/templates/checkbox.svg +1 -1
- package/docs/design/templates/chip/tags-dark.svg +1 -1
- package/docs/design/templates/chip/tags.svg +1 -1
- package/docs/design/templates/chip-dark.svg +1 -1
- package/docs/design/templates/chip.svg +1 -1
- package/docs/design/templates/choice-chips/compact-icons-dark.svg +1 -1
- package/docs/design/templates/choice-chips/compact-icons.svg +1 -1
- package/docs/design/templates/choice-chips-dark.svg +1 -1
- package/docs/design/templates/choice-chips.svg +1 -1
- package/docs/design/templates/color-field/compact-dark.svg +1 -1
- package/docs/design/templates/color-field/compact.svg +1 -1
- package/docs/design/templates/color-field/error-dark.svg +1 -1
- package/docs/design/templates/color-field/error.svg +1 -1
- package/docs/design/templates/color-field/hint-dark.svg +1 -1
- package/docs/design/templates/color-field/hint.svg +1 -1
- package/docs/design/templates/color-field-dark.svg +1 -1
- package/docs/design/templates/color-field.svg +1 -1
- package/docs/design/templates/color-picker/gray-dark.svg +1 -1
- package/docs/design/templates/color-picker/gray.svg +1 -1
- package/docs/design/templates/color-picker/hsb-dark.svg +1 -1
- package/docs/design/templates/color-picker/hsb.svg +1 -1
- package/docs/design/templates/color-picker/rgb-dark.svg +1 -1
- package/docs/design/templates/color-picker/rgb.svg +1 -1
- package/docs/design/templates/color-picker-dark.svg +1 -1
- package/docs/design/templates/color-picker.svg +1 -1
- package/docs/design/templates/disclosure/embedded-dark.svg +1 -1
- package/docs/design/templates/disclosure/embedded.svg +1 -1
- package/docs/design/templates/disclosure/framed-sunken-dark.svg +1 -1
- package/docs/design/templates/disclosure/framed-sunken.svg +1 -1
- package/docs/design/templates/disclosure/plain-dark.svg +1 -1
- package/docs/design/templates/disclosure/plain.svg +1 -1
- package/docs/design/templates/disclosure-dark.svg +1 -1
- package/docs/design/templates/disclosure.svg +1 -1
- package/docs/design/templates/empty-state/filtered-dark.svg +1 -1
- package/docs/design/templates/empty-state/filtered.svg +1 -1
- package/docs/design/templates/empty-state/with-action-dark.svg +1 -1
- package/docs/design/templates/empty-state/with-action.svg +1 -1
- package/docs/design/templates/empty-state-dark.svg +1 -1
- package/docs/design/templates/empty-state.svg +1 -1
- package/docs/design/templates/gauge/bare-dark.svg +1 -0
- package/docs/design/templates/gauge/bare.svg +1 -0
- package/docs/design/templates/gauge/full-dark.svg +1 -0
- package/docs/design/templates/gauge/full.svg +1 -0
- package/docs/design/templates/gauge-dark.svg +1 -0
- package/docs/design/templates/gauge.svg +1 -0
- package/docs/design/templates/list/compact-dark.svg +1 -1
- package/docs/design/templates/list/compact.svg +1 -1
- package/docs/design/templates/list/stack-dark.svg +1 -1
- package/docs/design/templates/list/stack.svg +1 -1
- package/docs/design/templates/list-action-row/default-dark.svg +1 -1
- package/docs/design/templates/list-action-row/default.svg +1 -1
- package/docs/design/templates/list-action-row/icon-tile-dark.svg +1 -1
- package/docs/design/templates/list-action-row/icon-tile.svg +1 -1
- package/docs/design/templates/list-action-row/selected-dark.svg +1 -1
- package/docs/design/templates/list-action-row/selected.svg +1 -1
- package/docs/design/templates/list-action-row/trailing-menu-dark.svg +1 -1
- package/docs/design/templates/list-action-row/trailing-menu.svg +1 -1
- package/docs/design/templates/list-action-row-dark.svg +1 -1
- package/docs/design/templates/list-action-row.svg +1 -1
- package/docs/design/templates/list-dark.svg +1 -1
- package/docs/design/templates/list-header/action-dark.svg +1 -1
- package/docs/design/templates/list-header/action.svg +1 -1
- package/docs/design/templates/list-header/inline-action-dark.svg +1 -1
- package/docs/design/templates/list-header/inline-action.svg +1 -1
- package/docs/design/templates/list-header/toggle-collapsed-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-collapsed.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded.svg +1 -1
- package/docs/design/templates/list-header-dark.svg +1 -1
- package/docs/design/templates/list-header.svg +1 -1
- package/docs/design/templates/list-item/default-dark.svg +1 -1
- package/docs/design/templates/list-item/default.svg +1 -1
- package/docs/design/templates/list-item/icon-tile-dark.svg +1 -1
- package/docs/design/templates/list-item/icon-tile.svg +1 -1
- package/docs/design/templates/list-item/multiline-dark.svg +1 -1
- package/docs/design/templates/list-item/multiline.svg +1 -1
- package/docs/design/templates/list-item/selected-dark.svg +1 -1
- package/docs/design/templates/list-item/selected.svg +1 -1
- package/docs/design/templates/list-item/trailing-dark.svg +1 -1
- package/docs/design/templates/list-item/trailing.svg +1 -1
- package/docs/design/templates/list-item-dark.svg +1 -1
- package/docs/design/templates/list-item.svg +1 -1
- package/docs/design/templates/list.svg +1 -1
- package/docs/design/templates/progress-ring/sizes-dark.svg +1 -1
- package/docs/design/templates/progress-ring/sizes.svg +1 -1
- package/docs/design/templates/progress-ring/tones-dark.svg +1 -1
- package/docs/design/templates/progress-ring/tones.svg +1 -1
- package/docs/design/templates/progress-ring-dark.svg +1 -1
- package/docs/design/templates/progress-ring.svg +1 -1
- package/docs/design/templates/search-field/empty-dark.svg +1 -1
- package/docs/design/templates/search-field/empty.svg +1 -1
- package/docs/design/templates/search-field/tokens-dark.svg +1 -1
- package/docs/design/templates/search-field/tokens.svg +1 -1
- package/docs/design/templates/search-field-dark.svg +1 -1
- package/docs/design/templates/search-field.svg +1 -1
- package/docs/design/templates/segmented-control/equal-dark.svg +1 -1
- package/docs/design/templates/segmented-control/equal.svg +1 -1
- package/docs/design/templates/segmented-control/pill-small-dark.svg +1 -1
- package/docs/design/templates/segmented-control/pill-small.svg +1 -1
- package/docs/design/templates/segmented-control-dark.svg +1 -1
- package/docs/design/templates/segmented-control.svg +1 -1
- package/docs/design/templates/select/compact-dark.svg +1 -1
- package/docs/design/templates/select/compact.svg +1 -1
- package/docs/design/templates/select/form-dark.svg +1 -1
- package/docs/design/templates/select/form.svg +1 -1
- package/docs/design/templates/select/icons-dark.svg +1 -1
- package/docs/design/templates/select/icons.svg +1 -1
- package/docs/design/templates/select-dark.svg +1 -1
- package/docs/design/templates/select.svg +1 -1
- package/docs/design/templates/split-button/full-width-dark.svg +1 -1
- package/docs/design/templates/split-button/full-width.svg +1 -1
- package/docs/design/templates/split-button/pill-dark.svg +1 -1
- package/docs/design/templates/split-button/pill.svg +1 -1
- package/docs/design/templates/split-button/states-dark.svg +1 -1
- package/docs/design/templates/split-button/states.svg +1 -1
- package/docs/design/templates/split-button/tones-dark.svg +1 -1
- package/docs/design/templates/split-button/tones.svg +1 -1
- package/docs/design/templates/split-button-dark.svg +1 -1
- package/docs/design/templates/split-button.svg +1 -1
- package/docs/design/templates/state-banner/danger-dark.svg +1 -1
- package/docs/design/templates/state-banner/danger.svg +1 -1
- package/docs/design/templates/state-banner/info-badge-dark.svg +1 -1
- package/docs/design/templates/state-banner/info-badge.svg +1 -1
- package/docs/design/templates/state-banner/info-dark.svg +1 -1
- package/docs/design/templates/state-banner/info.svg +1 -1
- package/docs/design/templates/state-banner/strip-dark.svg +1 -1
- package/docs/design/templates/state-banner/strip.svg +1 -1
- package/docs/design/templates/state-banner/success-dark.svg +1 -1
- package/docs/design/templates/state-banner/success.svg +1 -1
- package/docs/design/templates/state-banner/warning-dark.svg +1 -1
- package/docs/design/templates/state-banner/warning.svg +1 -1
- package/docs/design/templates/state-banner-dark.svg +1 -1
- package/docs/design/templates/state-banner.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs-dark.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs.svg +1 -1
- package/docs/design/templates/tab-bar-dark.svg +1 -1
- package/docs/design/templates/tab-bar.svg +1 -1
- package/docs/design/templates/tag-field/error-dark.svg +1 -1
- package/docs/design/templates/tag-field/error.svg +1 -1
- package/docs/design/templates/tag-field/tags-dark.svg +1 -1
- package/docs/design/templates/tag-field/tags.svg +1 -1
- package/docs/design/templates/tag-field-dark.svg +1 -1
- package/docs/design/templates/tag-field.svg +1 -1
- package/docs/design/templates/text-field/labeled-dark.svg +1 -1
- package/docs/design/templates/text-field/labeled.svg +1 -1
- package/docs/design/templates/text-field/search-dark.svg +1 -1
- package/docs/design/templates/text-field/search.svg +1 -1
- package/docs/design/templates/text-field-dark.svg +1 -1
- package/docs/design/templates/text-field.svg +1 -1
- package/docs/design/templates/toolbar/title-and-actions-dark.svg +1 -1
- package/docs/design/templates/toolbar/title-and-actions.svg +1 -1
- package/docs/design/templates/toolbar/width-visibility-320-dark.svg +1 -1
- package/docs/design/templates/toolbar/width-visibility-320.svg +1 -1
- package/docs/design/templates/toolbar/width-visibility-600-dark.svg +1 -1
- package/docs/design/templates/toolbar/width-visibility-600.svg +1 -1
- package/docs/design/templates/toolbar-control-group/borderless-single-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/borderless-single.svg +1 -1
- package/docs/design/templates/toolbar-control-group/glass-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/glass.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-buttons-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-buttons.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-brand-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-brand.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-danger-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-danger.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-neutral-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-neutral.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-success-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-success.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-warning-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-warning.svg +1 -1
- package/docs/design/templates/toolbar-control-group/push-buttons-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/push-buttons.svg +1 -1
- package/docs/design/templates/toolbar-control-group/with-text-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/with-text.svg +1 -1
- package/docs/design/templates/toolbar-control-group-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group.svg +1 -1
- package/docs/design/templates/toolbar-dark.svg +1 -1
- package/docs/design/templates/toolbar.svg +1 -1
- package/docs/design/templates/tree-list/files-dark.svg +1 -1
- package/docs/design/templates/tree-list/files.svg +1 -1
- package/docs/design/templates/tree-list/outline-dark.svg +1 -1
- package/docs/design/templates/tree-list/outline.svg +1 -1
- package/docs/design/templates/tree-list-dark.svg +1 -1
- package/docs/design/templates/tree-list.svg +1 -1
- package/docs/design/templates/value-table/details-dark.svg +1 -1
- package/docs/design/templates/value-table/details.svg +1 -1
- package/docs/design/templates/value-table-dark.svg +1 -1
- package/docs/design/templates/value-table.svg +1 -1
- package/docs/gauge.md +55 -0
- package/docs/progress.md +3 -2
- package/llms.txt +10 -1
- package/package.json +8 -2
- package/dist/chunk-4Z4QSTRF.js.map +0 -1
package/dist/editor.js
CHANGED
|
@@ -3,18 +3,19 @@ import { wireTagFields } from './chunk-SBCXWGNP.js';
|
|
|
3
3
|
import { wireTreeList, treeListExternalDrop } from './chunk-HPOXLOVC.js';
|
|
4
4
|
import { wireSidebar } from './chunk-DJ65XFVN.js';
|
|
5
5
|
import { wireSliders } from './chunk-TXBNPEIJ.js';
|
|
6
|
+
import { wireContentItems } from './chunk-3S3WXAZ5.js';
|
|
6
7
|
import { wireNavStack } from './chunk-KELWWCMX.js';
|
|
7
8
|
import { wireWorkbench } from './chunk-SJBMKA4X.js';
|
|
8
9
|
import { wireColorFields } from './chunk-VX3YF2UD.js';
|
|
9
10
|
import { wireColorPickers } from './chunk-Z3T24FX3.js';
|
|
10
|
-
import { wireContentItems } from './chunk-3S3WXAZ5.js';
|
|
11
11
|
import { TreeList } from './chunk-BCO673YW.js';
|
|
12
12
|
import { TagField } from './chunk-73LC3JAL.js';
|
|
13
|
+
import { wireSummaryRows } from './chunk-CKPI4WIN.js';
|
|
13
14
|
import { wireTabBars, reorderTabs } from './chunk-ADMWT7FX.js';
|
|
14
15
|
import { wireTextFields } from './chunk-KC6WUSNS.js';
|
|
15
16
|
import { wireResizableRegions } from './chunk-JZZVWTUB.js';
|
|
16
17
|
import { wireSearchFields } from './chunk-TPLVC5BE.js';
|
|
17
|
-
|
|
18
|
+
|
|
18
19
|
import { wireFilePickers } from './chunk-KK3S5OTW.js';
|
|
19
20
|
import { wireForms } from './chunk-44AOBT2F.js';
|
|
20
21
|
import { wireListReorder, reorderListItems } from './chunk-MJ5RU6XT.js';
|
|
@@ -23,11 +24,10 @@ import { wireScrollDividers } from './chunk-VNT4MXR5.js';
|
|
|
23
24
|
import { wireCheckboxes } from './chunk-CNM6ZWP2.js';
|
|
24
25
|
import { wireChoiceChips, readChoiceChips } from './chunk-VPDSPD76.js';
|
|
25
26
|
import { wireComboboxes } from './chunk-MVKHSAKE.js';
|
|
26
|
-
|
|
27
|
+
import { TextField } from './chunk-RGB4DPMN.js';
|
|
27
28
|
import { ValueTable, ValueTableRow } from './chunk-WSPXSWFG.js';
|
|
28
29
|
import { TabBarItem } from './chunk-Q7RILH2D.js';
|
|
29
30
|
import { TabBar } from './chunk-4IXG6XCT.js';
|
|
30
|
-
import { TextField } from './chunk-RGB4DPMN.js';
|
|
31
31
|
import { StateBanner } from './chunk-LOW7J7SE.js';
|
|
32
32
|
import { SummaryRow } from './chunk-JHUEYWWI.js';
|
|
33
33
|
import { createSearchFieldModel } from './chunk-CIAUILRR.js';
|
|
@@ -49,11 +49,12 @@ import { deviceClass } from './chunk-WCMGPAY2.js';
|
|
|
49
49
|
|
|
50
50
|
import { openAnchoredSurface } from './chunk-3WYREXW4.js';
|
|
51
51
|
import { Button } from './chunk-QXXLDY6I.js';
|
|
52
|
-
import { Workbench } from './chunk-
|
|
52
|
+
import { Workbench } from './chunk-KQZIC5CA.js';
|
|
53
53
|
import { workbenchRegionId } from './chunk-S4ZGTDSG.js';
|
|
54
54
|
import { Switch } from './chunk-C4FBYP2D.js';
|
|
55
55
|
import { SearchField, readSearchField } from './chunk-UD5KHQOH.js';
|
|
56
56
|
import { Row } from './chunk-CCPWJDRW.js';
|
|
57
|
+
import { ListInsetText } from './chunk-CJAKN2KZ.js';
|
|
57
58
|
import { PopupMenu, openPopupMenuAt } from './chunk-BZXA5SSA.js';
|
|
58
59
|
|
|
59
60
|
|
|
@@ -62,17 +63,16 @@ import { PopupMenu, openPopupMenuAt } from './chunk-BZXA5SSA.js';
|
|
|
62
63
|
import { ToolbarText } from './chunk-JAC6AVZN.js';
|
|
63
64
|
import { ListHeader } from './chunk-SPI6VMIY.js';
|
|
64
65
|
import { Text } from './chunk-F34LHBQI.js';
|
|
65
|
-
import { ListInsetText } from './chunk-CJAKN2KZ.js';
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
import { ToolbarControlGroup, ToolbarButton } from './chunk-EXGDKG7B.js';
|
|
71
|
-
import { Toolbar } from './chunk-SWXWLSUD.js';
|
|
72
71
|
|
|
73
72
|
|
|
74
73
|
|
|
75
74
|
|
|
75
|
+
import { Toolbar } from './chunk-SWXWLSUD.js';
|
|
76
76
|
|
|
77
77
|
import { ListItem } from './chunk-2E7S5C4D.js';
|
|
78
78
|
|
package/dist/gauge.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as kerfjs from 'kerfjs';
|
|
2
|
+
import { CssLength, CssColor } from './css-values.js';
|
|
3
|
+
import { ProgressTone } from './progress-bar.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `full` draws ticks with the value and unit inside the dial, for a stats
|
|
7
|
+
* tile or a standby display; `bare` draws only the arc, fill, and needle, for
|
|
8
|
+
* chip height, and carries the value in its accessible name and hover title.
|
|
9
|
+
*/
|
|
10
|
+
type GaugeVariant = 'full' | 'bare';
|
|
11
|
+
/**
|
|
12
|
+
* A consumer palette, such as dark red on black for a night display. Each
|
|
13
|
+
* color is a typed `CssColor` from `uiColor()`, `colorVar()`, or
|
|
14
|
+
* `fillColor()`; an omitted one keeps the tone's color.
|
|
15
|
+
*/
|
|
16
|
+
interface GaugeColors {
|
|
17
|
+
/** The unfilled arc. */
|
|
18
|
+
track?: CssColor;
|
|
19
|
+
/** The filled arc from zero to the value. */
|
|
20
|
+
fill?: CssColor;
|
|
21
|
+
/** The needle and its hub. */
|
|
22
|
+
needle?: CssColor;
|
|
23
|
+
/** The value, unit, and ticks of a `full` gauge. */
|
|
24
|
+
text?: CssColor;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Application `data-*` identity on the Gauge root, such as `data-key`; its
|
|
28
|
+
* own configuration attributes stay protected.
|
|
29
|
+
*/
|
|
30
|
+
type GaugeRootAttributes = Readonly<Record<`data-${string}`, string | undefined>>;
|
|
31
|
+
interface GaugeProps {
|
|
32
|
+
/**
|
|
33
|
+
* The reading, zero or more. A value above `max` pins the needle and fill
|
|
34
|
+
* at the end of the scale while the text still shows the real value.
|
|
35
|
+
*/
|
|
36
|
+
value: number;
|
|
37
|
+
/** The end of the scale, such as the highest expected rate. */
|
|
38
|
+
max: number;
|
|
39
|
+
/** The gauge's accessible name, such as "Tokens per minute". */
|
|
40
|
+
label: string;
|
|
41
|
+
/**
|
|
42
|
+
* The value as shown in a `full` dial and spoken, such as "1.2k"; defaults
|
|
43
|
+
* to the value rounded to one decimal place.
|
|
44
|
+
*/
|
|
45
|
+
valueText?: string;
|
|
46
|
+
/** The unit under the value in a `full` dial, such as "tok/min". */
|
|
47
|
+
unit?: string;
|
|
48
|
+
variant?: GaugeVariant;
|
|
49
|
+
tone?: ProgressTone;
|
|
50
|
+
/**
|
|
51
|
+
* The gauge's width as a typed `CssLength`; its height follows the dial.
|
|
52
|
+
* Defaults to 88px for `full` and 40px for `bare`.
|
|
53
|
+
*/
|
|
54
|
+
size?: CssLength;
|
|
55
|
+
colors?: GaugeColors;
|
|
56
|
+
id?: string;
|
|
57
|
+
rootAttributes?: GaugeRootAttributes;
|
|
58
|
+
className?: string;
|
|
59
|
+
/** Native named-slot assignment when composed inside a web component. */
|
|
60
|
+
slot?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A speedometer-style dial for a reading on a scale that is not progress,
|
|
64
|
+
* such as a live rate: a track arc, a fill from zero to the value, and a
|
|
65
|
+
* needle, scaled to `max`. `full` adds ticks and the value and unit inside
|
|
66
|
+
* the dial; `bare` is the arc, fill, and needle alone, for chip height. It is
|
|
67
|
+
* a `role="meter"` named by `label`, with the value and unit as
|
|
68
|
+
* `aria-valuetext`. The needle and fill transition only when the value
|
|
69
|
+
* changes, and hold still under reduced motion.
|
|
70
|
+
*/
|
|
71
|
+
declare function Gauge({ value, max, label, valueText, unit, variant, tone, size, colors, id, rootAttributes, className, slot, }: GaugeProps): kerfjs.SafeHtml;
|
|
72
|
+
|
|
73
|
+
export { Gauge, type GaugeColors, type GaugeProps, type GaugeRootAttributes, type GaugeVariant, ProgressTone };
|
package/dist/gauge.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { remify } from './chunk-IQSRHXZR.js';
|
|
2
|
+
import { filterDataAttributes } from './chunk-COQI4OMZ.js';
|
|
3
|
+
import { jsx, jsxs } from 'kerfjs/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var GAUGE_PROTECTED = /* @__PURE__ */ new Set([
|
|
6
|
+
"data-component",
|
|
7
|
+
"data-tone",
|
|
8
|
+
"data-variant",
|
|
9
|
+
"data-pinned"
|
|
10
|
+
]);
|
|
11
|
+
var CENTER = 50;
|
|
12
|
+
var RADIUS = 42;
|
|
13
|
+
var SWEEP = 240;
|
|
14
|
+
var START = -SWEEP / 2;
|
|
15
|
+
var TICKS = 10;
|
|
16
|
+
var DEFAULT_WIDTH = { full: 88, bare: 40 };
|
|
17
|
+
var VIEW_HEIGHT = { full: 98, bare: 76 };
|
|
18
|
+
function polar(radius, angle) {
|
|
19
|
+
const radians = angle * Math.PI / 180;
|
|
20
|
+
return [
|
|
21
|
+
CENTER + radius * Math.sin(radians),
|
|
22
|
+
CENTER - radius * Math.cos(radians)
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
var fixed = (n) => String(Number(n.toFixed(3)));
|
|
26
|
+
var [arcStartX, arcStartY] = polar(RADIUS, START);
|
|
27
|
+
var [arcEndX, arcEndY] = polar(RADIUS, START + SWEEP);
|
|
28
|
+
var ARC = `M ${fixed(arcStartX)} ${fixed(arcStartY)} A ${RADIUS} ${RADIUS} 0 1 1 ${fixed(arcEndX)} ${fixed(arcEndY)}`;
|
|
29
|
+
var TICK_LINES = Array.from({ length: TICKS + 1 }, (_, index) => {
|
|
30
|
+
const angle = START + SWEEP * index / TICKS;
|
|
31
|
+
const major = index === 0 || index === TICKS / 2 || index === TICKS;
|
|
32
|
+
const [x1, y1] = polar(major ? 27 : 30, angle);
|
|
33
|
+
const [x2, y2] = polar(34, angle);
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"line",
|
|
36
|
+
{
|
|
37
|
+
class: major ? "kui-gauge__tick kui-gauge__tick--major" : "kui-gauge__tick",
|
|
38
|
+
x1: fixed(x1),
|
|
39
|
+
y1: fixed(y1),
|
|
40
|
+
x2: fixed(x2),
|
|
41
|
+
y2: fixed(y2)
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
function formatValue(value) {
|
|
46
|
+
return String(Math.round(value * 10) / 10);
|
|
47
|
+
}
|
|
48
|
+
function Gauge({
|
|
49
|
+
value,
|
|
50
|
+
max,
|
|
51
|
+
label,
|
|
52
|
+
valueText,
|
|
53
|
+
unit,
|
|
54
|
+
variant = "full",
|
|
55
|
+
tone = "brand",
|
|
56
|
+
size,
|
|
57
|
+
colors = {},
|
|
58
|
+
id,
|
|
59
|
+
rootAttributes = {},
|
|
60
|
+
className = "",
|
|
61
|
+
slot
|
|
62
|
+
}) {
|
|
63
|
+
if (!Number.isFinite(max) || max <= 0)
|
|
64
|
+
throw new RangeError("Gauge max must be a positive number.");
|
|
65
|
+
if (!Number.isFinite(value) || value < 0)
|
|
66
|
+
throw new RangeError("Gauge value must be zero or more.");
|
|
67
|
+
const shown = Math.min(value, max);
|
|
68
|
+
const fraction = shown / max;
|
|
69
|
+
const text = valueText ?? formatValue(value);
|
|
70
|
+
const spoken = unit === void 0 ? text : `${text} ${unit}`;
|
|
71
|
+
const style = [
|
|
72
|
+
`--_kui-gauge-size:${size ?? remify(DEFAULT_WIDTH[variant])}`,
|
|
73
|
+
colors.track === void 0 ? "" : `--_kui-gauge-track:${colors.track}`,
|
|
74
|
+
colors.fill === void 0 ? "" : `--_kui-gauge-fill:${colors.fill}`,
|
|
75
|
+
colors.needle === void 0 ? "" : `--_kui-gauge-needle:${colors.needle}`,
|
|
76
|
+
colors.text === void 0 ? "" : `--_kui-gauge-text:${colors.text}`
|
|
77
|
+
].filter(Boolean).join(";");
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
...filterDataAttributes(rootAttributes, GAUGE_PROTECTED),
|
|
82
|
+
id,
|
|
83
|
+
class: `kui-gauge ${className}`.trim(),
|
|
84
|
+
"data-component": "gauge",
|
|
85
|
+
"data-tone": tone,
|
|
86
|
+
"data-variant": variant,
|
|
87
|
+
"data-pinned": value > max ? "" : void 0,
|
|
88
|
+
role: "meter",
|
|
89
|
+
"aria-label": label,
|
|
90
|
+
"aria-valuemin": "0",
|
|
91
|
+
"aria-valuemax": String(max),
|
|
92
|
+
"aria-valuenow": String(shown),
|
|
93
|
+
"aria-valuetext": spoken,
|
|
94
|
+
title: variant === "bare" ? `${label}: ${spoken}` : void 0,
|
|
95
|
+
style,
|
|
96
|
+
slot,
|
|
97
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 100 ${VIEW_HEIGHT[variant]}`, "aria-hidden": "true", children: [
|
|
98
|
+
/* @__PURE__ */ jsx("path", { class: "kui-gauge__track", d: ARC, pathLength: 100 }),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
"path",
|
|
101
|
+
{
|
|
102
|
+
class: "kui-gauge__fill",
|
|
103
|
+
d: ARC,
|
|
104
|
+
pathLength: 100,
|
|
105
|
+
style: `stroke-dasharray:${fixed(fraction * 100)} 100`
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
variant === "full" ? TICK_LINES : null,
|
|
109
|
+
/* @__PURE__ */ jsxs(
|
|
110
|
+
"g",
|
|
111
|
+
{
|
|
112
|
+
class: "kui-gauge__needle",
|
|
113
|
+
style: `transform:rotate(${fixed(START + SWEEP * fraction)}deg)`,
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
"line",
|
|
117
|
+
{
|
|
118
|
+
x1: String(CENTER),
|
|
119
|
+
y1: String(CENTER),
|
|
120
|
+
x2: String(CENTER),
|
|
121
|
+
y2: String(CENTER - (variant === "full" ? 25 : 34))
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsx("circle", { cx: String(CENTER), cy: String(CENTER), r: "5" })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
variant === "full" ? /* @__PURE__ */ jsx(
|
|
129
|
+
"text",
|
|
130
|
+
{
|
|
131
|
+
class: "kui-gauge__value",
|
|
132
|
+
x: "50",
|
|
133
|
+
y: "83",
|
|
134
|
+
"text-anchor": "middle",
|
|
135
|
+
"font-size": "18",
|
|
136
|
+
children: text
|
|
137
|
+
}
|
|
138
|
+
) : null,
|
|
139
|
+
variant === "full" && unit !== void 0 ? /* @__PURE__ */ jsx(
|
|
140
|
+
"text",
|
|
141
|
+
{
|
|
142
|
+
class: "kui-gauge__unit",
|
|
143
|
+
x: "50",
|
|
144
|
+
y: "95",
|
|
145
|
+
"text-anchor": "middle",
|
|
146
|
+
"font-size": "11",
|
|
147
|
+
children: unit
|
|
148
|
+
}
|
|
149
|
+
) : null
|
|
150
|
+
] })
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { Gauge };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=gauge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/feedback/gauge/gauge.tsx"],"names":[],"mappings":";;;;AAyCA,IAAM,eAAA,uBAAsB,GAAA,CAAI;AAAA,EAC9B,gB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AA,IAAA,CAAA;AAAA,YAE1D,QAAA,EAAA;AAAA,8BAAA,GAAA;AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,EAAA,EAAI,OAAO,MAAM,CAAA;AAAA,kBACjB,EAAA,EAAI,OAAO,MAAM,CAAA;AAAA,kBACjB,EAAA,EAAI,OAAO,MAAM,CAAA;AAAA,kBACjB,IAAI,MAAA,CAAO,MAAA,IAAU,OAAA,KAAY,MAAA,GAAS,KAAK,EAAA,CAAG;AAAA;AAAA,eACpD;AAAA,8BACA,GAAA,CAAC,QAAA,EAAA,EAAO,EAAA,EAAI,MAAA,CAAO,MAAM,CAAA,EAAG,EAAA,EAAI,MAAA,CAAO,MAAM,CAAA,EAAG,CAAA,EAAE,GAAA,EAAI;AAAA;AAAA;AAAA,SACxD;AAAA,QACC,YAAY,MAAA,mBACX,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAM,kBAAA;AAAA,YACN,CAAA,EAAE,IAAA;AAAA,YACF,CAAA,EAAE,IAAA;AAAA,YACF,aAAA,EAAY,QAAA;AAAA,YACZ,WAAA,EAAU,IAAA;AAAA,YAET,QAAA,EAAA;AAAA;AAAA,SACH,GACE,IAAA;AAAA,QACH,OAAA,KAAY,MAAA,IAAU,IAAA,KAAS,MAAA,mBAC9B,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAM,iBAAA;AAAA,YACN,CAAA,EAAE,IAAA;AAAA,YACF,CAAA,EAAE,IAAA;AAAA,YACF,aAAA,EAAY,QAAA;AAAA,YACZ,WAAA,EAAU,IAAA;AAAA,YAET,QAAA,EAAA;AAAA;AAAA,SACH,GACE;AAAA,OAAA,EACN;AAAA;AAAA,GACF;AAEJ","file":"gauge.js","sourcesContent":["import { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport {\n type CssColor,\n type CssLength,\n remify,\n} from '../../../shared/styles/css-values.js';\nimport type { ProgressTone } from '../progress-bar/progress-bar.js';\n\nexport type { ProgressTone } from '../progress-bar/progress-bar.js';\n\n/**\n * `full` draws ticks with the value and unit inside the dial, for a stats\n * tile or a standby display; `bare` draws only the arc, fill, and needle, for\n * chip height, and carries the value in its accessible name and hover title.\n */\nexport type GaugeVariant = 'full' | 'bare';\n\n/**\n * A consumer palette, such as dark red on black for a night display. Each\n * color is a typed `CssColor` from `uiColor()`, `colorVar()`, or\n * `fillColor()`; an omitted one keeps the tone's color.\n */\nexport interface GaugeColors {\n /** The unfilled arc. */\n track?: CssColor;\n /** The filled arc from zero to the value. */\n fill?: CssColor;\n /** The needle and its hub. */\n needle?: CssColor;\n /** The value, unit, and ticks of a `full` gauge. */\n text?: CssColor;\n}\n\n/**\n * Application `data-*` identity on the Gauge root, such as `data-key`; its\n * own configuration attributes stay protected.\n */\nexport type GaugeRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined>\n>;\n\nconst GAUGE_PROTECTED = new Set([\n 'data-component',\n 'data-tone',\n 'data-variant',\n 'data-pinned',\n]);\n\nexport interface GaugeProps {\n /**\n * The reading, zero or more. A value above `max` pins the needle and fill\n * at the end of the scale while the text still shows the real value.\n */\n value: number;\n /** The end of the scale, such as the highest expected rate. */\n max: number;\n /** The gauge's accessible name, such as \"Tokens per minute\". */\n label: string;\n /**\n * The value as shown in a `full` dial and spoken, such as \"1.2k\"; defaults\n * to the value rounded to one decimal place.\n */\n valueText?: string;\n /** The unit under the value in a `full` dial, such as \"tok/min\". */\n unit?: string;\n variant?: GaugeVariant;\n tone?: ProgressTone;\n /**\n * The gauge's width as a typed `CssLength`; its height follows the dial.\n * Defaults to 88px for `full` and 40px for `bare`.\n */\n size?: CssLength;\n colors?: GaugeColors;\n id?: string;\n rootAttributes?: GaugeRootAttributes;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/** The dial's center and arc radius in the 100-unit-wide viewBox. */\nconst CENTER = 50;\nconst RADIUS = 42;\n/** The arc sweeps 240 degrees, clockwise from lower left to lower right. */\nconst SWEEP = 240;\nconst START = -SWEEP / 2;\nconst TICKS = 10;\n\nconst DEFAULT_WIDTH: Record<GaugeVariant, number> = { full: 88, bare: 40 };\n/** The viewBox height: `bare` crops below the arc, `full` keeps the readout. */\nconst VIEW_HEIGHT: Record<GaugeVariant, number> = { full: 98, bare: 76 };\n\n/** A point on a circle around the center, `angle` degrees clockwise from up. */\nfunction polar(radius: number, angle: number): [number, number] {\n const radians = (angle * Math.PI) / 180;\n return [\n CENTER + radius * Math.sin(radians),\n CENTER - radius * Math.cos(radians),\n ];\n}\n\nconst fixed = (n: number) => String(Number(n.toFixed(3)));\n\nconst [arcStartX, arcStartY] = polar(RADIUS, START);\nconst [arcEndX, arcEndY] = polar(RADIUS, START + SWEEP);\nconst ARC = `M ${fixed(arcStartX)} ${fixed(arcStartY)} A ${RADIUS} ${RADIUS} 0 1 1 ${fixed(arcEndX)} ${fixed(arcEndY)}`;\n\nconst TICK_LINES = Array.from({ length: TICKS + 1 }, (_, index) => {\n const angle = START + (SWEEP * index) / TICKS;\n const major = index === 0 || index === TICKS / 2 || index === TICKS;\n const [x1, y1] = polar(major ? 27 : 30, angle);\n const [x2, y2] = polar(34, angle);\n return (\n <line\n class={\n major ? 'kui-gauge__tick kui-gauge__tick--major' : 'kui-gauge__tick'\n }\n x1={fixed(x1)}\n y1={fixed(y1)}\n x2={fixed(x2)}\n y2={fixed(y2)}\n />\n );\n});\n\nfunction formatValue(value: number): string {\n return String(Math.round(value * 10) / 10);\n}\n\n/**\n * A speedometer-style dial for a reading on a scale that is not progress,\n * such as a live rate: a track arc, a fill from zero to the value, and a\n * needle, scaled to `max`. `full` adds ticks and the value and unit inside\n * the dial; `bare` is the arc, fill, and needle alone, for chip height. It is\n * a `role=\"meter\"` named by `label`, with the value and unit as\n * `aria-valuetext`. The needle and fill transition only when the value\n * changes, and hold still under reduced motion.\n */\nexport function Gauge({\n value,\n max,\n label,\n valueText,\n unit,\n variant = 'full',\n tone = 'brand',\n size,\n colors = {},\n id,\n rootAttributes = {},\n className = '',\n slot,\n}: GaugeProps) {\n if (!Number.isFinite(max) || max <= 0)\n throw new RangeError('Gauge max must be a positive number.');\n if (!Number.isFinite(value) || value < 0)\n throw new RangeError('Gauge value must be zero or more.');\n const shown = Math.min(value, max);\n const fraction = shown / max;\n const text = valueText ?? formatValue(value);\n const spoken = unit === undefined ? text : `${text} ${unit}`;\n const style = [\n `--_kui-gauge-size:${size ?? remify(DEFAULT_WIDTH[variant])}`,\n colors.track === undefined ? '' : `--_kui-gauge-track:${colors.track}`,\n colors.fill === undefined ? '' : `--_kui-gauge-fill:${colors.fill}`,\n colors.needle === undefined ? '' : `--_kui-gauge-needle:${colors.needle}`,\n colors.text === undefined ? '' : `--_kui-gauge-text:${colors.text}`,\n ]\n .filter(Boolean)\n .join(';');\n return (\n <span\n {...filterDataAttributes(rootAttributes, GAUGE_PROTECTED)}\n id={id}\n class={`kui-gauge ${className}`.trim()}\n data-component=\"gauge\"\n data-tone={tone}\n data-variant={variant}\n data-pinned={value > max ? '' : undefined}\n role=\"meter\"\n aria-label={label}\n aria-valuemin=\"0\"\n aria-valuemax={String(max)}\n aria-valuenow={String(shown)}\n aria-valuetext={spoken}\n title={variant === 'bare' ? `${label}: ${spoken}` : undefined}\n style={style}\n slot={slot}\n >\n <svg viewBox={`0 0 100 ${VIEW_HEIGHT[variant]}`} aria-hidden=\"true\">\n <path class=\"kui-gauge__track\" d={ARC} pathLength={100} />\n <path\n class=\"kui-gauge__fill\"\n d={ARC}\n pathLength={100}\n style={`stroke-dasharray:${fixed(fraction * 100)} 100`}\n />\n {variant === 'full' ? TICK_LINES : null}\n <g\n class=\"kui-gauge__needle\"\n style={`transform:rotate(${fixed(START + SWEEP * fraction)}deg)`}\n >\n <line\n x1={String(CENTER)}\n y1={String(CENTER)}\n x2={String(CENTER)}\n y2={String(CENTER - (variant === 'full' ? 25 : 34))}\n />\n <circle cx={String(CENTER)} cy={String(CENTER)} r=\"5\" />\n </g>\n {variant === 'full' ? (\n <text\n class=\"kui-gauge__value\"\n x=\"50\"\n y=\"83\"\n text-anchor=\"middle\"\n font-size=\"18\"\n >\n {text}\n </text>\n ) : null}\n {variant === 'full' && unit !== undefined ? (\n <text\n class=\"kui-gauge__unit\"\n x=\"50\"\n y=\"95\"\n text-anchor=\"middle\"\n font-size=\"11\"\n >\n {unit}\n </text>\n ) : null}\n </svg>\n </span>\n );\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
export { wireToolbarVisibility } from './chunk-2GOCOLQL.js';
|
|
2
|
+
export { wireOverlaySheets } from './chunk-4RECPEHI.js';
|
|
2
3
|
export { wireCornerStatus } from './chunk-ZKKO4MHC.js';
|
|
3
4
|
export { wireListFocusScroll } from './chunk-QDSZTQXL.js';
|
|
4
5
|
export { wireMessageComposers } from './chunk-HTERKONR.js';
|
|
5
|
-
export { wireOverlaySheets } from './chunk-4RECPEHI.js';
|
|
6
6
|
export { ValuePreview } from './chunk-Y4VR6VNM.js';
|
|
7
7
|
export { TabPanel } from './chunk-OKZTLRGG.js';
|
|
8
8
|
export { Spacer } from './chunk-FQETQ7CM.js';
|
|
9
9
|
export { SplitButton } from './chunk-CRHKWHTA.js';
|
|
10
10
|
export { SunkenPanel } from './chunk-NA4LKVPX.js';
|
|
11
|
-
export {
|
|
11
|
+
export { ScrollEffect } from './chunk-7KN5OQVN.js';
|
|
12
|
+
export { SegmentedControl } from './chunk-TTFW6E6C.js';
|
|
12
13
|
export { SizedRegion } from './chunk-ECVTRAXN.js';
|
|
13
14
|
export { RadioGroup } from './chunk-MLDO7WLA.js';
|
|
14
|
-
export { ScrollEffect } from './chunk-7KN5OQVN.js';
|
|
15
15
|
export { MessageComposer } from './chunk-R6FIXYAE.js';
|
|
16
16
|
export { EdgeActivityIndicator } from './chunk-5KWXM5O7.js';
|
|
17
17
|
export { EditorFrame } from './chunk-V6N3YLTM.js';
|
|
18
|
+
export { wireSummaryRows } from './chunk-CKPI4WIN.js';
|
|
18
19
|
export { reorderTabs, wireTabBars } from './chunk-ADMWT7FX.js';
|
|
19
20
|
export { wireTextFields } from './chunk-KC6WUSNS.js';
|
|
20
21
|
export { wireResizableRegions } from './chunk-JZZVWTUB.js';
|
|
21
22
|
export { wireSearchFields } from './chunk-TPLVC5BE.js';
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
export { fileMatchesAccept, wireFilePickers } from './chunk-KK3S5OTW.js';
|
|
24
25
|
export { wireForms } from './chunk-44AOBT2F.js';
|
|
25
26
|
export { reorderListItems, wireListReorder } from './chunk-MJ5RU6XT.js';
|
|
@@ -28,11 +29,10 @@ export { wireScrollDividers } from './chunk-VNT4MXR5.js';
|
|
|
28
29
|
export { wireCheckboxes } from './chunk-CNM6ZWP2.js';
|
|
29
30
|
export { readChoiceChips, wireChoiceChips } from './chunk-VPDSPD76.js';
|
|
30
31
|
export { wireComboboxes } from './chunk-MVKHSAKE.js';
|
|
31
|
-
|
|
32
|
+
export { TextField } from './chunk-RGB4DPMN.js';
|
|
32
33
|
export { ValueTable, ValueTableRow } from './chunk-WSPXSWFG.js';
|
|
33
34
|
export { TabBarItem } from './chunk-Q7RILH2D.js';
|
|
34
35
|
export { TabBar } from './chunk-4IXG6XCT.js';
|
|
35
|
-
export { TextField } from './chunk-RGB4DPMN.js';
|
|
36
36
|
export { StateBanner } from './chunk-LOW7J7SE.js';
|
|
37
37
|
export { SummaryRow } from './chunk-JHUEYWWI.js';
|
|
38
38
|
export { createSearchFieldModel } from './chunk-CIAUILRR.js';
|
|
@@ -64,6 +64,7 @@ export { ListInsetControl } from './chunk-3TBMGGTA.js';
|
|
|
64
64
|
export { Switch } from './chunk-C4FBYP2D.js';
|
|
65
65
|
export { SearchField, placeSearchFieldCaret, readSearchField } from './chunk-UD5KHQOH.js';
|
|
66
66
|
export { Row } from './chunk-CCPWJDRW.js';
|
|
67
|
+
export { ListInsetText } from './chunk-CJAKN2KZ.js';
|
|
67
68
|
export { PopupMenu, closePopupMenu, openPopupMenu, openPopupMenuAt } from './chunk-BZXA5SSA.js';
|
|
68
69
|
|
|
69
70
|
|
|
@@ -71,15 +72,14 @@ export { ResizableRegion, clampRegionSize, resizeRegionFromPointer } from './chu
|
|
|
71
72
|
export { ToolbarText } from './chunk-JAC6AVZN.js';
|
|
72
73
|
export { ListHeader } from './chunk-SPI6VMIY.js';
|
|
73
74
|
export { FieldLabel, Text } from './chunk-F34LHBQI.js';
|
|
74
|
-
export { ListInsetText } from './chunk-CJAKN2KZ.js';
|
|
75
75
|
export { FloatingToolbar } from './chunk-E7Q6UNCB.js';
|
|
76
76
|
export { DisclosureArrow } from './chunk-RPJOLDSR.js';
|
|
77
77
|
export { ToolbarActionLink, ToolbarButton, ToolbarControlGroup } from './chunk-EXGDKG7B.js';
|
|
78
|
-
export { Toolbar } from './chunk-SWXWLSUD.js';
|
|
79
78
|
export { Pane } from './chunk-KACJOE2N.js';
|
|
80
79
|
|
|
81
80
|
|
|
82
81
|
export { ensureSunkenTexture } from './chunk-IKS72C6P.js';
|
|
82
|
+
export { Toolbar } from './chunk-SWXWLSUD.js';
|
|
83
83
|
|
|
84
84
|
export { ListItem, ListItemLink } from './chunk-2E7S5C4D.js';
|
|
85
85
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SplitView } from './chunk-
|
|
1
|
+
import { SplitView } from './chunk-SVUJIVMR.js';
|
|
2
2
|
import { DialogSurface } from './chunk-LD6A6PYB.js';
|
|
3
3
|
export { closeDialog, openDialog } from './chunk-FJMABKKV.js';
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ export { closeDialog, openDialog } from './chunk-FJMABKKV.js';
|
|
|
7
7
|
import { ToolbarText } from './chunk-JAC6AVZN.js';
|
|
8
8
|
|
|
9
9
|
import { ToolbarControlGroup } from './chunk-EXGDKG7B.js';
|
|
10
|
-
import { Toolbar } from './chunk-SWXWLSUD.js';
|
|
11
10
|
import { Pane } from './chunk-KACJOE2N.js';
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
|
|
14
|
+
import { Toolbar } from './chunk-SWXWLSUD.js';
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
package/dist/nav-stack.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as kerfjs from 'kerfjs';
|
|
2
2
|
import { K as KerfUiContent } from './semantic-content-BbzjvSu9.js';
|
|
3
3
|
import { R as RootDataAttributes } from './extension-attributes-IJ4decoa.js';
|
|
4
|
+
import { S as SemanticTone } from './semantic-tone-CdW013KF.js';
|
|
5
|
+
|
|
6
|
+
/** A badge's value: a count, short text, or `true` for a text-free dot. */
|
|
7
|
+
type BadgeValue = number | string | true;
|
|
4
8
|
|
|
5
9
|
type SegmentedControlAppearance = 'filled' | 'outlined' | 'toolbar';
|
|
6
10
|
type SegmentedControlShape = 'rounded' | 'pill';
|
|
@@ -12,6 +16,23 @@ interface SegmentedControlChoice<Value extends string = string> {
|
|
|
12
16
|
content?: KerfUiContent;
|
|
13
17
|
title?: string;
|
|
14
18
|
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* A count, short text, or `true` for a text-free dot over the choice's
|
|
21
|
+
* top-trailing corner, such as how many workers are live. A count of 0 (or
|
|
22
|
+
* less) and empty text show no badge, and a `placeholder` control shows
|
|
23
|
+
* none. The badge is decorative (`aria-hidden`): put its meaning in `label`
|
|
24
|
+
* and `title` yourself, for example "Workers View, 2 live". Since `label`
|
|
25
|
+
* is also the visible text when `content` is omitted, give a badged choice
|
|
26
|
+
* its own `content`, such as an icon.
|
|
27
|
+
*/
|
|
28
|
+
badge?: BadgeValue;
|
|
29
|
+
/** The badge's tone (default `danger`). */
|
|
30
|
+
badgeTone?: SemanticTone;
|
|
31
|
+
/**
|
|
32
|
+
* The largest count shown in full; a larger count shows as `{badgeMax}+`
|
|
33
|
+
* (default 99, so 100 shows "99+"). Text badges are shown as given.
|
|
34
|
+
*/
|
|
35
|
+
badgeMax?: number;
|
|
15
36
|
}
|
|
16
37
|
interface SegmentedControlProps<Value extends string = string> {
|
|
17
38
|
id: string;
|
package/dist/split-view.js
CHANGED
package/dist/styles/badge.css
CHANGED
|
@@ -186,3 +186,42 @@
|
|
|
186
186
|
0 0 0 2px var(--_kui-toolbar-control-group-badge-ring),
|
|
187
187
|
0 0 0 2px var(--kui-color-surface);
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
/* A corner badge on a SegmentedControl choice (SegmentedControlChoice
|
|
191
|
+
`badge`, KF-170258): the same 16px pill as a toolbar button's, its top on
|
|
192
|
+
the segment's top edge so its bottom covers only the top row of the
|
|
193
|
+
segment's centered 16px icon. It never rises past the segment: a filled or
|
|
194
|
+
outlined track scrolls sideways, which clips vertically too. */
|
|
195
|
+
.kui-segmented-control__item > .kui-badge[data-placement="corner"] {
|
|
196
|
+
inset-block-start: -0.0625rem;
|
|
197
|
+
inset-inline-end: 0.1875rem;
|
|
198
|
+
/* The segment's fill (the context value the control provides: none at
|
|
199
|
+
rest, then hover or selected) over its track's surface, over an opaque
|
|
200
|
+
surface, so a translucent fill still cuts cleanly. */
|
|
201
|
+
box-shadow:
|
|
202
|
+
0 0 0 2px var(--_kui-segmented-control-badge-ring),
|
|
203
|
+
0 0 0 2px var(--_kui-segmented-control-badge-base),
|
|
204
|
+
0 0 0 2px var(--kui-color-surface);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* A filled or outlined track clips at its padding edge, 1px above a segment,
|
|
208
|
+
so the mark sits 1px lower there and its ring still clears the clip. */
|
|
209
|
+
.kui-segmented-control:not([data-appearance="toolbar"])
|
|
210
|
+
> .kui-segmented-control__item
|
|
211
|
+
> .kui-badge[data-placement="corner"]:not([data-size="dot"]) {
|
|
212
|
+
inset-block-start: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.kui-segmented-control__item
|
|
216
|
+
> .kui-badge[data-placement="corner"]:not([data-size="dot"]) {
|
|
217
|
+
min-width: 1rem;
|
|
218
|
+
min-height: 1rem;
|
|
219
|
+
padding-inline: 0.25rem;
|
|
220
|
+
font-size: var(--kui-font-2xs);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.kui-segmented-control__item
|
|
224
|
+
> .kui-badge[data-placement="corner"][data-size="dot"] {
|
|
225
|
+
inset-block-start: 0.375rem;
|
|
226
|
+
inset-inline-end: 0.375rem;
|
|
227
|
+
}
|
|
@@ -186,3 +186,42 @@
|
|
|
186
186
|
0 0 0 2px var(--_kui-toolbar-control-group-badge-ring),
|
|
187
187
|
0 0 0 2px var(--kui-color-surface);
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
/* A corner badge on a SegmentedControl choice (SegmentedControlChoice
|
|
191
|
+
`badge`, KF-170258): the same 16px pill as a toolbar button's, its top on
|
|
192
|
+
the segment's top edge so its bottom covers only the top row of the
|
|
193
|
+
segment's centered 16px icon. It never rises past the segment: a filled or
|
|
194
|
+
outlined track scrolls sideways, which clips vertically too. */
|
|
195
|
+
.kui-segmented-control__item > .kui-badge[data-placement="corner"] {
|
|
196
|
+
inset-block-start: -0.0625rem;
|
|
197
|
+
inset-inline-end: 0.1875rem;
|
|
198
|
+
/* The segment's fill (the context value the control provides: none at
|
|
199
|
+
rest, then hover or selected) over its track's surface, over an opaque
|
|
200
|
+
surface, so a translucent fill still cuts cleanly. */
|
|
201
|
+
box-shadow:
|
|
202
|
+
0 0 0 2px var(--_kui-segmented-control-badge-ring),
|
|
203
|
+
0 0 0 2px var(--_kui-segmented-control-badge-base),
|
|
204
|
+
0 0 0 2px var(--kui-color-surface);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* A filled or outlined track clips at its padding edge, 1px above a segment,
|
|
208
|
+
so the mark sits 1px lower there and its ring still clears the clip. */
|
|
209
|
+
.kui-segmented-control:not([data-appearance="toolbar"])
|
|
210
|
+
> .kui-segmented-control__item
|
|
211
|
+
> .kui-badge[data-placement="corner"]:not([data-size="dot"]) {
|
|
212
|
+
inset-block-start: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.kui-segmented-control__item
|
|
216
|
+
> .kui-badge[data-placement="corner"]:not([data-size="dot"]) {
|
|
217
|
+
min-width: 1rem;
|
|
218
|
+
min-height: 1rem;
|
|
219
|
+
padding-inline: 0.25rem;
|
|
220
|
+
font-size: var(--kui-font-2xs);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.kui-segmented-control__item
|
|
224
|
+
> .kui-badge[data-placement="corner"][data-size="dot"] {
|
|
225
|
+
inset-block-start: 0.375rem;
|
|
226
|
+
inset-inline-end: 0.375rem;
|
|
227
|
+
}
|