@shapesos/clay 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -16342,6 +16342,7 @@ var require_lottie = __commonJS({
16342
16342
  // src/index.ts
16343
16343
  var src_exports = {};
16344
16344
  __export(src_exports, {
16345
+ BUTTON_INTENT: () => BUTTON_INTENT,
16345
16346
  BUTTON_SIZE: () => BUTTON_SIZE,
16346
16347
  BUTTON_VARIANT: () => BUTTON_VARIANT,
16347
16348
  Button: () => Button2,
@@ -17155,13 +17156,17 @@ function copyToClipboard(text2, options) {
17155
17156
  var PLACEHOLDER_PREFIX = "\u200B\u200BIC";
17156
17157
  var PLACEHOLDER_SUFFIX = "\u200B\u200B";
17157
17158
  var PLACEHOLDER_REGEX = new RegExp(`${PLACEHOLDER_PREFIX}(\\d+)${PLACEHOLDER_SUFFIX}`, "g");
17159
+ function stripInlineMarks(text2) {
17160
+ return text2.replace(/\*{3}(.+?)\*{3}/g, "$1").replace(/\*{2}(.+?)\*{2}/g, "$1").replace(/_{2}(.+?)_{2}/g, "$1").replace(/\*(.+?)\*/g, "$1").replace(/_(.+?)_/g, "$1").replace(/~~(.+?)~~/g, "$1");
17161
+ }
17158
17162
  function markdownToPlainText(markdown) {
17159
17163
  if (!markdown) return "";
17160
17164
  const inlineCodeSnippets = [];
17161
17165
  let result = markdown.replace(/^<!--[\s\S]*?--!?>\n?/gm, "").replace(/```[\s\S]*?```/g, "").replace(/`([^`]+)`/g, (_match, code) => {
17162
17166
  inlineCodeSnippets.push(code);
17163
17167
  return `${PLACEHOLDER_PREFIX}${inlineCodeSnippets.length - 1}${PLACEHOLDER_SUFFIX}`;
17164
- }).replace(/^#{1,6}\s+/gm, "").replace(/^(?:---|\*\*\*|___)\s*$/gm, "").replace(/\*{3}(.+?)\*{3}/g, "$1").replace(/\*{2}(.+?)\*{2}/g, "$1").replace(/_{2}(.+?)_{2}/g, "$1").replace(/\*(.+?)\*/g, "$1").replace(/_(.+?)_/g, "$1").replace(/~~(.+?)~~/g, "$1").replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^>\s?/gm, "").replace(/^\|[-:\s|]+\|\s*$/gm, "").replace(/^\|\s?/gm, "").replace(/\s?\|$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
17168
+ }).replace(/^#{1,6}\s+/gm, "").replace(/^(?:---|\*\*\*|___)\s*$/gm, "");
17169
+ result = stripInlineMarks(result).replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^>\s?/gm, "").replace(/^\|[-:\s|]+\|\s*$/gm, "").replace(/^\|\s?/gm, "").replace(/\s?\|$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
17165
17170
  result = result.replace(PLACEHOLDER_REGEX, (_match, index2) => inlineCodeSnippets[Number(index2)]);
17166
17171
  return result;
17167
17172
  }
@@ -17660,7 +17665,7 @@ function parseMarkdownTable(markdown, tableIndex = 0) {
17660
17665
  continue;
17661
17666
  }
17662
17667
  if (tableCount === tableIndex) {
17663
- const columns = parseCells(headerLine);
17668
+ const columns = parseCells(headerLine).map(stripInlineMarks);
17664
17669
  const rows = [];
17665
17670
  const title = i > 0 ? extractTableTitle(lines[i - 1]) : void 0;
17666
17671
  for (let j = i + 2; j < lines.length; j++) {
@@ -17671,7 +17676,7 @@ function parseMarkdownTable(markdown, tableIndex = 0) {
17671
17676
  if (trimmedLine === "") {
17672
17677
  break;
17673
17678
  }
17674
- rows.push(parseCells(lines[j]));
17679
+ rows.push(parseCells(lines[j]).map(stripInlineMarks));
17675
17680
  }
17676
17681
  return { columns, rows, ...title ? { title } : {} };
17677
17682
  }
@@ -17698,66 +17703,107 @@ var import_react10 = require("react");
17698
17703
 
17699
17704
  // src/components/button/button-styles.ts
17700
17705
  var import_styled_components10 = __toESM(require("styled-components"), 1);
17701
- var sizeStyles = {
17702
- xs: import_styled_components10.css`
17703
- padding: 6px 10px;
17704
- border-radius: 8px;
17705
- gap: 4px;
17706
- `,
17707
- s: import_styled_components10.css`
17708
- padding: 8px 12px;
17709
- border-radius: 10px;
17710
- gap: 6px;
17711
- `,
17712
- m: import_styled_components10.css`
17713
- padding: 10px 14px;
17714
- border-radius: 10px;
17715
- gap: 6px;
17716
- `
17717
- };
17718
- var variantStyles2 = {
17719
- solid: import_styled_components10.css`
17720
- background: ${colors["brown-100"]};
17721
- color: ${colors.white};
17722
- border: none;
17723
-
17724
- &:hover:not(:disabled) {
17725
- background: ${colors["brown-90"]};
17726
- }
17727
-
17728
- &:disabled {
17729
- background: ${colors["brown-20"]};
17730
- color: ${colors["brown-50"]};
17731
- }
17732
- `,
17733
- outline: import_styled_components10.css`
17734
- background: ${colors.white};
17735
- color: ${colors["brown-100"]};
17736
- border: 1px solid ${colors["brown-40"]};
17737
17706
 
17738
- &:hover:not(:disabled) {
17739
- background: ${colors["brown-20"]};
17740
- }
17707
+ // src/components/button/constants.ts
17708
+ var BUTTON_VARIANT = {
17709
+ SOLID: "solid",
17710
+ OUTLINE: "outline",
17711
+ GHOST: "ghost"
17712
+ };
17713
+ var BUTTON_SIZE = {
17714
+ XS: "xs",
17715
+ S: "s",
17716
+ M: "m"
17717
+ };
17718
+ var BUTTON_INTENT = {
17719
+ PRIMARY: "primary",
17720
+ ERROR: "error"
17721
+ };
17722
+ var ICON_POSITION = {
17723
+ LEADING: "leading",
17724
+ TRAILING: "trailing"
17725
+ };
17741
17726
 
17742
- &:disabled {
17743
- border-color: ${colors["brown-20"]};
17744
- color: ${colors["brown-50"]};
17745
- }
17746
- `,
17747
- ghost: import_styled_components10.css`
17748
- background: transparent;
17749
- color: ${colors["brown-100"]};
17750
- border: none;
17727
+ // src/components/button/button-styles.ts
17728
+ var intentColors = {
17729
+ [BUTTON_INTENT.PRIMARY]: {
17730
+ base: colors["brown-100"],
17731
+ hover: colors["brown-90"],
17732
+ disabledBg: colors["brown-20"],
17733
+ disabledText: colors["brown-50"],
17734
+ subtleHover: colors["brown-20"],
17735
+ border: colors["brown-40"],
17736
+ disabledBorder: colors["brown-20"]
17737
+ },
17738
+ [BUTTON_INTENT.ERROR]: {
17739
+ base: colors["red-500"],
17740
+ hover: colors["red-600"],
17741
+ disabledBg: colors["red-100"],
17742
+ disabledText: colors["red-200"],
17743
+ subtleHover: colors["red-50"],
17744
+ border: colors["red-200"],
17745
+ disabledBorder: colors["red-100"]
17746
+ }
17747
+ };
17748
+ var sizeValues = {
17749
+ [BUTTON_SIZE.XS]: { padding: "6px 10px", borderRadius: "8px", gap: "4px" },
17750
+ [BUTTON_SIZE.S]: { padding: "8px 12px", borderRadius: "10px", gap: "6px" },
17751
+ [BUTTON_SIZE.M]: { padding: "10px 14px", borderRadius: "10px", gap: "6px" }
17752
+ };
17753
+ function sizeMixin({ $size }) {
17754
+ const s = sizeValues[$size];
17755
+ return import_styled_components10.css`
17756
+ padding: ${s.padding};
17757
+ border-radius: ${s.borderRadius};
17758
+ gap: ${s.gap};
17759
+ `;
17760
+ }
17761
+ var variantColorMap = {
17762
+ [BUTTON_VARIANT.SOLID]: (c) => ({
17763
+ background: c.base,
17764
+ color: colors.white,
17765
+ border: "none",
17766
+ hoverBg: c.hover,
17767
+ disabledBg: c.disabledBg,
17768
+ disabledColor: c.disabledText
17769
+ }),
17770
+ [BUTTON_VARIANT.OUTLINE]: (c) => ({
17771
+ background: colors.white,
17772
+ color: c.base,
17773
+ border: `1px solid ${c.border}`,
17774
+ hoverBg: c.subtleHover,
17775
+ disabledColor: c.disabledText,
17776
+ disabledBorder: c.disabledBorder
17777
+ }),
17778
+ [BUTTON_VARIANT.GHOST]: (c) => ({
17779
+ background: "transparent",
17780
+ color: c.base,
17781
+ border: "none",
17782
+ hoverBg: c.subtleHover,
17783
+ disabledColor: c.disabledText
17784
+ })
17785
+ };
17786
+ function variantMixin({
17787
+ $variant,
17788
+ $intent
17789
+ }) {
17790
+ const v = variantColorMap[$variant](intentColors[$intent]);
17791
+ return import_styled_components10.css`
17792
+ background: ${v.background};
17793
+ color: ${v.color};
17794
+ border: ${v.border};
17751
17795
 
17752
17796
  &:hover:not(:disabled) {
17753
- background: ${colors["brown-20"]};
17797
+ background: ${v.hoverBg};
17754
17798
  }
17755
17799
 
17756
17800
  &:disabled {
17757
- color: ${colors["brown-50"]};
17801
+ color: ${v.disabledColor};
17802
+ ${v.disabledBg ? `background: ${v.disabledBg};` : ""}
17803
+ ${v.disabledBorder ? `border-color: ${v.disabledBorder};` : ""}
17758
17804
  }
17759
- `
17760
- };
17805
+ `;
17806
+ }
17761
17807
  var StyledButton = import_styled_components10.default.button`
17762
17808
  display: inline-flex;
17763
17809
  align-items: center;
@@ -17770,31 +17816,16 @@ var StyledButton = import_styled_components10.default.button`
17770
17816
  cursor: not-allowed;
17771
17817
  }
17772
17818
 
17773
- ${({ $size }) => sizeStyles[$size]}
17774
- ${({ $variant }) => variantStyles2[$variant]}
17819
+ ${sizeMixin}
17820
+ ${variantMixin}
17775
17821
  `;
17776
17822
 
17777
- // src/components/button/constants.ts
17778
- var BUTTON_VARIANT = {
17779
- SOLID: "solid",
17780
- OUTLINE: "outline",
17781
- GHOST: "ghost"
17782
- };
17783
- var BUTTON_SIZE = {
17784
- XS: "xs",
17785
- S: "s",
17786
- M: "m"
17787
- };
17788
- var ICON_POSITION = {
17789
- LEADING: "leading",
17790
- TRAILING: "trailing"
17791
- };
17792
-
17793
17823
  // src/components/button/button.tsx
17794
17824
  var import_jsx_runtime11 = require("react/jsx-runtime");
17795
17825
  var Button2 = (0, import_react10.forwardRef)(function Button3({
17796
17826
  children,
17797
17827
  variant = BUTTON_VARIANT.SOLID,
17828
+ intent = BUTTON_INTENT.PRIMARY,
17798
17829
  size = BUTTON_SIZE.M,
17799
17830
  icon,
17800
17831
  iconPosition = ICON_POSITION.LEADING,
@@ -17810,6 +17841,7 @@ var Button2 = (0, import_react10.forwardRef)(function Button3({
17810
17841
  ref,
17811
17842
  type: "button",
17812
17843
  $variant: variant,
17844
+ $intent: intent,
17813
17845
  $size: size,
17814
17846
  disabled,
17815
17847
  onClick: disabled ? void 0 : onClick,
@@ -17825,6 +17857,7 @@ var Button2 = (0, import_react10.forwardRef)(function Button3({
17825
17857
  });
17826
17858
  // Annotate the CommonJS export names for ESM import in node:
17827
17859
  0 && (module.exports = {
17860
+ BUTTON_INTENT,
17828
17861
  BUTTON_SIZE,
17829
17862
  BUTTON_VARIANT,
17830
17863
  Button,