diff --git a/docs/src/content/utils/cls.md b/docs/src/content/utils/cls.md new file mode 100644 index 000000000..db58026ac --- /dev/null +++ b/docs/src/content/utils/cls.md @@ -0,0 +1,19 @@ +--- +description: Utility function wrapper around tailwind-merge and clsx for easy style overrides. +category: tools +layers: [] +related: [/docs/components/BrushContext/selection, https://github.com/dcastil/tailwind-merge, https://github.com/lukeed/clsx, https://www.layerstack.dev/docs/tailwind/utils] +--- + + + +## Usage + +### cls() + +
clsx allows for conditional class additions
tailwind-merge dedups overlapping classes
+
+ diff --git a/docs/src/content/utils/format.md b/docs/src/content/utils/format.md new file mode 100644 index 000000000..8083b96fe --- /dev/null +++ b/docs/src/content/utils/format.md @@ -0,0 +1,18 @@ +--- +description: Utility function to easily manipulate numbers and dates to different formats and locales. +category: tools +layers: [] +related: [/docs/components/BarChart/sparkbar-fixed-position-tooltip, https://www.layerstack.dev/docs/utils/format#playgrounds] +--- + + + +## Usage + +### format() + +> Full API + + \ No newline at end of file diff --git a/docs/src/content/utils/string.md b/docs/src/content/utils/string.md new file mode 100644 index 000000000..68a06111a --- /dev/null +++ b/docs/src/content/utils/string.md @@ -0,0 +1,27 @@ +--- +description: Utility string functions. +category: tools +layers: [] +related: [/docs/components/BarChart/duration-civilization-timeline, /docs/components/BarChart/duration-civilization-timeline-dense, /docs/components/Text/playground, components/Text, https://www.layerstack.dev/docs/utils/string] +--- + + + +## Usage + +### truncate() + +> Full API + +{truncate("This is a really long string of text.", 21)} + + + +### toTitleCase() + +{toTitleCase("string of text")} + + \ No newline at end of file diff --git a/docs/src/examples/utils/cls/cls.svelte b/docs/src/examples/utils/cls/cls.svelte new file mode 100644 index 000000000..d73379367 --- /dev/null +++ b/docs/src/examples/utils/cls/cls.svelte @@ -0,0 +1,14 @@ + + + diff --git a/docs/src/examples/utils/format/format.svelte b/docs/src/examples/utils/format/format.svelte new file mode 100644 index 000000000..0ab885ae2 --- /dev/null +++ b/docs/src/examples/utils/format/format.svelte @@ -0,0 +1,31 @@ + + +{format(1234.56, 'integer')}
+{format(1234.56, 'decimal')}
+{format(1234.56, 'currency')}
+{format(0.5678, 'percent')}
+{format(0.5678, 'percentRound')}
+{format(1_234_567, 'metric')}
+{format(new Date(), 'day', { variant: 'short' })}
+{format(new Date(), 'custom', { custom: 'eee, MMMM do' })}
+ diff --git a/docs/src/examples/utils/string/toTitleCase.svelte b/docs/src/examples/utils/string/toTitleCase.svelte new file mode 100644 index 000000000..ede0708c5 --- /dev/null +++ b/docs/src/examples/utils/string/toTitleCase.svelte @@ -0,0 +1,15 @@ + + + diff --git a/docs/src/examples/utils/string/truncate.svelte b/docs/src/examples/utils/string/truncate.svelte new file mode 100644 index 000000000..357e4a9a5 --- /dev/null +++ b/docs/src/examples/utils/string/truncate.svelte @@ -0,0 +1,17 @@ + + +