sculpted 0.3.4 → 0.3.5

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/ui.mjs CHANGED
@@ -707,6 +707,21 @@ const createLucideIcon = (iconName, iconNode) => {
707
707
  return Component;
708
708
  };
709
709
  //#endregion
710
+ //#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/arrow-down.mjs
711
+ /**
712
+ * @license lucide-preact v1.16.0 - ISC
713
+ *
714
+ * This source code is licensed under the ISC license.
715
+ * See the LICENSE file in the root directory of this source tree.
716
+ */
717
+ const ArrowDown = createLucideIcon("arrow-down", [["path", {
718
+ d: "M12 5v14",
719
+ key: "s699le"
720
+ }], ["path", {
721
+ d: "m19 12-7 7-7-7",
722
+ key: "1idqje"
723
+ }]]);
724
+ //#endregion
710
725
  //#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/arrow-left.mjs
711
726
  /**
712
727
  * @license lucide-preact v1.16.0 - ISC
@@ -722,6 +737,21 @@ const ArrowLeft = createLucideIcon("arrow-left", [["path", {
722
737
  key: "x3x0zl"
723
738
  }]]);
724
739
  //#endregion
740
+ //#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/arrow-up.mjs
741
+ /**
742
+ * @license lucide-preact v1.16.0 - ISC
743
+ *
744
+ * This source code is licensed under the ISC license.
745
+ * See the LICENSE file in the root directory of this source tree.
746
+ */
747
+ const ArrowUp = createLucideIcon("arrow-up", [["path", {
748
+ d: "m5 12 7-7 7 7",
749
+ key: "hav0vg"
750
+ }], ["path", {
751
+ d: "M12 19V5",
752
+ key: "x0mq9r"
753
+ }]]);
754
+ //#endregion
725
755
  //#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/brush-cleaning.mjs
726
756
  /**
727
757
  * @license lucide-preact v1.16.0 - ISC
@@ -1028,6 +1058,50 @@ const Settings = createLucideIcon("settings", [["path", {
1028
1058
  key: "1v7zrd"
1029
1059
  }]]);
1030
1060
  //#endregion
1061
+ //#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/square-arrow-right-enter.mjs
1062
+ /**
1063
+ * @license lucide-preact v1.16.0 - ISC
1064
+ *
1065
+ * This source code is licensed under the ISC license.
1066
+ * See the LICENSE file in the root directory of this source tree.
1067
+ */
1068
+ const SquareArrowRightEnter = createLucideIcon("square-arrow-right-enter", [
1069
+ ["path", {
1070
+ d: "m10 16 4-4-4-4",
1071
+ key: "w9835o"
1072
+ }],
1073
+ ["path", {
1074
+ d: "M3 12h11",
1075
+ key: "pmja8f"
1076
+ }],
1077
+ ["path", {
1078
+ d: "M3 8V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",
1079
+ key: "1bqs5q"
1080
+ }]
1081
+ ]);
1082
+ //#endregion
1083
+ //#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/square-arrow-right-exit.mjs
1084
+ /**
1085
+ * @license lucide-preact v1.16.0 - ISC
1086
+ *
1087
+ * This source code is licensed under the ISC license.
1088
+ * See the LICENSE file in the root directory of this source tree.
1089
+ */
1090
+ const SquareArrowRightExit = createLucideIcon("square-arrow-right-exit", [
1091
+ ["path", {
1092
+ d: "M10 12h11",
1093
+ key: "6m4ad9"
1094
+ }],
1095
+ ["path", {
1096
+ d: "m17 16 4-4-4-4",
1097
+ key: "iin4zf"
1098
+ }],
1099
+ ["path", {
1100
+ d: "M21 6.344V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-1.344",
1101
+ key: "1ojbhp"
1102
+ }]
1103
+ ]);
1104
+ //#endregion
1031
1105
  //#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/square-dashed-mouse-pointer.mjs
