@ada-cx/lovelace 1.14.0 → 1.16.0
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/AttachmentChip/AttachmentChip.css.js.map +1 -1
- package/dist/components/Button/Button.css.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.css.js.map +1 -1
- package/dist/components/Chip/Chip.css.js.map +1 -1
- package/dist/components/Dialog/Dialog.css.js.map +1 -1
- package/dist/components/Divider/Divider.css.js.map +1 -1
- package/dist/components/DropZone/DropZone.css.js.map +1 -1
- package/dist/components/DropZone/DropZone.d.ts +54 -10
- package/dist/components/DropZone/DropZone.js +60 -30
- package/dist/components/DropZone/DropZone.js.map +1 -1
- package/dist/components/Header/Header.css.js.map +1 -1
- package/dist/components/Header/HeaderTitle.d.ts +13 -4
- package/dist/components/Header/HeaderTitle.js +9 -7
- package/dist/components/Header/HeaderTitle.js.map +1 -1
- package/dist/components/Input/Input.css.js.map +1 -1
- package/dist/components/Link/Link.css.js.map +1 -1
- package/dist/components/MessageError/MessageError.css.js.map +1 -1
- package/dist/components/PillButton/PillButton.css.js.map +1 -1
- package/dist/components/ProactiveMessage/ProactiveMessage.css.js.map +1 -1
- package/dist/components/Radio/Radio.css.js.map +1 -1
- package/dist/components/ScrollMarker/ScrollMarker.css.js.map +1 -1
- package/dist/components/Sheet/Sheet.css.js.map +1 -1
- package/dist/components/Survey/SurveyRating/SurveyRating.css.js.map +1 -1
- package/dist/components/Text/Text.css.d.ts +13 -0
- package/dist/components/Text/Text.css.js +28 -0
- package/dist/components/Text/Text.css.js.map +1 -0
- package/dist/components/Text/Text.d.ts +30 -0
- package/dist/components/Text/Text.js +17 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/index.d.ts +3 -0
- package/dist/components/ThinkingShimmer/ThinkingShimmer.css.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.css.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -12
- package/dist/style.css +1 -1
- package/dist/styles/typography.d.ts +32 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentChip.css.js","names":[],"sources":["../../../src/components/AttachmentChip/AttachmentChip.css.ts"],"sourcesContent":["import type { ComplexStyleRule } from \"@vanilla-extract/css\";\nimport { globalStyle, style } from \"@vanilla-extract/css\";\nimport type { RuntimeFn } from \"@vanilla-extract/recipes\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { t } from \"../../tokens/index.js\";\n\nconst attachmentChipBase = style({});\n\n/**\n * Figma pins each chip's frame height, the way it pins other control heights —\n * literals, with no size tier to route them through. The file chip is 40px: its\n * 24px thumbnail plus the 8px padding leaves nothing to trim. The summary chip\n * carries a 22px icon instead, and the composer draws it at 36px.\n */\nconst FILE_CHIP_HEIGHT = \"40px\";\nconst SUMMARY_CHIP_HEIGHT = \"36px\";\n\n/**\n * The cap the filename ellipsises against. Figma pins it on the file chip only;\n * the summary sizes to its own label, so a count is never clipped.\n */\nconst FILE_CHIP_MAX_WIDTH = \"148px\";\n\n/**\n * Annotated `string` deliberately: `t()` returns a template-literal type per\n * token, and four of them concatenated exceed what tsc will represent\n * (TS2590).\n */\nconst CHIP_SHADOW: string = `0 ${t(\"elevation-2-offset-y\")} ${t(\"elevation-2-blur\")} ${t(\"elevation-2-spread\")} ${t(\"elevation-2-color\")}`;\n\nexport const attachmentChipRoot: RuntimeFn<{\n\tinteractive: Record<\"true\" | \"false\", ComplexStyleRule>;\n}> = recipe({\n\tbase: [\n\t\tattachmentChipBase,\n\t\t{\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tgap: t(\"gap-8\"),\n\t\t\tminWidth: 0,\n\t\t\tpadding: t(\"padding-8\"),\n\t\t\toverflow: \"hidden\",\n\t\t\tborderRadius: t(\"border-radius-6\"),\n\t\t\tborder: 0,\n\t\t\tbackgroundColor: t(\"color-background-quaternary\"),\n\t\t\tcolor: t(\"color-content-default\"),\n\t\t\
|
|
1
|
+
{"version":3,"file":"AttachmentChip.css.js","names":[],"sources":["../../../src/components/AttachmentChip/AttachmentChip.css.ts"],"sourcesContent":["import type { ComplexStyleRule } from \"@vanilla-extract/css\";\nimport { globalStyle, style } from \"@vanilla-extract/css\";\nimport type { RuntimeFn } from \"@vanilla-extract/recipes\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nconst attachmentChipBase = style({});\n\n/**\n * Figma pins each chip's frame height, the way it pins other control heights —\n * literals, with no size tier to route them through. The file chip is 40px: its\n * 24px thumbnail plus the 8px padding leaves nothing to trim. The summary chip\n * carries a 22px icon instead, and the composer draws it at 36px.\n */\nconst FILE_CHIP_HEIGHT = \"40px\";\nconst SUMMARY_CHIP_HEIGHT = \"36px\";\n\n/**\n * The cap the filename ellipsises against. Figma pins it on the file chip only;\n * the summary sizes to its own label, so a count is never clipped.\n */\nconst FILE_CHIP_MAX_WIDTH = \"148px\";\n\n/**\n * Annotated `string` deliberately: `t()` returns a template-literal type per\n * token, and four of them concatenated exceed what tsc will represent\n * (TS2590).\n */\nconst CHIP_SHADOW: string = `0 ${t(\"elevation-2-offset-y\")} ${t(\"elevation-2-blur\")} ${t(\"elevation-2-spread\")} ${t(\"elevation-2-color\")}`;\n\nexport const attachmentChipRoot: RuntimeFn<{\n\tinteractive: Record<\"true\" | \"false\", ComplexStyleRule>;\n}> = recipe({\n\tbase: [\n\t\tattachmentChipBase,\n\t\t{\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tgap: t(\"gap-8\"),\n\t\t\tminWidth: 0,\n\t\t\tpadding: t(\"padding-8\"),\n\t\t\toverflow: \"hidden\",\n\t\t\tborderRadius: t(\"border-radius-6\"),\n\t\t\tborder: 0,\n\t\t\tbackgroundColor: t(\"color-background-quaternary\"),\n\t\t\tcolor: t(\"color-content-default\"),\n\t\t\t...typography(\"body\", \"regular\"),\n\t\t\ttextAlign: \"start\",\n\t\t\tappearance: \"none\",\n\t\t\tboxShadow: CHIP_SHADOW,\n\t\t},\n\t],\n\tvariants: {\n\t\t/**\n\t\t * Off, the chip is a plain container whose trailing button is the only\n\t\t * control — Figma's file chip, capped so a long filename ellipsises. On,\n\t\t * the chip itself is the control — Figma's summary chip, which has no\n\t\t * trailing button, sizes to its label, and so takes the shared state\n\t\t * layer.\n\t\t */\n\t\tinteractive: {\n\t\t\ttrue: {\n\t\t\t\theight: SUMMARY_CHIP_HEIGHT,\n\t\t\t\tposition: \"relative\",\n\t\t\t\tisolation: \"isolate\",\n\t\t\t\tcursor: \"pointer\",\n\t\t\t\toutline: \"none\",\n\t\t\t\t\"::after\": {\n\t\t\t\t\tcontent: '\"\"',\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tinset: 0,\n\t\t\t\t\tborderRadius: \"inherit\",\n\t\t\t\t\tbackgroundColor: \"currentColor\",\n\t\t\t\t\topacity: 0,\n\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\tzIndex: -1,\n\t\t\t\t\ttransition: `opacity ${t(\"duration-fast\")} ${t(\"easing-standard\")}`,\n\t\t\t\t},\n\t\t\t\tselectors: {\n\t\t\t\t\t\"&[data-hovered]::after\": { opacity: t(\"opacity-state-hover\") },\n\t\t\t\t\t\"&[data-focus-visible]::after\": { opacity: t(\"opacity-state-focus\") },\n\t\t\t\t\t\"&[data-pressed]::after\": { opacity: t(\"opacity-state-pressed\") },\n\t\t\t\t\t\"&[data-focus-visible]\": {\n\t\t\t\t\t\toutline: `2px solid ${t(\"color-border-focus\")}`,\n\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"@media\": {\n\t\t\t\t\t// A token-based ring is flattened away in High Contrast, so the\n\t\t\t\t\t// focus state needs a system colour to survive it.\n\t\t\t\t\t\"(forced-colors: active)\": {\n\t\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\t\"&[data-focus-visible]\": {\n\t\t\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\theight: FILE_CHIP_HEIGHT,\n\t\t\t\tmaxWidth: FILE_CHIP_MAX_WIDTH,\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: { interactive: false },\n});\n\n/**\n * Fixed box for the leading slot so a thumbnail, a spinner and an icon all\n * occupy the same 24px square — otherwise the chip's contents shift as an\n * upload settles and the stand-in gives way to the image.\n */\nexport const attachmentChipMedia = style({\n\tdisplay: \"inline-flex\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tflexShrink: 0,\n\twidth: \"24px\",\n\theight: \"24px\",\n\tborderRadius: t(\"border-radius-6\"),\n\toverflow: \"hidden\",\n});\n\n/**\n * A thumbnail fills the box; an icon sits at 22px inside it, as Figma draws\n * it — and on the chip's own background, with no backing of its own.\n */\nglobalStyle(`${attachmentChipMedia} [data-slot=\"icon\"]`, {\n\tfontSize: t(\"icon-size-control\"),\n});\n\nexport const attachmentChipThumbnail = style({\n\twidth: \"100%\",\n\theight: \"100%\",\n\tobjectFit: \"cover\",\n});\n\nexport const attachmentChipLabel = style({\n\tminWidth: 0,\n\toverflow: \"hidden\",\n\ttextOverflow: \"ellipsis\",\n\twhiteSpace: \"nowrap\",\n\twordBreak: \"break-word\",\n});\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.css.js","names":[],"sources":["../../../src/components/Button/Button.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { t } from \"../../tokens/index.js\";\n\nconst buttonBase = style({});\n\nexport const buttonRoot = recipe({\n\tbase: [\n\t\tbuttonBase,\n\t\t{\n\t\t\tposition: \"relative\",\n\t\t\tisolation: \"isolate\",\n\t\t\tdisplay: \"inline-flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\tgap: t(\"gap-8\"),\n\t\t\tpaddingInline: t(\"padding-12\"),\n\t\t\tboxSizing: \"border-box\",\n\t\t\tborder: `${t(\"border-width-default\")} solid transparent`,\n\t\t\tborderRadius: t(\"border-radius-button\"),\n\t\t\
|
|
1
|
+
{"version":3,"file":"Button.css.js","names":[],"sources":["../../../src/components/Button/Button.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nconst buttonBase = style({});\n\nexport const buttonRoot = recipe({\n\tbase: [\n\t\tbuttonBase,\n\t\t{\n\t\t\tposition: \"relative\",\n\t\t\tisolation: \"isolate\",\n\t\t\tdisplay: \"inline-flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\tgap: t(\"gap-8\"),\n\t\t\tpaddingInline: t(\"padding-12\"),\n\t\t\tboxSizing: \"border-box\",\n\t\t\tborder: `${t(\"border-width-default\")} solid transparent`,\n\t\t\tborderRadius: t(\"border-radius-button\"),\n\t\t\t...typography(\"body\", \"medium\"),\n\t\t\twhiteSpace: \"nowrap\",\n\t\t\tcursor: \"pointer\",\n\t\t\tuserSelect: \"none\",\n\t\t\tappearance: \"none\",\n\t\t\ttextDecoration: \"none\",\n\t\t\toutline: \"none\",\n\t\t\ttransitionProperty: \"background-color, border-color\",\n\t\t\ttransitionDuration: t(\"duration-fast\"),\n\t\t\ttransitionTimingFunction: t(\"easing-standard\"),\n\t\t\t\"::after\": {\n\t\t\t\tcontent: '\"\"',\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tinset: 0,\n\t\t\t\tborderRadius: \"inherit\",\n\t\t\t\tbackgroundColor: \"currentColor\",\n\t\t\t\topacity: 0,\n\t\t\t\tpointerEvents: \"none\",\n\t\t\t\tzIndex: -1,\n\t\t\t\ttransition: `opacity ${t(\"duration-fast\")} ${t(\"easing-standard\")}`,\n\t\t\t},\n\t\t\tselectors: {\n\t\t\t\t\"&[data-hovered]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-hover\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-focus\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-pressed]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-pressed\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t\t\t},\n\t\t\t\t\"&[data-disabled]\": {\n\t\t\t\t\tcursor: \"not-allowed\",\n\t\t\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"@media\": {\n\t\t\t\t\"(forced-colors: active)\": {\n\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tvariants: {\n\t\tintent: {\n\t\t\tprimary: {\n\t\t\t\tbackgroundColor: t(\"button-primary-background\"),\n\t\t\t\tcolor: t(\"button-primary-content\"),\n\t\t\t\tselectors: {\n\t\t\t\t\t\"&[data-disabled]\": {\n\t\t\t\t\t\tbackgroundColor: t(\"color-background-disabled\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"primary-destructive\": {\n\t\t\t\tbackgroundColor: t(\"color-background-destructive\"),\n\t\t\t\tcolor: t(\"color-content-on-destructive\"),\n\t\t\t\tselectors: {\n\t\t\t\t\t\"&[data-disabled]\": {\n\t\t\t\t\t\tbackgroundColor: t(\"color-background-disabled\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\tbackgroundColor: t(\"color-background-default\"),\n\t\t\t\tcolor: t(\"color-content-default\"),\n\t\t\t\tborderColor: t(\"color-border-default\"),\n\t\t\t},\n\t\t\t\"secondary-destructive\": {\n\t\t\t\tbackgroundColor: t(\"color-background-default\"),\n\t\t\t\tcolor: t(\"color-content-destructive\"),\n\t\t\t\tborderColor: t(\"color-border-destructive\"),\n\t\t\t},\n\t\t\ttertiary: {\n\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\tcolor: t(\"color-content-default\"),\n\t\t\t},\n\t\t\t\"tertiary-destructive\": {\n\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\tcolor: t(\"color-content-destructive\"),\n\t\t\t},\n\t\t},\n\t\t// Hardcoded heights are correct.\n\t\tsize: {\n\t\t\tmd: { height: \"40px\" },\n\t\t\tsm: { height: \"32px\" },\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tintent: \"primary\",\n\t\tsize: \"md\",\n\t},\n});\n\nglobalStyle(`${buttonBase} [data-slot='icon']`, {\n\tflexShrink: 0,\n\tfontSize: t(\"icon-size-control\"),\n});\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.css.js","names":[],"sources":["../../../src/components/Checkbox/Checkbox.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport {\n\tcontrolRowFrame,\n\tcontrolRowSlotRules,\n} from \"../../styles/control-row.js\";\nimport { t } from \"../../tokens/index.js\";\n\n// 24px box + 16px glyph mirror Figma's fixed frame sizes (button-size/xs,\n// icon-size/md), which the token set does not expose as spacing values.\nconst BOX_SIZE = \"24px\";\nconst GLYPH_SIZE = \"16px\";\n\nexport const checkboxGroup = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tgap: t(\"gap-20\"),\n});\n\n// Empty handle classes: a recipe can't target a descendant, so the row variant's\n// slot rules are attached to a stable class instead (same trick as Button's base).\nconst checkboxRowBase = style({});\n\n/**\n * The RAC `Checkbox` label. `inline` lays the box out beside an optional label;\n * `row` is the 40px selectable row Figma draws for a menu item, for a\n * `CheckboxGroup` rendered as a list of options.\n */\nexport const checkboxRoot = recipe({\n\tbase: {\n\t\
|
|
1
|
+
{"version":3,"file":"Checkbox.css.js","names":[],"sources":["../../../src/components/Checkbox/Checkbox.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport {\n\tcontrolRowFrame,\n\tcontrolRowSlotRules,\n} from \"../../styles/control-row.js\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\n// 24px box + 16px glyph mirror Figma's fixed frame sizes (button-size/xs,\n// icon-size/md), which the token set does not expose as spacing values.\nconst BOX_SIZE = \"24px\";\nconst GLYPH_SIZE = \"16px\";\n\nexport const checkboxGroup = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tgap: t(\"gap-20\"),\n});\n\n// Empty handle classes: a recipe can't target a descendant, so the row variant's\n// slot rules are attached to a stable class instead (same trick as Button's base).\nconst checkboxRowBase = style({});\n\n/**\n * The RAC `Checkbox` label. `inline` lays the box out beside an optional label;\n * `row` is the 40px selectable row Figma draws for a menu item, for a\n * `CheckboxGroup` rendered as a list of options.\n */\nexport const checkboxRoot = recipe({\n\tbase: {\n\t\t...typography(\"body\", \"regular\"),\n\t\tcolor: t(\"color-content-default\"),\n\t\tcursor: \"pointer\",\n\t\tuserSelect: \"none\",\n\t\toutline: \"none\",\n\t\tselectors: {\n\t\t\t\"&[data-disabled]\": {\n\t\t\t\tcursor: \"not-allowed\",\n\t\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t\t},\n\t\t},\n\t},\n\tvariants: {\n\t\tvariant: {\n\t\t\tinline: {\n\t\t\t\tdisplay: \"inline-flex\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\tgap: t(\"gap-12\"),\n\t\t\t},\n\t\t\trow: [checkboxRowBase, controlRowFrame],\n\t\t},\n\t},\n\tdefaultVariants: { variant: \"inline\" },\n});\n\nglobalStyle(\n\t`${checkboxRowBase} > [data-slot=\"icon\"]`,\n\tcontrolRowSlotRules.icon,\n);\nglobalStyle(\n\t`${checkboxRowBase} > [data-slot=\"label\"]`,\n\tcontrolRowSlotRules.label,\n);\n\n/**\n * The 24px indicator. Its geometry is fixed in every state — a rigid `border-box`\n * square with an always-present 1px border (transparent when filled) and a\n * `box-shadow` focus ring — so selecting/focusing never reflows it.\n *\n * Selection/interaction state lives on the host element (the RAC label, or a\n * `MenuItem` row), so the state rules below are child selectors driven from\n * whichever host carries React Aria's `data-*`. `color` is the inverse content\n * color: it feeds both the glyph stroke and the `currentColor` state-layer\n * overlay, so the overlay is invisible over the light unchecked box (Figma changes\n * only the border on hover) yet lightens the dark filled box.\n */\nexport const checkboxBox = style({\n\tposition: \"relative\",\n\tisolation: \"isolate\",\n\tboxSizing: \"border-box\",\n\tflexShrink: 0,\n\twidth: BOX_SIZE,\n\theight: BOX_SIZE,\n\tborderRadius: t(\"border-radius-6\"),\n\tborderStyle: \"solid\",\n\tborderWidth: t(\"border-width-default\"),\n\tborderColor: t(\"color-border-default\"),\n\tbackgroundColor: t(\"color-background-default\"),\n\tcolor: t(\"color-content-inverse\"),\n\t// No background-color transition, so the fill flips instantly and lands with the glyph.\n\ttransitionProperty: \"border-color, box-shadow\",\n\ttransitionDuration: t(\"duration-fast\"),\n\ttransitionTimingFunction: t(\"easing-standard\"),\n\t\"::after\": {\n\t\tcontent: '\"\"',\n\t\tposition: \"absolute\",\n\t\tinset: 0,\n\t\tborderRadius: \"inherit\",\n\t\tbackgroundColor: \"currentColor\",\n\t\topacity: 0,\n\t\tpointerEvents: \"none\",\n\t\tzIndex: -1,\n\t\ttransition: `opacity ${t(\"duration-fast\")} ${t(\"easing-standard\")}`,\n\t},\n});\n\n/**\n * Checkmark / dash glyph — absolutely centered and toggled by opacity, never\n * in-flow, so revealing it can never shift the box.\n */\nexport const checkboxGlyph = style({\n\tposition: \"absolute\",\n\tinset: 0,\n\tmargin: \"auto\",\n\twidth: GLYPH_SIZE,\n\theight: GLYPH_SIZE,\n\tcolor: \"currentColor\",\n\topacity: 0,\n\tpointerEvents: \"none\",\n});\n\n// Selection and disabled are host-agnostic: any element carrying React Aria's\n// `data-*` drives the box directly below it. Interaction (hover border, state\n// layer, focus ring) additionally requires `[data-state-layer]`, which the\n// indicator sets only when it is the sole affordance — inside a row the row\n// paints those itself.\n\n// Border goes transparent when filled so it folds into the fill (no ring).\nglobalStyle(\n\t`[data-selected] > ${checkboxBox}, [data-indeterminate] > ${checkboxBox}`,\n\t{\n\t\tbackgroundColor: t(\"color-background-inverse\"),\n\t\tborderColor: \"transparent\",\n\t},\n);\n\n// Unchecked hover darkens the border (Figma color/border/medium).\nglobalStyle(\n\t`[data-hovered]:not([data-disabled]):not([data-selected]):not([data-indeterminate]) > ${checkboxBox}[data-state-layer]`,\n\t{ borderColor: t(\"color-border-medium\") },\n);\n\n// State layer — currentColor overlay at per-state opacity, tracking box content color.\nglobalStyle(\n\t`[data-hovered]:not([data-disabled]) > ${checkboxBox}[data-state-layer]::after`,\n\t{ opacity: t(\"opacity-state-hover\") },\n);\nglobalStyle(\n\t`[data-focus-visible]:not([data-disabled]) > ${checkboxBox}[data-state-layer]::after`,\n\t{ opacity: t(\"opacity-state-focus\") },\n);\nglobalStyle(\n\t`[data-pressed]:not([data-disabled]) > ${checkboxBox}[data-state-layer]::after`,\n\t{ opacity: t(\"opacity-state-pressed\") },\n);\n\n// Focus ring — box-shadow, so it never changes the box's size.\nglobalStyle(\n\t`[data-focus-visible]:not([data-disabled]) > ${checkboxBox}[data-state-layer]`,\n\t{ boxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}` },\n);\n\nglobalStyle(\n\t`[data-focus-visible]:not([data-disabled]) > ${checkboxBox}[data-state-layer]`,\n\t{\n\t\t\"@media\": {\n\t\t\t\"(forced-colors: active)\": {\n\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\toutlineOffset: \"2px\",\n\t\t\t},\n\t\t},\n\t},\n);\n\n// Disabled wins over the filled rule: light fill, default border, faded glyph\n// (Figma color/content/disabled).\nglobalStyle(`[data-disabled] > ${checkboxBox}`, {\n\tbackgroundColor: t(\"color-background-disabled\"),\n\tborderColor: t(\"color-border-default\"),\n\tcolor: t(\"color-content-disabled\"),\n});\n\n// Reveal the matching glyph. Dash wins for the mixed state; the check shows only\n// when selected and not indeterminate.\nglobalStyle(\n\t`[data-selected]:not([data-indeterminate]) > ${checkboxBox} > ${checkboxGlyph}[data-glyph=\"check\"]`,\n\t{ opacity: 1 },\n);\nglobalStyle(\n\t`[data-indeterminate] > ${checkboxBox} > ${checkboxGlyph}[data-glyph=\"dash\"]`,\n\t{ opacity: 1 },\n);\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.css.js","names":[],"sources":["../../../src/components/Chip/Chip.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { t } from \"../../tokens/index.js\";\n\nconst chipBase = style({});\n\nexport const chipRoot = recipe({\n\tbase: [\n\t\tchipBase,\n\t\t{\n\t\t\tposition: \"relative\",\n\t\t\tisolation: \"isolate\",\n\t\t\tdisplay: \"inline-flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tborder: `${t(\"border-width-default\")} solid transparent`,\n\t\t\
|
|
1
|
+
{"version":3,"file":"Chip.css.js","names":[],"sources":["../../../src/components/Chip/Chip.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nconst chipBase = style({});\n\nexport const chipRoot = recipe({\n\tbase: [\n\t\tchipBase,\n\t\t{\n\t\t\tposition: \"relative\",\n\t\t\tisolation: \"isolate\",\n\t\t\tdisplay: \"inline-flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tborder: `${t(\"border-width-default\")} solid transparent`,\n\t\t\t...typography(\"body\", \"medium\"),\n\t\t\twhiteSpace: \"nowrap\",\n\t\t\tcursor: \"pointer\",\n\t\t\tuserSelect: \"none\",\n\t\t\tappearance: \"none\",\n\t\t\toutline: \"none\",\n\t\t\ttransitionProperty: \"background-color, border-color\",\n\t\t\ttransitionDuration: t(\"duration-fast\"),\n\t\t\ttransitionTimingFunction: t(\"easing-standard\"),\n\t\t\t\"::after\": {\n\t\t\t\tcontent: '\"\"',\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tinset: 0,\n\t\t\t\tborderRadius: \"inherit\",\n\t\t\t\tbackgroundColor: \"currentColor\",\n\t\t\t\topacity: 0,\n\t\t\t\tpointerEvents: \"none\",\n\t\t\t\tzIndex: -1,\n\t\t\t\ttransition: `opacity ${t(\"duration-fast\")} ${t(\"easing-standard\")}`,\n\t\t\t},\n\t\t\tselectors: {\n\t\t\t\t\"&:not([data-selected])\": {\n\t\t\t\t\tbackgroundColor: t(\"color-background-default\"),\n\t\t\t\t\tcolor: t(\"color-content-default\"),\n\t\t\t\t\tborderColor: t(\"color-border-default\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-selected]\": {\n\t\t\t\t\tbackgroundColor: t(\"chip-background-selected\"),\n\t\t\t\t\tcolor: t(\"color-content-on-accent\"),\n\t\t\t\t\tborderColor: \"transparent\",\n\t\t\t\t},\n\t\t\t\t\"&[data-hovered]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-hover\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-focus\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-pressed]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-pressed\"),\n\t\t\t\t},\n\t\t\t\t// Focus: inner 1px accent border + outer 2px focus ring (Figma double ring).\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\tborderColor: t(\"color-border-accent\"),\n\t\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t\t\t},\n\t\t\t\t\"&[data-disabled]\": {\n\t\t\t\t\tcursor: \"not-allowed\",\n\t\t\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"@media\": {\n\t\t\t\t\"(forced-colors: active)\": {\n\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tvariants: {\n\t\tvariant: {\n\t\t\t// A flexible, min-80px pill; height comes from the size compound variants.\n\t\t\ttext: {\n\t\t\t\tminWidth: \"80px\",\n\t\t\t\tpaddingInline: t(\"padding-12\"),\n\t\t\t\tborderRadius: t(\"border-radius-pill\"),\n\t\t\t},\n\t\t\ticon: { borderRadius: t(\"border-radius-button\") },\n\t\t\tnumber: { borderRadius: t(\"border-radius-button\") },\n\t\t},\n\t\tsize: {\n\t\t\tmd: {},\n\t\t\tlg: {},\n\t\t},\n\t},\n\t// Dimensions per variant×size. Hardcoded px mirror Figma's fixed frame sizes;\n\t// text is a flexible pill (height only), icon/number are square. The large number\n\t// chip carries its own type size: at 48px the digit is the control's content, not\n\t// a label on it, so body type under-reads it.\n\tcompoundVariants: [\n\t\t{\n\t\t\tvariants: { variant: \"text\", size: \"md\" },\n\t\t\tstyle: { height: \"40px\" },\n\t\t},\n\t\t{\n\t\t\tvariants: { variant: \"text\", size: \"lg\" },\n\t\t\tstyle: { height: \"48px\" },\n\t\t},\n\t\t{\n\t\t\tvariants: { variant: \"icon\", size: \"md\" },\n\t\t\tstyle: { width: \"40px\", height: \"40px\" },\n\t\t},\n\t\t{\n\t\t\tvariants: { variant: \"icon\", size: \"lg\" },\n\t\t\tstyle: { width: \"48px\", height: \"48px\" },\n\t\t},\n\t\t{\n\t\t\tvariants: { variant: \"number\", size: \"md\" },\n\t\t\tstyle: { width: \"40px\", height: \"40px\" },\n\t\t},\n\t\t{\n\t\t\tvariants: { variant: \"number\", size: \"lg\" },\n\t\t\tstyle: {\n\t\t\t\twidth: \"48px\",\n\t\t\t\theight: \"48px\",\n\t\t\t\tfontSize: t(\"font-size-title-large\"),\n\t\t\t},\n\t\t},\n\t],\n\tdefaultVariants: {\n\t\tvariant: \"text\",\n\t\tsize: \"md\",\n\t},\n});\n\nglobalStyle(`${chipBase} [data-slot='icon']`, {\n\tfontSize: t(\"icon-size-control\"),\n\tflexShrink: 0,\n});\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.css.js","names":[],"sources":["../../../src/components/Dialog/Dialog.css.ts"],"sourcesContent":["import { style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { t } from \"../../tokens/index.js\";\n\n/* ── Content stack ────────────────────────────────────────────────────── */\n\n// Content arrangement for the icon → content → actions stack, wrapped by\n// DialogOverlay's focus-trap surface (which supplies the card + scroll): a\n// centered flex column with a single gap-16 between the three blocks.\n// Dialog.Content supplies the tighter title↔body gap-8 internally.\nexport const dialogContentSurface = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\talignItems: \"center\",\n\ttextAlign: \"center\",\n\tgap: t(\"gap-16\"),\n\tpadding: t(\"padding-16\"),\n\tbackgroundColor: t(\"elevation-2-background\"),\n});\n\n/* ── Parts ────────────────────────────────────────────────────────────── */\n\nexport const dialogIcon = recipe({\n\tbase: {\n\t\tdisplay: \"flex\",\n\t\tlineHeight: 0,\n\t\tfontSize: \"32px\",\n\t\tflexShrink: 0,\n\t},\n\tvariants: {\n\t\tintent: {\n\t\t\twarning: { color: t(\"color-content-warning\") },\n\t\t\tsuccess: { color: t(\"color-content-success\") },\n\t\t},\n\t},\n});\n\nexport const dialogContent = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\talignItems: \"center\",\n\tgap: t(\"gap-8\"),\n\twidth: \"100%\",\n});\n\nexport const dialogTitle = style({\n\tmargin: 0,\n\ttextAlign: \"center\",\n\twidth: \"100%\",\n\
|
|
1
|
+
{"version":3,"file":"Dialog.css.js","names":[],"sources":["../../../src/components/Dialog/Dialog.css.ts"],"sourcesContent":["import { style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\n/* ── Content stack ────────────────────────────────────────────────────── */\n\n// Content arrangement for the icon → content → actions stack, wrapped by\n// DialogOverlay's focus-trap surface (which supplies the card + scroll): a\n// centered flex column with a single gap-16 between the three blocks.\n// Dialog.Content supplies the tighter title↔body gap-8 internally.\nexport const dialogContentSurface = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\talignItems: \"center\",\n\ttextAlign: \"center\",\n\tgap: t(\"gap-16\"),\n\tpadding: t(\"padding-16\"),\n\tbackgroundColor: t(\"elevation-2-background\"),\n});\n\n/* ── Parts ────────────────────────────────────────────────────────────── */\n\nexport const dialogIcon = recipe({\n\tbase: {\n\t\tdisplay: \"flex\",\n\t\tlineHeight: 0,\n\t\tfontSize: \"32px\",\n\t\tflexShrink: 0,\n\t},\n\tvariants: {\n\t\tintent: {\n\t\t\twarning: { color: t(\"color-content-warning\") },\n\t\t\tsuccess: { color: t(\"color-content-success\") },\n\t\t},\n\t},\n});\n\nexport const dialogContent = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\talignItems: \"center\",\n\tgap: t(\"gap-8\"),\n\twidth: \"100%\",\n});\n\nexport const dialogTitle = style({\n\tmargin: 0,\n\ttextAlign: \"center\",\n\twidth: \"100%\",\n\t...typography(\"title-large\", \"medium\"),\n\t// The one heading-family consumer in the package, so the family stays a\n\t// local override rather than an axis on `typography()`.\n\tfontFamily: t(\"font-family-heading\"),\n\tcolor: t(\"color-content-default\"),\n});\n\nexport const dialogBody = style({\n\tmargin: 0,\n\ttextAlign: \"center\",\n\twidth: \"100%\",\n\t...typography(\"body\", \"regular\"),\n\tcolor: t(\"color-content-secondary\"),\n});\n\nexport const dialogActions = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\talignItems: \"stretch\",\n\tgap: t(\"gap-8\"),\n\twidth: \"100%\",\n});\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Divider.css.js","names":[],"sources":["../../../src/components/Divider/Divider.css.ts"],"sourcesContent":["import { style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { t } from \"../../tokens/index.js\";\n\nconst captionText = {\n\
|
|
1
|
+
{"version":3,"file":"Divider.css.js","names":[],"sources":["../../../src/components/Divider/Divider.css.ts"],"sourcesContent":["import { style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { typographyVariant } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\n// Weight is not here: the three label variants below each set their own.\nconst captionText = {\n\t...typographyVariant(\"caption\"),\n\tcolor: t(\"color-content-secondary\"),\n} as const;\n\nexport const dividerRoot = recipe({\n\tbase: {\n\t\tboxSizing: \"border-box\",\n\t},\n\tvariants: {\n\t\tvariant: {\n\t\t\tline: {\n\t\t\t\tdisplay: \"block\",\n\t\t\t\twidth: \"100%\",\n\t\t\t},\n\t\t\tlabel: {\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\tjustifyContent: \"center\",\n\t\t\t\tgap: t(\"gap-8\"),\n\t\t\t\twidth: \"100%\",\n\t\t\t},\n\t\t\tmessage: {\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\tjustifyContent: \"center\",\n\t\t\t\tgap: t(\"gap-4\"),\n\t\t\t\ttextAlign: \"center\",\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tvariant: \"line\",\n\t},\n});\n\n// The horizontal rule for the `line` variant and the two flanking rules of `label`.\n// A zero-height element with only a top border renders as a 1px line. `flex: 1 1 0`\n// makes the flanking rules share the row equally in `label`; it's inert in `line`'s\n// block context, where `width: 100%` spans the full width instead.\nexport const dividerRule = style({\n\tborder: \"none\",\n\tborderTop: `${t(\"border-width-default\")} solid ${t(\"color-border-default\")}`,\n\tmargin: 0,\n\theight: 0,\n\twidth: \"100%\",\n\tflex: \"1 1 0\",\n\tminWidth: \"1px\",\n});\n\n// `label`'s inline marker stays on one line; message captions may wrap to a sentence.\nexport const dividerLabel = style({\n\t...captionText,\n\tfontWeight: t(\"font-weight-regular\"),\n\twhiteSpace: \"nowrap\",\n\tflexShrink: 0,\n\tmargin: 0,\n});\n\nexport const dividerHeading = style({\n\t...captionText,\n\tfontWeight: t(\"font-weight-medium\"),\n\tmargin: 0,\n});\n\nexport const dividerCaption = style({\n\t...captionText,\n\tfontWeight: t(\"font-weight-regular\"),\n\tmargin: 0,\n});\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropZone.css.js","names":[],"sources":["../../../src/components/DropZone/DropZone.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const dropZoneRoot = style({\n\tposition: \"relative\",\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tflex: \"1 1 auto\",\n\tminHeight: 0,\n});\n\n// The panel covers the surface it is given rather than carrying the frame size\n// from Figma, so the same primitive works over a whole chat body or a smaller\n// region without the consumer overriding a fixed height.\nexport const dropZonePanel = style({\n\tposition: \"absolute\",\n\tinset: 0,\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tgap: t(\"gap-12\"),\n\tpadding: t(\"padding-16\"),\n\tborderRadius: t(\"border-radius-20\"),\n\tbackgroundColor: t(\"color-background-default\"),\n\t// The panel is a drag affordance, not a target: the drop is handled by the\n\t// zone underneath, and swallowing pointer events here would make the browser\n\t// fire dragleave the moment the panel appeared.\n\tpointerEvents: \"none\",\n});\n\n// 32px is the Figma frame size; the icon-size scale tops out at 24 (`icon-size-lg`).\nglobalStyle(`${dropZonePanel} [data-slot=\"icon\"]`, {\n\tfontSize: \"32px\",\n\tcolor: t(\"color-content-secondary\"),\n});\n\n// Figma ships two variants differing only in icon color. `active` is a drag actually\n// over the zone; `default` is the panel without one, which here is the keyboard path.\nglobalStyle(\n\t`${dropZoneRoot}[data-drop-target] ${dropZonePanel} [data-slot=\"icon\"]`,\n\t{\n\t\tcolor: t(\"color-content-highlight\"),\n\t},\n);\n\nexport const dropZoneText = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tgap: t(\"gap-8\"),\n\twidth: \"100%\",\n\ttextAlign: \"center\",\n\
|
|
1
|
+
{"version":3,"file":"DropZone.css.js","names":[],"sources":["../../../src/components/DropZone/DropZone.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const dropZoneRoot = style({\n\tposition: \"relative\",\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tflex: \"1 1 auto\",\n\tminHeight: 0,\n});\n\n// The panel covers the surface it is given rather than carrying the frame size\n// from Figma, so the same primitive works over a whole chat body or a smaller\n// region without the consumer overriding a fixed height.\nexport const dropZonePanel = style({\n\tposition: \"absolute\",\n\tinset: 0,\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tgap: t(\"gap-12\"),\n\tpadding: t(\"padding-16\"),\n\tborderRadius: t(\"border-radius-20\"),\n\tbackgroundColor: t(\"color-background-default\"),\n\t// The panel is a drag affordance, not a target: the drop is handled by the\n\t// zone underneath, and swallowing pointer events here would make the browser\n\t// fire dragleave the moment the panel appeared.\n\tpointerEvents: \"none\",\n});\n\n// 32px is the Figma frame size; the icon-size scale tops out at 24 (`icon-size-lg`).\nglobalStyle(`${dropZonePanel} [data-slot=\"icon\"]`, {\n\tfontSize: \"32px\",\n\tcolor: t(\"color-content-secondary\"),\n});\n\n// Figma ships two variants differing only in icon color. `active` is a drag actually\n// over the zone; `default` is the panel without one, which here is the keyboard path.\nglobalStyle(\n\t`${dropZoneRoot}[data-drop-target] ${dropZonePanel} [data-slot=\"icon\"]`,\n\t{\n\t\tcolor: t(\"color-content-highlight\"),\n\t},\n);\n\nexport const dropZoneText = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tgap: t(\"gap-8\"),\n\twidth: \"100%\",\n\ttextAlign: \"center\",\n\t...typography(\"body\", \"regular\"),\n\twordBreak: \"break-word\",\n});\n\nexport const dropZoneLabel = style({\n\tmargin: 0,\n\tcolor: t(\"color-content-default\"),\n});\n\nexport const dropZoneDescription = style({\n\tmargin: 0,\n\tcolor: t(\"color-content-secondary\"),\n});\n"],"mappings":""}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
/** Called with the dropped file once it resolves. Exactly one file per drop. */
|
|
4
|
-
onFileDrop: (file: File) => void;
|
|
5
|
-
/** Called instead of `onFileDrop` when a drop carries more than one file. */
|
|
6
|
-
onMultipleFilesRejected?: () => void;
|
|
2
|
+
interface DropZoneBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, "onDrop" | "children" | "aria-label"> {
|
|
7
3
|
/**
|
|
8
|
-
* Called when a
|
|
9
|
-
*
|
|
4
|
+
* Called when a drop carries items but no file, such as text, a link or a
|
|
5
|
+
* folder. The panel shows for any drag, because a drag does not reliably
|
|
6
|
+
* expose its contents until the drop.
|
|
7
|
+
*/
|
|
8
|
+
onNoFilesDropped?: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Called when a dropped file cannot be read, or when `onFileDrop` or
|
|
11
|
+
* `onFilesDrop` throws. Without it such a failure is silent, since the drop
|
|
12
|
+
* surface has no error state.
|
|
10
13
|
*/
|
|
11
14
|
onDropError?: (error: Error) => void;
|
|
12
15
|
/** Ignore drags and drops, and never show the panel. Children stay mounted. */
|
|
13
16
|
isDisabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Ignore a drag that starts inside this document, such as selected text, a
|
|
19
|
+
* link or an image on the page. The zone shows no panel for it and delivers
|
|
20
|
+
* nothing. Use it when the zone covers content the user can drag, and only
|
|
21
|
+
* files from outside the page count as a drop.
|
|
22
|
+
*/
|
|
23
|
+
ignorePageDrags?: boolean;
|
|
14
24
|
/**
|
|
15
25
|
* Panel heading, and the accessible name of the keyboard drop button. `aria-label`
|
|
16
26
|
* is deliberately not accepted separately — the two would disagree, and the visible
|
|
@@ -22,11 +32,45 @@ export interface DropZoneProps extends Omit<HTMLAttributes<HTMLDivElement>, "onD
|
|
|
22
32
|
className?: string;
|
|
23
33
|
children: ReactNode;
|
|
24
34
|
}
|
|
35
|
+
interface DropZonePerFileProps {
|
|
36
|
+
/**
|
|
37
|
+
* Called with the dropped file once it resolves. Exactly one file per drop,
|
|
38
|
+
* unless `allowMultiple` is set.
|
|
39
|
+
*/
|
|
40
|
+
onFileDrop: (file: File) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Called instead of `onFileDrop` when a drop carries more than one file and
|
|
43
|
+
* `allowMultiple` is not set.
|
|
44
|
+
*/
|
|
45
|
+
onMultipleFilesRejected?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Accept a drop that carries several files. `onFileDrop` then runs once per
|
|
48
|
+
* file, in drop order, after every file resolves.
|
|
49
|
+
*/
|
|
50
|
+
allowMultiple?: boolean;
|
|
51
|
+
onFilesDrop?: never;
|
|
52
|
+
}
|
|
53
|
+
interface DropZoneBatchProps {
|
|
54
|
+
/**
|
|
55
|
+
* Called once per drop with every readable file, in drop order, whatever the
|
|
56
|
+
* count. Use it when the consumer decides what a count means.
|
|
57
|
+
*/
|
|
58
|
+
onFilesDrop: (files: File[]) => void;
|
|
59
|
+
onFileDrop?: never;
|
|
60
|
+
onMultipleFilesRejected?: never;
|
|
61
|
+
allowMultiple?: never;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Exactly one delivery callback is required. Without one, a zone would accept a
|
|
65
|
+
* drop and deliver the files nowhere.
|
|
66
|
+
*/
|
|
67
|
+
export type DropZoneProps = DropZoneBaseProps & (DropZonePerFileProps | DropZoneBatchProps);
|
|
25
68
|
/**
|
|
26
|
-
* A region that accepts a
|
|
27
|
-
* while a drag is over it.
|
|
69
|
+
* A region that accepts a dropped file (or several, with `allowMultiple`),
|
|
70
|
+
* showing a panel over its children while a drag is over it.
|
|
28
71
|
*
|
|
29
72
|
* The panel fills the nearest positioned ancestor, so the caller decides how much
|
|
30
73
|
* of the UI is droppable.
|
|
31
74
|
*/
|
|
32
|
-
export declare function DropZone({ onFileDrop, onMultipleFilesRejected, onDropError, isDisabled, label, description, className, children, ...rest }: DropZoneProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
export declare function DropZone({ onFileDrop, onFilesDrop, onMultipleFilesRejected, onNoFilesDropped, onDropError, allowMultiple, isDisabled, ignorePageDrags, label, description, className, children, ...rest }: DropZoneProps): import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
export {};
|
|
@@ -3,54 +3,84 @@ import { CloudUpload as t } from "../Icon/icons/CloudUpload.js";
|
|
|
3
3
|
import { dropZoneRoot as n } from "./DropZone.css.js";
|
|
4
4
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
import { DropZone as o } from "react-aria-components";
|
|
6
|
-
import { useCallback as s,
|
|
7
|
-
import { isFileDropItem as
|
|
6
|
+
import { useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
7
|
+
import { isFileDropItem as d } from "react-aria";
|
|
8
8
|
//#region src/components/DropZone/DropZone.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
var f = "application/x-lovelace-page-drag", p = (e) => e.kind === "text" && e.types.has(f);
|
|
10
|
+
function m({ onFileDrop: m, onFilesDrop: h, onMultipleFilesRejected: g, onNoFilesDropped: _, onDropError: v, allowMultiple: y = !1, isDisabled: b = !1, ignorePageDrags: x = !1, label: S = "Drop your file here", description: C, className: w, children: T, ...E }) {
|
|
11
|
+
let D = l(!1), [O, k] = u(!1);
|
|
12
|
+
c(() => {
|
|
13
|
+
if (!x) return;
|
|
14
|
+
let e = (e) => {
|
|
15
|
+
e.dataTransfer?.setData(f, "1");
|
|
16
|
+
}, t = (e) => {
|
|
17
|
+
k(!!e.dataTransfer?.types.includes(f));
|
|
18
|
+
};
|
|
19
|
+
return document.addEventListener("dragstart", e, !0), document.addEventListener("dragenter", t, !0), () => {
|
|
20
|
+
document.removeEventListener("dragstart", e, !0), document.removeEventListener("dragenter", t, !0), k(!1);
|
|
21
|
+
};
|
|
22
|
+
}, [x]);
|
|
23
|
+
let A = s(async (e) => {
|
|
24
|
+
if (D.current || x && e.items.some(p)) return;
|
|
25
|
+
let t = e.items.filter(d);
|
|
26
|
+
if (t.length === 0) {
|
|
27
|
+
e.items.length > 0 && _?.();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (t.length > 1 && !y && !h) {
|
|
31
|
+
g?.();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
D.current = !0;
|
|
35
|
+
let n = (e) => v?.(e instanceof Error ? e : Error(String(e)));
|
|
36
|
+
try {
|
|
37
|
+
let e = await Promise.allSettled(t.map((e) => e.getFile())), r = [];
|
|
38
|
+
for (let t of e) t.status === "rejected" ? n(t.reason) : r.push(t.value);
|
|
39
|
+
if (h) {
|
|
40
|
+
if (r.length > 0) try {
|
|
41
|
+
h(r);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
n(e);
|
|
44
|
+
}
|
|
45
|
+
} else for (let e of r) try {
|
|
46
|
+
m?.(e);
|
|
21
47
|
} catch (e) {
|
|
22
|
-
|
|
23
|
-
} finally {
|
|
24
|
-
y.current = !1;
|
|
48
|
+
n(e);
|
|
25
49
|
}
|
|
50
|
+
} finally {
|
|
51
|
+
D.current = !1;
|
|
26
52
|
}
|
|
27
53
|
}, [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
54
|
+
y,
|
|
55
|
+
x,
|
|
56
|
+
v,
|
|
57
|
+
m,
|
|
58
|
+
h,
|
|
59
|
+
g,
|
|
60
|
+
_
|
|
31
61
|
]);
|
|
32
62
|
return /* @__PURE__ */ i(o, {
|
|
33
|
-
...
|
|
34
|
-
"aria-label":
|
|
35
|
-
isDisabled:
|
|
36
|
-
onDrop:
|
|
37
|
-
className: e(n,
|
|
38
|
-
children: ({ isDropTarget: e, isFocusVisible: n }) => /* @__PURE__ */ a(r, { children: [
|
|
63
|
+
...E,
|
|
64
|
+
"aria-label": S,
|
|
65
|
+
isDisabled: b,
|
|
66
|
+
onDrop: A,
|
|
67
|
+
className: e(n, w),
|
|
68
|
+
children: ({ isDropTarget: e, isFocusVisible: n }) => /* @__PURE__ */ a(r, { children: [T, (e && !O || n) && /* @__PURE__ */ a("div", {
|
|
39
69
|
className: "_1vy5zjp1",
|
|
40
70
|
children: [/* @__PURE__ */ i(t, {}), /* @__PURE__ */ a("div", {
|
|
41
71
|
className: "_1vy5zjp2",
|
|
42
72
|
children: [/* @__PURE__ */ i("p", {
|
|
43
73
|
className: "_1vy5zjp3",
|
|
44
|
-
children:
|
|
45
|
-
}),
|
|
74
|
+
children: S
|
|
75
|
+
}), C && /* @__PURE__ */ i("p", {
|
|
46
76
|
className: "_1vy5zjp4",
|
|
47
|
-
children:
|
|
77
|
+
children: C
|
|
48
78
|
})]
|
|
49
79
|
})]
|
|
50
80
|
})] })
|
|
51
81
|
});
|
|
52
82
|
}
|
|
53
83
|
//#endregion
|
|
54
|
-
export {
|
|
84
|
+
export { m as DropZone };
|
|
55
85
|
|
|
56
86
|
//# sourceMappingURL=DropZone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropZone.js","names":[],"sources":["../../../src/components/DropZone/DropZone.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { useCallback, useRef } from \"react\";\nimport type { DropEvent } from \"react-aria\";\nimport { isFileDropItem } from \"react-aria\";\nimport { DropZone as AriaDropZone } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { CloudUpload } from \"../Icon/icons/index.js\";\nimport {\n\tdropZoneDescription,\n\tdropZoneLabel,\n\tdropZonePanel,\n\tdropZoneRoot,\n\tdropZoneText,\n} from \"./DropZone.css.js\";\n\nexport interface DropZoneProps\n\textends Omit<\n\t\tHTMLAttributes<HTMLDivElement>,\n\t\t\"onDrop\" | \"children\" | \"aria-label\"\n\t> {\n\t/** Called with the dropped file once it resolves. Exactly one file per drop. */\n\tonFileDrop: (file: File) => void;\n\t/** Called instead of `onFileDrop` when a drop carries more than one file. */\n\tonMultipleFilesRejected?: () => void;\n\t/**\n\t * Called when a dropped file cannot be read, or when `onFileDrop` throws. Without\n\t * it such a failure is silent, since the drop surface has no error state.\n\t */\n\tonDropError?: (error: Error) => void;\n\t/** Ignore drags and drops, and never show the panel. Children stay mounted. */\n\tisDisabled?: boolean;\n\t/**\n\t * Panel heading, and the accessible name of the keyboard drop button. `aria-label`\n\t * is deliberately not accepted separately — the two would disagree, and the visible\n\t * heading is the name a screen reader should read.\n\t */\n\tlabel?: string;\n\t/** Optional second line under the heading. */\n\tdescription?: string;\n\tclassName?: string;\n\tchildren: ReactNode;\n}\n\n/**\n * A region that accepts a single dropped file, showing a panel over its children\n * while a drag is over it.\n *\n * The panel fills the nearest positioned ancestor, so the caller decides how much\n * of the UI is droppable.\n */\nexport function DropZone({\n\tonFileDrop,\n\tonMultipleFilesRejected,\n\tonDropError,\n\tisDisabled = false,\n\tlabel = \"Drop your file here\",\n\tdescription,\n\tclassName,\n\tchildren,\n\t...rest\n}: DropZoneProps) {\n\t// Resolving a dropped file is async, so a second drop can arrive before the\n\t// first reports. Claim the zone synchronously, while still on the drop event,\n\t// so only one drop per resolution reaches the consumer.\n\tconst resolvingRef = useRef(false);\n\n\tconst handleDrop = useCallback(\n\t\tasync (event: DropEvent) => {\n\t\t\tif (resolvingRef.current) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst files = event.items.filter(isFileDropItem);\n\t\t\tif (files.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (files.length > 1) {\n\t\t\t\tonMultipleFilesRejected?.();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolvingRef.current = true;\n\t\t\ttry {\n\t\t\t\tconst file = await files[0].getFile();\n\t\t\t\tonFileDrop(file);\n\t\t\t} catch (error) {\n\t\t\t\t// RAC calls onDrop without awaiting it, so anything thrown here — a file\n\t\t\t\t// the browser cannot read, or a consumer's own handler — escapes as an\n\t\t\t\t// unhandled rejection instead of reaching a caller. Report it and leave\n\t\t\t\t// the surface as it was; the consumer decides what a failed drop means.\n\t\t\t\tonDropError?.(\n\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tresolvingRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[onDropError, onFileDrop, onMultipleFilesRejected],\n\t);\n\n\treturn (\n\t\t<AriaDropZone\n\t\t\t{...rest}\n\t\t\taria-label={label}\n\t\t\tisDisabled={isDisabled}\n\t\t\tonDrop={handleDrop}\n\t\t\tclassName={cx(dropZoneRoot, className)}\n\t\t>\n\t\t\t{({ isDropTarget, isFocusVisible }) => (\n\t\t\t\t<>\n\t\t\t\t\t{children}\n\t\t\t\t\t{(isDropTarget || isFocusVisible) && (\n\t\t\t\t\t\t<div className={dropZonePanel}>\n\t\t\t\t\t\t\t<CloudUpload />\n\t\t\t\t\t\t\t<div className={dropZoneText}>\n\t\t\t\t\t\t\t\t<p className={dropZoneLabel}>{label}</p>\n\t\t\t\t\t\t\t\t{description && (\n\t\t\t\t\t\t\t\t\t<p className={dropZoneDescription}>{description}</p>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</AriaDropZone>\n\t);\n}\n"],"mappings":";;;;;;;;AAkDA,SAAgB,EAAS,EACxB,eACA,4BACA,gBACA,gBAAa,IACb,WAAQ,uBACR,gBACA,cACA,aACA,GAAG,KACc;CAIjB,IAAM,IAAe,EAAO,GAAM,EAE5B,IAAa,EAClB,OAAO,MAAqB;AAC3B,MAAI,EAAa,QAChB;EAED,IAAM,IAAQ,EAAM,MAAM,OAAO,EAAe;AAC5C,QAAM,WAAW,GAGrB;OAAI,EAAM,SAAS,GAAG;AACrB,SAA2B;AAC3B;;AAED,KAAa,UAAU;AACvB,OAAI;AAEH,MADa,MAAM,EAAM,GAAG,SAAS,CACrB;YACR,GAAO;AAKf,QACC,aAAiB,QAAQ,IAAY,MAAM,OAAO,EAAM,CAAC,CACzD;aACQ;AACT,MAAa,UAAU;;;IAGzB;EAAC;EAAa;EAAY;EAAwB,CAClD;AAED,QACC,kBAAC,GAAD;EACC,GAAI;EACJ,cAAY;EACA;EACZ,QAAQ;EACR,WAAW,EAAG,GAAc,EAAU;aAEpC,EAAE,iBAAc,wBACjB,kBAAA,GAAA,EAAA,UAAA,CACE,IACC,KAAgB,MACjB,kBAAC,OAAD;GAAK,WAAA;aAAL,CACC,kBAAC,GAAD,EAAe,CAAA,EACf,kBAAC,OAAD;IAAK,WAAA;cAAL,CACC,kBAAC,KAAD;KAAG,WAAA;eAA2B;KAAU,CAAA,EACvC,KACA,kBAAC,KAAD;KAAG,WAAA;eAAiC;KAAgB,CAAA,CAEhD;MACD;KAEL,EAAA,CAAA;EAEU,CAAA"}
|
|
1
|
+
{"version":3,"file":"DropZone.js","names":[],"sources":["../../../src/components/DropZone/DropZone.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { DropEvent, DropItem } from \"react-aria\";\nimport { isFileDropItem } from \"react-aria\";\nimport { DropZone as AriaDropZone } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { CloudUpload } from \"../Icon/icons/index.js\";\nimport {\n\tdropZoneDescription,\n\tdropZoneLabel,\n\tdropZonePanel,\n\tdropZoneRoot,\n\tdropZoneText,\n} from \"./DropZone.css.js\";\n\ninterface DropZoneBaseProps\n\textends Omit<\n\t\tHTMLAttributes<HTMLDivElement>,\n\t\t\"onDrop\" | \"children\" | \"aria-label\"\n\t> {\n\t/**\n\t * Called when a drop carries items but no file, such as text, a link or a\n\t * folder. The panel shows for any drag, because a drag does not reliably\n\t * expose its contents until the drop.\n\t */\n\tonNoFilesDropped?: () => void;\n\t/**\n\t * Called when a dropped file cannot be read, or when `onFileDrop` or\n\t * `onFilesDrop` throws. Without it such a failure is silent, since the drop\n\t * surface has no error state.\n\t */\n\tonDropError?: (error: Error) => void;\n\t/** Ignore drags and drops, and never show the panel. Children stay mounted. */\n\tisDisabled?: boolean;\n\t/**\n\t * Ignore a drag that starts inside this document, such as selected text, a\n\t * link or an image on the page. The zone shows no panel for it and delivers\n\t * nothing. Use it when the zone covers content the user can drag, and only\n\t * files from outside the page count as a drop.\n\t */\n\tignorePageDrags?: boolean;\n\t/**\n\t * Panel heading, and the accessible name of the keyboard drop button. `aria-label`\n\t * is deliberately not accepted separately — the two would disagree, and the visible\n\t * heading is the name a screen reader should read.\n\t */\n\tlabel?: string;\n\t/** Optional second line under the heading. */\n\tdescription?: string;\n\tclassName?: string;\n\tchildren: ReactNode;\n}\n\ninterface DropZonePerFileProps {\n\t/**\n\t * Called with the dropped file once it resolves. Exactly one file per drop,\n\t * unless `allowMultiple` is set.\n\t */\n\tonFileDrop: (file: File) => void;\n\t/**\n\t * Called instead of `onFileDrop` when a drop carries more than one file and\n\t * `allowMultiple` is not set.\n\t */\n\tonMultipleFilesRejected?: () => void;\n\t/**\n\t * Accept a drop that carries several files. `onFileDrop` then runs once per\n\t * file, in drop order, after every file resolves.\n\t */\n\tallowMultiple?: boolean;\n\tonFilesDrop?: never;\n}\n\ninterface DropZoneBatchProps {\n\t/**\n\t * Called once per drop with every readable file, in drop order, whatever the\n\t * count. Use it when the consumer decides what a count means.\n\t */\n\tonFilesDrop: (files: File[]) => void;\n\tonFileDrop?: never;\n\tonMultipleFilesRejected?: never;\n\tallowMultiple?: never;\n}\n\n/**\n * Marks a drag that starts inside this document, such as selected text or a\n * transcript image. The marker rides on the drag's own data, so no state can be\n * left over when a drag ends without a `dragend`.\n */\nconst PAGE_DRAG_TYPE = \"application/x-lovelace-page-drag\";\n\nconst isPageDragItem = (item: DropItem) =>\n\titem.kind === \"text\" && item.types.has(PAGE_DRAG_TYPE);\n\n/**\n * Exactly one delivery callback is required. Without one, a zone would accept a\n * drop and deliver the files nowhere.\n */\nexport type DropZoneProps = DropZoneBaseProps &\n\t(DropZonePerFileProps | DropZoneBatchProps);\n\n/**\n * A region that accepts a dropped file (or several, with `allowMultiple`),\n * showing a panel over its children while a drag is over it.\n *\n * The panel fills the nearest positioned ancestor, so the caller decides how much\n * of the UI is droppable.\n */\nexport function DropZone({\n\tonFileDrop,\n\tonFilesDrop,\n\tonMultipleFilesRejected,\n\tonNoFilesDropped,\n\tonDropError,\n\tallowMultiple = false,\n\tisDisabled = false,\n\tignorePageDrags = false,\n\tlabel = \"Drop your file here\",\n\tdescription,\n\tclassName,\n\tchildren,\n\t...rest\n}: DropZoneProps) {\n\t// Resolving a dropped file is async, so a second drop can arrive before the\n\t// first reports. Claim the zone synchronously, while still on the drop event,\n\t// so only one drop per resolution reaches the consumer.\n\tconst resolvingRef = useRef(false);\n\n\t// A page drag is tagged when it starts, and the tag rides on the drag data.\n\t// Every drag begins with a fresh dragenter, so the flag below cannot outlive\n\t// the drag that set it.\n\tconst [pageDragOver, setPageDragOver] = useState(false);\n\tuseEffect(() => {\n\t\tif (!ignorePageDrags) {\n\t\t\treturn;\n\t\t}\n\t\tconst markPageDrag = (event: DragEvent) => {\n\t\t\tevent.dataTransfer?.setData(PAGE_DRAG_TYPE, \"1\");\n\t\t};\n\t\tconst trackDrag = (event: DragEvent) => {\n\t\t\tsetPageDragOver(\n\t\t\t\tBoolean(event.dataTransfer?.types.includes(PAGE_DRAG_TYPE)),\n\t\t\t);\n\t\t};\n\t\tdocument.addEventListener(\"dragstart\", markPageDrag, true);\n\t\tdocument.addEventListener(\"dragenter\", trackDrag, true);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"dragstart\", markPageDrag, true);\n\t\t\tdocument.removeEventListener(\"dragenter\", trackDrag, true);\n\t\t\tsetPageDragOver(false);\n\t\t};\n\t}, [ignorePageDrags]);\n\n\tconst handleDrop = useCallback(\n\t\tasync (event: DropEvent) => {\n\t\t\tif (\n\t\t\t\tresolvingRef.current ||\n\t\t\t\t(ignorePageDrags && event.items.some(isPageDragItem))\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst files = event.items.filter(isFileDropItem);\n\t\t\tif (files.length === 0) {\n\t\t\t\tif (event.items.length > 0) {\n\t\t\t\t\tonNoFilesDropped?.();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (files.length > 1 && !allowMultiple && !onFilesDrop) {\n\t\t\t\tonMultipleFilesRejected?.();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolvingRef.current = true;\n\t\t\t// RAC calls onDrop without awaiting it. Anything thrown here, such as a\n\t\t\t// file the browser cannot read or a consumer's own handler throwing,\n\t\t\t// escapes as an unhandled rejection instead of reaching a caller. Report\n\t\t\t// each failure on its own, so one bad file in a multi-file drop does not\n\t\t\t// lose the rest. The consumer decides what a failed file means.\n\t\t\tconst reportError = (error: unknown) =>\n\t\t\t\tonDropError?.(\n\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst results = await Promise.allSettled(\n\t\t\t\t\tfiles.map((item) => item.getFile()),\n\t\t\t\t);\n\t\t\t\tconst readable: File[] = [];\n\t\t\t\tfor (const result of results) {\n\t\t\t\t\tif (result.status === \"rejected\") {\n\t\t\t\t\t\treportError(result.reason);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treadable.push(result.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (onFilesDrop) {\n\t\t\t\t\tif (readable.length > 0) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tonFilesDrop(readable);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\treportError(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor (const file of readable) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tonFileDrop?.(file);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\treportError(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tresolvingRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tallowMultiple,\n\t\t\tignorePageDrags,\n\t\t\tonDropError,\n\t\t\tonFileDrop,\n\t\t\tonFilesDrop,\n\t\t\tonMultipleFilesRejected,\n\t\t\tonNoFilesDropped,\n\t\t],\n\t);\n\n\treturn (\n\t\t<AriaDropZone\n\t\t\t{...rest}\n\t\t\taria-label={label}\n\t\t\tisDisabled={isDisabled}\n\t\t\tonDrop={handleDrop}\n\t\t\tclassName={cx(dropZoneRoot, className)}\n\t\t>\n\t\t\t{({ isDropTarget, isFocusVisible }) => (\n\t\t\t\t<>\n\t\t\t\t\t{children}\n\t\t\t\t\t{((isDropTarget && !pageDragOver) || isFocusVisible) && (\n\t\t\t\t\t\t<div className={dropZonePanel}>\n\t\t\t\t\t\t\t<CloudUpload />\n\t\t\t\t\t\t\t<div className={dropZoneText}>\n\t\t\t\t\t\t\t\t<p className={dropZoneLabel}>{label}</p>\n\t\t\t\t\t\t\t\t{description && (\n\t\t\t\t\t\t\t\t\t<p className={dropZoneDescription}>{description}</p>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</AriaDropZone>\n\t);\n}\n"],"mappings":";;;;;;;;AAwFA,IAAM,IAAiB,oCAEjB,KAAkB,MACvB,EAAK,SAAS,UAAU,EAAK,MAAM,IAAI,EAAe;AAgBvD,SAAgB,EAAS,EACxB,eACA,gBACA,4BACA,qBACA,gBACA,mBAAgB,IAChB,gBAAa,IACb,qBAAkB,IAClB,WAAQ,uBACR,gBACA,cACA,aACA,GAAG,KACc;CAIjB,IAAM,IAAe,EAAO,GAAM,EAK5B,CAAC,GAAc,KAAmB,EAAS,GAAM;AACvD,SAAgB;AACf,MAAI,CAAC,EACJ;EAED,IAAM,KAAgB,MAAqB;AAC1C,KAAM,cAAc,QAAQ,GAAgB,IAAI;KAE3C,KAAa,MAAqB;AACvC,KACC,EAAQ,EAAM,cAAc,MAAM,SAAS,EAAe,CAC1D;;AAIF,SAFA,SAAS,iBAAiB,aAAa,GAAc,GAAK,EAC1D,SAAS,iBAAiB,aAAa,GAAW,GAAK,QAC1C;AAGZ,GAFA,SAAS,oBAAoB,aAAa,GAAc,GAAK,EAC7D,SAAS,oBAAoB,aAAa,GAAW,GAAK,EAC1D,EAAgB,GAAM;;IAErB,CAAC,EAAgB,CAAC;CAErB,IAAM,IAAa,EAClB,OAAO,MAAqB;AAC3B,MACC,EAAa,WACZ,KAAmB,EAAM,MAAM,KAAK,EAAe,CAEpD;EAED,IAAM,IAAQ,EAAM,MAAM,OAAO,EAAe;AAChD,MAAI,EAAM,WAAW,GAAG;AACvB,GAAI,EAAM,MAAM,SAAS,KACxB,KAAoB;AAErB;;AAED,MAAI,EAAM,SAAS,KAAK,CAAC,KAAiB,CAAC,GAAa;AACvD,QAA2B;AAC3B;;AAED,IAAa,UAAU;EAMvB,IAAM,KAAe,MACpB,IACC,aAAiB,QAAQ,IAAY,MAAM,OAAO,EAAM,CAAC,CACzD;AACF,MAAI;GACH,IAAM,IAAU,MAAM,QAAQ,WAC7B,EAAM,KAAK,MAAS,EAAK,SAAS,CAAC,CACnC,EACK,IAAmB,EAAE;AAC3B,QAAK,IAAM,KAAU,EACpB,CAAI,EAAO,WAAW,aACrB,EAAY,EAAO,OAAO,GAE1B,EAAS,KAAK,EAAO,MAAM;AAG7B,OAAI;QACC,EAAS,SAAS,EACrB,KAAI;AACH,OAAY,EAAS;aACb,GAAO;AACf,OAAY,EAAM;;SAIpB,MAAK,IAAM,KAAQ,EAClB,KAAI;AACH,QAAa,EAAK;YACV,GAAO;AACf,MAAY,EAAM;;YAIZ;AACT,KAAa,UAAU;;IAGzB;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA,CACD;AAED,QACC,kBAAC,GAAD;EACC,GAAI;EACJ,cAAY;EACA;EACZ,QAAQ;EACR,WAAW,EAAG,GAAc,EAAU;aAEpC,EAAE,iBAAc,wBACjB,kBAAA,GAAA,EAAA,UAAA,CACE,IACE,KAAgB,CAAC,KAAiB,MACpC,kBAAC,OAAD;GAAK,WAAA;aAAL,CACC,kBAAC,GAAD,EAAe,CAAA,EACf,kBAAC,OAAD;IAAK,WAAA;cAAL,CACC,kBAAC,KAAD;KAAG,WAAA;eAA2B;KAAU,CAAA,EACvC,KACA,kBAAC,KAAD;KAAG,WAAA;eAAiC;KAAgB,CAAA,CAEhD;MACD;KAEL,EAAA,CAAA;EAEU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.css.js","names":[],"sources":["../../../src/components/Header/Header.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const headerRoot = style({\n\tbackgroundColor: t(\"header-background\"),\n\tcolor: t(\"header-content\"),\n\tdisplay: \"flex\",\n\talignItems: \"center\",\n\tposition: \"relative\",\n\theight: \"56px\",\n\tpadding: `0 ${t(\"padding-12\")}`,\n\tflexShrink: 0,\n\tgap: t(\"spacing-8\"),\n\toverflow: \"hidden\",\n});\n\nglobalStyle(`${headerRoot} [data-slot=\"icon\"]`, {\n\tcolor: t(\"header-content\"),\n});\n\nglobalStyle(`${headerRoot} [data-slot=\"avatar\"] [data-slot=\"icon\"]`, {\n\tcolor: t(\"avatar-content\"),\n});\n\nexport const headerTitle = style({\n\tmargin: 0,\n\tflex: 1,\n\tminWidth: 0,\n\toverflow: \"hidden\",\n\ttextOverflow: \"ellipsis\",\n\twhiteSpace: \"nowrap\",\n\
|
|
1
|
+
{"version":3,"file":"Header.css.js","names":[],"sources":["../../../src/components/Header/Header.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const headerRoot = style({\n\tbackgroundColor: t(\"header-background\"),\n\tcolor: t(\"header-content\"),\n\tdisplay: \"flex\",\n\talignItems: \"center\",\n\tposition: \"relative\",\n\theight: \"56px\",\n\tpadding: `0 ${t(\"padding-12\")}`,\n\tflexShrink: 0,\n\tgap: t(\"spacing-8\"),\n\toverflow: \"hidden\",\n});\n\nglobalStyle(`${headerRoot} [data-slot=\"icon\"]`, {\n\tcolor: t(\"header-content\"),\n});\n\nglobalStyle(`${headerRoot} [data-slot=\"avatar\"] [data-slot=\"icon\"]`, {\n\tcolor: t(\"avatar-content\"),\n});\n\nexport const headerTitle = style({\n\tmargin: 0,\n\tflex: 1,\n\tminWidth: 0,\n\toverflow: \"hidden\",\n\ttextOverflow: \"ellipsis\",\n\twhiteSpace: \"nowrap\",\n\t// Figma node 12861-6177 draws the bar title at the body tier, not a title\n\t// tier — it is a heading by role, not by size.\n\t...typography(\"body\", \"medium\"),\n});\n"],"mappings":""}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import type { HTMLAttributes, Ref } from "react";
|
|
2
2
|
export interface HeaderTitleProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Heading level. Defaults to `1` — the surface's top-level heading, and what
|
|
5
|
+
* this rendered before it composed RAC. RAC's own default is `3`, so the
|
|
6
|
+
* default here is load-bearing, not decoration. A widget embedded in a
|
|
7
|
+
* customer's page may need to sit under that page's outline instead.
|
|
8
|
+
*/
|
|
9
|
+
level?: number;
|
|
3
10
|
ref?: Ref<HTMLHeadingElement>;
|
|
4
11
|
}
|
|
5
12
|
/**
|
|
6
|
-
* Header title text,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
13
|
+
* Header title text, the surface's heading. Grows to fill the bar and truncates
|
|
14
|
+
* with an ellipsis when the label is too long; inherits `header-content` from
|
|
15
|
+
* the surrounding Header.
|
|
16
|
+
*
|
|
17
|
+
* Figma draws it at the body tier — a heading by role, not by size.
|
|
9
18
|
*/
|
|
10
|
-
export declare function HeaderTitle({ className, children, ref, ...rest }: HeaderTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function HeaderTitle({ level, className, children, ref, ...rest }: HeaderTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { cx as e } from "../../utils/cx.js";
|
|
2
2
|
import { headerTitle as t } from "./Header.css.js";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { Heading as r } from "react-aria-components";
|
|
4
5
|
//#region src/components/Header/HeaderTitle.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */ n(
|
|
7
|
-
...
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
function i({ level: i = 1, className: a, children: o, ref: s, ...c }) {
|
|
7
|
+
return /* @__PURE__ */ n(r, {
|
|
8
|
+
...c,
|
|
9
|
+
level: i,
|
|
10
|
+
ref: s,
|
|
11
|
+
className: e(t, a),
|
|
12
|
+
children: o
|
|
11
13
|
});
|
|
12
14
|
}
|
|
13
15
|
//#endregion
|
|
14
|
-
export {
|
|
16
|
+
export { i as HeaderTitle };
|
|
15
17
|
|
|
16
18
|
//# sourceMappingURL=HeaderTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderTitle.js","names":[],"sources":["../../../src/components/Header/HeaderTitle.tsx"],"sourcesContent":["import type { HTMLAttributes, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { headerTitle } from \"./Header.css.js\";\n\nexport interface HeaderTitleProps extends HTMLAttributes<HTMLElement> {\n\tref?: Ref<HTMLHeadingElement>;\n}\n\n/**\n * Header title text,
|
|
1
|
+
{"version":3,"file":"HeaderTitle.js","names":[],"sources":["../../../src/components/Header/HeaderTitle.tsx"],"sourcesContent":["import type { HTMLAttributes, Ref } from \"react\";\nimport { Heading } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { headerTitle } from \"./Header.css.js\";\n\nexport interface HeaderTitleProps extends HTMLAttributes<HTMLElement> {\n\t/**\n\t * Heading level. Defaults to `1` — the surface's top-level heading, and what\n\t * this rendered before it composed RAC. RAC's own default is `3`, so the\n\t * default here is load-bearing, not decoration. A widget embedded in a\n\t * customer's page may need to sit under that page's outline instead.\n\t */\n\tlevel?: number;\n\tref?: Ref<HTMLHeadingElement>;\n}\n\n/**\n * Header title text, the surface's heading. Grows to fill the bar and truncates\n * with an ellipsis when the label is too long; inherits `header-content` from\n * the surrounding Header.\n *\n * Figma draws it at the body tier — a heading by role, not by size.\n */\nexport function HeaderTitle({\n\tlevel = 1,\n\tclassName,\n\tchildren,\n\tref,\n\t...rest\n}: HeaderTitleProps) {\n\treturn (\n\t\t<Heading\n\t\t\t{...rest}\n\t\t\tlevel={level}\n\t\t\tref={ref}\n\t\t\tclassName={cx(headerTitle, className)}\n\t\t>\n\t\t\t{children}\n\t\t</Heading>\n\t);\n}\n"],"mappings":";;;;;AAuBA,SAAgB,EAAY,EAC3B,WAAQ,GACR,cACA,aACA,QACA,GAAG,KACiB;AACpB,QACC,kBAAC,GAAD;EACC,GAAI;EACG;EACF;EACL,WAAW,EAAG,GAAa,EAAU;EAEpC;EACQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.css.js","names":[],"sources":["../../../src/components/Input/Input.css.ts"],"sourcesContent":["import type { ComplexStyleRule } from \"@vanilla-extract/css\";\nimport { globalStyle, style } from \"@vanilla-extract/css\";\nimport type { RuntimeFn } from \"@vanilla-extract/recipes\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { t } from \"../../tokens/index.js\";\n\n// Shared by the text control and the label so their typography stays in lockstep.\nconst bodyText = {\n\tfontFamily: t(\"font-family-body\"),\n\tfontWeight: t(\"font-weight-regular\"),\n\tfontSize: t(\"font-size-body\"),\n\tlineHeight: t(\"line-height-body\"),\n} as const;\n\n// Field and action-button icon glyphs share sizing.\nconst iconSlotSizing = {\n\tflexShrink: 0,\n\tfontSize: t(\"icon-size-control\"),\n} as const;\n\nexport const inputRoot = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\twidth: \"100%\",\n\tfontFamily: t(\"font-family-body\"),\n});\n\n// Empty style used purely as a stable selector anchor for the globalStyle rules\n// below — a recipe class isn't a usable selector string, so descendant styles\n// hang off this base class instead.\nconst inputFieldBase = style({});\n\n// Composer-variant anchor: composed into the `composer` variant so the control's\n// content/placeholder colors (a descendant, not the field) can be re-themed to\n// the composer-* tokens via globalStyle.\nconst inputFieldComposer = style({});\n\n/**\n * Shares the line below the control with the field's own button rather than\n * taking a line of its own: Figma bottom-aligns the chips and the send action\n * on one line, which `Input.Field`'s `align-items: flex-end` then handles.\n */\nexport const inputAttachments = style({\n\tflex: \"1 1 auto\",\n\tminWidth: 0,\n\tdisplay: \"flex\",\n\tflexWrap: \"wrap\",\n\tgap: t(\"gap-8\"),\n});\n\n// Explicit annotation: the inferred recipe type exceeds tsc's declaration\n// serialization limit (TS7056) under `tsc -p tsconfig.build.json`.\nexport const inputField: RuntimeFn<{\n\tvariant: Record<\"default\" | \"composer\", ComplexStyleRule>;\n}> = recipe({\n\tbase: [\n\t\tinputFieldBase,\n\t\t{\n\t\t\tdisplay: \"flex\",\n\t\t\t// The control takes the whole first line whenever attachments are present\n\t\t\t// (see the `data-has-attachments` rule below), so the chips and the button\n\t\t\t// wrap onto the second. Keep wrapping unconditional because Chrome and\n\t\t\t// Firefox at the floor in `messaging/vite.browser-targets.mjs` lack\n\t\t\t// `:has()`. Without attachments nothing wraps: the control has\n\t\t\t// flex-basis 0, icons and button are 22px.\n\t\t\tflexWrap: \"wrap\",\n\t\t\talignItems: \"flex-end\",\n\t\t\tgap: t(\"gap-8\"),\n\t\t\twidth: \"100%\",\n\t\t\tminHeight: \"40px\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tpaddingInline: t(\"padding-12\"),\n\t\t\tpaddingBlock: t(\"padding-8\"),\n\t\t\tborder: `${t(\"border-width-default\")} solid ${t(\"color-border-default\")}`,\n\t\t\tbackgroundColor: t(\"color-background-default\"),\n\t\t\tborderRadius: t(\"border-radius-input\"),\n\t\t\tcursor: \"text\",\n\t\t\tselectors: {\n\t\t\t\t\"&[data-focus-within]\": {\n\t\t\t\t\tborderColor: t(\"color-border-accent\"),\n\t\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t\t\t},\n\t\t\t\t// After focus-within so an invalid field keeps its destructive border while focused.\n\t\t\t\t\"&[data-invalid]\": {\n\t\t\t\t\tborderColor: t(\"color-border-destructive\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-disabled]\": {\n\t\t\t\t\tbackgroundColor: t(\"color-background-disabled\"),\n\t\t\t\t\tcursor: \"not-allowed\",\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"@media\": {\n\t\t\t\t\"(prefers-reduced-motion: no-preference)\": {\n\t\t\t\t\ttransitionProperty: \"border-color, box-shadow\",\n\t\t\t\t\ttransitionDuration: t(\"duration-fast\"),\n\t\t\t\t\ttransitionTimingFunction: t(\"easing-standard\"),\n\t\t\t\t},\n\t\t\t\t// Token-color focus ring flattens in forced-colors; redraw with a system color.\n\t\t\t\t\"(forced-colors: active)\": {\n\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\"&[data-focus-within]\": {\n\t\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tvariants: {\n\t\tvariant: {\n\t\t\t// Default field styling lives in `base`; this key exists so the variant\n\t\t\t// axis accepts \"default\" as an explicit no-op.\n\t\t\tdefault: {},\n\t\t\tcomposer: [\n\t\t\t\tinputFieldComposer,\n\t\t\t\t{\n\t\t\t\t\tborderRadius: t(\"border-radius-composer\"),\n\t\t\t\t\tborder: `${t(\"border-width-default\")} solid ${t(\"composer-border-default\")}`,\n\t\t\t\t\tbackgroundColor: t(\"composer-background\"),\n\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\"&[data-focus-within]\": {\n\t\t\t\t\t\t\tborderColor: t(\"composer-border-active\"),\n\t\t\t\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"composer-border-focus\")}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t// Re-declared after focus-within for the same reason the base does:\n\t\t\t\t\t\t// variant styles are emitted after base at equal specificity, so\n\t\t\t\t\t\t// without this the composer's focus colour would win and an invalid\n\t\t\t\t\t\t// composer would lose its destructive border while focused.\n\t\t\t\t\t\t\"&[data-invalid]\": {\n\t\t\t\t\t\t\tborderColor: t(\"color-border-destructive\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tvariant: \"default\",\n\t},\n});\n\nexport const inputControl = style({\n\tflex: 1,\n\tminWidth: 0,\n\tmargin: 0,\n\tpadding: 0,\n\tborder: \"none\",\n\tbackgroundColor: \"transparent\",\n\toutline: \"none\",\n\tappearance: \"none\",\n\t...bodyText,\n\tcolor: t(\"color-content-default\"),\n\tselectors: {\n\t\t\"&::placeholder\": {\n\t\t\tcolor: t(\"color-content-secondary\"),\n\t\t\topacity: 1,\n\t\t},\n\t\t\"&[data-disabled]\": {\n\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t\tcursor: \"not-allowed\",\n\t\t},\n\t\t\"&[data-disabled]::placeholder\": {\n\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t},\n\t},\n});\n\n// Same control base as the single-line inputControl (typography, colors,\n// placeholder/disabled states), plus the multi-line-specific box behavior.\nexport const inputTextArea = style([\n\tinputControl,\n\t{\n\t\tdisplay: \"block\",\n\t\twidth: \"100%\",\n\t\tboxSizing: \"border-box\",\n\t\t// Height is driven by the auto-grow logic in InputTextArea; the user never drags it.\n\t\tresize: \"none\",\n\t\toverflowY: \"auto\",\n\t\toverflowWrap: \"anywhere\",\n\t\twordBreak: \"break-word\",\n\t\tscrollbarWidth: \"thin\",\n\t\tscrollbarColor: `${t(\"color-border-default\")} transparent`,\n\t},\n]);\n\nexport const inputButton = style({\n\tposition: \"relative\",\n\tisolation: \"isolate\",\n\tdisplay: \"inline-flex\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tflexShrink: 0,\n\t// Circular send/action button — 22px square per Figma (matches the field's icon size).\n\twidth: \"22px\",\n\theight: \"22px\",\n\tpadding: 0,\n\tborder: \"none\",\n\tborderRadius: t(\"border-radius-full\"),\n\tbackgroundColor: t(\"button-primary-background\"),\n\tcolor: t(\"button-primary-content\"),\n\tcursor: \"pointer\",\n\tappearance: \"none\",\n\toutline: \"none\",\n\toverflow: \"hidden\",\n\t\"::after\": {\n\t\tcontent: '\"\"',\n\t\tposition: \"absolute\",\n\t\tinset: 0,\n\t\tborderRadius: \"inherit\",\n\t\tbackgroundColor: \"currentColor\",\n\t\topacity: 0,\n\t\tpointerEvents: \"none\",\n\t\tzIndex: -1,\n\t},\n\tselectors: {\n\t\t\"&[data-hovered]:not([data-disabled])::after\": {\n\t\t\topacity: t(\"opacity-state-hover\"),\n\t\t},\n\t\t\"&[data-focus-visible]:not([data-disabled])::after\": {\n\t\t\topacity: t(\"opacity-state-focus\"),\n\t\t},\n\t\t\"&[data-pressed]:not([data-disabled])::after\": {\n\t\t\topacity: t(\"opacity-state-pressed\"),\n\t\t},\n\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t},\n\t\t\"&[data-disabled]\": {\n\t\t\tcursor: \"not-allowed\",\n\t\t\tbackgroundColor: t(\"color-background-disabled\"),\n\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t},\n\t},\n\t\"@media\": {\n\t\t\"(prefers-reduced-motion: no-preference)\": {\n\t\t\tselectors: {\n\t\t\t\t\"&::after\": {\n\t\t\t\t\ttransition: `opacity ${t(\"duration-fast\")} ${t(\"easing-standard\")}`,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t// Token-color focus ring flattens in forced-colors; redraw with a system color.\n\t\t\"(forced-colors: active)\": {\n\t\t\tselectors: {\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n});\n\nexport const inputLabel = style({\n\t...bodyText,\n\tmarginBottom: t(\"gap-8\"),\n\tcolor: t(\"color-content-default\"),\n});\n\nexport const inputHelperText = style({\n\tmarginTop: t(\"gap-4\"),\n\tfontFamily: t(\"font-family-body\"),\n\tfontWeight: t(\"font-weight-regular\"),\n\tfontSize: t(\"font-size-caption\"),\n\tlineHeight: t(\"line-height-caption\"),\n\tcolor: t(\"color-content-secondary\"),\n\tselectors: {\n\t\t\"&[data-invalid]\": {\n\t\t\tcolor: t(\"color-content-destructive\"),\n\t\t},\n\t},\n});\n\nglobalStyle(`${inputFieldBase} [data-slot='icon']`, iconSlotSizing);\nglobalStyle(`${inputButton} [data-slot='icon']`, iconSlotSizing);\n\n// Direct child only: field-level icons follow content color. The send button's\n// icon is a deeper descendant, so it deliberately has no rule of its own — it\n// inherits the button's paired tokens (button-primary-content over\n// button-primary-background, or the disabled pair). Giving the icon its own\n// background re-pairs an accent foreground with a neutral backdrop, and those\n// two are unrelated tokens: a customer tint near the surface color then renders\n// the arrow at ~1:1.\nglobalStyle(`${inputFieldBase} > [data-slot='icon']`, {\n\tcolor: t(\"color-content-secondary\"),\n});\n\nglobalStyle(`${inputFieldBase}[data-disabled] > [data-slot='icon']`, {\n\tcolor: t(\"color-content-disabled\"),\n});\n\n// Composer variant re-themes the field's content colors to the composer-* tokens.\n// The control (input/textarea) and field-level icons are descendants of the field,\n// so these ride the composer anchor rather than the field recipe.\n/**\n * With attachments in the field the control owns the first line, so the chips\n * and the send button fall onto the second and bottom-align there.\n *\n * Driven by an attribute the caller sets rather than `:has()`, which the iOS 15\n * baseline does not have.\n */\nglobalStyle(`${inputFieldBase}[data-has-attachments] ${inputControl}`, {\n\tflexBasis: \"100%\",\n});\n\n// Figma stacks the text and the chips 20px apart while the send button keeps its\n// 8px from the chips, so the two axes take different gaps.\nglobalStyle(`${inputFieldBase}[data-has-attachments]`, {\n\trowGap: t(\"gap-20\"),\n});\n\nglobalStyle(`${inputFieldComposer} ${inputControl}`, {\n\tcolor: t(\"composer-content-default\"),\n});\n\nglobalStyle(`${inputFieldComposer} ${inputControl}::placeholder`, {\n\tcolor: t(\"composer-content-secondary\"),\n});\n\nglobalStyle(`${inputFieldComposer} > [data-slot='icon']`, {\n\tcolor: t(\"composer-content-secondary\"),\n});\n\n// The composer rules above are descendant selectors, so they tie with the field\n// recipe's [data-disabled] rules on specificity and win on order. Re-assert the\n// disabled colors after them or a disabled control renders as if it were editable.\nglobalStyle(`${inputFieldComposer} ${inputControl}[data-disabled]`, {\n\tcolor: t(\"color-content-disabled\"),\n});\n\nglobalStyle(\n\t`${inputFieldComposer} ${inputControl}[data-disabled]::placeholder`,\n\t{\n\t\tcolor: t(\"color-content-disabled\"),\n\t},\n);\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Input.css.js","names":[],"sources":["../../../src/components/Input/Input.css.ts"],"sourcesContent":["import type { ComplexStyleRule } from \"@vanilla-extract/css\";\nimport { globalStyle, style } from \"@vanilla-extract/css\";\nimport type { RuntimeFn } from \"@vanilla-extract/recipes\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\n// Shared by the text control and the label so their typography stays in lockstep.\nconst bodyText = {\n\t...typography(\"body\", \"regular\"),\n} as const;\n\n// Field and action-button icon glyphs share sizing.\nconst iconSlotSizing = {\n\tflexShrink: 0,\n\tfontSize: t(\"icon-size-control\"),\n} as const;\n\nexport const inputRoot = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\twidth: \"100%\",\n\tfontFamily: t(\"font-family-body\"),\n});\n\n// Empty style used purely as a stable selector anchor for the globalStyle rules\n// below — a recipe class isn't a usable selector string, so descendant styles\n// hang off this base class instead.\nconst inputFieldBase = style({});\n\n// Composer-variant anchor: composed into the `composer` variant so the control's\n// content/placeholder colors (a descendant, not the field) can be re-themed to\n// the composer-* tokens via globalStyle.\nconst inputFieldComposer = style({});\n\n/**\n * Shares the line below the control with the field's own button rather than\n * taking a line of its own: Figma bottom-aligns the chips and the send action\n * on one line, which `Input.Field`'s `align-items: flex-end` then handles.\n */\nexport const inputAttachments = style({\n\tflex: \"1 1 auto\",\n\tminWidth: 0,\n\tdisplay: \"flex\",\n\tflexWrap: \"wrap\",\n\tgap: t(\"gap-8\"),\n});\n\n// Explicit annotation: the inferred recipe type exceeds tsc's declaration\n// serialization limit (TS7056) under `tsc -p tsconfig.build.json`.\nexport const inputField: RuntimeFn<{\n\tvariant: Record<\"default\" | \"composer\", ComplexStyleRule>;\n}> = recipe({\n\tbase: [\n\t\tinputFieldBase,\n\t\t{\n\t\t\tdisplay: \"flex\",\n\t\t\t// The control takes the whole first line whenever attachments are present\n\t\t\t// (see the `data-has-attachments` rule below), so the chips and the button\n\t\t\t// wrap onto the second. Keep wrapping unconditional because Chrome and\n\t\t\t// Firefox at the floor in `messaging/vite.browser-targets.mjs` lack\n\t\t\t// `:has()`. Without attachments nothing wraps: the control has\n\t\t\t// flex-basis 0, icons and button are 22px.\n\t\t\tflexWrap: \"wrap\",\n\t\t\talignItems: \"flex-end\",\n\t\t\tgap: t(\"gap-8\"),\n\t\t\twidth: \"100%\",\n\t\t\tminHeight: \"40px\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tpaddingInline: t(\"padding-12\"),\n\t\t\tpaddingBlock: t(\"padding-8\"),\n\t\t\tborder: `${t(\"border-width-default\")} solid ${t(\"color-border-default\")}`,\n\t\t\tbackgroundColor: t(\"color-background-default\"),\n\t\t\tborderRadius: t(\"border-radius-input\"),\n\t\t\tcursor: \"text\",\n\t\t\tselectors: {\n\t\t\t\t\"&[data-focus-within]\": {\n\t\t\t\t\tborderColor: t(\"color-border-accent\"),\n\t\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t\t\t},\n\t\t\t\t// After focus-within so an invalid field keeps its destructive border while focused.\n\t\t\t\t\"&[data-invalid]\": {\n\t\t\t\t\tborderColor: t(\"color-border-destructive\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-disabled]\": {\n\t\t\t\t\tbackgroundColor: t(\"color-background-disabled\"),\n\t\t\t\t\tcursor: \"not-allowed\",\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"@media\": {\n\t\t\t\t\"(prefers-reduced-motion: no-preference)\": {\n\t\t\t\t\ttransitionProperty: \"border-color, box-shadow\",\n\t\t\t\t\ttransitionDuration: t(\"duration-fast\"),\n\t\t\t\t\ttransitionTimingFunction: t(\"easing-standard\"),\n\t\t\t\t},\n\t\t\t\t// Token-color focus ring flattens in forced-colors; redraw with a system color.\n\t\t\t\t\"(forced-colors: active)\": {\n\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\"&[data-focus-within]\": {\n\t\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tvariants: {\n\t\tvariant: {\n\t\t\t// Default field styling lives in `base`; this key exists so the variant\n\t\t\t// axis accepts \"default\" as an explicit no-op.\n\t\t\tdefault: {},\n\t\t\tcomposer: [\n\t\t\t\tinputFieldComposer,\n\t\t\t\t{\n\t\t\t\t\tborderRadius: t(\"border-radius-composer\"),\n\t\t\t\t\tborder: `${t(\"border-width-default\")} solid ${t(\"composer-border-default\")}`,\n\t\t\t\t\tbackgroundColor: t(\"composer-background\"),\n\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\"&[data-focus-within]\": {\n\t\t\t\t\t\t\tborderColor: t(\"composer-border-active\"),\n\t\t\t\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"composer-border-focus\")}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t// Re-declared after focus-within for the same reason the base does:\n\t\t\t\t\t\t// variant styles are emitted after base at equal specificity, so\n\t\t\t\t\t\t// without this the composer's focus colour would win and an invalid\n\t\t\t\t\t\t// composer would lose its destructive border while focused.\n\t\t\t\t\t\t\"&[data-invalid]\": {\n\t\t\t\t\t\t\tborderColor: t(\"color-border-destructive\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tvariant: \"default\",\n\t},\n});\n\nexport const inputControl = style({\n\tflex: 1,\n\tminWidth: 0,\n\tmargin: 0,\n\tpadding: 0,\n\tborder: \"none\",\n\tbackgroundColor: \"transparent\",\n\toutline: \"none\",\n\tappearance: \"none\",\n\t...bodyText,\n\tcolor: t(\"color-content-default\"),\n\tselectors: {\n\t\t\"&::placeholder\": {\n\t\t\tcolor: t(\"color-content-secondary\"),\n\t\t\topacity: 1,\n\t\t},\n\t\t\"&[data-disabled]\": {\n\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t\tcursor: \"not-allowed\",\n\t\t},\n\t\t\"&[data-disabled]::placeholder\": {\n\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t},\n\t},\n});\n\n// Same control base as the single-line inputControl (typography, colors,\n// placeholder/disabled states), plus the multi-line-specific box behavior.\nexport const inputTextArea = style([\n\tinputControl,\n\t{\n\t\tdisplay: \"block\",\n\t\twidth: \"100%\",\n\t\tboxSizing: \"border-box\",\n\t\t// Height is driven by the auto-grow logic in InputTextArea; the user never drags it.\n\t\tresize: \"none\",\n\t\toverflowY: \"auto\",\n\t\toverflowWrap: \"anywhere\",\n\t\twordBreak: \"break-word\",\n\t\tscrollbarWidth: \"thin\",\n\t\tscrollbarColor: `${t(\"color-border-default\")} transparent`,\n\t},\n]);\n\nexport const inputButton = style({\n\tposition: \"relative\",\n\tisolation: \"isolate\",\n\tdisplay: \"inline-flex\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tflexShrink: 0,\n\t// Circular send/action button — 22px square per Figma (matches the field's icon size).\n\twidth: \"22px\",\n\theight: \"22px\",\n\tpadding: 0,\n\tborder: \"none\",\n\tborderRadius: t(\"border-radius-full\"),\n\tbackgroundColor: t(\"button-primary-background\"),\n\tcolor: t(\"button-primary-content\"),\n\tcursor: \"pointer\",\n\tappearance: \"none\",\n\toutline: \"none\",\n\toverflow: \"hidden\",\n\t\"::after\": {\n\t\tcontent: '\"\"',\n\t\tposition: \"absolute\",\n\t\tinset: 0,\n\t\tborderRadius: \"inherit\",\n\t\tbackgroundColor: \"currentColor\",\n\t\topacity: 0,\n\t\tpointerEvents: \"none\",\n\t\tzIndex: -1,\n\t},\n\tselectors: {\n\t\t\"&[data-hovered]:not([data-disabled])::after\": {\n\t\t\topacity: t(\"opacity-state-hover\"),\n\t\t},\n\t\t\"&[data-focus-visible]:not([data-disabled])::after\": {\n\t\t\topacity: t(\"opacity-state-focus\"),\n\t\t},\n\t\t\"&[data-pressed]:not([data-disabled])::after\": {\n\t\t\topacity: t(\"opacity-state-pressed\"),\n\t\t},\n\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t},\n\t\t\"&[data-disabled]\": {\n\t\t\tcursor: \"not-allowed\",\n\t\t\tbackgroundColor: t(\"color-background-disabled\"),\n\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t},\n\t},\n\t\"@media\": {\n\t\t\"(prefers-reduced-motion: no-preference)\": {\n\t\t\tselectors: {\n\t\t\t\t\"&::after\": {\n\t\t\t\t\ttransition: `opacity ${t(\"duration-fast\")} ${t(\"easing-standard\")}`,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t// Token-color focus ring flattens in forced-colors; redraw with a system color.\n\t\t\"(forced-colors: active)\": {\n\t\t\tselectors: {\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n});\n\nexport const inputLabel = style({\n\t...bodyText,\n\tmarginBottom: t(\"gap-8\"),\n\tcolor: t(\"color-content-default\"),\n});\n\nexport const inputHelperText = style({\n\tmarginTop: t(\"gap-4\"),\n\t...typography(\"caption\", \"regular\"),\n\tcolor: t(\"color-content-secondary\"),\n\tselectors: {\n\t\t\"&[data-invalid]\": {\n\t\t\tcolor: t(\"color-content-destructive\"),\n\t\t},\n\t},\n});\n\nglobalStyle(`${inputFieldBase} [data-slot='icon']`, iconSlotSizing);\nglobalStyle(`${inputButton} [data-slot='icon']`, iconSlotSizing);\n\n// Direct child only: field-level icons follow content color. The send button's\n// icon is a deeper descendant, so it deliberately has no rule of its own — it\n// inherits the button's paired tokens (button-primary-content over\n// button-primary-background, or the disabled pair). Giving the icon its own\n// background re-pairs an accent foreground with a neutral backdrop, and those\n// two are unrelated tokens: a customer tint near the surface color then renders\n// the arrow at ~1:1.\nglobalStyle(`${inputFieldBase} > [data-slot='icon']`, {\n\tcolor: t(\"color-content-secondary\"),\n});\n\nglobalStyle(`${inputFieldBase}[data-disabled] > [data-slot='icon']`, {\n\tcolor: t(\"color-content-disabled\"),\n});\n\n// Composer variant re-themes the field's content colors to the composer-* tokens.\n// The control (input/textarea) and field-level icons are descendants of the field,\n// so these ride the composer anchor rather than the field recipe.\n/**\n * With attachments in the field the control owns the first line, so the chips\n * and the send button fall onto the second and bottom-align there.\n *\n * Driven by an attribute the caller sets rather than `:has()`, which the iOS 15\n * baseline does not have.\n */\nglobalStyle(`${inputFieldBase}[data-has-attachments] ${inputControl}`, {\n\tflexBasis: \"100%\",\n});\n\n// Figma stacks the text and the chips 20px apart while the send button keeps its\n// 8px from the chips, so the two axes take different gaps.\nglobalStyle(`${inputFieldBase}[data-has-attachments]`, {\n\trowGap: t(\"gap-20\"),\n});\n\nglobalStyle(`${inputFieldComposer} ${inputControl}`, {\n\tcolor: t(\"composer-content-default\"),\n});\n\nglobalStyle(`${inputFieldComposer} ${inputControl}::placeholder`, {\n\tcolor: t(\"composer-content-secondary\"),\n});\n\nglobalStyle(`${inputFieldComposer} > [data-slot='icon']`, {\n\tcolor: t(\"composer-content-secondary\"),\n});\n\n// The composer rules above are descendant selectors, so they tie with the field\n// recipe's [data-disabled] rules on specificity and win on order. Re-assert the\n// disabled colors after them or a disabled control renders as if it were editable.\nglobalStyle(`${inputFieldComposer} ${inputControl}[data-disabled]`, {\n\tcolor: t(\"color-content-disabled\"),\n});\n\nglobalStyle(\n\t`${inputFieldComposer} ${inputControl}[data-disabled]::placeholder`,\n\t{\n\t\tcolor: t(\"color-content-disabled\"),\n\t},\n);\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.css.js","names":[],"sources":["../../../src/components/Link/Link.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { t } from \"../../tokens/index.js\";\n\nconst linkBase = style({});\n\nexport const linkRoot = recipe({\n\tbase: [\n\t\tlinkBase,\n\t\t{\n\t\t\tposition: \"relative\",\n\t\t\tisolation: \"isolate\",\n\t\t\tdisplay: \"inline-flex\",\n\t\t\talignItems: \"center\",\n\t\t\tgap: t(\"gap-4\"),\n\t\t\tcolor: t(\"color-content-link\"),\n\t\t\
|
|
1
|
+
{"version":3,"file":"Link.css.js","names":[],"sources":["../../../src/components/Link/Link.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { recipe } from \"@vanilla-extract/recipes\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nconst linkBase = style({});\n\nexport const linkRoot = recipe({\n\tbase: [\n\t\tlinkBase,\n\t\t{\n\t\t\tposition: \"relative\",\n\t\t\tisolation: \"isolate\",\n\t\t\tdisplay: \"inline-flex\",\n\t\t\talignItems: \"center\",\n\t\t\tgap: t(\"gap-4\"),\n\t\t\tcolor: t(\"color-content-link\"),\n\t\t\t...typography(\"body\", \"regular\"),\n\t\t\twordBreak: \"break-word\",\n\t\t\ttextDecoration: \"none\",\n\t\t\tcursor: \"pointer\",\n\t\t\toutline: \"none\",\n\t\t\tborderRadius: t(\"border-radius-6\"),\n\t\t\t\"::after\": {\n\t\t\t\tcontent: '\"\"',\n\t\t\t\tposition: \"absolute\",\n\t\t\t\t// Horizontal breathing room lives on the decorative overlay, not the\n\t\t\t\t// element box, so the state layer balances against the icon's trailing\n\t\t\t\t// whitespace without altering the link's inline layout footprint.\n\t\t\t\tinsetBlock: 0,\n\t\t\t\tinsetInline: `calc(-1 * ${t(\"padding-4\")})`,\n\t\t\t\tborderRadius: \"inherit\",\n\t\t\t\tbackgroundColor: \"currentColor\",\n\t\t\t\topacity: 0,\n\t\t\t\tpointerEvents: \"none\",\n\t\t\t\tzIndex: -1,\n\t\t\t\ttransition: `opacity ${t(\"duration-fast\")} ${t(\"easing-standard\")}`,\n\t\t\t},\n\t\t\tselectors: {\n\t\t\t\t// Without the trailing icon, the underline is the only non-color\n\t\t\t\t// signal that this is a link, so it is mandatory when no icon shows.\n\t\t\t\t\"&:not([data-icon])\": {\n\t\t\t\t\ttextDecoration: \"underline\",\n\t\t\t\t},\n\t\t\t\t\"&[data-hovered]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-hover\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-focus\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-pressed]:not([data-disabled])::after\": {\n\t\t\t\t\topacity: t(\"opacity-state-pressed\"),\n\t\t\t\t},\n\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t\t\t},\n\t\t\t\t\"&[data-disabled]\": {\n\t\t\t\t\tcursor: \"not-allowed\",\n\t\t\t\t\tcolor: t(\"color-content-disabled\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"@media\": {\n\t\t\t\t\"(forced-colors: active)\": {\n\t\t\t\t\tselectors: {\n\t\t\t\t\t\t\"&[data-focus-visible]:not([data-disabled])\": {\n\t\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tvariants: {\n\t\tunderlined: {\n\t\t\ttrue: { textDecoration: \"underline\" },\n\t\t\tfalse: {},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tunderlined: false,\n\t},\n});\n\nglobalStyle(`${linkBase} [data-slot='icon']`, {\n\tflexShrink: 0,\n\tfontSize: t(\"icon-size-control\"),\n});\n\n// The external-link arrow points outward in the reading direction, so it mirrors\n// under RTL. The download glyph is direction-neutral and is left unmirrored.\nglobalStyle(`[dir=\"rtl\"] ${linkBase}:not([data-download]) [data-slot='icon']`, {\n\ttransform: \"scaleX(-1)\",\n});\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageError.css.js","names":[],"sources":["../../../src/components/MessageError/MessageError.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const messageErrorRoot = style({\n\tdisplay: \"flex\",\n});\n\n// Shared layout for the failed-to-send row — icon + destructive-colored caption.\n// Used both interactively (the retry Button) and statically (no `onRetry`).\nexport const messageErrorContent = style({\n\tdisplay: \"inline-flex\",\n\talignItems: \"center\",\n\t// Sized to the error icon, and reserved even in the static variant that carries\n\t// none, so the row does not change height when a retry becomes available.\n\tminHeight: t(\"icon-size-lg\"),\n\tgap: t(\"gap-4\"),\n\tmargin: 0,\n\tcolor: t(\"color-content-destructive\"),\n});\n\n// The interactive retry control layers button affordances over the shared row.\nexport const messageErrorRetry = style([\n\tmessageErrorContent,\n\t{\n\t\tpadding: 0,\n\t\tborder: \"none\",\n\t\tbackground: \"none\",\n\t\tborderRadius: t(\"border-radius-6\"),\n\t\tcursor: \"pointer\",\n\t\toutline: \"none\",\n\t\tselectors: {\n\t\t\t\"&[data-focus-visible]\": {\n\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t\t},\n\t\t},\n\t\t\"@media\": {\n\t\t\t\"(forced-colors: active)\": {\n\t\t\t\tselectors: {\n\t\t\t\t\t\"&[data-focus-visible]\": {\n\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n]);\n\n// Carries the announced failure copy as real text (live regions announce\n// rendered text, not `aria-label`), while staying out of the visual layout.\nexport const messageErrorAnnouncement = style({\n\tposition: \"absolute\",\n\twidth: 1,\n\theight: 1,\n\tpadding: 0,\n\tmargin: -1,\n\toverflow: \"hidden\",\n\tclip: \"rect(0, 0, 0, 0)\",\n\twhiteSpace: \"nowrap\",\n\tborder: 0,\n\t// Clipped text is still selectable, so a select-all over the transcript would\n\t// otherwise copy the failure copy twice (EXP-1479).\n\tuserSelect: \"none\",\n\tWebkitUserSelect: \"none\",\n});\n\nexport const messageErrorText = style({\n\tmargin: 0,\n\tcolor: \"inherit\",\n\
|
|
1
|
+
{"version":3,"file":"MessageError.css.js","names":[],"sources":["../../../src/components/MessageError/MessageError.css.ts"],"sourcesContent":["import { globalStyle, style } from \"@vanilla-extract/css\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const messageErrorRoot = style({\n\tdisplay: \"flex\",\n});\n\n// Shared layout for the failed-to-send row — icon + destructive-colored caption.\n// Used both interactively (the retry Button) and statically (no `onRetry`).\nexport const messageErrorContent = style({\n\tdisplay: \"inline-flex\",\n\talignItems: \"center\",\n\t// Sized to the error icon, and reserved even in the static variant that carries\n\t// none, so the row does not change height when a retry becomes available.\n\tminHeight: t(\"icon-size-lg\"),\n\tgap: t(\"gap-4\"),\n\tmargin: 0,\n\tcolor: t(\"color-content-destructive\"),\n});\n\n// The interactive retry control layers button affordances over the shared row.\nexport const messageErrorRetry = style([\n\tmessageErrorContent,\n\t{\n\t\tpadding: 0,\n\t\tborder: \"none\",\n\t\tbackground: \"none\",\n\t\tborderRadius: t(\"border-radius-6\"),\n\t\tcursor: \"pointer\",\n\t\toutline: \"none\",\n\t\tselectors: {\n\t\t\t\"&[data-focus-visible]\": {\n\t\t\t\tboxShadow: `0 0 0 ${t(\"border-width-focus\")} ${t(\"color-border-focus\")}`,\n\t\t\t},\n\t\t},\n\t\t\"@media\": {\n\t\t\t\"(forced-colors: active)\": {\n\t\t\t\tselectors: {\n\t\t\t\t\t\"&[data-focus-visible]\": {\n\t\t\t\t\t\toutline: \"2px solid Highlight\",\n\t\t\t\t\t\toutlineOffset: \"2px\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n]);\n\n// Carries the announced failure copy as real text (live regions announce\n// rendered text, not `aria-label`), while staying out of the visual layout.\nexport const messageErrorAnnouncement = style({\n\tposition: \"absolute\",\n\twidth: 1,\n\theight: 1,\n\tpadding: 0,\n\tmargin: -1,\n\toverflow: \"hidden\",\n\tclip: \"rect(0, 0, 0, 0)\",\n\twhiteSpace: \"nowrap\",\n\tborder: 0,\n\t// Clipped text is still selectable, so a select-all over the transcript would\n\t// otherwise copy the failure copy twice (EXP-1479).\n\tuserSelect: \"none\",\n\tWebkitUserSelect: \"none\",\n});\n\nexport const messageErrorText = style({\n\tmargin: 0,\n\tcolor: \"inherit\",\n\t...typography(\"caption\", \"regular\"),\n});\n\n// The exclamation.sync glyph renders at icon-size-lg (24px, Figma), driving\n// `<Icon>`'s 1em box — the same value that sets the row's reserved min-height.\nglobalStyle(`${messageErrorContent} [data-slot='icon']`, {\n\tfontSize: t(\"icon-size-lg\"),\n});\n"],"mappings":""}
|