@supersoniks/concorde 3.1.6 → 3.1.9

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.
Files changed (72) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +133 -111
  3. package/concorde-core.es.js +936 -870
  4. package/dist/concorde-core.bundle.js +133 -111
  5. package/dist/concorde-core.es.js +936 -870
  6. package/docs/assets/index--bDsd7qW.css +1 -0
  7. package/docs/assets/index-Ce3mr_lI.js +4040 -0
  8. package/docs/css/docs.css +0 -0
  9. package/docs/img/concorde-logo.svg +1 -0
  10. package/docs/img/concorde.png +0 -0
  11. package/docs/img/concorde_def.png +0 -0
  12. package/docs/index.html +132 -0
  13. package/docs/src/core/components/functional/date/date.md +290 -0
  14. package/docs/src/core/components/functional/fetch/fetch.md +117 -0
  15. package/docs/src/core/components/functional/if/if.md +16 -0
  16. package/docs/src/core/components/functional/list/list.md +194 -0
  17. package/docs/src/core/components/functional/mix/mix.md +41 -0
  18. package/docs/src/core/components/functional/queue/queue.md +87 -0
  19. package/docs/src/core/components/functional/router/router.md +112 -0
  20. package/docs/src/core/components/functional/sdui/default-library.json +108 -0
  21. package/docs/src/core/components/functional/sdui/example.json +99 -0
  22. package/docs/src/core/components/functional/sdui/sdui.md +356 -0
  23. package/docs/src/core/components/functional/states/states.md +87 -0
  24. package/docs/src/core/components/functional/submit/submit.md +48 -0
  25. package/docs/src/core/components/functional/subscriber/subscriber.md +91 -0
  26. package/docs/src/core/components/functional/value/value.md +35 -0
  27. package/docs/src/core/components/ui/alert/alert.md +121 -0
  28. package/docs/src/core/components/ui/badge/badge.md +102 -0
  29. package/docs/src/core/components/ui/button/button.md +184 -0
  30. package/docs/src/core/components/ui/captcha/captcha.md +12 -0
  31. package/docs/src/core/components/ui/card/card.md +96 -0
  32. package/docs/src/core/components/ui/divider/divider.md +35 -0
  33. package/docs/src/core/components/ui/form/checkbox/checkbox.md +96 -0
  34. package/docs/src/core/components/ui/form/fieldset/fieldset.md +129 -0
  35. package/docs/src/core/components/ui/form/form-actions/form-actions.md +77 -0
  36. package/docs/src/core/components/ui/form/form-layout/form-layout.md +43 -0
  37. package/docs/src/core/components/ui/form/input/input.md +168 -0
  38. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
  39. package/docs/src/core/components/ui/form/radio/radio.md +86 -0
  40. package/docs/src/core/components/ui/form/select/select.md +99 -0
  41. package/docs/src/core/components/ui/form/textarea/textarea.md +66 -0
  42. package/docs/src/core/components/ui/group/group.md +75 -0
  43. package/docs/src/core/components/ui/icon/icon.md +125 -0
  44. package/docs/src/core/components/ui/icon/icons.json +1 -0
  45. package/docs/src/core/components/ui/image/image.md +107 -0
  46. package/docs/src/core/components/ui/link/link.md +43 -0
  47. package/docs/src/core/components/ui/loader/loader.md +37 -0
  48. package/docs/src/core/components/ui/menu/menu.md +288 -0
  49. package/docs/src/core/components/ui/modal/modal.md +123 -0
  50. package/docs/src/core/components/ui/pop/pop.md +79 -0
  51. package/docs/src/core/components/ui/progress/progress.md +65 -0
  52. package/docs/src/core/components/ui/table/table.md +467 -0
  53. package/docs/src/core/components/ui/tooltip/tooltip.md +37 -0
  54. package/docs/src/docs/_core-concept/overview.md +57 -0
  55. package/docs/src/docs/_core-concept/subscriber.md +76 -0
  56. package/docs/src/docs/_getting-started/concorde-outside.md +141 -0
  57. package/docs/src/docs/_getting-started/create-a-component.md +137 -0
  58. package/docs/src/docs/_getting-started/pubsub.md +150 -0
  59. package/docs/src/docs/_getting-started/start.md +37 -0
  60. package/docs/src/docs/_getting-started/theming.md +91 -0
  61. package/docs/src/docs/search/docs-search.json +3737 -0
  62. package/docs/src/tag-list.json +1 -0
  63. package/docs/src/tsconfig.json +113 -0
  64. package/docs/svg/regular/plane.svg +1 -0
  65. package/docs/svg/solid/plane.svg +1 -0
  66. package/package.json +1 -1
  67. package/postcss.config.cjs +0 -0
  68. package/src/core/components/ui/form/textarea/textarea.ts +5 -2
  69. package/src/core/components/ui/pop/pop.ts +70 -42
  70. package/src/core/components/ui/theme/theme.ts +22 -0
  71. package/src/core/utils/HTML.ts +65 -14
  72. package/src/docs/tailwind/index.ts +0 -0
