@streamscloud/kit 0.93.0 → 0.93.2

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.
@@ -2,7 +2,11 @@ import type { TextValidation, TextWithFormatValidation } from './types';
2
2
  import * as yup from 'yup';
3
3
  /** Value-level rules of `textValidationSchema`. Judges a real value — `null` / `undefined` are decided by the schema modifiers the caller adds. */
4
4
  export declare const isValidText: (value: string, rules: TextValidation) => boolean;
5
- /** Value-level rules of `formattedTextValidationSchema` — `isValidText` plus the format, which an empty value skips. */
6
- export declare const isValidFormattedText: (value: string, rules: TextWithFormatValidation) => boolean;
5
+ /**
6
+ * Value-level rules of `formattedTextValidationSchema` — `isValidText` plus the format, which an empty value skips.
7
+ * @param unicode compiles the format with the `u` flag, so Unicode property escapes like `\p{L}` work. @default true
8
+ */
9
+ export declare const isValidFormattedText: (value: string, rules: TextWithFormatValidation, unicode?: boolean) => boolean;
7
10
  export declare const textValidationSchema: (rules: TextValidation) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
8
- export declare const formattedTextValidationSchema: (rules: TextWithFormatValidation, fieldName: string, formatMessage?: string) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
11
+ /** @param unicode compiles the format with the `u` flag, so Unicode property escapes like `\p{L}` work. @default true */
12
+ export declare const formattedTextValidationSchema: (rules: TextWithFormatValidation, fieldName: string, formatMessage?: string, unicode?: boolean) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
@@ -1,13 +1,17 @@
1
1
  import { ValidationLocalization } from './validation-localization';
2
2
  import * as yup from 'yup';
3
3
  const isEmptyOrHasContent = (value) => !value || value.trim().length > 0;
4
+ const matchesFormat = (value, format, unicode) => new RegExp(format, unicode ? 'u' : '').test(value);
4
5
  /** Value-level rules of `textValidationSchema`. Judges a real value — `null` / `undefined` are decided by the schema modifiers the caller adds. */
5
6
  export const isValidText = (value, rules) => {
6
7
  return isEmptyOrHasContent(value) && value.length >= rules.minLength && value.length <= rules.maxLength;
7
8
  };
8
- /** Value-level rules of `formattedTextValidationSchema` — `isValidText` plus the format, which an empty value skips. */
9
- export const isValidFormattedText = (value, rules) => {
10
- return isValidText(value, rules) && (!value || new RegExp(rules.format).test(value));
9
+ /**
10
+ * Value-level rules of `formattedTextValidationSchema` — `isValidText` plus the format, which an empty value skips.
11
+ * @param unicode compiles the format with the `u` flag, so Unicode property escapes like `\p{L}` work. @default true
12
+ */
13
+ export const isValidFormattedText = (value, rules, unicode = true) => {
14
+ return isValidText(value, rules) && (!value || matchesFormat(value, rules.format, unicode));
11
15
  };
12
16
  export const textValidationSchema = (rules) => {
13
17
  const msg = new ValidationLocalization();
@@ -22,7 +26,8 @@ export const textValidationSchema = (rules) => {
22
26
  return schema.min(rules.minLength, msg.minLength(rules.minLength));
23
27
  }
24
28
  };
25
- export const formattedTextValidationSchema = (rules, fieldName, formatMessage) => {
29
+ /** @param unicode compiles the format with the `u` flag, so Unicode property escapes like `\p{L}` work. @default true */
30
+ export const formattedTextValidationSchema = (rules, fieldName, formatMessage, unicode = true) => {
26
31
  const msg = new ValidationLocalization();
27
- return textValidationSchema(rules).test(`${fieldName}-format`, formatMessage ?? msg.badFormat, (val) => !val || new RegExp(rules.format).test(val));
32
+ return textValidationSchema(rules).test(`${fieldName}-format`, formatMessage ?? msg.badFormat, (val) => !val || matchesFormat(val, rules.format, unicode));
28
33
  };
@@ -35,7 +35,7 @@ const changeItemPosition = (target, positionChange) => {
35
35
  <div class="actions">
36
36
  {#each visibleActions as action (action)}
37
37
  <PopoverItem on={{ click: () => action.action(item) }}>
38
- <IconText icon={action.icon} size="md">
38
+ <IconText icon={action.icon} size="sm">
39
39
  {action.title}
40
40
  </IconText>
41
41
  </PopoverItem>
@@ -308,6 +308,7 @@ const handleActionsClosed = () => {
308
308
  --_tree-node--padding-inline: var(--sc-kit--tree-node--padding-inline, 0.5rem);
309
309
  --_tree-node--padding-block: var(--sc-kit--tree-node--padding-block, 0.375rem);
310
310
  --_tree-node--indent: var(--sc-kit--tree-node--indent, 1rem);
311
+ --_tree-node--trailing-size: 1.5rem;
311
312
  position: relative;
312
313
  width: 100%;
313
314
  color: var(--sc-kit--color--text--primary);
@@ -432,6 +433,8 @@ const handleActionsClosed = () => {
432
433
  }
433
434
  .tree-node__count {
434
435
  flex-shrink: 0;
436
+ padding-inline-end: calc((var(--_tree-node--trailing-size) - 1ch) / 2);
437
+ font-variant-numeric: tabular-nums;
435
438
  font-size: var(--sc-kit--font-size--xs);
436
439
  color: var(--sc-kit--color--accent);
437
440
  }
@@ -447,8 +450,8 @@ const handleActionsClosed = () => {
447
450
  display: inline-flex;
448
451
  align-items: center;
449
452
  justify-content: center;
450
- width: 1.5rem;
451
- height: 1.5rem;
453
+ width: var(--_tree-node--trailing-size);
454
+ height: var(--_tree-node--trailing-size);
452
455
  border-radius: var(--sc-kit--radius--sm);
453
456
  color: var(--sc-kit--color--text--secondary);
454
457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.93.0",
3
+ "version": "0.93.2",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",