1032
1106
  /**
1033
1107
  * @license lucide-preact v1.16.0 - ISC
@@ -4222,18 +4296,78 @@ function resolveThreshold(threshold) {
4222
4296
  return threshold;
4223
4297
  }
4224
4298
  //#endregion
4299
+ //#region src/ui/inputs/pandaTokenReference.ts
4300
+ const TOKEN_PATH_PATTERN = "[A-Za-z_][\\w-]*(?:\\.[A-Za-z0-9_][\\w-]*)*";
4301
+ const TOKEN_REFERENCE_PATTERN = new RegExp(`^token\\(\\s*(${TOKEN_PATH_PATTERN})\\s*\\)$`);
4302
+ const COLOR_TOKEN_VALUE_PATTERN = new RegExp(`^(${TOKEN_PATH_PATTERN})(?:/([0-9]{1,3}))?$`);
4303
+ const COLOR_TOKEN_REFERENCE_PATTERN = new RegExp(`^token\\(\\s*(colors\\.(${TOKEN_PATH_PATTERN})(?:/([0-9]{1,3}))?)\\s*\\)$`);
4304
+ function pandaTokenPathFromValue(value, category) {
4305
+ const match = value.trim().match(TOKEN_REFERENCE_PATTERN);
4306
+ if (!match) return void 0;
4307
+ const path = match[1];
4308
+ const prefix = `${category}.`;
4309
+ return path?.startsWith(prefix) ? path.slice(prefix.length) : void 0;
4310
+ }
4311
+ function tokenPathFromValueOrTokenReference(value, category) {
4312
+ if (category === "colors") {
4313
+ const colorValue = pandaColorTokenValueFromString(value);
4314
+ if (colorValue) return colorValue.tokenPath;
4315
+ }
4316
+ return pandaTokenPathFromValue(value, category) ?? value;
4317
+ }
4318
+ function tokenValueForCurrentSyntax(currentValue, category, tokenPath) {
4319
+ return pandaTokenPathFromValue(currentValue, category) === void 0 ? tokenPath : `token(${category}.${tokenPath})`;
4320
+ }
4321
+ function pandaColorTokenValueFromString(value) {
4322
+ const trimmed = value.trim();
4323
+ const wrappedMatch = trimmed.match(COLOR_TOKEN_REFERENCE_PATTERN);
4324
+ if (wrappedMatch) {
4325
+ const tokenPath = wrappedMatch[2];
4326
+ const opacity = normalizedColorTokenOpacity(wrappedMatch[3]);
4327
+ return tokenPath && opacity ? {
4328
+ tokenPath,
4329
+ opacity,
4330
+ wrapped: true
4331
+ } : void 0;
4332
+ }
4333
+ const unwrappedMatch = trimmed.match(COLOR_TOKEN_VALUE_PATTERN);
4334
+ if (!unwrappedMatch) return void 0;
4335
+ const tokenPath = unwrappedMatch[1];
4336
+ const opacity = normalizedColorTokenOpacity(unwrappedMatch[2]);
4337
+ return tokenPath && opacity ? {
4338
+ tokenPath,
4339
+ opacity,
4340
+ wrapped: false
4341
+ } : void 0;
4342
+ }
4343
+ function colorTokenValueForCurrentSyntax(currentValue, tokenPath, opacity) {
4344
+ const current = pandaColorTokenValueFromString(currentValue);
4345
+ const nextOpacity = normalizedColorTokenOpacity(opacity ?? current?.opacity) ?? "100";
4346
+ const suffix = nextOpacity === "100" ? "" : `/${nextOpacity}`;
4347
+ return current?.wrapped ? `token(colors.${tokenPath}${suffix})` : `${tokenPath}${suffix}`;
4348
+ }
4349
+ function normalizedColorTokenOpacity(opacity) {
4350
+ if (opacity === void 0 || opacity === "") return "100";
4351
+ if (!/^\d{1,3}$/.test(opacity)) return void 0;
4352
+ const number = Number(opacity);
4353
+ if (!Number.isInteger(number) || number < 0 || number > 100) return void 0;
4354
+ return String(number);
4355
+ }
4356
+ //#endregion
4225
4357
  //#region src/ui/previewModel.ts
4226
4358
  const PREVIEW_STYLE_CONDITIONS = [
4227
4359
  "hover",
4228
4360
  "focus",
4229
4361
  "focus-visible",
4230
- "active"
4362
+ "active",
4363
+ "disabled"
4231
4364
  ];
4232
4365
  const PANDA_CONDITION_BY_PATH_SEGMENT = {
4233
4366
  _hover: "hover",
4234
4367
  _focus: "focus",
4235
4368
  _focusVisible: "focus-visible",
4236
- _active: "active"
4369
+ _active: "active",
4370
+ _disabled: "disabled"
4237
4371
  };
4238
4372
  function previewDeclarationsForPandaInput(path, inputValue) {
4239
4373
  const previewPath = pandaPreviewPath(path);
@@ -4453,8 +4587,18 @@ function pandaPreviewValue(kind, inputValue) {
4453
4587
  if (/^(var|calc|min|max|clamp)\(/.test(value) || /^(#|rgb\(|hsl\()/.test(value)) return value;
4454
4588
  if (/^-?\d*\.?\d+(px|rem|em|%|vh|vw|svh|svw|dvh|dvw|ch|lh)$/.test(value)) return value;
4455
4589
  if (kind === "color" && /^[a-zA-Z][\w.-]*$/.test(value)) return `var(--colors-${tokenPathToCssVariableSuffix(value)})`;
4590
+ const colorTokenValue = kind === "color" ? pandaColorTokenValueFromString(value) : void 0;
4591
+ if (colorTokenValue) return pandaColorTokenPreviewValue(colorTokenValue.tokenPath, colorTokenValue.opacity);
4456
4592
  if (kind === "spacing" && /^[\w.-]+$/.test(value)) return `var(--spacing-${tokenPathToCssVariableSuffix(value)})`;
4457
- return value.replace(/\btoken\(\s*(colors\.[A-Za-z_][\w-]*(?:\.[A-Za-z0-9_][\w-]*)*)\s*\)/g, (_match, tokenPath) => `var(--${tokenPathToCssVariableSuffix(tokenPath)})`);
4593
+ return value.replace(/\btoken\(\s*colors\.([A-Za-z_][\w-]*(?:\.[A-Za-z0-9_][\w-]*)*(?:\/[0-9]{1,3})?)\s*\)/g, (match, colorTokenPath) => {
4594
+ const colorTokenValue = pandaColorTokenValueFromString(colorTokenPath);
4595
+ if (!colorTokenValue) return match;
4596
+ return pandaColorTokenPreviewValue(colorTokenValue.tokenPath, colorTokenValue.opacity);
4597
+ });
4598
+ }
4599
+ function pandaColorTokenPreviewValue(tokenPath, opacity) {
4600
+ const variable = `var(--colors-${tokenPathToCssVariableSuffix(tokenPath)})`;
4601
+ return opacity === "100" ? variable : `color-mix(in srgb, ${variable} ${opacity}%, transparent)`;
4458
4602
  }
4459
4603
  function tokenPathToCssVariableSuffix(value) {
4460
4604
  return value.replace(/\./g, "-");
@@ -4589,90 +4733,530 @@ function ShadowMenuItem(props) {
4589
4733
  });
4590
4734
  }
4591
4735
  //#endregion
4592
- //#region src/ui/inputs/pandaTokenReference.ts
4593
- function pandaTokenPathFromValue(value, category) {
4594
- const match = value.trim().match(/^token\(\s*([A-Za-z_][\w-]*(?:\.[A-Za-z0-9_][\w-]*)*)\s*\)$/);
4595
- if (!match) return void 0;
4596
- const path = match[1];
4597
- const prefix = `${category}.`;
4598
- return path?.startsWith(prefix) ? path.slice(prefix.length) : void 0;
4599
- }
4600
- function tokenPathFromValueOrTokenReference(value, category) {
4601
- return pandaTokenPathFromValue(value, category) ?? value;
4602
- }
4603
- function tokenValueForCurrentSyntax(currentValue, category, tokenPath) {
4604
- return pandaTokenPathFromValue(currentValue, category) === void 0 ? tokenPath : `token(${category}.${tokenPath})`;
4605
- }
4606
- //#endregion
4607
- //#region src/ui/inputs/colorTokenInput.tsx
4608
- const COLOR_TOKEN_PROPERTIES = new Set([
4609
- "color",
4610
- "backgroundColor",
4611
- "bg",
4612
- "borderColor",
4613
- "outlineColor"
4736
+ //#region src/ui/inputs/rawValueInput.tsx
4737
+ const NUMERIC_INPUT_PATTERN = /^(?<number>[+-]?(?:\d+(?:\.\d+)?|\.\d+))(?<unit>px|rem|em|%|vh|vw|svh|svw|dvh|dvw|ch|lh|deg)?$/;
4738
+ const NON_NEGATIVE_NUMERIC_PROPERTIES = new Set([
4739
+ "p",
4740
+ "padding",
4741
+ "paddingBlock",
4742
+ "paddingBlockEnd",
4743
+ "paddingBlockStart",
4744
+ "paddingBottom",
4745
+ "paddingInline",
4746
+ "paddingInlineEnd",
4747
+ "paddingInlineStart",
4748
+ "paddingLeft",
4749
+ "paddingRight",
4750
+ "paddingTop",
4751
+ "paddingX",
4752
+ "paddingY",
4753
+ "padding-block",
4754
+ "padding-block-end",
4755
+ "padding-block-start",
4756
+ "padding-bottom",
4757
+ "padding-inline",
4758
+ "padding-inline-end",
4759
+ "padding-inline-start",
4760
+ "padding-left",
4761
+ "padding-right",
4762
+ "padding-top",
4763
+ "pb",
4764
+ "pl",
4765
+ "pr",
4766
+ "pt",
4767
+ "px",
4768
+ "py",
4769
+ "gap",
4770
+ "rowGap",
4771
+ "columnGap",
4772
+ "row-gap",
4773
+ "column-gap",
4774
+ "width",
4775
+ "w",
4776
+ "height",
4777
+ "h",
4778
+ "minWidth",
4779
+ "minW",
4780
+ "min-width",
4781
+ "maxWidth",
4782
+ "maxW",
4783
+ "max-width",
4784
+ "minHeight",
4785
+ "minH",
4786
+ "min-height",
4787
+ "maxHeight",
4788
+ "maxH",
4789
+ "max-height",
4790
+ "flexBasis",
4791
+ "flex-basis",
4792
+ "fontSize",
4793
+ "font-size",
4794
+ "lineHeight",
4795
+ "line-height",
4796
+ "aspectRatio",
4797
+ "aspect-ratio",
4798
+ "borderWidth",
4799
+ "borderTopWidth",
4800
+ "borderRightWidth",
4801
+ "borderBottomWidth",
4802
+ "borderLeftWidth",
4803
+ "outlineWidth",
4804
+ "boxShadowBlur",
4805
+ "boxShadowSpread",
4806
+ "border-width",
4807
+ "border-top-width",
4808
+ "border-right-width",
4809
+ "border-bottom-width",
4810
+ "border-left-width",
4811
+ "outline-width",
4812
+ "borderRadius",
4813
+ "borderTopRadius",
4814
+ "borderRightRadius",
4815
+ "borderBottomRadius",
4816
+ "borderLeftRadius",
4817
+ "border-radius",
4818
+ "border-top-radius",
4819
+ "border-right-radius",
4820
+ "border-bottom-radius",
4821
+ "border-left-radius",
4822
+ "rounded",
4823
+ "roundedTop",
4824
+ "roundedRight",
4825
+ "roundedBottom",
4826
+ "roundedLeft",
4827
+ "colorTokenOpacity"
4614
4828
  ]);
4615
- function colorTokenSelectorOptions(metadata) {
4616
- if (!metadata) return [];
4617
- return [...metadata.semanticColorTokens.items.map(colorTokenSelectorOption), ...metadata.colorTokens.items.map(colorTokenSelectorOption)];
4618
- }
4619
- function shouldUseColorTokenSelector(path, value, options) {
4620
- const property = pandaPreviewRootProperty(path);
4621
- if (!property || !COLOR_TOKEN_PROPERTIES.has(property)) return false;
4622
- const tokenPath = tokenPathFromValueOrTokenReference(value, "colors");
4623
- return options.some((option) => option.tokenPath === tokenPath);
4624
- }
4625
- function colorTokenSelectorOption(token) {
4626
- const value = jsonPrimitiveText$1(token.value);
4627
- const swatch = (token.kind === "semantic-token" ? token.cssVariable : void 0) ?? token.swatch ?? token.conditions?.find((condition) => condition.swatch)?.swatch ?? token.conditions?.map((condition) => jsonPrimitiveText$1(condition.value)).find((conditionValue) => conditionValue?.startsWith("#"));
4628
- const detail = token.conditions?.map((condition) => {
4629
- const conditionValue = jsonPrimitiveText$1(condition.value);
4630
- return conditionValue ? `${condition.condition}: ${conditionValue}` : void 0;
4631
- }).filter((item) => item !== void 0).join(" · ") || value || token.cssVariable || token.kind;
4632
- const kindLabel = token.kind === "token" ? "Color token" : "Semantic color";
4633
- const groupLabel = token.kind === "token" ? "Color tokens" : "Semantic colors";
4634
- return {
4635
- id: `${token.kind}:${token.path}`,
4636
- label: token.label,
4637
- groupLabel,
4638
- presetName: token.presetName,
4639
- detail,
4640
- searchText: [
4641
- token.path,
4642
- token.cssVariable,
4643
- searchableTokenValue(value),
4644
- ...token.conditions?.map((condition) => searchableTokenValue(jsonPrimitiveText$1(condition.value))) ?? [],
4645
- kindLabel,
4646
- token.kind
4647
- ].filter(Boolean).join(" "),
4648
- swatch,
4649
- tokenPath: token.path
4650
- };
4651
- }
4652
- function prepareColorTokenOption(option) {
4653
- return {
4654
- option,
4655
- label: prepare(option.label),
4656
- detail: option.detail ? prepare(option.detail) : void 0,
4657
- searchText: option.searchText ? prepare(option.searchText) : void 0
4829
+ function RawValueInput(props) {
4830
+ const focused = useSignal(false);
4831
+ const input = A$1(null);
4832
+ const showInvalid = props.invalid && !focused.value;
4833
+ const borderColor = showInvalid ? "#fca5a5" : props.changed ? "#93c5fd" : "#d6dde8";
4834
+ const background = showInvalid ? "#fef2f2" : props.changed ? "#eff6ff" : "#fff";
4835
+ const property = props.numericProperty ?? pandaPreviewRootProperty(props.path) ?? "";
4836
+ const numeric = isSteppableNumericInput(property, props.value);
4837
+ const stepValue = (direction, shiftKey = false, altKey = false) => {
4838
+ const nextValue = steppedNumericInputValue({
4839
+ property,
4840
+ value: props.value,
4841
+ direction,
4842
+ shiftKey,
4843
+ altKey
4844
+ });
4845
+ if (!nextValue) return;
4846
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, nextValue, "input");
4658
4847
  };
4659
- }
4660
- function filteredColorTokenOptions(query, preparedOptions) {
4661
- const queryText = query.trim();
4662
- if (!queryText) return preparedOptions.map((preparedOption) => preparedOption.option);
4663
- return searchFields(queryText, preparedOptions, queryText.startsWith("#") ? [
4664
- {
4665
- key: "label",
4666
- extract: (item) => item.label
4667
- },
4668
- {
4669
- key: "detail",
4670
- extract: (item) => item.detail
4671
- },
4672
- {
4673
- key: "searchText",
4674
- extract: (item) => item.searchText
4675
- }
4848
+ _$2(() => {
4849
+ if (props.saving.value) return;
4850
+ const request = props.autoFocus.value;
4851
+ if (!request || request.targetId !== props.targetId || request.pathLabel !== props.pathLabel) return;
4852
+ const timer = setTimeout(() => {
4853
+ input.current?.focus();
4854
+ input.current?.select();
4855
+ props.onAutoFocusHandled();
4856
+ }, 0);
4857
+ return () => {
4858
+ clearTimeout(timer);
4859
+ };
4860
+ }, [props.autoFocus.value, props.saving.value]);
4861
+ return /* @__PURE__ */ u("div", {
4862
+ style: {
4863
+ position: "relative",
4864
+ minWidth: 0
4865
+ },
4866
+ children: [/* @__PURE__ */ u("input", {
4867
+ ref: (element) => {
4868
+ input.current = element;
4869
+ if (typeof props.inputRef === "function") props.inputRef(element);
4870
+ else if (props.inputRef) props.inputRef.current = element;
4871
+ },
4872
+ "data-preview-target-id": props.targetId,
4873
+ "data-preview-path": props.pathLabel,
4874
+ "data-preview-shorthand-part": props.shorthandPart,
4875
+ "data-preview-changed": props.changed ? "true" : "false",
4876
+ "data-preview-invalid": showInvalid ? "true" : "false",
4877
+ "data-preview-original-value": props.originalValue,
4878
+ disabled: props.saving.value,
4879
+ value: props.value,
4880
+ onFocus: () => {
4881
+ focused.value = true;
4882
+ props.onFocus?.();
4883
+ },
4884
+ onBlur: () => {
4885
+ focused.value = false;
4886
+ props.onBlur?.();
4887
+ },
4888
+ onInput: (event) => {
4889
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, event.currentTarget.value, "input");
4890
+ },
4891
+ onKeyDown: (event) => {
4892
+ if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
4893
+ event.preventDefault();
4894
+ props.onModBackspace();
4895
+ return;
4896
+ }
4897
+ if ((event.metaKey || event.ctrlKey) && event.key === "ArrowRight" && props.onArrowRight) {
4898
+ event.preventDefault();
4899
+ props.onArrowRight();
4900
+ return;
4901
+ }
4902
+ if ((event.metaKey || event.ctrlKey) && event.key === "ArrowLeft" && props.onArrowLeft) {
4903
+ event.preventDefault();
4904
+ props.onArrowLeft();
4905
+ return;
4906
+ }
4907
+ if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
4908
+ const nextValue = steppedNumericInputValue({
4909
+ property,
4910
+ value: event.currentTarget.value,
4911
+ direction: event.key === "ArrowUp" ? 1 : -1,
4912
+ shiftKey: event.shiftKey,
4913
+ altKey: event.altKey
4914
+ });
4915
+ if (!nextValue) return;
4916
+ event.preventDefault();
4917
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, nextValue, "input");
4918
+ },
4919
+ style: {
4920
+ minWidth: 0,
4921
+ width: "100%",
4922
+ boxSizing: "border-box",
4923
+ border: `1px solid ${borderColor}`,
4924
+ borderRadius: "6px",
4925
+ minHeight: numeric ? "30px" : void 0,
4926
+ padding: numeric ? "4px 32px 4px 6px" : "4px 6px",
4927
+ font: "inherit",
4928
+ color: "#172033",
4929
+ background
4930
+ }
4931
+ }), numeric ? /* @__PURE__ */ u("div", {
4932
+ "data-numeric-stepper": "true",
4933
+ style: {
4934
+ position: "absolute",
4935
+ top: "2px",
4936
+ right: "2px",
4937
+ bottom: "2px",
4938
+ width: "24px",
4939
+ display: "grid",
4940
+ gridTemplateRows: "1fr 1fr"
4941
+ },
4942
+ children: [/* @__PURE__ */ u(NumericStepperButton, {
4943
+ action: "increment",
4944
+ disabled: props.saving.value,
4945
+ direction: "up",
4946
+ label: `Increment ${props.pathLabel}`,
4947
+ onStep: (shiftKey, altKey) => {
4948
+ stepValue(1, shiftKey, altKey);
4949
+ },
4950
+ onKeepFocus: () => {
4951
+ input.current?.focus();
4952
+ }
4953
+ }), /* @__PURE__ */ u(NumericStepperButton, {
4954
+ action: "decrement",
4955
+ disabled: props.saving.value,
4956
+ direction: "down",
4957
+ label: `Decrement ${props.pathLabel}`,
4958
+ onStep: (shiftKey, altKey) => {
4959
+ stepValue(-1, shiftKey, altKey);
4960
+ },
4961
+ onKeepFocus: () => {
4962
+ input.current?.focus();
4963
+ }
4964
+ })]
4965
+ }) : null]
4966
+ });
4967
+ }
4968
+ function SteppableNumericInput(props) {
4969
+ const input = A$1(null);
4970
+ const numeric = isSteppableNumericInput(props.property, props.value);
4971
+ const stepValue = (direction, shiftKey = false, altKey = false) => {
4972
+ const nextValue = steppedNumericInputValue({
4973
+ property: props.property,
4974
+ value: props.value,
4975
+ direction,
4976
+ shiftKey,
4977
+ altKey
4978
+ });
4979
+ if (!nextValue) return;
4980
+ props.onInput(nextValue);
4981
+ };
4982
+ return /* @__PURE__ */ u("div", {
4983
+ style: {
4984
+ position: "relative",
4985
+ minWidth: 0
4986
+ },
4987
+ children: [/* @__PURE__ */ u("input", {
4988
+ ref: input,
4989
+ ...props.dataAttributes,
4990
+ disabled: props.disabled,
4991
+ value: props.value,
4992
+ onInput: (event) => {
4993
+ props.onInput(event.currentTarget.value);
4994
+ },
4995
+ onKeyDown: (event) => {
4996
+ if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
4997
+ const nextValue = steppedNumericInputValue({
4998
+ property: props.property,
4999
+ value: event.currentTarget.value,
5000
+ direction: event.key === "ArrowUp" ? 1 : -1,
5001
+ shiftKey: event.shiftKey,
5002
+ altKey: event.altKey
5003
+ });
5004
+ if (!nextValue) return;
5005
+ event.preventDefault();
5006
+ props.onInput(nextValue);
5007
+ },
5008
+ style: {
5009
+ minWidth: 0,
5010
+ width: "100%",
5011
+ boxSizing: "border-box",
5012
+ border: "1px solid #d6dde8",
5013
+ borderRadius: "6px",
5014
+ minHeight: numeric ? "30px" : void 0,
5015
+ padding: numeric ? "4px 32px 4px 6px" : "4px 6px",
5016
+ font: "inherit",
5017
+ color: "#172033",
5018
+ background: "#fff"
5019
+ }
5020
+ }), numeric ? /* @__PURE__ */ u("div", {
5021
+ "data-numeric-stepper": "true",
5022
+ style: {
5023
+ position: "absolute",
5024
+ top: "2px",
5025
+ right: "2px",
5026
+ bottom: "2px",
5027
+ width: "24px",
5028
+ display: "grid",
5029
+ gridTemplateRows: "1fr 1fr"
5030
+ },
5031
+ children: [/* @__PURE__ */ u(NumericStepperButton, {
5032
+ action: "increment",
5033
+ disabled: props.disabled,
5034
+ direction: "up",
5035
+ label: `Increment ${props.label}`,
5036
+ onStep: (shiftKey, altKey) => {
5037
+ stepValue(1, shiftKey, altKey);
5038
+ },
5039
+ onKeepFocus: () => {
5040
+ input.current?.focus();
5041
+ }
5042
+ }), /* @__PURE__ */ u(NumericStepperButton, {
5043
+ action: "decrement",
5044
+ disabled: props.disabled,
5045
+ direction: "down",
5046
+ label: `Decrement ${props.label}`,
5047
+ onStep: (shiftKey, altKey) => {
5048
+ stepValue(-1, shiftKey, altKey);
5049
+ },
5050
+ onKeepFocus: () => {
5051
+ input.current?.focus();
5052
+ }
5053
+ })]
5054
+ }) : null]
5055
+ });
5056
+ }
5057
+ function NumericStepperButton(props) {
5058
+ return /* @__PURE__ */ u("button", {
5059
+ type: "button",
5060
+ "data-action": `numeric-${props.action}`,
5061
+ tabIndex: -1,
5062
+ disabled: props.disabled,
5063
+ "aria-label": props.label,
5064
+ onPointerDown: (event) => {
5065
+ event.preventDefault();
5066
+ props.onKeepFocus();
5067
+ },
5068
+ onClick: (event) => {
5069
+ props.onStep(event.shiftKey, event.altKey);
5070
+ },
5071
+ style: {
5072
+ width: "100%",
5073
+ minWidth: 0,
5074
+ height: "100%",
5075
+ display: "grid",
5076
+ placeItems: "center",
5077
+ boxSizing: "border-box",
5078
+ border: 0,
5079
+ padding: 0,
5080
+ background: "transparent"
5081
+ },
5082
+ children: /* @__PURE__ */ u("span", {
5083
+ style: {
5084
+ width: "100%",
5085
+ alignSelf: "stretch",
5086
+ justifySelf: "stretch",
5087
+ display: "grid",
5088
+ placeItems: "center",
5089
+ borderRadius: "3px",
5090
+ background: "#dbe3ef",
5091
+ marginBottom: props.direction === "up" ? "1px" : 0,
5092
+ marginTop: props.direction === "down" ? "1px" : 0
5093
+ },
5094
+ children: /* @__PURE__ */ u("span", {
5095
+ "aria-hidden": "true",
5096
+ style: {
5097
+ width: 0,
5098
+ height: 0,
5099
+ borderLeft: "3px solid transparent",
5100
+ borderRight: "3px solid transparent",
5101
+ borderBottom: props.direction === "up" ? "4px solid #344054" : void 0,
5102
+ borderTop: props.direction === "down" ? "4px solid #344054" : void 0
5103
+ }
5104
+ })
5105
+ })
5106
+ });
5107
+ }
5108
+ function steppedNumericInputValue(input) {
5109
+ const trimmedValue = input.value.trim();
5110
+ const match = NUMERIC_INPUT_PATTERN.exec(trimmedValue);
5111
+ if (!match?.groups) return void 0;
5112
+ const current = Number(match.groups.number);
5113
+ if (!Number.isFinite(current)) return void 0;
5114
+ const unit = match.groups.unit ?? "";
5115
+ if (input.property === "opacity" && unit) return void 0;
5116
+ const step = numericInputStep(input.property, input.shiftKey === true, input.altKey === true);
5117
+ return `${formatSteppedNumber(input.property === "hue" ? wrappedHueInputValue(current, input.direction, step) : boundedNumericInputValue(input.property, current + input.direction * step), match.groups.number, step)}${unit}`;
5118
+ }
5119
+ function isSteppableNumericInput(property, value) {
5120
+ return steppedNumericInputValue({
5121
+ property,
5122
+ value,
5123
+ direction: 1
5124
+ }) !== void 0;
5125
+ }
5126
+ function numericInputStep(property, shiftKey, altKey) {
5127
+ if (property === "opacity") {
5128
+ if (shiftKey && altKey) return 1e-4;
5129
+ if (shiftKey) return .1;
5130
+ if (altKey) return .001;
5131
+ return .01;
5132
+ }
5133
+ if (property === "lineHeight") {
5134
+ if (shiftKey && altKey) return 1e-4;
5135
+ if (shiftKey) return .1;
5136
+ if (altKey) return .001;
5137
+ return .01;
5138
+ }
5139
+ const step = shiftKey && altKey ? .01 : shiftKey ? 10 : altKey ? .1 : 1;
5140
+ if (property === "fontWeight") return shiftKey && !altKey ? 100 : Math.max(step, 10);
5141
+ return step;
5142
+ }
5143
+ function boundedNumericInputValue(property, value) {
5144
+ if (property === "opacity") return Math.min(1, Math.max(0, value));
5145
+ if (property === "colorTokenOpacity") return Math.min(100, Math.max(0, value));
5146
+ if (NON_NEGATIVE_NUMERIC_PROPERTIES.has(property)) return Math.max(0, value);
5147
+ return value;
5148
+ }
5149
+ function wrappedHueInputValue(current, direction, step) {
5150
+ if (current === 360 && direction === 1) return 0;
5151
+ if (current === 0 && direction === -1) return 360;
5152
+ const next = current + direction * step;
5153
+ if (next > 360) return next - 360;
5154
+ if (next < 0) return next + 360;
5155
+ return next;
5156
+ }
5157
+ function formatSteppedNumber(value, originalNumber, step) {
5158
+ const precision = Math.max(decimalPlaces(originalNumber), decimalPlaces(String(step)));
5159
+ const fixed = value.toFixed(precision);
5160
+ return fixed.includes(".") ? fixed.replace(/\.?0+$/, "") : fixed;
5161
+ }
5162
+ function decimalPlaces(value) {
5163
+ return value.includes(".") ? value.split(".")[1]?.length ?? 0 : 0;
5164
+ }
5165
+ //#endregion
5166
+ //#region src/ui/inputs/colorTokenInput.tsx
5167
+ const COLOR_TOKEN_PROPERTIES = new Set([
5168
+ "color",
5169
+ "backgroundColor",
5170
+ "bg",
5171
+ "borderColor",
5172
+ "outlineColor"
5173
+ ]);
5174
+ const CREATE_DIALOG_INPUT_STYLE = {
5175
+ minWidth: 0,
5176
+ width: "100%",
5177
+ boxSizing: "border-box",
5178
+ border: "1px solid #d6dde8",
5179
+ borderRadius: "6px",
5180
+ padding: "4px 6px",
5181
+ font: "inherit",
5182
+ color: "#172033",
5183
+ background: "#fff"
5184
+ };
5185
+ const CREATE_DIALOG_RANGE_STYLE = {
5186
+ minWidth: 0,
5187
+ width: "100%",
5188
+ height: "18px"
5189
+ };
5190
+ function colorTokenSelectorOptions(metadata) {
5191
+ if (!metadata) return [];
5192
+ return [...metadata.semanticColorTokens.items.map(colorTokenSelectorOption), ...metadata.colorTokens.items.map(colorTokenSelectorOption)];
5193
+ }
5194
+ function shouldUseColorTokenSelector(path, value, options) {
5195
+ const property = pandaPreviewRootProperty(path);
5196
+ if (!property || !COLOR_TOKEN_PROPERTIES.has(property)) return false;
5197
+ const tokenPath = tokenPathFromValueOrTokenReference(value, "colors");
5198
+ return options.some((option) => option.tokenPath === tokenPath);
5199
+ }
5200
+ function colorTokenOpacityInputValue(value) {
5201
+ const colorTokenValue = pandaColorTokenValueFromString(value);
5202
+ if (!colorTokenValue) return void 0;
5203
+ return {
5204
+ tokenPath: colorTokenValue.tokenPath,
5205
+ opacity: colorTokenValue.opacity,
5206
+ collapsedEditable: colorTokenValue.opacity === "100"
5207
+ };
5208
+ }
5209
+ function colorTokenSelectorOption(token) {
5210
+ const value = jsonPrimitiveText$1(token.value);
5211
+ const swatch = (token.kind === "semantic-token" ? token.cssVariable : void 0) ?? token.swatch ?? token.conditions?.find((condition) => condition.swatch)?.swatch ?? token.conditions?.map((condition) => jsonPrimitiveText$1(condition.value)).find((conditionValue) => conditionValue?.startsWith("#"));
5212
+ const detail = token.conditions?.map((condition) => {
5213
+ const conditionValue = jsonPrimitiveText$1(condition.value);
5214
+ return conditionValue ? `${condition.condition}: ${conditionValue}` : void 0;
5215
+ }).filter((item) => item !== void 0).join(" · ") || value || token.cssVariable || token.kind;
5216
+ const kindLabel = token.kind === "token" ? "Color token" : "Semantic color";
5217
+ const groupLabel = token.kind === "token" ? "Color tokens" : "Semantic colors";
5218
+ return {
5219
+ id: `${token.kind}:${token.path}`,
5220
+ label: token.label,
5221
+ groupLabel,
5222
+ presetName: token.presetName,
5223
+ detail,
5224
+ searchText: [
5225
+ token.path,
5226
+ token.cssVariable,
5227
+ searchableTokenValue(value),
5228
+ ...token.conditions?.map((condition) => searchableTokenValue(jsonPrimitiveText$1(condition.value))) ?? [],
5229
+ kindLabel,
5230
+ token.kind
5231
+ ].filter(Boolean).join(" "),
5232
+ swatch,
5233
+ tokenPath: token.path
5234
+ };
5235
+ }
5236
+ function prepareColorTokenOption(option) {
5237
+ return {
5238
+ option,
5239
+ label: prepare(option.label),
5240
+ detail: option.detail ? prepare(option.detail) : void 0,
5241
+ searchText: option.searchText ? prepare(option.searchText) : void 0
5242
+ };
5243
+ }
5244
+ function filteredColorTokenOptions(query, preparedOptions) {
5245
+ const queryText = query.trim();
5246
+ if (!queryText) return preparedOptions.map((preparedOption) => preparedOption.option);
5247
+ return searchFields(queryText, preparedOptions, queryText.startsWith("#") ? [
5248
+ {
5249
+ key: "label",
5250
+ extract: (item) => item.label
5251
+ },
5252
+ {
5253
+ key: "detail",
5254
+ extract: (item) => item.detail
5255
+ },
5256
+ {
5257
+ key: "searchText",
5258
+ extract: (item) => item.searchText
5259
+ }
4676
5260
  ] : [{
4677
5261
  key: "label",
4678
5262
  extract: (item) => item.label
@@ -4699,24 +5283,356 @@ function groupedColorTokenOptions(options) {
4699
5283
  options: groupOptions
4700
5284
  });
4701
5285
  }
4702
- return groups;
4703
- }
4704
- function searchableTokenValue(value) {
4705
- return value?.startsWith("#") ? void 0 : value;
4706
- }
4707
- function validHexColor(value) {
4708
- return /^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value.trim());
4709
- }
4710
- function validTokenPath(value) {
4711
- return /^[A-Za-z_][\w-]*(?:\.[A-Za-z0-9_][\w-]*)*$/.test(value.trim());
4712
- }
4713
- function jsonPrimitiveText$1(value) {
4714
- if (value === void 0) return void 0;
4715
- if (typeof value === "string") return value;
4716
- if (typeof value === "number" || typeof value === "boolean" || value === null) return String(value);
4717
- }
4718
- function tokenSourceTargetLabel(source) {
4719
- return `${source.file} - ${source.configPath}`;
5286
+ return groups;
5287
+ }
5288
+ function searchableTokenValue(value) {
5289
+ return value?.startsWith("#") ? void 0 : value;
5290
+ }
5291
+ function validHexColor(value) {
5292
+ return /^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value.trim());
5293
+ }
5294
+ function clampNumber(value, min, max) {
5295
+ if (Number.isNaN(value)) return min;
5296
+ return Math.min(max, Math.max(min, value));
5297
+ }
5298
+ function hexPair(value) {
5299
+ return Math.round(value).toString(16).padStart(2, "0");
5300
+ }
5301
+ function expandHexColor(value) {
5302
+ const hex = value.trim().replace(/^#/, "");
5303
+ if (hex.length === 3 || hex.length === 4) return hex.split("").map((digit) => `${digit}${digit}`).join("");
5304
+ return hex;
5305
+ }
5306
+ function hsvaFromHexColor(value) {
5307
+ const hex = expandHexColor(validHexColor(value) ? value : "#000000");
5308
+ const red = Number.parseInt(hex.slice(0, 2), 16) / 255;
5309
+ const green = Number.parseInt(hex.slice(2, 4), 16) / 255;
5310
+ const blue = Number.parseInt(hex.slice(4, 6), 16) / 255;
5311
+ const alpha = hex.length === 8 ? Number.parseInt(hex.slice(6, 8), 16) / 255 * 100 : 100;
5312
+ const max = Math.max(red, green, blue);
5313
+ const delta = max - Math.min(red, green, blue);
5314
+ let hue = 0;
5315
+ if (delta !== 0) {
5316
+ if (max === red) hue = (green - blue) / delta % 6;
5317
+ else if (max === green) hue = (blue - red) / delta + 2;
5318
+ else hue = (red - green) / delta + 4;
5319
+ hue = hue * 60;
5320
+ if (hue < 0) hue += 360;
5321
+ }
5322
+ return {
5323
+ hue,
5324
+ saturation: max === 0 ? 0 : delta / max * 100,
5325
+ value: max * 100,
5326
+ alpha
5327
+ };
5328
+ }
5329
+ function hexColorFromHsva(color) {
5330
+ const hue = (clampNumber(color.hue, 0, 360) % 360 + 360) % 360;
5331
+ const saturation = clampNumber(color.saturation, 0, 100) / 100;
5332
+ const value = clampNumber(color.value, 0, 100) / 100;
5333
+ const chroma = value * saturation;
5334
+ const hueSegment = hue / 60;
5335
+ const x = chroma * (1 - Math.abs(hueSegment % 2 - 1));
5336
+ const match = value - chroma;
5337
+ let red = 0;
5338
+ let green = 0;
5339
+ let blue = 0;
5340
+ if (hueSegment < 1) {
5341
+ red = chroma;
5342
+ green = x;
5343
+ } else if (hueSegment < 2) {
5344
+ red = x;
5345
+ green = chroma;
5346
+ } else if (hueSegment < 3) {
5347
+ green = chroma;
5348
+ blue = x;
5349
+ } else if (hueSegment < 4) {
5350
+ green = x;
5351
+ blue = chroma;
5352
+ } else if (hueSegment < 5) {
5353
+ red = x;
5354
+ blue = chroma;
5355
+ } else {
5356
+ red = chroma;
5357
+ blue = x;
5358
+ }
5359
+ const alpha = clampNumber(color.alpha, 0, 100);
5360
+ const hex = `#${hexPair((red + match) * 255)}${hexPair((green + match) * 255)}${hexPair((blue + match) * 255)}`;
5361
+ return alpha >= 100 ? hex : `${hex}${hexPair(alpha / 100 * 255)}`;
5362
+ }
5363
+ function opaqueHexColorFromHsva(color) {
5364
+ return hexColorFromHsva({
5365
+ ...color,
5366
+ alpha: 100
5367
+ });
5368
+ }
5369
+ function validTokenPath(value) {
5370
+ return /^[A-Za-z_][\w-]*(?:\.[A-Za-z0-9_][\w-]*)*$/.test(value.trim());
5371
+ }
5372
+ function jsonPrimitiveText$1(value) {
5373
+ if (value === void 0) return void 0;
5374
+ if (typeof value === "string") return value;
5375
+ if (typeof value === "number" || typeof value === "boolean" || value === null) return String(value);
5376
+ }
5377
+ function tokenSourceTargetLabel(source) {
5378
+ return `${source.file} - ${source.configPath}`;
5379
+ }
5380
+ function ColorComponentSlider(props) {
5381
+ const track = A$1(null);
5382
+ const valuePercent = props.max === props.min ? 0 : (props.value - props.min) / (props.max - props.min) * 100;
5383
+ const updateFromClientX = (clientX) => {
5384
+ const rect = track.current?.getBoundingClientRect();
5385
+ if (!rect) return;
5386
+ const width = rect.width || 1;
5387
+ const ratio = clampNumber((clientX - rect.left) / width, 0, 1);
5388
+ props.onInput(String(Math.round(props.min + ratio * (props.max - props.min))));
5389
+ };
5390
+ const stepBy = (direction, amount) => {
5391
+ props.onInput(String(Math.round(clampNumber(props.value + direction * amount, props.min, props.max))));
5392
+ };
5393
+ return /* @__PURE__ */ u("div", {
5394
+ ref: track,
5395
+ role: "slider",
5396
+ tabIndex: props.disabled ? -1 : 0,
5397
+ "aria-label": props.label,
5398
+ "aria-valuemin": props.min,
5399
+ "aria-valuemax": props.max,
5400
+ "aria-valuenow": Math.round(props.value),
5401
+ "aria-disabled": props.disabled ? "true" : "false",
5402
+ [props.dataAttribute]: "true",
5403
+ onPointerDown: (event) => {
5404
+ if (props.disabled) return;
5405
+ event.preventDefault();
5406
+ track.current?.focus();
5407
+ updateFromClientX(event.clientX);
5408
+ const move = (moveEvent) => {
5409
+ updateFromClientX(moveEvent.clientX);
5410
+ };
5411
+ const up = () => {
5412
+ window.removeEventListener("pointermove", move);
5413
+ window.removeEventListener("pointerup", up);
5414
+ };
5415
+ window.addEventListener("pointermove", move);
5416
+ window.addEventListener("pointerup", up);
5417
+ },
5418
+ onKeyDown: (event) => {
5419
+ if (props.disabled) return;
5420
+ if (event.key === "Home") {
5421
+ event.preventDefault();
5422
+ props.onInput(String(props.min));
5423
+ return;
5424
+ }
5425
+ if (event.key === "End") {
5426
+ event.preventDefault();
5427
+ props.onInput(String(props.max));
5428
+ return;
5429
+ }
5430
+ if (event.key === "ArrowRight" || event.key === "ArrowUp") {
5431
+ event.preventDefault();
5432
+ stepBy(1, event.shiftKey ? 10 : 1);
5433
+ return;
5434
+ }
5435
+ if (event.key === "ArrowLeft" || event.key === "ArrowDown") {
5436
+ event.preventDefault();
5437
+ stepBy(-1, event.shiftKey ? 10 : 1);
5438
+ }
5439
+ },
5440
+ style: {
5441
+ ...CREATE_DIALOG_RANGE_STYLE,
5442
+ position: "relative",
5443
+ borderRadius: "999px",
5444
+ background: props.background,
5445
+ backgroundPosition: props.backgroundPosition,
5446
+ backgroundSize: props.backgroundSize,
5447
+ boxShadow: "inset 0 0 0 1px rgba(15, 23, 42, 0.14)",
5448
+ cursor: props.disabled ? "not-allowed" : "pointer",
5449
+ opacity: props.disabled ? .62 : 1
5450
+ },
5451
+ children: /* @__PURE__ */ u("span", {
5452
+ "aria-hidden": "true",
5453
+ style: {
5454
+ position: "absolute",
5455
+ top: "50%",
5456
+ left: `${clampNumber(valuePercent, 0, 100)}%`,
5457
+ width: "14px",
5458
+ height: "14px",
5459
+ border: "2px solid #fff",
5460
+ borderRadius: "999px",
5461
+ background: "#172033",
5462
+ boxShadow: "0 1px 4px rgba(15, 23, 42, 0.28)",
5463
+ transform: "translate(-50%, -50%)",
5464
+ pointerEvents: "none"
5465
+ }
5466
+ })
5467
+ });
5468
+ }
5469
+ function ColorTokenOpacityInput(props) {
5470
+ const expandedRoot = A$1(null);
5471
+ const variant = props.variant ?? "full";
5472
+ const noAutoOpen = useSignal(null);
5473
+ const colorTokenValue = pandaColorTokenValueFromString(props.value);
5474
+ if (!colorTokenValue) return null;
5475
+ const colorOnlyValue = colorTokenValue.wrapped ? `token(colors.${colorTokenValue.tokenPath})` : colorTokenValue.tokenPath;
5476
+ const showInvalid = props.invalid;
5477
+ const borderColor = showInvalid ? "#fca5a5" : props.changed ? "#93c5fd" : "#d6dde8";
5478
+ const background = showInvalid ? "#fef2f2" : props.changed ? "#eff6ff" : "#fff";
5479
+ const collapsedStyle = {
5480
+ minWidth: 0,
5481
+ width: props.inputWidth,
5482
+ boxSizing: "border-box",
5483
+ border: `1px solid ${borderColor}`,
5484
+ borderRadius: "6px",
5485
+ padding: "4px 6px",
5486
+ textAlign: "left",
5487
+ font: "inherit",
5488
+ color: "#172033",
5489
+ background
5490
+ };
5491
+ const updateToken = (tokenValue, mode) => {
5492
+ const nextToken = pandaColorTokenValueFromString(tokenValue);
5493
+ if (!nextToken) return;
5494
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, colorTokenValueForCurrentSyntax(props.value, nextToken.tokenPath, colorTokenValue.opacity), mode);
5495
+ };
5496
+ const updateOpacity = (opacity) => {
5497
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, colorTokenValueForCurrentSyntax(props.value, colorTokenValue.tokenPath, opacity), "input");
5498
+ };
5499
+ _$2(() => {
5500
+ if (!props.expanded || variant !== "expanded-parts") return;
5501
+ (expandedRoot.current?.querySelector("button:not(:disabled), input:not(:disabled)"))?.focus();
5502
+ }, []);
5503
+ if (!props.expanded || variant === "placeholder") {
5504
+ if (colorTokenValue.opacity === "100" && variant !== "placeholder") return /* @__PURE__ */ u(ColorTokenValueInput, {
5505
+ targetId: props.targetId,
5506
+ path: props.path,
5507
+ pathLabel: props.pathLabel,
5508
+ originalValue: props.originalValue,
5509
+ value: props.value,
5510
+ changed: props.changed,
5511
+ invalid: props.invalid,
5512
+ autoOpen: props.autoOpen,
5513
+ options: props.options,
5514
+ tokenSources: props.tokenSources,
5515
+ saving: props.saving,
5516
+ onAutoOpenHandled: props.onAutoOpenHandled,
5517
+ onPreviewInput: props.onPreviewInput,
5518
+ onModBackspace: props.onModBackspace,
5519
+ onCreateToken: props.onCreateToken,
5520
+ onMenuOpenChange: props.onMenuOpenChange,
5521
+ onArrowRight: props.onExpand
5522
+ });
5523
+ return /* @__PURE__ */ u("button", {
5524
+ type: "button",
5525
+ "data-color-token-opacity-collapsed": "true",
5526
+ "data-preview-target-id": props.targetId,
5527
+ "data-preview-path": props.pathLabel,
5528
+ "data-preview-changed": props.changed ? "true" : "false",
5529
+ "data-preview-invalid": showInvalid ? "true" : "false",
5530
+ "data-preview-original-value": props.originalValue,
5531
+ tabIndex: variant === "placeholder" ? -1 : void 0,
5532
+ disabled: props.saving.value,
5533
+ "aria-hidden": variant === "placeholder" ? "true" : void 0,
5534
+ onClick: props.onExpand,
5535
+ onKeyDown: (event) => {
5536
+ if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
5537
+ event.preventDefault();
5538
+ props.onModBackspace();
5539
+ return;
5540
+ }
5541
+ if (!event.metaKey && !event.ctrlKey) return;
5542
+ if (event.key !== "ArrowRight") return;
5543
+ event.preventDefault();
5544
+ props.onExpand();
5545
+ },
5546
+ style: variant === "placeholder" ? {
5547
+ ...collapsedStyle,
5548
+ visibility: "hidden",
5549
+ pointerEvents: "none"
5550
+ } : collapsedStyle,
5551
+ children: props.value
5552
+ });
5553
+ }
5554
+ return /* @__PURE__ */ u("div", {
5555
+ ref: expandedRoot,
5556
+ "data-color-token-opacity-expanded": "true",
5557
+ style: {
5558
+ display: "grid",
5559
+ gap: "4px",
5560
+ minWidth: 0,
5561
+ width: `calc(48px + 6px + ${props.inputWidth})`
5562
+ },
5563
+ children: [/* @__PURE__ */ u("label", {
5564
+ style: {
5565
+ minWidth: 0,
5566
+ display: "grid",
5567
+ gridTemplateColumns: `48px ${props.inputWidth}`,
5568
+ alignItems: "center",
5569
+ gap: "6px"
5570
+ },
5571
+ children: [/* @__PURE__ */ u("span", {
5572
+ style: {
5573
+ color: "#667085",
5574
+ fontSize: "11px",
5575
+ fontWeight: 700
5576
+ },
5577
+ children: "Color"
5578
+ }), /* @__PURE__ */ u(ColorTokenValueInput, {
5579
+ targetId: props.targetId,
5580
+ path: props.path,
5581
+ pathLabel: props.pathLabel,
5582
+ originalValue: props.originalValue,
5583
+ value: colorOnlyValue,
5584
+ changed: props.changed,
5585
+ invalid: props.invalid,
5586
+ autoOpen: noAutoOpen,
5587
+ options: props.options,
5588
+ tokenSources: props.tokenSources,
5589
+ saving: props.saving,
5590
+ onAutoOpenHandled: () => {},
5591
+ onPreviewInput: (_editId, _path, _originalValue, value, mode) => {
5592
+ updateToken(value, mode);
5593
+ },
5594
+ onModBackspace: props.onModBackspace,
5595
+ onCreateToken: props.onCreateToken,
5596
+ onMenuOpenChange: props.onMenuOpenChange,
5597
+ onArrowLeft: props.onCollapse
5598
+ })]
5599
+ }), /* @__PURE__ */ u("label", {
5600
+ style: {
5601
+ minWidth: 0,
5602
+ display: "grid",
5603
+ gridTemplateColumns: `48px ${props.inputWidth}`,
5604
+ alignItems: "center",
5605
+ gap: "6px"
5606
+ },
5607
+ children: [/* @__PURE__ */ u("span", {
5608
+ style: {
5609
+ color: "#667085",
5610
+ fontSize: "11px",
5611
+ fontWeight: 700
5612
+ },
5613
+ children: "Opacity"
5614
+ }), /* @__PURE__ */ u("div", {
5615
+ "data-color-token-opacity-control": "true",
5616
+ children: /* @__PURE__ */ u(SteppableNumericInput, {
5617
+ property: "colorTokenOpacity",
5618
+ value: colorTokenValue.opacity,
5619
+ disabled: props.saving.value,
5620
+ label: `${props.pathLabel} opacity`,
5621
+ dataAttributes: {
5622
+ "data-color-token-opacity-input": "true",
5623
+ "data-preview-target-id": props.targetId,
5624
+ "data-preview-path": props.pathLabel,
5625
+ "data-preview-changed": props.changed ? "true" : "false",
5626
+ "data-preview-invalid": showInvalid ? "true" : "false",
5627
+ "data-preview-original-value": props.originalValue
5628
+ },
5629
+ onInput: (nextValue) => {
5630
+ updateOpacity(nextValue);
5631
+ }
5632
+ })
5633
+ })]
5634
+ })]
5635
+ });
4720
5636
  }