@@ -0,0 +1 @@
1
+ ["sonic-date","sonic-example","sonic-fetch","sonic-if","sonic-list","sonic-mix","sonic-queue","sonic-redirect","sonic-router","sonic-sdui","sonic-scope","sonic-states","sonic-submit","sonic-subscriber","sonic-value","sonic-alert","sonic-badge","sonic-button","sonic-captcha","sonic-card-footer","sonic-card-header-description","sonic-card-header","sonic-card-main","sonic-card","sonic-divider","sonic-checkbox","sonic-fieldset","sonic-legend-description","sonic-legend","sonic-form-actions","sonic-form-layout","sonic-input","sonic-password-helper","sonic-same-value-helper","sonic-input-autocomplete","sonic-radio","sonic-select","sonic-textarea","sonic-group","sonic-icon","sonic-image","sonic-link","sonic-loader","sonic-menu-item","sonic-menu","sonic-modal-actions","sonic-modal-close","sonic-modal-content","sonic-modal-subtitle","sonic-modal-title","sonic-modal","sonic-pop","sonic-progress","sonic-caption","sonic-tbody","sonic-td","sonic-tfoot","sonic-th","sonic-thead","sonic-tr","sonic-table","sonic-theme","sonic-toast-message-subscriber","sonic-toast-item","sonic-toast","sonic-tooltip"]
@@ -0,0 +1,113 @@
1
+ {
2
+ // "include": ["src/**/*"],
3
+ "exclude": ["node_modules/**/*", "dist/**/*", "vite.config.mts", "docs.ts", "docs/*"],
4
+ "compilerOptions": {
5
+ /* Visit https://aka.ms/tsconfig to read more about this file */
6
+
7
+ /* Projects */
8
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
9
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
10
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
11
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
12
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
13
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
14
+
15
+ /* Language and Environment */
16
+ "target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
17
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
18
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
19
+ "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
20
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
21
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
22
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
23
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
24
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
25
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
26
+ "useDefineForClassFields": false, /* Emit ECMAScript-standard-compliant class fields. */
27
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
28
+
29
+ /* Modules */
30
+ "module": "esnext", /* Specify what module code is generated. */
31
+ // "rootDir": "./src", /* Specify the root folder within your source files. */
32
+ "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
33
+ // "baseUrl": "./src", /* Specify the base directory to resolve non-relative module names. */
34
+ "paths": {
35
+ "@supersoniks/concorde/*":["./*"]
36
+ }, /* Specify a set of entries that re-map imports to additional lookup locations. */
37
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
38
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
39
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
40
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
41
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
42
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
43
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
44
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
45
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
46
+ "resolveJsonModule": true, /* Enable importing .json files. */
47
+ // "allowArbitraryExtensions": true, clear /* Enable importing files with any extension, provided a declaration file is present. */
48
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
49
+
50
+ /* JavaScript Support */
51
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
52
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
53
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
54
+
55
+ /* Emit */
56
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
57
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
58
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
59
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
60
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
61
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
62
+ // "outDir": "./development", /* Specify an output folder for all emitted files. */
63
+ // "removeComments": true, /* Disable emitting comments. */
64
+ "noEmit": true, /* Disable emitting files from a compilation. */
65
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
66
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
67
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
68
+ // "sourceRoot": "./src", /* Specify the root path for debuggers to find the reference source code. */
69
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
70
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
71
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
72
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
73
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
74
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
75
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
76
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
77
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
78
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
79
+
80
+ /* Interop Constraints */
81
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
82
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
83
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
84
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
85
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
86
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
87
+
88
+ /* Type Checking */
89
+ "strict": true, /* Enable all strict type-checking options. */
90
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
91
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
92
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
93
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
94
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
95
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
96
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
97
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
98
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
99
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
100
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
101
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
102
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
103
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
104
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
105
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
106
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
107
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
108
+
109
+ /* Completeness */
110
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
111
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
112
+ }
113
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M576 256C576 305 502.1 336 464.2 336H382.2L282.4 496C276.4 506 266.4 512 254.4 512H189.5C179.5 512 169.5 508 163.5 500C157.6 492 155.6 480.1 158.6 471L201.5 336H152.5L113.6 388C107.6 396 98.61 400 88.62 400H31.7C22.72 400 12.73 396 6.74 388C.7485 380-1.248 370 1.747 360L31.7 256L.7488 152C-1.248 143 .7488 133 6.74 125C12.73 117 22.72 112 31.7 112H88.62C98.61 112 107.6 117 113.6 125L152.5 176H201.5L158.6 41C155.6 32 157.6 21 163.5 13C169.5 5 179.5 0 189.5 0H254.4C265.4 0 277.4 7 281.4 16L381.2 176H463.2C502.1 176 576 208 576 256H576zM527.1 256C525.1 246 489.1 224 463.2 224H355.3L245.4 48H211.5L266.4 224H128.6L80.63 160H53.67L81.63 256L53.67 352H80.63L128.6 288H266.4L211.5 464H245.4L355.3 288H463.2C490.1 288 526.1 267 527.1 256V256z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M482.3 192c34.2 0 93.7 29 93.7 64c0 36-59.5 64-93.7 64l-116.6 0L265.2 495.9c-5.7 10-16.3 16.1-27.8 16.1l-56.2 0c-10.6 0-18.3-10.2-15.4-20.4l49-171.6L112 320 68.8 377.6c-3 4-7.8 6.4-12.8 6.4l-42 0c-7.8 0-14-6.3-14-14c0-1.3 .2-2.6 .5-3.9L32 256 .5 145.9c-.4-1.3-.5-2.6-.5-3.9c0-7.8 6.3-14 14-14l42 0c5 0 9.8 2.4 12.8 6.4L112 192l102.9 0-49-171.6C162.9 10.2 170.6 0 181.2 0l56.2 0c11.5 0 22.1 6.2 27.8 16.1L365.7 192l116.6 0z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "3.1.6",
3
+ "version": "3.1.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
File without changes
@@ -16,7 +16,10 @@ import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
16
16
  import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
17
17
  import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
18
18
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
19
- import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
19
+ import {
20
+ fontSize,
21
+ Size,
22
+ } from "@supersoniks/concorde/core/components/ui/_css/size";
20
23
  import { styleMap } from "lit/directives/style-map.js";
21
24
 
22
25
  const tagName = "sonic-textarea";
@@ -40,7 +43,7 @@ export class Textarea extends FormInput(FormElement(Subscriber(LitElement))) {
40
43
  // @property({ type: String })
41
44
  // type: "" | "primary" | "warning" | "danger" | "success" | "info" = "";
42
45
  // @property({ type: String }) variant: "" | "ghost" | "outline" = "";
43
- @property({ type: String }) size: "" | "xs" | "sm" | "lg" = "";
46
+ @property({ type: String }) size: Size = "md";
44
47
  @property({ type: Number }) rows?: number;
45
48
  @property({ type: Number }) cols?: number;
46
49
  @property({ type: Number }) maxlength?: number;
@@ -4,8 +4,19 @@ import { customElement, query, state, property } from "lit/decorators.js";
4
4
  import HTML, {
5
5
  SearchableDomElement,
6
6
  } from "@supersoniks/concorde/core/utils/HTML";
7
+ import { Theme } from "../theme/theme";
7
8
  // Toast
8
- type PopPlacement = "bottom" | "top" | "right" | "left";
9
+ type PopPlacement =
10
+ | "bottom"
11
+ | "top"
12
+ | "right"
13
+ | "left"
14
+ | "top"
15
+ | "bottom center"
16
+ | "top center"
17
+ | "right center"
18
+ | "left center";
19
+
9
20
  const tagName = "sonic-pop";
10
21
 
11
22
  @customElement(tagName)
@@ -213,48 +224,66 @@ export class Pop extends LitElement {
213
224
  }
214
225
 
215
226
  computePosition(placement: PopPlacement) {
227
+ const placementSplit = placement.split(" ");
228
+ const placementBase = placementSplit[0];
229
+ let placementSec = placementSplit[1];
216
230
  let contentRect = this.popContent?.getBoundingClientRect();
217
- const padding = 8;
218
- const shiftPadding = 5;
231
+ const padding = 5;
219
232
  const thisRect = this.getBoundingClientRect();
220
233
 
234
+ const scrollableAncestor = HTML.getScrollableAncestor(
235
+ this.popContent
236
+ ) as HTMLElement;
237
+ const scrollableAncestorRect = scrollableAncestor?.getBoundingClientRect();
238
+ const minX = Math.max(0, scrollableAncestorRect?.left || 0) + padding;
239
+ const minY = Math.max(0, scrollableAncestorRect?.top || 0) + padding;
240
+ const maxX =
241
+ Math.min(
242
+ window.innerWidth,
243
+ scrollableAncestorRect?.right || window.innerWidth
244
+ ) - padding;
245
+ const maxY =
246
+ Math.min(
247
+ window.innerHeight,
248
+ scrollableAncestorRect?.bottom || window.innerHeight
249
+ ) - padding;
221
250
  const x0 = thisRect.left;
222
251
  const y0 = thisRect.top;
223
252
  let x = x0,
224
253
  y = y0;
225
- const yTop = y0 - contentRect.height - padding;
226
- const xLeft = x0 - contentRect.width - padding;
227
- const xRight = x0 + thisRect.width + padding;
228
- const yBottom = y0 + thisRect.height + padding;
229
- switch (placement) {
254
+ const yTop = y0 - contentRect.height;
255
+ const xLeft = x0 - contentRect.width;
256
+ const xRight = x0 + thisRect.width;
257
+ const yBottom = y0 + thisRect.height;
258
+ const xCenter = x0 + (thisRect.width - contentRect.width) * 0.5;
259
+ const yCenter = y0 + (thisRect.height - contentRect.height) * 0.5;
260
+ switch (placementBase) {
230
261
  case "bottom":
231
262
  y = yBottom;
263
+ if (placementSec == "center") {
264
+ x = xCenter;
265
+ }
232
266
  break;
233
267
  case "top":
234
268
  y = yTop;
269
+ if (placementSec == "center") {
270
+ x = xCenter;
271
+ }
235
272
  break;
236
273
  case "left":
237
274
  x = xLeft;
275
+ if (placementSec == "center") {
276
+ y = yCenter;
277
+ }
238
278
  break;
239
279
  case "right":
240
280
  x = xRight;
281
+ if (placementSec == "center") {
282
+ y = yCenter;
283
+ }
241
284
  break;
242
285
  }
243
286
 
244
- // const dxRight = window.innerWidth - xRight - bodyRect.left - contentRect.width - shiftPadding;
245
- // if (dxRight < 0 && placement === "right") x = xLeft;
246
- // if (dxRight < 0 && ["top", "bottom"].includes(placement)) x = Math.max(x + dxRight, xLeft + thisRect.width);
247
-
248
- // const dxLeft = -bodyRect.left - xLeft;
249
- // if (dxLeft > shiftPadding && placement === "left") x = xRight;
250
-
251
- // const dyBottom = window.innerHeight - yBottom - bodyRect.top - contentRect.height - shiftPadding;
252
- // if (dyBottom < 0 && placement === "bottom") y = yTop;
253
- // if (dyBottom < 0 && ["left", "right"].includes(placement)) y = Math.max(y + dyBottom, yTop + thisRect.height);
254
-
255
- // const dyTop = -bodyRect.top - yTop;
256
- // if (dyTop > -shiftPadding && placement === "top") y = yBottom;
257
-
258
287
  this.lastContentX += x - contentRect.x;
259
288
  this.lastContentY += y - contentRect.y;
260
289
  Object.assign(this.popContent.style, {
@@ -263,21 +292,16 @@ export class Pop extends LitElement {
263
292
  });
264
293
 
265
294
  contentRect = this.popContent?.getBoundingClientRect();
266
- if (contentRect.x < shiftPadding && placement == "left") x = xRight;
267
- if (contentRect.y < shiftPadding && placement == "top") y = yBottom;
268
- if (
269
- contentRect.x + contentRect.width > window.innerWidth - shiftPadding &&
270
- placement == "right"
271
- )
295
+ if (contentRect.x < minX && placementBase == "left") x = xRight;
296
+ if (contentRect.y < minY && placementBase == "top") y = yBottom;
297
+ if (contentRect.x + contentRect.width > maxX && placementBase == "right")
272
298
  x = xLeft;
273
- if (
274
- contentRect.y + contentRect.height > window.innerHeight - shiftPadding &&
275
- placement == "bottom"
276
- )
299
+ if (contentRect.y + contentRect.height > maxY && placementBase == "bottom")
277
300
  y = yTop;
278
301
 
279
302
  this.lastContentX += x - contentRect.x;
280
303
  this.lastContentY += y - contentRect.y;
304
+
281
305
  Object.assign(this.popContent.style, {
282
306
  left: `${this.lastContentX}px`,
283
307
  top: `${this.lastContentY}px`,
@@ -285,19 +309,23 @@ export class Pop extends LitElement {
285
309
 
286
310
  contentRect = this.popContent?.getBoundingClientRect();
287
311
 
288
- if (contentRect.x < 0) {
289
- this.lastContentX += -contentRect.x;
312
+ if (contentRect.x < minX) {
313
+ this.lastContentX += minX - contentRect.x;
290
314
  }
291
- if (contentRect.y < 0) {
292
- this.lastContentY += -contentRect.y;
315
+ if (contentRect.y < minY) {
316
+ this.lastContentY += minY - contentRect.y;
293
317
  }
294
- if (contentRect.x + contentRect.width > window.innerWidth) {
295
- this.lastContentX +=
296
- window.innerWidth - (contentRect.x + contentRect.width);
318
+
319
+ Object.assign(this.popContent.style, {
320
+ left: `${this.lastContentX}px`,
321
+ top: `${this.lastContentY}px`,
322
+ });
323
+ contentRect = this.popContent?.getBoundingClientRect();
324
+ if (contentRect.x + contentRect.width > maxX) {
325
+ this.lastContentX += maxX - (contentRect.x + contentRect.width);
297
326
  }
298
- if (contentRect.y + contentRect.height > window.innerHeight) {
299
- this.lastContentY +=
300
- window.innerHeight - (contentRect.y + contentRect.height);
327
+ if (contentRect.y + contentRect.height > maxY) {
328
+ this.lastContentY += maxY - (contentRect.y + contentRect.height);
301
329
  }
302
330
 
303
331
  Object.assign(this.popContent.style, {
@@ -23,6 +23,28 @@ export class Theme extends LitElement {
23
23
  font-weight: var(--sc-font-weight-base);
24
24
  font-style: var(--sc-font-style-base);
25
25
  }
26
+ ::slotted(.sonic-pop-content) {
27
+ max-width: 80vw;
28
+ background-color: var(--sc-base);
29
+ position: fixed;
30
+ z-index: 99999;
31
+ display: block;
32
+ transform: translateY(1rem) scale(0.95);
33
+ pointer-events: none;
34
+ transition-duration: 0.15s;
35
+ transition-timing-function: ease;
36
+
37
+ transition-property: scale, opacity;
38
+ border-radius: min(calc(var(--sc-btn-rounded) * 2), 0.4em);
39
+ }
40
+
41
+ ::slotted(.sonic-pop-content).is-open:not(.is-empty) {
42
+ transform: translateY(0) scale(1);
43
+ opacity: 1;
44
+ pointer-events: auto;
45
+ transition-property: scale, opacity;
46
+ transition-timing-function: cubic-bezier(0.25, 0.25, 0.42, 1.225);
47
+ }
26
48
  `,
27
49
  ];
28
50
 
@@ -2,7 +2,7 @@
2
2
  /* eslint no-async-promise-executor: 0 */ // --> OFF
3
3
  export type SearchableDomElement = HTMLElement | ShadowRoot;
4
4
 
5
- import {APIConfiguration} from "./api";
5
+ import { APIConfiguration } from "./api";
6
6
  class HTML {
7
7
  /**
8
8
  * retourne la langue de la page courante telle que défini via l'attribut lang de la balise html
@@ -13,32 +13,66 @@ class HTML {
13
13
  return selectedLanguage || (documentLanguage as string);
14
14
  }
15
15
  static getCookies() {
16
- return document.cookie.split(";").reduce((previous: Record<string, string>, current) => {
17
- const eqIdx = current.indexOf("=");
18
- previous[current.substring(0, eqIdx).trim()] = current.substring(eqIdx + 1);
19
- return previous;
20
- }, {});
16
+ return document.cookie
17
+ .split(";")
18
+ .reduce((previous: Record<string, string>, current) => {
19
+ const eqIdx = current.indexOf("=");
20
+ previous[current.substring(0, eqIdx).trim()] = current.substring(
21
+ eqIdx + 1
22
+ );
23
+ return previous;
24
+ }, {});
21
25
  }
22
26
 
23
- static everyAncestors(node: SearchableDomElement, callback: (node: SearchableDomElement) => /*continue ?*/ boolean) {
27
+ static everyAncestors(
28
+ node: SearchableDomElement,
29
+ callback: (node: SearchableDomElement) => /*continue ?*/ boolean
30
+ ) {
24
31
  while (node) {
25
32
  const result = callback(node);
26
33
  if (!result) return;
27
- node = (node.parentNode || (node as ShadowRoot).host) as SearchableDomElement;
34
+ node = (node.parentNode ||
35
+ (node as ShadowRoot).host) as SearchableDomElement;
28
36
  }
29
37
  }
30
38
 
39
+ static getScrollableAncestor(node: SearchableDomElement) {
40
+ //Based on overflow-y: auto, overflow-y: scroll, overflow-y: hidden
41
+ while (node) {
42
+ const htmlNode = node as HTMLElement;
43
+ if (htmlNode.nodeType === 1) {
44
+ const style = window.getComputedStyle(htmlNode);
45
+ if (
46
+ // (htmlNode.scrollHeight > htmlNode.clientHeight &&
47
+ // (style?.overflowY === "auto" || style?.overflowY === "scroll")) ||
48
+ style?.overflowY === "hidden" ||
49
+ style?.overflowX === "hidden"
50
+ ) {
51
+
52
+ return node;
53
+ }
54
+ }
55
+ node = (node.parentNode ||
56
+ (node as ShadowRoot).host) as SearchableDomElement;
57
+ }
58
+ return null;
59
+ }
60
+
31
61
  /**
32
62
  * Va de parent en parent en partant de node pour trouver un attribut
33
63
  * @param attributeName nom de l'attribut
34
64
  * @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
35
65
  */
36
- static getAncestorAttributeValue(node: SearchableDomElement | null, attributeName: string): string | null {
66
+ static getAncestorAttributeValue(
67
+ node: SearchableDomElement | null,
68
+ attributeName: string
69
+ ): string | null {
37
70
  if (!node) return null;
38
71
  while (!("hasAttribute" in node && node.hasAttribute(attributeName))) {
39
72
  const newNode = node.parentNode || (node as ShadowRoot).host;
40
73
  if (!newNode) break;
41
- node = (node.parentNode || (node as ShadowRoot).host) as SearchableDomElement;
74
+ node = (node.parentNode ||
75
+ (node as ShadowRoot).host) as SearchableDomElement;
42
76
  }
43
77
  if (!("hasAttribute" in node)) {
44
78
  return null;
@@ -52,7 +86,8 @@ class HTML {
52
86
  */
53
87
  static getApiConfiguration(node: SearchableDomElement): APIConfiguration {
54
88
  const token = HTML.getAncestorAttributeValue(node, "token") as string;
55
- const addHTTPResponse = HTML.getAncestorAttributeValue(node, "addHTTPResponse") != null;
89
+ const addHTTPResponse =
90
+ HTML.getAncestorAttributeValue(node, "addHTTPResponse") != null;
56
91
  const serviceURL = HTML.getAncestorAttributeValue(node, "serviceURL");
57
92
  let userName = null;
58
93
  let password = null;
@@ -62,10 +97,25 @@ class HTML {
62
97
  userName = HTML.getAncestorAttributeValue(node, "userName");
63
98
  password = HTML.getAncestorAttributeValue(node, "password");
64
99
  }
65
- const credentials = (HTML.getAncestorAttributeValue(node, "credentials") as RequestCredentials) || undefined;
100
+ const credentials =
101
+ (HTML.getAncestorAttributeValue(
102
+ node,
103
+ "credentials"
104
+ ) as RequestCredentials) || undefined;
66
105
  const cache = (node as Element).getAttribute("cache") as RequestCache;
67
106
  const blockUntilDone = (node as Element).hasAttribute("blockUntilDone");
68
- return {serviceURL, token, userName, password, authToken, tokenProvider, addHTTPResponse, credentials, cache, blockUntilDone};
107
+ return {
108
+ serviceURL,
109
+ token,
110
+ userName,
111
+ password,
112
+ authToken,
113
+ tokenProvider,
114
+ addHTTPResponse,
115
+ credentials,
116
+ cache,
117
+ blockUntilDone,
118
+ };
69
119
  }
70
120
 
71
121
  /**
@@ -77,7 +127,8 @@ class HTML {
77
127
  while (!(node.nodeName && node.nodeName.toLowerCase() === selector)) {
78
128
  const newNode = node.parentNode || (node as ShadowRoot).host;
79
129
  if (!newNode) break;
80
- node = (node.parentNode || (node as ShadowRoot).host) as SearchableDomElement;
130
+ node = (node.parentNode ||
131
+ (node as ShadowRoot).host) as SearchableDomElement;
81
132
  }
82
133
  if (!node.nodeName) {
83
134
  return null;
File without changes