@crystallize/design-system 1.8.0 → 1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dd3c347: Added h4, h5 and h6 for rich text editor
8
+
3
9
  ## 1.8.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -5730,16 +5730,20 @@ function InsertTableDialog({ activeEditor }) {
5730
5730
 
5731
5731
  // src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
5732
5732
  var import_jsx_runtime88 = require("react/jsx-runtime");
5733
- var blockTypeToBlockName = {
5734
- bullet: "Bulleted List",
5735
- check: "Check List",
5736
- code: "Code Block",
5733
+ var headingTypeToBlockName = {
5737
5734
  h1: "Heading 1",
5738
5735
  h2: "Heading 2",
5739
5736
  h3: "Heading 3",
5740
5737
  h4: "Heading 4",
5741
5738
  h5: "Heading 5",
5742
- h6: "Heading 6",
5739
+ h6: "Heading 6"
5740
+ };
5741
+ var headings = Object.keys(headingTypeToBlockName);
5742
+ var blockTypeToBlockName = {
5743
+ ...headingTypeToBlockName,
5744
+ bullet: "Bulleted List",
5745
+ check: "Check List",
5746
+ code: "Code Block",
5743
5747
  number: "Numbered List",
5744
5748
  paragraph: "Normal",
5745
5749
  quote: "Quote"
@@ -5849,42 +5853,18 @@ function BlockFormatDropDown({
5849
5853
  })
5850
5854
  ]
5851
5855
  }),
5852
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5853
- onClick: () => formatHeading("h1"),
5856
+ headings.map((headingSize) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5857
+ onClick: () => formatHeading(headingSize),
5854
5858
  children: [
5855
5859
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5856
- className: `icon h1 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "h1" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5860
+ className: `icon ${headingSize} border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === headingSize ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5857
5861
  }),
5858
5862
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5859
- className: `${blockType === "h1" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5860
- children: "Heading 1"
5863
+ className: `${blockType === headingSize ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5864
+ children: headingTypeToBlockName[headingSize]
5861
5865
  })
5862
5866
  ]
5863
- }),
5864
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5865
- onClick: () => formatHeading("h2"),
5866
- children: [
5867
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5868
- className: `icon h2 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "h2" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5869
- }),
5870
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5871
- className: `${blockType === "h2" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5872
- children: "Heading 2"
5873
- })
5874
- ]
5875
- }),
5876
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5877
- onClick: () => formatHeading("h3"),
5878
- children: [
5879
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5880
- className: `icon h3 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "h3" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5881
- }),
5882
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5883
- className: `${blockType === "h3" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5884
- children: "Heading 3"
5885
- })
5886
- ]
5887
- }),
5867
+ }, headingSize)),
5888
5868
  /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5889
5869
  onClick: formatBulletList,