4721
5637
  function ColorTokenValueInput(props) {
4722
5638
  const menuOpen = useSignal(false);
@@ -4726,6 +5642,8 @@ function ColorTokenValueInput(props) {
4726
5642
  const createDialogOpen = useSignal(false);
4727
5643
  const createTokenPath = useSignal("");
4728
5644
  const createTokenKind = useSignal("token");
5645
+ const createColor = useSignal(hsvaFromHexColor("#ff0000"));
5646
+ const createColorHex = useSignal("#ff0000");
4729
5647
  const createSourceTargetId = useSignal("");
4730
5648
  const createApplyToInput = useSignal(false);
4731
5649
  const createError = useSignal("");
@@ -4756,9 +5674,11 @@ function ColorTokenValueInput(props) {
4756
5674
  });
4757
5675
  const createOptionVisible = useComputed(() => {
4758
5676
  const value = query.value.trim();
4759
- return value.startsWith("#") && validHexColor(value) && filteredOptions.value.length === 0 && writableTokenSources.value.length > 0;
5677
+ if (writableTokenSources.value.length === 0) return false;
5678
+ if (value.length === 0) return true;
5679
+ return value.startsWith("#") && validHexColor(value) && filteredOptions.value.length === 0;
4760
5680
  });
4761
- const selectableOptionIds = useComputed(() => createOptionVisible.value ? ["create-token"] : filteredOptions.value.filter((option) => option.disabled !== true).map((option) => option.id));
5681
+ const selectableOptionIds = useComputed(() => createOptionVisible.value ? ["create-token", ...filteredOptions.value.filter((option) => option.disabled !== true).map((option) => option.id)] : filteredOptions.value.filter((option) => option.disabled !== true).map((option) => option.id));
4762
5682
  const activeSelectableOptionId = useComputed(() => selectableOptionIds.value.includes(activeOptionId.value ?? "") ? activeOptionId.value : selectableOptionIds.value[0]);
4763
5683
  const showInvalid = props.invalid && !focused.value;
4764
5684
  const borderColor = showInvalid ? "#fca5a5" : props.changed ? "#93c5fd" : "#d6dde8";
@@ -4768,7 +5688,7 @@ function ColorTokenValueInput(props) {
4768
5688
  const selectedOptionId = selectedOption?.id;
4769
5689
  const previewOption = (option) => {
4770
5690
  if (!option.tokenPath || props.saving.value) return;
4771
- props.onPreviewInput(props.targetId, props.path, props.originalValue, tokenValueForCurrentSyntax(props.value, "colors", option.tokenPath), "transient");
5691
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, colorTokenValueForCurrentSyntax(props.value, option.tokenPath), "transient");
4772
5692
  };
4773
5693
  const selectOption = (option) => {
4774
5694
  if (!option.tokenPath || props.saving.value) return;
@@ -4776,13 +5696,16 @@ function ColorTokenValueInput(props) {
4776
5696
  if (baselineValue !== void 0) props.onPreviewInput(props.targetId, props.path, props.originalValue, baselineValue, "transient");
4777
5697
  menuSelectionConfirmed.current = true;
4778
5698
  menuOpen.value = false;
4779
- props.onPreviewInput(props.targetId, props.path, props.originalValue, tokenValueForCurrentSyntax(props.value, "colors", option.tokenPath), "immediate");
5699
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, colorTokenValueForCurrentSyntax(props.value, option.tokenPath), "immediate");
4780
5700
  };
4781
5701
  const openCreateDialog = () => {
5702
+ const initialHex = validHexColor(query.value) ? query.value.trim() : "#ff0000";
4782
5703
  createTokenPath.value = "";
4783
5704
  createTokenKind.value = "token";
5705
+ createColor.value = hsvaFromHexColor(initialHex);
5706
+ createColorHex.value = initialHex;
4784
5707
  createSourceTargetId.value = selectedCreateSource.value?.id ?? "";
4785
- createApplyToInput.value = false;
5708
+ createApplyToInput.value = true;
4786
5709
  createError.value = "";
4787
5710
  createSaving.value = false;
4788
5711
  createDialogOpen.value = true;
@@ -4820,7 +5743,7 @@ function ColorTokenValueInput(props) {
4820
5743
  };
4821
5744
  const submitCreateToken = () => {
4822
5745
  const tokenPath = createTokenPath.value.trim();
4823
- const value = query.value.trim();
5746
+ const value = createColorHex.value.trim();
4824
5747
  const section = createTokenKind.value === "token" ? "tokens.colors" : "semanticTokens.colors";
4825
5748
  const source = selectedCreateSource.value;
4826
5749
  if (!validHexColor(value)) {
@@ -4853,7 +5776,7 @@ function ColorTokenValueInput(props) {
4853
5776
  createError.value = response.error?.message ?? "Token creation failed.";
4854
5777
  return;
4855
5778
  }
4856
- if (createApplyToInput.value) props.onPreviewInput(props.targetId, props.path, props.originalValue, tokenValueForCurrentSyntax(props.value, "colors", tokenPath), "immediate");
5779
+ if (createApplyToInput.value) props.onPreviewInput(props.targetId, props.path, props.originalValue, colorTokenValueForCurrentSyntax(props.value, tokenPath), "immediate");
4857
5780
  closeCreateDialog();
4858
5781
  }, (error) => {
4859
5782
  createSaving.value = false;
@@ -4928,6 +5851,42 @@ function ColorTokenValueInput(props) {
4928
5851
  })
4929
5852
  }, option.id);
4930
5853
  };
5854
+ const updateCreateColor = (component, value) => {
5855
+ const max = component === "hue" ? 360 : 100;
5856
+ const nextColor = {
5857
+ ...createColor.value,
5858
+ [component]: clampNumber(Number.parseFloat(value), 0, max)
5859
+ };
5860
+ createColor.value = nextColor;
5861
+ createColorHex.value = hexColorFromHsva(nextColor);
5862
+ };
5863
+ const updateCreateColorFromSlider = (component, value) => {
5864
+ updateCreateColor(component, String(Math.round(Number.parseFloat(value))));
5865
+ };
5866
+ const updateCreateColorHex = (value) => {
5867
+ createColorHex.value = value;
5868
+ if (validHexColor(value)) createColor.value = hsvaFromHexColor(value);
5869
+ };
5870
+ const hueSliderBackground = "linear-gradient(90deg, #f00, #ff0 16.67%, #0f0 33.33%, #0ff 50%, #00f 66.67%, #f0f 83.33%, #f00)";
5871
+ const saturationSliderBackground = `linear-gradient(90deg, ${opaqueHexColorFromHsva({
5872
+ hue: createColor.value.hue,
5873
+ saturation: 0,
5874
+ value: createColor.value.value
5875
+ })}, ${opaqueHexColorFromHsva({
5876
+ hue: createColor.value.hue,
5877
+ saturation: 100,
5878
+ value: createColor.value.value
5879
+ })})`;
5880
+ const valueSliderBackground = `linear-gradient(90deg, #000000, ${opaqueHexColorFromHsva({
5881
+ hue: createColor.value.hue,
5882
+ saturation: createColor.value.saturation,
5883
+ value: 100
5884
+ })})`;
5885
+ const alphaSliderBackground = "linear-gradient(90deg, transparent, " + opaqueHexColorFromHsva({
5886
+ hue: createColor.value.hue,
5887
+ saturation: createColor.value.saturation,
5888
+ value: createColor.value.value
5889
+ }) + "), linear-gradient(45deg, #d6dde8 25%, transparent 25%), linear-gradient(-45deg, #d6dde8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d6dde8 75%), linear-gradient(-45deg, transparent 75%, #d6dde8 75%)";
4931
5890
  _$2(() => {
4932
5891
  if (menuOpen.value) {
4933
5892
  if (!previousMenuOpen.current) {
@@ -5142,7 +6101,7 @@ function ColorTokenValueInput(props) {
5142
6101
  overflow: "auto",
5143
6102
  minHeight: "32px"
5144
6103
  },
5145
- children: createOptionVisible.value ? /* @__PURE__ */ u(ShadowMenuItem, {
6104
+ children: [createOptionVisible.value ? /* @__PURE__ */ u(ShadowMenuItem, {
5146
6105
  active: activeSelectableOptionId.value === "create-token",
5147
6106
  class: "panda-token-selector-menu-item",
5148
6107
  disabled: props.saving.value,
@@ -5155,21 +6114,21 @@ function ColorTokenValueInput(props) {
5155
6114
  },
5156
6115
  children: "Create color token..."
5157
6116
  })
5158
- }) : props.options.value.length === 0 ? /* @__PURE__ */ u("div", {
6117
+ }) : null, props.options.value.length === 0 && !createOptionVisible.value ? /* @__PURE__ */ u("div", {
5159
6118
  "data-fuzzy-selector-empty": "true",
5160
6119
  style: {
5161
6120
  color: "#667085",
5162
6121
  padding: "7px 8px"
5163
6122
  },
5164
6123
  children: "No color tokens available."
5165
- }) : filteredOptions.value.length === 0 ? /* @__PURE__ */ u("div", {
6124
+ }) : filteredOptions.value.length === 0 && !createOptionVisible.value ? /* @__PURE__ */ u("div", {
5166
6125
  "data-fuzzy-selector-no-matches": "true",
5167
6126
  style: {
5168
6127
  color: "#667085",
5169
6128
  padding: "7px 8px"
5170
6129
  },
5171
6130
  children: "No matching color tokens."
5172
- }) : hasFilterQuery.value ? filteredOptions.value.map((option) => renderTokenOption(option)) : groupedOptions.value.map((group) => /* @__PURE__ */ u("div", {
6131
+ }) : filteredOptions.value.length === 0 ? null : hasFilterQuery.value ? filteredOptions.value.map((option) => renderTokenOption(option)) : groupedOptions.value.map((group) => /* @__PURE__ */ u("div", {
5173
6132
  "data-fuzzy-selector-group": group.presetName ? `${group.presetName} / ${group.label}` : group.label,
5174
6133
  children: [
5175
6134
  group.presetName ? /* @__PURE__ */ u("div", {
@@ -5196,7 +6155,7 @@ function ColorTokenValueInput(props) {
5196
6155
  }),
5197
6156
  group.options.map((option) => renderTokenOption(option))
5198
6157
  ]
5199
- }, `${group.label}:${group.presetName ?? ""}`))
6158
+ }, `${group.label}:${group.presetName ?? ""}`))]
5200
6159
  })]
5201
6160
  }),
5202
6161
  createDialogOpen.value ? /* @__PURE__ */ u("div", {
@@ -5243,7 +6202,8 @@ function ColorTokenValueInput(props) {
5243
6202
  placeholder: "brand.600",
5244
6203
  onInput: (event) => {
5245
6204
  createTokenPath.value = event.currentTarget.value;
5246
- }
6205
+ },
6206
+ style: CREATE_DIALOG_INPUT_STYLE
5247
6207
  })]
5248
6208
  }),
