pixelize-design-library 2.4.2-beta.3 → 2.4.2-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/Accordion/Accordion.js +5 -3
- package/dist/Components/AppSwitcher/AppMark.d.ts +19 -0
- package/dist/Components/AppSwitcher/AppMark.js +62 -0
- package/dist/Components/AppSwitcher/AppSwitcher.d.ts +4 -0
- package/dist/Components/AppSwitcher/AppSwitcher.js +315 -0
- package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +64 -0
- package/dist/Components/AppSwitcher/AppSwitcherProps.js +86 -0
- package/dist/Components/AppSwitcher/useAppSwitcherShortcut.d.ts +3 -0
- package/dist/Components/AppSwitcher/useAppSwitcherShortcut.js +31 -0
- package/dist/Components/AppearanceSettings/AppearanceSettings.js +2 -1
- package/dist/Components/Button/Button.d.ts +2 -2
- package/dist/Components/Button/Button.js +4 -3
- package/dist/Components/Button/Button.styles.js +62 -15
- package/dist/Components/Button/ButtonProps.d.ts +6 -1
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +6 -6
- package/dist/Components/Card/Card.d.ts +1 -1
- package/dist/Components/Card/Card.js +2 -2
- package/dist/Components/Card/CardProps.d.ts +0 -1
- package/dist/Components/Card/PaymentCard/PaymentCard.js +7 -7
- package/dist/Components/Checkbox/Checkbox.js +1 -1
- package/dist/Components/Checkbox/Checkbox.styles.js +12 -7
- package/dist/Components/Common/fieldStyles.js +1 -1
- package/dist/Components/CopyButton/CopyButton.js +6 -2
- package/dist/Components/CustomModulesTable/EditModuleModal.js +1 -1
- package/dist/Components/DatePicker/CalendarPanel.d.ts +5 -0
- package/dist/Components/DatePicker/CalendarPanel.js +24 -5
- package/dist/Components/DatePicker/DatePickerProps.d.ts +21 -0
- package/dist/Components/DatePicker/RangeDatePicker.js +4 -4
- package/dist/Components/DatePicker/SingleDatePicker.js +2 -2
- package/dist/Components/DatePicker/TimeOnlyPicker.js +1 -1
- package/dist/Components/DatePicker/dayStates.d.ts +56 -0
- package/dist/Components/DatePicker/dayStates.js +87 -0
- package/dist/Components/Dropdown/DropDown.js +7 -15
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +1 -1
- package/dist/Components/EmptyState/EmptyState.js +2 -1
- package/dist/Components/FilePreview/FilePreview.js +1 -1
- package/dist/Components/FileUpload/FileUpload.js +5 -4
- package/dist/Components/FileUpload/FileUploadProps.d.ts +3 -1
- package/dist/Components/FileUpload/constants.js +1 -0
- package/dist/Components/FilterSidebar/FilterSidebar.js +4 -4
- package/dist/Components/FilterSidebar/filterHoverStyle.d.ts +0 -9
- package/dist/Components/FilterSidebar/filterHoverStyle.js +4 -10
- package/dist/Components/Form/FormWrapper.js +1 -1
- package/dist/Components/Header/components/mobileMenu.js +12 -3
- package/dist/Components/Input/TextInput.styles.js +6 -4
- package/dist/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/Components/KanbanBoard/KanbanBoard.js +5 -45
- package/dist/Components/LimitReachedModal/LimitReachedModal.js +4 -5
- package/dist/Components/Loading/Loading.js +15 -14
- package/dist/Components/MultiSelect/MultiSelect.js +1 -1
- package/dist/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/Components/NoteTextArea/NoteTextArea.js +9 -4
- package/dist/Components/NumberInput/NumberInput.js +3 -1
- package/dist/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +2 -2
- package/dist/Components/PdfViewer/PdfViewer.js +6 -1
- package/dist/Components/PinInput/PinInput.js +1 -1
- package/dist/Components/PlanPill/PlanPill.js +5 -5
- package/dist/Components/PlanPill/planPillGradient.d.ts +2 -14
- package/dist/Components/PlanPill/planPillGradient.js +3 -15
- package/dist/Components/Primitives/Primitives.d.ts +6 -0
- package/dist/Components/Primitives/Primitives.js +113 -0
- package/dist/Components/ProductCard/ProductPrice.js +1 -1
- package/dist/Components/ProductCard/ProductReview.js +6 -1
- package/dist/Components/ProductCard/ProductTags.js +1 -1
- package/dist/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +1 -1
- package/dist/Components/RadioButton/RadioButton.js +3 -2
- package/dist/Components/Reorder/Reorder.js +1 -1
- package/dist/Components/ScrollToTop/ScrollToTop.js +2 -0
- package/dist/Components/ScrollbarBox/ScrollbarBox.d.ts +13 -0
- package/dist/Components/ScrollbarBox/ScrollbarBox.js +11 -0
- package/dist/Components/Search/Search.js +2 -2
- package/dist/Components/SearchSelect/SearchSelect.js +14 -9
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +2 -0
- package/dist/Components/SegmentedControl/SegmentedControl.js +58 -0
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +16 -0
- package/dist/Components/SegmentedControl/SegmentedControlProps.js +2 -0
- package/dist/Components/Select/Select.d.ts +1 -1
- package/dist/Components/Select/Select.js +4 -2
- package/dist/Components/Select/Select.styles.js +3 -2
- package/dist/Components/Select/SelectProps.d.ts +3 -0
- package/dist/Components/SelectSearch/SelectSearch.js +7 -4
- package/dist/Components/SelectV2/SelectV2.js +18 -14
- package/dist/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/Components/SideBar/SideBar.js +1 -1
- package/dist/Components/SideBar/components/MenuPopoverContent.js +2 -2
- package/dist/Components/Slider/Slider.js +8 -1
- package/dist/Components/StageProgress/StageProgress.js +2 -9
- package/dist/Components/StageProgress/StepperStage.js +2 -2
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +17 -24
- package/dist/Components/Table/TableProps.d.ts +4 -0
- package/dist/Components/Table/components/Pagination.js +1 -1
- package/dist/Components/Table/components/TableActions.js +2 -2
- package/dist/Components/Table/components/TableBody.js +41 -12
- package/dist/Components/Table/components/TableGroupRow.js +1 -1
- package/dist/Components/Table/components/TableHeader.js +21 -8
- package/dist/Components/Table/components/TableSearch.js +1 -1
- package/dist/Components/Table/filters/ActiveFilters.js +2 -18
- package/dist/Components/Table/settings/ManageColumns.js +4 -17
- package/dist/Components/Table/settings/TableSettings.js +5 -11
- package/dist/Components/Table/variants/TableVariantContext.d.ts +4 -0
- package/dist/Components/Table/variants/TableVariantContext.js +17 -0
- package/dist/Components/Table/variants/classic.d.ts +6 -0
- package/dist/Components/Table/variants/classic.js +47 -0
- package/dist/Components/Table/variants/index.d.ts +7 -0
- package/dist/Components/Table/variants/index.js +27 -0
- package/dist/Components/Table/variants/pillInk.d.ts +6 -0
- package/dist/Components/Table/variants/pillInk.js +21 -0
- package/dist/Components/Table/variants/studio.d.ts +6 -0
- package/dist/Components/Table/variants/studio.js +50 -0
- package/dist/Components/Table/variants/tokens.d.ts +49 -0
- package/dist/Components/Table/variants/tokens.js +2 -0
- package/dist/Components/Tag/Tag.styles.js +3 -4
- package/dist/Components/Timeline/Timeline.js +2 -2
- package/dist/Components/Toaster/Toaster.js +1 -1
- package/dist/Components/Toggle/TableToggle.js +11 -7
- package/dist/Components/ToggleSwitch/ToggleSwitch.d.ts +2 -0
- package/dist/Components/ToggleSwitch/ToggleSwitch.js +18 -0
- package/dist/Components/ToggleSwitch/ToggleSwitchProps.d.ts +11 -0
- package/dist/Components/ToggleSwitch/ToggleSwitchProps.js +2 -0
- package/dist/Components/ToolTip/ToolTip.js +6 -6
- package/dist/Components/ToolTip/ToolTipProps.d.ts +3 -1
- package/dist/Components/Trail/TrailWorks.js +1 -1
- package/dist/Components/UpgradeButton/UpgradeButton.js +3 -3
- package/dist/Constants/Sidebar.js +3 -2
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +3 -2
- package/dist/Theme/chakra/Menu.styles.d.ts +3 -0
- package/dist/Theme/chakra/Menu.styles.js +5 -0
- package/dist/Theme/chakra/Popover.styles.d.ts +3 -0
- package/dist/Theme/chakra/Popover.styles.js +5 -1
- package/dist/Theme/chakra/componentStyles.d.ts +6 -0
- package/dist/Theme/chakra/createBrandTheme.js +10 -16
- package/dist/Theme/chakra/focusRing.styles.d.ts +52 -0
- package/dist/Theme/chakra/focusRing.styles.js +46 -0
- package/dist/Theme/provider/ThemeSwitcher.js +5 -2
- package/dist/Theme/tokens/brands/index.js +6 -1
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +6 -1
- package/dist/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/Theme/tokens/builders/focusRing.d.ts +52 -0
- package/dist/Theme/tokens/builders/focusRing.js +92 -0
- package/dist/Theme/tokens/builders/gradientInk.d.ts +22 -0
- package/dist/Theme/tokens/builders/gradientInk.js +28 -0
- package/dist/Theme/tokens/builders/index.d.ts +4 -0
- package/dist/Theme/tokens/builders/index.js +4 -0
- package/dist/Theme/tokens/builders/outlineRung.d.ts +46 -3
- package/dist/Theme/tokens/builders/outlineRung.js +101 -5
- package/dist/Theme/tokens/builders/placeholderInk.d.ts +19 -0
- package/dist/Theme/tokens/builders/placeholderInk.js +35 -0
- package/dist/Theme/tokens/builders/resolvedRungs.d.ts +5 -1
- package/dist/Theme/tokens/builders/resolvedRungs.js +7 -2
- package/dist/Theme/tokens/builders/rowStates.d.ts +13 -0
- package/dist/Theme/tokens/builders/rowStates.js +19 -0
- package/dist/Theme/tokens/builders/scrollbar.d.ts +12 -0
- package/dist/Theme/tokens/builders/scrollbar.js +57 -0
- package/dist/Theme/tokens/builders/surfaceRungs.d.ts +5 -0
- package/dist/Theme/tokens/builders/surfaceRungs.js +20 -5
- package/dist/Theme/tokens/types.d.ts +21 -1
- package/dist/esm/Components/Accordion/Accordion.js +5 -3
- package/dist/esm/Components/AppSwitcher/AppMark.js +56 -0
- package/dist/esm/Components/AppSwitcher/AppSwitcher.js +280 -0
- package/dist/esm/Components/AppSwitcher/AppSwitcherProps.js +78 -0
- package/dist/esm/Components/AppSwitcher/useAppSwitcherShortcut.js +27 -0
- package/dist/esm/Components/AppearanceSettings/AppearanceSettings.js +2 -1
- package/dist/esm/Components/Button/Button.js +5 -4
- package/dist/esm/Components/Button/Button.styles.js +63 -16
- package/dist/esm/Components/ButtonGroupIcon/ButtonGroupIcon.js +6 -6
- package/dist/esm/Components/Card/Card.js +2 -2
- package/dist/esm/Components/Card/PaymentCard/PaymentCard.js +7 -7
- package/dist/esm/Components/Checkbox/Checkbox.js +1 -1
- package/dist/esm/Components/Checkbox/Checkbox.styles.js +13 -8
- package/dist/esm/Components/Common/fieldStyles.js +1 -1
- package/dist/esm/Components/CopyButton/CopyButton.js +7 -3
- package/dist/esm/Components/CustomModulesTable/EditModuleModal.js +1 -1
- package/dist/esm/Components/DatePicker/CalendarPanel.js +24 -5
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +4 -4
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +2 -2
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +1 -1
- package/dist/esm/Components/DatePicker/dayStates.js +79 -0
- package/dist/esm/Components/Dropdown/DropDown.js +7 -15
- package/dist/esm/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +1 -1
- package/dist/esm/Components/EmptyState/EmptyState.js +2 -1
- package/dist/esm/Components/FilePreview/FilePreview.js +1 -1
- package/dist/esm/Components/FileUpload/FileUpload.js +6 -5
- package/dist/esm/Components/FileUpload/constants.js +1 -0
- package/dist/esm/Components/FilterSidebar/FilterSidebar.js +4 -4
- package/dist/esm/Components/FilterSidebar/filterHoverStyle.js +4 -10
- package/dist/esm/Components/Form/FormWrapper.js +1 -1
- package/dist/esm/Components/Header/components/mobileMenu.js +12 -3
- package/dist/esm/Components/Input/TextInput.styles.js +6 -4
- package/dist/esm/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/esm/Components/KanbanBoard/KanbanBoard.js +5 -45
- package/dist/esm/Components/LimitReachedModal/LimitReachedModal.js +4 -5
- package/dist/esm/Components/Loading/Loading.js +12 -11
- package/dist/esm/Components/MultiSelect/MultiSelect.js +1 -1
- package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/esm/Components/NoteTextArea/NoteTextArea.js +9 -4
- package/dist/esm/Components/NumberInput/NumberInput.js +4 -2
- package/dist/esm/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +2 -2
- package/dist/esm/Components/PdfViewer/PdfViewer.js +6 -1
- package/dist/esm/Components/PinInput/PinInput.js +1 -1
- package/dist/esm/Components/PlanPill/PlanPill.js +6 -6
- package/dist/esm/Components/PlanPill/planPillGradient.js +3 -15
- package/dist/esm/Components/Primitives/Primitives.js +6 -0
- package/dist/esm/Components/ProductCard/ProductPrice.js +1 -1
- package/dist/esm/Components/ProductCard/ProductReview.js +6 -1
- package/dist/esm/Components/ProductCard/ProductTags.js +1 -1
- package/dist/esm/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +1 -1
- package/dist/esm/Components/RadioButton/RadioButton.js +3 -2
- package/dist/esm/Components/Reorder/Reorder.js +1 -1
- package/dist/esm/Components/ScrollToTop/ScrollToTop.js +2 -0
- package/dist/esm/Components/ScrollbarBox/ScrollbarBox.js +9 -0
- package/dist/esm/Components/Search/Search.js +2 -2
- package/dist/esm/Components/SearchSelect/SearchSelect.js +14 -9
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +55 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControlProps.js +1 -0
- package/dist/esm/Components/Select/Select.js +5 -3
- package/dist/esm/Components/Select/Select.styles.js +3 -2
- package/dist/esm/Components/SelectSearch/SelectSearch.js +7 -4
- package/dist/esm/Components/SelectV2/SelectV2.js +18 -14
- package/dist/esm/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/esm/Components/SideBar/SideBar.js +1 -1
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +2 -2
- package/dist/esm/Components/Slider/Slider.js +8 -1
- package/dist/esm/Components/StageProgress/StageProgress.js +2 -9
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -2
- package/dist/esm/Components/Table/Table.js +17 -24
- package/dist/esm/Components/Table/components/Pagination.js +1 -1
- package/dist/esm/Components/Table/components/TableActions.js +2 -2
- package/dist/esm/Components/Table/components/TableBody.js +42 -13
- package/dist/esm/Components/Table/components/TableGroupRow.js +1 -1
- package/dist/esm/Components/Table/components/TableHeader.js +21 -8
- package/dist/esm/Components/Table/components/TableSearch.js +1 -1
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -18
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -17
- package/dist/esm/Components/Table/settings/TableSettings.js +5 -11
- package/dist/esm/Components/Table/variants/TableVariantContext.js +13 -0
- package/dist/esm/Components/Table/variants/classic.js +43 -0
- package/dist/esm/Components/Table/variants/index.js +9 -0
- package/dist/esm/Components/Table/variants/pillInk.js +18 -0
- package/dist/esm/Components/Table/variants/studio.js +46 -0
- package/dist/esm/Components/Table/variants/tokens.js +1 -0
- package/dist/esm/Components/Tag/Tag.styles.js +3 -4
- package/dist/esm/Components/Timeline/Timeline.js +2 -2
- package/dist/esm/Components/Toaster/Toaster.js +1 -1
- package/dist/esm/Components/Toggle/TableToggle.js +11 -7
- package/dist/esm/Components/ToggleSwitch/ToggleSwitch.js +15 -0
- package/dist/esm/Components/ToggleSwitch/ToggleSwitchProps.js +1 -0
- package/dist/esm/Components/ToolTip/ToolTip.js +6 -6
- package/dist/esm/Components/Trail/TrailWorks.js +1 -1
- package/dist/esm/Components/UpgradeButton/UpgradeButton.js +3 -3
- package/dist/esm/Constants/Sidebar.js +3 -2
- package/dist/esm/Theme/assertPalette.js +3 -2
- package/dist/esm/Theme/chakra/Menu.styles.js +5 -0
- package/dist/esm/Theme/chakra/Popover.styles.js +5 -1
- package/dist/esm/Theme/chakra/createBrandTheme.js +10 -16
- package/dist/esm/Theme/chakra/focusRing.styles.js +40 -0
- package/dist/esm/Theme/provider/ThemeSwitcher.js +5 -2
- package/dist/esm/Theme/tokens/brands/index.js +6 -1
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +6 -1
- package/dist/esm/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/esm/Theme/tokens/builders/focusRing.js +85 -0
- package/dist/esm/Theme/tokens/builders/gradientInk.js +22 -0
- package/dist/esm/Theme/tokens/builders/index.js +4 -0
- package/dist/esm/Theme/tokens/builders/outlineRung.js +96 -4
- package/dist/esm/Theme/tokens/builders/placeholderInk.js +29 -0
- package/dist/esm/Theme/tokens/builders/resolvedRungs.js +7 -2
- package/dist/esm/Theme/tokens/builders/rowStates.js +15 -0
- package/dist/esm/Theme/tokens/builders/scrollbar.js +52 -0
- package/dist/esm/Theme/tokens/builders/surfaceRungs.js +20 -5
- package/dist/esm/index.js +24 -1
- package/dist/index.d.ts +27 -3
- package/dist/index.js +64 -4
- package/package.json +8 -2
|
@@ -46,6 +46,7 @@ const sidebarAccent_1 = require("../builders/sidebarAccent");
|
|
|
46
46
|
const mutedText_1 = require("../builders/mutedText");
|
|
47
47
|
const semanticText_1 = require("../builders/semanticText");
|
|
48
48
|
const resolvedRungs_1 = require("../builders/resolvedRungs");
|
|
49
|
+
const focusRing_1 = require("../builders/focusRing");
|
|
49
50
|
const surfaceRungs_1 = require("../builders/surfaceRungs");
|
|
50
51
|
/** Derived, never hand-written: a copied hex goes stale the moment a canvas moves. */
|
|
51
52
|
const finalizeLightPalette = (source) => ({
|
|
@@ -56,9 +57,13 @@ const finalizeLightPalette = (source) => ({
|
|
|
56
57
|
semanticText: (0, semanticText_1.buildSemanticText)(source.semantic, source.backgroundColor.main),
|
|
57
58
|
onPrimary: (0, accentText_1.onFilled)(source.primary[500], source.white, source.black),
|
|
58
59
|
onSemantic: (0, semanticText_1.buildOnSemantic)(source.semantic, source.white, source.black),
|
|
60
|
+
focusRing: (0, focusRing_1.buildFocusRing)(source),
|
|
59
61
|
});
|
|
60
62
|
exports.finalizeLightPalette = finalizeLightPalette;
|
|
61
|
-
|
|
63
|
+
// `withFocusRing` is outermost: it is the only step that reads `primary` and the surfaces
|
|
64
|
+
// TOGETHER, so it must see both after every earlier step — and after a brand file's own
|
|
65
|
+
// post-derivation overrides (zinc dark replaces `primary` and `background` wholesale).
|
|
66
|
+
const resolveRungs = (palette) => (0, focusRing_1.withFocusRing)((0, surfaceRungs_1.withSurfaceRungs)((0, resolvedRungs_1.withTableHoverRung)((0, resolvedRungs_1.withPlaceholderRung)((0, outlineRung_1.withOutlineRung)(palette)))));
|
|
62
67
|
const lightBrand = (source) => resolveRungs((0, exports.finalizeLightPalette)(source));
|
|
63
68
|
/** Light palette per brand. `lavender` is the base the other six extend. */
|
|
64
69
|
exports.lightPalettes = {
|
|
@@ -197,6 +197,7 @@ declare const palette: {
|
|
|
197
197
|
purple: import("../..").ColorScale;
|
|
198
198
|
pink: import("../..").ColorScale;
|
|
199
199
|
backgroundColor: import("../..").NamedSurfaces;
|
|
200
|
+
focusRing: import("../..").FocusRingTokens;
|
|
200
201
|
sidebar: import("../..").SidebarTokens;
|
|
201
202
|
semanticText: import("../..").SemanticTextTokens;
|
|
202
203
|
textMuted: string;
|
|
@@ -8,6 +8,7 @@ const accentText_1 = require("./accentText");
|
|
|
8
8
|
const sidebarAccent_1 = require("./sidebarAccent");
|
|
9
9
|
const mutedText_1 = require("./mutedText");
|
|
10
10
|
const semanticText_1 = require("./semanticText");
|
|
11
|
+
const focusRing_1 = require("./focusRing");
|
|
11
12
|
/**
|
|
12
13
|
* Derives a brand's dark palette from its light palette.
|
|
13
14
|
*
|
|
@@ -246,6 +247,7 @@ function buildDarkPalette(light) {
|
|
|
246
247
|
]));
|
|
247
248
|
const white = light.white;
|
|
248
249
|
const primary = liftBrand(light.primary, white);
|
|
250
|
+
const background = fromTargets(hueSource, SURFACE_TARGETS, SURFACE_SAT);
|
|
249
251
|
const semantic = {
|
|
250
252
|
success: liftAccent(light.semantic.success, white),
|
|
251
253
|
error: liftAccent(light.semantic.error, white),
|
|
@@ -276,7 +278,7 @@ function buildDarkPalette(light) {
|
|
|
276
278
|
purple: (0, exports.reverseScale)(light.purple),
|
|
277
279
|
pink: (0, exports.reverseScale)(light.pink),
|
|
278
280
|
backgroundColor: namedSurfaces,
|
|
279
|
-
background
|
|
281
|
+
background,
|
|
280
282
|
text: fromTargets(hueSource, TEXT_TARGETS, TEXT_SAT),
|
|
281
283
|
header: fromTargets(hueSource, TEXT_TARGETS, TEXT_SAT + 2),
|
|
282
284
|
placeholder: fromTargets(hueSource, PLACEHOLDER_TARGETS, PLACEHOLDER_SAT),
|
|
@@ -293,6 +295,9 @@ function buildDarkPalette(light) {
|
|
|
293
295
|
semanticText: (0, semanticText_1.buildSemanticText)(semantic, namedSurfaces.main),
|
|
294
296
|
onPrimary: (0, accentText_1.onFilled)(primary[500], light.white, light.black),
|
|
295
297
|
onSemantic: (0, semanticText_1.buildOnSemantic)(semantic, light.white, light.black),
|
|
298
|
+
// The dark ring is derived from the LIFTED accent against the dark canvas, not copied from
|
|
299
|
+
// light: the two modes squeeze it from opposite sides, so a shared value fails one of them.
|
|
300
|
+
focusRing: (0, focusRing_1.buildFocusRing)({ primary, background, backgroundColor: namedSurfaces }),
|
|
296
301
|
// Sidebar is already near-black in light mode, so it needs no inversion.
|
|
297
302
|
sidebar: (0, sidebarAccent_1.withSidebarTokens)(light),
|
|
298
303
|
boxShadow: {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { FocusRingTokens, PaletteProps } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* The nearest re-lighting of `hex` that clears `target` against EVERY backdrop at once.
|
|
4
|
+
*
|
|
5
|
+
* Not `settleAcross`: that folds one `liftToContrast` per surface, and each lift walks AWAY from
|
|
6
|
+
* the surface it was handed. That is correct when every backdrop sits on the same side of the ink
|
|
7
|
+
* (its case — a set of light surfaces, or a set of dark ones), and wrong here, where a focus ring
|
|
8
|
+
* is squeezed BETWEEN a near-white canvas and a mid-dark button fill: the lift against the fill
|
|
9
|
+
* walks straight back across the canvas it had just cleared. Seeding `settleAcross` with
|
|
10
|
+
* `primary[500]` measured 1.08-1.99 on the light canvas for every brand for exactly that reason.
|
|
11
|
+
*
|
|
12
|
+
* Walking outward from the seed and testing every backdrop at each step keeps the result the
|
|
13
|
+
* CLOSEST passing colour to the brand accent, so the ring still reads as brand chrome. Contrast is
|
|
14
|
+
* a function of relative luminance alone, and lightness sweeps luminance monotonically from 0 to 1,
|
|
15
|
+
* so if any colour on this hue clears the set, this finds it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function settleBetween(hex: string, backdrops: readonly string[], target?: number): string;
|
|
18
|
+
/** Everything the ring is derived from. A `PaletteProps` satisfies it; so does a brand source. */
|
|
19
|
+
export type FocusRingSource = Pick<PaletteProps, "primary" | "background" | "backgroundColor">;
|
|
20
|
+
/**
|
|
21
|
+
* The three backdrops a focused button's ring is actually drawn against: the page canvas, a card
|
|
22
|
+
* surface, and — because a solid button's ring sits directly against its own fill — `primary[500]`.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately NOT every named surface. `muted`/`accent`/`quaternary` are mid-tone, and a single
|
|
25
|
+
* band asked to clear those AND a dark brand fill has no solution at any hue — contrast is
|
|
26
|
+
* luminance alone, and `skyline`/`storefront` come out with an empty band. That is what the second
|
|
27
|
+
* tone is for: `halo` owns the fill-side adjacency instead.
|
|
28
|
+
*/
|
|
29
|
+
export declare const focusRingBackdrops: (source: FocusRingSource) => string[];
|
|
30
|
+
/**
|
|
31
|
+
* The two-tone `:focus-visible` indicator.
|
|
32
|
+
*
|
|
33
|
+
* Chakra's stock ring (`shadows.outline`, a fixed `rgba(66,153,225,.6)`) measured 1.83:1 on the
|
|
34
|
+
* lavender canvas and 1.38:1 on a primary button — a focus indicator you cannot see, on all nine
|
|
35
|
+
* brands. It is one hardcoded blue, so no palette could have saved it.
|
|
36
|
+
*
|
|
37
|
+
* `halo` is the surface tone, drawn as the inner band so the indicator separates from a filled
|
|
38
|
+
* control whatever `colorScheme` painted it. `ring` is the brand accent, walked to the nearest
|
|
39
|
+
* lightness that clears 3:1 on all three backdrops at once — including the halo, so the two tones
|
|
40
|
+
* are always told apart.
|
|
41
|
+
*/
|
|
42
|
+
export declare const buildFocusRing: (source: FocusRingSource) => FocusRingTokens;
|
|
43
|
+
/**
|
|
44
|
+
* Re-derives the ring from the FINISHED palette, as the last step of the rung chain.
|
|
45
|
+
*
|
|
46
|
+
* `finalizeLightPalette` and `buildDarkPalette` seed it, but neither is the final word: a brand
|
|
47
|
+
* file may replace `primary` or `background` after the generic derivation runs — `zinc`'s dark
|
|
48
|
+
* palette replaces both, inverting the filled button to near-white — and a ring resolved against
|
|
49
|
+
* the pre-override values is then silently wrong. Same reason `withSurfaceRungs` re-lifts inks the
|
|
50
|
+
* finalizers already derived. `focusRing.test.ts` asserts this is a fixed point.
|
|
51
|
+
*/
|
|
52
|
+
export declare const withFocusRing: (palette: PaletteProps) => PaletteProps;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withFocusRing = exports.buildFocusRing = exports.focusRingBackdrops = void 0;
|
|
4
|
+
exports.settleBetween = settleBetween;
|
|
5
|
+
const color_1 = require("./color");
|
|
6
|
+
const outlineRung_1 = require("./outlineRung");
|
|
7
|
+
/** Same lightness granularity `buildDarkPalette` walks its accents at. */
|
|
8
|
+
const LIGHTNESS_STEP = 0.5;
|
|
9
|
+
/**
|
|
10
|
+
* The nearest re-lighting of `hex` that clears `target` against EVERY backdrop at once.
|
|
11
|
+
*
|
|
12
|
+
* Not `settleAcross`: that folds one `liftToContrast` per surface, and each lift walks AWAY from
|
|
13
|
+
* the surface it was handed. That is correct when every backdrop sits on the same side of the ink
|
|
14
|
+
* (its case — a set of light surfaces, or a set of dark ones), and wrong here, where a focus ring
|
|
15
|
+
* is squeezed BETWEEN a near-white canvas and a mid-dark button fill: the lift against the fill
|
|
16
|
+
* walks straight back across the canvas it had just cleared. Seeding `settleAcross` with
|
|
17
|
+
* `primary[500]` measured 1.08-1.99 on the light canvas for every brand for exactly that reason.
|
|
18
|
+
*
|
|
19
|
+
* Walking outward from the seed and testing every backdrop at each step keeps the result the
|
|
20
|
+
* CLOSEST passing colour to the brand accent, so the ring still reads as brand chrome. Contrast is
|
|
21
|
+
* a function of relative luminance alone, and lightness sweeps luminance monotonically from 0 to 1,
|
|
22
|
+
* so if any colour on this hue clears the set, this finds it.
|
|
23
|
+
*/
|
|
24
|
+
function settleBetween(hex, backdrops, target = outlineRung_1.AA_NON_TEXT) {
|
|
25
|
+
const clears = (candidate) => backdrops.every((backdrop) => (0, color_1.contrastRatio)(candidate, backdrop) >= target);
|
|
26
|
+
if (clears(hex))
|
|
27
|
+
return hex;
|
|
28
|
+
const { l } = (0, color_1.hexToHsl)(hex);
|
|
29
|
+
for (let step = LIGHTNESS_STEP; step <= 100; step += LIGHTNESS_STEP) {
|
|
30
|
+
const darker = (0, color_1.withLightness)(hex, l - step);
|
|
31
|
+
if (clears(darker))
|
|
32
|
+
return darker;
|
|
33
|
+
const lighter = (0, color_1.withLightness)(hex, l + step);
|
|
34
|
+
if (clears(lighter))
|
|
35
|
+
return lighter;
|
|
36
|
+
}
|
|
37
|
+
// Unreachable for every shipped brand (the gate proves it) — a brand whose fill and canvas are
|
|
38
|
+
// close enough to leave no gap would land here. Take the end that is least bad rather than throw
|
|
39
|
+
// at import time, and let `focusRing.test.ts` be what reports it.
|
|
40
|
+
const ends = [(0, color_1.withLightness)(hex, 0), (0, color_1.withLightness)(hex, 100)];
|
|
41
|
+
const worst = (candidate) => Math.min(...backdrops.map((backdrop) => (0, color_1.contrastRatio)(candidate, backdrop)));
|
|
42
|
+
return worst(ends[0]) >= worst(ends[1]) ? ends[0] : ends[1];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The three backdrops a focused button's ring is actually drawn against: the page canvas, a card
|
|
46
|
+
* surface, and — because a solid button's ring sits directly against its own fill — `primary[500]`.
|
|
47
|
+
*
|
|
48
|
+
* Deliberately NOT every named surface. `muted`/`accent`/`quaternary` are mid-tone, and a single
|
|
49
|
+
* band asked to clear those AND a dark brand fill has no solution at any hue — contrast is
|
|
50
|
+
* luminance alone, and `skyline`/`storefront` come out with an empty band. That is what the second
|
|
51
|
+
* tone is for: `halo` owns the fill-side adjacency instead.
|
|
52
|
+
*/
|
|
53
|
+
const focusRingBackdrops = (source) => [
|
|
54
|
+
source.backgroundColor.main,
|
|
55
|
+
source.background[50],
|
|
56
|
+
source.primary[500],
|
|
57
|
+
];
|
|
58
|
+
exports.focusRingBackdrops = focusRingBackdrops;
|
|
59
|
+
/**
|
|
60
|
+
* The two-tone `:focus-visible` indicator.
|
|
61
|
+
*
|
|
62
|
+
* Chakra's stock ring (`shadows.outline`, a fixed `rgba(66,153,225,.6)`) measured 1.83:1 on the
|
|
63
|
+
* lavender canvas and 1.38:1 on a primary button — a focus indicator you cannot see, on all nine
|
|
64
|
+
* brands. It is one hardcoded blue, so no palette could have saved it.
|
|
65
|
+
*
|
|
66
|
+
* `halo` is the surface tone, drawn as the inner band so the indicator separates from a filled
|
|
67
|
+
* control whatever `colorScheme` painted it. `ring` is the brand accent, walked to the nearest
|
|
68
|
+
* lightness that clears 3:1 on all three backdrops at once — including the halo, so the two tones
|
|
69
|
+
* are always told apart.
|
|
70
|
+
*/
|
|
71
|
+
const buildFocusRing = (source) => {
|
|
72
|
+
const halo = settleBetween(source.background[50], [source.primary[500]]);
|
|
73
|
+
return {
|
|
74
|
+
halo,
|
|
75
|
+
ring: settleBetween(source.primary[500], [...(0, exports.focusRingBackdrops)(source), halo]),
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
exports.buildFocusRing = buildFocusRing;
|
|
79
|
+
/**
|
|
80
|
+
* Re-derives the ring from the FINISHED palette, as the last step of the rung chain.
|
|
81
|
+
*
|
|
82
|
+
* `finalizeLightPalette` and `buildDarkPalette` seed it, but neither is the final word: a brand
|
|
83
|
+
* file may replace `primary` or `background` after the generic derivation runs — `zinc`'s dark
|
|
84
|
+
* palette replaces both, inverting the filled button to near-white — and a ring resolved against
|
|
85
|
+
* the pre-override values is then silently wrong. Same reason `withSurfaceRungs` re-lifts inks the
|
|
86
|
+
* finalizers already derived. `focusRing.test.ts` asserts this is a fixed point.
|
|
87
|
+
*/
|
|
88
|
+
const withFocusRing = (palette) => ({
|
|
89
|
+
...palette,
|
|
90
|
+
focusRing: (0, exports.buildFocusRing)(palette),
|
|
91
|
+
});
|
|
92
|
+
exports.withFocusRing = withFocusRing;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type Gradient = {
|
|
2
|
+
from: string;
|
|
3
|
+
to: string;
|
|
4
|
+
};
|
|
5
|
+
/** A gradient already safe to paint, plus the ink that is guaranteed legible on it. */
|
|
6
|
+
export type ResolvedGradient = Gradient & {
|
|
7
|
+
ink: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Sinks both stops until WHITE ink clears AA, keeping each stop's hue. Any mid-tone gradient
|
|
11
|
+
* otherwise flips `onGradient` to black ink, so the same element reads white-on-colour in one
|
|
12
|
+
* brand and black-on-pastel in the next.
|
|
13
|
+
*/
|
|
14
|
+
export declare const inkSafeGradient: (gradient: Gradient) => Gradient;
|
|
15
|
+
/**
|
|
16
|
+
* The only correct way to paint text on a gradient: returns the stops to draw AND the ink for
|
|
17
|
+
* them. Calling `onGradient` on raw stops is the black-text bug — it picks ink for a backdrop
|
|
18
|
+
* that is then painted differently.
|
|
19
|
+
*/
|
|
20
|
+
export declare const resolveGradient: (gradient: Gradient, white: string, black: string) => ResolvedGradient;
|
|
21
|
+
/** `linear-gradient(...)` for a resolved pair — one spelling of the CSS everywhere. */
|
|
22
|
+
export declare const gradientCss: (g: Gradient, angle?: string) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gradientCss = exports.resolveGradient = exports.inkSafeGradient = void 0;
|
|
4
|
+
const accentText_1 = require("./accentText");
|
|
5
|
+
const statusTone_1 = require("./statusTone");
|
|
6
|
+
/**
|
|
7
|
+
* Sinks both stops until WHITE ink clears AA, keeping each stop's hue. Any mid-tone gradient
|
|
8
|
+
* otherwise flips `onGradient` to black ink, so the same element reads white-on-colour in one
|
|
9
|
+
* brand and black-on-pastel in the next.
|
|
10
|
+
*/
|
|
11
|
+
const inkSafeGradient = (gradient) => ({
|
|
12
|
+
from: (0, statusTone_1.resolveAvatarFill)(gradient.from),
|
|
13
|
+
to: (0, statusTone_1.resolveAvatarFill)(gradient.to),
|
|
14
|
+
});
|
|
15
|
+
exports.inkSafeGradient = inkSafeGradient;
|
|
16
|
+
/**
|
|
17
|
+
* The only correct way to paint text on a gradient: returns the stops to draw AND the ink for
|
|
18
|
+
* them. Calling `onGradient` on raw stops is the black-text bug — it picks ink for a backdrop
|
|
19
|
+
* that is then painted differently.
|
|
20
|
+
*/
|
|
21
|
+
const resolveGradient = (gradient, white, black) => {
|
|
22
|
+
const { from, to } = (0, exports.inkSafeGradient)(gradient);
|
|
23
|
+
return { from, to, ink: (0, accentText_1.onGradient)(from, to, white, black) };
|
|
24
|
+
};
|
|
25
|
+
exports.resolveGradient = resolveGradient;
|
|
26
|
+
/** `linear-gradient(...)` for a resolved pair — one spelling of the CSS everywhere. */
|
|
27
|
+
const gradientCss = (g, angle = "135deg") => `linear-gradient(${angle}, ${g.from} 0%, ${g.to} 100%)`;
|
|
28
|
+
exports.gradientCss = gradientCss;
|
|
@@ -3,3 +3,7 @@ export * from "./buildBrandTokens";
|
|
|
3
3
|
export * from "./buildDarkPalette";
|
|
4
4
|
export * from "./chartColorsFromTheme";
|
|
5
5
|
export * from "./color";
|
|
6
|
+
export * from "./focusRing";
|
|
7
|
+
export * from "./scrollbar";
|
|
8
|
+
export * from "./gradientInk";
|
|
9
|
+
export * from "./placeholderInk";
|
|
@@ -19,3 +19,7 @@ __exportStar(require("./buildBrandTokens"), exports);
|
|
|
19
19
|
__exportStar(require("./buildDarkPalette"), exports);
|
|
20
20
|
__exportStar(require("./chartColorsFromTheme"), exports);
|
|
21
21
|
__exportStar(require("./color"), exports);
|
|
22
|
+
__exportStar(require("./focusRing"), exports);
|
|
23
|
+
__exportStar(require("./scrollbar"), exports);
|
|
24
|
+
__exportStar(require("./gradientInk"), exports);
|
|
25
|
+
__exportStar(require("./placeholderInk"), exports);
|
|
@@ -7,6 +7,28 @@ import type { PaletteProps } from "../types";
|
|
|
7
7
|
export declare const MIN_PERCEPTIBLE_STEP = 1.15;
|
|
8
8
|
/** WCAG 1.4.11 — a control outline is a UI component boundary, held to 3:1. */
|
|
9
9
|
export declare const AA_NON_TEXT = 3;
|
|
10
|
+
/**
|
|
11
|
+
* Resting chrome — card, popover and field outlines — settles here, not at `AA_NON_TEXT`.
|
|
12
|
+
* At 3:1 a container border is text-weight and the UI reads as a wireframe; every mainstream
|
|
13
|
+
* system draws this line far lighter (Tailwind gray-200 1.24, Chakra gray.200 1.30, Material
|
|
14
|
+
* outline-variant 1.61). 1.4.11 asks that a control be identifiable, not that its resting
|
|
15
|
+
* border carry the whole job: the fill, the label and the focus ring do that.
|
|
16
|
+
*
|
|
17
|
+
* That defence was untrue when it was written. Buttons defined no `_focusVisible` at all, so the
|
|
18
|
+
* focus ring was Chakra's stock `shadows.outline` — a fixed blue measuring 1.38:1 on a primary
|
|
19
|
+
* button — and nothing in the library was held to `AA_NON_TEXT` at the moment of focus. It is
|
|
20
|
+
* true now: `focusRing` (`builders/focusRing.ts`) is derived per brand per mode and gated at 3:1
|
|
21
|
+
* on the canvas, on a card and on the button's own fill by `builders/focusRing.test.ts`. If that
|
|
22
|
+
* gate is ever relaxed, this constant loses its justification with it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const CHROME_BORDER = 1.5;
|
|
25
|
+
export declare const CHROME_RULE = 1.31;
|
|
26
|
+
/**
|
|
27
|
+
* A rule is decorative, so it has a ceiling and no floor: soften it until the surface it reads
|
|
28
|
+
* hardest against sits at `target`, and leave a already-fainter rung alone. Never `settleAcross`
|
|
29
|
+
* here — that clears a floor on EVERY surface, so one tinted surface drags the rule darker.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ruleInk(hex: string, surfaces: readonly string[], target: number): string;
|
|
10
32
|
/**
|
|
11
33
|
* Walks a hex toward `target` contrast against `backdrop`, keeping hue and saturation.
|
|
12
34
|
* Direction is DERIVED from the backdrop, never passed: a mode argument here was redundant
|
|
@@ -14,11 +36,17 @@ export declare const AA_NON_TEXT = 3;
|
|
|
14
36
|
* Tries the far side first, falls back to the near side, and stops at the first passing step.
|
|
15
37
|
*/
|
|
16
38
|
export declare function liftToContrast(hex: string, backdrop: string, target?: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Mirror of `liftToContrast`: walks ink TOWARD the backdrop, stopping at the last step that
|
|
41
|
+
* still clears `target`. For ink that must stay legible without reading as body copy.
|
|
42
|
+
*/
|
|
43
|
+
export declare function softenToContrast(hex: string, backdrop: string, target: number): string;
|
|
17
44
|
/**
|
|
18
45
|
* `boxborder[500]` is the rung every control outline reads (Checkbox, SearchSelect, the date
|
|
19
|
-
* pickers, the editor's inputs).
|
|
20
|
-
*
|
|
21
|
-
*
|
|
46
|
+
* pickers, the editor's inputs). Settled onto `CHROME_BORDER` — lifted when a brand authored it
|
|
47
|
+
* invisibly pale, softened when it overshoots. It was previously lifted to `AA_NON_TEXT`, which
|
|
48
|
+
* shipped 3.85-4.95:1 outlines: a text-weight box around every card and popover.
|
|
49
|
+
* Resolved here rather than hand-pinned per brand: a copied hex goes stale the moment a canvas moves.
|
|
22
50
|
*
|
|
23
51
|
* `border[*]` is deliberately untouched — that ramp draws table gridlines, which are decorative
|
|
24
52
|
* and outside 1.4.11.
|
|
@@ -33,3 +61,18 @@ export declare function withOutlineRung(palette: PaletteProps): PaletteProps;
|
|
|
33
61
|
* its OWN list background, not necessarily the page canvas.
|
|
34
62
|
*/
|
|
35
63
|
export declare function resolveHoverTint(seed: string, restSurface: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Settles ink into `target` against EVERY surface at once. Softening one step can change which
|
|
66
|
+
* surface is hardest, so resolving against a single pre-computed "hardest" one lands under the
|
|
67
|
+
* floor on another — that is how radiant and rosewood ended up with an invisible outline on
|
|
68
|
+
* their muted surface.
|
|
69
|
+
*/
|
|
70
|
+
export declare function settleAcross(hex: string, surfaces: readonly string[], target: number): string;
|
|
71
|
+
/**
|
|
72
|
+
* A pure-grey surface sitting `target` contrast away from `backdrop`. Binary search, not a walk:
|
|
73
|
+
* `liftToContrast` cannot move a seed already at lightness 0 or 100, and a pure-white panel seeded
|
|
74
|
+
* itself straight to black. Neutral on purpose — the light palettes are hand-authored and tinted,
|
|
75
|
+
* so lifting one of their surface rungs turns a selected row into a saturated brand block, while
|
|
76
|
+
* the derived dark palettes land on grey and look right.
|
|
77
|
+
*/
|
|
78
|
+
export declare function neutralStep(backdrop: string, target: number): string;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AA_NON_TEXT = exports.MIN_PERCEPTIBLE_STEP = void 0;
|
|
3
|
+
exports.CHROME_RULE = exports.CHROME_BORDER = exports.AA_NON_TEXT = exports.MIN_PERCEPTIBLE_STEP = void 0;
|
|
4
|
+
exports.ruleInk = ruleInk;
|
|
4
5
|
exports.liftToContrast = liftToContrast;
|
|
6
|
+
exports.softenToContrast = softenToContrast;
|
|
5
7
|
exports.withOutlineRung = withOutlineRung;
|
|
6
8
|
exports.resolveHoverTint = resolveHoverTint;
|
|
9
|
+
exports.settleAcross = settleAcross;
|
|
10
|
+
exports.neutralStep = neutralStep;
|
|
7
11
|
const color_1 = require("./color");
|
|
8
12
|
/**
|
|
9
13
|
* The floor a hover/active state's step off its own resting surface must clear to be seen at
|
|
@@ -13,6 +17,35 @@ const color_1 = require("./color");
|
|
|
13
17
|
exports.MIN_PERCEPTIBLE_STEP = 1.15;
|
|
14
18
|
/** WCAG 1.4.11 — a control outline is a UI component boundary, held to 3:1. */
|
|
15
19
|
exports.AA_NON_TEXT = 3;
|
|
20
|
+
/**
|
|
21
|
+
* Resting chrome — card, popover and field outlines — settles here, not at `AA_NON_TEXT`.
|
|
22
|
+
* At 3:1 a container border is text-weight and the UI reads as a wireframe; every mainstream
|
|
23
|
+
* system draws this line far lighter (Tailwind gray-200 1.24, Chakra gray.200 1.30, Material
|
|
24
|
+
* outline-variant 1.61). 1.4.11 asks that a control be identifiable, not that its resting
|
|
25
|
+
* border carry the whole job: the fill, the label and the focus ring do that.
|
|
26
|
+
*
|
|
27
|
+
* That defence was untrue when it was written. Buttons defined no `_focusVisible` at all, so the
|
|
28
|
+
* focus ring was Chakra's stock `shadows.outline` — a fixed blue measuring 1.38:1 on a primary
|
|
29
|
+
* button — and nothing in the library was held to `AA_NON_TEXT` at the moment of focus. It is
|
|
30
|
+
* true now: `focusRing` (`builders/focusRing.ts`) is derived per brand per mode and gated at 3:1
|
|
31
|
+
* on the canvas, on a card and on the button's own fill by `builders/focusRing.test.ts`. If that
|
|
32
|
+
* gate is ever relaxed, this constant loses its justification with it.
|
|
33
|
+
*/
|
|
34
|
+
exports.CHROME_BORDER = 1.5;
|
|
35
|
+
// The resting rule between two surfaces — a card edge, a divider, a menu outline. Lighter than
|
|
36
|
+
// CHROME_BORDER, which outlines a control the user acts on.
|
|
37
|
+
exports.CHROME_RULE = 1.31;
|
|
38
|
+
/**
|
|
39
|
+
* A rule is decorative, so it has a ceiling and no floor: soften it until the surface it reads
|
|
40
|
+
* hardest against sits at `target`, and leave a already-fainter rung alone. Never `settleAcross`
|
|
41
|
+
* here — that clears a floor on EVERY surface, so one tinted surface drags the rule darker.
|
|
42
|
+
*/
|
|
43
|
+
function ruleInk(hex, surfaces, target) {
|
|
44
|
+
const loudest = surfaces.reduce((worst, s) => (0, color_1.contrastRatio)(hex, s) > (0, color_1.contrastRatio)(hex, worst) ? s : worst);
|
|
45
|
+
return (0, color_1.contrastRatio)(hex, loudest) > target
|
|
46
|
+
? softenToContrast(hex, loudest, target)
|
|
47
|
+
: hex;
|
|
48
|
+
}
|
|
16
49
|
/**
|
|
17
50
|
* Walks a hex toward `target` contrast against `backdrop`, keeping hue and saturation.
|
|
18
51
|
* Direction is DERIVED from the backdrop, never passed: a mode argument here was redundant
|
|
@@ -36,11 +69,30 @@ function liftToContrast(hex, backdrop, target = exports.AA_NON_TEXT) {
|
|
|
36
69
|
const ends = [(0, color_1.withLightness)(hex, 100, s), (0, color_1.withLightness)(hex, 0, s)];
|
|
37
70
|
return (0, color_1.contrastRatio)(ends[0], backdrop) >= (0, color_1.contrastRatio)(ends[1], backdrop) ? ends[0] : ends[1];
|
|
38
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Mirror of `liftToContrast`: walks ink TOWARD the backdrop, stopping at the last step that
|
|
74
|
+
* still clears `target`. For ink that must stay legible without reading as body copy.
|
|
75
|
+
*/
|
|
76
|
+
function softenToContrast(hex, backdrop, target) {
|
|
77
|
+
if ((0, color_1.contrastRatio)(hex, backdrop) <= target)
|
|
78
|
+
return hex;
|
|
79
|
+
const { s, l: start } = (0, color_1.hexToHsl)(hex);
|
|
80
|
+
const toward = (0, color_1.relativeLuminance)(backdrop) < 0.5 ? -1 : 1;
|
|
81
|
+
let softest = hex;
|
|
82
|
+
for (let l = start; l > 0 && l < 100; l += toward) {
|
|
83
|
+
const next = (0, color_1.withLightness)(hex, l, s);
|
|
84
|
+
if ((0, color_1.contrastRatio)(next, backdrop) < target)
|
|
85
|
+
break;
|
|
86
|
+
softest = next;
|
|
87
|
+
}
|
|
88
|
+
return softest;
|
|
89
|
+
}
|
|
39
90
|
/**
|
|
40
91
|
* `boxborder[500]` is the rung every control outline reads (Checkbox, SearchSelect, the date
|
|
41
|
-
* pickers, the editor's inputs).
|
|
42
|
-
*
|
|
43
|
-
*
|
|
92
|
+
* pickers, the editor's inputs). Settled onto `CHROME_BORDER` — lifted when a brand authored it
|
|
93
|
+
* invisibly pale, softened when it overshoots. It was previously lifted to `AA_NON_TEXT`, which
|
|
94
|
+
* shipped 3.85-4.95:1 outlines: a text-weight box around every card and popover.
|
|
95
|
+
* Resolved here rather than hand-pinned per brand: a copied hex goes stale the moment a canvas moves.
|
|
44
96
|
*
|
|
45
97
|
* `border[*]` is deliberately untouched — that ramp draws table gridlines, which are decorative
|
|
46
98
|
* and outside 1.4.11.
|
|
@@ -53,7 +105,9 @@ function withOutlineRung(palette) {
|
|
|
53
105
|
(0, color_1.contrastRatio)(current, palette.background[50])
|
|
54
106
|
? palette.backgroundColor.main
|
|
55
107
|
: palette.background[50];
|
|
56
|
-
const resolved =
|
|
108
|
+
const resolved = (0, color_1.contrastRatio)(current, backdrop) > exports.CHROME_BORDER
|
|
109
|
+
? softenToContrast(current, backdrop, exports.CHROME_BORDER)
|
|
110
|
+
: liftToContrast(current, backdrop, exports.CHROME_BORDER);
|
|
57
111
|
if (resolved === current)
|
|
58
112
|
return palette;
|
|
59
113
|
return { ...palette, boxborder: { ...palette.boxborder, 500: resolved } };
|
|
@@ -69,3 +123,45 @@ function withOutlineRung(palette) {
|
|
|
69
123
|
function resolveHoverTint(seed, restSurface) {
|
|
70
124
|
return liftToContrast(seed, restSurface, exports.MIN_PERCEPTIBLE_STEP);
|
|
71
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Settles ink into `target` against EVERY surface at once. Softening one step can change which
|
|
128
|
+
* surface is hardest, so resolving against a single pre-computed "hardest" one lands under the
|
|
129
|
+
* floor on another — that is how radiant and rosewood ended up with an invisible outline on
|
|
130
|
+
* their muted surface.
|
|
131
|
+
*/
|
|
132
|
+
function settleAcross(hex, surfaces, target) {
|
|
133
|
+
const clearsAll = (c) => surfaces.every((s) => (0, color_1.contrastRatio)(c, s) >= target);
|
|
134
|
+
if (!clearsAll(hex)) {
|
|
135
|
+
return surfaces.reduce((ink, s) => liftToContrast(ink, s, target), hex);
|
|
136
|
+
}
|
|
137
|
+
const { s: sat, l: start } = (0, color_1.hexToHsl)(hex);
|
|
138
|
+
const toward = (0, color_1.relativeLuminance)(surfaces[0]) < 0.5 ? -1 : 1;
|
|
139
|
+
let settled = hex;
|
|
140
|
+
for (let l = start; l > 0 && l < 100; l += toward) {
|
|
141
|
+
const next = (0, color_1.withLightness)(hex, l, sat);
|
|
142
|
+
if (!clearsAll(next))
|
|
143
|
+
break;
|
|
144
|
+
settled = next;
|
|
145
|
+
}
|
|
146
|
+
return settled;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A pure-grey surface sitting `target` contrast away from `backdrop`. Binary search, not a walk:
|
|
150
|
+
* `liftToContrast` cannot move a seed already at lightness 0 or 100, and a pure-white panel seeded
|
|
151
|
+
* itself straight to black. Neutral on purpose — the light palettes are hand-authored and tinted,
|
|
152
|
+
* so lifting one of their surface rungs turns a selected row into a saturated brand block, while
|
|
153
|
+
* the derived dark palettes land on grey and look right.
|
|
154
|
+
*/
|
|
155
|
+
function neutralStep(backdrop, target) {
|
|
156
|
+
const grey = (l) => (0, color_1.withLightness)("#808080", l, 0);
|
|
157
|
+
let lo = (0, color_1.hexToHsl)(backdrop).l;
|
|
158
|
+
let hi = (0, color_1.relativeLuminance)(backdrop) < 0.5 ? 100 : 0;
|
|
159
|
+
for (let i = 0; i < 20; i += 1) {
|
|
160
|
+
const mid = (lo + hi) / 2;
|
|
161
|
+
if ((0, color_1.contrastRatio)(grey(mid), backdrop) < target)
|
|
162
|
+
lo = mid;
|
|
163
|
+
else
|
|
164
|
+
hi = mid;
|
|
165
|
+
}
|
|
166
|
+
return grey(hi);
|
|
167
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PaletteProps } from "../types";
|
|
2
|
+
/** A field always renders on at least one surface — the first is the reference backdrop. */
|
|
3
|
+
export type FieldSurfaces = readonly [string, ...string[]];
|
|
4
|
+
/**
|
|
5
|
+
* The hint ink for a field: the brand's authored rung settled onto `PLACEHOLDER_TEXT` against the
|
|
6
|
+
* hardest surface a field can land on — lifted when it falls short, softened when it overshoots.
|
|
7
|
+
*
|
|
8
|
+
* Settled rather than floored because the authored rungs measured 3.96-7.73:1 across the brands,
|
|
9
|
+
* and anything much past the floor reads as a field already typed into. The floor is the look:
|
|
10
|
+
* one hint weight for every brand in both modes, instead of a per-brand accident.
|
|
11
|
+
*/
|
|
12
|
+
export declare const placeholderInkOn: (palette: PaletteProps, surfaces: FieldSurfaces) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Every surface an ENABLED field renders on. Disabled fields are deliberately absent — 1.4.3
|
|
15
|
+
* exempts them, and folding their dimmer fill in here would darken the hint on every other field.
|
|
16
|
+
*/
|
|
17
|
+
export declare const fieldSurfaces: (palette: PaletteProps) => FieldSurfaces;
|
|
18
|
+
/** The hint ink every field in this library reads. Takes no backdrop: see `fieldSurfaces`. */
|
|
19
|
+
export declare const placeholderInk: (palette: PaletteProps) => string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.placeholderInk = exports.fieldSurfaces = exports.placeholderInkOn = void 0;
|
|
4
|
+
const color_1 = require("./color");
|
|
5
|
+
const outlineRung_1 = require("./outlineRung");
|
|
6
|
+
const surfaceRungs_1 = require("./surfaceRungs");
|
|
7
|
+
/**
|
|
8
|
+
* The hint ink for a field: the brand's authored rung settled onto `PLACEHOLDER_TEXT` against the
|
|
9
|
+
* hardest surface a field can land on — lifted when it falls short, softened when it overshoots.
|
|
10
|
+
*
|
|
11
|
+
* Settled rather than floored because the authored rungs measured 3.96-7.73:1 across the brands,
|
|
12
|
+
* and anything much past the floor reads as a field already typed into. The floor is the look:
|
|
13
|
+
* one hint weight for every brand in both modes, instead of a per-brand accident.
|
|
14
|
+
*/
|
|
15
|
+
const placeholderInkOn = (palette, surfaces) => {
|
|
16
|
+
const rung = palette.placeholder[500];
|
|
17
|
+
const hardest = surfaces.reduce((worst, s) => (0, color_1.contrastRatio)(rung, s) < (0, color_1.contrastRatio)(rung, worst) ? s : worst);
|
|
18
|
+
return (0, color_1.contrastRatio)(rung, hardest) > surfaceRungs_1.PLACEHOLDER_TEXT
|
|
19
|
+
? (0, outlineRung_1.softenToContrast)(rung, hardest, surfaceRungs_1.PLACEHOLDER_TEXT)
|
|
20
|
+
: (0, outlineRung_1.liftToContrast)(rung, hardest, surfaceRungs_1.PLACEHOLDER_TEXT);
|
|
21
|
+
};
|
|
22
|
+
exports.placeholderInkOn = placeholderInkOn;
|
|
23
|
+
/**
|
|
24
|
+
* Every surface an ENABLED field renders on. Disabled fields are deliberately absent — 1.4.3
|
|
25
|
+
* exempts them, and folding their dimmer fill in here would darken the hint on every other field.
|
|
26
|
+
*/
|
|
27
|
+
const fieldSurfaces = (palette) => [
|
|
28
|
+
palette.gray[50],
|
|
29
|
+
palette.background[50],
|
|
30
|
+
palette.backgroundColor.main,
|
|
31
|
+
];
|
|
32
|
+
exports.fieldSurfaces = fieldSurfaces;
|
|
33
|
+
/** The hint ink every field in this library reads. Takes no backdrop: see `fieldSurfaces`. */
|
|
34
|
+
const placeholderInk = (palette) => (0, exports.placeholderInkOn)(palette, (0, exports.fieldSurfaces)(palette));
|
|
35
|
+
exports.placeholderInk = placeholderInk;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { AA_NON_TEXT } from "./outlineRung";
|
|
2
2
|
import type { PaletteProps } from "../types";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* A hint is floored at 3:1, not 4.5:1. Held to body-text contrast it stopped reading as a hint —
|
|
5
|
+
* an empty field looked like one already typed into — and the published library ships this rung
|
|
6
|
+
* as the brand authored it. See CHROME-CONSISTENCY.md.
|
|
7
|
+
*/
|
|
4
8
|
export declare function withPlaceholderRung(palette: PaletteProps): PaletteProps;
|
|
5
9
|
/** The hover row is a SURFACE, so it steps away from the ink rather than the ink moving. */
|
|
6
10
|
export declare function withTableHoverRung(palette: PaletteProps): PaletteProps;
|
|
@@ -6,9 +6,14 @@ exports.withTableHoverRung = withTableHoverRung;
|
|
|
6
6
|
const outlineRung_1 = require("./outlineRung");
|
|
7
7
|
Object.defineProperty(exports, "AA_NON_TEXT", { enumerable: true, get: function () { return outlineRung_1.AA_NON_TEXT; } });
|
|
8
8
|
const accentText_1 = require("./accentText");
|
|
9
|
-
|
|
9
|
+
const surfaceRungs_1 = require("./surfaceRungs");
|
|
10
|
+
/**
|
|
11
|
+
* A hint is floored at 3:1, not 4.5:1. Held to body-text contrast it stopped reading as a hint —
|
|
12
|
+
* an empty field looked like one already typed into — and the published library ships this rung
|
|
13
|
+
* as the brand authored it. See CHROME-CONSISTENCY.md.
|
|
14
|
+
*/
|
|
10
15
|
function withPlaceholderRung(palette) {
|
|
11
|
-
const resolved = (0, outlineRung_1.liftToContrast)(palette.placeholder[500], palette.background[50],
|
|
16
|
+
const resolved = (0, outlineRung_1.liftToContrast)(palette.placeholder[500], palette.background[50], surfaceRungs_1.PLACEHOLDER_TEXT);
|
|
12
17
|
if (resolved === palette.placeholder[500])
|
|
13
18
|
return palette;
|
|
14
19
|
return { ...palette, placeholder: { ...palette.placeholder, 500: resolved } };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PaletteProps } from "../types";
|
|
2
|
+
export interface RowStateBackgrounds {
|
|
3
|
+
active: string;
|
|
4
|
+
selected: string;
|
|
5
|
+
selectedActive: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The three backgrounds a selectable list row can rest on. Every rung is NEUTRAL and pale, so a
|
|
9
|
+
* row's ink stays the canvas ink `withSurfaceRungs` already settled. Seeding a row state from
|
|
10
|
+
* `primary[500]` instead — the filled-button rung — is what painted SelectV2's hovered rows a
|
|
11
|
+
* solid brand fill under unreadable text.
|
|
12
|
+
*/
|
|
13
|
+
export declare const listRowBackgrounds: (colors: PaletteProps) => RowStateBackgrounds;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listRowBackgrounds = void 0;
|
|
4
|
+
const outlineRung_1 = require("./outlineRung");
|
|
5
|
+
/**
|
|
6
|
+
* The three backgrounds a selectable list row can rest on. Every rung is NEUTRAL and pale, so a
|
|
7
|
+
* row's ink stays the canvas ink `withSurfaceRungs` already settled. Seeding a row state from
|
|
8
|
+
* `primary[500]` instead — the filled-button rung — is what painted SelectV2's hovered rows a
|
|
9
|
+
* solid brand fill under unreadable text.
|
|
10
|
+
*/
|
|
11
|
+
const listRowBackgrounds = (colors) => {
|
|
12
|
+
const selected = colors.backgroundColor.tertiary;
|
|
13
|
+
return {
|
|
14
|
+
active: (0, outlineRung_1.resolveHoverTint)(colors.gray[50], colors.backgroundColor.light),
|
|
15
|
+
selected,
|
|
16
|
+
selectedActive: (0, outlineRung_1.resolveHoverTint)(selected, selected),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.listRowBackgrounds = listRowBackgrounds;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PaletteProps } from "../types";
|
|
2
|
+
export type ScrollbarStyle = Record<string, unknown>;
|
|
3
|
+
/** One width everywhere. The 3px, 4px, 5px and 10px bars in use were all accidents. */
|
|
4
|
+
export declare const SCROLLBAR_WIDTH = "6px";
|
|
5
|
+
export type ScrollbarVariant = "default" | "overlay" | "hover";
|
|
6
|
+
/**
|
|
7
|
+
* The single source of scrollbar chrome. `overlay` drops the track for bars that float over a
|
|
8
|
+
* card; `hover` keeps the thumb invisible until the region is hovered.
|
|
9
|
+
*/
|
|
10
|
+
export declare function scrollbarStyles(palette: PaletteProps, variant?: ScrollbarVariant): ScrollbarStyle;
|
|
11
|
+
/** The same chrome for the document itself, where `&` selectors do not apply. */
|
|
12
|
+
export declare function globalScrollbarStyles(palette: PaletteProps): ScrollbarStyle;
|