{"version":3,"file":"BulletListWidget-DsbsppA_.cjs","names":["gapValues","borderWidthClasses","borderColorClasses","getFontSizeField","getColorField","getPaddingField","getBorderRadiusField","getBorderWidthField","getBorderColorField","getGapField"],"sources":["../../widgets/src/widgets/BulletListWidget.tsx"],"sourcesContent":["import type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport type { ComponentProps } from \"react\";\nimport type React from \"react\";\nimport {\n  getBorderRadiusField,\n  getBorderWidthField,\n  getBorderColorField,\n  getColorField,\n  getFontSizeField,\n  getGapField,\n  getPaddingField,\n  borderWidthClasses,\n  borderColorClasses,\n  gapValues,\n} from \"../core/fields\";\nimport type {\n  BackgroundValue,\n  BorderRadiusOptions,\n  BorderWidthOptions,\n  ColorOptions,\n  FontSizeOptions,\n  GapOptions,\n  PaddingOptions,\n} from \"@fluid-app/portal-core/types\";\n\ntype BulletListWidgetProps = ComponentProps<\"div\"> & {\n  // Title\n  titleEnabled?: boolean;\n  title?: string;\n  titleFontSize?: FontSizeOptions;\n  titleColor?: ColorOptions;\n\n  // List\n  listType?: \"ordered\" | \"unordered\";\n  items?: string[] | string;\n  itemFontSize?: FontSizeOptions;\n  itemColor?: ColorOptions;\n\n  // Styling\n  background?: BackgroundValue;\n  padding?: PaddingOptions;\n  borderRadius?: BorderRadiusOptions;\n  borderWidth?: BorderWidthOptions;\n  borderColor?: ColorOptions;\n  gapSize?: GapOptions;\n};\n\nexport function BulletListWidget({\n  titleEnabled = true,\n  title = \"List\",\n  titleFontSize = \"lg\",\n  titleColor = \"foreground\",\n  listType = \"unordered\",\n  items = [\"Item 1\", \"Item 2\", \"Item 3\"],\n  itemFontSize = \"md\",\n  itemColor = \"foreground\",\n  background = { type: \"solid\", color: \"background\" },\n  padding = 4,\n  borderRadius = \"md\",\n  borderWidth = \"none\",\n  borderColor = \"muted\",\n  gapSize = \"sm\",\n  className,\n  ...props\n}: BulletListWidgetProps): React.JSX.Element {\n  const backgroundColor = background.color ?? \"background\";\n  const backgroundImage =\n    (background.resource?.image_url || background.resource?.imageUrl) &&\n    background.type === \"image\"\n      ? `url(${background.resource.image_url || background.resource.imageUrl})`\n      : \"none\";\n\n  const listItems =\n    typeof items === \"string\"\n      ? items.split(\"\\n\").filter(Boolean)\n      : (items ?? []);\n\n  const ListTag = listType === \"ordered\" ? \"ol\" : \"ul\";\n  const listStyleClass = listType === \"ordered\" ? \"list-decimal\" : \"list-disc\";\n  const gap = gapValues[gapSize] ?? gapValues.sm;\n\n  return (\n    <div\n      className={`bg-${backgroundColor} p-${padding} rounded-${borderRadius} ${borderWidthClasses[borderWidth]} ${borderWidth !== \"none\" ? borderColorClasses[borderColor] : \"\"} ${className ?? \"\"}`}\n      style={{ backgroundImage }}\n      {...props}\n    >\n      {titleEnabled && (\n        <h2\n          className={`text-${titleFontSize} text-${titleColor} font-header mb-2 font-bold`}\n        >\n          {title}\n        </h2>\n      )}\n      <ListTag\n        className={`${listStyleClass} pl-5 text-${itemFontSize} text-${itemColor}`}\n        style={{ display: \"flex\", flexDirection: \"column\", gap }}\n      >\n        {listItems.map((item, index) => (\n          <li key={index}>{item}</li>\n        ))}\n      </ListTag>\n    </div>\n  );\n}\n\nexport const bulletListWidgetPropertySchema: WidgetPropertySchema = {\n  widgetType: \"BulletListWidget\",\n  displayName: \"Bullet List\",\n  fields: [\n    // Title Group\n    {\n      key: \"titleEnabled\",\n      label: \"Widget Title\",\n      type: \"boolean\",\n      description: \"Enable the title displayed above the list\",\n      defaultValue: true,\n      group: \"Title\",\n    },\n    {\n      key: \"title\",\n      label: \"Title\",\n      type: \"text\",\n      description: \"The title\",\n      defaultValue: \"List\",\n      group: \"Title\",\n      requiresKeyToBeTrue: \"titleEnabled\",\n    },\n    getFontSizeField({\n      key: \"titleFontSize\",\n      label: \"Title Font Size\",\n      description: \"Font size for the title\",\n      defaultValue: \"lg\",\n      group: \"Title\",\n      requiresKeyToBeTrue: \"titleEnabled\",\n    }),\n    getColorField({\n      key: \"titleColor\",\n      label: \"Title Color\",\n      description: \"The color of the title\",\n      defaultValue: \"foreground\",\n      group: \"Title\",\n      requiresKeyToBeTrue: \"titleEnabled\",\n    }),\n    // List Group\n    {\n      key: \"listType\",\n      label: \"List Type\",\n      type: \"select\",\n      description: \"Ordered (numbered) or unordered (bullets)\",\n      options: [\n        { label: \"Bullets\", value: \"unordered\" },\n        { label: \"Numbered\", value: \"ordered\" },\n      ],\n      defaultValue: \"unordered\",\n      group: \"List\",\n    },\n    {\n      key: \"items\",\n      label: \"List Items\",\n      type: \"stringArray\",\n      description: \"Add or remove list items\",\n      defaultValue: [\"Item 1\", \"Item 2\", \"Item 3\"],\n      group: \"List\",\n    },\n    getFontSizeField({\n      key: \"itemFontSize\",\n      label: \"Item Font Size\",\n      description: \"Font size for list items\",\n      defaultValue: \"md\",\n      group: \"List\",\n    }),\n    getColorField({\n      key: \"itemColor\",\n      label: \"Item Color\",\n      description: \"The color of list items\",\n      defaultValue: \"foreground\",\n      group: \"List\",\n    }),\n    // Style Group\n    {\n      type: \"background\",\n      key: \"background\",\n      label: \"Background\",\n      description: \"Background for the list container\",\n      defaultValue: { type: \"solid\", color: \"background\" },\n      group: \"Style\",\n    },\n    getPaddingField({\n      key: \"padding\",\n      label: \"Padding\",\n      description: \"The padding of the list container\",\n      defaultValue: 4,\n      group: \"Style\",\n    }),\n    getBorderRadiusField({\n      key: \"borderRadius\",\n      label: \"Border Radius\",\n      description: \"The border radius of the list container\",\n      group: \"Design\",\n    }),\n    getBorderWidthField({\n      key: \"borderWidth\",\n      label: \"Border Width\",\n      description: \"Border width for the widget\",\n      defaultValue: \"none\",\n      group: \"Design\",\n    }),\n    getBorderColorField({\n      key: \"borderColor\",\n      label: \"Border Color\",\n      description: \"Border color for the widget\",\n      defaultValue: \"muted\",\n      group: \"Design\",\n    }),\n    getGapField({\n      key: \"gapSize\",\n      label: \"Item Gap\",\n      description: \"Gap between list items\",\n      defaultValue: \"sm\",\n      group: \"Style\",\n    }),\n  ],\n};\n"],"mappings":";;;;;;;;A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