5249
6209
  /* @__PURE__ */ u("label", {
@@ -5258,6 +6218,7 @@ function ColorTokenValueInput(props) {
5258
6218
  onChange: (event) => {
5259
6219
  createTokenKind.value = event.currentTarget.value;
5260
6220
  },
6221
+ style: CREATE_DIALOG_INPUT_STYLE,
5261
6222
  children: [/* @__PURE__ */ u("option", {
5262
6223
  value: "token",
5263
6224
  children: "Color token"
@@ -5275,10 +6236,166 @@ function ColorTokenValueInput(props) {
5275
6236
  children: [/* @__PURE__ */ u("span", { children: "Value" }), /* @__PURE__ */ u("input", {
5276
6237
  type: "text",
5277
6238
  "data-create-color-token-value": "true",
5278
- value: query.value.trim(),
5279
- disabled: true
6239
+ value: createColorHex.value,
6240
+ disabled: createSaving.value,
6241
+ onInput: (event) => {
6242
+ updateCreateColorHex(event.currentTarget.value);
6243
+ },
6244
+ style: CREATE_DIALOG_INPUT_STYLE
5280
6245
  })]
5281
6246
  }),
6247
+ /* @__PURE__ */ u("div", {
6248
+ "data-create-color-token-preview": "true",
6249
+ style: {
6250
+ height: "44px",
6251
+ border: "1px solid #d6dde8",
6252
+ borderRadius: "6px",
6253
+ backgroundImage: "linear-gradient(45deg, #d6dde8 25%, transparent 25%), linear-gradient(-45deg, #d6dde8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d6dde8 75%), linear-gradient(-45deg, transparent 75%, #d6dde8 75%)",
6254
+ backgroundPosition: "0 0, 0 6px, 6px -6px, -6px 0",
6255
+ backgroundSize: "12px 12px",
6256
+ overflow: "hidden"
6257
+ },
6258
+ children: /* @__PURE__ */ u("div", { style: {
6259
+ width: "100%",
6260
+ height: "100%",
6261
+ backgroundColor: validHexColor(createColorHex.value) ? createColorHex.value : "transparent"
6262
+ } })
6263
+ }),
6264
+ /* @__PURE__ */ u("div", {
6265
+ style: {
6266
+ display: "grid",
6267
+ gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
6268
+ gap: "8px"
6269
+ },
6270
+ children: [
6271
+ /* @__PURE__ */ u("label", {
6272
+ style: {
6273
+ display: "grid",
6274
+ gap: "4px",
6275
+ minWidth: 0
6276
+ },
6277
+ children: [/* @__PURE__ */ u("span", { children: "Hue" }), /* @__PURE__ */ u(SteppableNumericInput, {
6278
+ dataAttributes: { "data-create-color-token-hue": "true" },
6279
+ property: "hue",
6280
+ label: "hue",
6281
+ value: String(createColor.value.hue),
6282
+ disabled: createSaving.value,
6283
+ onInput: (value) => {
6284
+ updateCreateColor("hue", value);
6285
+ }
6286
+ })]
6287
+ }),
6288
+ /* @__PURE__ */ u("label", {
6289
+ style: {
6290
+ display: "grid",
6291
+ gap: "4px",
6292
+ minWidth: 0
6293
+ },
6294
+ children: [/* @__PURE__ */ u("span", { children: "Sat" }), /* @__PURE__ */ u(SteppableNumericInput, {
6295
+ dataAttributes: { "data-create-color-token-saturation": "true" },
6296
+ property: "saturation",
6297
+ label: "saturation",
6298
+ value: String(createColor.value.saturation),
6299
+ disabled: createSaving.value,
6300
+ onInput: (value) => {
6301
+ updateCreateColor("saturation", value);
6302
+ }
6303
+ })]
6304
+ }),
6305
+ /* @__PURE__ */ u("label", {
6306
+ style: {
6307
+ display: "grid",
6308
+ gap: "4px",
6309
+ minWidth: 0
6310
+ },
6311
+ children: [/* @__PURE__ */ u("span", { children: "Value" }), /* @__PURE__ */ u(SteppableNumericInput, {
6312
+ dataAttributes: { "data-create-color-token-brightness": "true" },
6313
+ property: "value",
6314
+ label: "value",
6315
+ value: String(createColor.value.value),
6316
+ disabled: createSaving.value,
6317
+ onInput: (value) => {
6318
+ updateCreateColor("value", value);
6319
+ }
6320
+ })]
6321
+ }),
6322
+ /* @__PURE__ */ u("label", {
6323
+ style: {
6324
+ display: "grid",
6325
+ gap: "4px",
6326
+ minWidth: 0
6327
+ },
6328
+ children: [/* @__PURE__ */ u("span", { children: "Alpha" }), /* @__PURE__ */ u(SteppableNumericInput, {
6329
+ dataAttributes: { "data-create-color-token-alpha": "true" },
6330
+ property: "alpha",
6331
+ label: "alpha",
6332
+ value: String(createColor.value.alpha),
6333
+ disabled: createSaving.value,
6334
+ onInput: (value) => {
6335
+ updateCreateColor("alpha", value);
6336
+ }
6337
+ })]
6338
+ })
6339
+ ]
6340
+ }),
6341
+ /* @__PURE__ */ u("div", {
6342
+ style: {
6343
+ display: "grid",
6344
+ gap: "8px"
6345
+ },
6346
+ children: [
6347
+ /* @__PURE__ */ u(ColorComponentSlider, {
6348
+ dataAttribute: "data-create-color-token-hue-slider",
6349
+ label: "Hue",
6350
+ min: 0,
6351
+ max: 360,
6352
+ value: createColor.value.hue,
6353
+ disabled: createSaving.value,
6354
+ background: hueSliderBackground,
6355
+ onInput: (value) => {
6356
+ updateCreateColorFromSlider("hue", value);
6357
+ }
6358
+ }),
6359
+ /* @__PURE__ */ u(ColorComponentSlider, {
6360
+ dataAttribute: "data-create-color-token-saturation-slider",
6361
+ label: "Saturation",
6362
+ min: 0,
6363
+ max: 100,
6364
+ value: createColor.value.saturation,
6365
+ disabled: createSaving.value,
6366
+ background: saturationSliderBackground,
6367
+ onInput: (value) => {
6368
+ updateCreateColorFromSlider("saturation", value);
6369
+ }
6370
+ }),
6371
+ /* @__PURE__ */ u(ColorComponentSlider, {
6372
+ dataAttribute: "data-create-color-token-brightness-slider",
6373
+ label: "Value",
6374
+ min: 0,
6375
+ max: 100,
6376
+ value: createColor.value.value,
6377
+ disabled: createSaving.value,
6378
+ background: valueSliderBackground,
6379
+ onInput: (value) => {
6380
+ updateCreateColorFromSlider("value", value);
6381
+ }
6382
+ }),
6383
+ /* @__PURE__ */ u(ColorComponentSlider, {
6384
+ dataAttribute: "data-create-color-token-alpha-slider",
6385
+ label: "Alpha",
6386
+ min: 0,
6387
+ max: 100,
6388
+ value: createColor.value.alpha,
6389
+ disabled: createSaving.value,
6390
+ background: alphaSliderBackground,
6391
+ backgroundPosition: "0 0, 0 0, 0 6px, 6px -6px, -6px 0",
6392
+ backgroundSize: "auto, 12px 12px, 12px 12px, 12px 12px, 12px 12px",
6393
+ onInput: (value) => {
6394
+ updateCreateColorFromSlider("alpha", value);
6395
+ }
6396
+ })
6397
+ ]
6398
+ }),
5282
6399
  createTargetSources.value.length > 1 ? /* @__PURE__ */ u("label", {
5283
6400
  style: {
5284
6401
  display: "grid",
@@ -5291,6 +6408,7 @@ function ColorTokenValueInput(props) {
5291
6408
  onChange: (event) => {
5292
6409
  createSourceTargetId.value = event.currentTarget.value;
5293
6410
  },
6411
+ style: CREATE_DIALOG_INPUT_STYLE,
5294
6412
  children: createTargetSources.value.map((source) => /* @__PURE__ */ u("option", {
5295
6413
  value: source.id,
5296
6414
  children: tokenSourceTargetLabel(source)
@@ -5345,6 +6463,570 @@ function ColorTokenValueInput(props) {
5345
6463
  });
5346
6464
  }
5347
6465
  //#endregion
6466
+ //#region src/ui/inputs/boxShadowInput.tsx
6467
+ const SHADOW_LENGTH_PATTERN = /^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:px|rem|em|%|vh|vw|svh|svw|dvh|dvw|ch|lh)?$/i;
6468
+ const SHADOW_LENGTH_FUNCTION_PATTERN = /^(?:calc|clamp|min|max)\(/i;
6469
+ function shouldUseBoxShadowInput(path) {
6470
+ return pandaPreviewRootProperty(path) === "boxShadow";
6471
+ }
6472
+ function parseBoxShadowValue(value) {
6473
+ const trimmed = value.trim();
6474
+ if (!trimmed || trimmed.toLowerCase() === "none") return {
6475
+ kind: "layers",
6476
+ layers: []
6477
+ };
6478
+ const layerValues = splitTopLevel(trimmed, ",");
6479
+ const layers = [];
6480
+ for (const layerValue of layerValues) {
6481
+ const layer = parseBoxShadowLayer(layerValue);
6482
+ if (!layer) return {
6483
+ kind: "raw",
6484
+ value
6485
+ };
6486
+ layers.push(layer);
6487
+ }
6488
+ return {
6489
+ kind: "layers",
6490
+ layers
6491
+ };
6492
+ }
6493
+ function serializeBoxShadowLayers(layers) {
6494
+ if (layers.length === 0) return "none";
6495
+ return layers.map((layer) => [
6496
+ layer.inset ? "inset" : "",
6497
+ layer.x,
6498
+ layer.y,
6499
+ layer.blur,
6500
+ layer.spread,
6501
+ layer.color
6502
+ ].filter((part) => part.trim() !== "").join(" ")).join(", ");
6503
+ }
6504
+ function BoxShadowInput(props) {
6505
+ const firstExpandedInput = A$1(null);
6506
+ const inactiveAutoActivation = useSignal(null);
6507
+ const draft = useSignal(null);
6508
+ const lastEmittedValue = A$1(null);
6509
+ const parsed = draft.value && props.value === lastEmittedValue.current ? {
6510
+ kind: "layers",
6511
+ layers: draft.value.layers
6512
+ } : parseBoxShadowValue(props.value);
6513
+ const showInvalid = props.invalid;
6514
+ const borderColor = showInvalid ? "#fca5a5" : props.changed ? "#93c5fd" : "#d6dde8";
6515
+ const background = showInvalid ? "#fef2f2" : props.changed ? "#eff6ff" : "#fff";
6516
+ _$2(() => {
6517
+ if (props.value === lastEmittedValue.current) return;
6518
+ const parsedValue = parseBoxShadowValue(props.value);
6519
+ draft.value = parsedValue.kind === "layers" ? { layers: parsedValue.layers } : null;
6520
+ lastEmittedValue.current = null;
6521
+ }, [props.value]);
6522
+ _$2(() => {
6523
+ if (props.saving.value || props.focusRequest !== "expanded-first") return;
6524
+ const timer = setTimeout(() => {
6525
+ firstExpandedInput.current?.focus();
6526
+ firstExpandedInput.current?.select();
6527
+ props.onFocusRequestHandled();
6528
+ }, 0);
6529
+ return () => {
6530
+ clearTimeout(timer);
6531
+ };
6532
+ }, [props.focusRequest, props.saving.value]);
6533
+ const previewLayers = (layers, mode = "input") => {
6534
+ const value = serializeBoxShadowLayers(layers);
6535
+ draft.value = { layers };
6536
+ lastEmittedValue.current = value;
6537
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, value, mode);
6538
+ };
6539
+ const previewRaw = (value) => {
6540
+ lastEmittedValue.current = value;
6541
+ props.onPreviewInput(props.targetId, props.path, props.originalValue, value, "input");
6542
+ };
6543
+ const previewLayerPart = (layers, index, layer, value, part, mode = "input") => {
6544
+ previewLayers(replaceLayer(layers, index, {
6545
+ ...layer,
6546
+ [part]: value
6547
+ }), mode);
6548
+ };
6549
+ if (props.variant === "placeholder") return /* @__PURE__ */ u("button", {
6550
+ type: "button",
6551
+ "data-box-shadow-collapsed": "true",
6552
+ "data-preview-target-id": props.targetId,
6553
+ "data-preview-path": props.pathLabel,
6554
+ "data-preview-changed": props.changed ? "true" : "false",
6555
+ "data-preview-invalid": showInvalid ? "true" : "false",
6556
+ disabled: props.saving.value,
6557
+ onClick: () => {
6558
+ props.onExpand();
6559
+ },
6560
+ onKeyDown: (event) => {
6561
+ if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
6562
+ event.preventDefault();
6563
+ props.onModBackspace();
6564
+ }
6565
+ },
6566
+ style: {
6567
+ minWidth: 0,
6568
+ width: "100%",
6569
+ boxSizing: "border-box",
6570
+ border: `1px solid ${borderColor}`,
6571
+ borderRadius: "6px",
6572
+ padding: "4px 6px",
6573
+ font: "inherit",
6574
+ color: "#172033",
6575
+ background,
6576
+ textAlign: "left",
6577
+ whiteSpace: "nowrap",
6578
+ overflow: "hidden",
6579
+ textOverflow: "ellipsis"
6580
+ },
6581
+ children: props.value
6582
+ });
6583
+ if (parsed.kind === "raw") return /* @__PURE__ */ u("input", {
6584
+ ref: firstExpandedInput,
6585
+ "data-box-shadow-raw": "true",
6586
+ "data-preview-target-id": props.targetId,
6587
+ "data-preview-path": props.pathLabel,
6588
+ "data-preview-changed": props.changed ? "true" : "false",
6589
+ "data-preview-invalid": showInvalid ? "true" : "false",
6590
+ disabled: props.saving.value,
6591
+ value: props.value,
6592
+ onInput: (event) => {
6593
+ previewRaw(event.currentTarget.value);
6594
+ },
6595
+ onKeyDown: (event) => {
6596
+ if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
6597
+ event.preventDefault();
6598
+ props.onModBackspace();
6599
+ return;
6600
+ }
6601
+ if ((event.metaKey || event.ctrlKey) && event.key === "ArrowLeft") {
6602
+ event.preventDefault();
6603
+ props.onCollapse();
6604
+ }
6605
+ },
6606
+ style: inputStyle(borderColor, background)
6607
+ });
6608
+ return /* @__PURE__ */ u("div", {
6609
+ "data-box-shadow-input": "true",
6610
+ style: {
6611
+ display: "grid",
6612
+ gap: "6px",
6613
+ minWidth: 0
6614
+ },
6615
+ children: [parsed.layers.length === 0 ? /* @__PURE__ */ u("button", {
6616
+ type: "button",
6617
+ "data-action": "add-box-shadow-layer",
6618
+ disabled: props.saving.value,
6619
+ onClick: () => {
6620
+ previewLayers([defaultBoxShadowLayer()]);
6621
+ },
6622
+ style: secondaryButtonStyle,
6623
+ children: [/* @__PURE__ */ u(Plus, {
6624
+ size: 13,
6625
+ "aria-hidden": "true"
6626
+ }), " Add shadow"]
6627
+ }) : parsed.layers.map((layer, index) => /* @__PURE__ */ u("div", {
6628
+ "data-box-shadow-layer": index,
6629
+ style: {
6630
+ display: "grid",
6631
+ gridTemplateColumns: "minmax(0, 1fr)",
6632
+ gap: "6px",
6633
+ minWidth: 0,
6634
+ padding: "6px",
6635
+ border: "1px solid #eef2f7",
6636
+ borderRadius: "6px"
6637
+ },
6638
+ children: [
6639
+ /* @__PURE__ */ u("div", {
6640
+ style: shadowPartRowStyle,
6641
+ children: [/* @__PURE__ */ u(ShadowNumericInput, {
6642
+ inputRef: index === 0 ? firstExpandedInput : void 0,
6643
+ targetId: props.targetId,
6644
+ path: props.path,
6645
+ pathLabel: props.pathLabel,
6646
+ part: "x",
6647
+ layerIndex: index,
6648
+ originalValue: layer.x,
6649
+ value: layer.x,
6650
+ changed: props.changed,
6651
+ invalid: props.invalid,
6652
+ saving: props.saving,
6653
+ autoFocus: inactiveAutoActivation,
6654
+ onAutoFocusHandled: () => {},
6655
+ onPreviewInput: (value) => {
6656
+ previewLayerPart(parsed.layers, index, layer, value, "x");
6657
+ },
6658
+ onModBackspace: props.onModBackspace,
6659
+ onCollapse: props.onCollapse
6660
+ }), /* @__PURE__ */ u(ShadowNumericInput, {
6661
+ targetId: props.targetId,
6662
+ path: props.path,
6663
+ pathLabel: props.pathLabel,
6664
+ part: "y",
6665
+ layerIndex: index,
6666
+ originalValue: layer.y,
6667
+ value: layer.y,
6668
+ changed: props.changed,
6669
+ invalid: props.invalid,
6670
+ saving: props.saving,
6671
+ autoFocus: inactiveAutoActivation,
6672
+ onAutoFocusHandled: () => {},
6673
+ onPreviewInput: (value) => {
6674
+ previewLayerPart(parsed.layers, index, layer, value, "y");
6675
+ },
6676
+ onModBackspace: props.onModBackspace,
6677
+ onCollapse: props.onCollapse
6678
+ })]
6679
+ }),
6680
+ /* @__PURE__ */ u("div", {
6681
+ style: shadowPartRowStyle,
6682
+ children: [/* @__PURE__ */ u(ShadowNumericInput, {
6683
+ targetId: props.targetId,
6684
+ path: props.path,
6685
+ pathLabel: props.pathLabel,
6686
+ part: "blur",
6687
+ layerIndex: index,
6688
+ originalValue: layer.blur || "0px",
6689
+ value: layer.blur || "0px",
6690
+ changed: props.changed,
6691
+ invalid: props.invalid,
6692
+ saving: props.saving,
6693
+ autoFocus: inactiveAutoActivation,
6694
+ onAutoFocusHandled: () => {},
6695
+ onPreviewInput: (value) => {
6696
+ previewLayerPart(parsed.layers, index, layer, value, "blur");
6697
+ },
6698
+ onModBackspace: props.onModBackspace,
6699
+ onCollapse: props.onCollapse
6700
+ }), /* @__PURE__ */ u(ShadowNumericInput, {
6701
+ targetId: props.targetId,
6702
+ path: props.path,
6703
+ pathLabel: props.pathLabel,
6704
+ part: "spread",
6705
+ layerIndex: index,
6706
+ originalValue: layer.spread || "0px",
6707
+ value: layer.spread || "0px",
6708
+ changed: props.changed,
6709
+ invalid: props.invalid,
6710
+ saving: props.saving,
6711
+ autoFocus: inactiveAutoActivation,
6712
+ onAutoFocusHandled: () => {},
6713
+ onPreviewInput: (value) => {
6714
+ previewLayerPart(parsed.layers, index, layer, value, "spread");
6715
+ },
6716
+ onModBackspace: props.onModBackspace,
6717
+ onCollapse: props.onCollapse
6718
+ })]
6719
+ }),
6720
+ /* @__PURE__ */ u("div", {
6721
+ "data-box-shadow-part": "color",
6722
+ children: /* @__PURE__ */ u(ColorTokenValueInput, {
6723
+ targetId: props.targetId,
6724
+ path: props.path,
6725
+ pathLabel: `${props.pathLabel}.${index}.color`,
6726
+ originalValue: layer.color,
6727
+ value: layer.color,
6728
+ changed: props.changed,
6729
+ invalid: props.invalid,
6730
+ autoOpen: inactiveAutoActivation,
6731
+ options: props.colorTokenOptions,
6732
+ tokenSources: props.tokenSources,
6733
+ saving: props.saving,
6734
+ onAutoOpenHandled: () => {},
6735
+ onPreviewInput: (_editId, _path, _originalValue, value, mode = "input") => {
6736
+ previewLayerPart(parsed.layers, index, layer, value, "color", mode);
6737
+ },
6738
+ onModBackspace: props.onModBackspace,
6739
+ onCreateToken: props.onCreateToken,
6740
+ onMenuOpenChange: props.onMenuOpenChange,
6741
+ onArrowLeft: props.onCollapse
6742
+ })
6743
+ }),
6744
+ /* @__PURE__ */ u("div", {
6745
+ style: {
6746
+ display: "inline-flex",
6747
+ gap: "4px",
6748
+ justifyContent: "flex-end",
6749
+ alignItems: "center"
6750
+ },
6751
+ children: [
6752
+ /* @__PURE__ */ u(IconButton, {
6753
+ action: "toggle-box-shadow-inset",
6754
+ label: layer.inset ? `Use outset shadow ${index + 1}` : `Use inset shadow ${index + 1}`,
6755
+ disabled: props.saving.value,
6756
+ onClick: () => {
6757
+ previewLayers(replaceLayer(parsed.layers, index, {
6758
+ ...layer,
6759
+ inset: !layer.inset
6760
+ }));
6761
+ },
6762
+ children: layer.inset ? /* @__PURE__ */ u(SquareArrowRightEnter, {
6763
+ size: 13,
6764
+ "aria-hidden": "true"
6765
+ }) : /* @__PURE__ */ u(SquareArrowRightExit, {
6766
+ size: 13,
6767
+ "aria-hidden": "true"
6768
+ })
6769
+ }),
6770
+ /* @__PURE__ */ u(IconButton, {
6771
+ action: "move-box-shadow-layer-up",
6772
+ label: `Move shadow ${index + 1} up`,
6773
+ disabled: props.saving.value || index === 0,
6774
+ onClick: () => {
6775
+ previewLayers(moveLayer(parsed.layers, index, index - 1));
6776
+ },
6777
+ children: /* @__PURE__ */ u(ArrowUp, {
6778
+ size: 13,
6779
+ "aria-hidden": "true"
6780
+ })
6781
+ }),
6782
+ /* @__PURE__ */ u(IconButton, {
6783
+ action: "move-box-shadow-layer-down",
6784
+ label: `Move shadow ${index + 1} down`,
6785
+ disabled: props.saving.value || index === parsed.layers.length - 1,
6786
+ onClick: () => {
6787
+ previewLayers(moveLayer(parsed.layers, index, index + 1));
6788
+ },
6789
+ children: /* @__PURE__ */ u(ArrowDown, {
6790
+ size: 13,
6791
+ "aria-hidden": "true"
6792
+ })
6793
+ }),
6794
+ /* @__PURE__ */ u(IconButton, {
6795
+ action: "remove-box-shadow-layer",
6796
+ label: `Remove shadow ${index + 1}`,
6797
+ disabled: props.saving.value,
6798
+ onClick: () => {
6799
+ previewLayers(parsed.layers.filter((_, layerIndex) => layerIndex !== index));
6800
+ },
6801
+ children: /* @__PURE__ */ u(Trash2, {
6802
+ size: 13,
6803
+ "aria-hidden": "true"
6804
+ })
6805
+ })
6806
+ ]
6807
+ })
6808
+ ]
6809
+ }, index)), parsed.layers.length > 0 ? /* @__PURE__ */ u("button", {
6810
+ type: "button",
6811
+ "data-action": "add-box-shadow-layer",
6812
+ disabled: props.saving.value,
6813
+ onClick: () => {
6814
+ previewLayers([...parsed.layers, defaultBoxShadowLayer()]);
6815
+ },
6816
+ style: {
6817
+ ...secondaryButtonStyle,
6818
+ justifySelf: "start"
6819
+ },
6820
+ children: [/* @__PURE__ */ u(Plus, {
6821
+ size: 13,
6822
+ "aria-hidden": "true"
6823
+ }), " Add shadow"]
6824
+ }) : null]
6825
+ });
6826
+ }
6827
+ function ShadowNumericInput(props) {
6828
+ const pathLabel = `${props.pathLabel}.${props.layerIndex}.${props.part}`;
6829
+ const label = props.part === "x" ? "X" : props.part === "y" ? "Y" : props.part;
6830
+ return /* @__PURE__ */ u("label", {
6831
+ "data-box-shadow-part": props.part,
6832
+ style: {
6833
+ display: "grid",
6834
+ gridTemplateColumns: "44px minmax(0, 1fr)",
6835
+ gap: "4px",
6836
+ alignItems: "center",
6837
+ minWidth: 0
6838
+ },
6839
+ children: [/* @__PURE__ */ u("span", {
6840
+ style: {
6841
+ color: "#526070",
6842
+ fontSize: "12px"
6843
+ },
6844
+ children: label
6845
+ }), /* @__PURE__ */ u(RawValueInput, {
6846
+ targetId: props.targetId,
6847
+ path: props.path,
6848
+ pathLabel,
6849
+ numericProperty: props.part === "blur" ? "boxShadowBlur" : props.part === "spread" ? "boxShadowSpread" : void 0,
6850
+ originalValue: props.originalValue,
6851
+ value: props.value,
6852
+ changed: props.changed,
6853
+ invalid: props.invalid,
6854
+ autoFocus: props.autoFocus,
6855
+ inputRef: props.inputRef,
6856
+ saving: props.saving,
6857
+ onAutoFocusHandled: props.onAutoFocusHandled,
6858
+ onPreviewInput: (_editId, _path, _originalValue, value) => {
6859
+ props.onPreviewInput(clampedShadowPartValue(props.part, value));
6860
+ },
6861
+ onModBackspace: props.onModBackspace,
6862
+ onArrowLeft: props.onCollapse
6863
+ })]
6864
+ });
6865
+ }
6866
+ function IconButton(props) {
6867
+ return /* @__PURE__ */ u("button", {
6868
+ type: "button",
6869
+ "data-action": props.action,
6870
+ "data-icon-button": "true",
6871
+ "aria-label": props.label,
6872
+ disabled: props.disabled,
6873
+ onClick: props.onClick,
6874
+ children: props.children
6875
+ });
6876
+ }
6877
+ function parseBoxShadowLayer(value) {
6878
+ const tokens = splitWhitespaceTopLevel(value.trim());
6879
+ if (tokens.length === 0) return void 0;
6880
+ const lengthTokens = [];
6881
+ let inset = false;
6882
+ tokens.forEach((token, index) => {
6883
+ if (token.toLowerCase() === "inset") {
6884
+ inset = true;
6885
+ return;
6886
+ }
6887
+ if (lengthTokens.length < 4 && isShadowLengthToken(token)) lengthTokens.push({
6888
+ index,
6889
+ value: token
6890
+ });
6891
+ });
6892
+ if (lengthTokens.length < 2) return void 0;
6893
+ const lengthIndexes = new Set(lengthTokens.map((token) => token.index));
6894
+ const color = tokens.filter((token, index) => token.toLowerCase() !== "inset" && !lengthIndexes.has(index)).join(" ");
6895
+ return {
6896
+ inset,
6897
+ x: lengthTokens[0]?.value ?? "",
6898
+ y: lengthTokens[1]?.value ?? "",
6899
+ blur: clampedShadowPartValue("blur", lengthTokens[2]?.value ?? ""),
6900
+ spread: clampedShadowPartValue("spread", lengthTokens[3]?.value ?? ""),
6901
+ color
6902
+ };
6903
+ }
6904
+ function splitTopLevel(value, separator) {
6905
+ const parts = [];
6906
+ let current = "";
6907
+ let depth = 0;
6908
+ let quote;
6909
+ for (let index = 0; index < value.length; index += 1) {
6910
+ const char = value[index];
6911
+ const previous = value[index - 1];
6912
+ if (quote) {
6913
+ current += char;
6914
+ if (char === quote && previous !== "\\") quote = void 0;
6915
+ continue;
6916
+ }
6917
+ if (char === "\"" || char === "'") {
6918
+ quote = char;
6919
+ current += char;
6920
+ continue;
6921
+ }
6922
+ if (char === "(" || char === "[") depth += 1;
6923
+ else if (char === ")" || char === "]") depth = Math.max(0, depth - 1);
6924
+ if (char === separator && depth === 0) {
6925
+ parts.push(current.trim());
6926
+ current = "";
6927
+ continue;
6928
+ }
6929
+ current += char;
6930
+ }
6931
+ parts.push(current.trim());
6932
+ return parts.filter((part) => part !== "");
6933
+ }
6934
+ function splitWhitespaceTopLevel(value) {
6935
+ const parts = [];
6936
+ let current = "";
6937
+ let depth = 0;
6938
+ let quote;
6939
+ for (let index = 0; index < value.length; index += 1) {
6940
+ const char = value[index];
6941
+ const previous = value[index - 1];
6942
+ if (quote) {
6943
+ current += char;
6944
+ if (char === quote && previous !== "\\") quote = void 0;
6945
+ continue;
6946
+ }
6947
+ if (char === "\"" || char === "'") {
6948
+ quote = char;
6949
+ current += char;
6950
+ continue;
6951
+ }
6952
+ if (char === "(" || char === "[") depth += 1;
6953
+ else if (char === ")" || char === "]") depth = Math.max(0, depth - 1);
6954
+ if (/\s/.test(char) && depth === 0) {
6955
+ if (current) {
6956
+ parts.push(current);
6957
+ current = "";
6958
+ }
6959
+ continue;
6960
+ }
6961
+ current += char;
6962
+ }
6963
+ if (current) parts.push(current);
6964
+ return parts;
6965
+ }
6966
+ function isShadowLengthToken(token) {
6967
+ if (SHADOW_LENGTH_PATTERN.test(token)) return true;
6968
+ return SHADOW_LENGTH_FUNCTION_PATTERN.test(token);
6969
+ }
6970
+ function clampedShadowPartValue(part, value) {
6971
+ if (part !== "blur" && part !== "spread") return value;
6972
+ const match = /^(?<number>[+-]?(?:\d+(?:\.\d+)?|\.\d+))(?<unit>.*)$/.exec(value.trim());
6973
+ if (!match?.groups || !match.groups.number.startsWith("-")) return value;
6974
+ return `0${match.groups.unit}`;
6975
+ }
6976
+ function replaceLayer(layers, index, layer) {
6977
+ return layers.map((existing, layerIndex) => layerIndex === index ? layer : existing);
6978
+ }
6979
+ function moveLayer(layers, fromIndex, toIndex) {
6980
+ if (toIndex < 0 || toIndex >= layers.length) return layers;
6981
+ const next = [...layers];
6982
+ const [layer] = next.splice(fromIndex, 1);
6983
+ if (!layer) return layers;
6984
+ next.splice(toIndex, 0, layer);
6985
+ return next;
6986
+ }
6987
+ function defaultBoxShadowLayer() {
6988
+ return {
6989
+ inset: false,
6990
+ x: "0px",
6991
+ y: "4px",
6992
+ blur: "12px",
6993
+ spread: "0px",
6994
+ color: "rgba(15, 23, 42, 0.16)"
6995
+ };
6996
+ }
6997
+ function inputStyle(borderColor, background) {
6998
+ return {
6999
+ minWidth: 0,
7000
+ width: "100%",
7001
+ boxSizing: "border-box",
7002
+ border: `1px solid ${borderColor}`,
7003
+ borderRadius: "6px",
7004
+ padding: "4px 6px",
7005
+ font: "inherit",
7006
+ color: "#172033",
7007
+ background
7008
+ };
7009
+ }
7010
+ const shadowPartRowStyle = {
7011
+ display: "grid",
7012
+ gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1fr)",
7013
+ gap: "6px",
7014
+ minWidth: 0
7015
+ };
7016
+ const secondaryButtonStyle = {
7017
+ display: "inline-flex",
7018
+ alignItems: "center",
7019
+ gap: "4px",
7020
+ minWidth: 0,
7021
+ justifyContent: "center",
7022
+ border: "1px solid #d6dde8",
7023
+ borderRadius: "6px",
7024
+ padding: "4px 6px",
7025
+ font: "inherit",
7026
+ color: "#172033",
7027
+ background: "#fff"
7028
+ };
7029
+ //#endregion
5348
7030
  //#region src/ui/inputs/finiteValueInput.tsx
5349
7031
  const GLOBAL_VALUE_GROUP = "Global";
5350
7032
  const GLOBAL_VALUES = [
@@ -6244,416 +7926,110 @@ function FontTokenValueInput(props) {
6244
7926
  };
6245
7927
  const selectActiveOption = () => {
6246
7928
  const option = filteredOptions.value.find((item) => item.id === activeSelectableOptionId.value);
6247
- if (option) selectOption(option);
6248
- };
6249
- const renderTokenOption = (option) => {
6250
- const selected = selectedOption?.id === option.id;
6251
- return /* @__PURE__ */ u(ShadowMenuItem, {
6252
- active: activeSelectableOptionId.value === option.id,
6253
- class: "panda-token-selector-menu-item",
6254
- disabled: props.saving.value,
6255
- onPreview: () => {
6256
- activeOptionId.value = option.id;
6257
- previewOption(option);
6258
- },
6259
- onSelect: () => {
6260
- selectOption(option);
6261
- },
6262
- children: /* @__PURE__ */ u("span", {
6263
- "data-font-token-option": "true",
6264
- "data-font-token-option-id": option.id,
6265
- "aria-selected": selected,
6266
- onClick: (event) => {
6267
- event.stopPropagation();
6268
- selectOption(option);
6269
- },
6270
- style: {
6271
- minWidth: 0,
6272
- display: "grid",
6273
- gridTemplateColumns: "minmax(0, 1fr) auto",
6274
- alignItems: "center",
6275
- gap: "8px"
6276
- },
6277
- children: [/* @__PURE__ */ u("span", {
6278
- style: {
6279
- minWidth: 0,
6280
- overflow: "hidden",
6281
- textOverflow: "ellipsis",
6282
- whiteSpace: "nowrap",
6283
- fontWeight: selected ? 700 : 400
6284
- },
6285
- children: option.label
6286
- }), option.detail ? /* @__PURE__ */ u("span", {
6287
- style: {
6288
- minWidth: 0,
6289
- overflow: "hidden",
6290
- textOverflow: "ellipsis",
6291
- whiteSpace: "nowrap",
6292
- color: "#667085"
6293
- },
6294
- children: option.detail
6295
- }) : null]
6296
- })
6297
- }, option.id);
6298
- };
6299
- _$2(() => {
6300
- if (menuOpen.value) {
6301
- if (!previousMenuOpen.current) {
6302
- menuBaselineValue.current = props.value;
6303
- menuSelectionConfirmed.current = false;
6304
- props.onMenuOpenChange(true);
6305
- }
6306
- previousMenuOpen.current = true;
6307
- searchInput.current?.focus();
6308
- return;
6309
- }
6310
- if (previousMenuOpen.current && !menuSelectionConfirmed.current) props.onPreviewInput(props.targetId, props.path, props.originalValue, menuBaselineValue.current ?? props.value, "transient");
6311
- if (previousMenuOpen.current) {
6312
- trigger.current?.focus();
6313
- props.onMenuOpenChange(false);
6314
- }
6315
- previousMenuOpen.current = false;
6316
- menuBaselineValue.current = void 0;
6317
- menuSelectionConfirmed.current = false;
6318
- }, [menuOpen.value]);
6319
- _$2(() => {
6320
- if (props.saving.value) return;
6321
- const request = props.autoOpen.value;
6322
- if (!request || request.targetId !== props.targetId || request.pathLabel !== props.pathLabel) return;
6323
- menuOpen.value = true;
6324
- props.onAutoOpenHandled();
6325
- }, [props.autoOpen.value, props.saving.value]);
6326
- _$2(() => () => {
6327
- if (previousMenuOpen.current) props.onMenuOpenChange(false);
6328
- }, []);
6329
- _$2(() => {
6330
- if (optionList.current) optionList.current.scrollTop = 0;
6331
- }, [query.value]);
6332
- return /* @__PURE__ */ u("div", {
6333
- style: {
6334
- position: "relative",
6335
- minWidth: 0
6336
- },
6337
- children: [/* @__PURE__ */ u("button", {
6338
- ref: trigger,
6339
- type: "button",
6340
- "data-preview-target-id": props.targetId,
6341
- "data-preview-path": props.pathLabel,
6342
- "data-preview-font-token-selector": "true",
6343
- "data-preview-changed": props.changed ? "true" : "false",
6344
- "data-preview-invalid": showInvalid ? "true" : "false",
6345
- "data-preview-original-value": props.originalValue,
6346
- disabled: props.saving.value,
6347
- "aria-haspopup": "listbox",
6348
- "aria-expanded": menuOpen.value,
6349
- onClick: () => {
6350
- menuOpen.value = !menuOpen.value;
6351
- },
6352
- onKeyDown: (event) => {
6353
- if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
6354
- event.preventDefault();
6355
- props.onModBackspace();
6356
- return;
6357
- }
6358
- if (event.key === "Enter" && !menuOpen.value) {
6359
- event.preventDefault();
6360
- menuOpen.value = true;
6361
- }
6362
- },
6363
- onFocus: () => {
6364
- focused.value = true;
6365
- },
6366
- onBlur: () => {
6367
- focused.value = false;
6368
- },
6369
- style: {
6370
- minWidth: 0,
6371
- width: "100%",
6372
- display: "grid",
6373
- gridTemplateColumns: "1fr auto",
6374
- alignItems: "center",
6375
- gap: "8px",
6376
- boxSizing: "border-box",
6377
- border: `1px solid ${borderColor}`,
6378
- borderRadius: "6px",
6379
- padding: "4px 6px",
6380
- font: "inherit",
6381
- color: "#172033",
6382
- background,
6383
- textAlign: "left"
6384
- },
6385
- children: [/* @__PURE__ */ u("span", {
6386
- style: {
6387
- minWidth: 0,
6388
- overflow: "hidden",
6389
- textOverflow: "ellipsis",
6390
- whiteSpace: "nowrap"
6391
- },
6392
- children: props.value
6393
- }), /* @__PURE__ */ u(Type, {
6394
- size: 14,
6395
- "aria-hidden": "true"
6396
- })]
6397
- }), /* @__PURE__ */ u(ShadowMenu, {
6398
- open: menuOpen,
6399
- onOpenChange: (open) => {
6400
- menuOpen.value = open;
6401
- },
6402
- anchor: () => trigger.current,
6403
- ariaLabel: "Font token selector",
6404
- class: "panda-token-selector-menu",
6405
- initialFocus: () => searchInput.current,
6406
- children: [/* @__PURE__ */ u("input", {
6407
- ref: searchInput,
6408
- type: "text",
6409
- "data-font-token-search": "true",
6410
- value: query.value,
6411
- placeholder: "Filter font tokens...",
6412
- disabled: props.saving.value,
6413
- onInput: (event) => {
6414
- query.value = event.currentTarget.value;
6415
- activeOptionId.value = void 0;
6416
- },
6417
- onKeyDown: (event) => {
6418
- if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
6419
- event.preventDefault();
6420
- menuOpen.value = false;
6421
- props.onModBackspace();
6422
- return;
6423
- }
6424
- if (event.key === "Escape") {
6425
- event.preventDefault();
6426
- menuOpen.value = false;
6427
- return;
6428
- }
6429
- if (event.key === "ArrowDown") {
6430
- event.preventDefault();
6431
- event.stopPropagation();
6432
- moveActiveOption(1);
6433
- return;
6434
- }
6435
- if (event.key === "ArrowUp") {
6436
- event.preventDefault();
6437
- event.stopPropagation();
6438
- moveActiveOption(-1);
6439
- return;
6440
- }
6441
- if (event.key === "Enter") {
6442
- event.preventDefault();
6443
- selectActiveOption();
6444
- }
7929
+ if (option) selectOption(option);
7930
+ };
7931
+ const renderTokenOption = (option) => {
7932
+ const selected = selectedOption?.id === option.id;
7933
+ return /* @__PURE__ */ u(ShadowMenuItem, {
7934
+ active: activeSelectableOptionId.value === option.id,
7935
+ class: "panda-token-selector-menu-item",
7936
+ disabled: props.saving.value,
7937
+ onPreview: () => {
7938
+ activeOptionId.value = option.id;
7939
+ previewOption(option);
7940
+ },
7941
+ onSelect: () => {
7942
+ selectOption(option);
7943
+ },
7944
+ children: /* @__PURE__ */ u("span", {
7945
+ "data-font-token-option": "true",
7946
+ "data-font-token-option-id": option.id,
7947
+ "aria-selected": selected,
7948
+ onClick: (event) => {
7949
+ event.stopPropagation();
7950
+ selectOption(option);
6445
7951
  },
6446
7952
  style: {
6447
7953
  minWidth: 0,
6448
- width: "100%",
6449
- border: "1px solid #d6dde8",
6450
- borderRadius: "5px",
6451
- padding: "5px 7px",
6452
- color: "#172033",
6453
- background: "#fff"
6454
- }
6455
- }), /* @__PURE__ */ u("div", {
6456
- ref: optionList,
6457
- role: "listbox",
6458
- "data-font-token-list": "true",
6459
- style: {
6460
7954
  display: "grid",
6461
- gap: "2px",
6462
- maxHeight: "232px",
6463
- overflow: "auto",
6464
- minHeight: "32px"
7955
+ gridTemplateColumns: "minmax(0, 1fr) auto",
7956
+ alignItems: "center",
7957
+ gap: "8px"
6465
7958
  },
6466
- children: filteredOptions.value.length === 0 ? /* @__PURE__ */ u("div", {
6467
- "data-font-token-no-matches": "true",
7959
+ children: [/* @__PURE__ */ u("span", {
6468
7960
  style: {
6469
- color: "#667085",
6470
- padding: "7px 8px"
7961
+ minWidth: 0,
7962
+ overflow: "hidden",
7963
+ textOverflow: "ellipsis",
7964
+ whiteSpace: "nowrap",
7965
+ fontWeight: selected ? 700 : 400
6471
7966
  },
6472
- children: "No matching font tokens."
6473
- }) : hasFilterQuery.value ? filteredOptions.value.map((option) => renderTokenOption(option)) : groupedOptions.value.map((group) => /* @__PURE__ */ u("div", {
6474
- "data-font-token-group": group.presetName ? `${group.presetName} / ${group.label}` : group.label,
6475
- children: [
6476
- group.presetName ? /* @__PURE__ */ u("div", {
6477
- "data-font-token-preset-label": "true",
6478
- style: {
6479
- borderTop: "1px solid #e6ebf2",
6480
- color: "#344054",
6481
- fontSize: "11px",
6482
- fontWeight: 700,
6483
- padding: "8px 8px 1px"
6484
- },
6485
- children: group.presetName
6486
- }) : null,
6487
- /* @__PURE__ */ u("div", {
6488
- "data-font-token-group-label": "true",
6489
- style: {
6490
- color: "#667085",
6491
- fontSize: "11px",
6492
- fontWeight: 700,
6493
- padding: "6px 8px 2px",
6494
- textTransform: "uppercase"
6495
- },
6496
- children: group.label
6497
- }),
6498
- group.options.map((option) => renderTokenOption(option))
6499
- ]
6500
- }, `${group.label}:${group.presetName ?? ""}`))
6501
- })]
6502
- })]
6503
- });
6504
- }
6505
- //#endregion
6506
- //#region src/ui/inputs/rawValueInput.tsx
6507
- const NUMERIC_INPUT_PATTERN = /^(?<number>[+-]?(?:\d+(?:\.\d+)?|\.\d+))(?<unit>px|rem|em|%|vh|vw|svh|svw|dvh|dvw|ch|lh|deg)?$/;
6508
- const NON_NEGATIVE_NUMERIC_PROPERTIES = new Set([
6509
- "p",
6510
- "padding",
6511
- "paddingBlock",
6512
- "paddingBlockEnd",
6513
- "paddingBlockStart",
6514
- "paddingBottom",
6515
- "paddingInline",
6516
- "paddingInlineEnd",
6517
- "paddingInlineStart",
6518
- "paddingLeft",
6519
- "paddingRight",
6520
- "paddingTop",
6521
- "paddingX",
6522
- "paddingY",
6523
- "padding-block",
6524
- "padding-block-end",
6525
- "padding-block-start",
6526
- "padding-bottom",
6527
- "padding-inline",
6528
- "padding-inline-end",
6529
- "padding-inline-start",
6530
- "padding-left",
6531
- "padding-right",
6532
- "padding-top",
6533
- "pb",
6534
- "pl",
6535
- "pr",
6536
- "pt",
6537
- "px",
6538
- "py",
6539
- "gap",
6540
- "rowGap",
6541
- "columnGap",
6542
- "row-gap",
6543
- "column-gap",
6544
- "width",
6545
- "w",
6546
- "height",
6547
- "h",
6548
- "minWidth",
6549
- "minW",
6550
- "min-width",
6551
- "maxWidth",
6552
- "maxW",
6553
- "max-width",
6554
- "minHeight",
6555
- "minH",
6556
- "min-height",
6557
- "maxHeight",
6558
- "maxH",
6559
- "max-height",
6560
- "flexBasis",
6561
- "flex-basis",
6562
- "fontSize",
6563
- "font-size",
6564
- "lineHeight",
6565
- "line-height",
6566
- "aspectRatio",
6567
- "aspect-ratio",
6568
- "borderWidth",
6569
- "borderTopWidth",
6570
- "borderRightWidth",
6571
- "borderBottomWidth",
6572
- "borderLeftWidth",
6573
- "outlineWidth",
6574
- "border-width",
6575
- "border-top-width",
6576
- "border-right-width",
6577
- "border-bottom-width",
6578
- "border-left-width",
6579
- "outline-width",
6580
- "borderRadius",
6581
- "borderTopRadius",
6582
- "borderRightRadius",
6583
- "borderBottomRadius",
6584
- "borderLeftRadius",
6585
- "border-radius",
6586
- "border-top-radius",
6587
- "border-right-radius",
6588
- "border-bottom-radius",
6589
- "border-left-radius",
6590
- "rounded",
6591
- "roundedTop",
6592
- "roundedRight",
6593
- "roundedBottom",
6594
- "roundedLeft"
6595
- ]);
6596
- function RawValueInput(props) {
6597
- const focused = useSignal(false);
6598
- const input = A$1(null);
6599
- const showInvalid = props.invalid && !focused.value;
6600
- const borderColor = showInvalid ? "#fca5a5" : props.changed ? "#93c5fd" : "#d6dde8";
6601
- const background = showInvalid ? "#fef2f2" : props.changed ? "#eff6ff" : "#fff";
6602
- const property = pandaPreviewRootProperty(props.path) ?? "";
6603
- const numeric = isSteppableNumericInput(property, props.value);
6604
- const stepValue = (direction, shiftKey = false, altKey = false) => {
6605
- const nextValue = steppedNumericInputValue({
6606
- property,
6607
- value: props.value,
6608
- direction,
6609
- shiftKey,
6610
- altKey
6611
- });
6612
- if (!nextValue) return;
6613
- props.onPreviewInput(props.targetId, props.path, props.originalValue, nextValue, "input");
7967
+ children: option.label
7968
+ }), option.detail ? /* @__PURE__ */ u("span", {
7969
+ style: {
7970
+ minWidth: 0,
7971
+ overflow: "hidden",
7972
+ textOverflow: "ellipsis",
7973
+ whiteSpace: "nowrap",
7974
+ color: "#667085"
7975
+ },
7976
+ children: option.detail
7977
+ }) : null]
7978
+ })
7979
+ }, option.id);
6614
7980
  };
7981
+ _$2(() => {
7982
+ if (menuOpen.value) {
7983
+ if (!previousMenuOpen.current) {
7984
+ menuBaselineValue.current = props.value;
7985
+ menuSelectionConfirmed.current = false;
7986
+ props.onMenuOpenChange(true);
7987
+ }
7988
+ previousMenuOpen.current = true;
7989
+ searchInput.current?.focus();
7990
+ return;
7991
+ }
7992
+ if (previousMenuOpen.current && !menuSelectionConfirmed.current) props.onPreviewInput(props.targetId, props.path, props.originalValue, menuBaselineValue.current ?? props.value, "transient");
7993
+ if (previousMenuOpen.current) {
7994
+ trigger.current?.focus();
7995
+ props.onMenuOpenChange(false);
7996
+ }
7997
+ previousMenuOpen.current = false;
7998
+ menuBaselineValue.current = void 0;
7999
+ menuSelectionConfirmed.current = false;
8000
+ }, [menuOpen.value]);
6615
8001
  _$2(() => {
6616
8002
  if (props.saving.value) return;
6617
- const request = props.autoFocus.value;
8003
+ const request = props.autoOpen.value;
6618
8004
  if (!request || request.targetId !== props.targetId || request.pathLabel !== props.pathLabel) return;
6619
- const timer = setTimeout(() => {
6620
- input.current?.focus();
6621
- input.current?.select();
6622
- props.onAutoFocusHandled();
6623
- }, 0);
6624
- return () => {
6625
- clearTimeout(timer);
6626
- };
6627
- }, [props.autoFocus.value, props.saving.value]);
6628
- return /* @__PURE__ */ u("div", {
6629
- style: {
6630
- position: "relative",
6631
- minWidth: 0
6632
- },
6633
- children: [/* @__PURE__ */ u("input", {
6634
- ref: (element) => {
6635
- input.current = element;
6636
- if (typeof props.inputRef === "function") props.inputRef(element);
6637
- else if (props.inputRef) props.inputRef.current = element;
6638
- },
8005
+ menuOpen.value = true;
8006
+ props.onAutoOpenHandled();
8007
+ }, [props.autoOpen.value, props.saving.value]);
8008
+ _$2(() => () => {
8009
+ if (previousMenuOpen.current) props.onMenuOpenChange(false);
8010
+ }, []);
8011
+ _$2(() => {
8012
+ if (optionList.current) optionList.current.scrollTop = 0;
8013
+ }, [query.value]);
8014
+ return /* @__PURE__ */ u("div", {
8015
+ style: {
8016
+ position: "relative",
8017
+ minWidth: 0
8018
+ },
8019
+ children: [/* @__PURE__ */ u("button", {
8020
+ ref: trigger,
8021
+ type: "button",
6639
8022
  "data-preview-target-id": props.targetId,
6640
8023
  "data-preview-path": props.pathLabel,
6641
- "data-preview-shorthand-part": props.shorthandPart,
8024
+ "data-preview-font-token-selector": "true",
6642
8025
  "data-preview-changed": props.changed ? "true" : "false",
6643
8026
  "data-preview-invalid": showInvalid ? "true" : "false",
6644
8027
  "data-preview-original-value": props.originalValue,
6645
8028
  disabled: props.saving.value,
6646
- value: props.value,
6647
- onFocus: () => {
6648
- focused.value = true;
6649
- props.onFocus?.();
6650
- },
6651
- onBlur: () => {
6652
- focused.value = false;
6653
- props.onBlur?.();
6654
- },
6655
- onInput: (event) => {
6656
- props.onPreviewInput(props.targetId, props.path, props.originalValue, event.currentTarget.value, "input");
8029
+ "aria-haspopup": "listbox",
8030
+ "aria-expanded": menuOpen.value,
8031
+ onClick: () => {
8032
+ menuOpen.value = !menuOpen.value;
6657
8033
  },
6658
8034
  onKeyDown: (event) => {
6659
8035
  if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
@@ -6661,176 +8037,153 @@ function RawValueInput(props) {
6661
8037
  props.onModBackspace();
6662
8038
  return;
6663
8039
  }
6664
- if ((event.metaKey || event.ctrlKey) && event.key === "ArrowRight" && props.onArrowRight) {
6665
- event.preventDefault();
6666
- props.onArrowRight();
6667
- return;
6668
- }
6669
- if ((event.metaKey || event.ctrlKey) && event.key === "ArrowLeft" && props.onArrowLeft) {
8040
+ if (event.key === "Enter" && !menuOpen.value) {
6670
8041
  event.preventDefault();
6671
- props.onArrowLeft();
6672
- return;
8042
+ menuOpen.value = true;
6673
8043
  }
6674
- if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
6675
- const nextValue = steppedNumericInputValue({
6676
- property,
6677
- value: event.currentTarget.value,
6678
- direction: event.key === "ArrowUp" ? 1 : -1,
6679
- shiftKey: event.shiftKey,
6680
- altKey: event.altKey
6681
- });
6682
- if (!nextValue) return;
6683
- event.preventDefault();
6684
- props.onPreviewInput(props.targetId, props.path, props.originalValue, nextValue, "input");
8044
+ },
8045
+ onFocus: () => {
8046
+ focused.value = true;
8047
+ },
8048
+ onBlur: () => {
8049
+ focused.value = false;
6685
8050
  },
6686
8051
  style: {
6687
8052
  minWidth: 0,
6688
8053
  width: "100%",
8054
+ display: "grid",
8055
+ gridTemplateColumns: "1fr auto",
8056
+ alignItems: "center",
8057
+ gap: "8px",
6689
8058
  boxSizing: "border-box",
6690
8059
  border: `1px solid ${borderColor}`,
6691
8060
  borderRadius: "6px",
6692
- minHeight: numeric ? "30px" : void 0,
6693
- padding: numeric ? "4px 32px 4px 6px" : "4px 6px",
8061
+ padding: "4px 6px",
6694
8062
  font: "inherit",
6695
8063
  color: "#172033",
6696
- background
6697
- }
6698
- }), numeric ? /* @__PURE__ */ u("div", {
6699
- "data-numeric-stepper": "true",
6700
- style: {
6701
- position: "absolute",
6702
- top: "2px",
6703
- right: "2px",
6704
- bottom: "2px",
6705
- width: "24px",
6706
- display: "grid",
6707
- gridTemplateRows: "1fr 1fr"
8064
+ background,
8065
+ textAlign: "left"
6708
8066
  },
6709
- children: [/* @__PURE__ */ u(NumericStepperButton, {
6710
- action: "increment",
6711
- disabled: props.saving.value,
6712
- direction: "up",
6713
- label: `Increment ${props.pathLabel}`,
6714
- onStep: (shiftKey, altKey) => {
6715
- stepValue(1, shiftKey, altKey);
6716
- },
6717
- onKeepFocus: () => {
6718
- input.current?.focus();
6719
- }
6720
- }), /* @__PURE__ */ u(NumericStepperButton, {
6721
- action: "decrement",
6722
- disabled: props.saving.value,
6723
- direction: "down",
6724
- label: `Decrement ${props.pathLabel}`,
6725
- onStep: (shiftKey, altKey) => {
6726
- stepValue(-1, shiftKey, altKey);
8067
+ children: [/* @__PURE__ */ u("span", {
8068
+ style: {
8069
+ minWidth: 0,
8070
+ overflow: "hidden",
8071
+ textOverflow: "ellipsis",
8072
+ whiteSpace: "nowrap"
6727
8073
  },
6728
- onKeepFocus: () => {
6729
- input.current?.focus();
6730
- }
8074
+ children: props.value
8075
+ }), /* @__PURE__ */ u(Type, {
8076
+ size: 14,
8077
+ "aria-hidden": "true"
6731
8078
  })]
6732
- }) : null]
6733
- });
6734
- }
6735
- function NumericStepperButton(props) {
6736
- return /* @__PURE__ */ u("button", {
6737
- type: "button",
6738
- "data-action": `numeric-${props.action}`,
6739
- tabIndex: -1,
6740
- disabled: props.disabled,
6741
- "aria-label": props.label,
6742
- onPointerDown: (event) => {
6743
- event.preventDefault();
6744
- props.onKeepFocus();
6745
- },
6746
- onClick: (event) => {
6747
- props.onStep(event.shiftKey, event.altKey);
6748
- },
6749
- style: {
6750
- width: "100%",
6751
- minWidth: 0,
6752
- height: "100%",
6753
- display: "grid",
6754
- placeItems: "center",
6755
- boxSizing: "border-box",
6756
- border: 0,
6757
- padding: 0,
6758
- background: "transparent"
6759
- },
6760
- children: /* @__PURE__ */ u("span", {
6761
- style: {
6762
- width: "100%",
6763
- alignSelf: "stretch",
6764
- justifySelf: "stretch",
6765
- display: "grid",
6766
- placeItems: "center",
6767
- borderRadius: "3px",
6768
- background: "#dbe3ef",
6769
- marginBottom: props.direction === "up" ? "1px" : 0,
6770
- marginTop: props.direction === "down" ? "1px" : 0
8079
+ }), /* @__PURE__ */ u(ShadowMenu, {
8080
+ open: menuOpen,
8081
+ onOpenChange: (open) => {
8082
+ menuOpen.value = open;
6771
8083
  },
6772
- children: /* @__PURE__ */ u("span", {
6773
- "aria-hidden": "true",
8084
+ anchor: () => trigger.current,
8085
+ ariaLabel: "Font token selector",
8086
+ class: "panda-token-selector-menu",
8087
+ initialFocus: () => searchInput.current,
8088
+ children: [/* @__PURE__ */ u("input", {
8089
+ ref: searchInput,
8090
+ type: "text",
8091
+ "data-font-token-search": "true",
8092
+ value: query.value,
8093
+ placeholder: "Filter font tokens...",
8094
+ disabled: props.saving.value,
8095
+ onInput: (event) => {
8096
+ query.value = event.currentTarget.value;
8097
+ activeOptionId.value = void 0;
8098
+ },
8099
+ onKeyDown: (event) => {
8100
+ if ((event.metaKey || event.ctrlKey) && event.key === "Backspace") {
8101
+ event.preventDefault();
8102
+ menuOpen.value = false;
8103
+ props.onModBackspace();
8104
+ return;
8105
+ }
8106
+ if (event.key === "Escape") {
8107
+ event.preventDefault();
8108
+ menuOpen.value = false;
8109
+ return;
8110
+ }
8111
+ if (event.key === "ArrowDown") {
8112
+ event.preventDefault();
8113
+ event.stopPropagation();
8114
+ moveActiveOption(1);
8115
+ return;
8116
+ }
8117
+ if (event.key === "ArrowUp") {
8118
+ event.preventDefault();
8119
+ event.stopPropagation();
8120
+ moveActiveOption(-1);
8121
+ return;
8122
+ }
8123
+ if (event.key === "Enter") {
8124
+ event.preventDefault();
8125
+ selectActiveOption();
8126
+ }
8127
+ },
6774
8128
  style: {
6775
- width: 0,
6776
- height: 0,
6777
- borderLeft: "3px solid transparent",
6778
- borderRight: "3px solid transparent",
6779
- borderBottom: props.direction === "up" ? "4px solid #344054" : void 0,
6780
- borderTop: props.direction === "down" ? "4px solid #344054" : void 0
8129
+ minWidth: 0,
8130
+ width: "100%",
8131
+ border: "1px solid #d6dde8",
8132
+ borderRadius: "5px",
8133
+ padding: "5px 7px",
8134
+ color: "#172033",
8135
+ background: "#fff"
6781
8136
  }
6782
- })
6783
- })
8137
+ }), /* @__PURE__ */ u("div", {
8138
+ ref: optionList,
8139
+ role: "listbox",
8140
+ "data-font-token-list": "true",
8141
+ style: {
8142
+ display: "grid",
8143
+ gap: "2px",
8144
+ maxHeight: "232px",
8145
+ overflow: "auto",
8146
+ minHeight: "32px"
8147
+ },
8148
+ children: filteredOptions.value.length === 0 ? /* @__PURE__ */ u("div", {
8149
+ "data-font-token-no-matches": "true",
8150
+ style: {
8151
+ color: "#667085",
8152
+ padding: "7px 8px"
8153
+ },
8154
+ children: "No matching font tokens."
8155
+ }) : hasFilterQuery.value ? filteredOptions.value.map((option) => renderTokenOption(option)) : groupedOptions.value.map((group) => /* @__PURE__ */ u("div", {
8156
+ "data-font-token-group": group.presetName ? `${group.presetName} / ${group.label}` : group.label,
8157
+ children: [
8158
+ group.presetName ? /* @__PURE__ */ u("div", {
8159
+ "data-font-token-preset-label": "true",
8160
+ style: {
8161
+ borderTop: "1px solid #e6ebf2",
8162
+ color: "#344054",
8163
+ fontSize: "11px",
8164
+ fontWeight: 700,
8165
+ padding: "8px 8px 1px"
8166
+ },
8167
+ children: group.presetName
8168
+ }) : null,
8169
+ /* @__PURE__ */ u("div", {
8170
+ "data-font-token-group-label": "true",
8171
+ style: {
8172
+ color: "#667085",
8173
+ fontSize: "11px",
8174
+ fontWeight: 700,
8175
+ padding: "6px 8px 2px",
8176
+ textTransform: "uppercase"
8177
+ },
8178
+ children: group.label
8179
+ }),
8180
+ group.options.map((option) => renderTokenOption(option))
8181
+ ]
8182
+ }, `${group.label}:${group.presetName ?? ""}`))
8183
+ })]
8184
+ })]
6784
8185
  });
6785
8186
  }
6786
- function steppedNumericInputValue(input) {
6787
- const trimmedValue = input.value.trim();
6788
- const match = NUMERIC_INPUT_PATTERN.exec(trimmedValue);
6789
- if (!match?.groups) return void 0;
6790
- const current = Number(match.groups.number);
6791
- if (!Number.isFinite(current)) return void 0;
6792
- const unit = match.groups.unit ?? "";
6793
- if (input.property === "opacity" && unit) return void 0;
6794
- const step = numericInputStep(input.property, input.shiftKey === true, input.altKey === true);
6795
- return `${formatSteppedNumber(boundedNumericInputValue(input.property, current + input.direction * step), match.groups.number, step)}${unit}`;
6796
- }
6797
- function isSteppableNumericInput(property, value) {
6798
- return steppedNumericInputValue({
6799
- property,
6800
- value,
6801
- direction: 1
6802
- }) !== void 0;
6803
- }
6804
- function numericInputStep(property, shiftKey, altKey) {
6805
- if (property === "opacity") {
6806
- if (shiftKey && altKey) return 1e-4;
6807
- if (shiftKey) return .1;
6808
- if (altKey) return .001;
6809
- return .01;
6810
- }
6811
- if (property === "lineHeight") {
6812
- if (shiftKey && altKey) return 1e-4;
6813
- if (shiftKey) return .1;
6814
- if (altKey) return .001;
6815
- return .01;
6816
- }
6817
- const step = shiftKey && altKey ? .01 : shiftKey ? 10 : altKey ? .1 : 1;
6818
- if (property === "fontWeight") return shiftKey && !altKey ? 100 : Math.max(step, 10);
6819
- return step;
6820
- }
6821
- function boundedNumericInputValue(property, value) {
6822
- if (property === "opacity") return Math.min(1, Math.max(0, value));
6823
- if (NON_NEGATIVE_NUMERIC_PROPERTIES.has(property)) return Math.max(0, value);
6824
- return value;
6825
- }
6826
- function formatSteppedNumber(value, originalNumber, step) {
6827
- const precision = Math.max(decimalPlaces(originalNumber), decimalPlaces(String(step)));
6828
- const fixed = value.toFixed(precision);
6829
- return fixed.includes(".") ? fixed.replace(/\.?0+$/, "") : fixed;
6830
- }
6831
- function decimalPlaces(value) {
6832
- return value.includes(".") ? value.split(".")[1]?.length ?? 0 : 0;
6833
- }
6834
8187
  //#endregion
6835
8188
  //#region src/ui/inputs/shorthandValueInput.tsx
6836
8189
  const BOX_SHORTHAND_PROPERTIES = new Set([
@@ -6838,8 +8191,7 @@ const BOX_SHORTHAND_PROPERTIES = new Set([
6838
8191
  "margin",
6839
8192
  "inset",
6840
8193
  "borderWidth",
6841
- "borderStyle",
6842
- "borderColor"
8194
+ "borderStyle"
6843
8195
  ]);
6844
8196
  const RADIUS_SHORTHAND_PROPERTIES = new Set(["borderRadius"]);
6845
8197
  const BORDER_COMPOUND_SHORTHAND_PROPERTIES = new Set(["border", "outline"]);
@@ -6869,6 +8221,9 @@ function ShorthandValueInput(props) {
6869
8221
  const showInvalid = props.invalid && focusedPart.value === void 0;
6870
8222
  const borderColor = showInvalid ? "#fca5a5" : props.changed ? "#93c5fd" : "#d6dde8";
6871
8223
  const background = showInvalid ? "#fef2f2" : props.changed ? "#eff6ff" : "#fff";
8224
+ const expandedWidth = model?.lockableBox ? `calc(48px + 6px + ${props.inputWidth} + 6px + 22px)` : `calc(48px + 6px + ${props.inputWidth})`;
8225
+ const inputWidthPixels = props.inputWidth.match(/^(\d+(?:\.\d+)?)px$/)?.[1];
8226
+ const nestedPartInputWidth = inputWidthPixels ? `${Math.max(0, Number(inputWidthPixels) - 54)}px` : `calc(${props.inputWidth} - 54px)`;
6872
8227
  const focusFirstExpandedControl = () => {
6873
8228
  const control = firstInput.current ?? expandedRoot.current?.querySelector("input:not(:disabled), button:not(:disabled)");
6874
8229
  control?.focus();
@@ -6876,10 +8231,14 @@ function ShorthandValueInput(props) {
6876
8231
  };
6877
8232
  _$2(() => {
6878
8233
  if (variant !== "placeholder" && props.focusRequest === "expanded-first") {
6879
- focusFirstExpandedControl();
6880
- props.onFocusRequestHandled();
8234
+ const timer = setTimeout(() => {
8235
+ focusFirstExpandedControl();
8236
+ props.onFocusRequestHandled();
8237
+ }, 0);
6881
8238
  wasExpanded.current = props.expanded;
6882
- return;
8239
+ return () => {
8240
+ clearTimeout(timer);
8241
+ };
6883
8242
  }
6884
8243
  if (variant === "placeholder" || !props.expanded || wasExpanded.current) {
6885
8244
  wasExpanded.current = props.expanded;
@@ -6887,7 +8246,7 @@ function ShorthandValueInput(props) {
6887
8246
  }
6888
8247
  focusFirstExpandedControl();
6889
8248
  wasExpanded.current = props.expanded;
6890
- }, [props.expanded]);
8249
+ }, [props.expanded, props.focusRequest]);
6891
8250
  if (!model) return null;
6892
8251
  const collapsedValue = model.serialize(model.parts);
6893
8252
  const updatePart = (key, value, mode = "input") => {
@@ -6959,7 +8318,7 @@ function ShorthandValueInput(props) {
6959
8318
  display: "grid",
6960
8319
  gap: "4px",
6961
8320
  minWidth: 0,
6962
- width: `calc(48px + 6px + ${props.inputWidth})`
8321
+ width: expandedWidth
6963
8322
  },
6964
8323
  children: model.parts.map((part) => /* @__PURE__ */ u("label", {
6965
8324
  style: {
@@ -6978,7 +8337,31 @@ function ShorthandValueInput(props) {
6978
8337
  },
6979
8338
  children: part.label
6980
8339
  }),
6981
- shouldUseColorTokenSelector(part.inputPath, part.value, props.colorTokenOptions.value) ? /* @__PURE__ */ u(ColorTokenValueInput, {
8340
+ shouldUseColorTokenSelector(part.inputPath, part.value, props.colorTokenOptions.value) && colorTokenOpacityInputValue(part.value) ? /* @__PURE__ */ u(ColorTokenOpacityInput, {
8341
+ targetId: props.targetId,
8342
+ path: part.inputPath,
8343
+ pathLabel: props.pathLabel,
8344
+ originalValue: props.originalValue,
8345
+ value: part.value,
8346
+ changed: props.changed,
8347
+ invalid: props.invalid,
8348
+ expanded: true,
8349
+ variant: "expanded-parts",
8350
+ inputWidth: nestedPartInputWidth,
8351
+ autoOpen: noAutoFocus,
8352
+ options: props.colorTokenOptions,
8353
+ tokenSources: props.tokenSources,
8354
+ saving: props.saving,
8355
+ onAutoOpenHandled: () => {},
8356
+ onExpand: () => {},
8357
+ onCollapse: props.onCollapse,
8358
+ onPreviewInput: (_editId, _path, _originalValue, value, mode) => {
8359
+ updatePart(part.key, value, mode);
8360
+ },
8361
+ onModBackspace: props.onModBackspace,
8362
+ onCreateToken: props.onCreateToken,
8363
+ onMenuOpenChange: props.onMenuOpenChange
8364
+ }) : shouldUseColorTokenSelector(part.inputPath, part.value, props.colorTokenOptions.value) ? /* @__PURE__ */ u(ColorTokenValueInput, {
6982
8365
  targetId: props.targetId,
6983
8366
  path: part.inputPath,
6984
8367
  pathLabel: props.pathLabel,
@@ -7219,7 +8602,7 @@ function splitShorthandValue(value) {
7219
8602
  return parts;
7220
8603
  }
7221
8604
  function isSupportedPandaTokenReference(value) {
7222
- return pandaTokenPathFromValue(value, "colors") !== void 0 || pandaTokenPathFromValue(value, "fonts") !== void 0;
8605
+ return pandaColorTokenValueFromString(value) !== void 0 || pandaTokenPathFromValue(value, "colors") !== void 0 || pandaTokenPathFromValue(value, "fonts") !== void 0;
7223
8606
  }
7224
8607
  function expandBoxValues(parts) {
7225
8608
  const top = parts[0] ?? "";
@@ -7755,6 +9138,7 @@ function InspectorPanel(props) {
7755
9138
  const inspectCursorActive = A$1(false);
7756
9139
  const selectedElement = A$1();
7757
9140
  const selectedElementAutofocusRevision = useSignal(0);
9141
+ const propertyFilterQuery = useSignal("");
7758
9142
  const shell = A$1(null);
7759
9143
  const contentScroller = A$1(null);
7760
9144
  const previousPreviewBarVisible = A$1(false);
@@ -8275,7 +9659,12 @@ function InspectorPanel(props) {
8275
9659
  });
8276
9660
  commitPreviewHistoryStep(before, next);
8277
9661
  applyPreviewState(next);
8278
- addedInputActivationRequest.value = {
9662
+ if (pandaPreviewRootProperty(path) === "boxShadow" || shorthandValueInputBehavior(path, value) !== void 0) {
9663
+ const key = previewChangeKey(editId, path);
9664
+ expandedShorthandInputs.value = new Set([...expandedShorthandInputs.value, key]);
9665
+ shorthandFocusRequest.value = { key };
9666
+ addedInputActivationRequest.value = null;
9667
+ } else addedInputActivationRequest.value = {
8279
9668
  targetId: editId,
8280
9669
  pathLabel: path.join(".")
8281
9670
  };
@@ -8351,25 +9740,33 @@ function InspectorPanel(props) {
8351
9740
  if (styleModuleCreateEditIds.has(change.editId)) continue;
8352
9741
  changesByEditId.set(change.editId, [...changesByEditId.get(change.editId) ?? [], change]);
8353
9742
  }
8354
- return Array.from(changesByEditId, ([editId, changes]) => {
8355
- const entry = runtime.getEntry(editId);
8356
- return {
8357
- editId,
8358
- kind: "panda-css",
8359
- edits: changes.map((change) => {
8360
- if (change.op === "delete") return {
8361
- op: "delete",
8362
- path: change.path
8363
- };
8364
- return {
8365
- op: "set",
8366
- path: change.path,
8367
- value: change.value
8368
- };
8369
- }),
8370
- options: { expectedSourceHash: entry?.sourceHash }
8371
- };
8372
- });
9743
+ const missingTargetIds = Array.from(changesByEditId.keys()).filter((editId) => !runtime.getEntry(editId));
9744
+ if (missingTargetIds.length > 0) return {
9745
+ ok: false,
9746
+ missingTargetIds
9747
+ };
9748
+ return {
9749
+ ok: true,
9750
+ requests: Array.from(changesByEditId, ([editId, changes]) => {
9751
+ const entry = runtime.getEntry(editId);
9752
+ return {
9753
+ editId,
9754
+ kind: "panda-css",
9755
+ edits: changes.map((change) => {
9756
+ if (change.op === "delete") return {
9757
+ op: "delete",
9758
+ path: change.path
9759
+ };
9760
+ return {
9761
+ op: "set",
9762
+ path: change.path,
9763
+ value: change.value
9764
+ };
9765
+ }),
9766
+ options: { expectedSourceHash: entry?.sourceHash }
9767
+ };
9768
+ })
9769
+ };
8373
9770
  };
8374
9771
  const createInlineSourceRequests = () => {
8375
9772
  flushPreviewHistoryBatch();
@@ -8440,23 +9837,36 @@ function InspectorPanel(props) {
8440
9837
  });
8441
9838
  };
8442
9839
  const savePreviewChanges = () => {
8443
- const requests = createStyleEditRequests();
8444
9840
  const inlineSourceRequests = createInlineSourceRequests();
8445
9841
  const styleModuleRequests = createStyleModuleRequests();
8446
- if (requests.length === 0 && inlineSourceRequests.length === 0 && styleModuleRequests.length === 0) return;
8447
9842
  saveFlow.value = { status: "saving" };
8448
- const saveOperationCount = (requests.length > 0 ? 1 : 0) + inlineSourceRequests.length + styleModuleRequests.length;
8449
- const requestResponses = (write) => {
8450
- const styleResponses = requests.length > 0 ? runtime.requestStyleEditBatch(requests, write) : Promise.resolve([]);
8451
- const inlineSourceResponses = Promise.all(inlineSourceRequests.map((request) => runtime.requestInlineCssSource(request, write)));
8452
- const styleModuleResponses = Promise.all(styleModuleRequests.map((request) => runtime.requestStyleModuleEdit(request, write)));
8453
- return Promise.all([
8454
- styleResponses,
8455
- inlineSourceResponses,
8456
- styleModuleResponses
8457
- ]).then((responses) => responses.flat());
8458
- };
8459
9843
  (async () => {
9844
+ await runtime.loadManifest();
9845
+ const styleRequestResult = createStyleEditRequests();
9846
+ if (!styleRequestResult.ok) {
9847
+ saveFlow.value = {
9848
+ status: "error",
9849
+ message: `Selected source target is stale: ${styleRequestResult.missingTargetIds.join(" ")}`
9850
+ };
9851
+ await refreshSelectedElementInfo();
9852
+ return;
9853
+ }
9854
+ const requests = styleRequestResult.requests;
9855
+ if (requests.length === 0 && inlineSourceRequests.length === 0 && styleModuleRequests.length === 0) {
9856
+ saveFlow.value = { status: "idle" };
9857
+ return;
9858
+ }
9859
+ const saveOperationCount = (requests.length > 0 ? 1 : 0) + inlineSourceRequests.length + styleModuleRequests.length;
9860
+ const requestResponses = (write) => {
9861
+ const styleResponses = requests.length > 0 ? runtime.requestStyleEditBatch(requests, write) : Promise.resolve([]);
9862
+ const inlineSourceResponses = Promise.all(inlineSourceRequests.map((request) => runtime.requestInlineCssSource(request, write)));
9863
+ const styleModuleResponses = Promise.all(styleModuleRequests.map((request) => runtime.requestStyleModuleEdit(request, write)));
9864
+ return Promise.all([
9865
+ styleResponses,
9866
+ inlineSourceResponses,
9867
+ styleModuleResponses
9868
+ ]).then((responses) => responses.flat());
9869
+ };
8460
9870
  if (saveOperationCount > 1) {
8461
9871
  const dryRunFailure = (await requestResponses(false)).find((response) => !response.ok);
8462
9872
  if (dryRunFailure) {
@@ -8771,8 +10181,13 @@ function InspectorPanel(props) {
8771
10181
  disabled: saving,
8772
10182
  onToggle: toggleForcedPreviewState
8773
10183
  }) : null,
10184
+ view.value.editableTargets.length > 0 || view.value.inheritedTargets.length > 0 ? /* @__PURE__ */ u(PropertyFilterInput, {
10185
+ query: propertyFilterQuery,
10186
+ saving
10187
+ }) : null,
8774
10188
  /* @__PURE__ */ u(EditableTargetsSection, {
8775
10189
  view,
10190
+ propertyFilterQuery,
8776
10191
  preview,
8777
10192
  elementStyleModule,
8778
10193
  forcedPreviewStates,
@@ -8837,6 +10252,7 @@ function InspectorPanel(props) {
8837
10252
  heading: "Inherited Styles",
8838
10253
  targets: view.value.inheritedTargets,
8839
10254
  view,
10255
+ propertyFilterQuery,
8840
10256
  preview,
8841
10257
  forcedPreviewStates,
8842
10258
  expandedShorthandInputs,
@@ -9022,6 +10438,12 @@ function selectedElementAutofocusKey(info, selectionRevision) {
9022
10438
  }
9023
10439
  function focusInitialInspectorEditControl(shell) {
9024
10440
  if (!shell) return;
10441
+ const propertyFilter = shell.querySelector("input[data-inspector-property-filter=\"true\"]:not(:disabled)");
10442
+ if (propertyFilter) {
10443
+ propertyFilter.focus();
10444
+ propertyFilter.select();
10445
+ return;
10446
+ }
9025
10447
  const firstPropertyControl = shell.querySelector([
9026
10448
  "input[data-preview-target-id][data-preview-path]:not(:disabled)",
9027
10449
  "button[data-preview-target-id][data-preview-path]:not(:disabled):not([data-action])",
@@ -9034,6 +10456,15 @@ function focusInitialInspectorEditControl(shell) {
9034
10456
  }
9035
10457
  shell.querySelector("button[data-action=\"create-inline-source\"]:not(:disabled)")?.focus();
9036
10458
  }
10459
+ function focusFirstVisiblePropertyMatch(shell) {
10460
+ const firstVisibleRow = shell.querySelector("[data-preview-row-path]");
10461
+ (firstVisibleRow?.querySelector([
10462
+ "input[data-preview-target-id][data-preview-path]:not(:disabled)",
10463
+ "button[data-preview-target-id][data-preview-path]:not(:disabled):not([data-action])",
10464
+ "select[data-preview-target-id][data-preview-path]:not(:disabled)",
10465
+ "textarea[data-preview-target-id][data-preview-path]:not(:disabled)"
10466
+ ].join(",")) ?? firstVisibleRow?.querySelector("button[data-preview-path-label]:not(:disabled)"))?.focus();
10467
+ }
9037
10468
  function isPreviewValueControl(element) {
9038
10469
  if (!element.hasAttribute("data-preview-target-id")) return false;
9039
10470
  if (!element.hasAttribute("data-preview-path")) return false;
@@ -9561,7 +10992,7 @@ function StyleModuleSection(props) {
9561
10992
  });
9562
10993
  }
9563
10994
  function EditableTargetsSection(props) {
9564
- const { view, targets, preview, elementStyleModule, heading = "Style Sources", forcedPreviewStates, expandedShorthandInputs, shorthandFocusRequest, colorTokenOptions, fontTokenOptions, tokenSources, propertyOptions, saving, addedInputActivationRequest, onPreviewInput, onCreateColorToken, onAddedInputActivationHandled, onAddProperty, onCreateInlineSource, onAttachStyleModuleSource, onDetachStyleModuleSource, onRemoveProperty, onFocusRestoreButton, onFocusPreviewControl, onRestoreProperty, onHighlightSourceTarget, onClearHighlight, onOpenSource, onInputMenuOpenChange, onToggleShorthandInput, onExpandShorthandInput, onCollapseShorthandInput, onRequestShorthandFocus, onShorthandFocusRequestHandled } = props;
10995
+ const { view, targets, propertyFilterQuery, preview, elementStyleModule, heading = "Style Sources", forcedPreviewStates, expandedShorthandInputs, shorthandFocusRequest, colorTokenOptions, fontTokenOptions, tokenSources, propertyOptions, saving, addedInputActivationRequest, onPreviewInput, onCreateColorToken, onAddedInputActivationHandled, onAddProperty, onCreateInlineSource, onAttachStyleModuleSource, onDetachStyleModuleSource, onRemoveProperty, onFocusRestoreButton, onFocusPreviewControl, onRestoreProperty, onHighlightSourceTarget, onClearHighlight, onOpenSource, onInputMenuOpenChange, onToggleShorthandInput, onExpandShorthandInput, onCollapseShorthandInput, onRequestShorthandFocus, onShorthandFocusRequestHandled } = props;
9565
10996
  const sourceManagementEnabled = targets === void 0;
9566
10997
  const baseEditableTargets = targets ?? view.value.editableTargets;
9567
10998
  const inspectedJsxSource = view.value.inspectedJsxSource;
@@ -9602,8 +11033,21 @@ function EditableTargetsSection(props) {
9602
11033
  ...pendingAttachedStyleSourceTargets,
9603
11034
  ...pendingInlineSourceTarget ? [pendingInlineSourceTarget] : []
9604
11035
  ];
9605
- const inlineSourceCreate = sourceManagementEnabled && view.value.inlineSourceCreate && !pendingInlineSourceTarget ? view.value.inlineSourceCreate : void 0;
9606
- if (editableTargets.length === 0 && (!sourceManagementEnabled || !inlineSourceCreate) && (!sourceManagementEnabled || !canAttachStyleSource)) return null;
11036
+ const propertyFilterText = propertyFilterQuery?.value.trim() ?? "";
11037
+ const propertyFilterActive = propertyFilterText.length > 0;
11038
+ const targetPanels = editableTargets.flatMap((target) => {
11039
+ const rows = targetRowsWithPendingChanges(target, preview.changes.value);
11040
+ const visibleRows = propertyFilterActive ? filteredPropertyRows(propertyFilterText, rows) : rows;
11041
+ if (propertyFilterActive && visibleRows.length === 0) return [];
11042
+ return [{
11043
+ target,
11044
+ rows,
11045
+ rowGroups: groupedEditableRows(visibleRows)
11046
+ }];
11047
+ });
11048
+ const inspectedElementSourceLocation = sourceManagementEnabled && editableTargets.length === 0 && inspectedJsxSource ? inspectedJsxSource : void 0;
11049
+ const inlineSourceCreate = sourceManagementEnabled && !propertyFilterActive && view.value.inlineSourceCreate && !pendingInlineSourceTarget ? view.value.inlineSourceCreate : void 0;
11050
+ if (targetPanels.length === 0 && !inspectedElementSourceLocation && (!sourceManagementEnabled || !inlineSourceCreate) && (!sourceManagementEnabled || propertyFilterActive || !canAttachStyleSource)) return null;
9607
11051
  return /* @__PURE__ */ u("section", {
9608
11052
  "data-editable-sources-section": "true",
9609
11053
  children: [
@@ -9614,7 +11058,7 @@ function EditableTargetsSection(props) {
9614
11058
  },
9615
11059
  children: heading
9616
11060
  }) : null,
9617
- sourceManagementEnabled && (inlineSourceCreate || canAttachStyleSource) ? /* @__PURE__ */ u("div", {
11061
+ sourceManagementEnabled && !propertyFilterActive && (inlineSourceCreate || canAttachStyleSource) ? /* @__PURE__ */ u("div", {
9618
11062
  style: {
9619
11063
  display: "flex",
9620
11064
  flexWrap: "wrap",
@@ -9649,7 +11093,43 @@ function EditableTargetsSection(props) {
9649
11093
  onMenuOpenChange: onInputMenuOpenChange
9650
11094
  }) : null]
9651
11095
  }) : null,
9652
- editableTargets.map((target, targetIndex) => /* @__PURE__ */ u("div", {
11096
+ inspectedElementSourceLocation ? /* @__PURE__ */ u("div", {
11097
+ "data-inspected-jsx-source-panel": "true",
11098
+ style: {
11099
+ display: "grid",
11100
+ gap: "2px",
11101
+ marginTop: "8px",
11102
+ paddingTop: "8px",
11103
+ borderTop: "1px solid #eef2f7"
11104
+ },
11105
+ children: [/* @__PURE__ */ u("span", {
11106
+ style: {
11107
+ color: "#667085",
11108
+ fontSize: "12px"
11109
+ },
11110
+ children: "JSX element"
11111
+ }), /* @__PURE__ */ u("button", {
11112
+ type: "button",
11113
+ "data-action": "open-inspected-jsx-source-location",
11114
+ onClick: () => {
11115
+ onOpenSource(inspectedElementSourceLocation);
11116
+ },
11117
+ style: {
11118
+ minWidth: 0,
11119
+ justifySelf: "start",
11120
+ border: 0,
11121
+ padding: 0,
11122
+ background: "transparent",
11123
+ textAlign: "left",
11124
+ font: "inherit",
11125
+ whiteSpace: "normal",
11126
+ wordBreak: "break-word",
11127
+ color: "#475467"
11128
+ },
11129
+ children: /* @__PURE__ */ u("code", { children: inspectedElementSourceLocation })
11130
+ })]
11131
+ }) : null,
11132
+ targetPanels.map(({ target, rows, rowGroups }, targetIndex) => /* @__PURE__ */ u("div", {
9653
11133
  "data-editable-target-panel": "true",
9654
11134
  "data-editable-target-id": target.id,
9655
11135
  style: {
@@ -9694,6 +11174,7 @@ function EditableTargetsSection(props) {
9694
11174
  "data-action": "open-editable-source-location",
9695
11175
  "data-editable-source-identity": target.name ? void 0 : "true",
9696
11176
  "data-editable-source-target-id": target.name ? void 0 : target.id,
11177
+ tabIndex: -1,
9697
11178
  onMouseEnter: target.name ? void 0 : () => {
9698
11179
  onHighlightSourceTarget(target.id);
9699
11180
  },
@@ -9735,8 +11216,6 @@ function EditableTargetsSection(props) {
9735
11216
  ]
9736
11217
  });
9737
11218
  })(), (() => {
9738
- const rows = targetRowsWithPendingChanges(target, preview.changes.value);
9739
- const rowGroups = groupedEditableRows(rows);
9740
11219
  const activeAddPropertyPathPrefix = addPropertyPathPrefix(forcedPreviewStates.value);
9741
11220
  const defaultAddPropertyPathPrefix = rowGroups.some((group) => group.pathPrefix.join(".") === activeAddPropertyPathPrefix.join(".")) ? [] : activeAddPropertyPathPrefix;
9742
11221
  const existingPaths = rows.map((row) => row.path);
@@ -9751,13 +11230,22 @@ function EditableTargetsSection(props) {
9751
11230
  const value = row.previewValue === void 0 ? row.value : previewChange?.value ?? row.previewValue;
9752
11231
  const editable = row.previewValue !== void 0 && !removed;
9753
11232
  const invalid = editable && !isPreviewInputCssValid(path, value);
11233
+ const boxShadowInput = editable && shouldUseBoxShadowInput(path);
9754
11234
  const shorthandInputBehavior = editable ? shorthandValueInputBehavior(path, value) : void 0;
9755
11235
  const shorthandInput = shorthandInputBehavior !== void 0;
9756
- const shorthandKey = previewChangeKey(target.id, path);
9757
- const shorthandExpanded = shorthandInputBehavior === "expanded" || expandedShorthandInputs.value.has(shorthandKey);
11236
+ const expandableInputKey = previewChangeKey(target.id, path);
11237
+ const shorthandExpanded = shorthandInputBehavior === "expanded" || expandedShorthandInputs.value.has(expandableInputKey);
11238
+ const boxShadowExpanded = boxShadowInput && expandedShorthandInputs.value.has(expandableInputKey);
9758
11239
  const collapsedShorthandInput = shorthandInput && !shorthandExpanded ? shorthandCollapsedValueInput(path, value) : void 0;
11240
+ const colorTokenOpacityInput = editable && shouldUseColorTokenSelector(path, value, colorTokenOptions.value) ? colorTokenOpacityInputValue(value) : void 0;
11241
+ const colorTokenOpacityExpanded = colorTokenOpacityInput !== void 0 && expandedShorthandInputs.value.has(expandableInputKey);
11242
+ const rowExpandable = shorthandInputBehavior === "collapsible" || boxShadowInput || colorTokenOpacityInput !== void 0;
11243
+ const rowExpanded = shorthandExpanded || boxShadowExpanded || colorTokenOpacityExpanded;
9759
11244
  const labelOwnLine = displayPath.length > 18;
9760
11245
  const shorthandExpandedArea = shorthandInput && shorthandExpanded && row.previewValue !== void 0;
11246
+ const boxShadowExpandedArea = boxShadowExpanded && row.previewValue !== void 0;
11247
+ const colorTokenOpacityExpandedArea = colorTokenOpacityExpanded && row.previewValue !== void 0;
11248
+ const expandedInputArea = shorthandExpandedArea || boxShadowExpandedArea || colorTokenOpacityExpandedArea;
9761
11249
  const handleModBackspace = () => {
9762
11250
  if (changed && !added) {
9763
11251
  onRestoreProperty(target.id, path);
@@ -9775,7 +11263,7 @@ function EditableTargetsSection(props) {
9775
11263
  style: {
9776
11264
  display: "grid",
9777
11265
  gridTemplateColumns: labelOwnLine ? "minmax(0, 1fr) 24px" : `minmax(0, 1fr) ${PROPERTY_INPUT_WIDTH} 24px`,
9778
- gridTemplateAreas: shorthandExpandedArea ? labelOwnLine ? "\"label action\" \"value value\" \"expanded expanded\"" : "\"label value action\" \"expanded expanded expanded\"" : labelOwnLine ? "\"label action\" \"value value\"" : "\"label value action\"",
11266
+ gridTemplateAreas: expandedInputArea ? labelOwnLine ? "\"label action\" \"value value\" \"expanded expanded\"" : "\"label value action\" \"expanded expanded expanded\"" : labelOwnLine ? "\"label action\" \"value value\"" : "\"label value action\"",
9779
11267
  columnGap: labelOwnLine ? "0" : "8px",
9780
11268
  rowGap: "4px",
9781
11269
  marginTop: "4px",
@@ -9794,9 +11282,9 @@ function EditableTargetsSection(props) {
9794
11282
  onRestoreProperty(target.id, path);
9795
11283
  return;
9796
11284
  }
9797
- if (shorthandInputBehavior !== "collapsible") return;
11285
+ if (!rowExpandable) return;
9798
11286
  event.preventDefault();
9799
- onToggleShorthandInput(shorthandKey);
11287
+ onToggleShorthandInput(expandableInputKey);
9800
11288
  },
9801
11289
  style: {
9802
11290
  gridArea: "label",
@@ -9812,17 +11300,17 @@ function EditableTargetsSection(props) {
9812
11300
  font: "inherit",
9813
11301
  background: "transparent",
9814
11302
  color: "inherit",
9815
- cursor: shorthandInputBehavior === "collapsible" ? "pointer" : "default",
11303
+ cursor: rowExpandable ? "pointer" : "default",
9816
11304
  whiteSpace: labelOwnLine ? "normal" : "nowrap",
9817
11305
  overflowWrap: "anywhere",
9818
11306
  textDecoration: removed ? "line-through" : "none"
9819
11307
  },
9820
- children: [/* @__PURE__ */ u("code", { children: displayPath }), shorthandInputBehavior === "collapsible" ? /* @__PURE__ */ u(ChevronRight, {
11308
+ children: [/* @__PURE__ */ u("code", { children: displayPath }), rowExpandable ? /* @__PURE__ */ u(ChevronRight, {
9821
11309
  size: 13,
9822
11310
  "aria-hidden": "true",
9823
11311
  style: {
9824
11312
  flex: "0 0 auto",
9825
- transform: shorthandExpanded ? "rotate(90deg)" : void 0
11313
+ transform: rowExpanded ? "rotate(90deg)" : void 0
9826
11314
  }
9827
11315
  }) : null]
9828
11316
  }),
@@ -9842,6 +11330,33 @@ function EditableTargetsSection(props) {
9842
11330
  wordBreak: "break-word"
9843
11331
  },
9844
11332
  children: row.value
11333
+ }) : colorTokenOpacityInput ? /* @__PURE__ */ u(ColorTokenOpacityInput, {
11334
+ targetId: target.id,
11335
+ path,
11336
+ pathLabel: row.path,
11337
+ originalValue: row.previewValue,
11338
+ value,
11339
+ changed,
11340
+ invalid,
11341
+ expanded: colorTokenOpacityExpanded,
11342
+ variant: colorTokenOpacityExpanded ? "placeholder" : "full",
11343
+ inputWidth: PROPERTY_INPUT_WIDTH,
11344
+ autoOpen: addedInputActivationRequest,
11345
+ options: colorTokenOptions,
11346
+ tokenSources,
11347
+ saving,
11348
+ onAutoOpenHandled: onAddedInputActivationHandled,
11349
+ onExpand: () => {
11350
+ onExpandShorthandInput(expandableInputKey);
11351
+ },
11352
+ onCollapse: () => {
11353
+ onCollapseShorthandInput(expandableInputKey);
11354
+ onFocusPreviewControl(target.id, path);
11355
+ },
11356
+ onPreviewInput,
11357
+ onModBackspace: handleModBackspace,
11358
+ onCreateToken: onCreateColorToken,
11359
+ onMenuOpenChange: onInputMenuOpenChange
9845
11360
  }) : collapsedShorthandInput?.editable && shouldUseColorTokenSelector(path, collapsedShorthandInput.value, colorTokenOptions.value) ? /* @__PURE__ */ u(ColorTokenValueInput, {
9846
11361
  targetId: target.id,
9847
11362
  path,
@@ -9860,8 +11375,8 @@ function EditableTargetsSection(props) {
9860
11375
  onCreateToken: onCreateColorToken,
9861
11376
  onMenuOpenChange: onInputMenuOpenChange,
9862
11377
  onArrowRight: () => {
9863
- onExpandShorthandInput(shorthandKey);
9864
- onRequestShorthandFocus({ key: shorthandKey });
11378
+ onExpandShorthandInput(expandableInputKey);
11379
+ onRequestShorthandFocus({ key: expandableInputKey });
9865
11380
  }
9866
11381
  }) : collapsedShorthandInput?.editable ? /* @__PURE__ */ u(RawValueInput, {
9867
11382
  targetId: target.id,
@@ -9877,8 +11392,8 @@ function EditableTargetsSection(props) {
9877
11392
  onPreviewInput,
9878
11393
  onModBackspace: handleModBackspace,
9879
11394
  onArrowRight: () => {
9880
- onExpandShorthandInput(shorthandKey);
9881
- onRequestShorthandFocus({ key: shorthandKey });
11395
+ onExpandShorthandInput(expandableInputKey);
11396
+ onRequestShorthandFocus({ key: expandableInputKey });
9882
11397
  }
9883
11398
  }) : shorthandInput ? /* @__PURE__ */ u(ShorthandValueInput, {
9884
11399
  targetId: target.id,
@@ -9890,15 +11405,15 @@ function EditableTargetsSection(props) {
9890
11405
  invalid,
9891
11406
  expanded: shorthandExpanded,
9892
11407
  variant: shorthandExpanded ? "placeholder" : "full",
9893
- focusRequest: shorthandFocusRequest.value?.key === shorthandKey ? "expanded-first" : null,
11408
+ focusRequest: shorthandFocusRequest.value?.key === expandableInputKey ? "expanded-first" : null,
9894
11409
  colorTokenOptions,
9895
11410
  tokenSources,
9896
11411
  saving,
9897
11412
  onExpand: () => {
9898
- onExpandShorthandInput(shorthandKey);
11413
+ onExpandShorthandInput(expandableInputKey);
9899
11414
  },
9900
11415
  onCollapse: () => {
9901
- onCollapseShorthandInput(shorthandKey);
11416
+ onCollapseShorthandInput(expandableInputKey);
9902
11417
  onFocusPreviewControl(target.id, path);
9903
11418
  },
9904
11419
  onFocusRequestHandled: onShorthandFocusRequestHandled,
@@ -9907,6 +11422,32 @@ function EditableTargetsSection(props) {
9907
11422
  onCreateToken: onCreateColorToken,
9908
11423
  onMenuOpenChange: onInputMenuOpenChange,
9909
11424
  inputWidth: PROPERTY_INPUT_WIDTH
11425
+ }) : boxShadowInput ? /* @__PURE__ */ u(BoxShadowInput, {
11426
+ targetId: target.id,
11427
+ path,
11428
+ pathLabel: row.path,
11429
+ originalValue: row.previewValue,
11430
+ value,
11431
+ changed,
11432
+ invalid,
11433
+ variant: "placeholder",
11434
+ focusRequest: null,
11435
+ saving,
11436
+ onExpand: () => {
11437
+ onExpandShorthandInput(expandableInputKey);
11438
+ onRequestShorthandFocus({ key: expandableInputKey });
11439
+ },
11440
+ onCollapse: () => {
11441
+ onCollapseShorthandInput(expandableInputKey);
11442
+ onFocusPreviewControl(target.id, path);
11443
+ },
11444
+ onFocusRequestHandled: onShorthandFocusRequestHandled,
11445
+ onPreviewInput,
11446
+ colorTokenOptions,
11447
+ tokenSources,
11448
+ onCreateToken: onCreateColorToken,
11449
+ onMenuOpenChange: onInputMenuOpenChange,
11450
+ onModBackspace: handleModBackspace
9910
11451
  }) : shouldUseColorTokenSelector(path, value, colorTokenOptions.value) ? /* @__PURE__ */ u(ColorTokenValueInput, {
9911
11452
  targetId: target.id,
9912
11453
  path,
@@ -10049,15 +11590,15 @@ function EditableTargetsSection(props) {
10049
11590
  invalid,
10050
11591
  expanded: true,
10051
11592
  variant: "expanded-parts",
10052
- focusRequest: shorthandFocusRequest.value?.key === shorthandKey ? "expanded-first" : null,
11593
+ focusRequest: shorthandFocusRequest.value?.key === expandableInputKey ? "expanded-first" : null,
10053
11594
  colorTokenOptions,
10054
11595
  tokenSources,
10055
11596
  saving,
10056
11597
  onExpand: () => {
10057
- onExpandShorthandInput(shorthandKey);
11598
+ onExpandShorthandInput(expandableInputKey);
10058
11599
  },
10059
11600
  onCollapse: () => {
10060
- onCollapseShorthandInput(shorthandKey);
11601
+ onCollapseShorthandInput(expandableInputKey);
10061
11602
  onFocusPreviewControl(target.id, path);
10062
11603
  },
10063
11604
  onFocusRequestHandled: onShorthandFocusRequestHandled,
@@ -10067,6 +11608,72 @@ function EditableTargetsSection(props) {
10067
11608
  onMenuOpenChange: onInputMenuOpenChange,
10068
11609
  inputWidth: PROPERTY_INPUT_WIDTH
10069
11610
  })
11611
+ }) : boxShadowExpandedArea && row.previewValue !== void 0 ? /* @__PURE__ */ u("div", {
11612
+ "data-box-shadow-expanded-area": "true",
11613
+ style: {
11614
+ gridArea: "expanded",
11615
+ minWidth: 0
11616
+ },
11617
+ children: /* @__PURE__ */ u(BoxShadowInput, {
11618
+ targetId: target.id,
11619
+ path,
11620
+ pathLabel: row.path,
11621
+ originalValue: row.previewValue,
11622
+ value,
11623
+ changed,
11624
+ invalid,
11625
+ variant: "expanded",
11626
+ focusRequest: shorthandFocusRequest.value?.key === expandableInputKey ? "expanded-first" : null,
11627
+ saving,
11628
+ onExpand: () => {
11629
+ onExpandShorthandInput(expandableInputKey);
11630
+ },
11631
+ onCollapse: () => {
11632
+ onCollapseShorthandInput(expandableInputKey);
11633
+ onFocusPreviewControl(target.id, path);
11634
+ },
11635
+ onFocusRequestHandled: onShorthandFocusRequestHandled,
11636
+ onPreviewInput,
11637
+ colorTokenOptions,
11638
+ tokenSources,
11639
+ onCreateToken: onCreateColorToken,
11640
+ onMenuOpenChange: onInputMenuOpenChange,
11641
+ onModBackspace: handleModBackspace
11642
+ })
11643
+ }) : colorTokenOpacityExpandedArea && row.previewValue !== void 0 ? /* @__PURE__ */ u("div", {
11644
+ "data-color-token-opacity-expanded-area": "true",
11645
+ style: {
11646
+ gridArea: "expanded",
11647
+ minWidth: 0
11648
+ },
11649
+ children: /* @__PURE__ */ u(ColorTokenOpacityInput, {
11650
+ targetId: target.id,
11651
+ path,
11652
+ pathLabel: row.path,
11653
+ originalValue: row.previewValue,
11654
+ value,
11655
+ changed,
11656
+ invalid,
11657
+ expanded: true,
11658
+ variant: "expanded-parts",
11659
+ inputWidth: PROPERTY_INPUT_WIDTH,
11660
+ autoOpen: addedInputActivationRequest,
11661
+ options: colorTokenOptions,
11662
+ tokenSources,
11663
+ saving,
11664
+ onAutoOpenHandled: onAddedInputActivationHandled,
11665
+ onExpand: () => {
11666
+ onExpandShorthandInput(expandableInputKey);
11667
+ },
11668
+ onCollapse: () => {
11669
+ onCollapseShorthandInput(expandableInputKey);
11670
+ onFocusPreviewControl(target.id, path);
11671
+ },
11672
+ onPreviewInput,
11673
+ onModBackspace: handleModBackspace,
11674
+ onCreateToken: onCreateColorToken,
11675
+ onMenuOpenChange: onInputMenuOpenChange
11676
+ })
10070
11677
  }) : null
10071
11678
  ]
10072
11679
  }, row.path);
@@ -10089,7 +11696,7 @@ function EditableTargetsSection(props) {
10089
11696
  children: ["On ", statePathLabel(group.pathPrefix.join("."))]
10090
11697
  }) : null,
10091
11698
  group.rows.map((row) => renderEditableRow(row)),
10092
- group.condition ? /* @__PURE__ */ u(AddPropertyMenu, {
11699
+ group.condition && !propertyFilterActive ? /* @__PURE__ */ u(AddPropertyMenu, {
10093
11700
  targetId: target.id,
10094
11701
  pathPrefix: group.pathPrefix,
10095
11702
  existingPaths,
@@ -10099,7 +11706,7 @@ function EditableTargetsSection(props) {
10099
11706
  autoOpen: target.id === pendingInlineSourceTarget?.id,
10100
11707
  onAddProperty,
10101
11708
  onMenuOpenChange: onInputMenuOpenChange
10102
- }) : sourceManagementEnabled ? /* @__PURE__ */ u(AddPropertyMenu, {
11709
+ }) : sourceManagementEnabled && !propertyFilterActive ? /* @__PURE__ */ u(AddPropertyMenu, {
10103
11710
  targetId: target.id,
10104
11711
  pathPrefix: defaultAddPropertyPathPrefix,
10105
11712
  existingPaths,
@@ -10159,13 +11766,15 @@ function pandaPathSegmentForPreviewCondition(condition) {
10159
11766
  if (condition === "hover") return "_hover";
10160
11767
  if (condition === "focus") return "_focus";
10161
11768
  if (condition === "focus-visible") return "_focusVisible";
10162
- return "_active";
11769
+ if (condition === "active") return "_active";
11770
+ return "_disabled";
10163
11771
  }
10164
11772
  function statePathLabel(pathPrefixLabel) {
10165
11773
  if (pathPrefixLabel === "_hover") return "hover";
10166
11774
  if (pathPrefixLabel === "_focus") return "focus";
10167
11775
  if (pathPrefixLabel === "_focusVisible") return "focus-visible";
10168
11776
  if (pathPrefixLabel === "_active") return "active";
11777
+ if (pathPrefixLabel === "_disabled") return "disabled";
10169
11778
  return pathPrefixLabel;
10170
11779
  }
10171
11780
  function groupedEditableRows(rows) {
@@ -10346,7 +11955,7 @@ function defaultPropertyValue(property) {
10346
11955
  if (property.name === "backgroundRepeat") return "no-repeat";
10347
11956
  if (property.name === "backgroundAttachment") return "scroll";
10348
11957
  if (property.name === "backgroundClip") return "border-box";
10349
- if (property.name === "boxShadow") return "none";
11958
+ if (property.name === "boxShadow") return "0px 4px 12px 0px rgba(15, 23, 42, 0.16)";
10350
11959
  if (property.name === "outline") return "0 solid transparent";
10351
11960
  if (property.name === "outlineStyle") return "solid";
10352
11961
  if (property.name === "outlineWidth" || property.name === "outlineOffset") return "0";
@@ -10405,6 +12014,26 @@ function preparePropertyOption(option) {
10405
12014
  label: prepare(option.label)
10406
12015
  };
10407
12016
  }
12017
+ function filteredPropertyRows(query, rows) {
12018
+ const queryText = query.trim();
12019
+ if (!queryText) return rows;
12020
+ const preparedRows = rows.map((row) => {
12021
+ const path = row.path.split(".");
12022
+ const displayPath = pandaPreviewCondition(path) ? path.slice(1).join(".") : row.path;
12023
+ return {
12024
+ row,
12025
+ path: prepare(row.path),
12026
+ displayPath: prepare(displayPath)
12027
+ };
12028
+ });
12029
+ return searchFields(queryText, preparedRows, [{
12030
+ key: "path",
12031
+ extract: (item) => item.path
12032
+ }, {
12033
+ key: "displayPath",
12034
+ extract: (item) => item.displayPath
12035
+ }], { limit: preparedRows.length }).items.map((match) => match.value.row);
12036
+ }
10408
12037
  function filteredPropertyOptions(query, preparedOptions, propertyContext) {
10409
12038
  const queryText = query.trim();
10410
12039
  if (!queryText) return preparedOptions.map((preparedOption) => preparedOption.option).filter((option) => propertyVisibleByContext(option, propertyContext));
@@ -11144,6 +12773,41 @@ function AddPropertyMenu(props) {
11144
12773
  }) : null]
11145
12774
  });
11146
12775
  }
12776
+ function PropertyFilterInput(props) {
12777
+ return /* @__PURE__ */ u("div", {
12778
+ style: {
12779
+ display: "grid",
12780
+ gap: "4px",
12781
+ marginTop: "8px"
12782
+ },
12783
+ children: /* @__PURE__ */ u("input", {
12784
+ type: "search",
12785
+ "data-inspector-property-filter": "true",
12786
+ value: props.query.value,
12787
+ placeholder: "Filter properties",
12788
+ disabled: props.saving.value,
12789
+ onInput: (event) => {
12790
+ props.query.value = event.currentTarget.value;
12791
+ },
12792
+ onKeyDown: (event) => {
12793
+ if (event.key !== "Enter") return;
12794
+ const shell = event.currentTarget.closest("[data-sculpted-shell=\"true\"]");
12795
+ if (!shell) return;
12796
+ event.preventDefault();
12797
+ focusFirstVisiblePropertyMatch(shell);
12798
+ },
12799
+ style: {
12800
+ minWidth: 0,
12801
+ width: "100%",
12802
+ border: "1px solid #d6dde8",
12803
+ borderRadius: "5px",
12804
+ padding: "6px 8px",
12805
+ color: "#172033",
12806
+ background: "#fff"
12807
+ }
12808
+ })
12809
+ });
12810
+ }
11147
12811
  function ReadonlyTargetsSection(props) {
11148
12812
  const { view } = props;
11149
12813
  if (view.value.readonlyTargets.length === 0 && view.value.missingTargetIds.length === 0) return null;