5890
5870
  children: [
package/dist/index.mjs CHANGED
@@ -5756,16 +5756,20 @@ function InsertTableDialog({ activeEditor }) {
5756
5756
 
5757
5757
  // src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
5758
5758
  import { Fragment as Fragment8, jsx as jsx88, jsxs as jsxs66 } from "react/jsx-runtime";
5759
- var blockTypeToBlockName = {
5760
- bullet: "Bulleted List",
5761
- check: "Check List",
5762
- code: "Code Block",
5759
+ var headingTypeToBlockName = {
5763
5760
  h1: "Heading 1",
5764
5761
  h2: "Heading 2",
5765
5762
  h3: "Heading 3",
5766
5763
  h4: "Heading 4",
5767
5764
  h5: "Heading 5",
5768
- h6: "Heading 6",
5765
+ h6: "Heading 6"
5766
+ };
5767
+ var headings = Object.keys(headingTypeToBlockName);
5768
+ var blockTypeToBlockName = {
5769
+ ...headingTypeToBlockName,
5770
+ bullet: "Bulleted List",
5771
+ check: "Check List",
5772
+ code: "Code Block",
5769
5773
  number: "Numbered List",
5770
5774
  paragraph: "Normal",
5771
5775
  quote: "Quote"
@@ -5875,42 +5879,18 @@ function BlockFormatDropDown({
5875
5879
  })
5876
5880
  ]
5877
5881
  }),
5878
- /* @__PURE__ */ jsxs66(DropdownMenu.Item, {
5879
- onClick: () => formatHeading("h1"),
5882
+ headings.map((headingSize) => /* @__PURE__ */ jsxs66(DropdownMenu.Item, {
5883
+ onClick: () => formatHeading(headingSize),
5880
5884
  children: [
5881
5885
  /* @__PURE__ */ jsx88("i", {
5882
- className: `icon h1 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "h1" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5886
+ className: `icon ${headingSize} border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === headingSize ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5883
5887
  }),
5884
5888
  /* @__PURE__ */ jsx88("span", {
5885
- className: `${blockType === "h1" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5886
- children: "Heading 1"
5889
+ className: `${blockType === headingSize ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5890
+ children: headingTypeToBlockName[headingSize]
5887
5891
  })
5888
5892
  ]
5889
- }),
5890
- /* @__PURE__ */ jsxs66(DropdownMenu.Item, {
5891
- onClick: () => formatHeading("h2"),
5892
- children: [
5893
- /* @__PURE__ */ jsx88("i", {
5894
- className: `icon h2 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "h2" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5895
- }),
5896
- /* @__PURE__ */ jsx88("span", {
5897
- className: `${blockType === "h2" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5898
- children: "Heading 2"
5899
- })
5900
- ]
5901
- }),
5902
- /* @__PURE__ */ jsxs66(DropdownMenu.Item, {
5903
- onClick: () => formatHeading("h3"),
5904
- children: [
5905
- /* @__PURE__ */ jsx88("i", {
5906
- className: `icon h3 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "h3" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5907
- }),
5908
- /* @__PURE__ */ jsx88("span", {
5909
- className: `${blockType === "h3" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5910
- children: "Heading 3"
5911
- })
5912
- ]
5913
- }),
5893
+ }, headingSize)),
5914
5894
  /* @__PURE__ */ jsxs66(DropdownMenu.Item, {
5915
5895
  onClick: formatBulletList,
5916
5896
  children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -65,16 +65,21 @@ import { sanitizeUrl } from '../../utils/url';
65
65
  import ActionsPlugin from './../ActionsPlugin';
66
66
  import { InsertTableDialog } from './insert-table';
67
67
 
68
- const blockTypeToBlockName = {
69
- bullet: 'Bulleted List',
70
- check: 'Check List',
71
- code: 'Code Block',
68
+ const headingTypeToBlockName: Record<HeadingTagType, string> = {
72
69
  h1: 'Heading 1',
73
70
  h2: 'Heading 2',
74
71
  h3: 'Heading 3',
75
72
  h4: 'Heading 4',
76
73
  h5: 'Heading 5',
77
74
  h6: 'Heading 6',
75
+ };
76
+ const headings = Object.keys(headingTypeToBlockName) as HeadingTagType[];
77
+
78
+ const blockTypeToBlockName = {
79
+ ...headingTypeToBlockName,
80
+ bullet: 'Bulleted List',
81
+ check: 'Check List',
82
+ code: 'Code Block',
78
83
  number: 'Numbered List',
79
84
  paragraph: 'Normal',
80
85
  quote: 'Quote',
@@ -204,36 +209,18 @@ function BlockFormatDropDown({
204
209
  Normal
205
210
  </span>
206
211
  </DropdownMenu.Item>
207
- <DropdownMenu.Item onClick={() => formatHeading('h1')}>
208
- <i
209
- className={`icon h1 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${
210
- blockType === 'h1' ? 'opacity-100 bg-purple-50-900' : 'opacity-60'
211
- }`}
212
- />
213
- <span className={`${blockType === 'h1' ? 'font-bold' : 'font-normal'} text-sm px-3 min-w-[150px]`}>
214
- Heading 1
215
- </span>
216
- </DropdownMenu.Item>
217
- <DropdownMenu.Item onClick={() => formatHeading('h2')}>
218
- <i
219
- className={`icon h2 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${
220
- blockType === 'h2' ? 'opacity-100 bg-purple-50-900' : 'opacity-60'
221
- }`}
222
- />
223
- <span className={`${blockType === 'h2' ? 'font-bold' : 'font-normal'} text-sm px-3 min-w-[150px]`}>
224
- Heading 2
225
- </span>
226
- </DropdownMenu.Item>
227
- <DropdownMenu.Item onClick={() => formatHeading('h3')}>
228
- <i
229
- className={`icon h3 border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${
230
- blockType === 'h3' ? 'opacity-100 bg-purple-50-900' : 'opacity-60'
231
- }`}
232
- />
233
- <span className={`${blockType === 'h3' ? 'font-bold' : 'font-normal'} text-sm px-3 min-w-[150px]`}>
234
- Heading 3
235
- </span>
236
- </DropdownMenu.Item>
212
+ {headings.map(headingSize => (
213
+ <DropdownMenu.Item key={headingSize} onClick={() => formatHeading(headingSize)}>
214
+ <i
215
+ className={`icon ${headingSize} border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${
216
+ blockType === headingSize ? 'opacity-100 bg-purple-50-900' : 'opacity-60'
217
+ }`}
218
+ />
219
+ <span className={`${blockType === headingSize ? 'font-bold' : 'font-normal'} text-sm px-3 min-w-[150px]`}>
220
+ {headingTypeToBlockName[headingSize]}
221
+ </span>
222
+ </DropdownMenu.Item>
223
+ ))}
237
224
  <DropdownMenu.Item onClick={formatBulletList}>
238
225
  <i
239
226
  className={`icon bullet-list border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${